Commit 4fe143dd authored by Philipp Haim's avatar Philipp Haim

Working for arbitrary constelation of DomainTuple

parent eacba248
Pipeline #63621 failed with stages
in 4 minutes and 44 seconds
...@@ -231,21 +231,18 @@ class CorrelatedFieldMaker: ...@@ -231,21 +231,18 @@ class CorrelatedFieldMaker:
twolog = _TwoLogIntegrations(target, space) twolog = _TwoLogIntegrations(target, space)
dt = twolog._logvol dt = twolog._logvol
axis = target.axes[space][0] axis = target.axes[space][0]
sl = (slice(None),)*axis first = (slice(None),)*axis + (0,)
extender_sl = (None,)*axis + (slice(None),) + (None,)*(target.axes[-1][-1] - axis) extender_sl = (None,)*axis + (slice(None),) + (None,)*(target.axes[-1][-1] - axis)
first = sl + (0,)
second = sl + (1,)
expander = ContractionOperator(twolog.domain, spaces = space).adjoint expander = ContractionOperator(twolog.domain, spaces = space).adjoint
sqrt_t = np.zeros(twolog.domain[space].shape) sqrt_t = np.zeros(twolog.domain[space].shape)
#sqrt_t[first] = sqrt_t[second] = np.sqrt(dt)
sqrt_t[0] = sqrt_t[1] = np.sqrt(dt) sqrt_t[0] = sqrt_t[1] = np.sqrt(dt)
sqrt_t = from_global_data(twolog.domain[space], sqrt_t) sqrt_t = from_global_data(twolog.domain[space], sqrt_t)
sqrt_t = DiagonalOperator(sqrt_t, twolog.domain, spaces = space) sqrt_t = DiagonalOperator(sqrt_t, twolog.domain, spaces = space)
sigmasq = sqrt_t @ expander @ flexibility sigmasq = sqrt_t @ expander @ flexibility
dist = np.zeros(twolog.domain[space].shape) dist = np.zeros(twolog.domain[space].shape)
dist[first] += 1. dist[0] += 1.
dist = from_global_data(twolog.domain[space], dist) dist = from_global_data(twolog.domain[space], dist)
dist = DiagonalOperator(dist, twolog.domain, spaces = space) dist = DiagonalOperator(dist, twolog.domain, spaces = space)
...@@ -258,8 +255,9 @@ class CorrelatedFieldMaker: ...@@ -258,8 +255,9 @@ class CorrelatedFieldMaker:
smoothslope = _make_slope_Operator(smooth,loglogavgslope, space) smoothslope = _make_slope_Operator(smooth,loglogavgslope, space)
# move to tests # move to tests
#assert_allclose( assert_allclose(
# smooth(from_random('normal', smooth.domain)).val[0:2], 0) smooth(from_random('normal', smooth.domain)).val[(
slice(None),)*axis + (slice(0,2),)], 0)
consistency_check(twolog) consistency_check(twolog)
check_jacobian_consistency(smooth, from_random('normal', check_jacobian_consistency(smooth, from_random('normal',
smooth.domain)) smooth.domain))
...@@ -275,7 +273,7 @@ class CorrelatedFieldMaker: ...@@ -275,7 +273,7 @@ class CorrelatedFieldMaker:
expander = DiagonalOperator(from_global_data(target[space], arr) expander = DiagonalOperator(from_global_data(target[space], arr)
, target, spaces = space) @ expander , target, spaces = space) @ expander
mask = np.zeros(target.shape) mask = np.zeros(target.shape)
mask[0] = vol mask[first] = vol
adder = Adder(from_global_data(target, mask)) adder = Adder(from_global_data(target, mask))
ampl = adder @ ((expander @ fluctuations)*normal_ampl) ampl = adder @ ((expander @ fluctuations)*normal_ampl)
......
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