def test_mcmc(): x0 = generic_params bounds = generic_bounds f = np.linspace(0, 288, 100) model = asy_peakbag.asymp_spec_model(f, 2) snr = np.ones(len(f)) prior = asy_peakbag.Prior(generic_bounds, generic_gaussian) mcmc = asy_peakbag.mcmc(f, snr, model, x0, prior)
def test_prior_call(): prior = asy_peakbag.Prior(generic_bounds, generic_gaussian) lp_bound = prior.pbound(generic_params) assert lp_bound == 0 lp_gauss = prior.pgaussian(generic_params) assert lp_gauss >= 0 p = generic_params lp = prior(generic_params) assert lp > 1e-3
def test_prior_bounds(): prior = asy_peakbag.Prior([(10, 5000), (1, 200), (-3, 2)], [(0, 0), (0, 0), (0, 0)]) lp = prior.pbound([120.0, 10.0, 1.0]) assert_almost_equal(lp, 0.0, 2) lp = prior.pbound([1.0, 10.0, 1.0]) assert_almost_equal(lp, -np.inf, 1) lp = prior.pbound([100.0, 1000.0, 1.0]) assert_almost_equal(lp, -np.inf, 1)
def test_mcmc_call(): x0 = generic_params bounds = generic_bounds f = np.linspace(0, 288, 100) model = asy_peakbag.asymp_spec_model(f, 2) snr = model(x0) prior = asy_peakbag.Prior(generic_bounds, generic_gaussian) mcmc = asy_peakbag.mcmc(f, snr, model, x0, prior) samples = mcmc(10, 20)
def test_prior(): prior = asy_peakbag.Prior([], [])