NumpyTensor.real

property NumpyTensor.real

Real part of self.

Returns
realNumpyTensor

Real part of this element as a member of a NumpyTensorSpace with corresponding real data type.

Examples

Get the real part:

>>> space = odl.cn(3)
>>> x = space.element([1 + 1j, 2, 3 - 3j])
>>> x.real
rn(3).element([ 1.,  2.,  3.])

Set the real part:

>>> space = odl.cn(3)
>>> x = space.element([1 + 1j, 2, 3 - 3j])
>>> zero = odl.rn(3).zero()
>>> x.real = zero
>>> x
cn(3).element([ 0.+1.j,  0.+0.j,  0.-3.j])

Other array-like types and broadcasting:

>>> x.real = 1.0
>>> x
cn(3).element([ 1.+1.j,  1.+0.j,  1.-3.j])
>>> x.real = [2, 3, 4]
>>> x
cn(3).element([ 2.+1.j,  3.+0.j,  4.-3.j])