hispecdrp.primitives.lsf.lsf_convolve

Generic LSF utilities: PSF stamps → 1-D kernels and spectrum convolution.

This module has no dependency on hispecdrp.simulations. HDF / pyechelle instrument-model loading lives in hispecdrp.simulations.lsf.

Functions

_convolve_numba_1d_chromatic(spec_padded, ...)

_psf_oversample(block, pixelsize)

convolve_l2_with_gaussian_lsf(wave_2d, ...)

Apply a per-pixel Gaussian LSF to a 2-D (order, pix) spectrum.

convolve_numba_1d_chromatic(spec, kernels[, ...])

Convolve a 1-D spectrum with a wavelength-dependent LSF.

convolve_order_spectrum_gaussian_lsf(wave, ...)

Convolve a 1-D order spectrum with a wavelength-dependent Gaussian LSF.

lsf_1d_from_psf_stamp(stamp, *, oversample)

Collapse an oversampled PSF stamp to a 1-D spectral LSF.

lsf_library_from_psf_fiber_block(fiber_block, *)

Build a per-order 1-D LSF library from one fiber's PSF stamp block.

sigma_pix_from_lsf_library(lib, order, wave)

Effective Gaussian σ (detector pixels) vs spectral sample from an LSF library.

_convolve_numba_1d_chromatic(spec_padded, kernels, spec_out)[source]
_psf_oversample(block, pixelsize)[source]
convolve_l2_with_gaussian_lsf(wave_2d, flux_2d, sigma_pix_2d, *, num_sigma=5.0)[source]

Apply a per-pixel Gaussian LSF to a 2-D (order, pix) spectrum.

sigma_pix_2d has the same shape as wave_2d / flux_2d and is in detector spectral pixels.

convolve_numba_1d_chromatic(spec, kernels, spec_out=None)[source]

Convolve a 1-D spectrum with a wavelength-dependent LSF.

kernels is (n_wave, n_kernel) with an odd n_kernel. Each row is the normalized kernel at that sample. The wavelength grid must be uniform (same assumption as make_kernels()).

convolve_order_spectrum_gaussian_lsf(wave, flux, sigma_pix, *, num_sigma=5.0)[source]

Convolve a 1-D order spectrum with a wavelength-dependent Gaussian LSF.

sigma_pix is in detector spectral pixels; converted to wavelength using local dλ/dpix from wave.

lsf_1d_from_psf_stamp(stamp, *, oversample, half_width_pix=None)[source]

Collapse an oversampled PSF stamp to a 1-D spectral LSF.

Stamp layout matches deposit: axis 0 = cross-dispersion (y), axis 1 = spectral (x). Returns (offsets_pix, kernel) with offsets in detector spectral pixels relative to the stamp center, and kernel normalized to unit sum.

lsf_library_from_psf_fiber_block(fiber_block, *, pixelsize=1.0)[source]

Build a per-order 1-D LSF library from one fiber’s PSF stamp block.

fiber_block is {order: {psf_stamps, psf_wavelengths, ...}} (the layout written by the pyechelle HDF reader). Returns {order: {"wavelengths", "offsets_list", "kernels"}}.

sigma_pix_from_lsf_library(lib, order, wave)[source]

Effective Gaussian σ (detector pixels) vs spectral sample from an LSF library.

Uses the second moment of each collapsed 1-D kernel, interpolated in wavelength. Missing orders return σ = 1 pixel.