bit_truncate_weights#

caput.util.truncate.bit_truncate_weights(val: numpy.ndarray[numpy.float32], inv_var: numpy.ndarray[numpy.float32], fallback: numpy.float32) numpy.ndarray[numpy.float32][source]#
caput.util.truncate.bit_truncate_weights(val: numpy.ndarray[numpy.float64], inv_var: numpy.ndarray[numpy.float64], fallback: numpy.float64) numpy.ndarray[numpy.float64]

Truncate using a set of inverse variance weights.

Giving the error as an inverse variance is particularly useful for data analysis.

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.

inv_vararray_like

The acceptable precision expressed as an inverse variance.

fallbackarray_like

A relative precision to use for cases where the inv_var is zero.

Returns:
truncatedndarray

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