Skip to content

Commit

Permalink
Fix location of logabsdet.
Browse files Browse the repository at this point in the history
  • Loading branch information
transientlunatic committed Aug 19, 2024
1 parent 9a07570 commit 7f20b36
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
3 changes: 2 additions & 1 deletion heron/likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
27 changes: 26 additions & 1 deletion tests/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit 7f20b36

Please sign in to comment.