h0rton.h0_inference.forward_modeling_posterior

Script to run MCMC cosmological sampling for individual lenses, using the BNN posterior

It borrows heavily from the catalogue modelling.ipynb notebook in Lenstronomy Extensions, which you can find here.

Example

To run this script, pass in the path to the user-defined inference config file as the argument:

$ python h0rton/infer_h0_mcmc_default.py mcmc_default.json

Module Contents

Classes

ForwardModelingPosterior Joint posterior over the model parameters of lens mass, lens light, source light, and AGN point source
class h0rton.h0_inference.forward_modeling_posterior.ForwardModelingPosterior(kwargs_lens_eqn_solver=None, astrometric_sigma=0.005, supersampling_factor=1)[source]

Joint posterior over the model parameters of lens mass, lens light, source light, and AGN point source as well as D_dt (H0)

kwargs_lens_init[source]
kwargs_lens_light_init[source]
kwargs_source_init[source]
kwargs_ps_init[source]
kwargs_special_init[source]
couple_lens_mass_light_centroids(self, kwargs_lens, kwargs_source, kwargs_lens_light=None, kwargs_ps=None, kwargs_special=None, kwargs_extinction=None)[source]

Force the lens mass and lens light to share centroids by appending to the MCMC objective

set_kwargs_data_joint(self, image, measured_td, measured_td_sigma, survey_object_dict, eff_exposure_time=5400.0, inverse=False)[source]

Feed in time delay and imaging data, different across lenses

image : np.array, of shape [n_pix, n_pix] measured_td : np.array, of shape [n_img - 1,] measured_td_sigma : float or np.array of shape [n_img - 1,]

get_lens_mass_mcmc_kwargs(self)[source]

Compile reasonable MCMC kwargs for the lens mass components, PEMD and SHEAR

get_lens_light_mcmc_kwargs(self)[source]

Compile reasonable MCMC kwargs for the SERSIC_ELLIPSE lens light

get_source_mcmc_kwargs(self)[source]

Compile reasonable MCMC kwargs for the SERSIC_ELLIPSE source light

get_ps_mcmc_kwargs(self, lens_init_kwargs)[source]

Get the init kwargs for point source LENSED_POSITION based on the init kwargs for the lens model, a centered point source, and reasonable redshifts

dict
kwargs for LENSED_POSITION that can be used to initialize the MCMC
get_cosmo_mcmc_kwargs(self)[source]

Compile reasonable MCMC kwargs for D_dt

run_mcmc(self, mcmc_numerics)[source]

Sample from the joint likelihood