Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further grb utils cleanup #4886

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/pycbc_multi_inspiral
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ with ctx:
if not any(n_trigs):
continue

# Loop over (short) time-slides, staring with the zero-lag
# Loop over (short) time-slides, starting with the zero-lag
for slide in range(num_slides):
logging.info("Analyzing slide %d/%d", slide, num_slides)
# Loop over sky positions
Expand Down
22 changes: 6 additions & 16 deletions pycbc/workflow/grb_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,9 @@ def build_veto_filelist(workflow):
return veto_files


def build_segment_filelist(workflow):
def build_segment_filelist(seg_dir):
"""Construct a FileList instance containing all segments txt files"""

seg_dir = workflow.cp.get('workflow', 'segment-dir')
file_names = ["bufferSeg.txt", "offSourceSeg.txt", "onSourceSeg.txt"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A suggestion here to combine these 3 files into one (these were horrible even in 2011).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... Probably not for this PR though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened an issue #4887 for future PyGRB development. Thanks!

seg_files = [os.path.join(seg_dir, fn) for fn in file_names]
seg_files = [resolve_url_to_file(sf) for sf in seg_files]
Expand Down Expand Up @@ -489,7 +488,7 @@ def make_pygrb_plot(workflow, exec_name, out_dir,
out_dir=out_dir,
tags=tags+extra_tags).create_node()
if trig_file is not None:
node.add_input_opt('--trig-file', resolve_url_to_file(trig_file))
node.add_input_opt('--trig-file', trig_file)
# Pass the veto and segment files and options
if workflow.cp.has_option('workflow', 'veto-category'):
node.add_opt('--veto-category',
Expand All @@ -507,19 +506,18 @@ def make_pygrb_plot(workflow, exec_name, out_dir,
# Pass the injection file as an input File instance
if inj_file is not None and exec_name not in \
['pygrb_plot_skygrid', 'pygrb_plot_stats_distribution']:
fm_file = resolve_url_to_file(inj_file)
fm_file = inj_file
node.add_input_opt('--found-missed-file', fm_file)
# IFO option
if ifo:
node.add_opt('--ifo', ifo)
# Output files and final input file (passed as a File instance)
if exec_name == 'pygrb_efficiency':
# In this case tags[0] is the offtrial number
seg_filelist = FileList([resolve_url_to_file(sf) for sf in seg_files])
node.add_input_list_opt('--seg-files', seg_filelist)
node.add_input_list_opt('--seg-files', seg_files)
node.add_input_opt('--onsource-file',
resolve_url_to_file(onsource_file))
node.add_input_opt('--bank-file', resolve_url_to_file(bank_file))
onsource_file)
node.add_input_opt('--bank-file', bank_file)
node.new_output_file_opt(workflow.analysis_time, '.png',
'--background-output-file',
tags=extra_tags+['max_background'])
Expand Down Expand Up @@ -696,8 +694,6 @@ def setup_pygrb_minifollowups(workflow, followups_file, trigger_file,
makedir(dax_output)

# Turn the config file into a File instance
# curr_ifo = single_trig_file.ifo
# config_path = os.path.abspath(dax_output + '/' + curr_ifo + \
config_path = os.path.abspath(dax_output + '/' +
'_'.join(tags) + '_minifollowup.ini')
workflow.cp.write(open(config_path, 'w'))
Expand Down Expand Up @@ -773,12 +769,6 @@ def setup_pygrb_results_workflow(workflow, res_dir, trig_files,
# _workflow.makedir(dax_output)
makedir(dax_output)

# Turn the config file into a File instance
# config_path = os.path.abspath(dax_output + '/' + \
# '_'.join(tags) + 'webpage.ini')
# workflow.cp.write(open(config_path, 'w'))
# config_file = resolve_url_to_file(config_path)

# Create the node
exe = Executable(workflow.cp, 'pygrb_pp_workflow',
ifos=workflow.ifos, out_dir=dax_output,
Expand Down
Loading