Skip to content

Commit

Permalink
adding post-fit rejection of gaussian parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmejia committed Oct 24, 2024
1 parent ba8c7af commit 9087855
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions python/lvmdrp/core/spectrum1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -3403,7 +3403,18 @@ def fitSepGauss(
flux[i], cent[i], fwhm[i] = gauss.getPar()
fwhm[i] *= 2.354

# mask line if >=2 pixels are masked within 3.5sigma
model_badpix = data[select] == 0
x = self._wave[select].copy()
if not numpy.isnan([cent[i], fwhm[i]]).any():
select_2 = (self._wave>=cent[i]-3.5*fwhm[i]/2.354) & (self._wave<=cent[i]+3.5*fwhm[i]/2.354)
x = self._wave[select_2]
model_badpix = mask[select_2]
if model_badpix.sum() >= 2:
flux[i] = cent[i] = fwhm[i] = bg[i] = numpy.nan

if axs is not None:
axs[i].axvspan(x[0], x[-1], alpha=0.1, fc="0.5", label="reg. of masking")
axs[i] = gauss.plot(self._wave[select], self._data[select], mask=self._mask[select], ax=axs[i])
axs[i].axvline(cent_guess[i], ls="--", lw=1, color="tab:red", label="cent. guess")
axs[i].set_title(f"{axs[i].get_title()} @ {cent[i]:.1f} (pixel)")
Expand Down

0 comments on commit 9087855

Please sign in to comment.