Commit 56077e8d authored by Theo Steininger's avatar Theo Steininger
Browse files

Merge branch 'real_power_synthesize' into 'master'

Real power synthesize

See merge request !187
parents f64c8f54 bcb2055f
Pipeline #16818 failed with stages
in 60 minutes and 4 seconds
...@@ -599,6 +599,9 @@ class Field(Loggable, Versionable, object): ...@@ -599,6 +599,9 @@ class Field(Loggable, Versionable, object):
if real_power: if real_power:
result = result_list[0] result = result_list[0]
if not issubclass(result_val_list[0].dtype.type,
np.complexfloating):
result = result.real
else: else:
result = result_list[0] + 1j*result_list[1] result = result_list[0] + 1j*result_list[1]
...@@ -613,6 +616,14 @@ class Field(Loggable, Versionable, object): ...@@ -613,6 +616,14 @@ class Field(Loggable, Versionable, object):
flipped_val = domain[space].hermitianize_inverter( flipped_val = domain[space].hermitianize_inverter(
x=flipped_val, x=flipped_val,
axes=domain_axes[space]) axes=domain_axes[space])
# if no flips at all where performed `h` is a real field.
# if all spaces use the default implementation of doing nothing when
# no flips are applied, one can use `is` to infer this case.
if flipped_val is val:
h = flipped_val.real
a = 1j * flipped_val.imag
else:
flipped_val = flipped_val.conjugate() flipped_val = flipped_val.conjugate()
h = (val + flipped_val)/2. h = (val + flipped_val)/2.
a = val - h a = val - h
......
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