Skip to main content

lume-pva

Lume-PVA is a Python library that serves or consumes EPICS PVs based on a LUMEModel subclass and its supported variables.

Features:

  • Model outputs served over PVAccess (PVA) and/or ChannelAccess (CA).
    • PVA PVs support a subset of the EPICS NormativeTypes metadata.
    • CA PVs support a subset of the standard EPICS CA meta, such as alarms, display limits and control limits.
  • Inputs can be served as standalone PVs over PVA, or configured as clients for remote PVs.
  • Automatic discovery of remote PV protocols.
  • Snapshot mode for remote PVs.

Basic Usage

from lume_pva.runner import Runner

myModel = MyLUMEModel()
r = Runner(model=myModel)
r.run()

Operational Description

Model Outputs

Model outputs can be served served over PVA and/or CA. If the output is solely an output, it will be configured as a read-only PV.

Model Inputs

Model inputs can be configured as remote or local PVs. Local PVs are served by the Runner class and can be interacted with using pvput, caput or other CA/PVA tools on the command line.

Like model outputs, standalone inputs can be served over CA or PVA, depending on the Runner configuration.

In the remote mode, the input is setup as a client. In this mode, both PVA and CA are supported transparently. It's not necessary to specify the protocol of the remote PV; the pvua library will automatically detect which protocol to use. pvua prefers the more modern protocol (PVA), if available.

Snapshot Mode

When configured in snapshot mode, the Runner will only fetch values from remote PVs when a snapshot is triggered by a write to {prefix}SNAPSHOT.

Control PVs

The runner always exposes a small set of control PVs:

  • {prefix}SNAPSHOT: triggers a snapshot pull for remote inputs in snapshot mode.
  • {prefix}RESET: any write requests model.reset() and publishes the reset state to output PVs.

Control PVs are served over PVA, and are also available over CA when protocol includes "ca".

prefix is passed to the constructor of the Runner class and defines a prefix to prepend to the start of PV names.

Configuration

Runner.generate_config() can be used to generate a dict describing the default configuration for the model. You can either edit this on the fly, or serialize it and edit it by hand later.

print(Runner.generate_config(model=myModel))

An example configuration:

{
    'remote_model_mode': 'continuous', # Set to 'snapshot' for snapshot mode
    'prefix': 'MY_PV_PREFIX:',
    'update_rate': 0.1, # Update period under which PVs will be batched together into one model.set(). Set to 0 to disable the window.
    'protocol': ['ca', 'pva'] # Serve this as both CA and PVA (the default)
    'variables': {
        'input_a': {
            'name': 'input_a',
            'pv': 'input_a_pv',
            'mode': 'rw' # 'rw' means we can read and write this PV. It's served by the Runner class
        },
        'input_b': {
            'name': 'input_b',
            'pv': 'SOME:REMOTE:PV',
            'mode': 'remote' # 'remote' means this PV will be configured as a client and fetched from a remote
        }
    }
}

Supported Variables

Supported variable types and their metadata fields.

ScalarVariable and IntVariable

Represented as NTScalar with a double or int value field (depending on variable type).

Supported metadata:

  • timestamp
  • display.units
    • ScalarVariable.unit
  • control.limitLow
    • ScalarVariable.value_range[0]
  • control.limitHigh
    • ScalarVariable.value_range[1]
  • alarm.severity and alarm.status
    • Set based on the value in relation to value_range. Out of range values trigger alarms.

NDVariable

Represented as NTNDArray with data representation matching the numpy shape and dtype.

Supported metadata:

  • timestamp

TorchScalarVariable

Requires the torch extra (pip install lume-pva[torch]).

Represented as NTScalar with a double value field.

Supported metadata:

  • timestamp

TorchNDVariable

Requires the torch extra (pip install lume-pva[torch]).

Represented as NTNDArray with data representation matching the Tensor shape and dtype.

Supported metadata:

  • timestamp

BoolVariable

Represented as NTScalar with a bool value field.

Supported metadata:

  • timestamp

StrVariable

Represented as NTScalar with a str value field.

Supported metadata:

  • timestamp

Metadata

Release files for lume-pva 0.5.0

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

Source distribution (sdist)

Source distribution for lume-pva 0.5.0
File Size Uploaded
lume_pva-0.5.0.tar.gz 45.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lume-pva 0.5.0
File Interpreter ABI Platform
lume_pva-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 89.2 kB

Release files / lume_pva-0.5.0.tar.gz

Download URL lume_pva-0.5.0.tar.gz
Size 45.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6c276cd9269240ded0985106f30f6d49d738605bad56b073d957dd64a97cf0ba
BLAKE2b-256 checksum
How to use checksums
fa936941063896c06f8910903fbf70bf422341cb8c74651e8b91f11ccdc8dc5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / lume_pva-0.5.0-py3-none-any.whl

Download URL lume_pva-0.5.0-py3-none-any.whl
Size 43.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea9f954d3102c3969620cbdf8f329027e5b5637317cf24322c3acbe7766f5561
BLAKE2b-256 checksum
How to use checksums
ca50cbc29fb596f247b197b24301fd9297fd09f2651dfc790adb12ead3530bec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.3.0

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