Configs – Configuration Modules
paltas.Configs.config_handler module
Interact with the paltas configuration files
Classes used to draw relevant parameters from paltas configuration files.
- class paltas.Configs.config_handler.ConfigHandler(config_path)[source]
Bases:
objectClass that parses the configuration files to extract images and lenstronomy configurations.
- Parameters:
config_path (str) – A path to the config file to parse.
- draw_image(new_sample=True)[source]
Takes a sample from the config and generate an image of the strong lensing system along with its metadata.
- Parameters:
new_sample (bool) – If true will draw a new sample from the config sampler before returning the image. True by default.
- Returns:
A tuple containing a numpy array of the generated image and a metavalue dictionary with the corresponding sampled values.
- Return type:
(np.array,dict)
Notes
Even if new_sample is False, this function is not guaranteed to be deterministic. For example, most of the substructure classes draw from populations specified by the input parameters, and therefore calling the function repeatedly will return images of different realizations of that population.
- get_current_sample()[source]
Returns the current sample from the config sampler.
- Returns:
The current sample
- Return type:
(dict)
- get_lenstronomy_models_kwargs(new_sample=True)[source]
Takes a sample from the config and returns the list of lenstronomy models, kwargs, and redshifts for the lensing system.
- Parameters:
new_sample (bool) – If true will draw a new sample from the config sampler before returning the lenstronomy kwargs. True by default.
- Returns:
Two dicts, the first containing the list of lens models, lens model redshifts, source light models, source redshifts, lens light models, and point source models. The second contains the lens kwargs, the source kwargs, the point source kwargs, and the lens light kwargs.
- Return type:
(dict,dict)
Notes
Even if new_sample is False, this function is not guaranteed to be deterministic. For example, most of the substructure classes draw from populations specified by the input parameters, and therefore calling the function repeatedly will return different realizations of that population.
- get_metadata()[source]
Returns the values drawn from the configuration file to generate the current sample.
- Returns:
A dictionary containing the values drawn from the configuration file to generate the current sample. This includes the parameters of the lensing system (some of which may be population level parameters), the parameters of the observation, the cosmology, and any other parameters specified within the config_dict of the input configuration file.
- Return type:
(dict)
Notes
The metadata naming scheme is object_parameters_name_of_parameters. For example for the Einstein radius of the main deflector the key is main_deflector_parameters_theta_E. For the redshift of the source it would be source_parameters_z_source.
- get_sample_cosmology(as_astropy=False)[source]
Return the cosmology object for the current sample.
- Parameters:
as_astropy (bool) – If True, will return an astropy cosmology object instead of a colossus cosmology object. Defaults to False.
- Returns:
An instance of the colossus cosmology class. If as_astropy is True, this will be an astropy object instead.
- Return type:
(colossus.cosmology.cosmology.Cosmology)