Skip to content
HainaHuang729Public

Repository files navigation

ObsCU (obscu) — Cosmological Survey Forward Modeling & Baryon Calibration

License: MIT Release Python >= 3.11 Documentation

Documentation · Function Wiki · Basic examples · API Guide · GPU Benchmarks · llms.txt

ObsCU (v2.0.0) is the standalone post-processing survey forward-modeling, inference, and baryon-calibration library of the CU (Cosmology Unified) ecosystem — complementing and accelerating PyCCL / Halotools / GLASS / Lenstools workflows for Euclid, CSST, LSST, DESI, and JWST surveys. Strictly decoupled from gravityCU time integration, it consumes outputs from CosmoCU ($\chi(z), H(z), P_{\rm NL}(k,z)$, 5D AD Fisher Jacobians) and gravityCU (v3.10 merger trees / 6D subhalos, v3.11 lightcone HEALPix density shells, SPH hydro snapshots), as well as 21cmCU reionization boxes.


Modules & Survey Capabilities

Package / Module Capabilities & Physics Models Survey / Cross-Probe Support
obscu.weak_lensing Born & multi-plane ray-tracing ($\kappa, \gamma$) for flat-sky & HEALPix, MG $\Sigma_0$ slip, NLA/TATT IA (flat & spherical), observer-relative $z_{\rm obs}$ lightcone geometry, curved-sky spin-0/spin-2 MASTER mode coupling, real-space $\xi_\pm / w(\theta)$, 3×2pt builders Euclid, CSST, LSST, DESI
obscu.mock_galaxies & obscu.photometry Extended HOD (Assembly Bias) & SHAM, gravityCU merger-tree accretion, high-$z$ $M_{\rm UV}$ / UV LF, GSMF, RSD, filter photometry, catalog-to-grid projection JWST, Euclid, CSST, LSST, DESI
obscu.lya_skewers Periodic Wendland C2 SPH skewers, banded velocity-space optical depths (exact_hi & fgpa, Gaussian/Voigt), $\tau_{\rm eff}$ UVB rescaling, spectrograph PSF/SNR, $(T_0,\gamma)$ fit, $P_{1\mathrm{D},F}(k_\parallel)$ DESI Ly$\alpha$ forest
obscu.cmb_secondary & obscu.cross_probes Correlated $\kappa_{\rm CMB}$, tSZ Compton-$y$, kSZ $\Delta T/T$, 3D/2D cross-power spectra, 21cmCU × galaxy cross-PS CMB-S4 / Simons Obs. × LSS/21cm
obscu.summary_stats Device-native CPU/CuPy weak-lensing peak counts, 1-pt PDF/moments, $P_0/P_2/P_4(k)$ multipoles, periodic $k$NN-CDF, 2D Minkowski functionals ($V_0, V_1, V_2$), 3D bispectrum, 2D wavelet scattering moments (WST) Non-Gaussian SBI summaries
obscu.calibration, obscu.datasets & obscu.sbi GSMF / $f_{\rm gas}$ / $M_{\rm BH}-M_\star$ / strict common-overlap $S_{\rm bar}(k,z)$, closed-loop CosmoCU HMCode_CU_feedback / BCM fitter, curated literature datasets, zero-copy DLPack ingest, LHS SBI runner Closed-loop DMO+Hydro calibration
obscu.forecast, obscu.nonstandard, obscu.io, obscu.validation & obscu.pipeline Limber 3×2pt & 6×2pt theory, CosmoCU 5D AD Fisher, Knox/Hartlap/Super-Sample (SSC) covariances, Sellentin–Heavens, WDM/FDM/BPL, sharded NPZ/HDF5 + IEEE-754 WCS FITS & DESC SACC-v1 I/O, 10-gate validation (obscu benchmark), TOML CLI (obscu run), single-pass streaming lightcone multiprobes (run_streaming_lightcone_multiprobes) End-to-end verification, standards I/O & forecast
obscu.imaging_sim Sub-pixel Sérsic/starfield RGB deep-field rasterizer (sky_renderer), single-launch spatially varying Zernike PSF + OU jitter + radial vignetting/spikes/CR + CMOS noise (psf_degrader) with DLPack batch generation (1,640–3,182 pairs/sec on RTX 4090), restoration fidelity probes (restoration_metrics) Optical imaging validation

Benchmarks & Documentation

  • Developer guide: docs/API_GUIDE.md
  • GPU cluster benchmark protocol & measured RTX 4090 results ($N_{\rm side}=4096$ in 0.51 s, $10^7$ halos in 0.82 s, 85.5× speedup; imaging_sim 1,640–3,182 pairs/sec): docs/GPU_BENCHMARK_PROTOCOL.md
  • Generate validation dashboard: PYTHONPATH=src python3 -m obscu.cli dashboard --output-dir validation_dashboard
  • Run scale benchmark (smoke / mid / production): PYTHONPATH=src python3 scripts/benchmark_gpu_production.py --preset smoke

Canonical Units & Backends

  • Units: non-h comoving $\mathrm{Mpc}$, $M_\odot$, $\mathrm{km,s^{-1}}$, $\mathrm{Mpc}^{-1}$.
  • Compute Backends: CPU-first (numpy / scipy), with optional cupy GPU acceleration (backend="cupy" or "auto").

Quick Start

# Install editable package (optional extras: io, healpix, gpu, full)
pip install -e .

# Check optional dependencies and module readiness
PYTHONPATH=src python3 -m obscu.cli check

# Run 10 quantitative analytic + live CosmoCU validation gates
PYTHONPATH=src python3 -m obscu.cli benchmark

# Run full forward-modeling pipeline from a CU-Suite/ObsCU TOML config
PYTHONPATH=src python3 -m obscu.cli run path/to/project.toml --output-dir runs/smoke

# Run unit tests & examples
PYTHONPATH=src python3 -m unittest discover -s tests -v
PYTHONPATH=src python3 examples/euclid_3x2pt_fisher.py
PYTHONPATH=src python3 examples/jwst_wdm_uvlf_and_lya.py
PYTHONPATH=src python3 examples/ng_sbi_wdm_bpl_fom.py

Cosmology Unified (CU) Ecosystem

Repository Role Canonical Link
CU-Suite Top-level orchestrator, interface contract & baryon calibration https://github.com/HainaHuang729/CU-Suite
CosmoCU C++20 Einstein–Boltzmann, nonlinear HMcode/BCM/EFTofLSS, CMB & Dual<10> AD https://github.com/HainaHuang729/CosmoCU
ICU Memory-optimized GPU/CPU/MPI 1LPT/2LPT/3LPT cosmological initial conditions https://github.com/HainaHuang729/ICU
gravityCU Multi-GPU VRAM-resident CUDA TreePM, SPH hydro, lightcones & GPU FoF https://github.com/HainaHuang729/gravityCU
21cmCU Native C/CUDA + cuFFT 21cm reionization & Bayesian inference engine https://github.com/HainaHuang729/21cmCU
ObsCU Decoupled cosmological survey forward modeling, SBI & baryon calibration https://github.com/HainaHuang729/ObsCU

Citation

If you use ObsCU in your research, please cite CITATION.cff:

@software{huang_2026_obscu,
  author       = {Huang, Haina},
  title        = {{ObsCU}: Decoupled Cosmological Survey Forward-Modeling and Baryon-Calibration Library},
  version      = {2.0.0},
  year         = {2026},
  url          = {https://github.com/HainaHuang729/ObsCU}
}

Releases

Packages

Contributors

Languages