hispecdrp.primitives.trace_fitting.traceprof_moments

Trace-profile moments for spectroperfection extraction.

Spatial profile (0th/2nd spatial moment) comes from a fiberflat rate map. Iso-λ shear and spectral 2nd moment come from LFC spots: each comb peak is a tilted 2-D PSF whose covariance encodes ∂row/∂col and the line-spread width along the dispersion axis.

Functions

_n_orders_n_pix(spectrograph, *[, n_pix, ...])

fill_traceprof_spectroperfection_moments(...)

Write shear / σ_spec (LFC) and σ_spat (fiberflat) into traceprof.

interpolate_moments_to_pixels(spot_rows, ...)

PCHIP-interpolate finite spot samples onto ``0 .

measure_fiberflat_spatial_sigma(rate, trace_y, *)

Per-spectral-row spatial Gaussian σ from a fiberflat rate map.

measure_lfc_spot_moments_along_trace(rate, ...)

Measure LFC spot moments along one order's trace.

spot_window_moments(rate, row, col, *[, ...])

Flux-weighted 1st/2nd moments of a 2-D window about (row, col).

fill_traceprof_spectroperfection_moments(traceprof, *, fiberflat_rate, lfc_rate, tracepos, spectrograph, fiber, orders=None, extraction_aperture=8.0, half_win=6, expected_xy_by_order=None)[source]

Write shear / σ_spec (LFC) and σ_spat (fiberflat) into traceprof.

PROF_FIB is left unchanged (fiberflat image). Moment HDUs are (n_orders, n_pix) on the same spectral-row grid as TracePos.

interpolate_moments_to_pixels(spot_rows, values, n_pix)[source]

PCHIP-interpolate finite spot samples onto 0 .. n_pix-1.

measure_fiberflat_spatial_sigma(rate, trace_y, *, extraction_aperture=8.0)[source]

Per-spectral-row spatial Gaussian σ from a fiberflat rate map.

measure_lfc_spot_moments_along_trace(rate, trace_y, *, extraction_aperture=8.0, half_win=6, min_prominence_frac=0.05, min_separation_pix=8, expected_xy=None)[source]

Measure LFC spot moments along one order’s trace.

If expected_xy is given (deposit (row, col) pairs), those centers are used. Otherwise peaks are found on the aperture-summed spectral profile.

spot_window_moments(rate, row, col, *, half_win=6)[source]

Flux-weighted 1st/2nd moments of a 2-D window about (row, col).

Oriented detector: spectral axis is row, cross-dispersion is col. Shear is cov(row, col) / var(col) = ∂row/∂col of the iso-λ ridge.