| Name | liteserver JSON |
| Version |
3.3.1
JSON |
| download |
| home_page | None |
| Summary | Lightweight control system for scientific instruments. Resembles EPICS |
| upload_time | 2024-08-23 03:38:43 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | >=3.7 |
| license | None |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# 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:
- [liteAccess: Access to liteServer's](https://pypi.org/project/liteaccess)
- [pvplot: Dynamic plotting tool](https://pypi.org/project/pvplot)
- [apstrim: Data Logger](https://pypi.org/project/apstrim)
- [Imagin: Image analysis](https://github.com/ASukhanov/Imagin)
### Supported devices
Server implementations for various devices are located in .device sub-package.
A device server can be started using following command:<br>
python3 -m liteserv.device.<deviceName> <Arguments>
- **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](https://pypi.org/project/cbor2/)
### Installation:<br>
```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:<br>
```python -m liteserver.device.liteScaler -ilo```<br>
To monitor, use:<br>
```python -m pvplot L:localhost:dev1:counters```
#### Peak simulator
```python -m liteserver.device.litePeakSimulator -ilo```<br>
To monitor, use:<br>
```python -m pvplot -s.01 -a'L:localhost:dev1' 'x,y'```
#### Labjack U3-HV
```python -m liteserver.device.liteLabjack -ilo```<br>
To monitor, use:<br>
```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:<br>
```python -m utils.i2cmux -M 112```<br>
If multiplexer address on your board is not 112, you can find it using:<br>
```i2cdetect -y 1```
#### Start the senstation server
Start the senstation server through default network interface:<br>
```python -m liteserver.device.senstation```
#### Interfacing to senstation using python
```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
```
Raw data
{
"_id": null,
"home_page": null,
"name": "liteserver",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Andrei Sukhanov <cyxandr@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/a6/c8/a80593db7a4725b404a6951610acb6685a4869890b2ca6363f084725f591/liteserver-3.3.1.tar.gz",
"platform": null,
"description": "# liteserver 3.1.0\nVery Lightweight Data Object Server. \nIt hosts Lite Data Objects (**LDO**, analog of Process Variables in \nEPICS) and provides info/set/get/read/subscribe remote access to them using \nUDP protocol. Data encoding is implemented using **CBOR** specification, \nwhich makes it very fast and efficient.\n\n### Data logging and retrieving\nData objects can be logged and retrieved using an **apstrim** package (https://pypi.org/project/apstrim).\n\n### Features\n - Simplicity. The network protocol is **UDP**, error correction of \nlate/missing/mangled data is implemented. Binary serialization protocol **CBOR**. \nProgramming interface is very similar to JSON.\n - Low latency, connection-less.\n - Supported requests:\n - **info()**, returns dictionary with information on requested LDOs and \n parameters\n - **get()**, returns dictionary of values of requested LDOs and parameters\n - **read()**, returns dictionary of changed readable (non-constant) \n parameters of requested LDOs\n - **set()**, set values or attributes of requested LDO parameters\n - **subscribe(callback)**, subscribe to a set of the objects, if any object \nof the requested LDOs have been changed, the server will publish the changed \nobjects to client and the callback function on the client will be invoked.\n - Multidimensional data (numpy arrays) are supported.\n - Access control info (username, program name) supplied in every request\n - Name service\n - file-based\n - network-based using a dedicated liteServer (not commissioned yet)\n - Basic spreadsheet-based GUI: **pypeto**\n - Architectures. All programs are 100% python. Tested on Linux and partially on Windows.\n - Companion applications:\n - [liteAccess: Access to liteServer's](https://pypi.org/project/liteaccess)\n - [pvplot: Dynamic plotting tool](https://pypi.org/project/pvplot)\n - [apstrim: Data Logger](https://pypi.org/project/apstrim)\n - [Imagin: Image analysis](https://github.com/ASukhanov/Imagin) \n\n### Supported devices\nServer implementations for various devices are located in .device sub-package. \nA device server can be started using following command:<br>\n python3 -m liteserv.device.<deviceName> <Arguments>\n\n- **device.litePeakSimulator**: Waveform simulator with multiple peaks and a background noise.\n- **device.liteScaler**: Test implementation of the liteServer, \nsupporting 1000 of up/down counters as well as multi-dimensional arrays.\n- **device.senstation**: Server for various devices, connected to Raspberry Pi\nGPIOs: 1-wire temperature sensor, Pulse Counter, Fire alarm and Spark detector,\nBuzzer, RGB LED indicator, OmegaBus serial sensors. \nVarious I2C devices: ADC: ADS1x15, Magnetometers: MMC5983MA, HMC5883, QMC5983, \nTLV493D.\nI2C multiplexing using TCA9548 or PCA9546.\nNUCLEO-STM33 mixed signal MCU boards, connected to Raspberry Pi over USB.\n- **device.liteGQ**: Geiger Counter and a gyro sensor GMC-500 from GQ Electronics.\n- **device.liteWLM**: Wavelength Meter WS6-600 from HighFinesse.\n- **device.liteLabjack**: LabJack U3 analog and digital IO module.\n- **device.liteUSBCam**: Server for USB cameras.\n- **device.liteUvcCam**: Server for USB cameras using UVC library.\n- **device.liteVGM**: (Obsolete) Server for multiple gaussmeters from AlphaLab Inc.\n\n## Installation\n\n### Dependencies:\n- Python3 3.6 or higher.\n- [CBOR2](https://pypi.org/project/cbor2/)\n\n### Installation:<br>\n```python3 -m pip install liteserver```\n\nAdditional libraries may be required for specific devices.\n\n## Examples\nMost convenient way to test a base class functionality is by using **ipython3**, \n\n#### Test server: liteScaler\nStart liteScaler on a local host:<br>\n```python -m liteserver.device.liteScaler -ilo```<br>\nTo monitor, use:<br>\n```python -m pvplot L:localhost:dev1:counters```\n\n#### Peak simulator\n```python -m liteserver.device.litePeakSimulator -ilo```<br>\nTo monitor, use:<br>\n```python -m pvplot -s.01 -a'L:localhost:dev1' 'x,y'```\n\n#### Labjack U3-HV\n```python -m liteserver.device.liteLabjack -ilo```<br>\nTo monitor, use:<br>\n```python -m pvplot -a'L:localhost:dev1' 'tempU3 ADC_HV[0] ADC_HV[1] ADC_HV[2] ADC_HV[3] ADC_LV'```\n\n### Server for all supported peripherals: senstation:\n#### I2C Support\nTo detect available devices on the multiplexed I2C chain:<br>\n```python -m utils.i2cmux -M 112```<br>\nIf multiplexer address on your board is not 112, you can find it using:<br>\n```i2cdetect -y 1```\n\n#### Start the senstation server\nStart the senstation server through default network interface:<br>\n```python -m liteserver.device.senstation```\n\n#### Interfacing to senstation using python\n```python\nfrom liteserver import liteAccess as LA \nfrom pprint import pprint\n\nHost = 'localhost'\nLAserver = Host+':server'\nLAdev1 = Host+':dev1'\nLAdev2 = Host+':dev2'\n\n#``````````````````Programmatic way, using Access`````````````````````````````\nLA.Access.info((Host+':*','*'))# map of all devices and parameters the Host\nLA.Access.info((LAserver,'*'))\nLA.Access.get((LAserver,'*'))\nLA.Access.set((LAdev1,'frequency',2.0))\nLA.Access.subscribe(LA.testCallback,(LAdev1,'cycle'))\nLA.Access.unsubscribe()\n#,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\t\n#``````````````````Object-oriented way````````````````````````````````````````\n# Advantage: The previuosly created PVs are reused.\nallServerParameters = LA.PVs((LAserver,'*'))\npprint(allServerParameters.info())\npprint(allServerParameters.get())# get all parameters from device LAserver\n# get all readable parameters from device Scaler1:server, which have been \n# modified since the last read:\npprint(allServerParameters.read())\n\nallDev1Parameters = LA.PVs((LAdev1,'*'))\nprint(allDev1Parameters.info())\n\nserver_performance = LA.PVs((LAserver,'perf'))\npprint(server_performance.info())\npprint(server_performance.get())\n# simplified get: returns (value,timestamp) of a parameter 'perf' \npprint(server_performance.value)\n\nserver_multiple_parameters = LA.PVs((LAserver,('perf','run')))\npprint(server_multiple_parameters.info())\npprint(server_multiple_parameters.get())\n\nserver_multiple_devPars = LA.PVs((LAdev1,('time','frequency')),(LAserver,('statistics','perf')))\npprint(server_multiple_devPars.get())\n\n# setting\ndev1_frequency = LA.PVs((LAdev1,'frequency'))\ndev1_frequency.set([1.5])\ndev1_frequency.value\ndev1_multiple_parameters = LA.PVs([LAdev1,('frequency','coordinate')])\ndev1_multiple_parameters.set([8.,[3.,4.]])\n\n# subscribing\nldo = LA.PVs([LAdev1,'cycle'])\nldo.subscribe()# it will print image data periodically\nldo.unsubscribe()# cancel the subscruption\n\n# test for timeout, should timeout in 10s:\n#,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\n#``````````````````Observations```````````````````````````````````````````````\nTiming of Access.get using ipython on localhost.\n from liteserver import liteAccess as LA\n Host='localhost'\n LAdev1 = Host+':dev1'\n %timeit image = LA.Access.get((LAdev1,['image']))\n 145 \u00b5s \u00b1 1.95 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 10000 loops each)\n image[(LAdev1,'image')]['value'].shape\n (120, 160, 3)\nRetrieving time of 57600 values (120*160*3) is 145 \u00b5s,\nwhich corresponds to 400 mValues/s\n\nRetrieving time of 57600 values (120*160*3) 220 \u00b5s,\nwhich corresponds to 260 MValues/s (on entry-level workstation). \nIt was 400 MValues/s on top-level workstation.\nNote: Msgpack was 4% faster.\n#``````````````````Tips```````````````````````````````````````````````````````\n# To enable debugging: LA.PVs.Dbg = True\n# To enable transaction timing: LA.Channel.Perf = True\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Lightweight control system for scientific instruments. Resembles EPICS",
"version": "3.3.1",
"project_urls": {
"Bug Tracker": "https://github.com/ASukhanov/liteServer/issues",
"Homepage": "https://github.com/ASukhanov/liteServer"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6334e2c7f6f13ca1a733bdadba150976523d53c281d7d92adcc3f76b8db82698",
"md5": "c88ed0c833932d4577e014fba3bb420f",
"sha256": "26e858206e379de01016073920b8369233fa672eb902513c0d1668712428c3b9"
},
"downloads": -1,
"filename": "liteserver-3.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c88ed0c833932d4577e014fba3bb420f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 105814,
"upload_time": "2024-08-23T03:38:42",
"upload_time_iso_8601": "2024-08-23T03:38:42.300217Z",
"url": "https://files.pythonhosted.org/packages/63/34/e2c7f6f13ca1a733bdadba150976523d53c281d7d92adcc3f76b8db82698/liteserver-3.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a6c8a80593db7a4725b404a6951610acb6685a4869890b2ca6363f084725f591",
"md5": "23e2db2ed15bfdef349c264e09203e93",
"sha256": "4cb44d2e16987b4bd6ad6b316202c24f254b3d61595c368f3323193dbe6aa893"
},
"downloads": -1,
"filename": "liteserver-3.3.1.tar.gz",
"has_sig": false,
"md5_digest": "23e2db2ed15bfdef349c264e09203e93",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 142968,
"upload_time": "2024-08-23T03:38:43",
"upload_time_iso_8601": "2024-08-23T03:38:43.570653Z",
"url": "https://files.pythonhosted.org/packages/a6/c8/a80593db7a4725b404a6951610acb6685a4869890b2ca6363f084725f591/liteserver-3.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-23 03:38:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ASukhanov",
"github_project": "liteServer",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "liteserver"
}