zkbt / mosasaurus

Tools for extracting chromatic lightcurves from MultiObject Spectrograph data.
MIT License
3 stars 1 forks source link

Wavelength re-calibration for multiple data sets #22

Closed hdiamondlowe closed 5 years ago

hdiamondlowe commented 5 years ago

As it stands now, mosasaurus cross-correlates all spectra within a data set against a single, master spectrum from that data set. This works well to align spectra to within ~0.25 nm across a data set.

However, down the road we will want to do a joint-fit across multiple data sets, and even across multiple instruments (with comparable wavelength coverage). It would be nice to have the option to direct mosasaurus to the extracted spectrum of another data set in order to do the re-calibration.

This seems reasonable to do with a simple hack, but will require some thinking to make a nice user prompt and an easy way to designate a master spectrum across multiple data sets.

hdiamondlowe commented 5 years ago

I think this is an actual issue that may be worth fixing now. When combining multiple data sets, not re-calibrating against a single common spectrum basically erases all the helpfulness that the wavelength re-calibration does in the first place. In this figure, spectra of the same color are from the same data set, solid lines are the target spectrum, dotted lines are the comparison star spectrum.

jointSpectraMisaligned

To address this I'm adding an optional input to the instantiation of WavelengthRecalibrator.py where you can include a path to a shifted cube (or maybe the unshifted one? Not sure yet). It is then necessary to redefine the 'left' and 'right' ranges of the line to calibrate against, but for the user-defined master spectrum.

hdiamondlowe commented 5 years ago

This has been fixed! There is now an optional string that points to an "outsidecube." The default is an empty string, which the user can change when instantiating WavelengthRecalibrator.py. If the user wants to calibrate against another cube (preferably, an already shifted one), they can put the path to that cube in the string (as seen here).

jointSpectraAligned

This fix works for both LDSS3C and IMACS. It should work for other instruments, provided that there is enough wavelength overlap between the "outsidecube" and the working data set.

This fix is committed on the IMACS branch. I will try to merge (again) the IMACS branch to the master.