Skip to content

Commit 2f1b3c6

Browse files
committed
Fix creation of cube source from file name
1 parent 3cb4fd0 commit 2f1b3c6

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

scopesim/source/source.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,15 @@ def _from_cube(self, cube, ext=0, **kwargs):
324324
wcs = WCS(cube)
325325
else:
326326
with fits.open(cube) as hdul:
327-
data = hdul[ext].data
328-
header = hdul[ext].header
329-
header["FILENAME"] = Path(cube).name
330-
wcs = WCS(cube)
327+
try:
328+
data = hdul[ext].data
329+
header = hdul[ext].header
330+
header["FILENAME"] = Path(cube).name
331+
wcs = WCS(header)
332+
except ValueError: # e.g. TAB WCS
333+
self._from_cube(hdul, ext)
334+
self.fields[0].header["FILENAME"] = Path(cube).name
335+
return
331336

332337
try:
333338
bunit = header["BUNIT"]

0 commit comments

Comments
 (0)