|
| 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