snsim.generators

This module contain generators class.

Classes

BaseGen

Abstract class for basic astrobj generator.

SNIaGen

SNIa parameters generator. Inherit from BaseGen

CCGen

Template for CoreColapse. Inherit from BaseGen.

SNIIGen

SNII parameters generator. Inherit from CCGen.

SNIIplGen

SNIIPL parameters generator. Inherit from CCGen.

SNIIbGen

SNIIb parameters generator. Inherit from CCGen.

SNIInGen

SNIIn parameters generator. Inherit from CCGen.

SNIbcGen

SNIb/c parameters generator. Inherit from CCGen.

SNIcGen

SNIc class. Inherit from CCGen.

SNIbGen

SNIb class. Inherit from CCGen.

SNIc_BLGen

SNIc_BL class. Inherit from CCGen.

SNIapeculiarGen

SNIa_peculiar class.

SNIaxGen

SNIaxclass.

SNIa_91bgGen

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.ABC

Abstract 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 deg

  • geometry (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:
gen_peak_time(n, seed=None)[source]

Generate uniformly n peak time in the survey time range.

Parameters:
Returns:

A numpy array which contains generated peak time.

Return type:

numpy.ndarray(float)

gen_coord(n, seed=None)[source]

Generate n coords (ra,dec) uniformly on the sky sphere.

Parameters:
Returns:

2 numpy arrays containing generated coordinates.

Return type:

numpy.ndarray(float), numpy.ndarray(float)

gen_zcos(n, seed=None)[source]

Generate n cosmological redshift in a range.

Parameters:
Returns:

A numpy array which contains generated cosmological redshift.

Return type:

numpy.ndarray(float)

gen_vpec(n, seed=None)[source]

Generate n peculiar velocities.

Parameters:
Returns:

numpy array containing vpec (km/s) generated.

Return type:

numpy.ndarray(float)

gen_basic_par(n_obj, seed=None, min_max_t=False)[source]

Generate basic obj properties.

Parameters:

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

gen_coh_scatter(n_obj, seed=None)[source]
random_models(n_obj, seed=None)[source]

Draw n random models for a given source.

Parameters:
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: BaseGen

SNIa 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 deg

  • geometry (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:

dict

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:

numpy.ndarray(float), numpy.ndarray(float)

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: BaseGen

Template for CoreColapse. Inherit from BaseGen.

Notes

For Rate:

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:

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 deg

  • geometry (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:

dict

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: CCGen

SNII 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 deg

  • geometry (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: CCGen

SNIIPL 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 deg

  • geometry (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: CCGen

SNIIb 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 deg

  • geometry (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: CCGen

SNIIn 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 deg

  • geometry (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: CCGen

SNIb/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 deg

  • geometry (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: CCGen

SNIc 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 deg

  • geometry (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: CCGen

SNIb 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 deg

  • geometry (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: CCGen

SNIc_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 deg

  • geometry (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: BaseGen

SNIa_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 deg

  • geometry (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:
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: SNIapeculiarGen

SNIaxclass.

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 deg

  • geometry (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: SNIapeculiarGen

SNIa 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 deg

  • geometry (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.