Inferring subhalo effective density slopes from strong lensing observations with neural likelihood-ratio estimation
The code uses standard astropy
, numpy
and scipy
packages. We use paltas and lenstronomy for data generation. These can be installed as follows:
pip install paltas lenstronomy
We ran our analysis with Python 3.7.7
and Pytorch 1.11.0+cu102
.
To generate mock lensing images, use the following scripts (which have dependency on utils.py):
- make_images_eplsh.py makes lensing images with EPL subhalos
- make_images_nfwsh.py makes lensing images with NFW subhalos
Note: if these scripts are run with slurm job arrays, then it is necessary to manually combine the gamma parameter files produced by the job arrays.
The likelihood-ratio estimator model class is in resnet.py. To train the model on generated images, run train.py with the specified parameters (which has dependecy on data_utils.py).
figures.ipynb contains code that produces the plots in 2208.13796.