snsim.simu ========== .. py:module:: snsim.simu .. autoapi-nested-parse:: Main module of the simulaiton package. Classes ------- .. autoapisummary:: snsim.simu.Simulator Module Contents --------------- .. py:class:: Simulator(param_dic, print_config=False) Simulation class using a config file config.yml. :param param_dic: The configuration yaml file / The dictionnary containing all simulation parameters. :type param_dic: dict / str .. rubric:: 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 | 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 | sig_psf: GAUSSIAN PSF SIGMA # Otional, default given by survey file as FWHMeff | noise_key: [key, type] type can be 'mlim5' or 'skysigADU' | ra_size: RA FIELD SIZE | dec_size: DEC FIELD SIZE | gain: CCD GAIN e-/ADU (Optional, default given by survey file) | sub_field: ['sub_field_file', 'sub_field_key'] | cdd_noise : sig_ccd_noise # Optional, default is 0 ADU | 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 | M0: 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. .. py:method:: simulate() Launch the simulation. :rtype: None .. rubric:: 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) .. py:property:: config Get the whole configuration dic. .. py:property:: sim_name Get sim name. .. py:property:: vpec_dist Get vpec option. .. py:property:: cmb Get cmb parameters. .. py:property:: samples Get the list of simulated sn. .. py:property:: cosmology Get astropy cosmological model used in simulation. .. py:property:: survey Get the SurveyObs object of the simulation. .. py:property:: generators Get the SNGen object of the simulation. .. py:property:: hosts Get the SnHosts object of the simulation. .. py:property:: randseed Get primary random seed of the simulation. .. py:property:: z_range Get z_range. .. py:property:: nep_cut Get the list of epochs cuts.