Skip to content

Commit 8147b65

Browse files
authored
JP-3307: Determine source position in slit from TA verification image for MIRI LRS (#10011)
1 parent 21d681b commit 8147b65

34 files changed

+1757
-104
lines changed

changes/10011.associations.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add TA verification images to spec2 associations for MIRI LRS fixed-slit and slitless data

changes/10011.pipeline.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add new step ``targ_centroid`` to spec2 pipeline for MIRI LRS fixed-slit and slitless data, off by default

changes/10011.targ_centroid.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Initial implementation of the step. Finds x,y position of target on detector based on TA verification images (if available) for MIRI LRS fixed-slit and slitless data.

changes/README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Stage 2
5454
- ``<PR#>.master_background.rst``
5555
- ``<PR#>.wavecorr.rst``
5656
- ``<PR#>.srctype.rst``
57+
- ``<PR#>.targ_centroid.rst``
5758
- ``<PR#>.straylight.rst``
5859
- ``<PR#>.wfss_contam.rst``
5960
- ``<PR#>.flatfield.rst``

docs/jwst/package_index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Package Index
6464
stpipe/index.rst
6565
straylight/index.rst
6666
superbias/index.rst
67+
targ_centroid/index.rst
6768
tso_photometry/index.rst
6869
tweakreg/index.rst
6970
wavecorr/index.rst

docs/jwst/pipeline/calwebb_spec2.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ TSO exposures. The instrument mode abbreviations used in the table are as follow
6161
+----------------------------------------------------------+-----+-----+-----+-----+-----+-----+-----------------+------+--------+-----+
6262
| :ref:`srctype <srctype_step>`\ :sup:`1` | |c| | |c| | |c| | |c| | |c| | |c| | |c| | |c| | |c| | |c| |
6363
+----------------------------------------------------------+-----+-----+-----+-----+-----+-----+-----------------+------+--------+-----+
64+
| :ref:`targ_centroid <targ_centroid_step>` :sup:`2` | | | | |c| | |c| | | | | | |
65+
+----------------------------------------------------------+-----+-----+-----+-----+-----+-----+-----------------+------+--------+-----+
6466
| :ref:`master_background <master_background_step>` | | |c| | | | | | | | | |
6567
+----------------------------------------------------------+-----+-----+-----+-----+-----+-----+-----------------+------+--------+-----+
6668
| :ref:`wavecorr <wavecorr_step>` | |c| | |c| | | | | | | | | |

docs/jwst/references_general/references_general.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ documentation on each reference file.
178178
+-------------------------------------------------------+--------------------------------------------------+
179179
| :ref:`superbias <superbias_step>` | :ref:`SUPERBIAS <superbias_reffile>` |
180180
+-------------------------------------------------------+--------------------------------------------------+
181+
| :ref:`targ_centroid <targ_centroid_step>` | :ref:`FILTEROFFSET <filteroffset_reffile>` |
182+
+-------------------------------------------------------+--------------------------------------------------+
181183
| :ref:`tso_photometry <tso_photometry_step>` | :ref:`GAIN <gain_reffile>` |
182184
+-------------------------------------------------------+--------------------------------------------------+
183185
| :ref:`wavecorr <wavecorr_step>` | :ref:`WAVECORR <wavecorr_reffile>` |
@@ -221,6 +223,8 @@ documentation on each reference file.
221223
| :ref:`FFLAT <fflat_reffile>` | :ref:`flatfield <flatfield_step>` |
222224
+--------------------------------------------------+-------------------------------------------------------+
223225
| :ref:`FILTEROFFSET <filteroffset_reffile>` | :ref:`assign_wcs <assign_wcs_step>` |
226+
+ +-------------------------------------------------------+
227+
| | :ref:`targ_centroid <targ_centroid_step>` |
224228
+--------------------------------------------------+-------------------------------------------------------+
225229
| :ref:`FLAT <flat_reffile>` | :ref:`clean_flicker_noise <clean_flicker_noise_step>` |
226230
| +-------------------------------------------------------+
@@ -530,6 +534,7 @@ S_SRCCAT Source catalog creation
530534
S_SRCTYP Source type determination
531535
S_STRAY Straylight correction
532536
S_SUPERB Superbias subtraction
537+
S_TACNTR Source position from TA verification image
533538
S_TELEMI Telescope emission correction
534539
S_TSPHOT TSO imaging photometry
535540
S_TWKREG Tweakreg image alignment
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Step Arguments
2+
==============
3+
4+
The ``targ_centroid`` step has the following optional arguments to control
5+
the behavior of the processing.
6+
7+
``--ta_file`` (string, default=None)
8+
Path to a target acquisition verification image file. If provided, the
9+
step will use this file to determine the target acquisition offsets. If not
10+
provided, the step will attempt to find the appropriate verification image
11+
in the input association. If no verification image is found in either location,
12+
the step will skip processing.

docs/jwst/targ_centroid/index.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.. _targ_centroid_step:
2+
3+
=======================
4+
Target Centroiding Step
5+
=======================
6+
7+
.. toctree::
8+
:maxdepth: 1
9+
10+
main.rst
11+
arguments.rst
12+
reference_files.rst
13+
14+
.. automodapi:: jwst.targ_centroid

docs/jwst/targ_centroid/main.rst

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
Description
2+
===========
3+
4+
:Class: `jwst.targ_centroid.TargCentroidStep`
5+
:Alias: targ_centroid
6+
7+
The ``targ_centroid`` step determines the location of a point source in the detector
8+
frame using the target acquisition (TA) verification image. The measured source
9+
position is used by downstream calibration steps, such as
10+
:ref:`pathloss <pathloss_step>`, to apply corrections that account
11+
for source positioning within the aperture.
12+
13+
This step is applicable to MIRI Low-Resolution Spectrometer (LRS) observations
14+
where a TA verification image is available. Pre-launch assumptions that telescope
15+
pointing information would be sufficient for accurate pathloss corrections have
16+
been superseded by in-flight experience, which demonstrates the need to use
17+
actual TA verification images when available.
18+
19+
Upon successful completion of this step, the status keyword S_TACNTR is
20+
set to "COMPLETE", the position of the source in the TA verification is stored in
21+
the model's ``ta_xpos`` and ``ta_ypos`` attributes (FITS keywords TA_XPOS and TA_YPOS),
22+
and the expected source position in the science exposure, applying any
23+
necessary filter offset, is stored in the model's
24+
``source_xpos`` and ``source_ypos`` attributes (FITS keywords SRCXPOS and SRCYPOS).
25+
26+
When run as part of the :ref:`calwebb_spec2 <calwebb_spec2>` pipeline, the
27+
step is executed after the :ref:`srctype <srctype_step>` step.
28+
29+
Step Inputs
30+
-----------
31+
32+
The ``targ_centroid`` step can accept either:
33+
34+
* A single science exposure (ImageModel) along with a separate TA verification
35+
image file specified via the ``ta_file`` parameter, or
36+
* An association file that includes both the science exposure and the TA
37+
verification image as separate members.
38+
39+
If no TA verification image is found in either location, the step will be skipped.
40+
If the ``ta_file`` parameter is provided and an association with a TA verification
41+
image is also provided, the file specified by ``ta_file`` will take precedence.
42+
43+
Algorithm
44+
---------
45+
46+
The ``targ_centroid`` step performs the following operations:
47+
48+
#. **Load reference files**: The step retrieves the following reference files from CRDS:
49+
50+
* FILTEROFFSET: Provides column and row offsets specific to the observation filter
51+
52+
#. **Assign WCS to TA verification image**: If the TA verification image does not already have
53+
a WCS assigned, the step invokes the :ref:`assign_wcs <assign_wcs_step>` step
54+
to compute and attach the WCS to the TA verification image data model.
55+
56+
#. **Determine reference position**: The step computes the expected source location
57+
based on the TA verification image WCS and metadata.
58+
59+
#. **Extract cutout**: A cutout of the TA verification image is extracted,
60+
centered on the expected source position.
61+
62+
#. **Find the centroid**: The centroid of the source within the cutout is determined
63+
using the :func:`~photutils.centroids.centroid_2dg` method,
64+
which fits the source with a 2D Gaussian.
65+
This yields the fitted x and y coordinates of the source in
66+
cutout pixel coordinates.
67+
68+
#. **Store TA position**: The measured source position in the TA verification
69+
image is stored in the input data model's ``ta_xpos`` and ``ta_ypos``
70+
attributes for reference.
71+
72+
#. **Transform coordinates**: The fitted position is transformed from TA verification image cutout
73+
coordinates to science image coordinates, accounting for any subarray
74+
offsets and/or dither offsets.
75+
76+
#. **Apply filter offsets**: The FILTEROFFSET reference file corrections are
77+
applied to the final x and y position.
78+
79+
#. **Store source position**: The corrected source position is stored in the output
80+
data model's ``source_xpos`` and ``source_ypos`` attributes for use by
81+
subsequent calibration steps.
82+
83+
Step Outputs
84+
------------
85+
86+
The input science exposure is returned unmodified, except with new metadata attributes:
87+
88+
* ``ta_xpos``: The measured x-coordinate of the source
89+
in the TA verification image (0-indexed pixels)
90+
* ``ta_ypos``: The measured y-coordinate of the source
91+
in the TA verification image (0-indexed pixels)
92+
* ``source_xpos``: The x-coordinate of the source in the science detector
93+
coordinate system (0-indexed pixels).
94+
* ``source_ypos``: The y-coordinate of the source in the science detector
95+
coordinate system (0-indexed pixels).
96+
* ``meta.cal_step.targ_centroid`` keyword set to "COMPLETE"

0 commit comments

Comments
 (0)