Commit cbacf1b1 authored by Gordian Edenhofer's avatar Gordian Edenhofer
Browse files

Seed test_simple_without_asp_fluct

While at it, stop using numpy's deprecated `assert_` method.
parent fbc57654
......@@ -17,7 +17,7 @@
import numpy as np
import pytest
from numpy.testing import assert_, assert_allclose
from numpy.testing import assert_allclose
import nifty7 as ift
......@@ -114,8 +114,8 @@ def testAmplitudesInvariants(sspace, N):
em, estd = _stats(fa.slice_fluctuation(0), samples)
assert_allclose(m, em, rtol=0.5)
assert_([-2] == sspace)
assert_([-1] == fsspace)
assert[-2] == sspace
assert[-1] == fsspace
for ampl in fa.normalized_amplitudes:
ift.extra.check_operator(ampl, 0.1*ift.from_random(ampl.domain), ntries=10)
......@@ -160,22 +160,31 @@ def test_complicated_vs_simple(seed, domain):
inp = ift.from_random(scf.domain)
op1 = cfm.finalize()
assert_(scf.domain is op1.domain)
assert scf.domain is op1.domain
ift.extra.assert_allclose(scf(inp), op1(inp))
ift.extra.check_operator(scf, inp, ntries=10)
op1 = cfm.amplitude
op0 = scf.amplitude
assert_(op0.domain is op1.domain)
assert op0.domain is op1.domain
ift.extra.assert_allclose(op0.force(inp), op1.force(inp))
@pmp('asperity', [None, (_posrand(), _posrand())])
@pmp('flexibility', [None, (_posrand(), _posrand())])
def test_simple_without_asp_fluct(asperity, flexibility):
@pmp('seed', [42, 31])
@pmp('without', (('asperity', ), ('flexibility', ), ('flexibility', 'asperity')))
def test_simple_without_asp_fluct(seed, without):
with ift.random.Context(seed):
domain = ift.RGSpace((4, 4), (0.123, 0.4))
offset_mean = _rand()
offset_std = _posrand(), _posrand()
if "flexibility" in without:
flexibility = None
flexibility = _posrand(), _posrand()
if "asperity" in without:
asperity = None
asperity = _posrand(), _posrand()
fluctuations = _posrand(), _posrand()
loglogavgslope = _posrand(), _posrand()
prefix = 'foobar'
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