blosc2.imag#

blosc2.imag(ndarr: NDArray | NDField | C2Array | LazyExpr, /) LazyExpr#

Return the imaginary part of the complex array, element-wise.

Parameters:

ndarr (NDArray or NDField or C2Array or LazyExpr) – The input array.

Returns:

out – A lazy expression representing the imaginary part of the input array.

Return type:

LazyExpr

References

np.imag

Examples

>>> import numpy as np
>>> import blosc2
>>> complex_values = np.array([2+3j, -1+4j, 0-2j, 5+6j])
>>> ndarray = blosc2.asarray(complex_values)
>>> result_ = blosc2.imag(ndarray)
>>> result = result_[:]
>>> print("Original complex values:", complex_values)
Original complex values: [ 2.+3.j -1.+4.j  0.-2.j  5.+6.j]
>>> print("Imaginary parts:", result)
Imaginary parts: [ 3.  4. -2.  6.]