Skip to content

Commit

Permalink
Correctly handle regular single-hdu fits files
Browse files Browse the repository at this point in the history
  • Loading branch information
ddobie committed Dec 7, 2023
1 parent d37f4dc commit bffb97b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vast_pipeline/image/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ def open_fits(fits_path: Union[str, Path], memmap: Optional[bool] = True):
hdul = fits.open(fits_path, memmap=memmap)

# This is a messy way to check, but I can't think of a better one
if type(hdul[1]) == fits.hdu.compressed.CompImageHDU:
if len(hdul) == 1:
return hdul
elif type(hdul[1]) == fits.hdu.compressed.CompImageHDU:
return fits.HDUList(hdul[1:])
else:
return hdul

0 comments on commit bffb97b

Please sign in to comment.