desihub / fastspecfit

Fast spectral synthesis and emission-line fitting of DESI spectra.
https://fastspecfit.readthedocs.org
BSD 3-Clause "New" or "Revised" License
13 stars 2 forks source link

Unreal fits because the fit does not converge to a final solution #52

Closed Ragadeepika-Pucha closed 2 years ago

Ragadeepika-Pucha commented 2 years ago

I found one galaxy (low-mass AGN from Reines+2013) where the fit does not converge to a solution leading to wrong emission line fluxes. The fastspecfit-qa for this sources is as follows -

image

Source Information: image

SDSS Information if needed: image

moustakas commented 2 years ago

It turns out that this particular fit didn't converge because of the too-large negative bound on the line-amplitudes, which in Everest was -1e3 (in standard DESI flux units).

In https://github.com/desihub/fastspecfit/commit/7bd53c9f577a9cdb7c9d7d91085f10d04b5432a4 I now adaptively determine sensible (but conservative) bounds on the amplitude of each emission line, immediately before fitting, which seems to be working OK but should be tested more.

With this change, here's the example posted. @Ragadeepika-Pucha can you verify whether this is satisfactory?

It might make sense to flag fits which may not have converged numerically to the data model, for post-facto inspection.

fastspec /global/cfs/cdirs/desi/spectro/redux/everest/healpix/main/bright/107/10702/redrock-main-bright-10702.fits \
  -o fastspec.fits --targetids 39633200246424565 --specprod everest
Screen Shot 2022-01-22 at 11 40 34 PM
Ragadeepika-Pucha commented 2 years ago

@moustakas - This looks good. Again, Can I have access to the result file for this one? Additionally, @stephjuneau and me were discussing finding examples of such sources which did not converge in everest. If I find such examples, we can probably use those to further test the changes.

moustakas commented 2 years ago

Should be significantly better now (see #69). Please reopen if the issue persists.