bit_truncate_relative#

caput.util.truncate.bit_truncate_relative(val: numpy.ndarray[numpy.float32], prec: numpy.float32) numpy.ndarray[numpy.float32][source]#
caput.util.truncate.bit_truncate_relative(val: numpy.ndarray[numpy.float64], prec: numpy.float64) numpy.ndarray[numpy.float64]

Truncate using a relative tolerance.

N.B. non-contiguous arrays are supported in order to allow real and imaginary parts of numpy arrays to be truncated without making a copy.

Parameters:
valarray_like

The array of values to truncate the precision of. These values are modified in place.

precfloat

The fractional precision required.

Returns:
truncatedarray_like

The modified array. This shares the same underlying memory as the input.