snsim.simu¶
Main module of the simulaiton package.
Classes¶
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 insurvey_file doesn’t match sncosmo namegain: CCD GAIN e-/ADU # Optional, default given by survey filesub_field: ‘sub_field_key’ # Optionalcdd_noise : sig_ccd_noise # Optional, default is 0 ADUkey_dic: {‘column_name’: ‘new_column_name’, etc} # Optional, to change columns namesadd_data: [‘keys1’, ‘keys2’, …] add db file keys to metadatasurvey_cut: {‘key1’: [‘conditon1’,’conditon2’,…], ‘key2’: [‘conditon1’]}start_day: MJD NUMBER or ‘YYYY-MM-DD’ # Optional, default given by survey fileduration: SURVEY DURATION (DAYS) # Optional, default given by survey filezp: INSTRUMENTAL ZEROPOINT # Optional, default given by survey filesig_zp: ZEROPOINT ERROR # Optional, default given by survey filefwhm_psf: GAUSSIAN PSF FWHM # Otional, default given by survey file as FWHMeffnoise_key: [key, type] type can be ‘mlim5’ or ‘skysigADU’ra_size: RA FIELD SIZE # Optional if there is geo_field_mapdec_size: DEC FIELD SIZE # Optional if there is geo_field_mapfield_shape: ‘/PATH/TO/FIELD_SHAPE_FILE’ # Optional if there is geo_field_mapgeo_field_map: ‘/PATH/TO/GEO_FIELD_MAP_FILE’ # Optionalsim_par:randseed: RANDSEED TO REPRODUCE SIMULATION # Optionalz_range: [ZMIN, ZMAX]nep_cut: [[nep_min1,Tmin,Tmax],[nep_min2,Tmin2,Tmax2,’filter1’],…] EP CUTSduration_for_rate: FAKE DURATION ONLY USE TO GENERATE N OBJ # Optionalmw_dust:model: MOD_NAMEr_v: Rv # Optional, default Rv = 3.1snia_gen:n_sn: NUMBER OF SN TO GENERATE # Optionalrate: rate of SN/Mpc^3/year # Optional, default=3e-5Mabs: SN ABSOLUT MAGNITUDEsigM: SN INTRINSIC COHERENT SCATTERINGsct_model: ‘G10’,’C11_i’ USE WAVELENGHT DEP MODEL FOR SN INT SCATTERINGmodel_name: ‘THE MODEL NAME’ Example : ‘salt2’model_dir: ‘/PATH/TO/SALT/MODEL’alpha: STRETCH CORRECTION = alpha*x1beta: COLOR CORRECTION = -beta*cdist_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 DENSITYH0: HUBBLE CONSTANTcmb:v_cmb: OUR PECULIAR VELOCITY # Optional, default = 620 km/sl_cmb: GAL L OF CMB DIPOLE # Optional, default = 271.0b_cmb: GAL B OF CMB DIPOLE # Optional, default = 29.6vpec_dist:mean_vpec: MEAN SN PECULIAR VELOCITYsig_vpec: SIGMA VPEChosts: (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 namesdask: # Optional for using dask parallelizationuse: True or Falsenworkers: NUMBER OF WORKERS # used to adjust work distributionInitialise 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.