Skip to content

Commit

Permalink
Address error when no gating veto argument was given (#3513)
Browse files Browse the repository at this point in the history
* Address error when no gating veto argument was given

* Fix error when no gating veto argument is given

* add comment on default empty dict assignment

* shorten too long line

Co-authored-by: Thomas Dent <thomas.dent@usc.es>
  • Loading branch information
veronica-villa and tdent authored Oct 22, 2020
1 parent 27c8cd6 commit b270e6a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pycbc/io/hdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,8 +987,9 @@ def to_coinc_xml_object(self, file_name):
ligolw_utils.write_filename(outdoc, file_name)

class ReadByTemplate(object):
# default assignment to {} is OK for a variable used only in __init__
def __init__(self, filename, bank=None, segment_name=None, veto_files=None,
gating_veto_windows=None):
gating_veto_windows={}):
self.filename = filename
self.file = h5py.File(filename, 'r')
self.ifo = tuple(self.file.keys())[0]
Expand All @@ -1008,7 +1009,7 @@ def __init__(self, filename, bank=None, segment_name=None, veto_files=None,
veto_segs = veto.select_segments_by_definer(vfile, ifo=self.ifo,
segment_name=name)
self.segs = (self.segs - veto_segs).coalesce()
if gating_veto_windows is not None:
if self.ifo in gating_veto_windows:
gating_veto = gating_veto_windows[self.ifo].split(',')
gveto_before = float(gating_veto[0])
gveto_after = float(gating_veto[1])
Expand Down

0 comments on commit b270e6a

Please sign in to comment.