uvex_transients.utils.keyed_noise.keyed_standard_normal#
- uvex_transients.utils.keyed_noise.keyed_standard_normal(seed: ArrayLike, observation_key: ArrayLike, band_index: ArrayLike = 0) NDArray[float64][source]#
Draw standard-normal noise that depends only on a key, not on draw order.
Each output element is a pure function of its own
(seed, observation_key, band_index)triple. Unlike a draw from a sequential numpy.random.Generator, the value for one key is the same no matter which other keys are requested alongside it, in what order, or in how many batches. That lets a chunked iterator and a per-event photometry simulation reproduce the exact same noise for the same measurement.The three integers are combined by chained splitmix64 finalizers (not by sums or products, which would collide for swapped keys), the result is turned into a uniform on the open interval (0, 1), and scipy.special.ndtri maps it to a normal draw.
- Parameters:
seed (
intorarray-likeofint) – Per-event seed (a non-negative integer below2**64).observation_key (
intorarray-likeofint) – Integer identifying the observation, e.g. time_key of its start time.band_index (
intorarray-likeofint, optional) – Integer id of the band (its position in the detector’s bandpass list). Distinct bands of one observation get independent draws. Defaults to 0.
- Returns:
Standard-normal draws, with the shape the three inputs broadcast to.
- Return type:
- Raises:
OverflowError – If any key is negative or does not fit in
uint64.