diff --git a/heron/likelihood.py b/heron/likelihood.py index 9de6390..b540f03 100644 --- a/heron/likelihood.py +++ b/heron/likelihood.py @@ -25,7 +25,8 @@ class LikelihoodBase: class Likelihood(LikelihoodBase): def logdet(self, K): - return np.linalg.slogdet(K).logabsdet + (sign, logabsdet) = np.linalg.slogdet(K) + return logabsdet def inverse(self, A): return np.linalg.inv(A) diff --git a/tests/test_inference.py b/tests/test_inference.py index 130e7f0..0532545 100644 --- a/tests/test_inference.py +++ b/tests/test_inference.py @@ -70,7 +70,32 @@ def test_likelihood_no_norm(self): log_like = likelihood.log_likelihood(projected_waveform, norm=False) self.assertTrue(log_like <= 1e-5) - + + + def test_likelihood_no_norm(self): + data = self.injections['H1'] + + from gwpy.plot import Plot + + likelihood = TimeDomainLikelihood(data, psd=self.psd_model) + + test_waveform = self.waveform.time_domain(parameters={"distance": 1000*u.megaparsec, + "mass_ratio": 0.6, + "gpstime": 0, + "total_mass": 60 * u.solMass}, times=likelihood.times) + projected_waveform = test_waveform.project(AdvancedLIGOHanford(), + ra=0, dec=0, + gpstime=0, + phi_0=0, psi=0, + iota=0) + + f = Plot(data, projected_waveform) + f.savefig("projected_waveform.png") + + log_like = likelihood.log_likelihood(projected_waveform) + + self.assertTrue(log_like <= 1e-5) + class Test_Filter(unittest.TestCase): """Test that filters can be applied correctly to data."""