diff --git a/gstlal-inspiral/python/stats/inspiral_extrinsics.py b/gstlal-inspiral/python/stats/inspiral_extrinsics.py index a5feaa2a2a52cf462d901e75d724e2299ce80403..74b8568498cad17c9e06a1a5f6630ca0d264f213 100644 --- a/gstlal-inspiral/python/stats/inspiral_extrinsics.py +++ b/gstlal-inspiral/python/stats/inspiral_extrinsics.py @@ -1270,7 +1270,7 @@ class TimePhaseSNR(object): self.tree_data = tree_data self.margsky = margsky - if self.tree_data is None: + if self.tree_data is None or numpy.shape(self.tree_data)[1] != 1 + max(sum(self.slices.values(),[])): time, phase, deff = TimePhaseSNR.tile(verbose = verbose) self.tree_data = self.dtdphideffpoints(time, phase, deff, self.slices) @@ -1333,13 +1333,24 @@ class TimePhaseSNR(object): Initialize one of these from a file instead of computing it from scratch """ f = h5py.File(fname, "r") - # These *have* to be here - transtt = dict((frozenset(k.split(",")), numpy.array(f["transtt"][k])) for k in f["transtt"]) - transtp = dict((frozenset(k.split(",")), numpy.array(f["transtp"][k])) for k in f["transtp"]) - transpt = dict((frozenset(k.split(",")), numpy.array(f["transpt"][k])) for k in f["transpt"]) - transpp = dict((frozenset(k.split(",")), numpy.array(f["transpp"][k])) for k in f["transpp"]) - transdd = dict((frozenset(k.split(",")), numpy.array(f["transdd"][k])) for k in f["transdd"]) - norm = dict((frozenset(k.split(",")), numpy.array(f["norm"][k])) for k in f["norm"]) + if os.path.join(gstlal_config_paths["pkgdatadir"], "covmat.h5") in other_fnames: + # These *have* to be here + f_covmat = h5py.File(os.path.join(gstlal_config_paths["pkgdatadir"], "covmat.h5")) + other_fnames.remove(os.path.join(gstlal_config_paths["pkgdatadir"], "covmat.h5")) + transtt = dict((frozenset(k.split(",")), numpy.array(f_covmat["transtt"][k])) for k in f_covmat["transtt"]) + transtp = dict((frozenset(k.split(",")), numpy.array(f_covmat["transtp"][k])) for k in f_covmat["transtp"]) + transpt = dict((frozenset(k.split(",")), numpy.array(f_covmat["transpt"][k])) for k in f_covmat["transpt"]) + transpp = dict((frozenset(k.split(",")), numpy.array(f_covmat["transpp"][k])) for k in f_covmat["transpp"]) + transdd = dict((frozenset(k.split(",")), numpy.array(f_covmat["transdd"][k])) for k in f_covmat["transdd"]) + norm = dict((frozenset(k.split(",")), numpy.array(f_covmat["norm"][k])) for k in f_covmat["norm"]) + else: + # These *have* to be here + transtt = dict((frozenset(k.split(",")), numpy.array(f["transtt"][k])) for k in f["transtt"]) + transtp = dict((frozenset(k.split(",")), numpy.array(f["transtp"][k])) for k in f["transtp"]) + transpt = dict((frozenset(k.split(",")), numpy.array(f["transpt"][k])) for k in f["transpt"]) + transpp = dict((frozenset(k.split(",")), numpy.array(f["transpp"][k])) for k in f["transpp"]) + transdd = dict((frozenset(k.split(",")), numpy.array(f["transdd"][k])) for k in f["transdd"]) + norm = dict((frozenset(k.split(",")), numpy.array(f["norm"][k])) for k in f["norm"]) try: dgrp = f["gstlal_extparams"]