lenstronomy.ImSim.MultiBand package — lenstronomy 1.9.1 documentation

# lenstronomy.ImSim.MultiBand package

## Submodules

## lenstronomy.ImSim.MultiBand.joint_linear module

class lenstronomy.ImSim.MultiBand.joint_linear.JointLinear(multi_band_list, kwargs_model, compute_bool=None, likelihood_mask_list=None)

  Bases: `lenstronomy.ImSim.MultiBand.multi_linear.MultiLinear`

  class to model multiple exposures in the same band and makes a constraint fit to all bands simultaneously with joint constraints on the surface brightness of the model. This model setting require the same surface brightness models to be called in all available images/bands

  property data_response

    returns the 1d array of the data element that is fitted for (including masking)

    Returns

      1d numpy array

  error_response(kwargs_lens, kwargs_ps, kwargs_special=None)

    returns the 1d array of the error estimate corresponding to the data response

    Returns

      1d numpy array of response, 2d array of additonal errors (e.g. point source uncertainties)

  image_linear_solve(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_extinction=None, kwargs_special=None, inv_bool=False)

    computes the image (lens and source surface brightness with a given lens model). The linear parameters are computed with a weighted linear least square optimization (i.e. flux normalization of the brightness profiles)

    Parameters

      - kwargs_lens – list of keyword arguments corresponding to the superposition of different lens profiles

      - kwargs_source – list of keyword arguments corresponding to the superposition of different source light profiles

      - kwargs_lens_light – list of keyword arguments corresponding to different lens light surface brightness profiles

      - kwargs_ps – keyword arguments corresponding to “other” parameters, such as external shear and point source image positions

      - inv_bool – if True, invert the full linear solver Matrix Ax = y for the purpose of the covariance matrix.

    Returns

      1d array of surface brightness pixels of the optimal solution of the linear parameters to match the data

  likelihood_data_given_model(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_extinction=None, kwargs_special=None, source_marg=False, linear_prior=None, check_positive_flux=False)

    computes the likelihood of the data given a model This is specified with the non-linear parameters and a linear inversion and prior marginalisation.

    Parameters

      - kwargs_lens –

      - kwargs_source –

      - kwargs_lens_light –

      - kwargs_ps –

      - check_positive_flux – bool, if True, checks whether the linear inversion resulted in non-negative flux components and applies a punishment in the likelihood if so.

    Returns

      log likelihood (natural logarithm) (sum of the log likelihoods of the individual images)

  linear_response_matrix(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_extinction=None, kwargs_special=None)

    computes the linear response matrix (m x n), with n being the data size and m being the coefficients

    Parameters

      - kwargs_lens –

      - kwargs_source –

      - kwargs_lens_light –

      - kwargs_ps –

    Returns

## lenstronomy.ImSim.MultiBand.multi_data_base module

class lenstronomy.ImSim.MultiBand.multi_data_base.MultiDataBase(imageModel_list, compute_bool=None)

  Bases: `object`

  Base class with definitions that are shared among all variations of modelling multiple data sets

  property num_bands
  property num_data_evaluate
  num_param_linear(kwargs_lens, kwargs_source, kwargs_lens_light, kwargs_ps)
    Parameters

      compute_bool –

    Returns

      number of linear coefficients to be solved for in the linear inversion

  property num_response_list

    list of number of data elements that are used in the minimization

    Returns

      list of integers

  reduced_residuals(model_list, error_map_list=None)
    Parameters

      - model_list – list of models

      - error_map_list – list of error maps

    Returns

  reset_point_source_cache(bool=True)

    deletes all the cache in the point source class and saves it from then on

    Returns

## lenstronomy.ImSim.MultiBand.multi_linear module

class lenstronomy.ImSim.MultiBand.multi_linear.MultiLinear(multi_band_list, kwargs_model, likelihood_mask_list=None, compute_bool=None, kwargs_pixelbased=None)

  Bases: `lenstronomy.ImSim.MultiBand.multi_data_base.MultiDataBase`

  class to simulate/reconstruct images in multi-band option. This class calls functions of image_model.py with different bands with joint non-linear parameters and decoupled linear parameters.

  the class supports keyword arguments ‘index_lens_model_list’, ‘index_source_light_model_list’, ‘index_lens_light_model_list’, ‘index_point_source_model_list’, ‘index_optical_depth_model_list’ in kwargs_model These arguments should be lists of length the number of imaging bands available and each entry in the list is a list of integers specifying the model components being evaluated for the specific band.

  E.g. there are two bands and you want to different light profiles being modeled. - you define two different light profiles lens_light_model_list = [‘SERSIC’, ‘SERSIC’] - set index_lens_light_model_list = [[0], [1]] - (optional) for now all the parameters between the two light profiles are independent in the model. You have the possibility to join a subset of model parameters (e.g. joint centroid). See the Param() class for documentation.

  image_linear_solve(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_extinction=None, kwargs_special=None, inv_bool=False)

    computes the image (lens and source surface brightness with a given lens model). The linear parameters are computed with a weighted linear least square optimization (i.e. flux normalization of the brightness profiles)

    Parameters

      - kwargs_lens – list of keyword arguments corresponding to the superposition of different lens profiles

      - kwargs_source – list of keyword arguments corresponding to the superposition of different source light profiles

      - kwargs_lens_light – list of keyword arguments corresponding to different lens light surface brightness profiles

      - kwargs_ps – keyword arguments corresponding to “other” parameters, such as external shear and point source image positions

      - inv_bool – if True, invert the full linear solver Matrix Ax = y for the purpose of the covariance matrix.

    Returns

      1d array of surface brightness pixels of the optimal solution of the linear parameters to match the data

  likelihood_data_given_model(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_extinction=None, kwargs_special=None, source_marg=False, linear_prior=None, check_positive_flux=False)

    computes the likelihood of the data given a model This is specified with the non-linear parameters and a linear inversion and prior marginalisation.

    Parameters

      - kwargs_lens –

      - kwargs_source –

      - kwargs_lens_light –

      - kwargs_ps –

      - check_positive_flux – bool, if True, checks whether the linear inversion resulted in non-negative flux components and applies a punishment in the likelihood if so.

    Returns

      log likelihood (natural logarithm) (sum of the log likelihoods of the individual images)

## lenstronomy.ImSim.MultiBand.single_band_multi_model module

class lenstronomy.ImSim.MultiBand.single_band_multi_model.SingleBandMultiModel(multi_band_list, kwargs_model, likelihood_mask_list=None, band_index=0, kwargs_pixelbased=None)

  Bases: `lenstronomy.ImSim.image_linear_solve.ImageLinearFit`

  class to simulate/reconstruct images in multi-band option. This class calls functions of image_model.py with different bands with decoupled linear parameters and the option to pass/select different light models for the different bands

  the class supports keyword arguments ‘index_lens_model_list’, ‘index_source_light_model_list’, ‘index_lens_light_model_list’, ‘index_point_source_model_list’, ‘index_optical_depth_model_list’ in kwargs_model These arguments should be lists of length the number of imaging bands available and each entry in the list is a list of integers specifying the model components being evaluated for the specific band.

  E.g. there are two bands and you want to different light profiles being modeled. - you define two different light profiles lens_light_model_list = [‘SERSIC’, ‘SERSIC’] - set index_lens_light_model_list = [[0], [1]] - (optional) for now all the parameters between the two light profiles are independent in the model. You have the possibility to join a subset of model parameters (e.g. joint centroid). See the Param() class for documentation.

  error_map_source(kwargs_source, x_grid, y_grid, cov_param, model_index_select=True)

    variance of the linear source reconstruction in the source plane coordinates, computed by the diagonal elements of the covariance matrix of the source reconstruction as a sum of the errors of the basis set.

    Parameters

      - kwargs_source – keyword arguments of source model

      - x_grid – x-axis of positions to compute error map

      - y_grid – y-axis of positions to compute error map

      - cov_param – covariance matrix of liner inversion parameters

      - model_index_select – boolean, if True, selects the model components of this band (default). If False, assumes input kwargs_source is already selected list.

    Returns

      diagonal covariance errors at the positions (x_grid, y_grid)

  image_linear_solve(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_extinction=None, kwargs_special=None, inv_bool=False)

    computes the image (lens and source surface brightness with a given lens model). The linear parameters are computed with a weighted linear least square optimization (i.e. flux normalization of the brightness profiles) :param kwargs_lens: list of keyword arguments corresponding to the superposition of different lens profiles :param kwargs_source: list of keyword arguments corresponding to the superposition of different source light profiles :param kwargs_lens_light: list of keyword arguments corresponding to different lens light surface brightness profiles :param kwargs_ps: keyword arguments corresponding to “other” parameters, such as external shear and point source image positions :param inv_bool: if True, invert the full linear solver Matrix Ax = y for the purpose of the covariance matrix. :return: 1d array of surface brightness pixels of the optimal solution of the linear parameters to match the data

  likelihood_data_given_model(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_extinction=None, kwargs_special=None, source_marg=False, linear_prior=None, check_positive_flux=False)

    computes the likelihood of the data given a model This is specified with the non-linear parameters and a linear inversion and prior marginalisation.

    Parameters

      - kwargs_lens –

      - kwargs_source –

      - kwargs_lens_light –

      - kwargs_ps –

      - check_positive_flux – bool, if True, checks whether the linear inversion resulted in non-negative flux components and applies a punishment in the likelihood if so.

    Returns

      log likelihood (natural logarithm) (sum of the log likelihoods of the individual images)

  linear_response_matrix(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_extinction=None, kwargs_special=None)

    computes the linear response matrix (m x n), with n beeing the data size and m being the coefficients

    Parameters

      - kwargs_lens –

      - kwargs_source –

      - kwargs_lens_light –

      - kwargs_ps –

    Returns

  num_param_linear(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None)
    Parameters

      compute_bool –

    Returns

      number of linear coefficients to be solved for in the linear inversion

  select_kwargs(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_extinction=None, kwargs_special=None)

    select subset of kwargs lists referenced to this imaging band

    Parameters

      - kwargs_lens –

      - kwargs_source –

      - kwargs_lens_light –

      - kwargs_ps –

    Returns

## Module contents