Skip to content

Commit

Permalink
Document calculation of readnoise variance (JP-2670) (#6924)
Browse files Browse the repository at this point in the history
* Document calculation of readnoise variance

* Document calculation of readnoise variance

* minor corrections based on review suggestions

* minor corrections based on review suggestions
  • Loading branch information
dmggh authored Jul 19, 2022
1 parent bf606c8 commit 2b3e92a
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ general

-


ramp_fitting
------------

- Added documentation for the calculation of the readnoise variance [#6924]


resample
--------

Expand Down
46 changes: 46 additions & 0 deletions docs/jwst/ramp_fitting/appendix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Appendix
========

The derivation of the segment-specific readnoise variance (:math:`{ var^R_{s} }`) is shown here. This derivation follows the standard procedure to fitting data to a straight line, such as in chapter 15 of Numerical Recipes. The segment-specific variance from read noise corresponds to :math:`{\sigma_b^2}` in section 15.2.

For read noise R, weight w = :math:`{1 / R^2}`, which is a constant.

n = number of groups (`ngroups` in the text)

t = group time (`tgroup` in the text)

x = starting time for each group, = :math:`{(1,2,3, ... n+1) \cdot t}`


:math:`{S_1 = \sum_{k=1}^n w}`

:math:`{S_x = \sum_{k=1}^n (w \cdot x_k) t}`

S\ :sub:`xx`\ = :math:`{\sum_{k=1}^n (w \cdot x_k)^2 t^2}`

D = :math:`{S_1 \cdot S}`\ :sub:`xx`\ - :math:`{S_x^2}`


Summations needed:

:math:`{\sum_{k=1}^n k = n \cdot (n+1) / 2 = n^2 /2 + n/2 }`

:math:`{\sum_{k=1}^n k^2= n \cdot (n+1) \cdot (2 \cdot n+1) / 6 = n^3/3 + n^2/2 +n/6 }`


The variance from read noise
= :math:`{var^R_{s} = S_1 / D = S_1 / (S_1 \cdot S_{xx} - S_x^2)}`


= :math:`{ \dfrac {w \cdot n} { [w \cdot n \cdot \sum_{k=1}^n (w \cdot x_k^2 \cdot t^2)] - [\sum_{k=1}^n (w \cdot x_k \cdot t)] ^2}}`


= :math:`{ \dfrac {n} { w \cdot t^2 \cdot [ n \cdot ( n^3/3 + n^2/2 +n/6 ) - (n^2/2 + n/2 )^2 ] }}`


= :math:`{ \dfrac {1} { ( n^3/12 - n/12 ) \cdot w \cdot t^2 }}`


= :math:`{ \dfrac{12 \cdot R^2} {(n^3 - n) \cdot t^2}}`

This is the equation in the code and in the segment-specific computations section of the Description.
4 changes: 3 additions & 1 deletion docs/jwst/ramp_fitting/description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ The variance of the slope of a segment due to read noise is:
where :math:`R` is the noise in the difference between 2 frames,
:math:`ngroups_{s}` is the number of groups in the segment, and :math:`tgroup` is the group
time in seconds (from the keyword TGROUP).
time in seconds (from the keyword TGROUP). The derivation of this equation is given in
the appendix of this section, at `readnoise variance derivation. <https://jwst-pipeline.readthedocs.io/en/latest/jwst/ramp_fitting/appendix.html>`_.


The variance of the slope in a segment due to Poisson noise is:

Expand Down
2 changes: 1 addition & 1 deletion docs/jwst/ramp_fitting/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ Ramp Fitting
description.rst
arguments.rst
reference_files.rst

appendix.rst

.. automodapi:: jwst.ramp_fitting

0 comments on commit 2b3e92a

Please sign in to comment.