NumpyTensor.imag

property NumpyTensor.imag

Imaginary part of self.

Returns
imagNumpyTensor

Imaginary part this element as an element of a NumpyTensorSpace with real data type.

Examples

Get the imaginary part:

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

Set the imaginary part:

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

Other array-like types and broadcasting:

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