I have a binary file written as
16b-Real (little endian, 2s compliment)
16b-Imag (little endian, 2s compliment)
.....repeating
I need to convert it to a 1D array of complex numbers. Can't figure out how to combine the "tuples or lists" into a single value
import numpy as np
dtype = np.dtype([('i','<i2'), ('q','<i2')])
array = np.fromfile(data_file, dtype=dtype)
print(array)
el = array[0]
print(el)
print(type(el))
Output:
[(531, -660) (267, -801) (-36, -841) ... (835, -102) (750, -396)
(567, -628)]
(531, -660)
<class 'numpy.void'>
Hoping for output:
[531-660j, 267-801j,...]
complex(re, im)?