hispecdrp.primitives.blaze_correction.blaze_correction_primitive

Functions

_longest_contiguous_true_segment(mask)

Return a slice covering the longest run of True values in mask.

apply_blaze(science_flux[, science_err, ...])

Apply blaze correction to science spectrum and propagate errors for a single order.

apply_blaze_array(output_model, blaze_array, ...)

Apply blaze correction to science spectrum and propagate errors for all orders, then add to output model.

divide_out_lamp_spectrum(blaze_array, ...[, ...])

Divide fiberflat blaze (and its uncertainty) by an analytic lamp spectrum.

estimate_blaze_spline(flat_flux, flat_err, ...)

Estimate blaze using weighted cubic lsq smoothing spline.

get_smooth_blaze(fiberflat_flux, ...[, ...])

Collect smoothed blaze function (not normalized) for each order and return in 2D array

lamp_spectrum_shape(wave_um, *[, temperature_k])

Analytic lamp SED matching simulated fiberflats (energy density).

normalize_blaze_array(blaze_array, ...)

Normalize blaze array across orders using a CubicSpline fit to wavelength/blaze peak.

Classes

BlazeCorrectionPrimitive([dataset, config, ...])

class BlazeCorrectionPrimitive(dataset=None, config=None, context=None, log_config=None, parent=None, **kwargs)[source]

Bases: BasePrimitive

get_output_model(input_model, **kwargs)[source]
divide_out_lamp_spectrum(blaze_array, blaze_err_array, wavelengths, order_vec, do_orders, *, temperature_k=1000.0)[source]

Divide fiberflat blaze (and its uncertainty) by an analytic lamp spectrum.

Per-order lamp shapes are applied directly (no median renormalization) so the subsequent per-order max-normalization step preserves the correct instrument-blaze shape after dividing out BB×blaze fiberflats.

lamp_spectrum_shape(wave_um, *, temperature_k=1000.0)[source]

Analytic lamp SED matching simulated fiberflats (energy density).

Uses the same blackbody construction as create_dummy_fiberflat_rate_files(): BlackBody radiance per Å, then ×1e4 to per-µm energy density. Only the relative shape is used when dividing the fiberflat.