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:
SupernovaClass 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
- 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:
ModelClass 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¶
slsim.Sources.Supernovae.supernovae_lightcone module¶
- class slsim.Sources.Supernovae.supernovae_lightcone.SNeLightcone(cosmo, redshifts, sky_area, noise, time_interval)[source]¶
Bases:
objectClass to integrate SNe comoving density n(z) in light cone volume.
slsim.Sources.Supernovae.supernovae_pop module¶
- class slsim.Sources.Supernovae.supernovae_pop.SNIaRate(cosmo, z_max)[source]¶
Bases:
objectClass to calculate supernovae rates.