xlens.utils.random

Attributes

num_rot

gal_seed_base

Functions

get_noise_seed(*, galaxy_seed[, noiseId, rotId, band, ...])

Generate a stable pseudo-random seed for noise realisations.

Module Contents

num_rot = 2[source]
gal_seed_base = 10[source]
get_noise_seed(*, galaxy_seed, noiseId=0, rotId=0, band: None | str = 'i', is_sim=False)[source]

Generate a stable pseudo-random seed for noise realisations.

The function mixes deterministic galaxy identifiers with optional meta-data, hashes the values into a uniform byte representation, and derives a 32-bit integer seed. The resulting seed is reproducible for a given combination of inputs and has a vanishingly small collision probability within typical survey data sets.

Parameters:
  • galaxy_seed (int) – Base integer identifier that uniquely labels the galaxy.

  • noiseId (int, optional) – Identifier describing the desired noise realisation. Defaults to 0.

  • rotId (int, optional) – Identifier describing the rotation realisation. Defaults to 0.

  • band (str, optional) – Photometric band label ("g", "r", "i", "z", "y"). Defaults to "i".

  • is_sim (bool, optional) – Flag that indicates whether the galaxy originates from a simulation (True) or observations (False). Defaults to False.

Returns:

Unsigned 32-bit integer seed suitable for initialising NumPy random generators.

Return type:

int