kinextract.convolve_gaussian_pixels
- kinextract.convolve_gaussian_pixels(flux: ndarray, sigma_pix: float, axis: int = -1) ndarray[source]
Convolve flux with a Gaussian kernel of a fixed width in pixels.
Thin wrapper over scipy.ndimage.gaussian_filter1d used to apply the resolution-matching kernel from
resolution_mismatch_sigma_A()(after converting its Angstrom sigma to pixels via the wavelength step). Works on a single 1-D spectrum or a 2-D template matrix (passaxis=0for a (npix, ntemplates) matrix, matching the convention used inbuild_template_matrix_fortran()).- Parameters:
flux (ndarray) – Spectrum or template matrix to convolve.
sigma_pix (float) – Gaussian sigma, in pixels. If
<= 0, flux is returned unchanged (no-op) rather than raising, since a zero-width match is a valid (if unusual) outcome ofresolution_mismatch_sigma_A().axis (int, optional) – Axis along which to convolve (the wavelength axis).
- Returns:
Convolved array, same shape as flux.
- Return type:
ndarray
Notes
Uses
mode="nearest"boundary handling (edge values repeated) rather than wrapping or zero-padding, since spectra are not periodic and zero-padding would spuriously pull flux down near the edges.