From 40fef12b2094ec53eb25d7e9370ef3f0e39074bd Mon Sep 17 00:00:00 2001 From: Andrew McCluskey Date: Tue, 25 Feb 2020 13:35:14 +0000 Subject: [PATCH] add test for prior when there is an unaccounted uncertainty --- uravu/tests/test_relationship.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/uravu/tests/test_relationship.py b/uravu/tests/test_relationship.py index d4238fd..0ac6fca 100644 --- a/uravu/tests/test_relationship.py +++ b/uravu/tests/test_relationship.py @@ -621,6 +621,36 @@ def test_prior(self): True, ) + def test_prior_b(self): + """ + Test prior function with unaccounted uncertainty. + """ + test_x = np.linspace(0, 99, 100) + test_y = np.linspace(1, 199, 100) + test_y_e = test_y * 0.1 + test_rel = Relationship(utils.straight_line, test_x, test_y, test_y_e, unaccounted_uncertainty=True) + test_rel.max_likelihood() + result_priors = test_rel.prior() + assert_equal(len(result_priors), 3) + assert_equal( + isinstance( + result_priors[0], scipy.stats._distn_infrastructure.rv_frozen + ), + True, + ) + assert_equal( + isinstance( + result_priors[1], scipy.stats._distn_infrastructure.rv_frozen + ), + True, + ) + assert_equal( + isinstance( + result_priors[2], scipy.stats._distn_infrastructure.rv_frozen + ), + True, + ) + def test_mcmc(self): """ Test mcmc function.