def make_coinc_info(workflow, singles, bank, coinc, out_dir, n_loudest=None, trig_id=None, file_substring=None, sort_order=None, sort_var=None, tags=None): tags = [] if tags is None else tags makedir(out_dir) name = 'page_coincinfo' files = FileList([]) node = PlotExecutable(workflow.cp, name, ifos=workflow.ifos, out_dir=out_dir, tags=tags).create_node() node.add_input_list_opt('--single-trigger-files', singles) node.add_input_opt('--statmap-file', coinc) node.add_input_opt('--bank-file', bank) if sort_order: node.add_opt('--sort-order', sort_order) if sort_var: node.add_opt('--sort-variable', sort_var) if n_loudest is not None: node.add_opt('--n-loudest', str(n_loudest)) if trig_id is not None: node.add_opt('--trigger-id', str(trig_id)) if file_substring is not None: node.add_opt('--statmap-file-subspace-name', file_substring) node.new_output_file_opt(workflow.analysis_time, '.html', '--output-file') workflow += node files += node.output_files return files
def make_coinc_info(workflow, singles, bank, coinc, num, out_dir, exclude=None, require=None, tags=None): tags = [] if tags is None else tags makedir(out_dir) name = 'page_coincinfo' secs = requirestr(workflow.cp.get_subsections(name), require) secs = excludestr(secs, exclude) files = FileList([]) node = PlotExecutable(workflow.cp, name, ifos=workflow.ifos, out_dir=out_dir, tags=tags).create_node() node.add_input_list_opt('--single-trigger-files', singles) node.add_input_opt('--statmap-file', coinc) node.add_input_opt('--bank-file', bank) node.add_opt('--n-loudest', str(num)) node.new_output_file_opt(workflow.analysis_time, '.html', '--output-file') workflow += node files += node.output_files return files
def make_coinc_info(workflow, singles, bank, coinc, num, out_dir, exclude=None, require=None, tags=None): tags = [] if tags is None else tags makedir(out_dir) name = 'page_coincinfo' secs = requirestr(workflow.cp.get_subsections(name), require) secs = excludestr(secs, exclude) files = FileList([]) node = PlotExecutable( workflow.cp, name, ifos=workflow.ifos, out_dir=out_dir, tags=tags).create_node() node.add_input_list_opt('--single-trigger-files', singles) node.add_input_opt('--statmap-file', coinc) node.add_input_opt('--bank-file', bank) node.add_opt('--n-loudest', str(num)) node.new_output_file_opt(workflow.analysis_time, '.html', '--output-file') workflow += node files += node.output_files return files
def make_coinc_info(workflow, singles, bank, coinc, num, out_dir, tags=None): tags = [] if tags is None else tags makedir(out_dir) name = "page_coincinfo" files = FileList([]) node = PlotExecutable(workflow.cp, name, ifos=workflow.ifos, out_dir=out_dir, tags=tags).create_node() node.add_input_list_opt("--single-trigger-files", singles) node.add_input_opt("--statmap-file", coinc) node.add_input_opt("--bank-file", bank) node.add_opt("--n-loudest", str(num)) node.new_output_file_opt(workflow.analysis_time, ".html", "--output-file") workflow += node files += node.output_files return files
def make_coinc_info(workflow, singles, bank, coinc, out_dir, n_loudest=None, trig_id=None, file_substring=None, tags=None): tags = [] if tags is None else tags makedir(out_dir) name = 'page_coincinfo' files = FileList([]) node = PlotExecutable(workflow.cp, name, ifos=workflow.ifos, out_dir=out_dir, tags=tags).create_node() node.add_input_list_opt('--single-trigger-files', singles) node.add_input_opt('--statmap-file', coinc) node.add_input_opt('--bank-file', bank) if n_loudest is not None: node.add_opt('--n-loudest', str(n_loudest)) if trig_id is not None: node.add_opt('--trigger-id', str(trig_id)) if file_substring is not None: node.add_opt('--statmap-file-subspace-name', file_substring) node.new_output_file_opt(workflow.analysis_time, '.html', '--output-file') workflow += node files += node.output_files return files
def make_inference_plot(workflow, input_file, output_dir, name, analysis_seg=None, tags=None, input_file_opt='input-file', output_file_extension='.png', add_to_workflow=False): """Boiler-plate function for creating a standard plotting job. Parameters ---------- workflow: pycbc.workflow.Workflow The core workflow instance we are populating input_file: (list of) pycbc.workflow.File The file used for the input. May provide either a single file or a list of files. output_dir: str The directory to store result plots. name: str The name in the [executables] section of the configuration file to use. analysis_segs: ligo.segments.Segment, optional The segment this job encompasses. If None then use the total analysis time from the workflow. tags: list, optional Tags to add to the inference executables. input_file_opt : str, optional The name of the input-file option used by the executable. Default is ``input-file``. output_file_extension : str, optional What file type to create. Default is ``.png``. add_to_workflow : bool, optional If True, the node will be added to the workflow before being returned. **This means that no options may be added to the node afterward.** Default is ``False``. Returns ------- pycbc.workflow.plotting.PlotExecutable The job node for creating the plot. """ # default values if tags is None: tags = [] if analysis_seg is None: analysis_seg = workflow.analysis_time # make the directory that will contain the output files makedir(output_dir) # Catch if a parameters option was specified: # we need to do this because PlotExecutable will automatically add any # option in the section to the node. However, we need to add the # appropriate escapes to the parameters option so pegasus will render it # properly (see _params_for_pegasus for details). parameters = None if workflow.cp.has_option(name, 'parameters'): parameters = workflow.cp.get(name, 'parameters') workflow.cp.remove_option(name, 'parameters') # make a node for plotting the posterior as a corner plot node = PlotExecutable(workflow.cp, name, ifos=workflow.ifos, out_dir=output_dir, tags=tags).create_node() # add back the parameters option if it was specified if parameters is not None: node.add_opt("--parameters", _params_for_pegasus(parameters)) # and put the opt back in the config file in memory workflow.cp.set(name, 'parameters', parameters) # add input and output options if isinstance(input_file, list): # list of input files are given, use input_list_opt node.add_input_list_opt("--{}".format(input_file_opt), input_file) else: # assume just a single file node.add_input_opt("--{}".format(input_file_opt), input_file) node.new_output_file_opt(analysis_seg, output_file_extension, "--output-file") # add node to workflow if add_to_workflow: workflow += node return node