pycosmommf package¶
Copyright (c) 2024 James Sunseri. All rights reserved.
pycosmommf: A package for identifying structures in the cosmic web.
Submodules¶
pycosmommf.filter module¶
- pycosmommf.filter.kspace_gaussian_filter(R_S, kv)¶
-
create a Gaussian filter in k-space.
- pycosmommf.filter.kspace_top_hat_filter(R_S, kv)¶
-
create a top-hat filter in k-space.
- pycosmommf.filter.smooth_gauss(f, R_S, kv)¶
-
apply a Gaussian filter to a field f.
- pycosmommf.filter.smooth_loggauss(f, R_S, kv)¶
-
apply a Gaussian filter to the log of a field f.
- pycosmommf.filter.smooth_top_hat(f, R_S, kv)¶
-
apply a top-hat filter to a field f.
- pycosmommf.filter.wavevectors3D(dims, box_size=(6.283185307179586, 6.283185307179586, 6.283185307179586))¶
-
Returns the wavevectors for a 3D grid of dimensions dims and box size box_size.
pycosmommf.hessian module¶
pycosmommf.signatures module¶
- pycosmommf.signatures.maximum_signature(Rs, field, alg='NEXUSPLUS', eps=1e-08)¶
-
Compute the maximum signatures across all scales Rs.
- Parameters:
-
-
Rs (array) – The scales.
-
field (3D array) – The field.
-
alg (string, optional) – The algorithm to use. Can be either ‘NEXUS’ or ‘NEXUSPLUS’. Default is ‘NEXUSPLUS’.
-
eps (float, optional) – A small number to avoid division by zero errors and whatnot. Default is 1e-8.
-
- Returns:
-
sigmax – The maximum signatures.
- Return type:
4D array
- pycosmommf.signatures.signatures_from_hessian(hessian)¶
-
Function to calculate the signatures from a given hessian.
- Parameters:
-
hessian (4D array) – The hessian matrix.
- Returns:
-
sigs – The signatures.
- Return type:
4D array
pycosmommf.tagging module¶
- pycosmommf.tagging.calc_mass_change(sig_vec, delta_vec, Smin, Smax)¶
-
Calculate the mass change curve for a given structure type.
Arguments:¶
sig_vec - [1D Float Array] - the signature values for a given structure type delta_vec - [1D Float Array] - the delta values for a given structure type Smin - [Float] - the minimum signature value Smax - [Float] - the maximum signature value
Returns:¶
- :
-
S - [1D Float Array] - the signature values ΔM_2 - [1D Float Array] - the mass change curve
- pycosmommf.tagging.calc_structure_bools(delta, max_sigs, verbose, clusbool=None, Smin=-3, Smax=2, Δ=370)¶
-
Calculate the boolean filters for clusters, filaments, walls, and voids.
Arguments:¶
delta - [3D Float Array] - the δ delta max_sigs - [4D Float Array] - the maximum signatures array from CosmoMMF.maximum_signature() verbose - [Boolean] - a flag to allow the function to be more helpful and verbose. clusbool - [3D Boolean Array] - the cluster boolean filter Smin - [Float] - the minimum signature value Smax - [Float] - the maximum signature value Δ - [Int] - the overdensity parameter threshold for determining virialization
Returns:¶
- :
-
clusbool - [3D Boolean Array] - the cluster boolean filter filbool - [3D Boolean Array] - the filament boolean filter wallbool - [3D Boolean Array] - the wall boolean filter voidbool - [3D Boolean Array] - the void boolean filter
- VERBOSE ONLY:
-
- summary_data - [Dict] - a dictionary containing the following keys:
-
S_clus - [1D Float Array] - the signature values for clusters f_vir_clus - [1D Float Array] - the virialization fraction for clusters S_fil - [1D Float Array] - the signature values for filaments dM2_fil - [1D Float Array] - the mass change curve for filaments S_wall - [1D Float Array] - the signature values for walls dM2_wall - [1D Float Array] - the mass change curve for walls
- pycosmommf.tagging.make_the_clusbool(delta, max_sigs, Δ)¶
-
make_the_clusbool() - Documentation
A function that creates a Boolean Filter which selects only the clusters in a given cosmological δ field. This function accomplishes this by finding a threshold value for 𝒮_cluster by looking at the change in virialization fraction as a function of 𝒮_cluster.
Arguments:
delta - [3D Float Array] - delta refers to the δ delta. max_sigs - [4D Float Array] - the maximum signatures array from CosmoMMF.maximum_signature() verbose - [Boolean] - a flag to allow the function to be more helpful and verbose. Δ - [Int] - The overdensity parameter threshold for determining virialization. This parameter comes from a paper by Gunn & Gott on spherical collapse. Commonly used values that are physically motivated can be 370, 200, or 500 (for R_200 or R_500).
pycosmommf.utils module¶
- pycosmommf.utils.cylinder(n, r)¶
-
Returns an nxnxn array with a cylinder in the center with radius r. All points within the radius are set to 1, the rest are set to 0.
- pycosmommf.utils.shrink(data, new_size)¶
-
A simple function to shrink a 3D array by summing over blocks of new_size.
- pycosmommf.utils.sphere(n, r)¶
-
Returns an nxnxn array with a sphere in the center with radius r. All points within the radius are set to 1, the rest are set to 0.
- pycosmommf.utils.wall(n)¶
-
Builds a wall out of an nxnxn array. All values in the wall are set to 1. Other points are set to 0.