coolest.api.composable_models#
Classes#
Given a COOLEST object, evaluates a selection of mass or light profiles. |
|
Given a COOLEST object, evaluates a selection of entity and their light profiles. |
|
Given a COOLEST object, evaluates a selection of entity and their mass profiles. |
|
Given a COOLEST object, evaluates a selection of entity and |
Functions#
|
Module Contents#
- class BaseComposableModel(model_type, coolest_object, coolest_directory=None, load_posterior_samples=False, entity_selection=None, profile_selection=None)[source]#
Given a COOLEST object, evaluates a selection of mass or light profiles. This class serves as parent for more specific classes and should not be instantiated by the user.
- Parameters:
model_type (str) – Either ‘light_model’ or ‘mass_model’
coolest_object (COOLEST) – COOLEST instance
coolest_directory (str, optional) – Directory which contains the COOLEST template, by default None
load_posterior_samples (bool, optional) – If True, and if the COOLEST metadata provides it, the constructor will attempt to load the chain file containing posterior samples, in addition to point estimates for each profile parameters. Default is False.
entity_selection (list, optional) – List of indices of the lensing entities to consider; If None, selects the first entity which has a model of type model_type, by default None
profile_selection (list, optional) – List of either lists of indices, or ‘all’, for selecting which (mass or light) profile of a given lensing entity to consider. If None, selects all the profiles of within the corresponding entity, by default None
- Raises:
ValueError – No valid entity found or no profiles found.
- class ComposableLightModel(coolest_object, coolest_directory=None, **kwargs_selection)[source]#
Given a COOLEST object, evaluates a selection of entity and their light profiles.
- Parameters:
coolest_object (COOLEST) – COOLEST instance
coolest_directory (str, optional) – Directory which contains the COOLEST template, by default None
kwargs_selection (dict, optional) – Keyword arguments for selecting which entities and profiles to consider, see BaseComposableModel for details.
- Raises:
ValueError – No valid entity found or no profiles found.
- class ComposableMassModel(coolest_object, coolest_directory=None, load_posterior_samples=False, **kwargs_selection)[source]#
Given a COOLEST object, evaluates a selection of entity and their mass profiles.
- Parameters:
coolest_object (COOLEST) – COOLEST instance
coolest_directory (str, optional) – Directory which contains the COOLEST template, by default None
kwargs_selection (dict, optional) – Keyword arguments for selecting which entities and profiles to consider, see BaseComposableModel for details.
- Raises:
ValueError – No valid entity found or no profiles found.
- evaluate_potential(x, y, mode='point', last_n_samples=None)[source]#
Evaluates the lensing potential field at given coordinates
- fermat_potential(x, y, x_src, y_src, mode='point', last_n_samples=None)[source]#
Computes the Fermat potential for image (x, y) and source position (x_src, y_src)
- evaluate_convergence(x, y)[source]#
Evaluates the lensing convergence (i.e., 2D mass density) at given coordinates
- class ComposableLensModel(coolest_object, coolest_directory=None, auto_selection=True, kwargs_selection_source=None, kwargs_selection_lens_mass=None, kwargs_selection_lens_light=None)[source]#
Given a COOLEST object, evaluates a selection of entity and their mass and light profiles, typically to construct an image of the lens.
- Parameters:
coolest_object (COOLEST) – COOLEST instance
coolest_directory (str, optional) – Directory which contains the COOLEST template, by default None
auto_selection (bool, True) – If True, will select entities based on their lensed attributes. In particular, all entities having a lensed=True will be associated to a ComposableLightModel for the source, and all entities having lensed=False will be associated to a ComposableLightModel and ComposableLightModel for the lens If False, the user should provide the appropriate keyword arguments in the kwargs_selection_* arguments.
kwargs_selection_lens_mass (dict, optional) – Keyword arguments for ComposableMassModel to select which entities and their profiles to consider for the lens mass model.
kwargs_selection_lens_light (dict, optional) – Keyword arguments for ComposableLightModel to select which entities and their profiles to consider for the lens light model.
kwargs_selection_source (dict, optional) – Keyword arguments for ComposableLightModel to select which entities and their profiles to consider for the source light model.
- Raises:
ValueError – No valid entity found or no profiles found.
- model_image(supersampling=5, convolved=True, super_convolution=True)[source]#
generates an image of the lens based on the selected model components
- model_residuals(mask=None, **model_image_kwargs)[source]#
computes the normalized residuals map as (data - model) / sigma