crow.recipes.binned_grid module

Module for defining the classes used in the MurataBinnedSpecZ cluster recipe.

This module provides implementations of cluster abundance and lensing predictions based on a binned representation of the mass–richness relation (Murata et al. 2019) and spectroscopic redshift assumptions. The primary class defined here constructs multi-dimensional grids for efficient numerical integration of cluster observables, including number counts and lensing profiles.

The implementation relies on precomputing and caching intermediate quantities such as halo mass functions, mass–richness relations, completeness, purity, and shear profiles. These cached grids are then combined into integrands and evaluated using Simpson integration over mass, redshift, and observable proxy.

class crow.recipes.binned_grid.GridBinnedClusterRecipe(cluster_theory, redshift_distribution, mass_distribution, completeness: Completeness = None, purity: Purity = None, mass_interval: tuple[float, float] = (11.0, 17.0), true_z_interval: tuple[float, float] = (0.0, 5.0), proxy_grid_size: int = 30, redshift_grid_size: int = 30, mass_grid_size: int = 30)[source]

Bases: BinnedClusterRecipe

Cluster recipe using a grid-based integration scheme for cluster observables.

This class implements a binned cluster model based on the Murata (2019) mass–richness relation, assuming perfectly measured spectroscopic redshifts. It evaluates cluster number counts and lensing signals by constructing multi-dimensional grids over mass, redshift, and observable proxy (e.g., richness), and performing numerical integration.

The computation is structured around reusable cached grids for efficiency, including: - Halo mass function × comoving volume - Mass–richness probability distribution - Completeness and purity corrections - Shear profiles for lensing observables

Parameters:
  • cluster_theory (object) -- Object providing theoretical predictions such as halo mass function, comoving volume, and shear profiles.

  • redshift_distribution (callable) -- Function describing the redshift distribution of clusters.

  • mass_distribution (callable) -- Function describing the mass–observable (e.g., richness) relation.

  • completeness (Completeness, optional) -- Completeness model. If None, a flat (unity) completeness is assumed.

  • purity (Purity, optional) -- Purity model. If None, a flat (unity) purity is assumed.

  • mass_interval (tuple of float, optional) -- Range of log10 halo mass values used for integration.

  • true_z_interval (tuple of float, optional) -- Redshift range used for integration.

  • proxy_grid_size (int, optional) -- Number of grid points in observable proxy (e.g., richness).

  • redshift_grid_size (int, optional) -- Number of grid points in redshift.

  • mass_grid_size (int, optional) -- Number of grid points in log-mass.

Variables:
  • log_mass_grid (numpy.ndarray) -- 1D grid of log10 halo masses used for integration.

  • _hmf_grid (dict) -- Cache of halo mass function × volume grids.

  • _mass_richness_grid (dict) -- Cache of mass–richness probability grids.

  • _completeness_grid (dict) -- Cache of completeness grids.

  • _purity_grid (dict) -- Cache of purity grids.

  • _shear_grids (dict) -- Cache of shear profile grids.

evaluate_theory_prediction_counts(z_edges, log_proxy_edges, sky_area: float, average_on: None | ClusterProperty = None) float[source]

Compute predicted cluster number counts in a bin.

This method evaluates the expected number of clusters within specified redshift and observable proxy bins by integrating the full cluster abundance model.

Parameters:
  • z_edges (tuple of float) -- Lower and upper bounds of the redshift bin.

  • log_proxy_edges (tuple of float) -- Bounds of the observable proxy bin (log-space).

  • sky_area (float) -- Survey area in square degrees.

  • average_on (ClusterProperty or None, optional) -- Optional weighting of the observable (e.g., mass-weighted counts).

Returns:

Predicted number of clusters in the bin.

Return type:

float

evaluate_theory_prediction_lensing_profile(z_edges: tuple[float, float], log_proxy_edges: tuple[float, float], radius_centers: ndarray, sky_area: float, average_on: None | ClusterProperty = None) float[source]

Compute the average cluster lensing profile in a bin.

This method evaluates the expected stacked lensing signal (e.g., \(\langle \Delta\Sigma(R) \rangle\) or \(\langle g_t(R) \rangle\)) by integrating the shear profile over the cluster population.

Parameters:
  • z_edges (tuple of float) -- Redshift bin boundaries.

  • log_proxy_edges (tuple of float) -- Observable proxy bin boundaries (log-space).

  • radius_centers (numpy.ndarray) -- Radial bins at which the lensing signal is evaluated.

  • sky_area (float) -- Survey area in square degrees.

  • average_on (ClusterProperty) -- Must include DELTASIGMA or SHEAR.

Returns:

Radial profile of the stacked lensing signal.

Return type:

numpy.ndarray

Raises:

ValueError -- If the required ClusterProperty flags are not set.

setup() None[source]

Reset all cached grids.

This method clears all internally stored grids used for caching intermediate quantities (e.g., halo mass function, mass–richness relation, etc.). It should be called whenever model parameters or cosmology are updated to ensure consistency in subsequent computations.