jaxtronomy.Sampling.Likelihoods package¶
Submodules¶
jaxtronomy.Sampling.Likelihoods.image_likelihood module¶
- class 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, linear_solver=True)[source]¶
Bases:
objectManages imaging data likelihoods.
- __init__(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, linear_solver=True)[source]¶
- Parameters:
multi_band_list – list of imaging band configurations [[kwargs_data, kwargs_psf, kwargs_numerics],[…], …]
multi_band_type – string, can be “single-band” only in jaxtronomy. “multi-linear” and “joint-liner” not supported yet
kwargs_model – dict containing model option keyword arguments. See arguments to class_creator.create_class_instances() for options.
bands_compute – bool list to indicate which band to be included in the modeling, only relevant for joint-linear and multi-linear. For single-band, the band index is zero by default.
image_likelihood_mask_list – list of boolean 2d arrays of size of images marking the pixels to be evaluated in the likelihood
source_marg – bool, performs a marginalization over the linear parameters
linear_prior – linear prior width in eigenvalues
check_positive_flux – checks whether the results of the linear solver amplitudes are positive, and applies a logL penalty if amplitudes are negative (for profiles whose amplitudes have a physical interpretation)
kwargs_pixelbased – should be None; not supported in jaxtronomy
linear_solver – bool, determines whether to solve for linear parameters (amplitudes of sources)
- logL(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_special=None, kwargs_extinction=None, **kwargs)[source]¶
Computes the log likelihood of the data given a model. The model kwargs are used to simulate an image which is compared to the data image.
- 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, linear parameter inversion list
- property num_data¶
- Returns:
number of image data points
jaxtronomy.Sampling.Likelihoods.position_likelihood module¶
- class 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=None, source_position_tolerance=None, source_position_sigma=0.001, force_no_add_image=False, restrict_image_number=False, max_num_images=None)[source]¶
Bases:
objectLikelihood of positions of multiply imaged point sources.
- __init__(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=None, source_position_tolerance=None, source_position_sigma=0.001, force_no_add_image=False, restrict_image_number=False, max_num_images=None)[source]¶
- Parameters:
point_source_class – Instance of PointSource() class
image_position_uncertainty – uncertainty in image position uncertainty (1-sigma Gaussian radially), this is applicable for astrometric uncertainties as well as if image positions are provided as data
astrometric_likelihood – bool, if True, evaluates the astrometric uncertainty of the predicted and modeled image positions with an offset ‘delta_x_image’ and ‘delta_y_image’
image_position_likelihood – bool, if True, evaluates the likelihood of the model predicted image position given the data/measured image positions
ra_image_list – list of lists; RA image positions per model component
dec_image_list – list of lists; DEC image positions per model component
source_position_likelihood – bool, if True, ray-traces image positions back to source plane and evaluates relative errors in respect ot the position_uncertainties in the image plane (image_position_uncertainty)
source_position_tolerance (None or float) – tolerance level (in arc seconds in the source plane) of the different images. If set =! None, then the backwards ray tracing is performed on the images and demand on the same position of the source is meant to match the requirements, otherwise a punishing likelihood term is introduced
source_position_sigma – r.m.s. value corresponding to a 1-sigma Gaussian likelihood accepted by the model precision in matching the source position transformed from the image plane
force_no_add_image – bool, if True, will punish additional images appearing in the frame of the modelled image(first calculate them)
restrict_image_number – bool, if True, searches for all appearing images in the frame of the data and compares with max_num_images
max_num_images – integer, maximum number of appearing images. Default is the number of images given in the Param() class
- 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
- 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
- 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.
- 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 – float, 1-sigma Gaussian uncertainty in the image plane
hard_bound_rms – float or None, hard bound deviation between the mapping of the images back to the source plane (in source frame)
verbose – unused
- Returns:
log likelihood of the model reproducing the correct image positions given an image position uncertainty
- property num_data¶
- Returns:
integer, number of data points associated with the class instance