hispecdrp.primitives.spectral_extraction.extract_optimal
Optimal spectral extraction (Horne), with optional iso-λ shear.
Functions
|
|
|
|
|
Shared Horne weighted sums for one spectral sample (in-place masks). |
|
Linear interpolate |
|
|
|
Optimal spectral extraction. |
- _extract_optimal_numba(input_data, input_err, input_dq, input_var_rnoise, input_var_poisson, input_mid_time, trace_positions, profile, extraction_aperture, pix_range, spec_output, err_output, var_rnoise_output, var_poisson_output, dq_output, mid_time_output, orders_are_vertical=True)[source]
- _extract_optimal_sheared_numba(input_data, input_err, input_dq, input_var_rnoise, input_var_poisson, input_mid_time, trace_positions, profile, shear, extraction_aperture, pix_range, spec_output, err_output, var_rnoise_output, var_poisson_output, dq_output, mid_time_output, orders_are_vertical=True)[source]
- _horne_accumulate(D, D_var, D_var_poisson, D_var_rnoise, D_dq, P, T, W, M_in)[source]
Shared Horne weighted sums for one spectral sample (in-place masks).
- _interp_spectral_sample(arr, x_frac, y, orders_are_vertical)[source]
Linear interpolate
arralong the spectral axis at cross-dispy.
- _nearest_dq_sample(dq, x_frac, y, orders_are_vertical)[source]
- extract_spectrum_optimal(input_data, input_err, input_dq, input_var_rnoise, input_var_poisson, input_mid_time, trace_positions, profile, extraction_aperture, pix_range=None, spec_output=None, err_output=None, var_rnoise_output=None, var_poisson_output=None, dq_output=None, mid_time_output=None, orders_are_vertical=True, shear=None)[source]
Optimal spectral extraction.
- Parameters:
shear (np.ndarray | None) – Optional iso-λ shear
∂(spectral)/∂(cross-disp)per spectral sample (same length astrace_positions). When set, data/profile are sampled alongx' = x + shear[x] * (y - y_c)before the Horne sum.
- 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.