psychopy.tools.typetools

Functions and classes related to variable type conversion

psychopy.tools.typetools.float_uint8(inarray)[source]

Converts arrays, lists, tuples and floats ranging -1:1 into an array of Uint8s ranging 0:255

>>> float_uint8(-1)
0
>>> float_uint8(0)
128
psychopy.tools.typetools.uint8_float(inarray)[source]

Converts arrays, lists, tuples and UINTs ranging 0:255 into an array of floats ranging -1:1

>>> uint8_float(0)
-1.0
>>> uint8_float(128)
0.0
psychopy.tools.typetools.float_uint16(inarray)[source]

Converts arrays, lists, tuples and floats ranging -1:1 into an array of Uint16s ranging 0:2^16

>>> float_uint16(-1)
0
>>> float_uint16(0)
32768

Back to top