StellarNet Python Library
Please first download this folder with the stellarNet python drivers. These files were obtained through private communication with StellarNet; they are not freely available online.
Examples
Examples of how to acquire and plot a spectrum.
TBD
MacMini Setup
Install Requirements
Let’s install pyusb and lsusb
Code Block | ||
---|---|---|
| ||
pip3 install pyusb
brew install libusb |
Install Python Drivers
First, unzip the stellarnet driver library. Second, go to the unzipped folder.
Then check what the Python version is
Code Block | ||
---|---|---|
| ||
conda activate
python --version |
The driver files for macOS are located in the stellarnet_driverLibs/
folder and have the .darwin.so
extension. Choose the correct file based on your Python version:
Python 3.7 →
stellarnet_driver3.cpython-37m-darwin.so
Python 3.8 →
stellarnet_driver3.cpython-38-darwin.so
Python 3.9 →
stellarnet_driver3.cpython-39-darwin.so
Python 3.10 →
stellarnet_driver3.cpython-310-darwin.so
Python 3.11 →
stellarnet_driver3.cpython-311-darwin.so
Python 3.12 →
stellarnet_driver3.cpython-312-darwin.so
If Python version is 3.12 for example,
Code Block | ||
---|---|---|
| ||
cd Python_StellarNet_Driver_2-6/
cp stellarnet_driverLibs/stellarnet_driver3.cpython-312-darwin.so stellarnet_driverLibs/stellarnet_driver3.so |
Make sure to add the driver as a trusted application of your system.
Code Block | ||
---|---|---|
| ||
sudo xattr -rd com.apple.quarantine stellarnet_driverLibs/stellarnet_driver3.cpython-312-darwin.so |
Permanently add the driver to your PYTHONPATH
Code Block | ||
---|---|---|
| ||
echo 'export PYTHONPATH=$PYTHONPATH:/Users/pandora_ctrl/Desktop/Python_StellarNet_Driver_2-6/stellarnet_driverLibs' >> ~/.zshrc
source ~/.zshrc |
Or add to the PYTHONPATH temporarily.
Code Block | ||
---|---|---|
| ||
export PYTHONPATH=$PYTHONPATH:/Users/pandora_ctrl/Desktop/Python_StellarNet_Driver_2-6/stellarnet_driverLibs |
Check if the installation is working.
Code Block | ||
---|---|---|
| ||
python3 -c "from stellarnet_driver3 import *" |
Run the demo python script to make sure your code is working properly.
Not setting up a python path
If you do not want to add the stellarnet path to your python you should add the python path before importing the module.
Code Block | ||
---|---|---|
| ||
import os
import sys
# Ensure the driver directory is in the Python path
driver_path = os.path.join(os.getcwd(), "stellarnet_driverLibs")
sys.path.append(driver_path)
# Import the driver
from stellarnet_driverLibs import stellarnet_driver3 as sn
# Test the driver version
print("StellarNet Driver Version:", sn.version()) |