From c7f244856b70e70755c4c94a210769d08e070060 Mon Sep 17 00:00:00 2001
From: Ryan Magee <ryan.magee@ligo.org>
Date: Tue, 10 Aug 2021 20:52:11 -0400
Subject: [PATCH] Revert "dtdphi: fixed h5py scalar access"

This reverts commit 71baeb4fc8328ba11d2f516038217fd9e438e309.
---
 .../bin/gstlal_inspiral_compute_dtdphideff_cov_matrix |  2 +-
 gstlal-inspiral/python/stats/inspiral_extrinsics.py   | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/gstlal-inspiral/bin/gstlal_inspiral_compute_dtdphideff_cov_matrix b/gstlal-inspiral/bin/gstlal_inspiral_compute_dtdphideff_cov_matrix
index cfaccc8c86..10f837ba4e 100755
--- a/gstlal-inspiral/bin/gstlal_inspiral_compute_dtdphideff_cov_matrix
+++ b/gstlal-inspiral/bin/gstlal_inspiral_compute_dtdphideff_cov_matrix
@@ -95,7 +95,7 @@ f = h5py.File(args.output, "w")
 f.create_dataset("psd", shape = (1,), data=refpsd)
 h5_snr = f.create_group("SNR")
 for ifo, snr in rho.items():
-	h5_snr.create_dataset(ifo, data=float(snr))
+	h5_snr.create_dataset(ifo, data=numpy.array([snr]))
 h5_transtt = f.create_group("transtt")
 h5_transtp = f.create_group("transtp")
 h5_transpt = f.create_group("transpt")
diff --git a/gstlal-inspiral/python/stats/inspiral_extrinsics.py b/gstlal-inspiral/python/stats/inspiral_extrinsics.py
index 85b8b41652..6b33574639 100644
--- a/gstlal-inspiral/python/stats/inspiral_extrinsics.py
+++ b/gstlal-inspiral/python/stats/inspiral_extrinsics.py
@@ -1307,11 +1307,14 @@ class TimePhaseSNR(object):
 		h5_transdd = f.create_group("transdd")
 		h5_norm = f.create_group("norm")
 		h5_snr = f.create_group("SNR")
-		for group, mat in zip((h5_transtt, h5_transtp, h5_transpt, h5_transpp, h5_transdd, h5_norm, h5_snr), (self.transtt, self.transtp, self.transpt, self.transpp, self.transdd, self.norm, self.snr)):
+		for group, mat in zip((h5_transtt, h5_transtp, h5_transpt, h5_transpp, h5_transdd, h5_norm), (self.transtt, self.transtp, self.transpt, self.transpp, self.transdd, self.norm)):
 			for k,v in mat.items():
 				group.create_dataset(",".join(sorted(k)), data = float(v))
 
-		f.create_dataset("psd", data=self.psd_fname)
+		f.create_dataset("psd", (1,), data=self.psd_fname)
+		for ifo, v in self.snr.items():
+			h5_snr.create_dataset(",".join(sorted(ifo)), data=v)
+
 		f.close()
 
 	@classmethod
@@ -1327,9 +1330,9 @@ class TimePhaseSNR(object):
 		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"])
-		snr = dict((frozenset(k.split(",")), numpy.array(f["SNR"][k][()])) for k in f["SNR"])
+		snr = dict((frozenset(k.split(",")), numpy.array(f["SNR"][k][:])) for k in f["SNR"])
 
-		psd_fname = f["psd"][()]
+		psd_fname = f["psd"][0]
 
 		try:
 			dgrp = f["gstlal_extparams"]
-- 
GitLab