Skip to content

Commit

Permalink
Update docstrings a little
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamJamieson committed Oct 6, 2023
1 parent dcded7a commit afe4712
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
5 changes: 5 additions & 0 deletions src/stcal/ramp_fitting/ols_cas22/_core.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ Enums
poisson_var: poisson variance computed
total_var: total variance computed (read_var + poisson_var)
RampJumpDQ
This enum is to specify the DQ flags for Ramp/Jump detection
JUMP_DET: jump detected
Functions
---------
get_power
Expand Down
35 changes: 22 additions & 13 deletions src/stcal/ramp_fitting/ols_cas22/_fit_ramps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,27 @@ class RampFitOutputs(NamedTuple):
Simple tuple wrapper for outputs from the ramp fitting algorithm
This clarifies the meaning of the outputs via naming them something
descriptive.
"""
Attributes
----------
fits: list of RampFits
the raw ramp fit outputs, these are all structs which will get mapped to
python dictionaries.
parameters: np.ndarray[n_pixel, 2]
the slope and intercept for each pixel's ramp fit. see Parameter enum
for indexing indicating slope/intercept in the second dimension.
variances: np.ndarray[n_pixel, 3]
the read, poisson, and total variances for each pixel's ramp fit.
see Variance enum for indexing indicating read/poisson/total in the
second dimension.
dq: np.ndarray[n_resultants, n_pixel]
the dq array, with additional flags set for jumps detected by the
jump detection algorithm.
"""
fits: list
parameters: np.ndarray
variances: np.ndarray
dq: np.ndarray
# def __init__(self, fits, parameters, variances, dq):
# self.fits = fits
# self.parameters = parameters
# self.variances = variances
# self.dq = dq


@cython.boundscheck(False)
Expand All @@ -49,12 +59,11 @@ def fit_ramps(np.ndarray[float, ndim=2] resultants,
float intercept=DefaultIntercept,
float constant=DefaultConstant):
"""Fit ramps using the Casertano+22 algorithm.
This implementation fits all ramp segments between bad pixels
marked in the dq image with values not equal to zero. So the
number of fit ramps can be larger than the number of pixels.
The derived slopes, corresponding variances, and the locations of
the ramps in each pixel are given in the returned dictionary.
This implementation uses the Cas22 algorithm to fit ramps, where
ramps are fit between bad resultants marked by dq flags for each pixel
which are not equal to zero. If use_jump is True, it additionally uses
jump detection to mark additional resultants for each pixel as bad if
a jump is suspected in them.
Parameters
----------
Expand All @@ -78,7 +87,7 @@ def fit_ramps(np.ndarray[float, ndim=2] resultants,
Returns
-------
A list of RampFits objects, one for each pixel.
A RampFitOutputs tuple
"""
cdef int n_pixels, n_resultants
n_resultants = resultants.shape[0]
Expand Down

0 comments on commit afe4712

Please sign in to comment.