clenspy.selection.selection_function.SelectionFunction¶
- class clenspy.selection.selection_function.SelectionFunction(lambda_edges, z_edges, mor, emg_params, sigma_z, bracket_width=8.0, n_quad=64)[source]¶
Bases:
object\(\mathcal S_{ij}(M, z^{\rm tr})\), and its two factors.
NOTE: units are dimensionless;
ln_massis \(\ln M\) with M in \(h^{-1}M_\odot\). See the module NOTE.- Parameters:
lambda_edges (array-like, shape (n_lambda + 1,)) – Observed-richness bin edges, ascending and contiguous.
z_edges (array-like, shape (n_z + 1,)) – Observed-redshift bin edges, ascending and contiguous.
mor (LogNormalMor or HodMor) – The mass–observable relation. Stored verbatim; supplies
pdf,meanandstd.emg_params (EmgParams) – The observed-richness kernel parameters.
sigma_z (float or array-like) – Photo-z scatter (not the 3-sigma window – see clenspy.kernels.photoz). A scalar, or one value per redshift bin.
bracket_width (float, optional) – \(L\) in \(\mu_{\rm eff} \pm L\sigma_{\rm eff}\) (default: 8).
n_quad (int, optional) – Gauss–Legendre order (default: 64).
Methods
S_i(ln_mass, z)\(S_i(M, z)\) for every richness bin.
S_ij(ln_mass, z)\(\mathcal S_{ij} = S_i\,\mathcal S_j\).
S_j(z)\(\mathcal S_j(z^{\rm tr})\) for every redshift bin.
__init__(lambda_edges, z_edges, mor, ...[, ...])bracket(ln_mass, z)(a, b): the \(\lambda^{\rm tr}\) quadrature bracket.first_moment_i(ln_mass, z)\int d\lambda^{\rm tr}\,P(\lambda^{\rm tr}\mid M,z)\,M_i, for every richness bin.first_moment_ij(ln_mass, z)first_moment_i * S_j, the \(\lambda^{\rm ob}\) first moment's share of \(\mathcal S_{ij}\).residual(ln_mass, z)How much \(\lambda^{\rm tr}\) probability the bracket misses.
Attributes
- property n_lambda_bins¶
- property n_z_bins¶
- bracket(ln_mass, z)[source]¶
(a, b): the \(\lambda^{\rm tr}\) quadrature bracket.\[a = \max(0,\;\mu_{\rm eff} - L\sigma_{\rm eff}), \qquad b = \mu_{\rm eff} + L\sigma_{\rm eff}\]NOTE: clipped at zero, never at the lowest bin edge. Clipping at \(\lambda_i^{\min}\) would be wrong: the projection tail scatters low-richness haloes up into the bin, so the integrand is non-zero well below the bin’s own edge. That upscatter is the entire physical effect this package exists to model.
- S_i(ln_mass, z)[source]¶
\(S_i(M, z)\) for every richness bin.
Returns shape
(*broadcast(ln_mass, z).shape, n_lambda_bins).
- first_moment_i(ln_mass, z)[source]¶
\int d\lambda^{\rm tr}\,P(\lambda^{\rm tr}\mid M,z)\,M_i, for every richness bin.The same \(\lambda^{\rm tr}\) quadrature S_i uses, contracted against ~clenspy.selection.richness_kernel.richness_bin_first_moment instead of richness_bin_probability. Dividing element-wise by S_i gives the observed-richness mean of haloes of mass \(M\) at redshift \(z\) that land in bin \(i\).
Returns shape
(*broadcast(ln_mass, z).shape, n_lambda_bins).
- S_j(z)[source]¶
\(\mathcal S_j(z^{\rm tr})\) for every redshift bin.
Returns shape
(*np.shape(z), n_z_bins).
- S_ij(ln_mass, z)[source]¶
\(\mathcal S_{ij} = S_i\,\mathcal S_j\).
Returns shape
(..., n_lambda_bins, n_z_bins).
- first_moment_ij(ln_mass, z)[source]¶
first_moment_i * S_j, the \(\lambda^{\rm ob}\) first moment’s share of \(\mathcal S_{ij}\).Factorises exactly like S_ij: the redshift factor \(\mathcal S_j\) carries no \(\lambda^{\rm ob}\) dependence, so it multiplies through unchanged. This is the numerator clenspy.observables.ClusterCounts.mean_richness needs – dividing its \((\ln M, z)\) integral by counts gives \(\langle\lambda^{\rm ob}\rangle_{ij}\).
Returns shape
(..., n_lambda_bins, n_z_bins).
- residual(ln_mass, z)[source]¶
How much \(\lambda^{\rm tr}\) probability the bracket misses.
\(1 - \int_a^b P(\lambda^{\rm tr}\mid M,z)\, d\lambda^{\rm tr}\), computed on the same nodes the quadrature uses.
NOTE: this is the module’s named approximation, made measurable. A value of \(10^{-6}\) says the bracket is fine; \(10^{-2}\) says \(S_i\) is low by about a percent and bracket_width needs raising. There is no way to know without evaluating it, which is why it is a method and not a comment.