Skip to content

Commit

Permalink
make the continuum subtraction in self-calibration optional
Browse files Browse the repository at this point in the history
  • Loading branch information
segasai committed Oct 9, 2024
1 parent 7f500c5 commit d5c29cf
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions py/desispec/trace_shifts.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,21 +415,22 @@ def compute_dy_using_boxcar_extraction(xytraceset, image, fibers, width=7, degyy
"""

log=get_logger()
continuum_subtract = True # use continuum subtracted spectra to self-calibrate

# boxcar extraction

qframe = qproc_boxcar_extraction(xytraceset, image, fibers=fibers, width=7)

# resampling on common finer wavelength grid
flux, ivar, wave = resample_boxcar_frame(qframe.flux, qframe.ivar, qframe.wave, oversampling=4)
if continuum_subtract:
mflux, mivar, flux = _continuum_subtract_median(flux, ivar)
else:
# boolean mask of fibers with good data
good_fibers = (np.sum(ivar>0, axis=1) > 0)

# median flux of good fibers used as internal spectral reference
mflux=np.median(flux[good_fibers],axis=0)

# boolean mask of fibers with good data
# good_fibers = (np.sum(ivar>0, axis=1) > 0)

# median flux of good fibers used as internal spectral reference
# mflux=np.median(flux[good_fibers],axis=0)

mflux, mivar, flux = _continuum_subtract_median(flux, ivar)

# measure y shifts
wavemin = xytraceset.wavemin
Expand Down

0 comments on commit d5c29cf

Please sign in to comment.