Skip to main content

DrX Lissajoux API

Project description


Doctor X Lissajoux API

This library provides the python API for a Doctor X Lissajoux device.

Installation

Install the lastest python3 version. Open command line interface (cmd) and type pip3 install --upgrade drx-lissajoux

Usage examples

The examples below can be run by first saving the example code as a example.py file using for instance Notepad. Place the license xml file which was provided by Doctor X during delivery of the Lissajoux in the same location as where you saved example.py. Please adjust the HOST constant in each of the example scripts to the IP adress of your Lissajoux. Please adjust the KEY_FILE constant in each of the example scripts to the location of your license file. Note that the license file name is diffrent for each device since it contains the organization and serial number, for example key_TFS_L15.4-7021151.xml The example can now be run using python3 example.py from the command line. The path of the command line needs to be set cd "path/to/the/example/folder" to the folder of the example.py file.

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

drx_lissajoux-1.0.5.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

drx_lissajoux-1.0.5-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file drx_lissajoux-1.0.5.tar.gz.

File metadata

  • Download URL: drx_lissajoux-1.0.5.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for drx_lissajoux-1.0.5.tar.gz
Algorithm Hash digest
SHA256 f57be457ddfdc69311207c5cf5795ecd9db0b6e6f2fc5ab4cf06b2cf49abb625
MD5 d0352eaa55b92f55d34041f88795eabe
BLAKE2b-256 f0f76605a1a01a764bb01265c4d15de73107a63d4e7c4f6e4282e091f61e4b8a

See more details on using hashes here.

File details

Details for the file drx_lissajoux-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: drx_lissajoux-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for drx_lissajoux-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6981c10bea3dc3117c9453011a9cb7d36a1c9abb35f3339a99946afb6e99443b
MD5 48c733c7287a7a262893b5b2b66096b4
BLAKE2b-256 fc0ba8621f617fdb89a917bf2cc18542182ae500d3922202f69feb4c479d0a4a

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