Commit b3ea2e41 authored by Philipp Arras's avatar Philipp Arras
Browse files

Update test

parent 771d979c
Pipeline #75628 canceled with stages
in 6 minutes and 49 seconds
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik. # NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
import pytest import pytest
from numpy.testing import assert_, assert_allclose from numpy.testing import assert_, assert_allclose, assert_raises
import nifty6 as ift import nifty6 as ift
...@@ -44,13 +44,17 @@ def test_kl(constants, point_estimates, mirror_samples, mf): ...@@ -44,13 +44,17 @@ def test_kl(constants, point_estimates, mirror_samples, mf):
mean0 = ift.from_random(h.domain, 'normal') mean0 = ift.from_random(h.domain, 'normal')
nsamps = 2 nsamps = 2
kl = ift.MetricGaussianKL(mean0, args = {'constants': constants,
h, 'point_estimates': point_estimates,
nsamps, 'mirror_samples': mirror_samples,
constants=constants, 'n_samples': nsamps,
point_estimates=point_estimates, 'mean': mean0,
mirror_samples=mirror_samples, 'hamiltonian': h}
napprox=0) if isinstance(mean0, ift.MultiField) and set(point_estimates) == set(mean0.keys()):
with assert_raises(RuntimeError):
ift.MetricGaussianKL(**args)
return
kl = ift.MetricGaussianKL(**args)
assert_(len(ic.history) > 0) assert_(len(ic.history) > 0)
assert_(len(ic.history) == len(ic.history.time_stamps)) assert_(len(ic.history) == len(ic.history.time_stamps))
assert_(len(ic.history) == len(ic.history.energy_values)) assert_(len(ic.history) == len(ic.history.energy_values))
...@@ -64,7 +68,8 @@ def test_kl(constants, point_estimates, mirror_samples, mf): ...@@ -64,7 +68,8 @@ def test_kl(constants, point_estimates, mirror_samples, mf):
h, h,
nsamps, nsamps,
mirror_samples=mirror_samples, mirror_samples=mirror_samples,
napprox=0, constants=constants,
point_estimates=point_estimates,
_local_samples=locsamp) _local_samples=locsamp)
# Test number of samples # Test number of samples
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment