Commit 919e2439 authored by Philipp Haim's avatar Philipp Haim

Simplified average_fluctuation_realized

parent de31a28f
Pipeline #65327 passed with stages
in 16 minutes and 8 seconds
...@@ -633,16 +633,15 @@ class CorrelatedFieldMaker: ...@@ -633,16 +633,15 @@ class CorrelatedFieldMaker:
space = space + spaces[0] space = space + spaces[0]
sub_spaces = set(spaces) sub_spaces = set(spaces)
sub_spaces.remove(space) sub_spaces.remove(space)
#Domain containing domain[space] and domain[0] iff total_N>0
sub_dom = makeDomain([samples[0].domain[ind] sub_dom = makeDomain([samples[0].domain[ind]
for ind in set([0,]) | set([space,])]) for ind in (set([0,])-set(spaces))|set([space,])])
co = ContractionOperator(sub_dom, len(sub_dom)-1) co = ContractionOperator(sub_dom, len(sub_dom)-1)
size = co.domain.size/co.target.size
res = 0. res = 0.
for s in samples: for s in samples:
r = s.mean(sub_spaces) r = s.mean(sub_spaces)
if min(spaces) == 0: res = res + (r - co.adjoint(co(r)/size))**2
res = res + (r - r.mean(spaces[:-1]))**2
else:
res = res + (r - co.adjoint(r.mean(spaces[:-1])))**2
res = res.mean(spaces[0])/len(samples) res = res.mean(spaces[0])/len(samples)
if np.isscalar(res): if np.isscalar(res):
return np.sqrt(res) return np.sqrt(res)
......
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