diff --git a/gstlal-inspiral/python/stats/inspiral_extrinsics.py b/gstlal-inspiral/python/stats/inspiral_extrinsics.py index 74b8568498cad17c9e06a1a5f6630ca0d264f213..50fd106c063533a4a88be821574cb0420d7e097f 100644 --- a/gstlal-inspiral/python/stats/inspiral_extrinsics.py +++ b/gstlal-inspiral/python/stats/inspiral_extrinsics.py @@ -1187,7 +1187,7 @@ class TimePhaseSNR(object): locations = {"H1":lal.CachedDetectors[lal.LHO_4K_DETECTOR].location, "L1":lal.CachedDetectors[lal.LLO_4K_DETECTOR].location, "V1":lal.CachedDetectors[lal.VIRGO_DETECTOR].location, "K1":lal.CachedDetectors[lal.KAGRA_DETECTOR].location} numchunks = 20 - def __init__(self, transtt = None, transtp = None, transpt = None, transpp = None, transdd = None, norm = None, tree_data = None, margsky = None, verbose = False, margstart = 0, margstop = None): + def __init__(self, transtt = None, transtp = None, transpt = None, transpp = None, transdd = None, norm = None, tree_data = None, margsky = None, verbose = False, margstart = 0, margstop = None, SNR=None, psd_fname=None): """ Initialize a new class from scratch via explicit computation of the tree data and marginalized probability distributions or by providing @@ -1270,7 +1270,10 @@ class TimePhaseSNR(object): self.tree_data = tree_data self.margsky = margsky - if self.tree_data is None or numpy.shape(self.tree_data)[1] != 1 + max(sum(self.slices.values(),[])): + self.snr = SNR + self.psd_fname = psd_fname + + if self.tree_data is None: time, phase, deff = TimePhaseSNR.tile(verbose = verbose) self.tree_data = self.dtdphideffpoints(time, phase, deff, self.slices) @@ -1325,6 +1328,11 @@ class TimePhaseSNR(object): for k,v in mat.items(): group.create_dataset(",".join(sorted(k)), data = float(v)) + f.create_dataset("psd", data=self.psd_fname) + h5_snr = f.create_group("SNR") + for ifo in self.snr: + h5_snr.create_dataset(ifo, data=self.snr[ifo].value) + f.close() @staticmethod