Skip to content

Commit

Permalink
always mask strong lines; lower-order smooth-continuum fitting
Browse files Browse the repository at this point in the history
  • Loading branch information
moustakas committed Dec 5, 2024
1 parent f1289c1 commit e6a58ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions py/fastspecfit/continuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,10 @@ def _smooth_percamera(camwave, camflux, camivar, camlinemask):

# We supply estimates local inverse stddev in each window
# (i.e., how noisy the data is there) so that variation is
# down-weighted in noisier regions.
# down-weighted in noisier regions. Note: ext=3 means constant
# extrapolation.
if len(swave) > 3:
spl_flux = UnivariateSpline(swave, sflux, w=sisig, ext=3, k=3)
spl_flux = UnivariateSpline(swave, sflux, w=sisig, ext=3, k=2)
smoothflux = spl_flux(camwave)
else:
smoothflux = np.zeros_like(camflux)
Expand Down
8 changes: 5 additions & 3 deletions py/fastspecfit/linemasker.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,10 +838,12 @@ def fit_patches(continuum_patches, patchMap, linemodel,
snrpix = pix['snr']


# remove low signal-to-noise ratio lines from the mask
# remove low signal-to-noise ratio lines from the mask, but always keep
# the "expected" strong lines (see, e.g., CIV 1549 in
# sv3-dark-25960-39627770216580342).
linenames = snrpix.keys()
for linename in linenames:
if snrpix[linename] < minsnr_linemask:
for linename, isstrong in zip(linenames, EMFit.line_table[EMFit.line_in_range]['isstrong'].value):
if not isstrong and snrpix[linename] < minsnr_linemask:
log.debug(f'Removing {linename} from linepix: S/N={snrpix[linename]:.1f}<{minsnr_linemask:.1f}.')
linepix.pop(linename)

Expand Down

0 comments on commit e6a58ae

Please sign in to comment.