From 5a44aa64c71bf99208f00264595e4cebd676ae0e Mon Sep 17 00:00:00 2001 From: jopohl Date: Sun, 17 Apr 2016 16:59:51 +0200 Subject: [PATCH] Test method 2 --> convert float --- tests/HackRF.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/HackRF.py b/tests/HackRF.py index d0b273ad..d40959b8 100644 --- a/tests/HackRF.py +++ b/tests/HackRF.py @@ -53,6 +53,22 @@ class TestHackRF(unittest.TestCase): print(c) # x,y = np.frombuffer(buffer, dtype=[('x', np.float16), ('y', np.float16)]) + def test_fromstring2(self): + buffer = b'\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfd\xff\xfd\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfd\xfe\xfd\xfe\xff\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfd\xfe' + c = np.empty(len(buffer) // 2, dtype=np.complex64) + + # dtype = + unpacked = np.frombuffer(buffer, dtype="