Plotting and Data Loaders
halocat.plotting provides lightweight helpers for loading reformatted DEGRACE-pilot summary products and plotting them with matplotlib.
Data containers
The module returns structured dataclasses rather than bare arrays:
PkMmDataforpk_mm.datHMFDataforhmf.hdf5
These objects retain both the measurement arrays and the identifying metadata such as gravity, redshift, imodel, and ibox.
Load reformatted products
Load one matter power spectrum:
from halocat import load_degrace_pk_mm
pk = load_degrace_pk_mm(
gravity="fRn1",
redshift=0.25,
imodel=1,
ibox=1,
)
The returned PkMmData includes:
kpknmodesbin_index- the first three header lines from the source file
Load one halo mass function:
from halocat import load_degrace_hmf
hmf = load_degrace_hmf(
gravity="fRn1",
redshift=0.25,
imodel=1,
ibox=1,
)
The returned HMFData includes:
log10mass_edgeslog10mass_centresmass_edgesmass_centrescountsdndlog10mcumulative_number_densityvolume
Plot helpers
plot_degrace_pk_mm_models(...) overlays several pk_mm.dat products for one (gravity, redshift, ibox) combination:
from halocat import plot_degrace_pk_mm_models
fig, ax = plot_degrace_pk_mm_models(
gravity="fRn1",
redshift=0.25,
imodels=[0, 1, 2],
ibox=1,
)
plot_degrace_hmf_models(...) does the same for HMF products:
from halocat import plot_degrace_hmf_models
fig, ax = plot_degrace_hmf_models(
gravity="fRn1",
redshift=0.25,
imodels=[0, 1, 2],
ibox=1,
statistic="differential",
)
For HMF plots, statistic must be one of:
"differential""cumulative"
Both plotting helpers:
- create a new matplotlib figure when
ax=None - return
(fig, ax) - accept
label_templatefor legend formatting - accept
output_root=to override the default DEGRACE output directory
Dependencies
load_degrace_hmf(...)requiresh5py- the plotting helpers require
matplotlib