Skip to main content

A package for detecting structures in the Cosmic Web.

Project description

PyCosmoMMF

A python version of the CosmoMMF package originally written in Julia.

PyCosmoMMF

codecov

Nexus Pipeline for analyzing the effects of baryonic matter on cosmological structures in IllustrisTNG simulations

The PyCosmoMMF package contains the algorithms necessary for a Multiscale Morphological Analysis (MMF) of cosmological simulations. The purpose of this package is to streamline our modified version of the NEXUS+ algorithm. We used the julia version of this package in our work (Sunseri et al. 2022) to analyze the effects of baryonic matter on the Cosmic Web.

The NEXUS+ algorithm contains several steps as described in our paper (Sunseri et al. 2022). In general, we start with a density field (note: we more specifically mean a 1 + δ field), smooth it with a logarithmic Gaussian smoothing filter, then compute the hessian of the smoothed density field, use the eigenvalues of the hessian matrix to calculate the structure type signatures, find the maximum signatures over a range of smoothing scales, and apply physically based threshold criterion to categorize structures within the Cosmic Web. The entire package is implemented in python and all of these steps are summarized inside of two functions. The first function maximum_signature() does the first several steps of the NEXUS+ algorithm to compute the maximum structure signatures, the second function is calc_structure_bools() which uses physical criteria to tag structures into 4 categories: clusters, filaments, walls, and voids.

We also make the data products from our paper (Sunseri et al. 2022) available for download at This Link

General Code Usage

The general usage of the package would look like:

Step I

We first calculate the maximum structure signatures across multiple smoothing scales with the NEXUS+/NEXUS algorithm

import PyCosmoMMF

density_field = np.load("path/to/density_field.npy")

Rs = [sqrt(2)**n for n in range(10)] #smoothing scales

max_signatures = PyCosmoMMF.maximum_signature(Rs, density_field, alg="NEXUSPLUS") #compute maximum signatures

The output of maximum_signature() is a 4D Float Array where the 4th index denotes the signature type: 0 = clusters, 1 = filaments, 2 = walls. An example output of this can be seen below

Step II

We then have the option of running the tagging scheme a few different ways. The first important argument in calc_structure_bools() besides the density_field and the max_signatures arrays is the verbose_flag. When

set to True the code gives a lot more information and provides a few plots. This is best turned on when

debugging the code. When verbose_flag is turned on there are 4 additional outputs to the calc_structure_bools()

function: S_fil, dM2_fil, S_wall, dM2_wall which can be used to make the mass change curves for filaments and

walls.

Verbose Flag On:

verbose_flag = True #or False


clusbool, filbool, wallbool, voidbool, S_fil, dM2_fil, S_wall, dM2_wall = PyCosmoMMF.calc_structure_bools(

                                                       density_field, max_signatures, verbose_flag) #tag structures

Verbose Flag Off:

verbose_flag = False


clusbool, filbool, wallbool, voidbool = PyCosmoMMF.calc_structure_bools(

                                        density_field, max_signatures, verbose_flag) #tag structures

We also note in the calc_structure_bools() function, one can use their own cluster boolean filter instead of the one generated by the NEXUS+ formalism (using virialization of clusters as a tool for determining spurious detections). This is helpful if you want to use a more trusted cluster/halo finder algorithm (FoF, Rockstar, etc...). For more information on the NEXUS+ method, see Cautun et al. 2013.

External Cluster Boolean Filter:

clusbool_ext = np.load("path/to/cluster_boolean_filter.npy")#load in externally computed boolean filter for clusters

verbose_flag = False


clusbool, filbool, wallbool, voidbool = PyCosmoMMF.calc_structure_bools(
                                        density_field, max_signatures, verbose_flag, clusbool_ext) #tag structures

Another important optional argument in the calc_structure_bools() function is Δ. The default value is Δ = 370 as used in Cautun et al. 2013 but other values can be 200 or 500 corresponding to R_200 or R_500. Δ is the overdensity parameter, when clusters achieve a density greater than this value, they are thought to be virialized/collapsed.

The boolean filters for each structure type produced by calc_structure_bools() can be used to tag structures within a density field, the results of this can be seen below

Additional Code Information

  • Note: The NEXUS+ implementation of tagging clusters is highly dependent on the the grid resolution being used. The cluster boolean filter will only be physically motivated if the resolution of each voxel is roughly < 1 Mpc/h so clusters can be resolved.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyCosmoMMF-0.0.8.tar.gz (129.4 kB view details)

Uploaded Source

Built Distribution

PyCosmoMMF-0.0.8-py3-none-any.whl (126.0 kB view details)

Uploaded Python 3

File details

Details for the file PyCosmoMMF-0.0.8.tar.gz.

File metadata

  • Download URL: PyCosmoMMF-0.0.8.tar.gz
  • Upload date:
  • Size: 129.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for PyCosmoMMF-0.0.8.tar.gz
Algorithm Hash digest
SHA256 3b17303e1c4874ca7261b30b98d138f6cc3b80a64c8b679463f48d5233b09c71
MD5 cf74d512e0aa8a61b20ccdd42bd102e2
BLAKE2b-256 8793ea71b762a8fe69022bb37b17d18dbc12a6ebc831d6e9e5f88ed674a1f6b2

See more details on using hashes here.

File details

Details for the file PyCosmoMMF-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: PyCosmoMMF-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 126.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for PyCosmoMMF-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 bfb2df0fe093666a3c4fb45936e34978d742d8287ac6b29b93ba1d73e2f7b326
MD5 33a93fffcac7e6c31fc093cb40edb34a
BLAKE2b-256 cf8902011ea78ba266e26823c80e8085ea6a649fcb621166e1eed5d7f3fa7346

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page