A Python package for analyzing the impact of baryonic physics on cosmological weak lensing maps using simulation-based inference.
BAR_IMPACT provides tools for:
- Summary Statistics: L1 norms (wavelet coefficients), angular power spectra, peak counts
- Tomographic Analysis: BNT (Bernardeau-Nishimichi-Taruya) transform for nulling redshift correlations
- Simulation-Based Inference: Neural Posterior Estimation (NPE) with JAX
- Posterior Validation: TARP coverage testing
# Basic installation
pip install -e .
# With inference dependencies (JAX, jaxili)
pip install -e ".[inference]"
# With development tools
pip install -e ".[dev]"
# All dependencies
pip install -e ".[all]"from bar_impact.core import ConvergenceMap, SurveyMask
from bar_impact.processing import PowerSpectrumProcessor
# Load convergence map
kappa = ConvergenceMap.from_h5("simulation.h5", bin_number=1)
# Add shape noise and apply survey mask
kappa = kappa.add_shape_noise(sigma_e=0.26)
mask = SurveyMask.create_disk_mask(nside=512, target_area_sqdeg=14000)
kappa = kappa.apply_mask(mask)
# Compute power spectrum
processor = PowerSpectrumProcessor(lmax=1024)
cls = processor.process_single(kappa.data)src/bar_impact/
├── core/ # ConvergenceMap, SurveyMask, DataVector
├── processing/ # L1NormProcessor, PowerSpectrumProcessor, PeakCountProcessor
├── inference/ # NPEInference, CoverageTester
├── analysis/ # Aggregation and visualization
├── utils/ # I/O, noise generation, reproducibility
└── constants.py # BNT matrices, default parameters
Full documentation is available at bar-impact.readthedocs.io
pytest tests/ -vMIT License - see LICENSE for details.
If you use this package, please cite:
@software{bar_impact,
author = {Tersenov, Andreas},
title = {BAR_IMPACT: Baryon Impact Analysis for Weak Lensing},
url = {https://github.com/AndreasTersenov/bar_impact}
}