-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
I downloaded Rasbian's Trixie, installed and tried to run this project. Within the default Python environment:
sudo apt-get install python3-opencv
I clone this project and tried to run PySpectrometer2-Picam2-v1.0.py, but I ran into an incompatibility with the NumPy installed on the system.
jlpoole@spectro:/usr/local/src/PySpectrometer2/src $ python PySpectrometer2-Picam2-v1.0.py
[0:54:53.039411102] [3073] INFO Camera camera_manager.cpp:330 libcamera v0.5.2+99-bfd68f78
[0:54:53.067831324] [3076] INFO IPAProxy ipa_proxy.cpp:180 Using tuning file /usr/share/libcamera/ipa/rpi/vc4/imx477.json
[0:54:53.073905326] [3076] INFO Camera camera_manager.cpp:220 Adding camera '/base/soc/i2c0mux/i2c@1/imx477@1a' for pipeline handler rpi/vc4
[0:54:53.073969306] [3076] INFO RPI vc4.cpp:440 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media2 and ISP device /dev/media0
[0:54:53.074003380] [3076] INFO RPI pipeline_base.cpp:1107 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[0:54:53.081826170] [3073] INFO Camera camera.cpp:1215 configuring streams: (0) 800x600-RGB888/SMPTE170M/Rec709/None/Full (1) 2028x1520-SBGGR12_CSI2P/RAW
[0:54:53.082366773] [3076] INFO RPI vc4.cpp:615 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1520-SBGGR12_1X12/RAW - Selected unicam format: 2028x1520-pBCC/RAW
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 "/usr/local/src/PySpectrometer2/src/PySpectrometer2-Picam2-v1.0.py", line 261, in <module>
intensity = savitzky_golay(intensity,17,savpoly)
File "/usr/local/src/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/dist-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.
jlpoole@spectro:/usr/local/src/PySpectrometer2/src $
So I created my own Python environment that shares the system's modules, notably opencv, and then I downgraded to numpy:
python3 -m venv --system-site-packages ~/pyspec-venv
source ~/pyspec-venv/bin/activate
pip install --upgrade pip
pip install "numpy<2.0"
I also was able to work remotely through an SSH shell and have the PySectrometer2 appear on my workstation. In Trixie, ssh is de-activated by default. So:
sudo systemctl enable ssh
sudo systemctl start ssh
I logged into my Raspberry Pi4B with:
ssh -Y [username]@[server name]

Metadata
Metadata
Assignees
Labels
No labels