slsim.Sources.Supernovae package

Submodules

slsim.Sources.Supernovae.random_supernovae module

class slsim.Sources.Supernovae.random_supernovae.RandomizedSupernova(sn_type, redshift, absolute_mag=None, absolute_mag_band='bessellb', mag_zpsys='AB', cosmo=FlatLambdaCDM(name=None, H0=<Quantity 70. km / (Mpc s)>, Om0=0.3, Tcmb0=<Quantity 0. K>, Neff=3.04, m_nu=None, Ob0=0.0), modeldir=None, random_seed=None, **kwargs)[source]

Bases: Supernova

Class for randomizing a supernova of the type sn_type specified by the user.

If modeldir is not provided by the user, and sn_type is Ia, the sn_model is chosen to be salt3-nir. If modeldir is not provided by the user and sn_type is other than Ia, the sn_model is picked randomly from a list of built-in models with the same sn_type

If modeldir is provided by the user and sn_type is Ia, the sn_model is chosen to be salt3. In this case, modeldir is the path to the directory containing files needed to initialize the sncosmo.SALT3Source class. For example, modeldir = ‘C:/Users/username/Documents/SALT3.NIR_WAVEEXT’

If modeldir is provided by the user and sn_type is other than Ia, the sn_model is picked randomly from the list of models located in modeldir. In this case, modeldir is the path to the full list of models. For example, modeldir = ‘C:/Users/username/Documents/NON1ASED.V19_CC+HostXT_WAVEEXT If the specified sn_type is Ic, then a supernova of type Ic will be picked at random.

These files can be found in https://github.com/LSST-strong-lensing/data_public

get_absolute_magnitude(sn_type, absolute_mag_distribution=None)[source]

Function to get a reasonable absolute mag for a given SN type.

Parameters:
  • sn_type (str) – Supernova type (Ia, Ib, Ic, IIP, etc.)

  • absolute_mag_distribution (func) – A function that returns an absolute mag

  • random_seed (int) – Random seed for randomization

Returns:

absolute magnitude of the source in the B band

set_random_sed_model(sn_type)[source]

Function to set a random SED model for a given SN type.

Parameters:
  • sn_type (str) – Supernova type (Ia, Ib, Ic, IIP, etc.)

  • random_seed (int) – Random seed for randomization

Returns:

randomized ~sncosmo.Source class

slsim.Sources.Supernovae.random_supernovae.get_accepted_sn_types()[source]

Helper function to get SN types from the SNCosmo source classes. The accepted sn_types are: [II, II-pec, IIL, IIL/P, IIP, IIb, IIn, Ia, Ib, Ib/c, Ic, Ic-BL, PopIII]

Returns:

dictionary of types and sources, and list of models

slsim.Sources.Supernovae.supernova module

class slsim.Sources.Supernovae.supernova.Supernova(source, redshift, sn_type, absolute_mag=None, absolute_mag_band=None, peak_apparent_mag=None, peak_apparent_mag_band=None, mag_zpsys='AB', cosmo=FlatLambdaCDM(name=None, H0=<Quantity 70. km / (Mpc s)>, Om0=0.3, Tcmb0=<Quantity 0. K>, Neff=3.04, m_nu=None, Ob0=0.0), modeldir=None, **kwargs)[source]

Bases: Model

Class for initializing a supernova of the type sn_type specified by the user. If modeldir is provided by the user and sn_type is Ia, the sncosmo.SALT3Source class is first used to model the supernova. In this case, modeldir is the path to the directory containing files needed to initialize this class. For example, modeldir = ‘C:/Users/username/Documents/SALT3.NIR_WAVEEXT’ Afterwards, this sncosmo.SALT3Source class is passed into the sncosmo.Model class. If modeldir is provided by the user and sn_type is other than Ia, the sncosmo.TimeSeriesSource class is used to model the supernova. In this case, modeldir is the path to the full list of models. For example, modeldir = ‘C:/Users/username/Documents/NON1ASED.V19_CC+HostXT_WAVEEXT Afterwards, this sncosmo.TimeSeriesSource class is passed into the sncomsmo.Model class.

These files can be found in https://github.com/LSST-strong-lensing/data_public If modeldir is not provided by the user, the sncosmo.Models class is directly used to model the supernova by retrieving the specified sn model from sncosmo’s list of built-in models, which can be found here: https://sncosmo.readthedocs.io/en/stable/source-list.html

get_apparent_magnitude(time, band, zpsys='AB')[source]

Function to return apparent magnitude of a SN for a given band and time.

Parameters:
  • time (~np.ndarray or list) – The observer-frame time array to evaluate the model (in days)

  • band (str or ~sncosmo.Bandpass) – The bandpass to evaluate the model over

  • zpsys (str) – Optional, AB or Vega (AB default)

Returns:

magnitude of source

set_source_amplitude(absmag, abs_mag_band, peak_apparent_mag, peak_apparent_mag_band, magsys, cosmo)[source]

Sets the amplitude of the source component of the model according to the desired absolute magnitude in the specified band.

If the absolute magnitude is not given, then sets the amplitude of the source component of the model according to a peak apparent magnitude.

If neither the absolute magnitude nor apparent magnitude are given, a warning message is displayed.

Parameters:
  • absolute_mag (float) – Absolute magnitude of the supernova

  • absolute_mag_band (str or ~sncosmo.Bandpass) – Band used to normalize to absolute magnitude

  • peak_apparent_mag (str or ~sncosmo.Bandpass) – Peak apparent mag of the supernova

  • peak_apparent_mag_band (str or ~sncosmo.Bandpass) – Band used to normalize to apparent magnitude

  • mag_zpsys (str) – Optional, AB or Vega (AB default)

Returns:

Nothing is returned. The source’s amplitude parameter is modified in place.

slsim.Sources.Supernovae.supernovae_host_match module

class slsim.Sources.Supernovae.supernovae_host_match.SupernovaeHostMatch(supernovae_catalog, galaxy_catalog)[source]

Bases: object

Class to generate a host galaxy catalog for a given supernovae catalog.

match()[source]

Generates catalog in which supernovae are matched with host galaxies. (Fig 8 - Sullivan et al. 2006)

Returns:

catalog with supernovae redshifts and their corresponding host galaxies

Return type:

astropy Table

slsim.Sources.Supernovae.supernovae_lightcone module

class slsim.Sources.Supernovae.supernovae_lightcone.SNeLightcone(cosmo, redshifts, sky_area, noise, time_interval)[source]

Bases: object

Class to integrate SNe comoving density n(z) in light cone volume.

convert_density(density)[source]

Converts SN Ia comoving densities from [yr^(-1)Mpc^(-3)] to have the desired time unit.

Parameters:

density – initial comoving density of SN Ia [yr^(-1)Mpc^(-3)]

Returns:

SN Ia comoving density with the desired time unit [day^(-1)Mpc^(-3), hr^(-1)Mpc^(-3), etc.]

supernovae_sample()[source]

Integrates SNe comoving density in light cone.

Returns:

sampled redshifts such that the comoving number density of galaxies corresponds to the input distribution

Return type:

numpy.ndarray

slsim.Sources.Supernovae.supernovae_pop module

class slsim.Sources.Supernovae.supernovae_pop.SNIaRate(cosmo, z_max)[source]

Bases: object

Class to calculate supernovae rates.

calculate_SNIa_rate(z, eta=0.04)[source]

Calculates the rate of SN Ia. (Eq 15 - Oguri and Marshall 2010)

Parameters:
  • z – redshift (z>=0)

  • eta – canonical efficiency

Returns:

SN Ia rate n(z) in [(h)yr^(-1)Mpc^(-3)]

Return type:

array-like

z_from_time(t)[source]

Calculates redshift given cosmic time.

Parameters:

t – cosmic time since big bang in [Gy]

Returns:

redshift at time t [float]

slsim.Sources.Supernovae.supernovae_pop.calculate_star_formation_rate(z)[source]

Calculates the cosmic star formation rate. (Eq 13 - Oguri and Marshall 2010)

Parameters:

z – redshift (z>=0)

Returns:

cosmic star formation rate in [(h)(M_sol)yr^(-1)Mpc^(-3)]

slsim.Sources.Supernovae.supernovae_pop.delay_time_distribution(t_d)[source]

Calculates the power-law constraint on time delay. (Eq 14 - Oguri and Marshall 2010)

Parameters:

t_d – time delay (t_d>=0) in [Gyr]

Returns:

constrained time delay

Module contents