kinextract.interp_template_tp_with_outside
- kinextract.interp_template_tp_with_outside(xg: ndarray, xt: ndarray, ft: ndarray) tuple[ndarray, ndarray][source]
Linearly interpolate a single template spectrum onto the galaxy grid.
Resamples a template’s
(xt, ft)tabulation onto the target wavelength arrayxgusing piecewise-linear interpolation, which is sufficient because template libraries are typically sampled at much finer or comparable resolution to the galaxy spectrum.- Parameters:
xg (ndarray) – Target (galaxy) wavelength grid, in Angstroms.
xt (ndarray) – Template wavelength grid, in Angstroms (must be increasing).
ft (ndarray) – Template flux values sampled at xt.
- Returns:
tp (ndarray) – Interpolated template values on xg. Pixels outside the template’s wavelength coverage are set to 1.0 (flat/neutral) rather than extrapolated, since the template carries no information there.
outside (ndarray of bool) – True where xg falls outside
[xt[0], xt[-1]), i.e. where tp is the fill value rather than a genuine interpolated value.
Notes
The outside mask is returned as a dedicated boolean array instead of being inferred from
tp == 1.0, because that sentinel comparison could misidentify genuine in-range pixels whose interpolated value happens to equal 1.0 exactly.