Fix create_submit_at_exact_signal_position.py
create_submit_at_exact_signal_position.py
is crashing because injection_param
is missing from the event_info
dict. Since we have not modified this script in a while, it is almost certainly an issue with our changes to the config parser.
Error message
Traceback (most recent call last):
File "/home/daniel.wysocki/research/rapidpe-rift-pipe/venv/bin/create_submit_at_exact_signal_position.py", line 7, in <module>
exec(compile(f.read(), __file__, 'exec'))
File "/home/daniel.wysocki/research/rapidpe-rift-pipe/bin/create_submit_at_exact_signal_position.py", line 189, in <module>
main()
File "/home/daniel.wysocki/research/rapidpe-rift-pipe/bin/create_submit_at_exact_signal_position.py", line 126, in main
inj_param = convert_list_string_to_dict(event_info["injection_param"])
KeyError: 'injection_param'
create_submit_at_exact_signal_position.py /home/daniel.wysocki/research/rapidpe-rift-pipe/test_config.ini '{"output_event_ID": "20220805_gstlal_20190425_G330564", "event_time": "1240215503.171470390", "intrinsic_param": "[mass1=2.2661283,mass2=1.3069071]", "wrapper_script_start_time": 1659736761.1322205, "approximant": "TaylorT2", "cache_file": "/home/daniel.wysocki/research/rapidpe-rift-pipe/output/rpe_pipe_test1/20220805_gstlal_20190425_G330564/data.cache", "psd_file": "[L1=/home/daniel.wysocki/research/rapidpe-rift-pipe/output/rpe_pipe_test1/20220805_gstlal_20190425_G330564/psd.xml.gz,V1=/home/daniel.wysocki/research/rapidpe-rift-pipe/output/rpe_pipe_test1/20220805_gstlal_20190425_G330564/psd.xml.gz]", "channel_name": "[L1=GDS-CALIB_STRAIN,V1=Hrec_hoft_16384Hz]"}'
ERROR: non zero exit status256
Config file used
[General]
output_parent_directory=output/rpe_pipe_test1
submit_only_at_exact_signal_position=1
#Note: if use_skymap is set, set the skymap directory/file pattern to match in the [Event] section
use_skymap=0
#If you want to perform multiple studies on a single event, you can set this. And command line arguments passed to create_submit_dag will be ignored. If you do NOT set this = 1, the [Event] section in the config file will be ignored, and command line arguments with event specific information is required
event_parameters_in_config_file=0
#was n_samples_per_job in old RIT code. This defines how many iterations of rapidPE are run. Before each new iteration a new grid is generated which is finer than the previous grid, and covers a smaller region of intrinsic parameter space (hopefully around the signal)
n_iterations_per_job=2
#You need to specify an accounting group when submitting jobs to condor. Use this link to determine your accounting tag: https://ldas-gridmon.ligo.caltech.edu/ldg_accounting/user
#accounting_group=cgca.sim.o3.cbc.pe.lalinferencerapid
accounting_group=ligo.dev.o3.cbc.pe.lalinferencerapid
#If the candidate output sub_directory, under the parent directory, it will not be overwritten by default. But if you're just testing things and not making submissions, you can force the overwrite with this option. default=0
overwrite_existing_event_dag=1
#If this is set, the script will submit the dag. set=0 if not sure everything is working
submit_dag=1
#If this is set, an email will be sent to this address once all jobs are complete, and the plotting scripts have run. If you don't want an email per event (likely if you're doing injections studies) dont set it
email_address_for_job_complete_notice = vvalsan@uwm.edu
#TO DO: Make these paths be optional for development, default just from rapidpe install. also move this
#WARNING: This should be an absolute path. It's up to you to make sure you have the correct environemnt loaded
#This is the script that integrates over the extrinsic parameters for each intrinsic point. It is called once per intrinsic grid point.
#exe_integration_extrinsic_likelihood = /home/caitlin.rose/miniconda3/envs/py3p8/bin/rapidpe_integrate_extrinsic_likelihood
# if rift ile
#exe_integration_extrinsic_likelihood=/home/vinaya.valsan/.conda/envs/igwn-py38-clone_rapidpe_rift_devl/bin/integrate_likelihood_extrinsic_batchmode
# if rapidpe ile
exe_integration_extrinsic_likelihood=rapidpe_integrate_extrinsic_likelihood
#exe_grid_refine = /home/caitlin.rose/miniconda3/envs/py3p8/bin/rapidpe_compute_intrinsic_grid
exe_grid_refine=rapidpe_compute_intrinsic_grid
#This is the script which sets up the dag to run the integration for every intrinsic grid point. It is run once per iteration of rapidPE.
#exe_create_event_dag = /home/caitlin.rose/miniconda3/envs/py3p8/bin/rapidpe_create_event_dag
exe_create_event_dag=rapidpe_create_event_dag
#TO DO: only define params key once
#If you want to include spin, you need to specify the list of intrinsic param to search here
#WARNING: this needs to be sed here and in [GridRefine], unless you want it to refine only in mass space
intrinsic_param_to_search=[mass1,mass2]
#moved this section
[Event]
#gracedb_id = G330564
superevent_id = S190425z
#NEW I MOVED INJECTIONS FILE HERE FROM GENERAL
#injections_file = /home/caitlin.rose/my_rapidPE_work/f2y2016data/subset_f2y2016inj/exact_inj/f2y2016_HLV_100shuffled_exactmasses.txt
#cache_file=/home/caitlin.rose/my_rapidPE_work/f2y2016data/create_2016_L1H1_data/2016injecteddata/injected_frames.cache
#psd_file= [H1=/home/caitlin.rose/my_rapidPE_work/f2y2016data/create_2016_L1H1_data/firstattempt/H1_psd_mid.xml.gz,L1=/home/caitlin.rose/my_rapidPE_work/f2y2016data/create_2016_L1H1_data/firstattempt/L1_psd_mid.xml.gz,V1=/home/caitlin.rose/my_rapidPE_work/f2y2016data/check_virgo_psd/V1_psd.xml.gz]
#skymap_file=/home/vinaya.valsan/rapidPE/sinead_rapidPE/pp-plots-from-scratch/skymap/2016_fits/$INJINDEX$/bayestar.fits.gz
#channel_name=[H1=INJ_GAUSSIAN,L1=INJ_GAUSSIAN,V1=INJ_GAUSSIAN]
#Anything specified in this section is passed verbatim to rapidpe_compute_intrinsic_grid in generate_initial_grid_based_of_gstlal_O2_overlaps.py
[InitialGridOnly]
overlap-threshold = 0.40
#mc-min = 5
#mc-max = 61
points-per-side=5
[InitialGridSetup]
initial_region = {"mchirp" : [1.45, 1.55],
"eta" : [0.05, 0.25]}
# Passes to rapidpe_compute_initial_grid as '-I mass1=1.5,3 -I mass2=1,2'
#overlap_bank = /home/sinead.walsh/20180214_O2_overlaps_from_heather_fong/*.hdf
#overlap_bank = /home/caitlin.rose/my_rapidPE_work/overlap_f2y_rapidpe_runs/overlap_first2years.hdf
#The arguments in this section are passed directly to the command line in the condor dag job which does the grid refinement. Do not include any arguments which change per iteration or per node.
##NOTE: The script is currently setup to work with rapidpe_compute_intrinsic_grid or util_ConstructIntrinsicPosterior.py
[GridRefine]
no-exact-match=
#distance-coordinates=tau0_tau3
distance-coordinates=mchirp_eta
#distance-coordinates=mchirp_q
overlap-threshold=0.99
verbose=
intrinsic-param=[mass1,mass2]
#here you define information needed as input to the rapidpe scripts which computes the likelihood
#The arguments in this section are passed directly to the command line in the condor dag job. Use any variable that your exe_ntegration_extrinsic_likelihood can take. arg_a will be converted to arg-a automatically.
##NOTE: Do not include any arguments which change per iteration or per node or per event. Note that since these variable argumnets are set in the script, naming must be consistent with what is in use. Specifically, your integration script should take the input intrinsic_grid.xml as --template-bank-xml,the naming of the output file should be set by --output-file, and event time is set by --event-time. Everything else should be static and set below.
#If the same argument is defined multiple times in the exe command line, pass it as a list. eg arga=[input1,input2]. do not set separately arga=input1 arga=input2, only input2 will be read.
[LikelihoodIntegration]
#enable time marginalised integration. The time marg integration runs faster than the unmarginalised integration, and is often used.
time-marginalization=
no-adapt=
#default is 0
#amp-order=0
# Weights will be raised to this power to prevent overconvergence
#value used by rift
#adapt-weight-exponent=0.1
#value used by chris
adapt-weight-exponent=0.8
#save_P is the threshold on cumulative probability contribution to cache sample. If this is not zero, you might get < save-samples points in output. If you care about extrinsic params, set this = 0.0.
#chris used default of 0
save-P=1e-7
#save-P=0.0
#lmax is the largest l-index of any h_lm mode considered. default is 2
#l-max=2
# The new sampling distribution at the end of each chunk will be floor_level-weighted average of a uniform distribution and the (L^tempering_exp p/p_s)-weighted histogram of sampled points. default 0.1
#adapt-floor-level=0.1
#Threshold on deltalnL for points preserved in output file. default is inf.
#save-deltalnL=inf
#rift used 100.0, chirs used 0
#reference-freq=100.0
reference-freq=0.0
#The default fmax is the max frequency in the psd that comes with the event
#fmax=7900.0
fmin-template=15.0
#This defines the max number of intrinsic posterior points you want to calculate the likelihood for per extrinsic grid point. The best choice is unclear: if it's too small random sampling on the intrinsic grid won't have a chance to converge on the true maximum but the bigger you make it the longer the code runs
n-max=10000
#This is what's referred to as the effective number of templates (aka intrinsic grid points). As the rapidpe code iterates through the intrinsic grid, it calculates the effective number of templates/grid points for which the likelihood has been calculated so far. I assume this calculation is based on the overlap between templates, and effective number of templates is the same as saying the number of effectively independent templates, but I haven't confirmed this. If rapidpe reaches n_eff before reaching n_max, the calculations finish. In the way it has been used so far, n_eff is rarely reached before n_max. If n_eff is small when you reach n_max it's probably a bad thing, it indicates the intrinsic parameter space is not well sampled. What number would be considered small you ask? I don't know.
n-eff=1000
#Number of samples per chunk is min(n-chunk,n-max). I'm assuming once the limit on samples per chunk is reached the code jumps to another part of extrinsic space before continuing
n-chunk=1000
#per extrinsic grid point, the likelihood is calculated for many combinations of intrinsic grid points. This option defines how many intrinsic points are save in the output _samples.xml file. It its set to 0 or not set, no samples saved. If you want all samples saved set = n-max #was save_samples
save-samples=1000
#%(n-max)s
#WARNING: is save_samples/n-chunk is small (~1-3) and you have a loud signal, the extrinsic posteriors wont cover the full extrinsic parameter space and may be bad.
##commands which exist in RIT and UWM code, but have different names in each
#d_max in RIT. distance_maximum in UWM. I think this is the maximum distance (in Mpc) to include in the sampled intrinsic parameter space.
#distance-minimum=5.0
#distance-maximum=484.0
d-max=3000.0
d-min=1.0
#distance-marginalization=
#distance-marginalization-lookup-table=/home/vinaya.valsan/rapidPE/RapidPE_RIFT/generate_dist_lookup/distance_marginalization_lookup.npz
#vectorized=
#gpu=
#force-xpy=