kinextract.precompute_ip_map
- kinextract.precompute_ip_map(st: FitState) None[source]
Precompute the (npix, nlosvd) pixel-shift index map for convolution.
For every combination of output pixel and fine-grid velocity point, computes which input pixel’s template flux contributes to it once shifted by that velocity — i.e. the discretized template-LOSVD convolution kernel geometry. Because the wavelength grid st.x and velocity grid st.vgrid0/st.facnew0 are fixed for the duration of a fit, this mapping is independent of the trial LOSVD amplitudes and is computed exactly once per fit rather than on every objective-function evaluation.
Pixel indices are rounded using kinextract.io.nint_fortran (round-half-away-from-zero) rather than NumPy’s default rounding, to exactly reproduce the legacy Fortran pipeline’s pixel-indexing convention.
- Parameters:
st (FitState) – Fit state to update in place. Requires st.c1, st.x, and st.facnew0 to already be set. Populates st.ip_map and st.ip_mask.
- Returns:
Results are stored directly on st: st.ip_map holds the (zero-based) pixel index for each (pixel, velocity-point) pair, and st.ip_mask marks which of those indices fall within the valid range
[0, npix).- Return type:
None