hispecdrp.primitives.spectral_extraction.extract_sheared_sp
Iso-λ sheared separable forward model + banded LS extract (spectroperfectionism-lite).
Horne gather/scatter are not inverses when neighboring iso-λ cuts overlap.
For a controlled self-check the world must be the scatter operator A, and
extraction must solve the normal equations (A^T N^{-1} A) f = A^T N^{-1} d.
Noiseless d = A f then round-trips to machine precision.
Functions
|
Sample continuum profile along the iso-λ cut (linear in spectral axis). |
|
Banded weighted LS extract: |
|
Separable forward model |
|
Yield |
- _profile_on_cut(profile_img, x, window_inds, yc, shear)[source]
Sample continuum profile along the iso-λ cut (linear in spectral axis).
- extract_sheared_banded_ls(rate, rate_var, profile_img, trace_y, *, extraction_aperture, shear=None, rate_dq=None, do_not_use=1)[source]
Banded weighted LS extract:
f = argmin ||N^{-1/2}(d - A f)||.rate_varis per-pixel variance (rate_err**2). Pixels with non-finite data, non-positive variance, orDO_NOT_USEare dropped.
- forward_sheared_separable(spec, profile_img, trace_y, *, extraction_aperture, shear=None)[source]
Separable forward model
M = A fmatching the sheared scatter operator.Returns
(model, aperture_mask).
- get_extraction_window(yc, window_size, n_pixels=-1)[source]
Computes the fractional overlap of pixels with the extraction window.
- Parameters:
yc (float) – Center of the extraction window (in pixel coordinates).
window_size (float) – Size of the extraction window (in pixels) centered in yc.
n_pixels (int, optional) – When
>= 0, clip candidate indices to[0, n_pixels - 1]so callers never receive out-of-bounds cross-dispersion indices (avoids Numba OOB segfaults when trace positions are extrapolated or non-finite).
- Returns:
idx (np.ndarray) – Indices of the pixels that might have overlap with the extraction window.
W (np.ndarray) – Fractional overlap of each pixel in idx with the extraction window.
- iter_sheared_scatter_weights(trace_y, profile_img, *, extraction_aperture, shear)[source]
Yield
(x, y, row0, row1, w0, w1, pix_weight)scatter terms.pix_weightisPP * Wfor the aperture sample;w0/w1split that weight across spectral rowsrow0/row1(bilinear).