Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_autocorr_multi_works():
np.random.seed(42)
xs = np.random.randn(16384, 2)
# This throws exception unconditionally in buggy impl's
acls_multi = integrated_time(xs)
acls_single = np.array([integrated_time(xs[:, i])
for i in range(xs.shape[1])])
assert np.all(np.abs(acls_multi - acls_single) < 2)
def test_nd(seed=1234, ndim=3, N=150000):
x = get_chain(seed=seed, ndim=ndim, N=N)
tau = integrated_time(x)
assert np.all(np.abs(tau - 19.0) / 19. < 0.2)
def test_too_short(seed=1234, ndim=3, N=100):
x = get_chain(seed=seed, ndim=ndim, N=N)
with pytest.raises(AutocorrError):
integrated_time(x)
tau = integrated_time(x, quiet=True) # NOQA
def test_autocorr_multi_works():
np.random.seed(42)
xs = np.random.randn(16384, 2)
# This throws exception unconditionally in buggy impl's
acls_multi = integrated_time(xs)
acls_single = np.array([integrated_time(xs[:, i])
for i in range(xs.shape[1])])
assert np.all(np.abs(acls_multi - acls_single) < 2)