Open dvnicolasdh opened 1 month ago
Reduced the code to: BGT60LTR11AIP_stripped.py using device.get_config_defaults() Seem to get the same error message (with some more trace):
Exception in thread Thread-1 (read_data):
Traceback (most recent call last):
File "C:\Users\dvnicolasdh\.pyenv\pyenv-win\versions\3.12.5\Lib\threading.py", line 1075, in _bootstrap_inner
self.run()
File "C:\Users\dvnicolasdh\.pyenv\pyenv-win\versions\3.12.5\Lib\threading.py", line 1012, in run
self._target(*self._args, **self._kwargs)
File "c:\dev\Download-Center\Python\VitalSigns\BGT60LTR11AIP_stripped.py", line 35, in read_data
frame_contents = device.get_next_frame()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dev\Download-Center\venv\Lib\site-packages\ifxradarsdk\ltr11\ltr11.py", line 235, in get_next_frame
frame_numpy = frame.contents.to_numpy()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dev\Download-Center\venv\Lib\site-packages\ifxradarsdk\common\base_types.py", line 163, in to_numpy
return np.array(arr_1d[::2] + 1j * arr_1d[1::2], order="C", dtype=np.complex64, copy="True").reshape(shape)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: strings are not allowed for 'copy' keyword. Use True/False/None instead.
where BGT60LTR11AIP_stripped.py:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright (c) 2024, <Mohammad Alaee>, university of luxembourg
# website: https://radarmimo.com/
# All rights reserved.
# Extract from: https://github.com/radarmimo/Download-Center/blob/main/Python/VitalSigns/BGT60LTR11AIP.py
import sys
import pprint
import threading
from ifxradarsdk import get_version
from ifxradarsdk.ltr11 import DeviceLtr11
from ifxradarsdk.ltr11.types import Ltr11Config
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
import time
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prt_index = 0 # 0 = 4000 Hz, 1 = 2000 Hz, 2 = 1000 Hz, 3 = 500 Hz
if prt_index == 0:
sample_rate = 4000
elif prt_index == 1:
sample_rate = 2000
elif prt_index == 2:
sample_rate = 1000
else:
sample_rate = 500
frame_counter = 0
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def read_data(device):
global frame_counter
while True:
# time.sleep(1)
frame_contents = device.get_next_frame()
for frame in frame_contents:
frame_counter+=1
if frame_counter % 100 == 0 :
print(f"{frame_counter=}")
def button_click():
print("Button clicked!")
app.quit()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if __name__ == "__main__":
app = QApplication([])
window = QMainWindow()
window.setWindowTitle("Simple App with Button")
window.setGeometry(100, 100, 300, 200)
button = QPushButton("Click Me", window)
button.setGeometry(100, 50, 100, 30)
button.clicked.connect(button_click)
window.show()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# connect to the device
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pp = pprint.PrettyPrinter()
with DeviceLtr11() as device:
config_defaults = device.get_config_defaults()
device.set_config(config_defaults)
print("Radar SDK Version: " + get_version())
sampling_frequency = device.get_sampling_frequency(prt_index)
print("sampling_frequency: ", sampling_frequency)
pp.pprint(device.get_config())
data_thread = threading.Thread(target=read_data, args=(device,))
data_thread.start()
sys.exit(app.exec_())
Hence, changing the SDK's line: File "C:\dev\Download-Center\venv\Lib\site-packages\ifxradarsdk\common\base_types.py", line 163, in to_numpy
return np.array(arr_1d[::2] + 1j * arr_1d[1::2], order="C", dtype=np.complex64, copy="True").reshape(shape)
to
return np.array(arr_1d[::2] + 1j * arr_1d[1::2], order="C", dtype=np.complex64, copy=True).reshape(shape)
resolves the issue to both:
With only a USB connected BGT60LTR11AIP (v3.1): with its firmware updated to 2.6.0,
hence with "ENABLE_NEULOG = False",
attempt at running BGT60LTR11AIP.py
encounters an exception on line 162: frame_contents = device.get_next_frame()
with error message "strings are not allowed for 'copy' keyword":
Tested on Windows 10 (10.0.19045 Build 19045), with Python 3.12.5 and:
Note: This BGT60LTR11AIP seems to work fine with "Radar Fusion GUI_3.5.4.202310241225" Note2: The same "Radar-Development-Kit/3.5.1.202310261055" seems to work fine with another device BGT60TR13C and another python code example: "Python Wrapper" from "Infineon/Tools/Radar-Development-Kit/3.5.1.202310261055/quickstart.html" (although needed to add "import numpy as np" at the beginning of this other example).