Skip to main content

Python client for the HighFinesse WS/6-200 wavemeter (wlmData wrapper).

Project description

ws6-200-wvm

Python client for the HighFinesse WS/6-200 wavemeter (and other WS/6 variants that share the same wlmData library).

The HighFinesse stack is a shared-memory client/server: the vendor's wlm_ws6 application owns the USB device and publishes measurements into shared memory; this package loads wlmData.dll (Windows) or libwlmData.so (Linux) via ctypes and reads from that shared memory. Reads are microsecond-scale memory operations.

Constraints:

  • The vendor library is x86_64 only — this package will not work on a Raspberry Pi / ARM host. Run on a Windows or Linux x86_64 PC attached to the wavemeter over USB.
  • The vendor server (wlm_ws6.exe) must be running locally. On Windows, this package can autostart it for you (default).

Install

pip install ws6-200-wvm

or with uv:

uv add ws6-200-wvm

Prerequisites

  1. HighFinesse "Wavelength Meter" application installed from the USB stick that shipped with your WS6. The installer is calibration-keyed to your unit's serial, so use the one for your device. It places wlmData.dll under C:\Windows\System32\ and wlm_ws6.exe somewhere on PATH.

    Linux equivalent: request the Linux bundle from HighFinesse support; it installs libwlmData.so and a wlm_ws6 daemon binary.

  2. USB connection from the host to the WS6, and the wavemeter powered on. First time, run the vendor "Wavelength Meter" GUI to confirm it sees the device.

If you are integrating this package into a larger application and need to write an adapter, see docs/wrapping.md.

Quickstart

from ws6200_wvm import Ws6200

with Ws6200(channel=1) as wm:
    print(wm.idn)
    print(wm.measure_frequency_thz(), "THz")
    print(wm.measure_wavelength_nm(), "nm")

Or without the context manager:

wm = Ws6200(channel=1)
wm.connect()
try:
    freq_thz = wm.measure_frequency_thz()
finally:
    wm.disconnect()

Configuration

Ws6200Config is a pydantic model that you can populate from YAML / JSON / env vars and call .make() on to get a driver:

from ws6200_wvm import Ws6200Config

cfg = Ws6200Config(channel=1, autostart_server=True, start_timeout_s=10.0)
wm = cfg.make()

Fields:

field default meaning
channel 1 1-indexed switcher channel.
dll_path None Override path to wlmData.dll / libwlmData.so. Auto-detected if unset.
autostart_server True On Windows, launch wlm_ws6.exe via ControlWLMEx if not running.
start_timeout_s 10.0 Seconds to wait for wlm_ws6 to come up.

CLI

A console script ws6200-wvm is installed for first-install smoke tests:

ws6200-wvm measure                       # one reading, then exit
ws6200-wvm measure --watch --interval 0.5
ws6200-wvm measure --channel 2 --dll-path "C:\path\to\wlmData.dll"

Errors

Library / setup problems raise RuntimeError:

  • "could not load HighFinesse wlmData library …" — install the vendor software, or pass dll_path=... to point at it.
  • "HighFinesse wlm server is not running …" — start wlm_ws6.exe manually, or pass autostart_server=True on Windows.

Wavemeter-reported measurement errors raise WavemeterError with a label from wlmData.h:

label meaning
noval No measurement available yet
nosig No input signal
badsig Signal present but uncomputable
under Underexposed
over Overexposed
nowlm No wavemeter server running
outofrange Outside calibrated range
noresponse
div0
outofresolution

NotConnectedError (subclass of WavemeterError) is raised if you call a measure_* method before connect().

Calibration

HighFinesse units use an internal reference but the factory absolute calibration drifts over time. Check the recommendation that came with your unit (typically 12–24 months) and send it back in cycle to keep the 200 MHz absolute spec.

Releasing

This section is for maintainers publishing to PyPI.

One-time setup

Create a PyPI account and a per-project API token at https://pypi.org/manage/account/token/, then add it to ~/.pypirc:

[pypi]
username = __token__
password = pypi-<your-token-here>

[testpypi]
repository = https://test.pypi.org/legacy/
username = __token__
password = pypi-<your-testpypi-token-here>

twine is already in the dev extra, so uv sync --extra dev is all the local install you need.

Publishing the first version (0.1.0)

rm -rf dist/
uv build
uv run twine check dist/*
uv run twine upload dist/*

A dry-run against TestPyPI is recommended before the first real publish:

uv run twine upload --repository testpypi dist/*
pip install --index-url https://test.pypi.org/simple/ ws6-200-wvm

Publishing a new version

PyPI versions are immutable — once 0.1.0 is uploaded you cannot replace it (you can only "yank" it, which hides it from new installs but keeps it resolvable for anyone already pinned). To publish a fix or change, bump the version first.

  1. Bump both version strings in lockstep:
  2. Commit and tag:
    git commit -am "release X.Y.Z"
    git tag vX.Y.Z
    
  3. Rebuild from a clean dist/ (otherwise twine upload dist/* will try to re-upload the old version's files and fail):
    rm -rf dist/
    uv build
    uv run twine check dist/*
    uv run twine upload dist/*
    
  4. Push the tag: git push && git push --tags.

Versioning policy

While pre-1.0:

  • Minor bumps (0.1.x → 0.2.0) may break API. Downstream consumers should pin >=0.1,<0.2 (see docs/wrapping.md).
  • Patch bumps (0.1.0 → 0.1.1) must remain backwards-compatible.

After 1.0, follow standard semver.

Yanking a broken release

If a published version has a critical bug, yank it on PyPI:

uv run twine upload --skip-existing dist/*   # no-op, just for reference

The actual yank is a web-UI action: go to https://pypi.org/manage/project/ws6-200-wvm/releases/ → select the version → Options → Yank. Then bump the patch version and re-publish per the steps above. Anyone who already pinned the yanked version keeps working; new resolves skip it.

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

ws6_200_wvm-0.1.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

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

ws6_200_wvm-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file ws6_200_wvm-0.1.0.tar.gz.

File metadata

  • Download URL: ws6_200_wvm-0.1.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for ws6_200_wvm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 32e28c6a96b7a5c0493f52a50cb21ca758f951971e6a3620a9697efb27bdce6e
MD5 b656bd223f37adb5c09940b165e4e1f0
BLAKE2b-256 43a6835c3ca01331ce9cf7db5f9eb14e48b5757eb11707c404e251afdc19a1de

See more details on using hashes here.

File details

Details for the file ws6_200_wvm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ws6_200_wvm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for ws6_200_wvm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4619800a9cb405a6f3e7c7327652984af25cc5a13fe36f940a0188ac7eed7161
MD5 13ac32d4d5433509fd2a471e7cf63592
BLAKE2b-256 0b8e746076e571297cc2f2b0e96f99ca4cc1cde50abb0301135d7888d6a706b6

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