Skip to content

Commit

Permalink
ami3 pipeline and ami average docs updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rcooper295 committed Sep 29, 2023
1 parent c543400 commit 4cd4257
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 67 deletions.
9 changes: 9 additions & 0 deletions docs/jwst/ami_average/description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ Description

:Class: `jwst.ami.AmiAverageStep`
:Alias: ami_average

.. Attention::
The ``ami_average`` step has been removed from the default ami3 pipeline
until the effects of averaging multiple exposures has been more thoroughly examined.
It may be updated in the future; until then the legacy code is left in place. It
does not use the OIFITS-format (`~jwst.datamodels.AmiOIModel`) input that the current
``ami_analayze`` step produces. It uses the deprecated `~jwst.datamodels.AmiLgModel`
for both input and output.


The ``ami_average`` step is one of the AMI-specific steps in the ``ami``
sub-package and is part of Stage 3 :ref:`calwebb_ami3 <calwebb_ami3>` processing.
Expand Down
91 changes: 30 additions & 61 deletions docs/jwst/pipeline/calwebb_ami3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ The steps applied by the ``calwebb_ami3`` pipeline are shown below.
+==========================================+
| :ref:`ami_analyze <ami_analyze_step>` |
+------------------------------------------+
| :ref:`ami_average <ami_average_step>` |
+------------------------------------------+
| :ref:`ami_normalize <ami_normalize_step>`|
+------------------------------------------+

Expand All @@ -27,37 +25,28 @@ exposures, the pipeline will:

- apply the :ref:`ami_analyze <ami_analyze_step>` step to each input exposure
independently, computing fringe parameters for each
- apply the :ref:`ami_average <ami_average_step>` step to compute the average of the
:ref:`ami_analyze <ami_analyze_step>` results for all of the science target exposures,
and the average for all of the reference PSF results (if present)
- apply the :ref:`ami_normalize <ami_normalize_step>` step to correct the average science
target results using the average reference PSF results (if present)
- apply the :ref:`ami_normalize <ami_normalize_step>` step to correct the science
target results using the reference PSF results (if present)

If no reference PSF target exposures are present in the input ASN file, the ``ami_normalize``
step is skipped.

Arguments
---------
The ``calwebb_ami3`` pipeline has one optional argument::

--save_averages boolean default=False

If set to ``True``, the results of the :ref:`ami_average <ami_average_step>` step will be saved
to a file. If not, the results of the :ref:`ami_average <ami_average_step>` step are passed
along in memory to the :ref:`ami_normalize <ami_normalize_step>` step.
The ``calwebb_ami3`` pipeline does not currently use any optional arguments.

Inputs
------

2D calibrated images
3D calibrated images
^^^^^^^^^^^^^^^^^^^^

:Data model: `~jwst.datamodels.ImageModel`
:File suffix: _cal
:Data model: `~jwst.datamodels.DataModel`
:File suffix: _calints

The inputs to ``calwebb_ami3`` need to be in the form of an ASN file that lists
multiple science target exposures, and optionally reference PSF exposures as well.
The individual exposures must be in the form of calibrated ("_cal") products from
The individual exposures must be in the form of 3D calibrated ("_calints") products from
:ref:`calwebb_image2 <calwebb_image2>` processing.

An example ASN file containing 2 science target and 2 reference PSF target exposures is
Expand All @@ -67,24 +56,18 @@ as indicated by the "exptype" values for each.
::

{"asn_type": "ami3",
"asn_rule": "discover_Asn_AMI",
"asn_rule": DMS_Level3_Base",
"program": "10005",
"asn_id": "a3001",
"target": "t001",
"asn_pool": "jw10005_001_01_pool",
"products": [
{"name": "jw10005-a3001_t001_niriss_f277w-nrm",
"members": [
{"expname": "jw10005007001_02102_00001_nis_cal.fits",
{"expname": "jw10005007001_02102_00001_nis_calints.fits",
"exptype": "psf"
},
{"expname": "jw10005027001_02102_00001_nis_cal.fits",
"exptype": "psf"
},
{"expname": "jw10005004001_02102_00001_nis_cal.fits",
"exptype": "science"
},
{"expname": "jw10005001001_02102_00001_nis_cal.fits",
{"expname": "jw10005004001_02102_00001_nis_calints.fits",
"exptype": "science"
}
]
Expand All @@ -95,41 +78,27 @@ as indicated by the "exptype" values for each.
Outputs
-------

Fringe parameter tables
^^^^^^^^^^^^^^^^^^^^^^^
Interferometric observables
^^^^^^^^^^^^^^^^^^^^^^^^^^^
:Data model: `~jwst.datamodels.AmiOIModel`
:File suffix: _ami.oifits

:Data model: `~jwst.datamodels.AmiLgModel`
:File suffix: _ami

For every input exposure, the fringe parameters and closure phases calculated
by the :ref:`ami_analyze <ami_analyze_step>` step are saved to an "_ami" product file, which
is a FITS table containing the fringe parameters and closure phases. Product names
use the input "_cal" exposure-based file name, with the association candidate ID
included and the product type changed to "_ami", e.g.
"jw93210001001_03101_00001_nis_a0003_ami.fits."

Averaged fringe parameters table
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

:Data model: `~jwst.datamodels.AmiLgModel`
:File suffix: _amiavg or _psf-amiavg

If multiple target or reference PSF exposures are used as input and the
"--save_averages" parameter is set to ``True``, the :ref:`ami_average <ami_average_step>` step
will save averaged results for the target in an "_amiavg" product and for the
reference PSF in a "_psf-amiavg" product. The file name root will use the
source-based output product name given in the ASN file. These files are the
same FITS table format as the "_ami" products.

Normalized fringe parameters table
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

:Data model: `~jwst.datamodels.AmiLgModel`
:File suffix: _aminorm

If reference PSF exposures are included in the input ASN, the averaged AMI results
for the target will be normalized by the averaged AMI results for the reference PSF,
via the :ref:`ami_normalize <ami_normalize_step>` step, and will be saved to an "_aminorm"
product file. This file has the same FITS table format as the "_ami" products.
by the :ref:`ami_analyze <ami_analyze_step>` step are saved to "_ami.oifits" product file,
which is a kind of FITS table of median observables over all integrations of the input file.
Product names use the input "_calints" exposure-based file name, with the association candidate ID
included and the product type changed to "_ami.oifits", e.g.
"jw93210001001_03101_00001_nis_a0003_ami.oifits."

Normalized Interferometric Observables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:Data model: `~jwst.datamodels.AmiOIModel`
:File suffix: _aminorm.oifits

If reference PSF exposures are included in the input ASN, the AMI results
for the target will be normalized by the AMI results for the reference PSF,
via the :ref:`ami_normalize <ami_normalize_step>` step, and will be saved to an "_aminorm.oifits"
product file. This file has the same FITS table format as the "_ami.oifits" products.
The file name root uses the source-based output product name given in the ASN file,
e.g. "jw93210-a0003_t001_niriss_f480m-nrm_aminorm.fits."
e.g. "jw93210-a0003_t001_niriss_f480m-nrm_aminorm.oifits."
8 changes: 2 additions & 6 deletions jwst/pipeline/calwebb_ami3.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ class Ami3Pipeline(Pipeline):
Ami3Pipeline: Apply all level-3 calibration steps to an
association of level-2b AMI exposures. Included steps are:
ami_analyze (fringe detection)
# ami_average (average results of fringe detection)
ami_normalize (normalize results by reference target)
"""

class_alias = "calwebb_ami3"

spec = """
save_averages = boolean(default=True)
"""

# Define aliases to steps
step_defs = {'ami_analyze': ami_analyze_step.AmiAnalyzeStep,
Expand Down Expand Up @@ -120,8 +116,8 @@ def process(self, input):
# blendmeta.blendmodels(result, inputs=[targ, psf])
self.save_model(result, suffix='aminorm')
result.close()
del psf_lg
del targ_lg
del psf_lg
del targ_lg

Check warning on line 120 in jwst/pipeline/calwebb_ami3.py

View check run for this annotation

Codecov / codecov/patch

jwst/pipeline/calwebb_ami3.py#L117-L120

Added lines #L117 - L120 were not covered by tests


# We're done
Expand Down

0 comments on commit 4cd4257

Please sign in to comment.