i have several 16bit binary files, that i need to convert into 32bit binary files in python.
i have tried the following:
data16 = np.fromfile(data_dir+fn, dtype=np.uint16)
print("16bit " + str(data16))
convert = np.array(data16 * 256)
print("32bit " + str(convert) + "\n")
Im new to dealing with datafiles and bytes etc. but from what i have read in the past few hours, this should work, shouldnt it?
based on the output that i have read, it seems to work in some parts but not in others... quite confusing..
Here is the output:
16bit [41238 273 257 ... 65456 65472 65482]
32bit [ 5632 4352 256 ... 45056 49152 51712]
16bit [41238 273 769 ... 4 1 65521]
32bit [ 5632 4352 256 ... 1024 256 61696]
16bit [41238 273 513 ... 52 75 67]
32bit [ 5632 4352 256 ... 13312 19200 17152]
Here a portion of the bits (files are huge, pycharm only prints some out). In the last row the last 3 bits are correctly converted but not all of the bits, why is that?