gstlal-inspiral  1.9.3
 All Classes Namespaces Files Functions
gstlal_inspiral_create_dt_dphi_snr_ratio_pdfs_dag
1 #!/usr/bin/env python3
2 #
3 # Copyright (C) 2018, 2019 Chad Hanna
4 #
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 2 of the License, or (at your
8 # option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13 # Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 
19 import os
20 from gstlal import dagparts
21 import argparse
22 
23 parser = argparse.ArgumentParser(description = 'generate a dt dphi covariance matrix and tree data to replace share/inspiral_dtdphi_pdf.h5')
24 parser.add_argument('--psd-xml', help = 'XML containing HLVK psd')
25 parser.add_argument('--H-snr', type = float, help = 'H characteristic SNR')
26 parser.add_argument('--L-snr', type = float, help = 'L characteristic SNR')
27 parser.add_argument('--V-snr', type = float, help = 'V characteristic SNR')
28 parser.add_argument('--K-snr', type = float, help = 'K characteristic SNR')
29 parser.add_argument('--m1', type = float, default = 1.4, help = 'primary component mass')
30 parser.add_argument('--m2', type = float, default = 1.4, help = 'secondary component mass')
31 parser.add_argument('--s1', type = float, default = 0., help = 'primary (z) spin')
32 parser.add_argument('--s2', type = float, default = 0., help = 'secondary (z) spin')
33 parser.add_argument('--flow', type = float, default = 10., help = 'Low frequency cut-off. Default 10 Hz')
34 parser.add_argument('--fhigh', type = float, default = 1024., help = 'High frequency cut-off. Default 1024 Hz')
35 args = parser.parse_args()
36 
37 if args.flow >= args.fhigh:
38  raise ValueError("flow cannot be greater than fhigh")
39 
40 try:
41  os.mkdir("logs")
42 except:
43  pass
44 dag = dagparts.DAG("dt_dphi")
45 
46 covJob = dagparts.DAGJob("gstlal_inspiral_compute_dtdphideff_cov_matrix", condor_commands = {"want_graceful_removal":"True", "kill_sig":"15", "accounting_group":"ligo.prod.o3.cbc.uber.gstlaloffline"})
47 margJob = dagparts.DAGJob("gstlal_inspiral_create_dt_dphi_snr_ratio_pdfs", condor_commands = {"request_memory":"7GB", "want_graceful_removal":"True", "kill_sig":"15", "accounting_group":"ligo.prod.o3.cbc.uber.gstlaloffline"})
48 addJob = dagparts.DAGJob("gstlal_inspiral_add_dt_dphi_snr_ratio_pdfs", condor_commands = {"request_memory":"4GB", "want_graceful_removal":"True", "kill_sig":"15", "accounting_group":"ligo.prod.o3.cbc.uber.gstlaloffline"})
49 
50 covnode = dagparts.DAGNode(covJob, dag, parent_nodes = [], opts = {"H-snr": args.H_snr, "L-snr": args.L_snr, "V-snr": args.V_snr, "K-snr": args.K_snr, "flow": args.flow, "fhigh": args.fhigh, "m1": args.m1, "m2": args.m2, "s1": args.s1, "s2": args.s2}, input_files = {"psd-xml": args.psd_xml}, output_files = {"output":"covmat.h5"})
51 
52 num = 1000
53 margnodes = []
54 # FIXME dont hardcode 3345408, it comes from number of tiles in TimePhaseSNR
55 for start in range(0, 3345408, num):
56  stop = start + num
57  margnodes.append(dagparts.DAGNode(margJob, dag, parent_nodes = [covnode], opts = {"start":str(start), "stop":str(stop)}, input_files = {"cov-mat": "covmat.h5"}, output_files = {"output":"%s/inspiral_dtdphi_pdf_%d_%d.h5" % (margJob.output_path, start, stop)}))
58 
59 addJob_input = ["covmat.h5"]
60 addJob_input.extend([n.output_files["output"] for n in margnodes])
61 addnode = dagparts.DAGNode(addJob, dag, parent_nodes = margnodes, input_files = {"": addJob_input})
62 
63 dag.write_sub_files()
64 dag.write_dag()
65 dag.write_script()
66 dag.write_cache()