I want to read from a binary data file, in the old matlab version of my script this is done by
file=fread(data,'bit16');
which would be the equivalent thing in python ? i tried
with open file(data, "rb") as f:
d = np.fromfile(f, "<i2", count = 10000)
since the matlab documentation says that bitn is of the type signed integer with n bits
i tried different dtypes ( "<>i2", "int16") unfortunately this doesnt give me the rigth data.
You may try to use float16 data type associated with numpy.frombuffer that deals with the half precision floting point (bit16 in matlab). The type doc is here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With