Skip to main content

liteserver 3.1.0

Very Lightweight Data Object Server. It hosts Lite Data Objects (LDO, analog of Process Variables in EPICS) and provides info/set/get/read/subscribe remote access to them using UDP protocol. Data encoding is implemented using CBOR specification, which makes it very fast and efficient.

Data logging and retrieving

Data objects can be logged and retrieved using an apstrim package (https://pypi.org/project/apstrim).

Features

  • Simplicity. The network protocol is UDP, error correction of late/missing/mangled data is implemented. Binary serialization protocol CBOR. Programming interface is very similar to JSON.
  • Low latency, connection-less.
  • Supported requests:
    • info(), returns dictionary with information on requested LDOs and parameters
    • get(), returns dictionary of values of requested LDOs and parameters
    • read(), returns dictionary of changed readable (non-constant) parameters of requested LDOs
    • set(), set values or attributes of requested LDO parameters
    • subscribe(callback), subscribe to a set of the objects, if any object of the requested LDOs have been changed, the server will publish the changed objects to client and the callback function on the client will be invoked.
  • Multidimensional data (numpy arrays) are supported.
  • Access control info (username, program name) supplied in every request
  • Name service
    • file-based
    • network-based using a dedicated liteServer (not commissioned yet)
  • Basic spreadsheet-based GUI: pypeto
  • Architectures. All programs are 100% python. Tested on Linux and partially on Windows.
  • Companion applications:

Supported devices

Server implementations for various devices are located in .device sub-package. A device server can be started using following command:
python3 -m liteserv.device.

  • device.litePeakSimulator: Waveform simulator with multiple peaks and a background noise.
  • device.liteScaler: Test implementation of the liteServer, supporting 1000 of up/down counters as well as multi-dimensional arrays.
  • device.senstation: Server for various devices, connected to Raspberry Pi GPIOs: 1-wire temperature sensor, Pulse Counter, Fire alarm and Spark detector, Buzzer, RGB LED indicator, OmegaBus serial sensors. Various I2C devices: ADC: ADS1x15, Magnetometers: MMC5983MA, HMC5883, QMC5983, TLV493D. I2C multiplexing using TCA9548 or PCA9546. NUCLEO-STM33 mixed signal MCU boards, connected to Raspberry Pi over USB.
  • device.liteGQ: Geiger Counter and a gyro sensor GMC-500 from GQ Electronics.
  • device.liteWLM: Wavelength Meter WS6-600 from HighFinesse.
  • device.liteLabjack: LabJack U3 analog and digital IO module.
  • device.liteUSBCam: Server for USB cameras.
  • device.liteUvcCam: Server for USB cameras using UVC library.
  • device.liteVGM: (Obsolete) Server for multiple gaussmeters from AlphaLab Inc.

Installation

Dependencies:

  • Python3 3.6 or higher.
  • CBOR2

Installation:

python3 -m pip install liteserver

Additional libraries may be required for specific devices.

Examples

Most convenient way to test a base class functionality is by using ipython3,

Test server: liteScaler

Start liteScaler on a local host:
python -m liteserver.device.liteScaler -ilo
To monitor, use:
python -m pvplot L:localhost:dev1:counters

Peak simulator

python -m liteserver.device.litePeakSimulator -ilo
To monitor, use:
python -m pvplot -s.01 -a'L:localhost:dev1' 'x,y'

Labjack U3-HV

python -m liteserver.device.liteLabjack -ilo
To monitor, use:
python -m pvplot -a'L:localhost:dev1' 'tempU3 ADC_HV[0] ADC_HV[1] ADC_HV[2] ADC_HV[3] ADC_LV'

Server for all supported peripherals: senstation:

I2C Support

To detect available devices on the multiplexed I2C chain:
python -m utils.i2cmux -M 112
If multiplexer address on your board is not 112, you can find it using:
i2cdetect -y 1

Start the senstation server

Start the senstation server through default network interface:
python -m liteserver.device.senstation

Interfacing to senstation using python

from liteserver import liteAccess as LA 
from pprint import pprint

Host = 'localhost'
LAserver = Host+':server'
LAdev1   = Host+':dev1'
LAdev2   = Host+':dev2'

#``````````````````Programmatic way, using Access`````````````````````````````
LA.Access.info((Host+':*','*'))# map of all devices and parameters the Host
LA.Access.info((LAserver,'*'))
LA.Access.get((LAserver,'*'))
LA.Access.set((LAdev1,'frequency',2.0))
LA.Access.subscribe(LA.testCallback,(LAdev1,'cycle'))
LA.Access.unsubscribe()
#,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,	
#``````````````````Object-oriented way````````````````````````````````````````
# Advantage: The previuosly created PVs are reused.
allServerParameters = LA.PVs((LAserver,'*'))
pprint(allServerParameters.info())
pprint(allServerParameters.get())# get all parameters from device LAserver
# get all readable parameters from device Scaler1:server, which have been 
# modified since the last read:
pprint(allServerParameters.read())

allDev1Parameters = LA.PVs((LAdev1,'*'))
print(allDev1Parameters.info())

server_performance = LA.PVs((LAserver,'perf'))
pprint(server_performance.info())
pprint(server_performance.get())
# simplified get: returns (value,timestamp) of a parameter 'perf' 
pprint(server_performance.value)

server_multiple_parameters = LA.PVs((LAserver,('perf','run')))
pprint(server_multiple_parameters.info())
pprint(server_multiple_parameters.get())

server_multiple_devPars = LA.PVs((LAdev1,('time','frequency')),(LAserver,('statistics','perf')))
pprint(server_multiple_devPars.get())

# setting
dev1_frequency = LA.PVs((LAdev1,'frequency'))
dev1_frequency.set([1.5])
dev1_frequency.value
dev1_multiple_parameters = LA.PVs([LAdev1,('frequency','coordinate')])
dev1_multiple_parameters.set([8.,[3.,4.]])

# subscribing
ldo = LA.PVs([LAdev1,'cycle'])
ldo.subscribe()# it will print image data periodically
ldo.unsubscribe()# cancel the subscruption

# test for timeout, should timeout in 10s:
#,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
#``````````````````Observations```````````````````````````````````````````````
Timing of Access.get using ipython on localhost.
    from liteserver import liteAccess as LA
    Host='localhost'
    LAdev1   = Host+':dev1'
    %timeit image = LA.Access.get((LAdev1,['image']))
    145 µs ± 1.95 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
    image[(LAdev1,'image')]['value'].shape
    (120, 160, 3)
Retrieving time of 57600 values (120*160*3) is 145 µs,
which corresponds to 400 mValues/s

Retrieving time of 57600 values (120*160*3) 220 µs,
which corresponds to 260 MValues/s (on entry-level workstation). 
It was 400 MValues/s on top-level workstation.
Note: Msgpack was 4% faster.
#``````````````````Tips```````````````````````````````````````````````````````
# To enable debugging: LA.PVs.Dbg = True
# To enable transaction timing: LA.Channel.Perf = True

Metadata

Release files for liteserver 3.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for liteserver 3.3.7
File Size Uploaded
liteserver-3.3.7.tar.gz 58.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for liteserver 3.3.7
File Interpreter ABI Platform
liteserver-3.3.7-py3-none-any.whl Python 3 none any Details

Total release size: 125.2 kB

Release files / liteserver-3.3.7.tar.gz

Download URL liteserver-3.3.7.tar.gz
Size 58.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a84f57b2300c75fe1f4570b076a8997c844bc51f185cee92482e154b0132bcc8
BLAKE2b-256 checksum
How to use checksums
bd942db75dd34f114b8912685d68ef107c5e9cb388c1a0b1147f4debe8d5aa69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release files / liteserver-3.3.7-py3-none-any.whl

Download URL liteserver-3.3.7-py3-none-any.whl
Size 66.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d7c5324b8238ca2d046020c39d3635149635f86df1aaab81a19d72d14a34511
BLAKE2b-256 checksum
How to use checksums
2e1df08ebf36ef719e490e1c3026baa5a48f0fd8d6b286098783f62baa76d9a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

3.3.7 This release

2 release files

3.3.6

2 release files

3.3.5

2 release files

3.3.4

2 release files

3.3.3

2 release files

3.3.2

2 release files

3.3.1

2 release files

3.3.0

2 release files

3.2.3

2 release files

3.2.2

2 release files

3.2.0

2 release files

3.1.0

2 release files

2.0.0

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page