37
37
38
38
from pycbc import makedir
39
39
from pycbc .workflow .core import \
40
- File , FileList , configparser_value_to_file , resolve_url_to_file , \
40
+ File , FileList , resolve_url_to_file ,\
41
41
Executable , Node
42
42
from pycbc .workflow .jobsetup import select_generic_executable
43
43
from pycbc .workflow .pegasus_workflow import SubWorkflow
@@ -598,10 +598,11 @@ def make_pygrb_info_table(workflow, exec_name, out_dir, in_files=None,
598
598
return node , node .output_files
599
599
600
600
601
- def make_pygrb_injs_tables (workflow , out_dir , # exclude=None, require=None,
602
- inj_set = None , tags = None ):
603
- """Adds a PyGRB job to make quiet-found and missed-found injection tables.
601
+ def make_pygrb_injs_tables (workflow , out_dir , bank_file , off_file , seg_files ,
602
+ inj_file = None , on_file = None , tags = None ):
604
603
"""
604
+ Adds a job to make quiet-found and missed-found injection tables,
605
+ or loudest trigger(s) table."""
605
606
606
607
tags = [] if tags is None else tags
607
608
@@ -610,30 +611,23 @@ def make_pygrb_injs_tables(workflow, out_dir, # exclude=None, require=None,
610
611
# Initialize job node
611
612
grb_name = workflow .cp .get ('workflow' , 'trigger-name' )
612
613
extra_tags = ['GRB' + grb_name ]
613
- # TODO: why is inj_set repeated twice in output files?
614
- if inj_set is not None :
615
- extra_tags .append (inj_set )
616
614
node = PlotExecutable (workflow .cp , exec_name ,
617
615
ifos = workflow .ifos , out_dir = out_dir ,
618
616
tags = tags + extra_tags ).create_node ()
617
+ # Pass the bank-file
618
+ node .add_input_opt ('--bank-file' , bank_file )
619
+ # Offsource input file (or equivalently trigger file for injections)
620
+ offsource_file = off_file
621
+ node .add_input_opt ('--offsource-file' , offsource_file )
619
622
# Pass the veto and segment files and options
620
623
if workflow .cp .has_option ('workflow' , 'veto-files' ):
621
624
veto_files = build_veto_filelist (workflow )
622
625
node .add_input_list_opt ('--veto-files' , veto_files )
623
- trig_time = workflow .cp .get ('workflow' , 'trigger-time' )
624
- node .add_opt ('--trigger-time' , trig_time )
625
- # Other shared tuning values
626
- for opt in ['chisq-index' , 'chisq-nhigh' , 'null-snr-threshold' ,
627
- 'veto-category' , 'snr-threshold' , 'newsnr-threshold' ,
628
- 'sngl-snr-threshold' , 'null-grad-thresh' , 'null-grad-val' ]:
629
- if workflow .cp .has_option ('workflow' , opt ):
630
- node .add_opt ('--' + opt , workflow .cp .get ('workflow' , opt ))
626
+ node .add_input_list_opt ('--seg-files' , seg_files )
631
627
# Handle input/output for injections
632
- if inj_set :
628
+ if inj_file is not None :
633
629
# Found-missed injection file (passed as File instance)
634
- fm_file = configparser_value_to_file (workflow .cp ,
635
- 'injections-' + inj_set ,
636
- 'found-missed-file' )
630
+ fm_file = inj_file
637
631
node .add_input_opt ('--found-missed-file' , fm_file )
638
632
# Missed-found and quiet-found injections html output files
639
633
for mf_or_qf in ['missed-found' , 'quiet-found' ]:
@@ -647,20 +641,20 @@ def make_pygrb_injs_tables(workflow, out_dir, # exclude=None, require=None,
647
641
tags = extra_tags + ['QUIET_FOUND' ])
648
642
# Handle input/output for onsource/offsource
649
643
else :
650
- # Onsource input file (passed as File instance)
651
- onsource_file = configparser_value_to_file ( workflow . cp ,
652
- 'workflow' , ' onsource-file' )
653
- node . add_input_opt ( '--onsource- file' , onsource_file )
654
- # Loudest offsource triggers and onsource trigger html and h5
655
- # output files
656
- for src_type in [ ' onsource-trig' , 'offsource-trigs' ]:
657
- src_type_tags = [src_type .upper ().replace ('-' , '_' )]
658
- node .new_output_file_opt (workflow .analysis_time , '.html' ,
659
- '--loudest-' + src_type + '-output-file' ,
660
- tags = extra_tags + src_type_tags )
661
- node .new_output_file_opt (workflow .analysis_time , '.h5' ,
662
- '--loudest-' + src_type + '-h5-output-file' ,
663
- tags = extra_tags + src_type_tags )
644
+ src_type = 'offsource-trigs'
645
+ if on_file is not None :
646
+ src_type = ' onsource-trig'
647
+ # Onsource input file (passed as File instance )
648
+ onsource_file = on_file
649
+ node . add_input_opt ( '--onsource-file' , onsource_file )
650
+ # Loudest offsource/ onsource triggers html and h5 output files
651
+ src_type_tags = [src_type .upper ().replace ('-' , '_' )]
652
+ node .new_output_file_opt (workflow .analysis_time , '.html' ,
653
+ '--loudest-' + src_type + '-output-file' ,
654
+ tags = extra_tags + src_type_tags )
655
+ node .new_output_file_opt (workflow .analysis_time , '.h5' ,
656
+ '--loudest-' + src_type + '-h5-output-file' ,
657
+ tags = extra_tags + src_type_tags )
664
658
665
659
# Add job node to the workflow
666
660
workflow += node
0 commit comments