Skip to content

Commit

Permalink
Add Roman jump detection to ramp fitting (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamJamieson authored Oct 26, 2023
2 parents 4a809eb + 40303d2 commit 1e7a317
Show file tree
Hide file tree
Showing 16 changed files with 2,118 additions and 598 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ dmypy.json

# Cython debug symbols
cython_debug/
src/stcal/ramp_fitting/ols_cas22/*.c
src/stcal/ramp_fitting/ols_cas22/*.cpp
src/stcal/ramp_fitting/ols_cas22/*.html

# setuptools-scm generated module
src/stcal/_version.py
Expand Down
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

- Added ``alignment`` sub-package. [#179]

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

- Refactor Casertano, et.al, 2022 uneven ramp fitting and incorporate the matching
jump detection algorithm into it. [#215]

Changes to API
--------------

Expand Down
30 changes: 26 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,31 @@
Options.docstrings = True
Options.annotate = False

extensions = [Extension('stcal.ramp_fitting.ols_cas22',
['src/stcal/ramp_fitting/ols_cas22.pyx'],
include_dirs=[np.get_include()],
extra_compile_args=['-std=c99'])]
extensions = [
Extension(
'stcal.ramp_fitting.ols_cas22._core',
['src/stcal/ramp_fitting/ols_cas22/_core.pyx'],
include_dirs=[np.get_include()],
language='c++'
),
Extension(
'stcal.ramp_fitting.ols_cas22._fixed',
['src/stcal/ramp_fitting/ols_cas22/_fixed.pyx'],
include_dirs=[np.get_include()],
language='c++'
),
Extension(
'stcal.ramp_fitting.ols_cas22._pixel',
['src/stcal/ramp_fitting/ols_cas22/_pixel.pyx'],
include_dirs=[np.get_include()],
language='c++'
),
Extension(
'stcal.ramp_fitting.ols_cas22._fit_ramps',
['src/stcal/ramp_fitting/ols_cas22/_fit_ramps.pyx'],
include_dirs=[np.get_include()],
language='c++'
),
]

setup(ext_modules=cythonize(extensions))
220 changes: 0 additions & 220 deletions src/stcal/ramp_fitting/ols_cas22.pyx

This file was deleted.

4 changes: 4 additions & 0 deletions src/stcal/ramp_fitting/ols_cas22/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from ._fit_ramps import fit_ramps, RampFitOutputs
from ._core import Parameter, Variance, Diff, RampJumpDQ

__all__ = ['fit_ramps', 'RampFitOutputs', 'Parameter', 'Variance', 'Diff', 'RampJumpDQ']
58 changes: 58 additions & 0 deletions src/stcal/ramp_fitting/ols_cas22/_core.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from libcpp.vector cimport vector
from libcpp.stack cimport stack
from libcpp.deque cimport deque


cdef struct RampIndex:
int start
int end


cdef struct RampFit:
float slope
float read_var
float poisson_var


cdef struct RampFits:
vector[RampFit] fits
vector[RampIndex] index
vector[int] jumps
RampFit average


cdef struct ReadPatternMetadata:
vector[float] t_bar
vector[float] tau
vector[int] n_reads


cdef struct Thresh:
float intercept
float constant


cpdef enum Diff:
single = 0
double = 1


cpdef enum Parameter:
intercept = 0
slope = 1


cpdef enum Variance:
read_var = 0
poisson_var = 1
total_var = 2


cpdef enum RampJumpDQ:
JUMP_DET = 4


cpdef float threshold(Thresh thresh, float slope)
cdef float get_power(float s)
cdef deque[stack[RampIndex]] init_ramps(int[:, :] dq)
cpdef ReadPatternMetadata metadata_from_read_pattern(list[list[int]] read_pattern, float read_time)
Loading

0 comments on commit 1e7a317

Please sign in to comment.