Closed drvdputt closed 1 year ago
Great summary @drvdputt. Do we think this functionality should live in instrument.py? Seems sensible to be able to pass the user-supplied spectral-range as an optional parameter, check it for the "lenient warning" or error, then proceed to use its values as the min/max range for hard or "near_fwhm" based cutoffs. This avoid repeating the logic twice: one for the instrument pack configured coverage range, and again for the actual user-supplied coverage. Thoughts?
Yes that sounds reasonable. The instrument module checks if the range given by the user is reasonable with respect to the instrument, and will decide if we quit, or continue using the given data. Something likeinstrument.validate_wave_grid(segments, wave_micron)
. After that point, it is assumed that the data are OK, and we can to the feature trimming based on the wavelength range from the data.
Not sure how we are going to handle the disjoint case though. Need a way to identify the gap in the wavelength grid, and drop features based on that (if we don't use the information about the instrument).
Perhaps this is solvable if we figure out the right thing to do in validate_wave_grid()
, and provide a return value containing the ranges where we want our features. Something like ((start, stop), (start, stop)) pairs, that tell you where the instrument model and the given wavelength grid overlap, and therefore which features we want to keep.
This is now supported with glob-style instrument specification, and the (mandatory) instrument.check_range
function.
The new paradigm uses instrument packs that define FWHM etc of a single segment. But we still expect many users to only have merged spectral data (or even, it might take a while until we get the 'separate segments' type of fitting to work). The changes in #222 (integrated from #229 ) have introduced a concept of a 'merged' instrument model. Lines in the overlap regions are given a variable width, while lines covered by a unique instrument segment have fixed widths that are defined by the instrument pack.
After todays discussion, we came across separate but related challenges that come with this.
After some discussion, a workable way is as follows: