Skip to main content

A Python project to control a Vortran Stradus laser

Project description

Stradus SDK for Vortran lasers

Note: Python library for controlling Vortran Stradus lasers, maintained by Lawrence Berkeley National Laboratory.

Installation

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 .

Use

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()

Logging Configuration

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:

Basic Logging Setup

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 messages

Advanced Logging Configuration

import 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)

Log Levels

  • DEBUG: Detailed USB communication, retry attempts
  • INFO: Device discovery, connection status
  • WARNING: Parse errors, failed operations with retries
  • ERROR: Connection failures, USB communication errors

Configuration

USB Library Configuration (Windows only)

The library automatically finds libusb in this order:

  1. Custom path via VORTRAN_LIBUSB_PATH environment variable
  2. libusb package installed via pip (pip install libusb)
  3. Default relative paths in your project directory

Setting Custom Path

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.dll

Default Paths

If 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

Recommended Setup

For easiest setup, simply install the libusb package:

pip install libusb

Development

Running Tests

Install test dependencies:

uv pip install -e ".[test]"

Run tests:

pytest

Run tests with coverage:

pytest --cov=src/vortran_lbl --cov-report=term-missing

Contributing

If you want to contribute, please install and use pre-commit:

uv pip install pre-commit
pre-commit install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vortran_lbl-1.0.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vortran_lbl-1.0.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file vortran_lbl-1.0.0.tar.gz.

File metadata

  • Download URL: vortran_lbl-1.0.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for vortran_lbl-1.0.0.tar.gz
Algorithm Hash digest
SHA256 01d064729f2e8a00009a9b9890d27010bba9ab3a5a51b89ac5ddaf1b07f96aa1
MD5 30b368eae51f6f8ab9b1bae35f396192
BLAKE2b-256 98dab134f235d3756366836251697ae5e3aac8ef09b488ea93006a70bbccce60

See more details on using hashes here.

File details

Details for the file vortran_lbl-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: vortran_lbl-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for vortran_lbl-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d2d592436b83dd28156c5c0f3f9a381ebcf503cb2d13c4b6048f1291265aa1f
MD5 a604eb715702b53852db5cabc27d97d5
BLAKE2b-256 76cf686e993a5e947e51c37b55a6a2372d56f431ccf12ee75186b2b2a29289e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page