def test_gelman_rubin_raise_error(self): chains=setup_chains() for _ in range(len(chains) - 1): chains.pop(-1) with self.assertRaises(ValueError, msg='Must have multiple chains'): CS.gelman_rubin(chains=chains)
def test_gelman_rubin_with_pres(self): chains = setup_chains() pres = [] for _, chain in enumerate(chains): pres.append(dict(chain=chain, nsimu=chain.shape[0])) psrf = CS.gelman_rubin(chains=pres) self.standard_check(psrf)
def test_gelman_rubin(self): chains=setup_chains() capturedOutput = io.StringIO() # Create StringIO object sys.stdout = capturedOutput # and redirect stdout. psrf = CS.gelman_rubin(chains=chains, display=True) sys.stdout = sys.__stdout__ # Reset redirect. self.assertTrue(isinstance(capturedOutput.getvalue(), str), msg='Caputured string') self.standard_check(psrf)
def test_gelman_rubin_with_names(self): chains = setup_chains() psrf = CS.gelman_rubin(chains=chains, names=['a', 'b']) self.standard_check(psrf)