Skip to content

Commit 4cfb54a

Browse files
authored
DOC: Complete API for msaflagopen (#10515)
1 parent ff76589 commit 4cfb54a

8 files changed

Lines changed: 84 additions & 49 deletions

File tree

docs/jwst/msaflagopen/api_ref.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
===
2+
API
3+
===
4+
5+
Public Step API
6+
===============
7+
8+
.. automodapi:: jwst.msaflagopen.msaflagopen_step
9+
:no-inheritance-diagram:
10+
11+
Complete Developer API
12+
======================
13+
14+
.. automodapi:: jwst.msaflagopen.msaflag_open
15+
:no-inheritance-diagram:

docs/jwst/msaflagopen/arguments.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/jwst/msaflagopen/description.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Description
22
===========
33

4-
:Class: `jwst.msaflagopen.MSAFlagOpenStep`
4+
:Class: `jwst.msaflagopen.msaflagopen_step.MSAFlagOpenStep`
55
:Alias: msa_flagging
66

77
Overview
@@ -15,15 +15,20 @@ The correction is applicable to NIRSpec IFU and MSA exposure types.
1515

1616
Algorithm
1717
---------
18-
The set of shutters whose state is not commandable (i.e. they are permanently stuck
18+
The set of shutters whose state is not commandable (i.e., they are permanently stuck
1919
in 'open' or 'closed' positions) is recorded in the MSAOPER reference file.
2020
The reference file is searched for all shutters with any of the quantities
21-
'Internal state', 'TA state' or 'state' set to 'open'.
21+
'Internal state', 'TA state', or 'state' set to 'open'.
2222

2323
The step loops over the list of stuck open shutters. For each shutter, the bounding box
2424
that encloses the projection of the shutter onto the detector array is calculated,
2525
and for each pixel in the bounding box, the WCS is calculated. If the pixel is inside
2626
the region affected by light through the shutter, the WCS will have valid values,
2727
whereas if the pixel is outside, the WCS values will be NaN. The indices of each non-NaN
2828
pixel in the WCS are used to alter the corresponding pixels in the DQ array by OR'ing
29-
their DQ value with that for "MSA_FAILED_OPEN."
29+
their DQ value with that for "MSA_FAILED_OPEN".
30+
31+
Step Arguments
32+
--------------
33+
34+
The ``msaflagopen`` step has no step-specific arguments.

docs/jwst/msaflagopen/index.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@ MSAFlagOpen Correction
88
:maxdepth: 2
99

1010
description.rst
11-
arguments.rst
1211
reference_files.rst
13-
14-
.. automodapi:: jwst.msaflagopen
12+
api_ref.rst

docs/jwst/references_general/msaoper_reffile.inc

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,53 @@ the following keywords are *required* in MSAOPER reference files,
2020
because they are used as CRDS selectors
2121
(see :ref:`msaoper_selectors`):
2222

23-
========= ==============================
23+
========= ========================
2424
Keyword Data Model Name
25-
========= ==============================
25+
========= ========================
2626
EXP_TYPE model.meta.exposure.type
27-
========= ==============================
27+
========= ========================
2828

2929
Reference File Format
3030
+++++++++++++++++++++
31-
The MSAOPER reference files are json format.
32-
31+
The MSAOPER reference files are in JSON format.
3332
The fields are:
3433

35-
:title: Short description of the reference file
36-
:reftype: Should be "MSAOPER"
37-
:pedigree: Should be one of "DUMMY", "GROUND" or "INFLIGHT"
38-
:author: Creator of the file
39-
:instrument: JWST Instrument; should be "NIRSPEC"
40-
:exp_type: EXP_TYPEs this file should be used with; should be "NRS_IFU|NRS_MSASPEC"
41-
:telescope: Should be "JWST"
42-
:useafter: Exposure datetime after which this file is applicable
43-
:descrip: Description of reference file
44-
:msaoper:
45-
:Q: Quadrant; should be an integer 1-4
46-
:x: x location of shutter (integer, 1-indexed)
47-
:y: y location of shutter (integer, 1-indexed)
48-
:state: state of shutter; should be "closed" or "open"
49-
:TA state: TA state of shutter; should be "closed" or "open"
50-
:Internal state: Internal state of shutter; should be "closed", "normal" or "open"
51-
:Vignetted: Is the shutter vignetted? Should be "yes" or "no"
52-
:history: Description of the history relevant to this file; might point to documentation
34+
``title``
35+
Short description of the reference file
36+
37+
``reftype``
38+
Should be "MSAOPER"
39+
40+
``pedigree``
41+
Should be one of "DUMMY", "GROUND", or "INFLIGHT"
42+
43+
``author``
44+
Creator of the file
45+
46+
``instrument``
47+
JWST Instrument; should be "NIRSPEC"
48+
49+
``exp_type``
50+
EXP_TYPEs this file should be used with; should be "NRS_IFU|NRS_MSASPEC"
51+
52+
``telescope``
53+
Should be "JWST"
54+
55+
``useafter``
56+
Exposure datetime after which this file is applicable
57+
58+
``descrip``
59+
Description of reference file
60+
61+
``msaoper``
62+
- ``Q``: Quadrant; should be an integer 1-4
63+
- ``x``: x location of shutter (integer, 1-indexed)
64+
- ``y``: y location of shutter (integer, 1-indexed)
65+
- ``state``: state of shutter; should be "closed" or "open"
66+
- ``TA state``: TA state of shutter; should be "closed" or "open"
67+
- ``Internal state``: Internal state of shutter; should be "closed", "normal" or "open"
68+
- ``Vignetted``: Is the shutter vignetted? Should be "yes" or "no"
69+
70+
``history``
71+
Description of the history relevant to this file;
72+
might point to documentation

docs/jwst/references_general/msaoper_selection.inc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ MSAOPER is not applicable for instruments not in the table.
77
All keywords used for file selection are *required*.
88

99
========== ======================================
10-
Instrument Keywords
10+
Instrument Keywords
1111
========== ======================================
12-
NIRSpec INSTRUME, EXP_TYPE, DATE-OBS, TIME-OBS
12+
NIRSpec INSTRUME, EXP_TYPE, DATE-OBS, TIME-OBS
1313
========== ======================================
14-

jwst/msaflagopen/msaflag_open.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ def do_correction(input_model, shutter_refname, wcs_refnames):
4444
Parameters
4545
----------
4646
input_model : `~stdatamodels.jwst.datamodels.ImageModel`
47-
Science data to be corrected. Updated in place.
47+
Science data to be corrected. Updated in-place.
4848
shutter_refname : str
4949
Name of MSAOPER reference file.
5050
wcs_refnames : dict
51-
Dictionary of wcs reference file names.
51+
Dictionary of WCS reference file names.
5252
5353
Returns
5454
-------
@@ -78,21 +78,21 @@ def flag(input_datamodel, failed_slitlets, wcs_refnames):
7878
that for the MSA_FAILED_OPEN standard flag. All other science data
7979
arrays are unchanged.
8080
81-
The input datamodel is modified in place.
81+
The input datamodel is modified in-place.
8282
8383
Parameters
8484
----------
85-
input_datamodel : DataModel
86-
Input science data. Updated in place.
87-
failed_slitlets : list of Slit
85+
input_datamodel : `~stdatamodels.jwst.datamodels.JwstDataModel`
86+
Input science data. Updated in-place.
87+
failed_slitlets : list of `~stdatamodels.jwst.transforms.Slit`
8888
Failed open slitlets.
8989
wcs_refnames : dict
9090
Reference file names used to calculate the WCS. Keys are reference
9191
file types; values are file paths.
9292
9393
Returns
9494
-------
95-
input_datamodel : DataModel
95+
input_datamodel : `~stdatamodels.jwst.datamodels.JwstDataModel`
9696
Science data with DQ flags modified.
9797
"""
9898
# Use the machinery in assign_wcs to create a WCS object for the bad shutters
@@ -142,7 +142,7 @@ def boundingbox_to_indices(data_shape, bounding_box):
142142
"""
143143
Translate a bounding box to image indices.
144144
145-
Takes a bounding_box (tuple of tuples: ((x1, x2), (y1, y2)) and
145+
Takes a ``bounding_box`` (tuple of tuples: ``((x1, x2), (y1, y2))``) and
146146
a datamodel and calculates the range of indices in the X and Y dimensions
147147
of the overlap between the bounding box and the datamodel's data array.
148148
@@ -151,7 +151,7 @@ def boundingbox_to_indices(data_shape, bounding_box):
151151
data_shape : tuple
152152
The data shape for the input science datamodel.
153153
bounding_box : tuple of tuple
154-
Bounding box returned from wcs object.
154+
Bounding box returned from WCS object.
155155
156156
Returns
157157
-------
@@ -176,7 +176,7 @@ def wcs_to_dq(wcs_array, flag):
176176
"""
177177
Create a DQ subarray corresponding to a failed open slitlet.
178178
179-
The created array has the value `flag` wherever the WCS coordinates
179+
The created array has the value ``flag`` wherever the WCS coordinates
180180
are valid (non-NaN) and 0 otherwise.
181181
182182
Parameters
@@ -239,7 +239,7 @@ def create_slitlets(shutter_refname):
239239
240240
Returns
241241
-------
242-
slitlets : list of Slit
242+
slitlets : list of `~stdatamodels.jwst.transforms.Slit`
243243
A list of slitlets. Each slitlet is a named tuple with elements
244244
("name", "shutter_id", "dither_position", "xcen", "ycen", "ymin", "ymax",
245245
"quadrant", "source_id", "shutter_state", "source_name", "source_alias",

jwst/msaflagopen/msaflagopen_step.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Flag pixels affected by open MSA shutters in NIRSpec exposures."""
2+
13
import logging
24

35
from stpipe.crds_client import reference_uri_to_cache_path
@@ -68,7 +70,7 @@ def create_reference_filename_dictionary(input_model):
6870
6971
Parameters
7072
----------
71-
input_model : DataModel
73+
input_model : `~stdatamodels.jwst.datamodels.JwstDataModel`
7274
Input data with WCS assigned.
7375
7476
Returns

0 commit comments

Comments
 (0)