Summary
In SACC 2.2, Sacc.load_fits() (and Sacc.load) can no longer read gzip-compressed FITS files (e.g. mydata.sacc.gz). This worked in prior versions because the filename was passed directly to astropy.io.fits.open(), which transparently decompresses .gz inputs. SACC 2.2 introduced a new detect_sacc_file_type() pre-flight check that rejects compressed files before astropy ever sees them.
This is a regression for Firecrown: a SACC file that loaded fine on the previous version now raises ValueError with 2.2, even though the underlying data is valid and astropy can still read it directly.
Versions
sacc: 2.2
astropy: 7.2.0
Python: 3.14
Reproduction
import sacc
# A gzip-compressed FITS SACC file
sacc.Sacc.load_fits("mydata.sacc.gz")
Result on 2.2:
ValueError: Could not detect file type of mydata.sacc.gz from filename or file content.
Confirming the file is valid and that astropy reads it directly:
from astropy.io import fits
with fits.open("mydata.sacc.gz") as f: # works: transparent gzip decompression
print(len(f), "HDUs") # -> 22 HDUs
Root cause
load_fits() now calls detect_sacc_file_type() before opening the file.
Because the check happens before the file is handed to astropy, the native gzip support in astropy.io.fits.open() is bypassed.
Impact
Previously valid Firecrown workflows that relied on .gz-compressed FITS SACC files (smaller files in version control, on disk, and in data releases) now fail to load. Downstream code that simply called Sacc.load_fits(path) must add its own decompression step purely to satisfy the new detection logic.
Requested behavior
Restore the ability to load gzip-compressed FITS SACC files via Sacc.load_fits() and Sacc.load(), so that no change is required in downstream code.
If the SACC maintainers agree with the desire expressed in this PR, I am happy to implement it an submit a PR. If that is the case, please DM me in the DESC Slack.
Summary
In SACC 2.2, Sacc.load_fits() (and Sacc.load) can no longer read gzip-compressed FITS files (e.g. mydata.sacc.gz). This worked in prior versions because the filename was passed directly to astropy.io.fits.open(), which transparently decompresses .gz inputs. SACC 2.2 introduced a new detect_sacc_file_type() pre-flight check that rejects compressed files before astropy ever sees them.
This is a regression for Firecrown: a SACC file that loaded fine on the previous version now raises ValueError with 2.2, even though the underlying data is valid and astropy can still read it directly.
Versions
sacc: 2.2
astropy: 7.2.0
Python: 3.14
Reproduction
Result on 2.2:
Confirming the file is valid and that astropy reads it directly:
Root cause
load_fits() now calls detect_sacc_file_type() before opening the file.
Because the check happens before the file is handed to astropy, the native gzip support in astropy.io.fits.open() is bypassed.
Impact
Previously valid Firecrown workflows that relied on .gz-compressed FITS SACC files (smaller files in version control, on disk, and in data releases) now fail to load. Downstream code that simply called Sacc.load_fits(path) must add its own decompression step purely to satisfy the new detection logic.
Requested behavior
Restore the ability to load gzip-compressed FITS SACC files via Sacc.load_fits() and Sacc.load(), so that no change is required in downstream code.
If the SACC maintainers agree with the desire expressed in this PR, I am happy to implement it an submit a PR. If that is the case, please DM me in the DESC Slack.