parser.add_argument('--veto-file') parser.add_argument('--veto-segment-name') parser.add_argument('--found-injection-file') #parser.add_argument('--coinc-triggers', nargs='+') #parser.add_argument('--coinc-threshold', type=float) parser.add_argument('--window', type=float) parser.add_argument('--output-file') parser.add_argument('--verbose', action='store_true') parser.add_argument('--inj-file') parser.add_argument('--inj-coinc-file') parser.add_argument('--ifar-thresh') parser.add_argument('--temp-bank') parser.add_argument('--just-inj', type=str, default='False') args = parser.parse_args() pycbc.init_logging(args.verbose) o = h5py.File(args.output_file, 'w') snrs = {} # NOTE : Use found injection file to restrict injection stats to windows # surrounding 'well found' coincident injection triggers .. # SINGLES #################################################################### logging.info('Handling Single Detector Triggers') with h5py.File(args.single_trigger_files, 'r') as hf, h5py.File(args.inj_file, 'r') as hf_inj, h5py.File( args.inj_coinc_file, 'r') as hf_injcoinc, h5py.File(args.temp_bank, 'r') as hf_t_bank: for ifo in hf:
#!/usr/bin/env python # Read a pycbc_multi_inspiral HDF5 trigger file and check that it contains # triggers compatible with mock GW170817-like injections # 2022 Andrew Williamson, Tito Dal Canton import sys import logging import h5py import numpy as np from pycbc import init_logging init_logging(True) gw170817_time = 1187008882 end_times = (np.arange(3) - 1) * 300 + gw170817_time pols = ['standard', 'left', 'right', 'left+right'] refs = { 'standard': np.array([38.8, 18.4, 39.4]), 'left': np.array([23.5, 17.0, 38.9]), 'right': np.array([38.1, 17.1, 24.3]), 'left+right': np.array([38.1, 17.1, 38.9]) } status = 0 for pol in pols: with h5py.File(pol + '.hdf', 'r') as f: snrs = [f['network/end_time_gc'][:], f['network/coherent_snr'][:]] # search for compatible trigs mask = np.logical_and( abs(end_times - snrs[0]) < 0.1, snrs[1] > 0.9 * refs[pol], snrs[1] < 1.1 * refs[pol]) n = mask.sum() result = 'PASS' if n == 3 else 'FAIL'
""" A minimal pycbc workflow example """ import argparse import pycbc import pycbc.workflow as wf import os pycbc.init_logging(True) parser = argparse.ArgumentParser(description=__doc__[1:]) parser.add_argument("--multilevel", action='store_true', default=False) wf.add_workflow_command_line_group(parser) wf.add_workflow_settings_cli(parser) args = parser.parse_args() input_file = wf.resolve_url_to_file("test_input.txt") input_file.add_pfn(os.path.abspath('./test_input.txt'), 'local') cont = wf.Workflow(args, 'cont') sub1 = wf.Workflow(args, 'sub1') sub1_1 = wf.Workflow(args, 'sub1_1') sub2 = wf.Workflow(args, 'sub2') exe1 = wf.Executable(cont.cp, 'exe1') SUBSUB = args.multilevel # Subworkflow 1: generate file that will be needed later # PATH1: generate that input in a sub-sub workflow if SUBSUB: # Subworkflow 1: sub-subworkflow