Open stscijgbot-jp opened 6 months ago
Comment by Howard Bushouse on JIRA:
FYI, it is already possible to define multiple background regions via the extract1d
reference file, using the bkg_coeff
params. For example:
"region_type": "target",
"bkg_coeff": [[1.5],[7.5],[35.5],[41.5]],
"xstart": 10,
"xstop": 32,
"ystart": 5,
"ystop": 315,
"dispaxis": 2,```
results in 2 background regions, one running from x=1.5 to 7.5 (x axis, because dispaxis=2) and the other from 35.5 to 41.5, which is designed to flank the source extraction region, which runs from x=10-32.
See <https://jwst-pipeline.readthedocs.io/en/latest/jwst/extract_1d/description.html#background-extraction-regions> for docs about this.
It's also possible to request smoothing of the data in the bkg region(s), as well as polynomial fits (as a function of wavelength), which are then evaluated and subtracted at the wavelengths of source extractions.
Comment by Greg Sloan on JIRA:
So this Jira ticket is almost a Helpdesk ticket masquerading as a JP ticket. Almost. One element of the algorithm as described is to median the background spectra. For salt-and-pepper noise in the mid-IR, this is important. Perhaps that is already there, too?
Comment by Sarah Kendrew on JIRA:
yes the 'bkg_fit' parameter lets you choose 'median' or 'mean'.
Issue JP-3545 was created on JIRA by Greg Sloan:
It would be helpful if users can run the pipeline with one or two background fields defined in the JSON file for extraction.
Here's a rough outline of how that could work:
The simpler algorithm:
1) JSON file defines 1 science aperture and 0-2 background apertures 2) Extract science spectrum from science aperture If no background apertures are defined, this is the final step 3) To extract a background spectrum (from each aperture) a) normalize each column (for LRS) in aperture b) take median spectrum from columns in aperture 4) If 2 background apertures defined, combine by taking mean of 2 background spectra 5) Subtract combined background spectrum from extracted science spectrum
The simpler method for 2 background apertures really requires that the background apertures be symmetric around the science aperture to properly correct for any linear gradients.
A more sophisticated algorithm could remove background gradients, but would have to operate on the spectral image in question.
1) Decision: If 1 background aperture is defined, the simpler algorithm should be used. If 2 background apertures are defined, then: 2) Generate an estimated background image by fitting a line to the data in the defined background columns in each row (for the LRS) 3) Subtract this background image from the science image 4) Extract the science spectrum in the science aperture
For TSOs, each integration would be treated individually.