kinextract.build_matched_mock
- kinextract.build_matched_mock(st: FitState, a_fit: ndarray, v_true: float, sigma_true: float, h3: float = 0.0, h4: float = 0.0, rng: Generator | None = None) ndarray[source]
Synthetic spectrum matched to st’s instrument/template/continuum/noise.
Evaluates the forward model (
kinextract.numerics.evaluate_model_gp()) at a_fit but with the LOSVD entries replaced by a known ground truth (v_true/sigma_true/h3/h4), so template weights, continuum, and amplitude all match the real target being validated. Per-pixel Gaussian noise is drawn at the level of st.gerr (the real target’s own error array), reproducing its actual per-pixel S/N structure rather than assuming a single flat scalar S/N.- Parameters:
st (FitState) – Reference fit state (instrument grid, template matrix, continuum, per-pixel errors) to match. Not modified.
a_fit (ndarray) – Flat parameter vector from a real fit (e.g.
fit["a_map"]); only its non-LOSVD entries (template weights, continuum, amplitude) are used – the LOSVD entries are overridden by the injected truth.v_true (float) – Ground-truth LOSVD parameters to inject.
sigma_true (float) – Ground-truth LOSVD parameters to inject.
h3 (float) – Ground-truth LOSVD parameters to inject.
h4 (float) – Ground-truth LOSVD parameters to inject.
rng (numpy.random.Generator, optional) – Random generator for the noise draw. A fresh, non-reproducible default generator is used if not given; pass an explicit seeded generator for reproducible mocks.
- Returns:
Synthetic noisy spectrum, same length and units as st.g.
- Return type:
ndarray