Bug in wcs1d-fits reader and flux_unit
I'm pretty sure there's a bug in the wcs1d-fits reader. I have some spectra that have BUNIT = erg/A/s/cm2. This is not able to be parsed into erg / (Angstrom s cm2), which I am "ok" with but the bigger issue is that if I give flux_unit = u.Unit("erg / (angstrom s cm2)") , I get an "unable to convert" error. The expected behavior is for flux_unit to IGNORE BUNIT, not try to convert to it. I'll upload an example file later.
Is it getting confused by angstrom versus Angstrom?
No, it's the A. It doesn't assume A = angstrom
The expected behavior is for flux_unit to IGNORE BUNIT, not try to convert to it.
Converting from BUNIT to the input flux_unit is the documented intended behavior, based on the docstring:
flux_unit: str or `~astropy.Unit`, optional
Units of the flux for this spectrum. If not given (or None), the unit will be inferred
from the BUNIT keyword in the header. Note that this unit will attempt to convert
from BUNIT if BUNIT is present
and from the top level of the wcs1d-fits loader docstring:
The flux unit of the spectrum is
determined by the 'BUNIT' keyword of the HDU (if present), while the
spectral axis unit is set by the WCS's 'CUNIT'.