Commit 0408c142 authored by Philipp Arras's avatar Philipp Arras
Browse files

correlated_fields_simple.py: Support fixed zero mode

parent 0eff4f8e
Pipeline #100964 passed with stages
in 12 minutes and 40 seconds
......@@ -62,6 +62,8 @@ def SimpleCorrelatedField(
for kk in [offset_std, fluctuations, loglogavgslope]:
if len(kk) != 2:
raise TypeError
if not (offset_std is None or len(offset_std) == 2):
raise TypeError
for kk in [flexibility, asperity]:
if not (kk is None or len(kk) == 2):
raise TypeError
......@@ -69,7 +71,6 @@ def SimpleCorrelatedField(
raise ValueError
fluct = LognormalTransform(*fluctuations, prefix + 'fluctuations', 0)
avgsl = NormalTransform(*loglogavgslope, prefix + 'loglogavgslope', 0)
zm = LognormalTransform(*offset_std, prefix + 'zeromode', 0)
pspace = PowerSpace(harmonic_partner)
twolog = _TwoLogIntegrations(pspace)
......@@ -107,8 +108,11 @@ def SimpleCorrelatedField(
maskzm = np.ones(pspace.shape)
maskzm[0] = 0
maskzm = makeOp(makeField(pspace, maskzm))
insert = ValueInserter(pspace, (0,))
a = (maskzm @ ((ps_expander @ fluct)*a)) + insert(zm)
a = (maskzm @ ((ps_expander @ fluct)*a))
if offset_std is not None:
zm = LognormalTransform(*offset_std, prefix + 'zeromode', 0)
insert = ValueInserter(pspace, (0,))
a = a + insert(zm)
a = a.scale(target.total_volume)
ht = HarmonicTransformOperator(harmonic_partner, target)
......
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