Skip to content

Error on Arch Linux: np.mat was removed in NumPy 2.0 in specFunctions.py #29

@JimKnopfIoT

Description

@JimKnopfIoT

When trying to run PySpectrometer2-USB-v1.0.py on Arch Linux, python-numpy 2.2.4-1, i'm getting this error:

./PySpectrometer2-USB-v1.0.py --device 2 --fps 15 [info] W, H, FPS 640.0 480.0 25.0 Loading calibration data... Loading of Calibration data failed (missing caldata.txt or corrupted data! Loading placeholder data... You MUST perform a Calibration to use this software!

Calculating second order polynomial...
2
3.125e-05 x + 0.4375 x + 380
Generating Wavelength Data!

Done! Note that calibration with only 3 wavelengths will not be accurate!
Traceback (most recent call last):
File "/home/user1/PySpectrometer2/src/./PySpectrometer2-USB-v1.0.py", line 263, in
intensity = savitzky_golay(intensity,17,savpoly)
File "/home/user1/PySpectrometer2/src/specFunctions.py", line 138, in savitzky_golay
b = np.mat([[k**i for i in order_range] for k in range(-half_window, half_window+1)])
^^^^^^
File "/usr/lib/python3.13/site-packages/numpy/init.py", line 400, in getattr
raise AttributeError(
...<3 lines>...
)
AttributeError: np.mat was removed in the NumPy 2.0 release. Use np.asmatrix instead.

Swapping np.map with np.matrix leads to other errors.
Any hotfix for that problem available? Running PySpectrometer2-Picam2-v1.0.py on a RPi4 via VNC is quite slow. So would prefer running it on my Laptop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions