slsim.Sources.SourcePopulation package

Submodules

slsim.Sources.SourcePopulation.galaxies module

class slsim.Sources.SourcePopulation.galaxies.Galaxies(galaxy_list, kwargs_cut, cosmo, sky_area, list_type='astropy_table', catalog_type=None, downsample_to_dc2=False, source_size='Bernardi', extended_source_type='single_sersic', extended_source_kwargs={})[source]

Bases: SourcePopBase

Class describing elliptical galaxies.

draw_galaxies(area, z_max=None)[source]

Draw galaxies within a specified area and redshift limit.

Parameters:
  • (astropy.units.Quantity) (area) – Area in which to draw galaxies (in square arcseconds).

  • z_max – Maximum redshift for the galaxies. If None, no redshift cut is applied.

Returns:

List of drawn galaxy instances.

draw_source(z_max=None, z_min=None, galaxy_index=None)[source]

Choose source at random.

Parameters:
  • z_max – maximum redshift limit for the galaxy to be drawn. If no galaxy is found for this limit, None will be returned.

  • z_min – minimum redshift limit for the galaxy to be drawn. If no galaxy is found for this limit, None will be returned.

  • galaxy_index – index of galaxy to pic (if provided)

Returns:

instance of Source class

draw_source_dict(z_max=None, z_min=None, galaxy_index=None)[source]

Choose source at random.

Parameters:
  • z_max – maximum redshift limit for the galaxy to be drawn. If no galaxy is found for this limit, None will be returned.

  • z_min – minimum redshift limit for the galaxy to be drawn. If no galaxy is found for this limit, None will be returned.

  • galaxy_index – index of galaxy to pic (if provided)

Returns:

dictionary of source

property source_number

Number of sources registered (within given area on the sky)

Returns:

number of sources

property source_number_selected

Number of sources selected (within given area on the sky)

Returns:

number of sources passing the selection criteria

slsim.Sources.SourcePopulation.galaxies.convert_to_slsim_convention(galaxy_catalog, light_profile, input_catalog_type='skypy', source_size=None, cosmo=None)[source]

This function converts scotch/catalog to slsim conventions. In slsim, sersic index are either n_sersic or (n_sersic_0 and n_sersic_1). Ellipticity are either ellipticity or (ellipticity0 and ellipticity1). These kewords can be read by Galaxies class. This function is written to convert scotch catalog to slsim convension and to change unit of angular size in skypy source catalog to arcsec.

Parameters:
  • galaxy_catalog (astropy Table object.) – An astropy table of galaxy catalog in other conventions.

  • light_profile – keyword for number of sersic profile to use in source light model. accepted keywords: “single_sersic”, “double_sersic”.

  • input_catalog_type (str. eg: "scotch" or "skypy".) – type of the catalog. If someone wants to use scotch catalog or skypy catalog, they need to specify it.

  • source_size – Keyword for source size convention. If “Bernardi”, computes galaxy size using g-band magnitude otherwise rescales skypy source size to Shibuya et al.(2015): ht tps://iopscience.iop.org/article/10.1088/0067-0049/219/2/15/pdf

  • cosmo – astropy.cosmology instance

Returns:

galaxy catalog in slsim convension.

slsim.Sources.SourcePopulation.galaxies.down_sample_to_dc2(galaxy_pop, sky_area)[source]

Downsamples given galaxy pop above redshift 1.5 to DC2 galaxy population.

Parameters:
  • galaxy_pop – Astropy table of galaxy population.

  • sky_area – Sky area over which galaxies are sampled. Must be in units of solid angle and it should be astropy unit object.

Returns:

Astropy tables of downsampled galaxy population in different bins. Redshift bins for returned populations are: (2-2.5), (2.5-3), (3-3.5), (3.5-4), (4-4.5), (4.5-5)

slsim.Sources.SourcePopulation.galaxies.galaxy_projected_eccentricity(ellipticity, rotation_angle=None)[source]

Projected eccentricity of elliptical galaxies as a function of other deflector parameters.

Parameters:
  • ellipticity (float [0,1)) – eccentricity amplitude

  • rotation_angle – rotation angle of the major axis of elliptical galaxy in radian. The reference of this rotation angle is +Ra axis i.e towards the East direction and it goes from East to North. If it is not provided, it will be drawn randomly.

Returns:

e1, e2 eccentricity components

slsim.Sources.SourcePopulation.point_plus_extended_sources module

class slsim.Sources.SourcePopulation.point_plus_extended_sources.PointPlusExtendedSources(point_plus_extended_sources_list, cosmo, sky_area, kwargs_cut, list_type='astropy_table', catalog_type=None, source_size='Bernadi', point_source_type=None, extended_source_type=None, point_source_kwargs={}, extendedsource_kwargs={})[source]

Bases: Galaxies, SourcePopBase

Class to describe point and extended sources.

draw_source(z_max=None)[source]

Choose source at random.

Parameters:

z_max – maximum redshift limit for the galaxy to be drawn. If no galaxy is found for this limit, None will be returned.

Returns:

instance of Source class

slsim.Sources.SourcePopulation.point_sources module

class slsim.Sources.SourcePopulation.point_sources.PointSources(point_source_list, cosmo, sky_area, kwargs_cut, list_type='astropy_table', point_source_type=None, point_source_kwargs={})[source]

Bases: SourcePopBase

Class to describe point sources.

draw_source(z_max=None, z_min=None, point_source_index=None)[source]

Choose source at random within the selected redshift range.

Parameters:
  • z_max – maximum redshift limit for the point source to be drawn. If no point source is found for this limit, None will be returned.

  • z_min – minimum redshift limit for the point source to be drawn. If no point source is found for this limit, None will be returned.

  • point_source_index – index of point source to pick (if provided)

Returns:

instance of Source class

property source_number

Number of sources registered (within given area on the sky)

Returns:

number of sources

property source_number_selected

Number of sources selected (within given area on the sky)

Returns:

number of sources passing the selection criteria

slsim.Sources.SourcePopulation.scotch_sources module

class slsim.Sources.SourcePopulation.scotch_sources.ScotchSources(cosmo: Cosmology, scotch_path: list[str] | str, sky_area=None, transient_types: list[str] | str | None = None, transient_subtypes: dict[list[str]] | None = None, kwargs_cut: dict | None = None, rng: Generator | int | None = None, sample_uniformly: bool = False, exclude_agn: bool = False)[source]

Bases: SourcePopBase

close()[source]
draw_source(*args, **kwargs) Source[source]

Draw a source from the population, returning a Source object. Transients are instantiated as “general_lightcurve” point sources, and hosts (if any) as “double_sersic” extended sources. If the transient is hostless, the Source is an instance of PointSource, otherwise it is an instance of PointPlusExtendedSource.

Returns

Source

The drawn source object. If hostless, an instance of PointSource; otherwise, an instance of PointPlusExtendedSource.

property source_number: int

Number of sources in the population before any selection cuts.

Returns

int

Number of sources.

property source_number_selected: int

Number of sources in the population after applying selection cuts.

Returns

int

Number of sources passing the selection criteria.

slsim.Sources.SourcePopulation.scotch_sources.d08(z: float | ndarray) float | ndarray[source]

Redshift Evolution of SNIa Rates from Dilday et al.

2008 Sec. 6.4.1 https://arxiv.org/abs/0801.3297

slsim.Sources.SourcePopulation.scotch_sources.expected_number(rate_fn: Callable, cosmo: Cosmology, z_min: float = 0.0, z_max: float = 3.0) float[source]
slsim.Sources.SourcePopulation.scotch_sources.galaxy_projected_eccentricity(ellipticity: float, rotation_angle=float | None) tuple[float, float][source]

Compute the projected eccentricity components (e1, e2) of an elliptical galaxy given its ellipticity and rotation angle. If the rotation angle is not provided, it is drawn randomly from a uniform distribution between 0 and π.

Parameters

ellipticityfloat

Eccentricity amplitude, must be in the range [0, 1).

rotation_anglefloat or None, optional

Rotation angle of the major axis in radians. The reference is the +RA axis (towards the East direction) and it increases from East to North. If None, a random angle is drawn.

Returns

e1float

First component of the projected eccentricity.

e2float

Second component of the projected eccentricity.

slsim.Sources.SourcePopulation.scotch_sources.kn_rate(z: float | ndarray) float | ndarray[source]
slsim.Sources.SourcePopulation.scotch_sources.md14(z: float | ndarray) float | ndarray[source]

Redshift Evolution of Cosmic Star Formation Rate from Madau & Dickinson 2014 Eq.

15. https://arxiv.org/abs/1403.0007

slsim.Sources.SourcePopulation.scotch_sources.s15(z: float | ndarray) float | ndarray[source]

Redshift Evolution of CCSNe Rates from Strolger et al.

2015 Eq. 9. https://arxiv.org/abs/1509.06574

slsim.Sources.SourcePopulation.scotch_sources.slsn_rate(z: float | ndarray) float | ndarray[source]
slsim.Sources.SourcePopulation.scotch_sources.snia_91bg_rate(z: float | ndarray) float | ndarray[source]
slsim.Sources.SourcePopulation.scotch_sources.snia_rate(z: float | ndarray) float | ndarray[source]
slsim.Sources.SourcePopulation.scotch_sources.sniax_rate(z: float | ndarray) float | ndarray[source]
slsim.Sources.SourcePopulation.scotch_sources.snibc_rate(z: float | ndarray) float | ndarray[source]
slsim.Sources.SourcePopulation.scotch_sources.snii_rate(z: float | ndarray) float | ndarray[source]
slsim.Sources.SourcePopulation.scotch_sources.tde_rate(z: float | ndarray) float | ndarray[source]

slsim.Sources.SourcePopulation.source_pop_base module

class slsim.Sources.SourcePopulation.source_pop_base.SourcePopBase(cosmo, sky_area)[source]

Bases: ABC

Base class with functions all source classes must have to be able to render populations.

abstractmethod draw_source()[source]

Choose source at random.

Returns:

dictionary of source

property kwargs_variability
Returns:

dict of keyword arguments for the variability model.

abstract property source_number

Number of sources registered (within given area on the sky)

Returns:

number of sources

abstract property source_number_selected

Number of sources selected (within given area on the sky)

Returns:

number of sources passing the selection criteria

property variability_model
Returns:

keyword for the variability model

Module contents