Skip to content

Commit

Permalink
test bugfix
Browse files Browse the repository at this point in the history
Signed-off-by: Anto Idicherian Lonappan <[email protected]>
  • Loading branch information
antolonappan committed Aug 31, 2023
1 parent b2b5957 commit 24f8603
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
39 changes: 38 additions & 1 deletion Notebooks/likelihood.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -27,6 +27,43 @@
"from marcia import Cosmology as cosmo "
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"l = Sampler('LCDM',['H0','Omega_m','r_d'],['CC','BAO-alam'],[70,0.3,147])"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Best-fit values: [ 68.14005706 0.31956576 147.24436055]\n",
"Max-Likelihood value (including prior likelihood):-7.455037717630277\n"
]
},
{
"data": {
"text/plain": [
"array([ 68.14005706, 0.31956576, 147.24436055])"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"l.MLE()"
]
},
{
"cell_type": "code",
"execution_count": 14,
Expand Down
6 changes: 3 additions & 3 deletions tests/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ def setUp(self):

def test_chisq(self):
chisq = self.lk.chisq([70,0.3,147.78])
assert np.allclose(round(chisq,3), 20.169)
assert np.allclose(round(chisq,3), 20.170710552057066)

def test_logLike(self):
loglike = self.lk.logLike([70,0.3,147.78])
assert np.allclose(round(loglike,4), -10.0845)
assert np.allclose(round(loglike,4), -10.085355276028533)

class TestSampler(unittest.TestCase):
def setUp(self):
self.sampler = Sampler('LCDM',['H0','Omega_m','r_d'],['CC','BAO-alam'],[70,0.3,147])

def TestMLE(self):
mle = self.sampler.MLE()
assert np.allclose(mle, [ 68.1401852 , 0.31956261, 147.24475664])
assert np.allclose(mle, [ 68.14005706,0.31956576,147.24436055])



0 comments on commit 24f8603

Please sign in to comment.