Commit 41523232 authored by Philipp Arras's avatar Philipp Arras

Add .real and .imag to MultiField

parent 800d1e02
Pipeline #31392 failed with stages
in 4 minutes and 18 seconds
......@@ -52,6 +52,16 @@ class MultiField(object):
def dtype(self):
return {key: val.dtype for key, val in self._val.items()}
@property
def real(self):
"""MultiField : The real part of the multi field"""
return MultiField({key: field.real for key, field in self.items()})
@property
def imag(self):
"""MultiField : The imaginary part of the multi field"""
return MultiField({key: field.imag for key, field in self.items()})
@staticmethod
def from_random(random_type, domain, dtype=np.float64, **kwargs):
dtype = MultiField.build_dtype(dtype, domain)
......
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