From 24ef67e3bfd41e226f33aef9c164dce69b7250ee Mon Sep 17 00:00:00 2001 From: Jacob Cardinal Tremblay Date: Thu, 26 Sep 2024 14:13:58 +0000 Subject: [PATCH 1/2] Added elif statement made by Kathrin Grunthal that is needed for Fe calculation and OS statistics. We changed her original elif-condition from: elif right.ndim == 2 and left_array is not None and left_array.ndim == 2:, to: elif left_array is not None and right.ndim == left_array.ndim and right.ndim<=2:. This was done in order to include the case where both right and left_array have dimension 1, but they are not the same. --- enterprise/signals/gp_signals.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/enterprise/signals/gp_signals.py b/enterprise/signals/gp_signals.py index 21ad177d..e503aa41 100644 --- a/enterprise/signals/gp_signals.py +++ b/enterprise/signals/gp_signals.py @@ -876,5 +876,13 @@ def solve(self, right, left_array=None, logdet=False): TNT = self.Nmat.solve(T, left_array=T) return TNT - np.tensordot(self.MNF(T), self.MNMMNF(T), (0, 0)) + elif left_array is not None and right.ndim == left_array.ndim and right.ndim<=2: + # needed for Fe calculation and OS statistics + T = right + L = left_array + + LNT = self.Nmat.solve(T, left_array=L) + + return LNT - np.tensordot(self.MNF(L), self.MNMMNF(T), (0, 0)) else: raise ValueError("Incorrect arguments given to MarginalizingNmat.solve.") From f8ee6df65db6a07d1a52d63f6933295bab35573d Mon Sep 17 00:00:00 2001 From: Jacob Cardinal Tremblay Date: Fri, 27 Sep 2024 09:41:46 +0000 Subject: [PATCH 2/2] Linted the code using Black. --- enterprise/signals/gp_signals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enterprise/signals/gp_signals.py b/enterprise/signals/gp_signals.py index e503aa41..e51c50e0 100644 --- a/enterprise/signals/gp_signals.py +++ b/enterprise/signals/gp_signals.py @@ -876,7 +876,7 @@ def solve(self, right, left_array=None, logdet=False): TNT = self.Nmat.solve(T, left_array=T) return TNT - np.tensordot(self.MNF(T), self.MNMMNF(T), (0, 0)) - elif left_array is not None and right.ndim == left_array.ndim and right.ndim<=2: + elif left_array is not None and right.ndim == left_array.ndim and right.ndim <= 2: # needed for Fe calculation and OS statistics T = right L = left_array