DrX Lissajoux API
Project description
This library provides the python API for a DrX Works Lissajoux device.
Installation
Install the lastest python3 version.
Open command line interface (cmd) and type pip3 install --upgrade drx-lissajoux
Usage examples
Normal operation of the API
The example below demonstrates the normal use of this API library.
import logging
from drx_lissajoux.api import Lissajoux, cmd
# Set the debug level, normal operation: "INFO"
logging.basicConfig(level="DEBUG")
HOST = "192.168.1.100"
KEY_FILE = "./key_file.xml"
# constuct the API object
api = Lissajoux(host=HOST, key_file=KEY_FILE)
# retrieve all properties from the lissajoux and store in the cache, call this each time the properties need to be updated
api.get_state()
# Get some values from the cache and print them
print(f"Global interlock: {api.global_interlock}")
print(f"F1 power: {api.F1_power}")
print(f"Frequency: {api.F1_frequency}")
print(f"Cavity temperature: {api.Cavity_temperature}")
print(f"PSU 5V: {api.PSU_5_volt}")
# Set the frequency of the lissajoux to a new value
api.F1_frequency = 2418.0
# Close the connection
api.close()
Available properties
The example below will print all available properties of the Lissajoux that can be used with this library.
from drx_lissajoux.api import Lissajoux
HOST = "192.168.1.100"
KEY_FILE = "./key_file.xml"
api = Lissajoux(host=HOST, key_file=KEY_FILE)
print("\nAvailable properties:")
for prop in api.available_properties:
print(prop)
Sending custom commands to the Lissajoux
The example below demonstrates how to send custom commands to the Lissajoux. A full list of the available commands for the Lissajoux can be found in the API section in the manual supplied with the device.
from drx_lissajoux.api import Lissajoux, cmd
HOST = "192.168.1.100"
KEY_FILE = "./key_file.xml"
# constuct the API object
api = Lissajoux(host=HOST, key_file=KEY_FILE)
# send a single command to GET the frequency
cmd_freq = api.send_command(cmd("Frq"))
print(f"Frequency: {cmd_freq.value}")
# send a single command to SET the frequency
cmd_freq = api.send_command(cmd("Frq", "=", 2417.0))
print(f"Frequency: {cmd_freq.value}")
# send 5 commands in one message to GET all PSU voltages
response = api.send_command([cmd("V05"), cmd("V55"), cmd("V15"), cmd("Vm5"), cmd("V24")])
for val in response.values():
print(f"{val.cmd}: {val.value}")
# Close the connection
api.close()
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file drx_lissajoux-1.0.1.tar.gz.
File metadata
- Download URL: drx_lissajoux-1.0.1.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
632e9e085ba1b7bf5fb77f106b690207b34fbd81405996e9ba468403a4f0be04
|
|
| MD5 |
30d99b6884549b5761c0747fd8e495d5
|
|
| BLAKE2b-256 |
828864fe21488ac938522e4ae5a7c1fa2b21423ea61ab772483c6b95a6b47cb9
|
File details
Details for the file drx_lissajoux-1.0.1-py3-none-any.whl.
File metadata
- Download URL: drx_lissajoux-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50b88770780ee29a04bfc6886992f93fb2366f42c2bcaf53e6a1626212c810d8
|
|
| MD5 |
0d5114f815ec0ea819df7a176d8b9127
|
|
| BLAKE2b-256 |
294ef4baeb77b734bb70b0e2eb4adac655d2b5dff4b13782b1a086431bfb9d40
|