hispecdrp.primitives.spectral_extraction.extract_spectroperfection
Spectroperfection extract from TraceProf shear + LSF moments.
Forward operator: each spectral sample deposits a sheared spatial profile
(from the fiberflat) along iso-λ. Default spectral_kernel='bilinear'
inverts that pixel-grid operator (LSF geometry via the measured shear).
spectral_kernel='gaussian' also inverts an LFC-measured spectral LSF.
Functions
|
|
|
|
|
Banded weighted LS spectroperfection extract. |
|
Deposit |
|
Yield |
- _gauss_pdf(dx, sigma)[source]
- _pix_lo_hi(ny, pix_range)[source]
- _profile_on_cut(profile_img, x, window_inds, yc, shear)[source]
Sample continuum profile along the iso-λ cut (linear in spectral axis).
- extract_spectroperfection(rate, rate_var, profile_img, trace_y, *, extraction_aperture, shear=None, sigma_spec=None, lsf_n_sigma=5.0, rate_dq=None, do_not_use=1, pix_range=None, spectral_kernel='bilinear', ridge_frac=None)[source]
Banded weighted LS spectroperfection extract.
profile_imgis the 2-D fiberflat spatial profile.shearis the iso-λ tilt from LFC spots. The defaultspectral_kernel='bilinear'inverts the sheared pixel-grid deposit (same 1-D basis as box/optimal);'gaussian'additionally inverts an LFC-measured spectral LSF and needsridge_fracto stay stable on real PSFs.
- forward_spectroperfection(spec, profile_img, trace_y, *, extraction_aperture, shear=None, sigma_spec=None, lsf_n_sigma=5.0, pix_range=None, spectral_kernel='bilinear')[source]
Deposit
specwith the spectroperfection operator (d = A f).
- 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).
- iter_spectroperfection_weights(trace_y, profile_img, *, extraction_aperture, shear, sigma_spec, lsf_n_sigma=5.0, pix_range=None)[source]
Yield
(j, y, x, weight): detector spectral rowj, cross-dispy, source spectral samplex.