Open electrickery opened 6 months ago
Found that the newer python interpreter makes a list of some code where an int was expected. This can be fixed by this patch:
$ git diff src/specFunctions.py
diff --git a/src/specFunctions.py b/src/specFunctions.py
index 72c4cee..bf65557 100644
--- a/src/specFunctions.py
+++ b/src/specFunctions.py
@@ -124,8 +124,8 @@ def savitzky_golay(y, window_size, order, deriv=0, rate=1):
import numpy as np
from math import factorial
try:
- window_size = np.abs(np.int(window_size))
- order = np.abs(np.int(order))
+ window_size = np.abs(np.int32(window_size))
+ order = np.abs(np.int32(order))
except ValueError:
raise ValueError("window_size and order have to be of type int")
if window_size % 2 != 1 or window_size < 1:
@@ -139,8 +139,8 @@ def savitzky_golay(y, window_size, order, deriv=0, rate=1):
m = np.linalg.pinv(b).A[deriv] * rate**deriv * factorial(deriv)
# pad the signal at the extremes with
# values taken from the signal itself
- firstvals = y[0] - np.abs( y[1:half_window+1][::-1] - y[0] )
- lastvals = y[-1] + np.abs(y[-half_window-1:-1][::-1] - y[-1])
+ firstvals = y[0] - np.abs( y[1:half_window+1][::-1] - y[0])
+ lastvals = [y[-1] + np.abs(y[-half_window-1:-1][::-1][0] - y[-1])]
y = np.concatenate((firstvals, y, lastvals))
return np.convolve( m[::-1], y, mode='valid')
There are more issues with webcam configuration, but those could be remedied by using an external program, guvcview for linux. Guvcview can configure the webcam without claiming the video image. The command line below is start, but still results in some error.
guvcview --device /dev/video2 -z -x 800x480 -a none
After fixing the np.int issue (np.int deprecated in bookworm #15), I got this error:
Platform: MXLinux 23.1 (derived from Debian Bookworm)
python3-numpy version: 1:1.24.2-1