lenstronomy.Sampling.Likelihoods package

Submodules

lenstronomy.Sampling.Likelihoods.image_likelihood module

class lenstronomy.Sampling.Likelihoods.image_likelihood.ImageLikelihood(multi_band_list, multi_band_type, kwargs_model, bands_compute=None, image_likelihood_mask_list=None, source_marg=False, linear_prior=None, check_positive_flux=False, kwargs_pixelbased=None)[source]

Bases: object

manages imaging data likelihoods

logL(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_special=None, kwargs_extinction=None)[source]
Parameters
  • kwargs_lens – lens model keyword argument list according to LensModel module

  • kwargs_source – source light keyword argument list according to LightModel module

  • kwargs_lens_light – deflector light (not lensed) keyword argument list according to LightModel module

  • kwargs_ps – point source keyword argument list according to PointSource module

  • kwargs_special – special keyword argument list as part of the Param module

  • kwargs_extinction – extinction parameter keyword argument list according to LightModel module

Returns

log likelihood of the data given the model

property num_data
Returns

number of image data points

num_param_linear(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_special=None, kwargs_extinction=None)[source]
Returns

number of linear parameters solved for during the image reconstruction process

reset_point_source_cache(cache=True)[source]
Parameters

cache – boolean

Returns

lenstronomy.Sampling.Likelihoods.position_likelihood module

class lenstronomy.Sampling.Likelihoods.position_likelihood.PositionLikelihood(point_source_class, image_position_uncertainty=0.005, astrometric_likelihood=False, image_position_likelihood=False, ra_image_list=None, dec_image_list=None, source_position_likelihood=False, check_matched_source_position=False, source_position_tolerance=0.001, source_position_sigma=0.001, force_no_add_image=False, restrict_image_number=False, max_num_images=None)[source]

Bases: object

likelihood of positions of multiply imaged point sources

static astrometric_likelihood(kwargs_ps, kwargs_special, sigma)[source]

evaluates the astrometric uncertainty of the model plotted point sources (only available for ‘LENSED_POSITION’ point source model) and predicted image position by the lens model including an astrometric correction term.

Parameters
  • kwargs_ps – point source model kwargs list

  • kwargs_special – kwargs list, should include the astrometric corrections ‘delta_x’, ‘delta_y’

  • sigma – 1-sigma Gaussian uncertainty in the astrometry

Returns

log likelihood of the astrometirc correction between predicted image positions and model placement of the point sources

check_additional_images(kwargs_ps, kwargs_lens)[source]

checks whether additional images have been found and placed in kwargs_ps of the first point source model #TODO check for all point source models :param kwargs_ps: point source kwargs :return: bool, True if more image positions are found than originally been assigned

image_position_likelihood(kwargs_ps, kwargs_lens, sigma)[source]

computes the likelihood of the model predicted image position relative to measured image positions with an astrometric error. This routine requires the ‘ra_image_list’ and ‘dec_image_list’ being declared in the initiation of the class

Parameters
  • kwargs_ps – point source keyword argument list

  • kwargs_lens – lens model keyword argument list

  • sigma – 1-sigma uncertainty in the measured position of the images

Returns

log likelihood of the model predicted image positions given the data/measured image positions.

logL(kwargs_lens, kwargs_ps, kwargs_special, verbose=False)[source]
Parameters
  • kwargs_lens – lens model parameter keyword argument list

  • kwargs_ps – point source model parameter keyword argument list

  • kwargs_special – special keyword arguments

  • verbose – bool

Returns

log likelihood of the optional likelihoods being computed

property num_data
Returns

integer, number of data points associated with the class instance

source_position_likelihood(kwargs_lens, kwargs_ps, sigma, hard_bound_rms=None, verbose=False)[source]

computes a likelihood/punishing factor of how well the source positions of multiple images match given the image position and a lens model. The likelihood level is computed in respect of a displacement in the image plane and transposed through the Hessian into the source plane.

Parameters
  • kwargs_lens – lens model keyword argument list

  • kwargs_ps – point source keyword argument list

  • sigma – 1-sigma Gaussian uncertainty in the image plane

  • hard_bound_rms – hard bound deviation between the mapping of the images back to the source plane (in source frame)

  • verbose – bool, if True provides print statements with useful information.

Returns

log likelihood of the model reproducing the correct image positions given an image position uncertainty

lenstronomy.Sampling.Likelihoods.prior_likelihood module

class lenstronomy.Sampling.Likelihoods.prior_likelihood.PriorLikelihood(prior_lens=None, prior_source=None, prior_lens_light=None, prior_ps=None, prior_special=None, prior_extinction=None, prior_lens_kde=None, prior_source_kde=None, prior_lens_light_kde=None, prior_ps_kde=None, prior_special_kde=None, prior_extinction_kde=None, prior_lens_lognormal=None, prior_source_lognormal=None, prior_lens_light_lognormal=None, prior_ps_lognormal=None, prior_special_lognormal=None, prior_extinction_lognormal=None)[source]

Bases: object

class containing additional Gaussian priors to be folded into the likelihood

logL(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_special=None, kwargs_extinction=None)[source]
Parameters

kwargs_lens – lens model parameter list

Returns

log likelihood of lens center

lenstronomy.Sampling.Likelihoods.time_delay_likelihood module

class lenstronomy.Sampling.Likelihoods.time_delay_likelihood.TimeDelayLikelihood(time_delays_measured, time_delays_uncertainties, lens_model_class, point_source_class)[source]

Bases: object

class to compute the likelihood of a model given a measurement of time delays

logL(kwargs_lens, kwargs_ps, kwargs_cosmo)[source]

routine to compute the log likelihood of the time delay distance :param kwargs_lens: lens model kwargs list :param kwargs_ps: point source kwargs list :param kwargs_cosmo: cosmology and other kwargs :return: log likelihood of the model given the time delay data

property num_data
Returns

number of time delay measurements

Module contents