This repository is part of the Bayesian Light Source Separator (BLISS) software family. It implements two forms of neural probabilistic weak lensing inference. The first infers convergence maps from images, and the second infers LambdaCDM parameters from convergence maps.
Create a virtual environment and install dependencies:
uv venv
source .venv/bin/activate
uv syncFor development dependencies (Jupyter, linting, etc.):
uv sync --group devThis module implements neural posterior estimation (NPE) for inferring weak lensing shear and convergence from LSST-like images. It supports two applications:
- DC2: Infer tomographic mass maps for the DC2 Simulated Sky Survey
- descwl-shear-sims: Infer constant shear from images generated with
descwl-shear-sims
python -u images_to_maps/dc2/generate_catalog.pypython -m images_to_maps.dc2.trainOr with Hydra config override:
python -m images_to_maps.dc2.train --config-path=. --config-name=config_train_npe- Results:
images_to_maps/dc2/results/credibleintervals.ipynb,posteriormeanmaps.ipynb - Exploratory:
images_to_maps/dc2/exploratory/dc2imageandmaps.ipynb,ellipticity.ipynb,galaxyproperties.ipynb,twopoint.ipynb
python -m images_to_maps.descwl.trainOr with Hydra config override:
python -m images_to_maps.descwl.train --config-path=. --config-name=config_train_npeConfigure settings in images_to_maps/descwl/config_run_anacal.yaml.
python -u images_to_maps/descwl/run_anacal.py- Results:
images_to_maps/descwl/results/compute_npe_credibleintervals.py,credibleintervals.ipynb,scatterplots.ipynb - Exploratory:
images_to_maps/descwl/exploratory/images.ipynb
Training logs are saved to TensorBoard. View with:
tensorboard --logdir=images_to_maps/dc2/resultsor for descwl:
tensorboard --logdir=images_to_maps/descwl/resultsThis module implements inference of cosmological parameters from weak lensing convergence maps. Two methods are supported:
- NPE (neural posterior estimation): Infers a full-rank multivariate normal variational distribution over cosmological parameters.
- Flow matching: Approximates the posterior distribution using a velocity field that transports noise to cosmological parameters via ODE integration.
Generate synthetic convergence maps using the log-normal forward model from sbi_lens:
python -m maps_to_cosmology.generate_mapsOverride defaults with Hydra syntax:
python -m maps_to_cosmology.generate_maps num_maps=50000 output_dir=/path/to/outputTrain with NPE (default):
python -m maps_to_cosmology.trainTrain with flow matching:
python -m maps_to_cosmology.train --config-name=train_flowmatchingTraining logs are saved to TensorBoard. View with:
tensorboard --logdir=maps_to_cosmology/results