snsim.generators¶
This module contain generators class.
Classes¶
Abstract class for basic astrobj generator. |
|
SNIa parameters generator. Inherit from BaseGen |
|
Template for CoreColapse. Inherit from BaseGen. |
|
SNII parameters generator. Inherit from CCGen. |
|
SNIIPL parameters generator. Inherit from CCGen. |
|
SNIIb parameters generator. Inherit from CCGen. |
|
SNIIn parameters generator. Inherit from CCGen. |
|
SNIb/c parameters generator. Inherit from CCGen. |
|
SNIc class. Inherit from CCGen. |
|
SNIb class. Inherit from CCGen. |
|
SNIc_BL class. Inherit from CCGen. |
|
SNIa_peculiar class. |
|
SNIaxclass. |
|
SNIa 91bg-like class. |
Module Contents¶
- class snsim.generators.BaseGen(params, cosmology, time_range, z_range=None, vpec_dist=None, hosts=None, mw_dust=None, cmb=None, geometry=None)[source]¶
Bases:
abc.ABCAbstract class for basic astrobj generator.
Init BaseGen class.
- Parameters:
params (dict) – Basic generator configuration.
cosmology (astropy.cosmology) – The cosmological model to use.
time_range (tuple) – (tmin, tmax) time range.
z_range (tuple, optional) – (zmin, zmax) redshift range, no need to be defined if there is hosts, by default None
vpec_dist (dic, optional) –
PV distrib parameters, by default None
vpec_dist├── mean_vpec, by default 0.└── sig_vpec, by default 0.hosts (snsim.SnHost, optional) – hosts for simulated SN, by default None
mw_dust (dic, optional) – Milky Way dust, by default None
cmb (dic, optional) –
CMB dipole parameters, by default None
cmb├── v_cmb, by default 369.82 km/s├── l_cmb, by default 264.021 deg└── b_cmb, by default 48.253 deggeometry (shapely.geometry, optional) – The survey footprint, by default None
- Raises:
ValueError – If you set PV dist and hosts at the same time.
ValueError – If you neither set PV or hosts.
ValueError – If no hosts and no z_range.
- sim_effects¶
- abstract gen_par(n_obj, basic_par, seed=None)[source]¶
Abstract method to add random generated parameters specific to the astro object used, called in __call__
- Parameters:
basic_par (dict(key: np.ndarray())) – Contains basic random generated properties.
seed (int or numpy.random.SeedSequence, optional) – Random seed.
- gen_peak_time(n, seed=None)[source]¶
Generate uniformly n peak time in the survey time range.
- Parameters:
n (int) – Number of time to generate.
seed (int or numpy.random.SeedSequence, optional) – Random seed, by default None
- Returns:
A numpy array which contains generated peak time.
- Return type:
- gen_coord(n, seed=None)[source]¶
Generate n coords (ra,dec) uniformly on the sky sphere.
- Parameters:
n (int) – Number of coords to generate.
seed (int or numpy.random.SeedSequence, optional) – Random seed, by default None
- Returns:
2 numpy arrays containing generated coordinates.
- Return type:
- gen_zcos(n, seed=None)[source]¶
Generate n cosmological redshift in a range.
- Parameters:
n (int) – Number of redshifts to generate.
seed (int or numpy.random.SeedSequence, optional) – Random seed, by default None
- Returns:
A numpy array which contains generated cosmological redshift.
- Return type:
- gen_vpec(n, seed=None)[source]¶
Generate n peculiar velocities.
- Parameters:
n (int) – Number of vpec to generate.
seed (int or numpy.random.SeedSequence, optional) – Random seed, by default None
- Returns:
numpy array containing vpec (km/s) generated.
- Return type:
- gen_basic_par(n_obj, seed=None, min_max_t=False)[source]¶
Generate basic obj properties.
- Parameters:
n_obj (int) – Number of obj.
seed (int or numpy.random.SeedSequence, optional) – Random seed, by default None
Notes
- List of parameters:
t0 : obj peak
zcos : cosmological redshift
ra : Right Ascension
dec : Declinaison
vpec : peculiar velocity
como_dist : comoving distance
zpcmb : CMB dipole redshift contribution
mw_ebv, opt : Milky way dust extinction
host_, opt : host parameters
- random_models(n_obj, seed=None)[source]¶
Draw n random models for a given source.
- Parameters:
n_obj (int) – Number of models to draw.
seed (int or numpy.random.SeedSequence, optional) – Random seed, by default None
- Returns:
dic(model_names – Dic which contains list of model_names and versions.
- Return type:
list, model_version: list)
- property hosts¶
Get the host class.
- property vpec_dist¶
Get the peculiar velocity distribution parameters.
- property mw_dust¶
Get the mw_dust parameters.
- property cosmology¶
Get astropy cosmological model.
- property cmb¶
Get cmb used parameters.
- property time_range¶
Get time range.
- property z_range¶
Get redshift range.
- property z_cdf¶
Get the redshift cumulative distribution.
- class snsim.generators.SNIaGen(params, cosmology, time_range, z_range=None, vpec_dist=None, hosts=None, mw_dust=None, cmb=None, geometry=None)[source]¶
Bases:
BaseGenSNIa parameters generator. Inherit from BaseGen
Init BaseGen class.
- Parameters:
params (dict) – Basic generator configuration.
cosmology (astropy.cosmology) – The cosmological model to use.
time_range (tuple) – (tmin, tmax) time range.
z_range (tuple, optional) – (zmin, zmax) redshift range, no need to be defined if there is hosts, by default None
vpec_dist (dic, optional) –
PV distrib parameters, by default None
vpec_dist├── mean_vpec, by default 0.└── sig_vpec, by default 0.hosts (snsim.SnHost, optional) – hosts for simulated SN, by default None
mw_dust (dic, optional) – Milky Way dust, by default None
cmb (dic, optional) –
CMB dipole parameters, by default None
cmb├── v_cmb, by default 369.82 km/s├── l_cmb, by default 264.021 deg└── b_cmb, by default 48.253 deggeometry (shapely.geometry, optional) – The survey footprint, by default None
- Raises:
ValueError – If you set PV dist and hosts at the same time.
ValueError – If you neither set PV or hosts.
ValueError – If no hosts and no z_range.
- gen_par(n_obj, basic_par, seed=None)[source]¶
Generate SNIa specific parameters.
- Parameters:
n_obj (int) – Number of parameters to generate.
basic_par (pd.DataFrame) – Dataframe with pre-generated parameters.
seed (int or numpy.random.SeedSequence, optional) – Random seed, by default None
- Returns:
One dictionnary containing ‘parameters names’: numpy.ndarray(float).
- Return type:
- gen_salt_par(n_sn, seed=None, basic_par=None)[source]¶
Generate SALT parameters.
- Parameters:
n_sn (int) – Number of parameters to generate.
seed (int or numpy.random.SeedSequence, optional) – Random seed, by default None
basic_par (pd.DataFrame) – Pre-generated parameters.
- Returns:
2 numpy arrays containing SALT2 x1 and c generated parameters.
- Return type:
- class snsim.generators.CCGen(params, cosmology, time_range, z_range=None, vpec_dist=None, hosts=None, mw_dust=None, cmb=None, geometry=None)[source]¶
Bases:
BaseGenTemplate for CoreColapse. Inherit from BaseGen.
Notes
- For Rate:
SNCC ztf20 relative fraction of SNe subtypes from https://arxiv.org/abs/2009.01242 figure 6 +
ztf20 relative fraction between SNe Ic and SNe Ib from https://iopscience.iop.org/article/10.3847/1538-4357/aa5eb7/meta * SNCC shiver17 fraction from https://arxiv.org/abs/1609.02922 Table 3
- For Luminosity Functions:
SNCC Mabs mean and scattering of luminosity function values from Vincenzi et al. 2021 Table 5 (https://arxiv.org/abs/2111.10382)
Init BaseGen class.
- Parameters:
params (dict) – Basic generator configuration.
cosmology (astropy.cosmology) – The cosmological model to use.
time_range (tuple) – (tmin, tmax) time range.
z_range (tuple, optional) – (zmin, zmax) redshift range, no need to be defined if there is hosts, by default None
vpec_dist (dic, optional) –
PV distrib parameters, by default None
vpec_dist├── mean_vpec, by default 0.└── sig_vpec, by default 0.hosts (snsim.SnHost, optional) – hosts for simulated SN, by default None
mw_dust (dic, optional) – Milky Way dust, by default None
cmb (dic, optional) –
CMB dipole parameters, by default None
cmb├── v_cmb, by default 369.82 km/s├── l_cmb, by default 264.021 deg└── b_cmb, by default 48.253 deggeometry (shapely.geometry, optional) – The survey footprint, by default None
- Raises:
ValueError – If you set PV dist and hosts at the same time.
ValueError – If you neither set PV or hosts.
ValueError – If no hosts and no z_range.
- gen_par(n_obj, basic_par, seed=None)[source]¶
Generate sncosmo model dependant parameters (others than redshift and t0). :param n_obj: Number of parameters to generate. :type n_obj: int :param basic_par: Pre-generated parameters. :param seed: Random seed, by default None
.
- Returns:
One dictionnary containing ‘parameters names’: numpy.ndarray(float).
- Return type:
- class snsim.generators.SNIIGen(params, cosmology, time_range, z_range=None, vpec_dist=None, hosts=None, mw_dust=None, cmb=None, geometry=None)[source]¶
Bases:
CCGenSNII parameters generator. Inherit from CCGen.
Init BaseGen class.
- Parameters:
params (dict) – Basic generator configuration.
cosmology (astropy.cosmology) – The cosmological model to use.
time_range (tuple) – (tmin, tmax) time range.
z_range (tuple, optional) – (zmin, zmax) redshift range, no need to be defined if there is hosts, by default None
vpec_dist (dic, optional) –
PV distrib parameters, by default None
vpec_dist├── mean_vpec, by default 0.└── sig_vpec, by default 0.hosts (snsim.SnHost, optional) – hosts for simulated SN, by default None
mw_dust (dic, optional) – Milky Way dust, by default None
cmb (dic, optional) –
CMB dipole parameters, by default None
cmb├── v_cmb, by default 369.82 km/s├── l_cmb, by default 264.021 deg└── b_cmb, by default 48.253 deggeometry (shapely.geometry, optional) – The survey footprint, by default None
- Raises:
ValueError – If you set PV dist and hosts at the same time.
ValueError – If you neither set PV or hosts.
ValueError – If no hosts and no z_range.
- class snsim.generators.SNIIplGen(params, cosmology, time_range, z_range=None, vpec_dist=None, hosts=None, mw_dust=None, cmb=None, geometry=None)[source]¶
Bases:
CCGenSNIIPL parameters generator. Inherit from CCGen.
Init BaseGen class.
- Parameters:
params (dict) – Basic generator configuration.
cosmology (astropy.cosmology) – The cosmological model to use.
time_range (tuple) – (tmin, tmax) time range.
z_range (tuple, optional) – (zmin, zmax) redshift range, no need to be defined if there is hosts, by default None
vpec_dist (dic, optional) –
PV distrib parameters, by default None
vpec_dist├── mean_vpec, by default 0.└── sig_vpec, by default 0.hosts (snsim.SnHost, optional) – hosts for simulated SN, by default None
mw_dust (dic, optional) – Milky Way dust, by default None
cmb (dic, optional) –
CMB dipole parameters, by default None
cmb├── v_cmb, by default 369.82 km/s├── l_cmb, by default 264.021 deg└── b_cmb, by default 48.253 deggeometry (shapely.geometry, optional) – The survey footprint, by default None
- Raises:
ValueError – If you set PV dist and hosts at the same time.
ValueError – If you neither set PV or hosts.
ValueError – If no hosts and no z_range.
- class snsim.generators.SNIIbGen(params, cosmology, time_range, z_range=None, vpec_dist=None, hosts=None, mw_dust=None, cmb=None, geometry=None)[source]¶
Bases:
CCGenSNIIb parameters generator. Inherit from CCGen.
Init BaseGen class.
- Parameters:
params (dict) – Basic generator configuration.
cosmology (astropy.cosmology) – The cosmological model to use.
time_range (tuple) – (tmin, tmax) time range.
z_range (tuple, optional) – (zmin, zmax) redshift range, no need to be defined if there is hosts, by default None
vpec_dist (dic, optional) –
PV distrib parameters, by default None
vpec_dist├── mean_vpec, by default 0.└── sig_vpec, by default 0.hosts (snsim.SnHost, optional) – hosts for simulated SN, by default None
mw_dust (dic, optional) – Milky Way dust, by default None
cmb (dic, optional) –
CMB dipole parameters, by default None
cmb├── v_cmb, by default 369.82 km/s├── l_cmb, by default 264.021 deg└── b_cmb, by default 48.253 deggeometry (shapely.geometry, optional) – The survey footprint, by default None
- Raises:
ValueError – If you set PV dist and hosts at the same time.
ValueError – If you neither set PV or hosts.
ValueError – If no hosts and no z_range.
- class snsim.generators.SNIInGen(params, cosmology, time_range, z_range=None, vpec_dist=None, hosts=None, mw_dust=None, cmb=None, geometry=None)[source]¶
Bases:
CCGenSNIIn parameters generator. Inherit from CCGen.
Init BaseGen class.
- Parameters:
params (dict) – Basic generator configuration.
cosmology (astropy.cosmology) – The cosmological model to use.
time_range (tuple) – (tmin, tmax) time range.
z_range (tuple, optional) – (zmin, zmax) redshift range, no need to be defined if there is hosts, by default None
vpec_dist (dic, optional) –
PV distrib parameters, by default None
vpec_dist├── mean_vpec, by default 0.└── sig_vpec, by default 0.hosts (snsim.SnHost, optional) – hosts for simulated SN, by default None
mw_dust (dic, optional) – Milky Way dust, by default None
cmb (dic, optional) –
CMB dipole parameters, by default None
cmb├── v_cmb, by default 369.82 km/s├── l_cmb, by default 264.021 deg└── b_cmb, by default 48.253 deggeometry (shapely.geometry, optional) – The survey footprint, by default None
- Raises:
ValueError – If you set PV dist and hosts at the same time.
ValueError – If you neither set PV or hosts.
ValueError – If no hosts and no z_range.
- class snsim.generators.SNIbcGen(params, cosmology, time_range, z_range=None, vpec_dist=None, hosts=None, mw_dust=None, cmb=None, geometry=None)[source]¶
Bases:
CCGenSNIb/c parameters generator. Inherit from CCGen.
Init BaseGen class.
- Parameters:
params (dict) – Basic generator configuration.
cosmology (astropy.cosmology) – The cosmological model to use.
time_range (tuple) – (tmin, tmax) time range.
z_range (tuple, optional) – (zmin, zmax) redshift range, no need to be defined if there is hosts, by default None
vpec_dist (dic, optional) –
PV distrib parameters, by default None
vpec_dist├── mean_vpec, by default 0.└── sig_vpec, by default 0.hosts (snsim.SnHost, optional) – hosts for simulated SN, by default None
mw_dust (dic, optional) – Milky Way dust, by default None
cmb (dic, optional) –
CMB dipole parameters, by default None
cmb├── v_cmb, by default 369.82 km/s├── l_cmb, by default 264.021 deg└── b_cmb, by default 48.253 deggeometry (shapely.geometry, optional) – The survey footprint, by default None
- Raises:
ValueError – If you set PV dist and hosts at the same time.
ValueError – If you neither set PV or hosts.
ValueError – If no hosts and no z_range.
- class snsim.generators.SNIcGen(params, cosmology, time_range, z_range=None, vpec_dist=None, hosts=None, mw_dust=None, cmb=None, geometry=None)[source]¶
Bases:
CCGenSNIc class. Inherit from CCGen.
Init BaseGen class.
- Parameters:
params (dict) – Basic generator configuration.
cosmology (astropy.cosmology) – The cosmological model to use.
time_range (tuple) – (tmin, tmax) time range.
z_range (tuple, optional) – (zmin, zmax) redshift range, no need to be defined if there is hosts, by default None
vpec_dist (dic, optional) –
PV distrib parameters, by default None
vpec_dist├── mean_vpec, by default 0.└── sig_vpec, by default 0.hosts (snsim.SnHost, optional) – hosts for simulated SN, by default None
mw_dust (dic, optional) – Milky Way dust, by default None
cmb (dic, optional) –
CMB dipole parameters, by default None
cmb├── v_cmb, by default 369.82 km/s├── l_cmb, by default 264.021 deg└── b_cmb, by default 48.253 deggeometry (shapely.geometry, optional) – The survey footprint, by default None
- Raises:
ValueError – If you set PV dist and hosts at the same time.
ValueError – If you neither set PV or hosts.
ValueError – If no hosts and no z_range.
- class snsim.generators.SNIbGen(params, cosmology, time_range, z_range=None, vpec_dist=None, hosts=None, mw_dust=None, cmb=None, geometry=None)[source]¶
Bases:
CCGenSNIb class. Inherit from CCGen.
Init BaseGen class.
- Parameters:
params (dict) – Basic generator configuration.
cosmology (astropy.cosmology) – The cosmological model to use.
time_range (tuple) – (tmin, tmax) time range.
z_range (tuple, optional) – (zmin, zmax) redshift range, no need to be defined if there is hosts, by default None
vpec_dist (dic, optional) –
PV distrib parameters, by default None
vpec_dist├── mean_vpec, by default 0.└── sig_vpec, by default 0.hosts (snsim.SnHost, optional) – hosts for simulated SN, by default None
mw_dust (dic, optional) – Milky Way dust, by default None
cmb (dic, optional) –
CMB dipole parameters, by default None
cmb├── v_cmb, by default 369.82 km/s├── l_cmb, by default 264.021 deg└── b_cmb, by default 48.253 deggeometry (shapely.geometry, optional) – The survey footprint, by default None
- Raises:
ValueError – If you set PV dist and hosts at the same time.
ValueError – If you neither set PV or hosts.
ValueError – If no hosts and no z_range.
- class snsim.generators.SNIc_BLGen(params, cosmology, time_range, z_range=None, vpec_dist=None, hosts=None, mw_dust=None, cmb=None, geometry=None)[source]¶
Bases:
CCGenSNIc_BL class. Inherit from CCGen.
Init BaseGen class.
- Parameters:
params (dict) – Basic generator configuration.
cosmology (astropy.cosmology) – The cosmological model to use.
time_range (tuple) – (tmin, tmax) time range.
z_range (tuple, optional) – (zmin, zmax) redshift range, no need to be defined if there is hosts, by default None
vpec_dist (dic, optional) –
PV distrib parameters, by default None
vpec_dist├── mean_vpec, by default 0.└── sig_vpec, by default 0.hosts (snsim.SnHost, optional) – hosts for simulated SN, by default None
mw_dust (dic, optional) – Milky Way dust, by default None
cmb (dic, optional) –
CMB dipole parameters, by default None
cmb├── v_cmb, by default 369.82 km/s├── l_cmb, by default 264.021 deg└── b_cmb, by default 48.253 deggeometry (shapely.geometry, optional) – The survey footprint, by default None
- Raises:
ValueError – If you set PV dist and hosts at the same time.
ValueError – If you neither set PV or hosts.
ValueError – If no hosts and no z_range.
- class snsim.generators.SNIapeculiarGen(params, cosmology, time_range, z_range=None, vpec_dist=None, hosts=None, mw_dust=None, cmb=None, geometry=None)[source]¶
Bases:
BaseGenSNIa_peculiar class.
Models form platicc challenge ask Rick need a directory to store model
same as TimeSeriesGen class
Init BaseGen class.
- Parameters:
params (dict) – Basic generator configuration.
cosmology (astropy.cosmology) – The cosmological model to use.
time_range (tuple) – (tmin, tmax) time range.
z_range (tuple, optional) – (zmin, zmax) redshift range, no need to be defined if there is hosts, by default None
vpec_dist (dic, optional) –
PV distrib parameters, by default None
vpec_dist├── mean_vpec, by default 0.└── sig_vpec, by default 0.hosts (snsim.SnHost, optional) – hosts for simulated SN, by default None
mw_dust (dic, optional) – Milky Way dust, by default None
cmb (dic, optional) –
CMB dipole parameters, by default None
cmb├── v_cmb, by default 369.82 km/s├── l_cmb, by default 264.021 deg└── b_cmb, by default 48.253 deggeometry (shapely.geometry, optional) – The survey footprint, by default None
- Raises:
ValueError – If you set PV dist and hosts at the same time.
ValueError – If you neither set PV or hosts.
ValueError – If no hosts and no z_range.
- gen_par(n_obj, basic_par, seed=None)[source]¶
Abstract method to add random generated parameters specific to the astro object used, called in __call__
- Parameters:
basic_par (dict(key: np.ndarray())) – Contains basic random generated properties.
seed (int or numpy.random.SeedSequence, optional) – Random seed.
- class snsim.generators.SNIaxGen(params, cosmology, time_range, z_range=None, vpec_dist=None, hosts=None, mw_dust=None, cmb=None, geometry=None)[source]¶
Bases:
SNIapeculiarGenSNIaxclass.
Models form platicc challenge ask Rick need a directory to store model
same as TimeSeriesGen class
Init BaseGen class.
- Parameters:
params (dict) – Basic generator configuration.
cosmology (astropy.cosmology) – The cosmological model to use.
time_range (tuple) – (tmin, tmax) time range.
z_range (tuple, optional) – (zmin, zmax) redshift range, no need to be defined if there is hosts, by default None
vpec_dist (dic, optional) –
PV distrib parameters, by default None
vpec_dist├── mean_vpec, by default 0.└── sig_vpec, by default 0.hosts (snsim.SnHost, optional) – hosts for simulated SN, by default None
mw_dust (dic, optional) – Milky Way dust, by default None
cmb (dic, optional) –
CMB dipole parameters, by default None
cmb├── v_cmb, by default 369.82 km/s├── l_cmb, by default 264.021 deg└── b_cmb, by default 48.253 deggeometry (shapely.geometry, optional) – The survey footprint, by default None
- Raises:
ValueError – If you set PV dist and hosts at the same time.
ValueError – If you neither set PV or hosts.
ValueError – If no hosts and no z_range.
- class snsim.generators.SNIa_91bgGen(params, cosmology, time_range, z_range=None, vpec_dist=None, hosts=None, mw_dust=None, cmb=None, geometry=None)[source]¶
Bases:
SNIapeculiarGenSNIa 91bg-like class.
Models form platicc challenge ask Rick need a directory to store model
same as TimeSeriesGen class
Init BaseGen class.
- Parameters:
params (dict) – Basic generator configuration.
cosmology (astropy.cosmology) – The cosmological model to use.
time_range (tuple) – (tmin, tmax) time range.
z_range (tuple, optional) – (zmin, zmax) redshift range, no need to be defined if there is hosts, by default None
vpec_dist (dic, optional) –
PV distrib parameters, by default None
vpec_dist├── mean_vpec, by default 0.└── sig_vpec, by default 0.hosts (snsim.SnHost, optional) – hosts for simulated SN, by default None
mw_dust (dic, optional) – Milky Way dust, by default None
cmb (dic, optional) –
CMB dipole parameters, by default None
cmb├── v_cmb, by default 369.82 km/s├── l_cmb, by default 264.021 deg└── b_cmb, by default 48.253 deggeometry (shapely.geometry, optional) – The survey footprint, by default None
- Raises:
ValueError – If you set PV dist and hosts at the same time.
ValueError – If you neither set PV or hosts.
ValueError – If no hosts and no z_range.