slsim.Sources.SourceTypes package

Submodules

slsim.Sources.SourceTypes.catalog_source module

class slsim.Sources.SourceTypes.catalog_source.CatalogSource(angular_size, e1, e2, n_sersic, cosmo, catalog_type, catalog_path, max_scale=1, match_n_sersic=False, sersic_fallback=False, **source_dict)[source]

Bases: SourceBase

Class to match sersic parameters to a real source in a given catalog.

The sources in the catalog must have parameters that have been obtained by performing a sersic fit.

kwargs_extended_light(band=None)[source]

Provides dictionary of keywords for the source light model(s). Keywords used are in lenstronomy conventions.

Parameters:

band – Imaging band

Returns:

dictionary of keywords for the source light model(s)

slsim.Sources.SourceTypes.double_sersic module

class slsim.Sources.SourceTypes.double_sersic.DoubleSersic(angular_size_0, angular_size_1, n_sersic_0, n_sersic_1, w0, w1=None, e1_1=0, e2_1=0, e1_2=0, e2_2=0, **source_dict)[source]

Bases: SourceBase

Class to manage source with double sersic light profile.

property angular_size

Returns angular size of the source for two component of the sersic profile.

property ellipticity

Returns ellipticity components of source for the both component of the light profile. first two ellipticity components are associated with the first sersic component and last two are associated with the second sersic component. Defined as:

\[e1 = \frac{1-q}{1+q} * cos(2 \phi) e2 = \frac{1-q}{1+q} * sin(2 \phi)\]

with q being the minor-to-major axis ratio.

kwargs_extended_light(band=None)[source]

Provides dictionary of keywords for the source light model(s). Keywords used are in lenstronomy conventions.

Parameters:

band – Imaging band

Returns:

dictionary of keywords for the source light model(s)

surface_brightness_reff(band=None)[source]

Calculate average surface brightness within half light radius.

Parameters:

band – Imageing band

Returns:

average surface brightness within half light radius [mag/arcsec^2]

slsim.Sources.SourceTypes.extended_source module

class slsim.Sources.SourceTypes.extended_source.ExtendedSource(source_type, **source_dict)[source]

Bases: object

Class to manage a single extended source.

property angular_size

Returns angular size of the source.

property ellipticity

Returns ellipticity components of source. Defined as:

\[e1 = \frac{1-q}{1+q} * cos(2 \phi) e2 = \frac{1-q}{1+q} * sin(2 \phi)\]

with q being the minor-to-major axis ratio.

extended_source_magnitude(band)[source]

Get the magnitude of the extended source in a specific band.

Parameters:

band (str) – Imaging band

Returns:

Magnitude of the extended source in the specified band

Return type:

float

property extended_source_position

Extended source position.

Returns:

[x_pos, y_pos]

kwargs_extended_light(band=None)[source]

Provides dictionary of keywords for the source light model(s). Keywords used are in lenstronomy conventions.

Parameters:

band – Imaging band

Returns:

dictionary of keywords for the source light model(s)

property name

Meaningful name string of the source.

Returns:

name string

property redshift

Returns source redshift.

surface_brightness_reff(band=None)[source]

Calculate average surface brightness within half light radius.

Parameters:

band – Imageing band

Returns:

average surface brightness within half light radius [mag/arcsec^2]

update_center(area=None, reference_position=None, center_x=None, center_y=None)[source]

Overwrites the source center position.

Parameters:
  • reference_position (2d numpy array) – [RA, DEC] in arc-seconds of the reference from where within a circle the source position is being drawn from

  • area – area (in solid angle arcseconds^2) to dither the center of the source

  • center_x – RA position [arc-secons] (optional, otherwise renders within area)

  • center_y – DEC position [arc-secons] (optional, otherwise renders within area)

Returns:

Source() instance updated with new center position

slsim.Sources.SourceTypes.general_lightcurve module

class slsim.Sources.SourceTypes.general_lightcurve.GeneralLightCurve(MJD, variability_model='light_curve', **kwargs)[source]

Bases: SourceBase

A class to manage a source with given lightcurve.

point_source_magnitude(band, image_observation_times=None)[source]

Get the magnitude of the point source in a specific band.

Parameters:
  • band (str) – Imaging band

  • image_observation_times – Images observation time for an image.

Returns:

Magnitude of the point source in the specified band

Return type:

float

slsim.Sources.SourceTypes.interpolated_image module

class slsim.Sources.SourceTypes.interpolated_image.Interpolated(image, pixel_width_data, phi_G, z_data, cosmo, **source_dict)[source]

Bases: SourceBase

Class to manage source with real extended source image.

kwargs_extended_light(band=None)[source]

Provides dictionary of keywords for the source light model(s). Kewords used are in lenstronomy conventions.

Parameters:
  • reference_position – reference position. the source postion will be defined relative to this position. The default choice is None. In this case source_dict must contain source position. Eg: np.array([0, 0])

  • draw_area – The area of the test region from which we randomly draw a source position. The default choice is None. In this case source_dict must contain source position. Eg: 4*pi.

  • band – Imaging band

Returns:

dictionary of keywords for the source light model(s)

slsim.Sources.SourceTypes.point_plus_extended_source module

class slsim.Sources.SourceTypes.point_plus_extended_source.PointPlusExtendedSource(extended_source_type, point_source_type, cosmo=None, **source_dict)[source]

Bases: PointSource, ExtendedSource

Class to manage a single point source and a single extended source (host)

update_center(area=None, reference_position=None, center_x=None, center_y=None)[source]

Overwrites the source center position.

Parameters:
  • reference_position (2d numpy array) – [RA, DEC] in arc-seconds of the reference from where within a circle the source position is being drawn from

  • area – area (in solid angle arc-seconds^2) to dither the center of the source

  • center_x – RA position [arc-seconds] (optional, otherwise renders within area)

  • center_y – DEC position [arc-seconds] (optional, otherwise renders within area)

Returns:

Source() instance updated with new center position

slsim.Sources.SourceTypes.point_source module

class slsim.Sources.SourceTypes.point_source.PointSource(source_type, **source_dict)[source]

Bases: object

Class to manage a single point source.

kwargs_point_source(band, image_observation_times=None, image_pos_x=None, image_pos_y=None, ps_mag=None)[source]
Parameters:
  • band (str) – Imaging band

  • image_observation_times – Images observation time for an image.

  • image_pos_x – pre-calculated image positions (solutions of the lens equation) RA [arcseconds]

  • image_pos_y – pre-calculated image positions (solutions of the lens equation) DEC [arcseconds]

  • ps_mag – magnitudes of images (or source)

Returns:

source type, list of dictionary in lenstronomy convention

property name

Meaningful name string of the source.

Returns:

name string

point_source_magnitude(band, image_observation_times=None)[source]

Get the magnitude of the point source in a specific band.

Parameters:
  • band (str) – Imaging band

  • image_observation_times – Images observation time for an image.

Returns:

Magnitude of the point source in the specified band

Return type:

float

property point_source_position

Point source position. point source could be at the center of the extended source, or it can be off from center of the extended source.

Returns:

[x_pos, y_pos]

point_source_type(image_positions=False)[source]

Type of point source model.

Parameters:

image_positions

Returns:

point source model string, or None

property redshift

Returns source redshift.

update_center(area=None, reference_position=None, center_x=None, center_y=None)[source]

Overwrites the source center position.

Parameters:
  • reference_position (2d numpy array) – [RA, DEC] in arc-seconds of the reference from where within a circle the source position is being drawn from

  • area – area (in solid angle arc-seconds^2) to dither the center of the source

  • center_x – RA position [arc-seconds] (optional, otherwise renders within area)

  • center_y – DEC position [arc-seconds] (optional, otherwise renders within area)

Returns:

Source() instance updated with new center position

slsim.Sources.SourceTypes.quasar module

class slsim.Sources.SourceTypes.quasar.Quasar(lightcurve_time=None, agn_known_band=None, agn_known_mag=None, agn_driving_variability_model=None, agn_driving_kwargs_variability=None, input_agn_bounds_dict=None, kwargs_variability=None, kwargs_variability_model=None, variability_model='light_curve', random_seed=None, cosmo=None, **kwargs)[source]

Bases: SourceBase

A class to manage a quasar.

property light_curve
point_source_magnitude(band, image_observation_times=None)[source]

Get the magnitude of the point source in a specific band.

Parameters:
  • band (str) – Imaging band

  • image_observation_times – Images observation time for an image.

Returns:

Magnitude of the point source in the specified band

Return type:

float

slsim.Sources.SourceTypes.quasar.add_mean_mag_to_source_table(sourcedict, mean_mags, band_list)[source]

This function adds/replace given mean magnitudes in given bands in a given source table/dict.

Parameters:
  • sourcedict – Given source table.

  • mean_mags – list of mean magnitudes in different bands.

  • band_list – list of bands corresponding to mean_mags.

Returns:

source table with additional columns corresponding to given mean magnitudes.

slsim.Sources.SourceTypes.quasar.extract_agn_kwargs_from_source_dict(source_dict)[source]

This extracts all AGN related parameters from a source_dict Table and constructs a compact dictionary from them to pass into the agn class.

Parameters:

source_dict – Astropy Table with columns representing all information of the source.

Returns:

Compact dict object containing key+value pairs of AGN parameters.

slsim.Sources.SourceTypes.single_sersic module

class slsim.Sources.SourceTypes.single_sersic.SingleSersic(angular_size, n_sersic, e1=0, e2=0, **source_dict)[source]

Bases: SourceBase

Class to manage source with single sersic light profile.

kwargs_extended_light(band=None)[source]

Provides dictionary of keywords for the source light model(s). Kewords used are in lenstronomy conventions.

Parameters:
  • reference_position – reference position. the source postion will be defined relative to this position. The default choice is None. In this case source_dict must contain source position. Eg: np.array([0, 0])

  • draw_area – The area of the test region from which we randomly draw a source position. Eg: 4*pi. The default choice is None. In this case source_dict must contain source position.

  • band – Imaging band

Returns:

dictionary of keywords for the source light model(s)

surface_brightness_reff(band=None)[source]

Calculate average surface brightness within half light radius.

Parameters:

band – Imageing band

Returns:

average surface brightness within half light radius [mag/arcsec^2]

slsim.Sources.SourceTypes.source_base module

class slsim.Sources.SourceTypes.source_base.SourceBase(z, model_type='SourceBase', lensed=True, point_source=False, extended_source=False, center_x=None, center_y=None, ra_off=None, dec_off=None, angular_size=None, e1=None, e2=None, cosmo=None, variability_model='NONE', kwargs_variability_model=None, **kwargs)[source]

Bases: ABC

Class of a single source with quantities only related to the source (independent of the deflector)

property angular_size

Returns angular size of the source for two component of the sersic profile.

Returns:

angular size [arcseconds]

property ellipticity

Returns ellipticity components of source for the both component of the light profile. first two ellipticity components are associated with the first sersic component and last two are associated with the second sersic component. Defined as:

\[e1 = \frac{1-q}{1+q} * cos(2 \phi) e2 = \frac{1-q}{1+q} * sin(2 \phi)\]

with q being the minor-to-major axis ratio.

extended_source_magnitude(band)[source]

Get the magnitude of the extended source in a specific band.

Parameters:

band (str) – Imaging band

Returns:

Magnitude of the extended source in the specified band

Return type:

float

property extended_source_position

Extended source position.

Returns:

[x_pos, y_pos] [arc-seconds]

kwargs_extended_light(band=None)[source]

Provides dictionary of keywords for the source light model(s). Keywords used are in lenstronomy conventions.

Parameters:

band – Imaging band

Returns:

list of extended source profiles (lenstronomy conventions), dictionary of keywords for the source light model(s)

kwargs_point_source(band, image_observation_times=None, image_pos_x=None, image_pos_y=None, ps_mag=None)[source]
Parameters:
  • band (str) – Imaging band

  • image_observation_times – Images observation time for an image.

  • image_pos_x – pre-calculated image positions (solutions of the lens equation) RA [arcseconds]

  • image_pos_y – pre-calculated image positions (solutions of the lens equation) DEC [arcseconds]

  • ps_mag – magnitudes of images (or source)

Returns:

source type, list of dictionary in lenstronomy convention

physical_size(cosmo)[source]
Parameters:

cosmo – ~astropy.cosmology instance

Returns:

physical size [kpc]

point_source_magnitude(band, image_observation_times=None)[source]

Get the magnitude of the point source in a specific band.

Parameters:
  • band (str) – Imaging band

  • image_observation_times – Images observation time for an image.

Returns:

Magnitude of the point source in the specified band

Return type:

float

property point_source_offset

Provides point source offset from host center.

property point_source_position

Point source position.

Returns:

[x_pos, y_pos]

point_source_type(image_positions=False)[source]

Type of point source model.

Parameters:

image_positions

Returns:

point source model string, or None

property redshift

Returns source redshift.

update_center(area=None, reference_position=None, center_x=None, center_y=None)[source]

Overwrites the source center position.

Parameters:
  • reference_position (2d numpy array) – [RA, DEC] in arc-seconds of the reference from where within a circle the source position is being drawn from

  • area – area (in solid angle arc-seconds^2) to dither the center of the source

  • center_x – RA position [arc-seconds] (optional, otherwise renders within area)

  • center_y – DEC position [arc-seconds] (optional, otherwise renders within area)

Returns:

Source() instance updated with new center position

slsim.Sources.SourceTypes.supernova_event module

class slsim.Sources.SourceTypes.supernova_event.SupernovaEvent(sn_type, sn_absolute_mag_band, sn_absolute_zpsys, lightcurve_time, variability_model, sn_modeldir=None, kwargs_variability=None, cosmo=None, **kwargs)[source]

Bases: SourceBase

A class to manage a supernova.

property light_curve

Provides lightcurves of a supernova in each band.

point_source_magnitude(band, image_observation_times=None)[source]

Get the magnitude of the point source in a specific band.

Parameters:
  • band (str) – Imaging band

  • image_observation_times – Images observation time for an image.

Returns:

Magnitude of the point source in the specified band

Return type:

float

Module contents