Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/jwst/picture_frame/api_ref.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
===
API
===

Public Step API
===============

.. automodapi:: jwst.picture_frame.picture_frame_step
:no-inheritance-diagram:

Complete Developer API
======================

.. automodapi:: jwst.picture_frame.picture_frame
:no-inheritance-diagram:
5 changes: 2 additions & 3 deletions docs/jwst/picture_frame/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Picture Frame Correction
:maxdepth: 2

main.rst
reference_files.rst
arguments.rst

.. automodapi:: jwst.picture_frame
reference_files.rst
api_ref.rst
7 changes: 3 additions & 4 deletions docs/jwst/picture_frame/main.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Description
===========

:Class: `jwst.picture_frame.PictureFrameStep`
:Class: `jwst.picture_frame.picture_frame_step.PictureFrameStep`
:Alias: picture_frame

Overview
Expand All @@ -12,7 +12,6 @@ from calibrated ramp images, after the :ref:`jump <jump_step>` step
and prior to performing the :ref:`clean_flicker_noise <clean_flicker_noise_step>`
or the :ref:`ramp_fitting <ramp_fitting_step>` step.


The picture frame artifacts are corrected by scaling and subtracting a reference rate
image, containing only the thermal background, stored in a PICTUREFRAME reference file.

Expand Down Expand Up @@ -59,7 +58,7 @@ group image in each integration, the cleaning process is:


References
==========
----------

The picture frame correction algorithm is based on work by M. Regan and
E. Bergeron (in prep).
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been so long. If it is still in prep, it is not happening.

E. Bergeron.
41 changes: 23 additions & 18 deletions jwst/picture_frame/picture_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@ def _region_masks(background_mask):
Parameters
----------
background_mask : ndarray
Background mask image (1 = valid background pixel, 0 otherwise).
Background mask image:

* 1 = valid background pixel
* 0 = otherwise

Returns
-------
center_data : ndarray of bool
Array matching background mask shape; True for background pixels
Array matching background mask shape; `True` for background pixels
in the center region.
edge_data : ndarray of bool
Array matching background mask shape; True for background pixels
Array matching background mask shape; `True` for background pixels
in the edge region.
"""
y, x = np.mgrid[: background_mask.shape[0], : background_mask.shape[1]]
Expand Down Expand Up @@ -74,10 +77,10 @@ def correct_picture_frame(

Parameters
----------
input_model : `~stdatamodels.jwst.datamodels.RampModel` \
or `~stdatamodels.jwst.datamodels.ImageModel` \
or `~stdatamodels.jwst.datamodels.CubeModel`
Science model to be corrected. Updated in place.
input_model : `~stdatamodels.jwst.datamodels.RampModel`, \
`~stdatamodels.jwst.datamodels.ImageModel`, or \
`~stdatamodels.jwst.datamodels.CubeModel`
Science model to be corrected. Updated in-place.
pictureframe_model : `~stdatamodels.jwst.datamodels.PictureFrameModel`
Picture frame reference model.
mask_science_regions : bool, optional
Expand All @@ -87,7 +90,7 @@ def correct_picture_frame(
n_sigma : float, optional
N-sigma rejection level for finding outliers.
input_dir : str, optional
Path to the input directory. Used by sub-steps (e.g. assign_wcs
Path to the input directory. Used by sub-steps (e.g., ``assign_wcs``
for NIRSpec MOS data) to find auxiliary data.
save_mask : bool, optional
Switch to indicate whether the scene mask should be saved.
Expand All @@ -96,20 +99,22 @@ def correct_picture_frame(

Returns
-------
output_model : `~stdatamodels.jwst.datamodels.RampModel` \
or `~stdatamodels.jwst.datamodels.ImageModel` \
or `~stdatamodels.jwst.datamodels.CubeModel`
Corrected data, updated in place.
output_model : `~stdatamodels.jwst.datamodels.RampModel`, \
`~stdatamodels.jwst.datamodels.ImageModel`, or \
`~stdatamodels.jwst.datamodels.CubeModel`
Corrected data, updated in-place.
mask_model : `~stdatamodels.jwst.datamodels.ImageModel`
Pixel mask to be saved or None.
correction_model : `~stdatamodels.jwst.datamodels.RampModel` \
or `~stdatamodels.jwst.datamodels.ImageModel` \
or `~stdatamodels.jwst.datamodels.CubeModel`
correction_model : `~stdatamodels.jwst.datamodels.RampModel`, \
`~stdatamodels.jwst.datamodels.ImageModel`, or \
`~stdatamodels.jwst.datamodels.CubeModel`
Correction model to be saved or None.
status : {'COMPLETE', 'SKIPPED'}
Completion status. If errors were encountered, status = 'SKIPPED'
and the output data is unchanged from the input data. Otherwise,
status = 'COMPLETE'.
Completion status:

* ``'SKIPPED'`` if errors were encountered and
the output data is unchanged from the input data.
* ``'COMPLETE'`` otherwise.
"""
# Set some default return values, to be updated later
correction_model = None
Expand Down
16 changes: 9 additions & 7 deletions jwst/picture_frame/picture_frame_step.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Correct NIRSpec ramp or rate data for thermal effects."""

import logging

from stdatamodels.jwst import datamodels
Expand Down Expand Up @@ -34,7 +36,7 @@ def process(self, input_data):
regions, then iteratively sigma-clipping. Then, the median levels are computed
from background data in a central region and from the edges of each group image.
These levels are used to scale and offset the correction image in the
``pictureframe`` reference file, then the scaled image is subtracted from the
PICTUREFRAME reference file, then the scaled image is subtracted from the
input data in each group.

Input data is expected to be a NIRSpec FULL frame ramp file (RampModel),
Expand All @@ -47,16 +49,16 @@ def process(self, input_data):

Parameters
----------
input_data : str or `~stdatamodels.jwst.datamodels.RampModel` \
or `~stdatamodels.jwst.datamodels.ImageModel` \
or `~stdatamodels.jwst.datamodels.CubeModel`
input_data : str, `~stdatamodels.jwst.datamodels.RampModel`, \
`~stdatamodels.jwst.datamodels.ImageModel`, or \
`~stdatamodels.jwst.datamodels.CubeModel`
Filename or input datamodel to be corrected. Must be NIRSpec full-frame.

Returns
-------
output_model : `~stdatamodels.jwst.datamodels.RampModel` \
or `~stdatamodels.jwst.datamodels.ImageModel` \
or `~stdatamodels.jwst.datamodels.CubeModel`
output_model : `~stdatamodels.jwst.datamodels.RampModel`, \
`~stdatamodels.jwst.datamodels.ImageModel`, or \
`~stdatamodels.jwst.datamodels.CubeModel`
The corrected datamodel, matching the type of the input.
"""
# Open the input data model
Expand Down
Loading