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

bug: estimate of observed peak-amplitude can be incorrect #173

Closed moustakas closed 1 day ago

moustakas commented 2 months ago

@jdbuhler has found that the code used to estimate the (observed, not model) amplitude of certain emission lines can be grossly incorrect.

One example is HBETA_AMP on sv1/bright/5060/39632929894174164-- https://fastspecfit.desi.lbl.gov/target/sv1-bright-5060-39632929894174164

The main branch of the code gives ~1e-5, whereas the correct answer is ~2.3 (slightly smaller than the model amplitude, ~2.6, as expected).

The bug is here, where I compute which camera the line falls in-- https://github.com/desihub/fastspecfit/blob/main/py/fastspecfit/emlines.py#L1029

The emission line is in fact on the red side of the blue camera, but the code returns the red camera, and so it misses the line completely.

This bug probably affects a pretty significant number of objects, but those objects can be identified by looking for very large differences between MODELAMP and AMP.

moustakas commented 1 day ago

Fixed in #177.