def test_NS_input_fails_in_MCMCSamples(): with pytest.raises(ValueError) as excinfo: MCMCSamples(root='./tests/example_data/pc') assert "Please use NestedSamples instead which has the same features as " \ "MCMCSamples and more. MCMCSamples should be used for MCMC " \ "chains only." in str(excinfo.value)
def test_read_cobayamcmc(): np.random.seed(3) mcmc = MCMCSamples(root='./tests/example_data/cb') mcmc.plot_2d(['x0', 'x1']) mcmc.plot_1d(['x0', 'x1']) plt.close("all")
def test_read_montepython(): np.random.seed(3) mcmc = MCMCSamples(root='./tests/example_data/mp') mcmc.plot_2d(['x0', 'x1', 'x2', 'x3']) mcmc.plot_1d(['x0', 'x1', 'x2', 'x3']) plt.close("all")
"plikHM_TTTEEE_lowl_lowE_lensing.tar.gz", "plikHM_TTTEEE_lowl_lowE_lensing_NS.tar.gz" ]: github_url = "https://github.com/williamjameshandley/cosmo_example/raw/master/" url = github_url + filename open(filename, 'wb').write(requests.get(url).content) tarfile.open(filename).extractall() #| ## Marginalised posterior plotting #| Import anesthetic and load the MCMC samples: import matplotlib.pyplot as plt from anesthetic import MCMCSamples, make_2d_axes mcmc_root = 'plikHM_TTTEEE_lowl_lowE_lensing/base_plikHM_TTTEEE_lowl_lowE_lensing' mcmc = MCMCSamples(root=mcmc_root) #| We have plotting tools for 1D plots ... fig, axes = mcmc.plot_1d('omegabh2') #| ... multiple 1D plots ... fig, axes = mcmc.plot_1d(['omegabh2', 'omegach2', 'H0', 'tau', 'logA', 'ns']) fig.tight_layout() #| ... triangle plots ... mcmc.plot_2d(['omegabh2', 'omegach2', 'H0'], types={ 'lower': 'kde',