spacetelescope / jwst

Python library for science observations from the James Webb Space Telescope
https://jwst-pipeline.readthedocs.io/en/latest/
Other
571 stars 167 forks source link

MIRI LRS use_source_posn setting also offsets the background aperture #8104

Open stscijgbot-jp opened 1 year ago

stscijgbot-jp commented 1 year ago

Issue JP-3481 was created on JIRA by Sarah Kendrew:

The change implemented with JP-3244 improved the functionality of the use_source_posn keyword for spectral extraction in MIRI LRS observations. When set to True, the code now accurately computes the dither offset and places the aperture in the right place for nodded exposures as well as combined products. However in the case where a user provides a background region to subtract the background as part of the extract_1d step (rather than the default nod-subtraction method), the background region is now also offset by the computed amount, often placing the background region outside of the slit region. 

I think it would be more accurate if only the xstart/xstop or source_coeff parameters were offset, not the background region. 

 

Leaving it to the LRS leads Greg Sloan Katherine Murray  to prioritize. 

stscijgbot-jp commented 9 months ago

Comment by Juergen Schreiber on JIRA:

But if you have a background defined symmetrically around nod 1 source position inside the slit, the offset background position should be also symmetrically around nod 2 source position inside the slit, isn't it? Or do I understand the offsetting wrongly?

stscijgbot-jp commented 9 months ago

Comment by Sarah Kendrew on JIRA:

sure but the background has to be provided in absolute coordinates, not relative to the source centroid. perhaps this doesn't require a code change, but more pointing out to users that if they want to provide the background region as part of the spectral extraction, they should keep use_source_posn set to False. (it would maybe be nice to be able to provide background regions relative to the source centroid, e.g. (-14, -10), (10, 14))

stscijgbot-jp commented 5 months ago

Comment by Sarah Kendrew on JIRA:

If you provide a background aperture in the spectral extraction reference file, you provide column numbers in absolute numbers, not relative to the source location. You have to provide separate extraction reference files for each nod position if you want to take this approach. For example:

"bkg_coeff": [[0.5],[4.5], [38.5],[42.5]],

"bkg_fit": "median"

uses two sets of 4 columns to compute a median background assuming the target is centred on column 16/17. However, if use_source_position is set to True, and the pipeline applies an offset of e.g. 5 pixels, then the background aperture will also be offset by that amount, pushing it to unphysical values. 

This is not our default background extraction strategy so it's not a critical priority - but it does create potential inconsistencies that need to be documented; or we could implement an ability to provide background apertures relative to the source location. The prioritization of this needs to come from the LRS team, Greg Sloan , Katherine Murray and Andreea Petric .