Python package for spherical collapse calculations including monolithic and self-similar collapse models.
- Predicting turnaround and virialization properties (e.g., time, density contrast), as well as shell orbit, of top-hat spherical collapse in any cosmology
- Computing self-similar orbits and various halo profiles (mass, density, velocity, mass flow rate) in Einstein-de-Sitter universe
download with
git clone https://github.com/Kambrian/SpheriC.gitor download the zip file and extract its content.
Assuming you cloned or extracted the package to SPHERIC_DIR (e.g., /home/user/SpheriC), you need to add it to your python path.
In bash (replace $SPHERIC_DIR with your actual path)
export PYTHONPATH=$SPHERIC_DIR:$PYTHONPATHOr only add it at runtime in the beginning of your python code:
import sys
# Replace with the actual path to the SpheriC directory
SPHERIC_DIR = '/home/user/SpheriC'
sys.path.append(SPHERIC_DIR)Once the path has been setup, you can use it:
# spherical collapse solver
from SpheriC import SCSolver
sc = SCSolver(OmegaM=0.1)
sc.DeltaVirial(a=0.5)
# self-similar collapse solver
from SpheriC import ReducedOrbit
orbit = ReducedOrbit(epsilon=0.3)
orbit.solve()For more detailed examples on the usage, see the enclosed examples/Example.ipynb jupyter notebook.
If you make use of this code, please cite the following paper:
- Jiaxin Han, The many boundaries of the stratified dark matter halo, 2026, arxiv:2603.02852
Jiaxin Han (jiaxin.han #at# sjtu.edu.cn)
