Note: Python library for controlling Vortran Stradus lasers, maintained by Lawrence Berkeley National Laboratory.
If you don't have python already on your system you can install it using uv.
Install the package from PyPI:
uv pip install vortran-lbl
You can also first clone this git repository and then install the package using uv directly from the cloned git repository:
uv pip install -e .
The code below shows how to use the package
import vortran_lbl as vortran
lasers = vortran.get_lasers()
laser = lasers[0]
is_open = laser.open_connection()
laser.enable_power_control_mode()
laser.power = 50
base_temp = laser.base_plate_temperature
laser.on()
time.sleep(1)
laser.off()The vortran_lbl library uses Python's standard logging module. By default, no log messages are shown. To see log output, configure logging in your application:
import logging
import vortran_lbl as vortran
# Show INFO level and above (device discovery, connections)
logging.basicConfig(level=logging.INFO)
# Or show DEBUG level for detailed USB communication
logging.basicConfig(level=logging.DEBUG)
lasers = vortran.get_lasers() # Will now show log messagesimport logging
import vortran_lbl as vortran
# Configure specific logger levels
logging.getLogger('vortran_lbl.usb').setLevel(logging.INFO) # USB device discovery
logging.getLogger('vortran_lbl.laser').setLevel(logging.DEBUG) # Laser operations
logging.getLogger('vortran_lbl.usb_connection').setLevel(logging.WARNING) # Only errors
# Custom formatter
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger = logging.getLogger('vortran_lbl')
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)- DEBUG: Detailed USB communication, retry attempts
- INFO: Device discovery, connection status
- WARNING: Parse errors, failed operations with retries
- ERROR: Connection failures, USB communication errors
The library automatically finds libusb in this order:
- Custom path via
VORTRAN_LIBUSB_PATHenvironment variable - libusb package installed via pip (
pip install libusb) - Default relative paths in your project directory
Linux/macOS (bash):
export VORTRAN_LIBUSB_PATH="/path/to/your/libusb-1.0.dll"Windows (PowerShell):
$env:VORTRAN_LIBUSB_PATH = "C:\path\to\your\libusb-1.0.dll"Windows (Command Prompt):
set VORTRAN_LIBUSB_PATH=C:\path\to\your\libusb-1.0.dllIf no custom path is set and libusb package is not installed, the library looks for:
- 32-bit:
USB/libusb/x86/libusb-1.0.dll - 64-bit:
USB/libusb/x64/libusb-1.0.dll
For easiest setup, simply install the libusb package:
pip install libusbInstall test dependencies:
uv pip install -e ".[test]"Run tests:
pytestRun tests with coverage:
pytest --cov=src/vortran_lbl --cov-report=term-missingIf you want to contribute, please install and use pre-commit:
uv pip install pre-commit
pre-commit install