jaxtronomy.ImSim.MultiBand package¶
Submodules¶
jaxtronomy.ImSim.MultiBand.single_band_multi_model module¶
- class SingleBandMultiModel(multi_band_list, kwargs_model, likelihood_mask_list=None, band_index=0, kwargs_pixelbased=None, linear_solver=True)[source]¶
Bases:
ImageLinearFit,ImageModelClass 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.
- __init__(multi_band_list, kwargs_model, likelihood_mask_list=None, band_index=0, kwargs_pixelbased=None, linear_solver=True)[source]¶
- Parameters:
multi_band_list – list of imaging band configurations [[kwargs_data, kwargs_psf, kwargs_numerics],[…], …]
kwargs_model – dict containing model option keyword arguments. See arguments to class_creator.create_class_instances() for options.
likelihood_mask_list – list of likelihood masks (booleans with size of the individual images
band_index – integer, index of the imaging band to model
kwargs_pixelbased – keyword arguments with various settings related to the pixel-based solver (see SLITronomy documentation)
linear_solver – bool, determines whether to solve for linear amplitudes
- image(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_extinction=None, kwargs_special=None, unconvolved=False, source_add=True, lens_light_add=True, point_source_add=True)[source]¶
Make an image with a realisation of linear parameter values “param”.
- Parameters:
kwargs_lens – list of dicts, keyword arguments corresponding to the superposition of different lens profiles in the same order of the lens_model_list
kwargs_source – list of dicts, keyword arguments corresponding to the superposition of different source light profiles in the same order of light_model_list
kwargs_lens_light – list of dicts, keyword arguments corresponding to different lens light surface brightness profiles in the same order of lens_light_model_list
kwargs_ps – list of dicts, keyword arguments for the points source models in the same order of point_source_type_list
kwargs_extinction – list of dicts, keyword arguments corresponding to different light profiles in the optical_depth_model
kwargs_special – optional dict including keys “delta_x_image” and “delta_y_image” and array/list values indicating how much to shift each point source image in units of arcseconds
unconvolved – if True: returns the unconvolved light distribution (prefect seeing)
source_add – if True, compute source, otherwise without
lens_light_add – if True, compute lens light, otherwise without
point_source_add – if True, add point sources, otherwise without
- Returns:
2d array of surface brightness pixels of the simulation
- source_surface_brightness(kwargs_source, kwargs_lens=None, kwargs_extinction=None, kwargs_special=None, unconvolved=False, de_lensed=False, k=None, update_pixelbased_mapping=False)[source]¶
Computes the source surface brightness distribution.
- Parameters:
kwargs_source – list of dicts, keyword arguments corresponding to the superposition of different source light profiles in the same order of light_model_list
kwargs_lens – list of dicts, keyword arguments corresponding to the superposition of different lens profiles in the same order of the lens_model_list
kwargs_extinction – list of dicts, keyword arguments corresponding to different light profiles in the optical_depth_model
kwargs_special – optional dict including keys “delta_x_image” and “delta_y_image” and array/list values indicating how much to shift each point source image in units of arcseconds
unconvolved – if True: returns the unconvolved light distribution (prefect seeing)
de_lensed – if True: returns the un-lensed source surface brightness profile, otherwise the lensed.
k – integer, if set, will only return the model of the specific index
- Returns:
2d array of surface brightness pixels
- lens_surface_brightness(kwargs_lens_light, unconvolved=False, k=None)[source]¶
Computes the lens surface brightness distribution.
- Parameters:
kwargs_lens_light – list of keyword arguments corresponding to different lens light surface brightness profiles
unconvolved – if True, returns unconvolved surface brightness (perfect seeing), otherwise convolved with PSF kernel
- Returns:
2d array of surface brightness pixels
- point_source(kwargs_ps, kwargs_lens=None, kwargs_special=None, unconvolved=False, k=None)[source]¶
Computes the point source positions and paints PSF convolutions on them.
- Parameters:
kwargs_ps – list of dicts, keyword arguments for each point source model in the same order of the point_source_type_list
kwargs_lens – list of dicts, keyword arguments for the full set of lens models in the same order of the lens_model_list
kwargs_special – optional dict including keys “delta_x_image” and “delta_y_image” and array/list values indicating how much to shift each point source image in units of arcseconds
unconvolved – bool, includes point source images if False, excludes ps if True
k – optional int, include only the k-th point source model. If None, includes all
- Returns:
rendered point source images
- 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)[source]¶
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
kwargs_extinction – keyword arguments corresponding to dust extinction
kwargs_special – keyword arguments corresponding to “special” parameters
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, linear_solver=None)[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 – 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
kwargs_extinction – list of dicts, keyword arguments corresponding to different light profiles in the optical_depth_model
kwargs_special – optional dict including keys “delta_x_image” and “delta_y_image” and array/list values indicating how much to shift each point source image in units of arcseconds
source_marg – bool, performs a marginalization over the linear parameters
linear_prior – linear prior width in eigenvalues
check_positive_flux – bool, should be false. True not supported in jaxtronomy
linear_solver – bool, determines whether to solve for linear amplitudes. Can also be None, in which case self.linear_solver will be used.
- Returns:
log likelihood (natural logarithm) (sum of the log likelihoods of the individual images)
- update_linear_kwargs(param, kwargs_lens, kwargs_source, kwargs_lens_light, kwargs_ps, model_band=None)[source]¶
Links linear parameters to kwargs arguments.
- Parameters:
param – linear parameter vector corresponding to the response matrix
kwargs_lens – list of dicts containing lens model keyword arguments
kwargs_source – list of dicts containing source model keyword arguments
kwargs_lens_light – list of dicts containing lens light model keyword arguments
kwargs_ps – list of dicts containing point source keyword arguments
- Returns:
updated list of kwargs with linear parameter values
- num_param_linear(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None)[source]¶
- Parameters:
kwargs_lens – list of dicts containing lens model keyword arguments
kwargs_source – list of dicts containing source model keyword arguments
kwargs_lens_light – list of dicts containing lens light model keyword arguments
kwargs_ps – list of dicts containing point source keyword arguments
- Returns:
number of linear coefficients to be solved for in the linear inversion
- linear_response_matrix(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_extinction=None, kwargs_special=None)[source]¶
Computes the linear response matrix (m x n), with n being the data size and m being the coefficients.
- Parameters:
kwargs_lens – list of dicts containing lens model keyword arguments
kwargs_source – list of dicts containing source model keyword arguments
kwargs_lens_light – list of dicts containing lens light model keyword arguments
kwargs_ps – list of dicts containing point source keyword arguments
kwargs_extinction – list of keyword arguments corresponding to the optical depth models tau, such that extinction is exp(-tau)
kwargs_special – keyword arguments corresponding to “special” parameters
- Returns:
- error_map_source(kwargs_source, x_grid, y_grid, cov_param, model_index_select=True)[source]¶
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)
- error_response(kwargs_lens, kwargs_ps, kwargs_special)[source]¶
Returns the 1d array of the error estimate corresponding to the data response.
- Parameters:
kwargs_lens – list of keyword arguments corresponding to the superposition of different lens profiles
kwargs_ps – keyword arguments corresponding to “other” parameters, such as external shear and point source image positions
kwargs_special – optional dict including keys “delta_x_image” and “delta_y_image” and array/list values indicating how much to shift each point source image in units of arcseconds
- Returns:
1d numpy array of response, 2d array of additional errors (e.g. point source uncertainties)
- linear_param_from_kwargs(kwargs_source, kwargs_lens_light, kwargs_ps)[source]¶
Inverse function of update_linear() returning the linear amplitude list for the keyword argument list.
- Parameters:
kwargs_source – list of dicts containing source model keyword arguments
kwargs_lens_light – list of dicts containing lens light model keyword arguments
kwargs_ps – list of dicts containing point source keyword arguments
- Returns:
list of linear coefficients
- select_kwargs(kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_extinction=None, kwargs_special=None)[source]¶
Select subset of kwargs lists referenced to this imaging band.
- 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
kwargs_extinction – list of dicts, keyword arguments corresponding to different light profiles in the optical_depth_model
kwargs_special – optional dict including keys “delta_x_image” and “delta_y_image” and array/list values indicating how much to shift each point source image in units of arcseconds
- Returns:
Select subset of kwargs lists