Sources – Source Light Rendering Modules

Source Classes Available

  • SingleSersicSource - Class to generate single Sersic profile light models

  • COSMOSCatalog - Class to interface to the COSMOS/GREAT3 23.5 magnitude catalog

  • COSMOSExcludeCatalog - Class identical to COSMOSCatalog, but allows for specific source indeces to be excluded from the analysis.

  • COSMOSIncludeCatalog - Class identical to COSMOSExcludeCatalog, but only allows for specific source indeces to be included for the analysis.

  • COSMOSSersic - Class to Combine COSMOS galaxy with Sersic light source

  • COSMOSSersicCatalog - Class identical to COSMOSCatalog, but produces the best-fit single elliptic Sersic profiles instead of real galaxy images

paltas.Sources.cosmos module

Turn COSMOS galaxies into Lenstronomy inputs.

This module contains the default class for transforming the objects of the COSMOS catalog into sources to be passed to lenstronomy.

class paltas.Sources.cosmos.COSMOSCatalog(cosmology_parameters, source_parameters)[source]

Bases: GalaxyCatalog

Class to interface to the COSMOS/GREAT3 23.5 magnitude catalog

This is the catalog used for real galaxies in galsim, see https://github.com/GalSim-developers/GalSim/wiki/RealGalaxy%20Data. The catalog must be downloaded and unzipped.

Parameters:
  • cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).

  • source_parameters (dict) – A dictionary containing all the parameters needed to draw sources.

Notes:

Required Parameters

  • minimum_size_in_pixels - smallest cutout size for COSMOS sources in pixels

  • faintest_apparent_mag - faintest apparent AB magnitude for COSMOS source

  • max_z - highest redshift for COSMOS source

  • smoothing_sigma - smoothing kernel to apply to COSMOS source in pixels

  • cosmos_folder - path to COSMOS images

  • random_rotation - boolean dictating if COSMOS sources will be rotated randomly when drawn

  • min_flux_radius - minimum half-light radius for COSMOS source in pixels

  • center_x - x-coordinate lens center for COSMOS source in units of arcseconds

  • center_y- y-coordinate lens center for COSMOS source in units of arcseconds

  • output_ab_zeropoint - AB magnitude zeropoint of the detector

  • z_source - source redshift

Optional Parameters

  • source_absolute_magnitude - AB absolute magnitude of the source. The light from the catalog galaxy will be rescaled to match this magnitude.

ab_zeropoint = 25.95
image_and_metadata(catalog_i)[source]

Returns the image array and metadata for one galaxy

Parameters:

catalog_i (int) – The catalog index

Returns:

([np.array, np.void]) A numpy array containing the image metadata and a numpy void type that acts as a dictionary with the metadata.

Notes

This will read the numpy files made during initialization. This is much faster on average than going for the fits files.

iter_image_and_metadata_bulk(message='')[source]

Yields the image array and metadata for all of the images in the catalog.

Parameters:

message (str) – If the iterator uses tqdm, this message will be displayed.

Returns:

A generator that can be iterated over to give lenstronomy kwargs.

Return type:

(generator)

Notes

This will read the fits files.

required_parameters = ('minimum_size_in_pixels', 'faintest_apparent_mag', 'max_z', 'smoothing_sigma', 'cosmos_folder', 'random_rotation', 'min_flux_radius', 'output_ab_zeropoint', 'z_source', 'center_x', 'center_y')
sample_indices(n_galaxies)[source]

Return n_galaxies array of catalog indices to sample

Parameters:

n_galaxies (int) – Number of indices to return

Returns:

Array of ints of catalog indices to sample.

Return type:

(np.array)

Notes

The minimum apparent magnitude, minimum size in pixels, and minimum redshift are all set by the source parameters dict.

class paltas.Sources.cosmos.COSMOSExcludeCatalog(cosmology_parameters, source_parameters)[source]

Bases: COSMOSCatalog

Class identical to COSMOSCatalog, but allows for specific source indexes to be excluded from the analysis.

Parameters:
  • cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).

  • source_parameters (dict) – A dictionary containing all the parameters needed to draw sources.

Notes:

Required Parameters

  • minimum_size_in_pixels - smallest cutout size for COSMOS sources in pixels

  • faintest_apparent_mag - faintest apparent AB magnitude for COSMOS source

  • max_z - highest redshift for COSMOS source

  • smoothing_sigma - smoothing kernel to apply to COSMOS source in pixels

  • cosmos_folder - path to COSMOS images

  • random_rotation - boolean dictating if COSMOS sources will be rotated randomly when drawn

  • min_flux_radius - minimum half-light radius for COSMOS source in pixels

  • center_x - x-coordinate lens center for COSMOS source in units of arcseconds

  • center_y- y-coordinate lens center for COSMOS source in units of arcseconds

  • output_ab_zeropoint - AB magnitude zeropoint of the detector

  • z_source - source redshift

  • source_exclusion_list - A list of COSMOS source indices to exclude, even if they pass the other cuts.

Optional Parameters

  • source_absolute_magnitude - AB absolute magnitude of the source. The light from the catalog galaxy will be rescaled to match this magnitude.

required_parameters = ('minimum_size_in_pixels', 'faintest_apparent_mag', 'max_z', 'smoothing_sigma', 'cosmos_folder', 'random_rotation', 'min_flux_radius', 'source_exclusion_list', 'output_ab_zeropoint', 'center_x', 'center_y', 'z_source')
class paltas.Sources.cosmos.COSMOSIncludeCatalog(cosmology_parameters, source_parameters)[source]

Bases: COSMOSCatalog

Class identical to COSMOSExcludeCatalog, but only allows for specific source indeces to be included for the analysis.

Parameters:
  • cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).

  • source_parameters (dict) – A dictionary containing all the parameters needed to draw sources.

  • Notes

Required Parameters

  • minimum_size_in_pixels - smallest cutout size for COSMOS sources in pixels

  • faintest_apparent_mag - faintest apparent AB magnitude for COSMOS source

  • max_z - highest redshift for COSMOS source

  • smoothing_sigma - smoothing kernel to apply to COSMOS source in pixels

  • cosmos_folder - path to COSMOS images

  • random_rotation - boolean dictating if COSMOS sources will be rotated randomly when drawn

  • min_flux_radius - minimum half-light radius for COSMOS source in pixels

  • center_x - x-coordinate lens center for COSMOS source in units of arcseconds

  • center_y- y-coordinate lens center for COSMOS source in units of arcseconds

  • output_ab_zeropoint - AB magnitude zeropoint of the detector

  • z_source - source redshift

  • source_inclusion_list - A list of COSMOS source indices to include, cutting any source not in this list.

Optional Parameters

  • source_absolute_magnitude - AB absolute magnitude of the source. The light from the catalog galaxy will be rescaled to match this magnitude.

required_parameters = ('minimum_size_in_pixels', 'faintest_apparent_mag', 'max_z', 'smoothing_sigma', 'cosmos_folder', 'random_rotation', 'min_flux_radius', 'source_inclusion_list', 'output_ab_zeropoint', 'center_x', 'center_y', 'z_source')
class paltas.Sources.cosmos.COSMOSSersicCatalog(*args, **kwargs)[source]

Bases: COSMOSCatalog

Class identical to COSMOSCatalog, but produces the best-fit single elliptic Sersic profiles instead of real galaxy images

Parameters:
  • cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).

  • source_parameters (dict) – A dictionary containing all the parameters needed to draw sources.

Notes:

Required Parameters

  • minimum_size_in_pixels - smallest cutout size for COSMOS sources in pixels

  • faintest_apparent_mag - faintest apparent AB magnitude for COSMOS source

  • max_z - highest redshift for COSMOS source

  • smoothing_sigma - smoothing kernel to apply to COSMOS source in pixels

  • cosmos_folder - path to COSMOS images

  • random_rotation - boolean dictating if COSMOS sources will be rotated randomly when drawn

  • min_flux_radius - minimum half-light radius for COSMOS source in pixels

  • center_x - x-coordinate lens center for COSMOS source in units of arcseconds

  • center_y- y-coordinate lens center for COSMOS source in units of arcseconds

  • output_ab_zeropoint - AB magnitude zeropoint of the detector

  • z_source - source redshift

Optional Parameters

  • source_absolute_magnitude - AB absolute magnitude of the source. The light from the catalog galaxy will be rescaled to match this magnitude.

draw_source(catalog_i=None, phi=None)[source]

Creates lenstronomy interpolation lightmodel kwargs from a catalog image.

Parameters:
  • catalog_i (int) – Index of image in catalog

  • z_new (float) – Redshift to place image at

  • phi (float) – Rotation to apply to the image. If not provided, use random or original rotation depending on source_parameters[‘random_rotation’]

Returns:

A list containing the model [‘INTERPOL’], the kwargs for an instance of the class lenstronomy.LightModel.Profiles.interpolation.Interpol, and the redshift of the model.

Return type:

(list,list,list)

Notes

If not catalog_i is provided, one that meets the cuts will be selected at random.

image_and_metadata(catalog_i)[source]

Returns the image array and metadata for one galaxy

Parameters:

catalog_i (int) – The catalog index

Returns:

([np.array, np.void]) A numpy array containing the image metadata and a numpy void type that acts as a dictionary with the metadata.

Notes

This will read the numpy files made during initialization. This is much faster on average than going for the fits files.

iter_image_and_metadata_bulk(message='')[source]

Yields the image array and metadata for all of the images in the catalog.

Parameters:

message (str) – If the iterator uses tqdm, this message will be displayed.

Returns:

A generator that can be iterated over to give lenstronomy kwargs.

Return type:

(generator)

Notes

This will read the fits files.

paltas.Sources.cosmos.unfits(fn, pandas=False)[source]

Returns numpy record array from fits catalog file fn

Parameters:
  • fn (str) – filename of fits file to load

  • pandas (bool) – If True, return pandas DataFrame instead of an array

Return type:

(np.array)

paltas.Sources.cosmos_sersic module

Generate Lenstronomy inputs for a COSMOS galaxy + a Sersic Ellipse

This module contains a class that combines a COSMOS galaxy and a Sersic light distribution as the two sources for paltas.

class paltas.Sources.cosmos_sersic.COSMOSSersic(cosmology_parameters, source_parameters)[source]

Bases: COSMOSCatalog

Class to Combine COSMOS galaxy with Sersic light source

Parameters:
  • cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).

  • source_parameters (dict) – A dictionary containing all the parameters needed to draw sources.

Notes:

Required Parameters

  • minimum_size_in_pixels - smallest cutout size for COSMOS sources in pixels

  • faintest_apparent_mag - faintest apparent AB magnitude for COSMOS source

  • max_z - highest redshift for COSMOS source

  • smoothing_sigma - smoothing kernel to apply to COSMOS source in pixels

  • cosmos_folder - path to COSMOS images

  • random_rotation - boolean dictating if COSMOS sources will be rotated randomly when drawn

  • min_flux_radius - minimum half-light radius for COSMOS source in pixels

  • center_x - x-coordinate lens center for COSMOS source in units of arcseconds

  • center_y- y-coordinate lens center for COSMOS source in units of arcseconds

  • mag_sersic - AB absolute magnitude of the sersic

  • output_ab_zeropoint - AB magnitude zeropoint of the detector

  • R_sersic - Sersic radius in units of arcseconds

  • n_sersic - Sersic index

  • e1_sersic - x-direction ellipticity eccentricity for sersic

  • e2_sersic - xy-direction ellipticity eccentricity for sersic

  • center_x_sersic - x-coordinate lens center for sersic in units of arcseconds

  • center_y_sersic - y-coordinate lens center for sersic in units of arcseconds

  • z_source - source redshift

Optional Parameters

  • source_absolute_magnitude - AB absolute magnitude of the source. The light from the catalog galaxy will be rescaled to match this magnitude.

draw_source(catalog_i=None, phi=None)[source]

Creates lenstronomy kwargs for a COSMOS catalog image and a Sersic source

Parameters:
  • catalog_i (int) – Index of image in catalog

  • phi (float) – Rotation to apply to the image. If not provided, use random or original rotation depending on source_parameters[‘random_rotation’]

Returns:

(list,list) A list containing the models [‘INTERPOL’, ‘SERSIC_ELLIPSE’] and a list of two kwarg dicts for the instances of the lenstronomy classes

Notes

If catalog_i is not provided, one that meets the cuts will be selected at random.

optional_parameters = 'source_absolute_magnitude'
required_parameters = ('minimum_size_in_pixels', 'faintest_apparent_mag', 'max_z', 'smoothing_sigma', 'cosmos_folder', 'random_rotation', 'min_flux_radius', 'output_ab_zeropoint', 'z_source', 'mag_sersic', 'center_x', 'center_y', 'R_sersic', 'n_sersic', 'e1_sersic', 'e2_sersic', 'center_x_sersic', 'center_y_sersic')

paltas.Sources.galaxy_catalog module

Turn real galaxies into Lenstronomy inputs.

This module contains the default class for transforming the objects of a source catalog into sources to be passed to lenstronomy.

class paltas.Sources.galaxy_catalog.GalaxyCatalog(cosmology_parameters, source_parameters)[source]

Bases: SourceBase

Base class for turning real galaxy images into Lenstronomy inputs.

Parameters:
  • cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).

  • source_parameters (dict) – A dictionary containing all the parameters needed to draw sources (in this case random_rotation).

Notes:

Required Parameters

  • random_rotation - boolean dictating if COSMOS sources will be rotated randomly when drawn

  • output_ab_zeropoint - AB magnitude zeropoint of the detector

  • z_source - source redshift

  • center_x - x-coordinate lens center for COSMOS source in units of arcseconds

  • center_y- y-coordinate lens center for COSMOS source in units of arcseconds

Optional Parameters

  • source_absolute_magnitude - AB absolute magnitude of the source. The light from the catalog galaxy will be rescaled to match this magnitude.

ab_zeropoint = None
check_parameterization(required_params)[source]

Check that all the required parameters are present in the source_parameters. Also checks ab_zeropoint is set.

Parameters:

required_params ([str,...]) – A list of strings containing the required parameters.

static draw_phi()[source]

Draws a random rotation angle for the interpolation of the source.

Returns:

The new angle to use in the interpolation class.

Return type:

(float)

draw_source(catalog_i=None, phi=None)[source]

Creates lenstronomy lightmodel kwargs from a catalog image.

Parameters:
  • catalog_i (int) – Index of image in catalog

  • z_new (float) – Redshift to place image at

  • phi (float) – Rotation to apply to the image. If not provided, randomize or use 0, depending on source_parameters[‘random_rotation’]

Returns:

A list containing the model [‘INTERPOL’], the kwargs for an instance of the class lenstronomy.LightModel.Profiles.interpolation.Interpol, and the redshift of the model.

Return type:

(list,list,list)

Notes

If not catalog_i is provided, one that meets the cuts will be selected at random.

fill_catalog_i_phi_defaults(catalog_i=None, phi=None)[source]

Return catalog index and source rotation angle.

Parameters:
  • catalog_i (int) – Index of image in catalog If not provided or None, will be sampled from catalog.

  • phi (float) – Rotation to apply to the image. If not provided or None, will either randomize or use 0, depending on source_parameters[‘random_rotation’].

image_and_metadata(catalog_i)[source]

Returns the image array and metadata for one galaxy

Parameters:

catalog_i (int) – The catalog index

Returns

([np.array, np.void]) A numpy array containing the image metadata and a numpy void type that acts as a dictionary with the metadata.

iter_image_and_metadata(message='')[source]

Yields the image array and metadata for all of the images in the catalog.

Parameters:

message (str) – If the iterator uses tqdm, this message will be displayed.

Returns:

A generator that can be iterated over to give lenstronomy kwargs.

Return type:

(generator)

iter_lightmodel_kwargs_samples(n_galaxies, z_new, **selection_kwargs)[source]

Yields dicts of lenstronomy LightModel kwargs for n_galaxies, placed at redshift z_new

Parameters:
  • n_galaxies (int) – Number of galaxies to draw

  • z_new (float) – Redshift to place galaxies at

  • **selection_kwargs – Kwargs that can be passed to the sample_indices method.

Returns:

A generator that can be iterated over to give lenstronomy model lists and kwargs.

Return type:

(generator)

static k_correct_image(image, z_original, z_new)[source]

Apply the k-correction to the image at the pixel level.

Parameters:
  • image (np.array) – The image that needs to be k-corrected

  • z_original (float) – The original redshift of the object

  • z_new (float) – The new redshift of the object

Notes

image will be changed in place

static normalize_to_mag(image, mag_apparent, mag_zero_point, pixel_width)[source]

Renormalizes and image so that it has the specified apparent magnitude.

Parameters:
  • image (np.array) – Image to be renormalized

  • mag_apparent (float) – TThe desired apparent magnitude

  • mag_zero_point (float) – The magnitude zero-point of the detector

  • pixel_width (float) – The width of a pixel in arcseconds

Notes

Image changed in place.

optional_parameters = 'source_absolute_magnitude'
required_parameters = ('random_rotation', 'output_ab_zeropoint', 'z_source', 'center_x', 'center_y')
sample_indices(n_galaxies)[source]

Returns n_galaxies array of ints, catalog indices to sample

Parameters:

n_galaxies (int) – Number of indices to return

Returns:

Array of ints to sample

Return type:

(np.array)

z_scale_factor(z_old, z_new)[source]

Return multiplication factor for object/pixel size for moving its redshift from z_old to z_new.

Parameters:
  • z_old (float) – The original redshift of the object.

  • z_new (float) – The redshift the object will be placed at.

Returns:

The multiplicative pixel size.

Return type:

(float)

paltas.Sources.sersic module

Provides classes for specifying a sersic light distribution.

This module contains the class required to provide a sersic light distribution as the source for paltas.

class paltas.Sources.sersic.DoubleSersicData(cosmology_parameters, source_parameters)[source]

Bases: SingleSersicSource

Class to generate a bulge + disk sersic light model for use as the lens light of the deflector.

Parameters:
  • cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).

  • source_parameters – dictionary with source-specific parameters.

Notes:

Required Parameters

  • magnitude - AB absolute total magnitude of the source

  • f_bulge - the fraction of the flux to assign to the bulge

  • output_ab_zeropoint - AB magnitude zeropoint of the detector

  • n_bulge - sersic index of the bulge. Should be close to 4

  • n_disk - sersic index of the disk. Should be close to 1

  • r_disk_bulge - the ratio of the disk to bulge half-light radius

  • e1 - x-direction ellipticity eccentricity of both components

  • e2 - xy-direction ellipticity eccentricity of both components

  • center_x - x-coordinate source center in units of arcseconds

  • center_y - y-coordinate source center in units of arcseconds

  • z_source - light source redshift (should be the same as main deflector)

draw_source()[source]

Returns lenstronomy LightModel kwargs

Returns:

(list,list,list) A list containing the model name(s), a list containing the model kwargs dictionaries, and a list containing the redshifts of each model. Redshifts list can be None.

get_bulge_disk_half_light(R_total)[source]

Returns the half-light radius for the disk and the bulge.

Parameters:

R_total (float) – The total half-light radius for the full system in units of kpc.

Returns:

A tuple with half light radius of the bulge and disk components in units of kpc.

Return type:

(float,float)

Notes

The total half-light radius is set by the SDS galaxy size distribution for early type galaxies https://arxiv.org/abs/astro-ph/0301527. The half light radius of each component is set to respect the user provided ratio and the SDS constraint for the total.

get_bulge_disk_mag()[source]

Returns the apparent magnitude for the bulge and the disk

Returns:

The apparent magnitude of the bulge and the

apparent magnitude of the disk as a tuple.

Return type:

(float,float)

get_total_half_light()[source]

Returns the half-light radius for the sum of the two components.

Returns:

The half-light radius for the sum of the two components in units of kpc.

Return type:

(float)

Notes

The total half-light radius is set by the SDS galaxy size distribution for early type galaxies https://arxiv.org/abs/astro-ph/0301527. The half light radius of each component is set to respect the user provided ratio and the SDS constraint for the total.

required_parameters = ('magnitude', 'f_bulge', 'output_ab_zeropoint', 'n_bulge', 'n_disk', 'r_disk_bulge', 'e1_bulge', 'e2_bulge', 'e1_disk', 'e2_disk', 'center_x', 'center_y', 'z_source')
class paltas.Sources.sersic.SingleSersicSource(cosmology_parameters, source_parameters)[source]

Bases: SourceBase

Class to generate single Sersic profile light models

Parameters:
  • cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).

  • source_parameters – dictionary with source-specific parameters.

Notes:

Required Parameters

  • magnitude - AB absolute magnitude of the source

  • output_ab_zeropoint - AB magnitude zeropoint of the detector

  • R_sersic - Sersic radius in units of arcseconds

  • n_sersic - Sersic index

  • e1 - x-direction ellipticity eccentricity

  • e2 - xy-direction ellipticity eccentricity

  • center_x - x-coordinate source center in units of arcseconds

  • center_y - y-coordinate source center in units of arcseconds

  • z_source - source redshift

draw_source()[source]

Return lenstronomy LightModel kwargs

Returns:

(list,list,list) A list containing the model name(s), a list containing the model kwargs dictionaries, and a list containing the redshifts of each model. Redshifts list can be None.

static get_total_sersic_flux(R_sersic, n_sersic, amp_sersic)[source]

Returns the total sersic flux.

Parameters:
  • R_sersic (float) – The sersic half-light radius in the same units as r.

  • n_sersic (float) – The sersic index

  • amp_sersic (float) – The amplitude (normalization) of the sersic luminosity.

Returns:

The total flux in counts per second.

Return type:

(float)

static get_total_sersic_flux_r(r, R_sersic, n_sersic, amp_sersic)[source]

Returns the total sersic flux within a radius r.

Parameters:
  • r (float) – The radius to calculate the flux to in the same units as R_sersic.

  • R_sersic (float) – The sersic half-light radius in the same units as r.

  • n_sersic (float) – The sersic index

  • amp_sersic (float) – The amplitude (normalization) of the sersic luminosity. Should have units of flux per units of r^2. So if flux has units of kpc then it should have units flux/kpc^2.

Returns:

The total flux within the radius r in counts per second.

Return type:

(float)

static mag_to_amplitude(mag_apparent, mag_zeropoint, kwargs_list)[source]

Converts a user defined magnitude to the corresponding amplitude that lenstronomy will use

Parameters:
  • mag_apparent (float) – The desired apparent magnitude

  • mag_zeropoint (float) – The magnitude zero-point of the detector

  • kwargs_list (dict) – A dict of kwargs for SERSIC_ELLIPSE, amp parameter not included

Returns:

amplitude lenstronomy should use to get desired magnitude desired magnitude

Return type:

(float)

required_parameters = ('magnitude', 'output_ab_zeropoint', 'R_sersic', 'n_sersic', 'e1', 'e2', 'center_x', 'center_y', 'z_source')

paltas.Sources.source_base module

Provides the base class for specifying the source of a lensing system.

This module contains the base class that all the source classes will build from. Because the steps for rendering a source can vary between different models, the required functions are very sparse.

class paltas.Sources.source_base.SourceBase(cosmology_parameters, source_parameters)[source]

Bases: object

Base class for producing lenstronomy LightModel arguments

Parameters:
  • cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).

  • source_parameters (dict) – dictionary with source-specific parameters

check_parameterization(required_params)[source]

Check that all the required parameters are present in the source_parameters.

Parameters:

required_params ([str,...]) – A list of strings containing the required parameters.

draw_source()[source]

Return lenstronomy LightModel names and kwargs

Returns:

(list,list,list) A list containing the model name(s), a list containing the model kwargs dictionaries, and a list containing the redshifts of each model. Redshifts list can be None.

required_parameters = ()
update_parameters(cosmology_parameters=None, source_parameters=None)[source]

Updated the class parameters

Parameters:
  • cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).

  • source_parameters (dict) – A dictionary containing all the parameters needed to draw sources.