Caution

You're reading the documentation for a development version. For the latest released version, please have a look at 0.9.1.

librosa.util.dtype_c2r

librosa.util.dtype_c2r(d, *, default=<class 'numpy.float32'>)[source]

Find the real numpy dtype corresponding to a complex dtype.

This is used to maintain numerical precision and memory footprint when constructing real arrays from complex-valued data (e.g. in an inverse Fourier transform).

A complex64 (single-precision) type maps to float32, while a complex128 (double-precision) maps to float64.

Parameters
dnp.dtype

The complex-valued dtype to convert to real. If d is a real (float) type already, it will be returned.

defaultnp.dtype, optional

The default real target type, if d does not match a known dtype

Returns
d_rnp.dtype

The real dtype

Examples

>>> librosa.util.dtype_r2c(np.complex64)
dtype('float32')
>>> librosa.util.dtype_r2c(np.float32)
dtype('float32')
>>> librosa.util.dtype_r2c(np.int16)
dtype('float32')
>>> librosa.util.dtype_r2c(np.complex128)
dtype('float64')