Commit e4fbed2e authored by Gordian Edenhofer's avatar Gordian Edenhofer

Check consistency of cf w/o asperity, flexibility

parent cbacf1b1
Pipeline #77570 passed with stages
in 13 minutes and 32 seconds
...@@ -124,39 +124,51 @@ def testAmplitudesInvariants(sspace, N): ...@@ -124,39 +124,51 @@ def testAmplitudesInvariants(sspace, N):
@pmp('seed', [42, 31]) @pmp('seed', [42, 31])
@pmp('domain', spaces) @pmp('domain', spaces)
def test_complicated_vs_simple(seed, domain): @pmp('without', (('asperity', ), ('flexibility', ), ('flexibility', 'asperity')))
def test_complicated_vs_simple(seed, domain, without):
with ift.random.Context(seed): with ift.random.Context(seed):
offset_mean = _rand() offset_mean = _rand()
offset_std_mean = _posrand() offset_std = _posrand(), _posrand()
offset_std_std = _posrand() fluctuations = _posrand(), _posrand()
fluctuations_mean = _posrand() if "flexibility" in without:
fluctuations_stddev = _posrand() flexibility = None
flexibility_mean = _posrand() else:
flexibility_stddev = _posrand() flexibility = _posrand(), _posrand()
asperity_mean = _posrand() if "asperity" in without:
asperity_stddev = _posrand() asperity = None
loglogavgslope_mean = _posrand() else:
loglogavgslope_stddev = _posrand() asperity = _posrand(), _posrand()
loglogavgslope = _posrand(), _posrand()
prefix = 'foobar' prefix = 'foobar'
hspace = domain.get_default_codomain() hspace = domain.get_default_codomain()
scf = ift.SimpleCorrelatedField( scf_args = (
domain, domain,
offset_mean, (offset_std_mean, offset_std_std), offset_mean,
(fluctuations_mean, fluctuations_stddev), offset_std,
(flexibility_mean, flexibility_stddev), fluctuations,
(asperity_mean, asperity_stddev), flexibility,
(loglogavgslope_mean, loglogavgslope_stddev), asperity,
prefix=prefix, loglogavgslope
harmonic_partner=hspace) )
cfm = ift.CorrelatedFieldMaker.make(offset_mean, add_fluct_args = (
(offset_std_mean, offset_std_std), domain,
prefix) fluctuations,
cfm.add_fluctuations(domain, flexibility,
(fluctuations_mean, fluctuations_stddev), asperity,
(flexibility_mean, flexibility_stddev), loglogavgslope
(asperity_mean, asperity_stddev), )
(loglogavgslope_mean, loglogavgslope_stddev), cfm = ift.CorrelatedFieldMaker.make(offset_mean, offset_std, prefix)
prefix='', if asperity is not None and flexibility is None:
with pytest.raises(ValueError):
scf = ift.SimpleCorrelatedField(*scf_args, prefix=prefix,
harmonic_partner=hspace)
with pytest.raises(ValueError):
cfm.add_fluctuations(*add_fluct_args, prefix='',
harmonic_partner=hspace)
return
scf = ift.SimpleCorrelatedField(*scf_args, prefix=prefix,
harmonic_partner=hspace)
cfm.add_fluctuations(*add_fluct_args, prefix='',
harmonic_partner=hspace) harmonic_partner=hspace)
inp = ift.from_random(scf.domain) inp = ift.from_random(scf.domain)
op1 = cfm.finalize() op1 = cfm.finalize()
......
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