pow2floor

sofia_redux.scan.utilities.utils.pow2floor(x)[source]

Returns the value floored to the closest 2^N integer.

Parameters:
xint or float or numpy.ndarray

The input value(s).

Returns:
resultint or numpy.ndarray (int)

Examples

>>> print(pow2floor(1023))
512
>>> print(pow2floor(1024))
1024
>>> print(pow2floor(1025))
1024