Skip to content

torchsky.log_lambda

Stability: core. Names on this page follow the deprecation policy in contributing.

Unit-integral Gaussian convolution on a uniformly spaced ln λ grid.

Guides: spectral-axes


This reference is generated from the package source. Names are grouped by the module that defines them; import every name from the public namespace torchsky.log_lambda unless the group text says otherwise.

Top-level namespace

Unit-integral Gaussian convolution on a uniformly spaced ln λ grid.

Used for LOSVD broadening and published resolving-power LSFs. The kernel is normalized to sum to one. sigma → 0 is the identity on the sampled grid (an honest sub-pixel statement, not a continuous Dirac identity).

C_KM_S module-attribute

C_KM_S = 299792.458

convolve_log_lambda

convolve_log_lambda(
    flux: Tensor,
    dln_lambda: float | Tensor | None = None,
    sigma_kms: Tensor | float | None = None,
    *,
    sigma_px: Tensor | float | None = None,
    kernel_radius: int = 8,
    mean_kms: Tensor | float = 0.0,
    zero_mean: bool = False,
) -> Tensor

Convolve flux with a unit-sum Gaussian in ln λ.

Parameters:

Name Type Description Default
flux Tensor

(..., n) samples on a uniform ln λ grid.

required
dln_lambda float | Tensor | None

constant grid spacing Δ ln λ (required when sigma_kms or nonzero mean_kms is used).

None
sigma_kms Tensor | float | None

Gaussian width in km/s, broadcastable to flux[..., 1] or per-pixel flux[..., n]. Mutually exclusive with sigma_px.

None
sigma_px Tensor | float | None

Gaussian width in grid pixels, broadcastable to flux[..., 1] or per-pixel flux[..., n]. Mutually exclusive with sigma_kms.

None
kernel_radius int

half-width of the discrete kernel in pixels.

8
mean_kms Tensor | float

optional kernel mean in km/s (LOSVD streaming), broadcastable to flux[..., 1] or flux[..., n]. The adjoint of a mean-μ kernel is the mean--μ kernel.

0.0
zero_mean bool

if True, rebuild the kernel so the discrete first moment is zero (truncated-Gaussian centering). Incompatible with a nonzero mean_kms.

False

sigma_R_kms

sigma_R_kms(resolving_power: Tensor | float) -> Tensor

Velocity width of a Gaussian LSF for published resolving power R.

σ = c / (2.355 R) so the FWHM is c / R.