specutils
specutils copied to clipboard
First Pass WCS extract region bound fix
Addresses #869
@PatrickOgle identified a bug in extract_regions
where the WCS wavelength reference value (CRVAL0) wasn't being updated to the new bounds of the extracted region. Implemented Patrick's solution in this PR. Still need to figure out what the appropriate solution would be for GWCS though...
Poked around in SpectralGWCS, other than adjusting the size of the bounding box, I'm not sure if I can see a place where an equivalent slice would be appropriate, or even possible. I'm not sure, and the ticket #869 doesn't suggest, this problem exists with SpectralGWCS defined WCS's, so I'm going to mark this ready for review and request someone who knows better than I do clarify!
@duytnguyendtn I am not familiar with GWCS and have not tried to use spectral_slab on it. We can either:
- Test this PR on a Spectrum1D with GWCS
- ...OR file a ticket for GWCS later if there is problem ...your choice.
As discussed, if we want to revisit, the solution should adhere to APE 14 high-level API if possible. That way, it would naturally work for both FITS WCS and GWCS.