Closed ashodkh closed 1 year ago
Thanks for the ticket @ashodkh. The smooth continuum is critical for getting good line-flux measurements, especially in the presence of broad-line emission. However, in the two examples you've highlighted, it's clear that the code isn't behaving as expected.
I'll play around with the algorithm. One idea is to switch to this new "smooth spline" implementation in scipy
, but please let me know if you have any other thoughts:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.make_smoothing_spline.html
@ashodkh I took a look at this ticket to see if there was a quick fix that wouldn't break other parts of the line-fitting (particularly the broad-line modeling).
I still think this is an important area of improvement, but in the meantime I (in a branch):
39627751547735909
got messed up);39627781696392988
was messed up).In general, these changes reduce the high-frequency smooth-continuum corrections while still being able to adapt to (low-frequency) calibration errors and spectra which are not well-fit by SPS models (i.e.g, most QSO spectra).
With these changes, here's the fit to 39627751547735909
with main
and with my branch, respectively (note especially the region around Halpha). There's still lots of (statistically insignificant) funny business in the blue part of the spectrum, but the interpolation across the Ha+[NII] complex is much better behaved.
Here's 39627781696392988
(before and after---note the very noisy NIR camera; it's not perfect but arguably not wrong due to a low-level mis-calibration of the camera edges, especially around [SII]).
And here's one of @Ragadeepika-Pucha's low-mass AGN, as a null test to make sure that things are still reasonably well-behaved:
And finally one of @VFawcett's totally crazy red quasars. This fit was never good, but at least the code doesn't crash!
If you're happy with these changes I'll get them merged in.
@moustakas These look great! Thank you!
I noticed that for some spectra the smooth continuum is drastically changing the flux (incorrectly) in some cases. This seems to be around H alpha but I haven't checked. As an example, https://fastspecfit.desi.lbl.gov/target/sv3-bright-26272-39627751547735909?index=1
This is the same spectrum without the smooth continuum:![Screen Shot 2023-05-01 at 5 51 10 PM](https://github.com/desihub/fastspecfit/assets/81383507/4f62fee3-3195-4720-9f6a-ace6b915ced2)
another example: https://fastspecfit.desi.lbl.gov/target/sv3-bright-26965-39627781696392988?index=1