Commit 08306d14 authored by Philipp Arras's avatar Philipp Arras
Browse files

Make adjust_variances compatible with larger MultiFields

parent 04894834
...@@ -66,10 +66,10 @@ def make_adjust_variances(a, ...@@ -66,10 +66,10 @@ def make_adjust_variances(a,
if n > 0: if n > 0:
d_eval = 0. d_eval = 0.
for i in range(n): for i in range(n):
d_eval = d_eval + d(position + samples[i]) d_eval = d_eval + d.force(position + samples[i])
d_eval = d_eval/n d_eval = d_eval/n
else: else:
d_eval = d(position) d_eval = d.force(position)
x = (a.conjugate()*a).real x = (a.conjugate()*a).real
if scaling is not None: if scaling is not None:
...@@ -83,14 +83,14 @@ def do_adjust_variances(position, ...@@ -83,14 +83,14 @@ def do_adjust_variances(position,
minimizer, minimizer,
xi_key='xi', xi_key='xi',
samples=[]): samples=[]):
h_space = position[xi_key].domain[0] h_space = position[xi_key].domain[0]
pd = PowerDistributor(h_space, amplitude_model.target[0]) pd = PowerDistributor(h_space, amplitude_model.target[0])
a = pd(amplitude_model) a = pd(amplitude_model)
xi = FieldAdapter(h_space, xi_key) xi = FieldAdapter(h_space, xi_key)
axi_domain = MultiDomain.union([a.domain, xi.domain]) axi_domain = MultiDomain.union([a.domain, xi.domain])
ham = make_adjust_variances( ham = make_adjust_variances(a, xi, position, samples=samples)
a, xi, position.extract(axi_domain), samples=samples)
a_pos = position.extract(a.domain) a_pos = position.extract(a.domain)
# Minimize # Minimize
......
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