Skip to content

Commit

Permalink
make sure arcs are still processed with continuum as before
Browse files Browse the repository at this point in the history
  • Loading branch information
segasai committed Oct 9, 2024
1 parent 764d413 commit ee20370
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion py/desispec/scripts/trace_shifts.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ def fit_trace_shifts(image, args):
internal_wavelength_calib = False
elif flavor == "arc" :
internal_wavelength_calib = True
subtract_continuum = False
args.arc_lamps = True
else :
subtract_continuum = True
internal_wavelength_calib = True
args.sky = True
log.info("wavelength calib, internal={}, sky={} , arc_lamps={}".format(internal_wavelength_calib,args.sky,args.arc_lamps))
Expand Down Expand Up @@ -196,7 +198,7 @@ def fit_trace_shifts(image, args):
x_for_dx,y_for_dx,dx,ex,fiber_for_dx,wave_for_dx = compute_dx_from_cross_dispersion_profiles(xcoef,ycoef,wavemin,wavemax, image=image, fibers=fibers, width=args.width, deg=args.degxy,image_rebin=args.ccd_rows_rebin)
if internal_wavelength_calib :
# measure y shifts
x_for_dy,y_for_dy,dy,ey,fiber_for_dy,wave_for_dy = compute_dy_using_boxcar_extraction(tset, image=image, fibers=fibers, width=args.width)
x_for_dy,y_for_dy,dy,ey,fiber_for_dy,wave_for_dy = compute_dy_using_boxcar_extraction(tset, image=image, fibers=fibers, width=args.width, subtract_continuum=subtract_continuum)
mdy = np.median(dy)
log.info("Subtract median(dy)={}".format(mdy))
dy -= mdy # remove median, because this is an internal calibration
Expand Down
5 changes: 3 additions & 2 deletions py/desispec/trace_shifts.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ def compute_dy_from_spectral_cross_correlations_of_frame(flux, ivar, wave , xcoe

return x_for_dy,y_for_dy,dy,ey,fiber_for_dy,wave_for_dy

def compute_dy_using_boxcar_extraction(xytraceset, image, fibers, width=7, degyy=2) :
def compute_dy_using_boxcar_extraction(xytraceset, image, fibers, width=7, degyy=2,
continuum_subtract = False):
"""
Measures y offsets (internal wavelength calibration) from a preprocessed image and a trace set using a cross-correlation of boxcar extracted spectra.
Uses boxcar_extraction , resample_boxcar_frame , compute_dy_from_spectral_cross_correlations_of_frame
Expand All @@ -406,6 +407,7 @@ def compute_dy_using_boxcar_extraction(xytraceset, image, fibers, width=7, degyy
fibers : 1D np.array of int (default is all fibers, the first fiber is always = 0)
width : int, extraction boxcar width, default is 7
degyy : int, degree of polynomial fit of shifts as a function of y, used to reject outliers.
continuum_subtract : bool if true subtract continuum before cross-correlation
Returns:
x : 1D array of x coordinates on CCD (axis=1 in numpy image array, AXIS=0 in FITS, cross-dispersion axis = fiber number direction)
Expand All @@ -418,7 +420,6 @@ 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)
Expand Down

0 comments on commit ee20370

Please sign in to comment.