gstlal-inspiral  1.9.3
 All Classes Namespaces Files Functions
gstlal_inspiral_create_dt_dphi_snr_ratio_pdfs
1 #!/usr/bin/env python3
2 #
3 # Copyright (C) 2018 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 sys
20 from gstlal.stats import inspiral_extrinsics
21 import argparse
22 
23 parser = argparse.ArgumentParser(description = "create dt dphi snr pdfs")
24 parser.add_argument("--cov-mat-h5", help = "hdf5 file that contains the covariance matrix")
25 parser.add_argument("--start", metavar='N', type=int, help='The first index to marginalize')
26 parser.add_argument("--stop", metavar='N', type=int, help='The last index to marginalize')
27 parser.add_argument("--output", metavar='name', type=str, help='The output file name', default = "inspiral_dtdphi_pdf.h5")
28 options = parser.parse_args()
29 
30 if options.start is not None and options.stop is not None:
31  if options.start % inspiral_extrinsics.TimePhaseSNR.numchunks or options.stop % inspiral_extrinsics.TimePhaseSNR.numchunks:
32  raise ValueError("start and stop must be multiple of %d" % TimePhaseSNR.numchunks)
33  IE = inspiral_extrinsics.TimePhaseSNR.from_hdf5(fname = options.cov_mat_h5, verbose = True, margstart = options.start, margstop = options.stop)
34 else:
35  IE = inspiral_extrinsics.TimePhaseSNR.from_hdf5(fname = options.cov_mat_h5, verbose = True)
36 
37 IE.to_hdf5(options.output)