specreduce
specreduce copied to clipboard
Wavelength solution
Given an uncalibrated data set, create a wavelength solution transforming from pixel space to wavelength
I have successfully obtained wavelength solutions using header information and NIST lines. But the method might not be general enough. Anyway I'd be interested in working on this.
Gemini's prototype wavelength calibration routine (by Chris Simpson) is determineWavelengthSolution in https://github.com/GeminiDRSoftware/DRAGONS/blob/master/geminidr/core/primitives_spect.py [updated Apr 2020]. That matches a 1D vector to a line list by constructing something like a binary (actually k-d) tree and calibrates λ(x) for it. A separate "primitive" called determineDistortion calibrates the 2D variations with respect to the reference vector and these models can be combined (at some point using gwcs) to map detector pixels to wavelength and vice versa.
The code at this level is rather tied to our pipeline system, though the heavy lifting is done by some library code in the gempy module that's a bit more generic (some of the latter routines do still use our data access class, AstroData, which is like a collection of NDData and is also worth a look).
This is a complicated issue and I'm not sure there's a one-size-fits-all for every type of data so I think there should be a flexibility to choose a particular method. So there should perhaps be some sort of API for the low-level code that does the actual work, e.g., it takes a numpy array of pixel locations of peaks, an optional array of measured line strengths in the data, a numpy array of line wavelengths, and an optional array of predicted line strengths, and returns a Model instance to map pixel->wavelength (and perhaps its inverse?).