Tools for computing and analyzing properties derived from the dark matter density field in cosmological simulations.
This repository provides methods and scripts for:
- Building the density field from dark matter particles using grid assignment schemes (CIC, TSC, etc.).
- Computing the tidal tensor and its eigenvalues/eigenvectors.
- Deriving related quantities such as tidal anisotropy and linear bias.
- Performing auxiliary analyses on density fields, including smoothing, Fourier transforms, and memory-efficient batching.
Clone the repository and create the environment:
git clone https://github.com/<your-username>/density_field_properties.git
cd density_field_properties
conda env create -f environment.yml
conda activate density_fieldAlternatively, install it as a local editable package:
pip install -e .To ensure consistent code style and quality, this repository uses pre-commit hooks configured with:
Install pre-commit
pip install pre-commitSet up hooks in your local repository
pre-commit installRun checks manually (optional)
pre-commit run --all-filesThe hooks will automatically run on every git commit, ensuring that code is formatted, imports are sorted, and style issues are caught early.
numpyscipyh5pymatplotlibtqdmnumba(optional, for JIT acceleration)
This codebase is designed for studies involving:
- Assembly bias and extended HOD models (e.g.
hod_madrid_py). - Tidal tensor and anisotropy in large-scale structure (Haloscope project).
- Applications to UNIT (UNIT simulations), FastPM (FastPM GitHub), and CAMELS (CAMELS project).
- Integration within cosmological survey frameworks such as Euclid (ESA Euclid mission) and DESI (DESI collaboration).
Rockstar text catalogs produced after FastPM runs (for example out_0.list under
rockstar_out_pm or rockstar_out_nbody) are read with the same
RockstarCatalogReader as standalone Rockstar outputs. Do not use
FastPMCatalogReader for those .list files; that reader is only for native
halos stored in FastPM BigFile snapshots.
Design: reuse RockstarCatalogReader only—no duplicate parser in
fastpm.py and no separate fastpm_rockstar catalog alias unless a future
requirement justifies it.
CLI example:
python scripts/your_pipeline.py \
--halo_catalog_name rockstar \
--halo_file /path/to/fastpm_tfm/rockstar_out_pm/out_0.listTypical folder layout on shared storage is documented in
config/fastpm_folders.md (rockstar_out_pm vs
rockstar_out_nbody).