LRS slit 1d spectral extraction does not account for dithers
stscijgbot-jp opened this issue · comments
Issue JP-3556 was created on JIRA by David Law:
Investigation on ticket https://jira.stsci.edu/projects/JP/issues/JP-3547 turned up some specific issues with LRS 1d spectral extraction. In particular, the CRDS extract1d reference file ([https://jwst-crds.stsci.edu/browse/jwst_miri_extract1d_0005.json)] specifies that extraction should happen between columns 27 and 34 of the s2d file, but no account is then made of dither offsets. As a result, 1d spectra extracted from all except one dither/nod position will always be performed at the incorrect location, producing spectra that can be negative or arbitrarily different depending on how the box overlaps with the trace location.
I believe the history is that use_source_posn (using RA/DEC information about the source) was disabled, because pointing information and source RA/DEC location information isn't always accurate enough and sometimes resulted in extracting the wrong location. The switch to columns 27-34 meant that the correct location was used for one of the two nods, and the combined mosaic of two standard nods, but not in general.
Ideally, it may be better to be able to specify extraction at the 'default' locations in some way other than pixel space. This could then handle both dither offsets and any potential scale changes coming from the pixel_scale_ratio keyword. The nominal slit center in V2/V3 is well known. Dither information (XOFFSET/YOFFSET) is recorded in the Ext1 header, but unfortunately this is given in Ideal coordinates, which are rotated with respect to V2/V3 by an amount not given in the headers without querying SIAF for the aperture name in use.
Indeed, maybe it would be better yet to 'find' the source in any given s2d image by looking for the location of the brightest trace?
Unsure what the best solution is, or how this may impact other instruments, but opening this ticket to start a discussion.
Comment by Tyler Pauly on JIRA:
See also JP-3244 and JP-3482 for related updates/issues. For some reason I thought use_source_posn had been set to True for LRS-FIXEDSLIT, but that doesn't appear to be the case.
Thanks Tyler Pauly . It sounds like this work essentially fixed the --use_source_posn flag, and the reason that LRS slit isn't benefiting from that is because the CRDS reference file sets use_source_posn=False. In which case, the solution is just to update the reference file. Sarah Kendrew said as much in an email a couple weeks ago that I'd forgotten.
Given this I'll close this ticket as unnecessary.
One question though: in PR-7796, I see that it uses the model MIRI_AB2Slice. This is an MRS model function though, so why is it used for LRS? Although looking at it further, it seems this change might have nothing to do with the rest of the PR?
Comment by Tyler Pauly on JIRA:
I believe that the MIRI_AB2Slice lines were altered due to a change in how imports were written - no implementation change, though.