Converting Works

This commit is contained in:
jopohl
2016-04-17 21:03:15 +02:00
parent 97e7b8ff75
commit 4e3ca829ca
3 changed files with 5 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ class Device(metaclass=ABCMeta):
self.current_index = 0
while True:
try:
self.receive_buffer = np.zeros(int(buf_size), dtype=np.complex64)
self.receive_buffer = np.zeros(int(buf_size), dtype=np.complex64, order='C')
break
except (MemoryError, ValueError):
buf_size //= 2

View File

@@ -12,8 +12,8 @@ class HackRF(Device):
self.is_open = False
self.success = 0
self.__lut = np.empty(0xffff + 1, dtype=np.complex64)
self.little_endian = True
self.__lut = np.zeros(0xffff + 1, dtype=np.complex64)
self.little_endian = False
for i in range(0, 0xffff + 1):
if self.little_endian:
real = (float(np.int8(i & 0xff))) * (1.0 / 128.0)

View File

@@ -70,17 +70,15 @@ class TestHackRF(unittest.TestCase):
def test_hackrf_class(self):
hfc = HackRF(1e6, 433e6, 20, 10e6)
hfc = HackRF(1e6, 433.92e6, 20, 1e6)
hfc.open()
hfc.start_rx_mode()
time.sleep(5)
print(hfc.current_index)
print(hfc.received_data)
hfc.stop_rx_mode("Finished test")
hfc.received_data.tofile("/tmp/hackrf.complex")
print("Wrote Data")
hfc.stop_rx_mode("Finished test")
hfc.close()
def test_lookup(self):