densitysplit package
Submodules
densitysplit.cosmology module
- class densitysplit.cosmology.Cosmology(omega_m=0.308, h=0.676, c=299792.458)
Bases:
objectClass for cosmology calculations.
- Parameters:
omega_m (float, optional) – Matter density parameter.
h (float, optional) – Hubble parameter.
c (float, optional) – Speed of light in km/s.
- H0
Hubble constant in km/s/Mpc.
- Type:
float
- h
Dimensionless Hubble parameter.
- Type:
float
- c
Speed of light in km/s.
- Type:
float
- omega_m
Matter density parameter.
- Type:
float
- omega_lambda
Dark energy density parameter.
- Type:
float
- zgrid
Redshift grid used for interpolation.
- Type:
array_like
- rgrid
Comoving distance grid used for interpolation.
- Type:
array_like
- AngularDiameterDistance(z)
Calculate angular diameter distance as a function of redshift.
- Parameters:
z (float) – Redshift.
- Returns:
Angular diameter distance in Mpc/h.
- Return type:
float
- ComovingDistance(z)
Calculate comoving distance as a function of redshift.
- Parameters:
z (float) – Redshift.
- Returns:
Comoving distance in Mpc/h.
- Return type:
float
- Ez(z)
- GrowthFactor(z)
Calculate linear growth factor as a function of redshift.
- Parameters:
z (float) – Redshift.
- Returns:
Linear growth factor.
- Return type:
float
- GrowthRate(z)
Calculate linear growth rate as a function of redshift.
- Parameters:
z (float) – Redshift.
- Returns:
Linear growth rate.
- Return type:
float
- HubbleParameter(z)
Calculate Hubble parameter as a function of redshift.
- Parameters:
z (float) –
Redshift.
- returns:
float
Hubble parameter in units of 100 km/s/Mpc.
- Redshift(r)
Calculate redshift as a function of comoving distance.
- Parameters:
r (float) – Comoving distance in Mpc/h.
- Returns:
Redshift.
- Return type:
float
densitysplit.filters module
- class densitysplit.filters.Gaussian(r)
Bases:
objectGaussian filter in Fourier space
- Parameters:
r (float) – the radius of the Gaussian filter
- class densitysplit.filters.TopHat(r)
Bases:
objectTop-hat filter in Fourier space adapted from https://github.com/bccp/nbodykit/
- Parameters:
r (float) – the radius of the top-hat filter
densitysplit.pipeline module
- class densitysplit.pipeline.DensitySplit(data_positions, boxsize=None, data_weights=None, randoms_positions=None, randoms_weights=None)
Bases:
objectClass to split a set of points into quantiles based on the local density field.
- Parameters:
data_positions (array_like) – Positions of the data points.
boxsize (float, optional) – Size of the box. If not provided, randoms are required.
data_weights (array_like, optional) – Weights of the data points. If not provided, all points are assumed to have the same weight.
randoms_positions (array_like, optional) – Positions of the random points. If not provided, boxsize must be provided.
randoms_weights (array_like, optional) – Weights of the random points. If not provided, all points are assumed to have the same weight.
- data_positions
Positions of the data points.
- Type:
array_like
- boxsize
Size of the box.
- Type:
float
- data_weights
Weights of the data points.
- Type:
array_like
- randoms_positions
Positions of the random points.
- Type:
array_like
- randoms_weights
Weights of the random points.
- Type:
array_like
- mesh
CatalogMesh object.
- Type:
CatalogMesh
- density
Density field at the sampling positions.
- Type:
array_like
- sampling_positions
Positions where the density field was sampled.
- Type:
array_like
- get_box_randoms(nrandoms, seed=42)
Get random points inside the box.
- Parameters:
nrandoms (int) – Number of random points to generate.
seed (int, optional) – Random seed.
- Returns:
randoms – Random points inside the box.
- Return type:
array_like
- get_density_mesh(smooth_radius, cellsize, compensate=False, resampler='cic', interlacing=0, sampling='randoms', sampling_positions=None, boxpad=2.0, filter_shape='TopHat', ran_min=0.01)
Get the overdensity field.
- Parameters:
smooth_radius (float) – Radius of the smoothing filter.
cellsize (float) – Size of the cells in the mesh.
compensate (bool, optional) – Compensate for the shot noise.
resampler (str, optional) – Resampling method.
interlacing (int, optional) – Interlacing order.
sampling (str, optional) – Sampling method.
sampling_positions (array_like, optional) – Positions where the density field should be sampled. If not provided, the randoms are used.
boxpad (float, optional) – Padding of the box.
filter_shape (str, optional) – Shape of the smoothing filter.
- Returns:
density (array_like) – Density field at the sampling positions.
sampling_positions (array_like) – Positions where the density field was sampled.
- get_density_paircount(smooth_radius, sampling_positions, filter_shape='Tophat', nthreads=1)
Get the overdensity field using pair counting.
- Parameters:
smooth_radius (float) – Radius of the smoothing filter.
sampling_positions (array_like) – Positions where the density field should be sampled.
filter_shape (str, optional) – Shape of the smoothing filter.
nthreads (int, optional) – Number of threads to use.
- Returns:
density – Density field at the sampling positions.
- Return type:
array_like
- get_mesh()
Get the CatalogMesh object.
- Returns:
mesh – CatalogMesh object.
- Return type:
CatalogMesh
- get_quantiles(nquantiles, return_idx=False)
Get the quantiles of the density field.
- Parameters:
nquantiles (int) – Number of quantiles.
return_idx (bool, optional) – Whether to return index of the quantile of each query point.
- Returns:
quantiles (array_like) – Quantiles of the density field.
quantiles_idx (array_like, optional) – Index of the quantile of each query point.