hispecdrp.primitives.ramp_fitting.fit_ramp_numba

Functions

_fit_ramp_mcds(times, ramp, dq_raw, rdnoise, ...)

Fits a ramp using the MCDS method.

_fit_ramp_slope_pedestal(times, ramp, ...)

Fits a line to the given data (times, ramp) with a free y-intercept.

_fit_ramps_mcds(times, ramps, dq_raw, dq, ...)

_fit_ramps_slope_pedestal(times, ramps, ...)

fit_ramps_mcds(times, ramps[, dq_raw, dq, ...])

Fits ramps using the MCDS method.

fit_ramps_ols(times, ramps[, dq_raw, dq, ...])

Fits ramps using the ordinary least squares (OLS) method.

fit_ramps_mcds(times, ramps, dq_raw=None, dq=None, rdnoise=None, gain=None, dark_current=None, start_times=None, num_coadd=1, max_cores=1)[source]

Fits ramps using the MCDS method.

Parameters:
  • times (np.ndarray) – Read times.

  • ramps (np.ndarray) – 3D array of ramp data with shape (n_reads, ny, nx) in units of DN.

  • dq_raw (np.ndarray, optional) – 3D array of data quality flags across reads and detector (n_reads, ny, nx).

  • dq (np.ndarray, optional) – 2D array of data quality flags across detector (ny, nx).

  • rdnoise (np.ndarray, optional) – 2D array of read noise across detector (ny, nx) in units of e-.

  • gain (np.ndarray, optional) – 2D array of gain across detector (ny, nx) in units of e-/DN.

  • dark_current (np.ndarray, optional) – 2D array of dark current across detector (ny, nx) in units of DN/s. Caution: Only use when the ramps have been already dark subtracted.

  • start_times (np.ndarray, optional) – 2D array of MJD times of the first read across detector (ny, nx).

  • num_coadd (int, optional) – Number of coadds. Default is 1.

  • max_cores (int, optional) – Maximum number of CPU cores to use. Default is 1.

Returns:

output (dict[str, np.ndarray]) – Dictionary with keys matching L0 rate objects.

fit_ramps_ols(times, ramps, dq_raw=None, dq=None, rdnoise=None, gain=None, dark_current=None, start_times=None, max_cores=1)[source]

Fits ramps using the ordinary least squares (OLS) method.

Parameters:
  • times (np.ndarray) – Read times.

  • ramps (np.ndarray) – 3D array of ramp data with shape (n_reads, ny, nx) in units of DN.

  • dq_raw (np.ndarray, optional) – 3D array of data quality flags across reads and detector (n_reads, ny, nx).

  • dq (np.ndarray, optional) – 2D array of data quality flags across detector (ny, nx).

  • rdnoise (np.ndarray, optional) – 2D array of read noise across detector (ny, nx) in units of e-.

  • gain (np.ndarray, optional) – 2D array of gain across detector (ny, nx) in units of e-/DN.

  • dark_current (np.ndarray, optional) – 2D array of dark current across detector (ny, nx) in units of DN/s. Caution: Only use when the ramps have been already dark subtracted.

  • start_times (np.ndarray, optional) – 2D array of MJD times of the first read across detector (ny, nx).

  • num_coadd (int, optional) – Number of coadds. Default is 1.

  • max_cores (int, optional) – Maximum number of CPU cores to use. Default is 1.

Returns:

output (dict[str, np.ndarray]) – Dictionary with keys matching L0 rate objects.