kinextract.fortran_rebin_after_redshift
- kinextract.fortran_rebin_after_redshift(x: ndarray, flux: ndarray, step: float, extra_arrays: dict | None = None) tuple[ndarray, ndarray, dict][source]
Resample a de-redshifted spectrum onto a uniform wavelength grid.
After dividing the observed wavelength array by
1 + zgal, the pixel spacing is no longer exactly uniform in the rest frame. This reproduces the legacy Fortranimfitbehavior of re-gridding onto a strictly uniform step (starting at the first rest-frame wavelength) via linear interpolation, which several downstream steps (e.g. the LOSVD convolution machinery) assume.- Parameters:
x (ndarray) – De-redshifted (rest-frame) wavelength array (Å), non-uniformly spaced.
flux (ndarray) – Flux array corresponding to x.
step (float) – Desired uniform wavelength step (Å) of the output grid.
extra_arrays (dict, optional) – Additional named arrays (e.g. flux errors, continuum estimates) to resample onto the same new grid using the same linear interpolation and edge-fill rule. Entries with value None are passed through as None in the output.
- Returns:
x_new (ndarray) – Uniformly spaced rest-frame wavelength grid (Å), same length as the input x, starting at
x[0].flux_new (ndarray) – Flux linearly interpolated onto x_new, with edge values held constant beyond the original range.
extra_new (dict) – Each array in extra_arrays similarly resampled onto x_new.