Sub-halo Clustering and Abundance Matching in Python
Project description
A Python interface for Sub-halo Clustering and Abundance Matching
SCAMPy is a flexible library for “painting” an observed population of cosmological objects on top of the DM-halo/subhalo hierarchy obtained from DM-only simulations. The method combines the classical Halo Occupation Distribution (HOD) with sub-halo abundance matching (SHAM): a synergy dubbed Sub-halo Clustering and Abundance Matching (SCAM).
The procedure itself is quite easy since it only requires to apply the two methods in sequence:
by applying the HOD scheme, the host sub-haloes are selected;
the SHAM algorithm associates to each sub-halo an observable property of choice.
The animation is obtained running SCAMPy on the halo/subhalo catalogues of 42 different snapshots, from redshift \(z=8\) to redshift \(z=0\), of a \(64\,\mathrm{Mpc}/h\) DM-only N-body simulation. The simulation has been obtained with the GADGET-3 code, following the evolution of \(512^3\) DM particles. For each different redshift we have fixed the parameter values for the HOD and matched the UV-luminosity function of star-forming galaxies.
The background colour-code shows the underlying DM-density field computed by smoothing the contribution of DM-particles in a 10 Mpc/h thick slice of the simulation. The markers locate the positions of the mock galaxies generated with SCAMPy. Circles mark the position of central galaxies while crosses mark the position of satellite galaxies. The marker colour represents lower to higher luminosity going from brighter to darker.
Basic Usage
To populate a DM catalogue with mock galaxies assigned a UV magnitude you would do something like:
# read the GADGET SUBFIND tables
from scampy.io.subfind_table import subfind_table
tab = subfind_table( "/path/to/subhalo_tab_snap" )
tab.read_all_files()
# build halo and sub-halo catalogue objects
import numpy as np
from scampy.catalogue import haloCat, subhaloCat, catalogue
haloes = haloCat(
len( tab.content['GroupMass'] ),
Mhalo = tab.content['GroupMass'],
Rhalo = tab.content['GroupRadiusM200'],
X = tab.content['GroupPos'][:, 0],
Y = tab.content['GroupPos'][:, 1],
Z = tab.content['GroupPos'][:, 2],
firstSub = tab.content['GroupFirstSub'],
numSubs = tab.content['GroupNsubs'],
)
subhaloes = subhaloCat(
len( tab.content['SubhaloMass'] ),
Msubh = tab.content['SubhaloMass'],
Parent = tab.content['SubhaloGrNr'],
X = tab.content['SubhaloPos'][:, 0],
Y = tab.content['SubhaloPos'][:, 1],
Z = tab.content['SubhaloPos'][:, 2],
)
cat = catalogue( haloes, subhaloes, Lbox = 512. ) # Lbox in Mpc/h
# select host sub-haloes with an HOD
from scampy.hod import HOD, get_hosts
hod = HOD( Mmin=1.e12, siglogM=0.5, M0=1.e12, M1=1.e13, alpha=1. )
hosts = get_hosts( cat, Pcen=hod.Pcen, Psat=hod.Psat )
# define a Schechter-like UV luminosity function
def schechter ( mag ) :
alpha = -1.07
norm = 1.6e-2
mstar = -19.7 + 5. * np.log10( 5. )
lum = -0.4 * ( mag - mstar )
return 0.4 * np.log( 10 ) * norm * 10**( -0.07 * lum ) * np.exp( -10**lum )
# assign magnitudes via sub-halo abundance matching
from scampy.sham import match_distribution
magnitudes = match_distribution(
cat.subhaloes['Msubh'][hosts], schechter,
minF = -25, maxF = -10, factF = 1. / cat.volume,
)
The magnitudes array contains the UV magnitude assigned to each mock galaxy.
Installation
The recommended installation uses pip:
pip install scampy
To install from source after cloning the repository:
git clone https://github.com/TommasoRonconi/scampy.git
cd scampy
pip install .
Alternatively, a conda environment file is provided:
conda env create -f scampy_environment.yml
conda activate scampy
pip install .
Requirements
Runtime:
numpyscipymatplotlib>=3.6h5py
Python: 3.10 or later recommended (3.8+ supported).
Documentation (optional):
sphinx>=5.0sphinx-rtd-thememyst-parser
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scampy-2.0.2.tar.gz.
File metadata
- Download URL: scampy-2.0.2.tar.gz
- Upload date:
- Size: 81.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b505eaba41a90ed4791215fca8f51d353900e549997d2d2af87654c62590d564
|
|
| MD5 |
bde860e003037fef121e95afed590b98
|
|
| BLAKE2b-256 |
b888a5fecdaf30ed1e02f11f42bc5f0a20b00a4d6e0d0427dae5a604a502b668
|
Provenance
The following attestation bundles were made for scampy-2.0.2.tar.gz:
Publisher:
publish.yml on TommasoRonconi/scampy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scampy-2.0.2.tar.gz -
Subject digest:
b505eaba41a90ed4791215fca8f51d353900e549997d2d2af87654c62590d564 - Sigstore transparency entry: 1566684649
- Sigstore integration time:
-
Permalink:
TommasoRonconi/scampy@e873812b65b11558e9f380a63329e42571626ad9 -
Branch / Tag:
refs/tags/2.0.2 - Owner: https://github.com/TommasoRonconi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e873812b65b11558e9f380a63329e42571626ad9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file scampy-2.0.2-py3-none-any.whl.
File metadata
- Download URL: scampy-2.0.2-py3-none-any.whl
- Upload date:
- Size: 67.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a3d66b899b70c41c324bf34ee851534085b5fc4483484145ad150d840e2261a
|
|
| MD5 |
7d94b2d9b8f500de1f501889b38f0d89
|
|
| BLAKE2b-256 |
d1d4329d31ad71672c0b7ed676e0a0c2d1169e7f07529a8f720d0d0ec3357545
|
Provenance
The following attestation bundles were made for scampy-2.0.2-py3-none-any.whl:
Publisher:
publish.yml on TommasoRonconi/scampy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scampy-2.0.2-py3-none-any.whl -
Subject digest:
3a3d66b899b70c41c324bf34ee851534085b5fc4483484145ad150d840e2261a - Sigstore transparency entry: 1566684666
- Sigstore integration time:
-
Permalink:
TommasoRonconi/scampy@e873812b65b11558e9f380a63329e42571626ad9 -
Branch / Tag:
refs/tags/2.0.2 - Owner: https://github.com/TommasoRonconi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e873812b65b11558e9f380a63329e42571626ad9 -
Trigger Event:
push
-
Statement type: