bd-j / prospector

Python code for Stellar Population Inference from Spectra and SEDs
http://prospect.readthedocs.io
MIT License
153 stars 71 forks source link

Changing how spectra are interpolated for smoothing with JWST/NIRSpec PRISM LSF #302

Open themiyan opened 8 months ago

themiyan commented 8 months ago

Attempts to fix an spectral interpolation issue when fitting lower resolution spectra JWST/NIRSpec PRISM spectra + photometry as noted in #298. Changed how the FSPS spectra are interpolated to the user supplied spectrum's wavelength grid. Changing numpy to Spectres package utilising numba seems to not have a significant effect on the run time.

karlglazebrook commented 7 months ago

yes, for low res data (e.g. NIRSPEC prism) the use ofnp.interp in the prospector code for the resampling step causes serious problems. This kind of linear interpolation really does not work in going from high-res models with lots of fine lines to low res NIRSPEC prism data.

As @themiyan mentioned when in our fitting we changed to spectres.spectres for this (one line change), which does binning up correctly by integrating pixels, that completely solved all our issues with fitting (including unrealistically small errors and poor chi^2 on the best fit).

This will affect anyone using Prospector to fit NIRSPEC PRISM spectra, (UNCOVER etc.) so it is probably worth informing people of this issue if you know they are working on this.