gstlal-inspiral  1.9.2
 All Classes Namespaces Files Functions
gstlal_inspiral_reset_zerolag_counts
1 #!/usr/bin/env python3
2 #
3 # Copyright (C) 2020 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 import far
21 from ligo import lw
22 from ligo.lw import utils as ligolw_utils
23 from ligo.lw.utils import process as ligolw_process
24 
25 fname = sys.argv[1]
26 
27 _, zlpdf = far.parse_likelihood_control_doc(ligolw_utils.load_url(fname, verbose = True, contenthandler = far.RankingStat.LIGOLWContentHandler))
28 
29 # Zero it out
30 zlpdf.zero_lag_lr_lnpdf.count.array[:] = 0.
31 
32 # write out the file to disk
33 xmldoc = lw.ligolw.Document()
34 xmldoc.appendChild(lw.ligolw.LIGO_LW())
35 process = ligolw_process.register_to_xmldoc(xmldoc, sys.argv[0], paramdict = {})
36 far.gen_likelihood_control_doc(xmldoc, None, zlpdf)
37 ligolw_process.set_process_end_time(process)
38 ligolw_utils.write_url(xmldoc, fname, verbose = True, trap_signals = None)