Skip to content

Latest commit

 

History

History
133 lines (85 loc) · 3.39 KB

File metadata and controls

133 lines (85 loc) · 3.39 KB

blissWL

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.

Installation

Create a virtual environment and install dependencies:

uv venv
source .venv/bin/activate
uv sync

For development dependencies (Jupyter, linting, etc.):

uv sync --group dev

Images to maps

This module implements neural posterior estimation (NPE) for inferring weak lensing shear and convergence from LSST-like images. It supports two applications:

  1. DC2: Infer tomographic mass maps for the DC2 Simulated Sky Survey
  2. descwl-shear-sims: Infer constant shear from images generated with descwl-shear-sims

DC2

Generate catalog

python -u images_to_maps/dc2/generate_catalog.py

Train MassMapEncoder

python -m images_to_maps.dc2.train

Or with Hydra config override:

python -m images_to_maps.dc2.train --config-path=. --config-name=config_train_npe

Notebooks

  • Results: images_to_maps/dc2/results/credibleintervals.ipynb, posteriormeanmaps.ipynb
  • Exploratory: images_to_maps/dc2/exploratory/dc2imageandmaps.ipynb, ellipticity.ipynb, galaxyproperties.ipynb, twopoint.ipynb

descwl-shear-sims

Train ScalarShearEncoder

python -m images_to_maps.descwl.train

Or with Hydra config override:

python -m images_to_maps.descwl.train --config-path=. --config-name=config_train_npe

Run AnaCal

Configure settings in images_to_maps/descwl/config_run_anacal.yaml.

python -u images_to_maps/descwl/run_anacal.py

Notebooks

  • Results: images_to_maps/descwl/results/compute_npe_credibleintervals.py, credibleintervals.ipynb, scatterplots.ipynb
  • Exploratory: images_to_maps/descwl/exploratory/images.ipynb

View training logs

Training logs are saved to TensorBoard. View with:

tensorboard --logdir=images_to_maps/dc2/results

or for descwl:

tensorboard --logdir=images_to_maps/descwl/results

Maps to cosmology

This module implements inference of cosmological parameters from weak lensing convergence maps. Two methods are supported:

  1. NPE (neural posterior estimation): Infers a full-rank multivariate normal variational distribution over cosmological parameters.
  2. Flow matching: Approximates the posterior distribution using a velocity field that transports noise to cosmological parameters via ODE integration.

Generate convergence maps

Generate synthetic convergence maps using the log-normal forward model from sbi_lens:

python -m maps_to_cosmology.generate_maps

Override defaults with Hydra syntax:

python -m maps_to_cosmology.generate_maps num_maps=50000 output_dir=/path/to/output

Train the encoder

Train with NPE (default):

python -m maps_to_cosmology.train

Train with flow matching:

python -m maps_to_cosmology.train --config-name=train_flowmatching

Training logs are saved to TensorBoard. View with:

tensorboard --logdir=maps_to_cosmology/results