sys_mapping.glass_mocks

Full-sky lognormal galaxy mock generation using the GLASS package (Tessore et al. 2023).

Generates systematic-free galaxy catalogs matched to the BGS LS10 redshift distribution and surface density. The workflow is:

  1. Measure n(z) from a reference catalog (e.g. Uchuu) with measure_nz().

  2. Generate GLASS mock with generate_glass_fullsky_mock(): a single tophat redshift shell is used; galaxy positions are drawn from a lognormal density field via glass.positions_from_delta, and redshifts are sampled from the measured \(n(z)\).

Inputs: NSIDE, target \(N_{\rm gal}\), measured \(n(z)\), seed.

Outputs: dict with keys ra, dec, z, ra_rand, dec_rand, n_total, nside, seed.

Full-sky lognormal galaxy mock generation using GLASS.

Generates systematic-free galaxy catalogs matched to the BGS LS10 redshift distribution and surface density. The key advantage over the lognormal generator in mocks.py is that GLASS produces proper full-sky catalogs without galactic-cut hacks, using the algorithm of Tessore et al. 2023 (arXiv:2302.01942).

Workflow

  1. Measure n(z) from a reference catalog (e.g. Uchuu).

  2. Call generate_glass_fullsky_mock() with the measured n(z) to produce galaxy and random positions over the full sky.

  3. Downstream pipeline code applies the survey footprint mask and injects systematics via sys_mapping.simulation.

References

Tessore et al. 2023, OJAp, 6, 11. https://arxiv.org/abs/2302.01942 GLASS code: https://github.com/glass-dev/glass

class sys_mapping.glass_mocks.MockCatalogDict[source]

Bases: TypedDict

Dict returned by mock generators — compatible with simulation pipeline.

ra: ndarray
dec: ndarray
z: ndarray
ra_rand: ndarray
dec_rand: ndarray
n_total: int
nside: int
seed: int | None
sys_mapping.glass_mocks.measure_nz(z_array, z_min, z_max, n_bins=20)[source]

Histogram a redshift array into equal-width bins.

Parameters:
  • z_array (ndarray) – Galaxy redshifts.

  • z_min (float) – Redshift range to include (endpoints of the bin grid).

  • z_max (float) – Redshift range to include (endpoints of the bin grid).

  • n_bins (int) – Number of histogram bins.

Returns:

  • z_edges – Bin edges (length n_bins + 1).

  • nz – Galaxy counts per bin (length n_bins). Galaxies outside [z_min, z_max] are ignored.

Return type:

tuple[ndarray, ndarray]

Examples

>>> import numpy as np
>>> from sys_mapping.glass_mocks import measure_nz
>>> rng = np.random.default_rng(0)
>>> z = rng.uniform(0.05, 0.26, 10000)
>>> edges, nz = measure_nz(z, 0.05, 0.26, n_bins=10)
>>> edges.shape
(11,)
>>> nz.shape
(10,)
>>> int(nz.sum()) <= 10000
True
sys_mapping.glass_mocks.generate_glass_fullsky_mock(nside, n_total, z_edges, nz, *, cl_amplitude=0.0005, rand_factor=10, seed=None)[source]

Generate a full-sky lognormal galaxy mock catalog using GLASS.

The mock has the angular clustering statistics of a lognormal random field with the given power spectrum amplitude, and the redshift distribution set by (z_edges, nz).

Parameters:
  • nside (int) – HEALPix resolution for the underlying density field.

  • n_total (int) – Target total number of galaxies. The actual count will be close but not exactly equal (Poisson sampling).

  • z_edges (ndarray) – Bin edges of the n(z) histogram (length n_bins + 1). The first edge defines z_min and the last edge defines z_max.

  • nz (ndarray) – Galaxy counts per redshift bin (length n_bins). Used to sample redshifts; does not need to be normalised.

  • cl_amplitude (float) – Amplitude of the galaxy angular power spectrum C_ℓ at ℓ=1.

  • rand_factor (int) – Ratio of randoms to data. Default 10 gives accurate Landy-Szalay.

  • seed (int | None) – Random seed for reproducibility.

Returns:

  • MockCatalogDict with keys ra, dec, z, ra_rand,

  • dec_rand, n_total, nside, seed.

Return type:

MockCatalogDict

Notes

The returned catalog is full-sky (no footprint mask applied). Downstream code in sys_mapping.simulation applies the LSDR10 systematic maps and the survey footprint.

Examples

>>> import numpy as np
>>> from sys_mapping.glass_mocks import generate_glass_fullsky_mock, measure_nz
>>> rng_z = np.random.default_rng(1)
>>> z = rng_z.uniform(0.05, 0.26, 5000)
>>> z_edges, nz = measure_nz(z, 0.05, 0.26, n_bins=5)
>>> cat = generate_glass_fullsky_mock(nside=16, n_total=5000,
...                                   z_edges=z_edges, nz=nz, seed=0)
>>> len(cat['ra']) > 0
True
>>> cat['ra'].min() >= 0.0 and cat['ra'].max() < 360.0
True
>>> cat['dec'].min() >= -90.0 and cat['dec'].max() <= 90.0
True