Measurements
Measurement logic is implemented in halocat/measurements.py and exposed through cat.measure.
Measurement namespace
cat.measure.hmf(...)
cat.measure.xi(...)
cat.measure.pairwise_velocity_moments(...)
cat.measure.binned_statistic(...)
cat.measure.bias(...)
Convenience wrappers on HaloCat mirror the main methods:
cat.measure_hmf(...)cat.measure_chmf(...)cat.measure_dhmf(...)cat.measure_dndlog10M(...)cat.measure_2PCF(...)cat.measure_velocity_moments(...)cat.measure_binned_statistic(...)cat.measure_bias(...)
All pair-counting measurements require catalogue.boxsize. For the current implementation, separation bins must satisfy:
r_edges[-1] <= 0.5 * min(boxsize)
Cross-catalogue measurements are available through the other= argument on xi(...), pairwise_velocity_moments(...), and bias(...). The two catalogues must have matching boxsize and periodic settings.
Halo mass function
Use either physical mass-bin edges or log-mass edges:
hmf = cat.measure.hmf(log10mass_edges=np.arange(12.0, 15.1, 0.1))
Returned fields include:
mass_edgesmass_centreslog10mass_edgeslog10mass_centrescountsnumber_densitycumulative_number_densityvolumemass_field
number_density is dn/dlog10M. cumulative_number_density is n(>M) evaluated at the lower edge of each bin.
Two-point correlation function
Real-space measurement:
xi = cat.measure.xi(np.geomspace(0.5, 50.0, 20))
Redshift-space measurement:
xi_s = cat.measure.xi(
np.geomspace(0.5, 50.0, 20),
space="redshift",
los="z",
los_velocity_factor=0.01,
mu_edges=np.linspace(0.0, 1.0, 33),
ells=(0, 2, 4),
)
Current implementation notes:
- The measurement uses periodic-box minimal-image distances.
estimator="natural"is the only implemented estimator.boxsizemust be set.- Cross-correlations can be measured with
other=other_catalogue. - Redshift-space mode requires velocity fields and
los_velocity_factorinMpc/hperkm/s. - The returned
TwoPointCorrelationResultincludesxi,pair_counts, andrandom_pair_countsin all modes. - Redshift-space results additionally include
mu_edges,mu_centres,xi_s_mu,pair_counts_s_mu,random_pair_counts_s_mu,ells, andmultipoles.
Example cross-correlation:
xi_cross = cat_a.measure.xi(
np.geomspace(0.5, 50.0, 20),
other=cat_b,
)
Pairwise velocity moments
vel = cat.measure.pairwise_velocity_moments(np.geomspace(0.5, 20.0, 12))
The result contains:
pair_countsmean_radial_velocitymean_squared_radial_velocityradial_velocity_dispersioncross
cross is True when the measurement was made with other=....
Generic binned statistics
spin_vs_mass = cat.measure.binned_statistic(
"spin",
bins=np.logspace(12.0, 15.0, 8),
x_field="mass",
statistic="mean",
)
The returned BinnedStatisticResult stores:
bin_edgesbin_centrescountsstatisticstatistic_namex_fieldy_field
This method is a light wrapper around scipy.stats.binned_statistic.
Halo bias
bias(...) accepts either:
- a
TwoPointCorrelationResult - an array-like reference
xiplus matchingr_edges
matter_xi = ...
bias = cat.measure.bias(matter_xi, r_edges=np.geomspace(0.5, 50.0, 20))
Currently implemented mode:
sqrt_ratio:b(r) = sqrt(xi_halo / xi_reference)
If you pass a TwoPointCorrelationResult, its r_edges are reused automatically.