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

Speed up energy gradient tests

parent 82969f52
Pipeline #75148 passed with stages
in 13 minutes and 14 seconds
...@@ -15,32 +15,28 @@ ...@@ -15,32 +15,28 @@
# #
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik. # NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
from itertools import product
import numpy as np import numpy as np
import pytest import pytest
import nifty6 as ift import nifty6 as ift
from itertools import product
from .common import setup_function, teardown_function from .common import setup_function, teardown_function
# Currently it is not possible to parametrize fixtures. But this will # Currently it is not possible to parametrize fixtures. But this will
# hopefully be fixed in the future. # hopefully be fixed in the future.
# https://docs.pytest.org/en/latest/proposals/parametrize_with_fixtures.html # https://docs.pytest.org/en/latest/proposals/parametrize_with_fixtures.html
SPACES = [ift.GLSpace(15), spaces = [ift.GLSpace(15),
ift.RGSpace(64, distances=.789), ift.MultiDomain.make({'': ift.RGSpace(64, distances=.789)}),
ift.RGSpace([32, 32], distances=.789)] (ift.RGSpace(4, distances=.789), ift.UnstructuredDomain(3))]
for sp in SPACES[:3]:
SPACES.append(ift.MultiDomain.make({'asdf': sp}))
SEEDS = [4, 78, 23]
PARAMS = product(SEEDS, SPACES)
pmp = pytest.mark.parametrize pmp = pytest.mark.parametrize
@pytest.fixture(params=PARAMS) @pytest.fixture(params=[spaces])
def field(request): def field(request):
with ift.random.Context(request.param[0]): return ift.from_random('normal', request.param[0])
S = ift.ScalingOperator(request.param[1], 1.)
return S.draw_sample_with_dtype(dtype=np.float64)
def test_gaussian(field): def test_gaussian(field):
......
Markdown is supported
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