From e830bf6daeb147cd6dd0725f5048a28fa125cfc3 Mon Sep 17 00:00:00 2001 From: Kathleen Labrie Date: Mon, 5 Oct 2026 08:52:08 -1000 Subject: [PATCH] Better handling of the "no data" extensions present in GHOST bundle. ad.info() was crashing on them. --- astrodata/core.py | 3 ++- astrodata/fits.py | 3 ++- astrodata/nddata.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/astrodata/core.py b/astrodata/core.py index 819c6f5a..dad8b603 100644 --- a/astrodata/core.py +++ b/astrodata/core.py @@ -1000,11 +1000,12 @@ def _pixel_info(self): other_objects.append(obj_dict) + data_type = nd.data.dtype.name if nd.data.shape != () else "" main_dict = { "content": "science", "type": type(nd).__name__, "dim": str(nd.data.shape), - "data_type": nd.data.dtype.name, + "data_type": data_type, } out_dict = { diff --git a/astrodata/fits.py b/astrodata/fits.py index 81a72977..794114e1 100644 --- a/astrodata/fits.py +++ b/astrodata/fits.py @@ -496,7 +496,8 @@ def header(self): def data(self): """The data of the HDU.""" res = self._create_result(self.shape) - res[:] = self._scale(self._obj.data) + if self._obj.data is not None: + res[:] = self._scale(self._obj.data) return res @property diff --git a/astrodata/nddata.py b/astrodata/nddata.py index 0b314d3a..356ce1d8 100644 --- a/astrodata/nddata.py +++ b/astrodata/nddata.py @@ -596,7 +596,8 @@ def _get_simple(self, target, section=None): if is_lazy(source): if section is None: ret = np.empty(source.shape, dtype=source.dtype) - ret[:] = source.data + if source.shape != (): + ret[:] = source.data setattr(self, target, ret) else: