Skip to content

Commit

Permalink
Don't default optimal extraction to background subtraction
Browse files Browse the repository at this point in the history
  • Loading branch information
melanieclarke committed Nov 26, 2024
1 parent a9e3a45 commit d19a2e1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions jwst/extract_1d/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,11 @@ def get_extract_parameters(ref_dict, input_model, slitname, sp_order, meta,
extract_params['src_coeff'] = aper.get('src_coeff')
extract_params['bkg_coeff'] = aper.get('bkg_coeff')

if ((extract_params['bkg_coeff'] is not None
or extraction_type == 'optimal')
and subtract_background is not False):
if (extract_params['bkg_coeff'] is not None
and subtract_background is None):
subtract_background = True

if subtract_background:
extract_params['subtract_background'] = True
if bkg_fit is not None:
# Mean value for background fitting is equivalent
Expand All @@ -306,8 +308,8 @@ def get_extract_parameters(ref_dict, input_model, slitname, sp_order, meta,
else:
extract_params['bkg_fit'] = aper.get('bkg_fit', 'poly')
else:
extract_params['bkg_fit'] = None
extract_params['subtract_background'] = False
extract_params['bkg_fit'] = None

extract_params['independent_var'] = aper.get('independent_var', 'pixel').lower()

Expand Down Expand Up @@ -380,6 +382,7 @@ def log_initial_parameters(extract_params):
log.debug(f"smoothing_length = {extract_params['smoothing_length']}")
log.debug(f"independent_var = {extract_params['independent_var']}")
log.debug(f"use_source_posn = {extract_params['use_source_posn']}")
log.debug(f"subtract_background = {extract_params['subtract_background']}")
log.debug(f"extraction_type = {extract_params['extraction_type']}")


Expand Down

0 comments on commit d19a2e1

Please sign in to comment.