snsim.simu

Main module of the simulaiton package.

Classes

Simulator

Simulation class using a config file config.yml.

Module Contents

class snsim.simu.Simulator(param_dic, print_config=False)[source]

Simulation class using a config file config.yml.

Parameters:

param_dic (dict / str) – The configuration yaml file / The dictionnary containing all simulation parameters.

Notes

yaml file format :

data :
write_path: ‘/PATH/TO/OUTPUT’
sim_name: ‘NAME OF SIMULATION’
write_format: ‘format’ or [‘format1’,’format2’]
survey_config:
survey_file: ‘/PATH/TO/FILE’
band_dic: {‘r’:’ztfr’,’g’:’ztfg’,’i’:’ztfi’} # Optional -> if bandname in
survey_file doesn’t match sncosmo name
gain: CCD GAIN e-/ADU # Optional, default given by survey file
sub_field: ‘sub_field_key’ # Optional
cdd_noise : sig_ccd_noise # Optional, default is 0 ADU
key_dic: {‘column_name’: ‘new_column_name’, etc} # Optional, to change columns names
add_data: [‘keys1’, ‘keys2’, …] add db file keys to metadata
survey_cut: {‘key1’: [‘conditon1’,’conditon2’,…], ‘key2’: [‘conditon1’]}
start_day: MJD NUMBER or ‘YYYY-MM-DD’ # Optional, default given by survey file
duration: SURVEY DURATION (DAYS) # Optional, default given by survey file
zp: INSTRUMENTAL ZEROPOINT # Optional, default given by survey file
sig_zp: ZEROPOINT ERROR # Optional, default given by survey file
fwhm_psf: GAUSSIAN PSF FWHM # Otional, default given by survey file as FWHMeff
noise_key: [key, type] type can be ‘mlim5’ or ‘skysigADU’
ra_size: RA FIELD SIZE # Optional if there is geo_field_map
dec_size: DEC FIELD SIZE # Optional if there is geo_field_map
field_shape: ‘/PATH/TO/FIELD_SHAPE_FILE’ # Optional if there is geo_field_map
geo_field_map: ‘/PATH/TO/GEO_FIELD_MAP_FILE’ # Optional
sim_par:
randseed: RANDSEED TO REPRODUCE SIMULATION # Optional
z_range: [ZMIN, ZMAX]
nep_cut: [[nep_min1,Tmin,Tmax],[nep_min2,Tmin2,Tmax2,’filter1’],…] EP CUTS
duration_for_rate: FAKE DURATION ONLY USE TO GENERATE N OBJ # Optional
mw_dust:
model: MOD_NAME
r_v: Rv # Optional, default Rv = 3.1
snia_gen:
n_sn: NUMBER OF SN TO GENERATE # Optional
rate: rate of SN/Mpc^3/year # Optional, default=3e-5
Mabs: SN ABSOLUT MAGNITUDE
sigM: SN INTRINSIC COHERENT SCATTERING
sct_model: ‘G10’,’C11_i’ USE WAVELENGHT DEP MODEL FOR SN INT SCATTERING
model_name: ‘THE MODEL NAME’ Example : ‘salt2’
model_dir: ‘/PATH/TO/SALT/MODEL’
alpha: STRETCH CORRECTION = alpha*x1
beta: COLOR CORRECTION = -beta*c
dist_x1: [MEAN X1, SIGMA X1], [MEAN X1, SIGMA_X1_LOW, SIGMA_X1_HIGH] or ‘N21’
dist_c: [MEAN C, SIGMA C] or [SIGMA_C_LOW, SIGMA_C_HIGH]
cosmology:
Om0: MATTER DENSITY
H0: HUBBLE CONSTANT
cmb:
v_cmb: OUR PECULIAR VELOCITY # Optional, default = 620 km/s
l_cmb: GAL L OF CMB DIPOLE # Optional, default = 271.0
b_cmb: GAL B OF CMB DIPOLE # Optional, default = 29.6
vpec_dist:
mean_vpec: MEAN SN PECULIAR VELOCITY
sig_vpec: SIGMA VPEC
hosts: (Optional)
host_file: ‘PATH/TO/HOSTFILE’
distrib: ‘rate’ or ‘random’ # Optional, default = ‘rate’
key_dic: {‘column_name’: ‘new_column_name’, etc} # Optional, to change columns names
dask: # Optional for using dask parallelization
use: True or False
nworkers: NUMBER OF WORKERS # used to adjust work distribution

Initialise Simulator class.

simulate()[source]

Launch the simulation.

Return type:

None

Notes

Simulation routine : 1- Use either _cadence_sim() or _gen_n_sn() to run the simulation 2- Gen all SN parameters inside SNGen class or/and SnHosts class 3- Check if SN pass cuts and then generate the lightcurves. 4- Write LCs to parquet/pkl file(s)

property config

Get the whole configuration dic.

property sim_name

Get sim name.

property vpec_dist

Get vpec option.

property cmb

Get cmb parameters.

property samples

Get the list of simulated sn.

property cosmology

Get astropy cosmological model used in simulation.

property survey

Get the SurveyObs object of the simulation.

property generators

Get the SNGen object of the simulation.

property hosts

Get the SnHosts object of the simulation.

property randseed

Get primary random seed of the simulation.

property z_range

Get z_range.

property nep_cut

Get the list of epochs cuts.