diff --git a/src/tdastro/pipeline.py b/src/tdastro/pipeline.py new file mode 100644 index 0000000..52fe8ab --- /dev/null +++ b/src/tdastro/pipeline.py @@ -0,0 +1,27 @@ +"""Utilities for running the simulation pipeline.""" + + +import numpy as np + + +def apply_noise(flux, flux_err, rng=None): + """Apply Gaussian noise to a flux measurement. + + Parameters + ---------- + flux : ndarray of float + The flux measurement. + flux_err : ndarray of float + The flux measurement error. + rng : np.random.Generator, optional + The random number generator. + + Returns + ------- + ndarray of float + The noisy flux measurement. + """ + if rng is None: + rng = np.random.default_rng() + + return rng.normal(loc=flux, scale=flux_err)