Commit 053e259b authored by Theo Steininger's avatar Theo Steininger
Browse files

Added check if synthesized field should be real valued in Field.power_synthesize

parent 20edb351
Pipeline #16637 passed with stage
in 29 minutes and 9 seconds
......@@ -599,6 +599,9 @@ class Field(Loggable, Versionable, object):
if real_power:
result = result_list[0]
if not issubclass(result_val_list[0].dtype.type,
result = result.real
result = result_list[0] + 1j*result_list[1]
......@@ -613,9 +616,17 @@ class Field(Loggable, Versionable, object):
flipped_val = domain[space].hermitianize_inverter(
flipped_val = flipped_val.conjugate()
h = (val + flipped_val)/2.
a = val - h
# if no flips at all where performed `h` is a real field.
# if all spaces use the default implementation of doing nothing when
# applying no flips, one can you object comparison to infer this case.
if flipped_val is val:
h = flipped_val.real
a = 1j * flipped_val.imag
flipped_val = flipped_val.conjugate()
h = (val + flipped_val)/2.
a = val - h
# correct variance
if preserve_gaussian_variance:
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