lenstronomy.Sampling.Likelihoods package — lenstronomy 1.8.2 documentation

# 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)

  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)

    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

  `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)

    Returns: | number of linear parameters solved for during the image reconstruction process

  `reset_point_source_cache`(bool=True)

    Parameters: | bool – 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=[], dec_image_list=[], 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)

  Bases: `object`

  likelihood of positions of multiply imaged point sources

  static `astrometric_likelihood`(kwargs_ps, kwargs_special, sigma)

    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)

    checks whether additional images have been found and placed in kwargs_ps :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)

    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)

    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

  `num_data`

    Returns: | integer, number of data points assocated with the class instance

  `source_position_likelihood`(kwargs_lens, kwargs_ps, sigma, hard_bound_rms=None, verbose=False)

    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=[], prior_source=[], prior_lens_light=[], prior_ps=[], prior_special=[], prior_extinction=[], prior_lens_kde=[], prior_source_kde=[], prior_lens_light_kde=[], prior_ps_kde=[], prior_special_kde=[], prior_extinction_kde=[], prior_lens_lognormal=[], prior_source_lognormal=[], prior_lens_light_lognormal=[], prior_ps_lognormal=[], prior_special_lognormal=[], prior_extinction_lognormal=[])

  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)

    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)

  Bases: `object`

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

  `logL`(kwargs_lens, kwargs_ps, kwargs_cosmo)

    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

  `num_data`

    Returns: | number of time delay measurements

## Module contents