Spectral FITS WCS - #316
Conversation
…CS compound model.
…ce pixel keywords (CRPIX, CRVAL, CDELT) exactly. Updated tests and removed global optimization step.
…gthCalibration1D class.
…ation, docstrings, tests, and documentation for consistency with FITS WCS Paper III.
…ed FITS WCS to a Spectrum object. This creates a copy of the spectrum object out of necessity.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #316 +/- ##
==========================================
+ Coverage 92.25% 92.43% +0.17%
==========================================
Files 18 18
Lines 2234 2312 +78
==========================================
+ Hits 2061 2137 +76
- Misses 173 175 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
i suspect the RTD build failure here is the same as with the other two recent PRs... |
|
The two PRs had slightly different issues in their docs, but both should be fixed now. Also, I agree with dropping support for Python 3.11. I've now made Python 2.12 as the minium in these two PRs, and marked this to the changelog for specreduce 1.10 (the next release). |
| header = ws.wcs().to_header() | ||
| print(header) | ||
|
|
||
| * **Export a GWCS Object**: Access the `~gwcs.wcs.WCS` object representing the polynomial |
There was a problem hiding this comment.
might be useful to note here that GWCS maintains the full fidelity of the wavelength solution vs using an approximation to work around the constraints of the FITS standard.
| Boolean indicating whether the input wavelengths correspond to air rather than vacuum; | ||
| by default `False`, meaning vacuum wavelengths. | ||
| by default `False`, meaning vacuum wavelengths. The flag is also stored in the | ||
| wavelength solution, where it selects between the 'AWAV-GRA' and 'WAVE-GRI' axis |
There was a problem hiding this comment.
someone looking at this who is not familiar with Paper III (like me until i went back and read it) would think GRA refers to grating and GRI refers to grism. even the paper itself makes it confusing. should make it clear here or in other documentation that the FITS standard uses GRA to refer to a disperser working in air wavelengths, and GRI to one working in vacuum.
| return models.Polynomial1D(m.degree - 1, **coeffs) | ||
|
|
||
|
|
||
| def _make_grism_wcs( |
There was a problem hiding this comment.
i would personally say disperser instead of grism, but it does make sense to follow the terminology and conventions of the paper.
This PR adds:
WavelengthSolution1D.wcsmethod to calculate a spectral FITS WCS by fitting the grism dispersion function (Greisen et al. 2006) to the native polynomial solution. The WCS is returned as anastropy.wcs.WCSobject that can be easily serialised to a FITS header.WavelengthSolution1D.attach_wcsmethod to attach a (cached) FITS WCS to aSpectrumobject, after which the spectrum can be saved/read using the "wcs1d-fits" format.AI/LLM disclaimer: I used Claude Opus 5 and Claude Fable quite extensively during development (including in agentic mode). That said, I am well familiar with the code and can explain what it does and why.