From bffb97b06bd0f8b3afd212fcb7a0196ad2260cc2 Mon Sep 17 00:00:00 2001 From: Dougal Dobie Date: Fri, 8 Dec 2023 09:40:51 +1100 Subject: [PATCH] Correctly handle regular single-hdu fits files --- vast_pipeline/image/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vast_pipeline/image/utils.py b/vast_pipeline/image/utils.py index cd93715f..15201753 100644 --- a/vast_pipeline/image/utils.py +++ b/vast_pipeline/image/utils.py @@ -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