Skip to content

Commit

Permalink
Update resample docs with error propagation details
Browse files Browse the repository at this point in the history
  • Loading branch information
melanieclarke committed Apr 29, 2024
1 parent 8896931 commit be4e677
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions docs/jwst/resample/main.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,57 @@ WCS of each input image and the WCS of the defined output product.
This mapping function gets passed to cdriz to drive the actual
drizzling to create the output product.


Error Propagation
-----------------

The error associated with each resampled pixel can in principle be derived
from the variance components associated with each input pixel, weighted by
the square of the input user weights and the square of the overlap between
the input and output pixels. In practice, the cdriz routine does not currently
support propagating variance data alongside science images, so the output
error cannot be precisely calculated.

To approximate the error on a resampled pixel, the variance arrays associated
with each input image are resampled individually, then combined with a weighted
sum. The process is:

#. For each input image, take the square root of each of the read noise variance
array to make an error image.

#. Drizzle the read noise error image onto the output WCS, with drizzle
parameters matching those used for the science data.

#. Square the resampled read noise to make a variance array.

a. If the resampling `weight_type` is an inverse variance map (`ivm`), weight
the resampled variance by the square of its own inverse.

#. If the `weight_type` is the exposure time (`exptime`), weight the
resampled variance by the square of the exposure time for the image.

#. Add the weighted, resampled read noise variance to a running sum across all
images. Add the weights (unsquared) to a separate running sum across
all images.

#. Perform the same steps for the Poisson noise variance and the flat variance.
For these components, the weight for the sum is either the resampled read
noise variance or else the exposure time.

#. For each variance component (read noise, Poisson, and flat), divide the
weighted variance sum by the total weight, squared.

After each variance component is resampled and summed, the final error
array is computed as the square root of the sum of the three independent
variance components. This error image is stored in the ``err`` attribute
in the output data model or the ``'ERR'`` extension of the FITS file.

It is expected that the output errors computed in this way will
generally overestimate the true error on the resampled data. The magnitude
of the overestimation depends on the details of the pixel weights
and error images.


Context Image
-------------

Expand Down Expand Up @@ -93,6 +144,7 @@ context array ``con``, one can do something like this:
For convenience, this functionality was implemented in the
:py:func:`~jwst.resample.resample_utils.decode_context` function.


Spectroscopic Data
------------------

Expand Down

0 comments on commit be4e677

Please sign in to comment.