This repo contains the code used to run a forward modeling lensing analysis on a population of subhalos generated from a normalizing flows algorithm. The code is split into 3 main steps:
-
Generate a set of Galacticus merger trees. The file
darkMatterOnlySubHalosPipeline.xml
is the input parameter file that gets read into Galacticus,dmosh_pipeline.sh
is the job script used to run Galacticus on this parameter file, anddarkMatterOnlySubHalosPipeline.hdf5
is the output file after Galacticus has generated the merger trees. -
Train the emulator on Galacticus data. The script
normalizing_flows_pipeline.py
reads in the Galacticus data from step 1, and feeds the data into the emulator.flows_pipeline.sh
is the job file used to runnormalizing_flows_pipeline.py
. -
Perform the forward modeling analysis to generate
$S_\text{lens}$ values. The scriptsubhalos_inference_pipeline.py
uses the emulator to generate a population of emulated subhalos, and runs it through a forward modeling analysis from the analysis code samana. The.sh
file used to run this final step isinference_pipeline.sh
. Currently, thesubhalos_inference_pipeline.py
file is set up to produce$S_\text{lens}$ values from an empirical model. To produce a population of emulated subhalos, in line 140 set the variablepreset_model_name = DMEmulator
instead ofpreset_model_name = WDM
. Also, uncomment line 152, as this is an extra input that gets read into thekwargs_sample_realization
dictionary when running the emulator.
NOTE1: In steps 2 and 3, both files normalizing_flows_pipeline.py
and subhalos_inference_pipeline.py
import functions/classes from the script emulator_pipeline.py
. This script contains functions for transforming Galacticus to and from it's normalized coordinates and hypercube coordinates, as well as the code which builds the normalizing flows architecture.
NOTE2: When performing step 3, the code requires certain files of pyHalo which have been modified to incorporate the emulator in the forward modeling analysis. The first file is pyHalo/preset_models.py
, and the second file is pyHalo/PresetModels/external.py
.