blosc2.real#

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

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

Parameters:

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

Returns:

out – A lazy expression that can be evaluated.

Return type:

LazyExpr

References

np.real

Examples

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