Skip to main content

Epics Channel Access for Python

Project description

PyEpics: Epics Channel Access for Python

https://github.com/pyepics/pyepics/actions/workflows/test-with-conda.yml/badge.svg https://img.shields.io/pypi/v/pyepics.svg https://img.shields.io/badge/docs-read-brightgreen https://zenodo.org/badge/4185/pyepics/pyepics.svg

PyEpics is a Python interface to the EPICS Channel Access (CA) library for the EPICS control system.

The PyEpics module includes both low-level (C-like) and higher-level access (with Python objects) to the EPICS Channnel Access (CA) protocol. Python’s ctypes library is used to wrap the basic CA functionality, with higher level objects on top of that basic interface. This approach has several advantages including no need for extension code written in C, better thread-safety, and easier installation on multiple platforms.

Installation

This package is supported and tested with Python 3.8 through 3.12. Shared libraries needed for Epics Channel Access are provided for Windows, MacOS, and Linux, and used by default. If you wish to use your own versions of the CA shared libraries, that can be controlled with an environmental variable.

To install the package, use:

pip install pyepics

To install from source, download the source kit for the latest release from PyPI (https://pypi.org/project/pyepics/) or Github (https://github.com/pyepics/pyepics/releases), unpack that and use:

pip install .

For additional installation details, see the INSTALL file. Binary installers for Windows are available.

License

This code is distributed under the Epics Open License

Overview

Pyepics provides two principle modules: ca, and pv, and functions caget(), caput(), and cainfo() for the simplest of interaction with EPICS. In addition, there are modules for Epics Motors and Alarms, autosave support via CA, and special widget classes for using EPICS PVs with wxPython.

caget(), caput() and cainfo()

The simplest interface to EPICS Channel Access provides functions caget(), caput(), and cainfo(), similar to the EZCA interface and to the EPICS-supplied command line utilities. These all take the name of an Epics Process Variable as the first argument:

 ~> python
 >>> from epics import caget, caput, cainfo
 >>> print(caget('XXX:m1.VAL'))
1.200
>>> caput('XXX:m1.VAL',2.30)
1
>>> cainfo('XXX.m1.VAL')
== XXX:m1.VAL  (double) ==
   value      = 2.3
   char_value = 2.3000
   count      = 1
   units      = mm
   precision  = 4
   host       = xxx.aps.anl.gov:5064
   access     = read/write
   status     = 1
   severity   = 0
   timestamp  = 1265996455.417 (2010-Feb-12 11:40:55.417)
   upper_ctrl_limit    = 200.0
   lower_ctrl_limit    = -200.0
   upper_disp_limit    = 200.0
   lower_disp_limit    = -200.0
   upper_alarm_limit   = 0.0
   lower_alarm_limit   = 0.0
   upper_warning_limit = 0.0
   lower_warning       = 0.0
   PV is monitored internally
   no user callbacks defined.
=============================

PV: Object Oriented CA interface

The general concept is that an Epics Process Variable is implemented as a Python PV object, which provides a natural way to interact with EPICS.

>>> import epics
>>> pv = epics.PV('PVName')
>>> pv.connected
True
>>> pv.get()
3.14
>>> pv.put(2.71)

Channel Access features that are included here:

  • user callbacks - user-supplied Python function(s) that are run when a PV’s value, access rights, or connection status changes

  • control values - a full Control DBR record can be requested

  • enumeration strings - enum PV types have integer or string representation, and you get access to both

  • put with wait - The PV.put() method can optionally wait until the record is done processing (with timeout)

Features that you won’t have to worry about:

  • connection management (unless you choose to worry about this)

  • PV record types - this is handled automatically.

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

pyepics-3.5.9.tar.gz (6.1 MB view details)

Uploaded Source

Built Distribution

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

pyepics-3.5.9-py3-none-any.whl (5.3 MB view details)

Uploaded Python 3

File details

Details for the file pyepics-3.5.9.tar.gz.

File metadata

  • Download URL: pyepics-3.5.9.tar.gz
  • Upload date:
  • Size: 6.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pyepics-3.5.9.tar.gz
Algorithm Hash digest
SHA256 78222c1a8aff55bc7a93bdcb6eea9cb544fa8b9122daed1e7ea5b5e87269d45c
MD5 c347f991493bfa9e2c362a38e8a4faa4
BLAKE2b-256 8a56b7edf871ec2d81ecc600a7687cf9c536759f31ea482e8aec453c6dd12d21

See more details on using hashes here.

File details

Details for the file pyepics-3.5.9-py3-none-any.whl.

File metadata

  • Download URL: pyepics-3.5.9-py3-none-any.whl
  • Upload date:
  • Size: 5.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pyepics-3.5.9-py3-none-any.whl
Algorithm Hash digest
SHA256 b9863cc55a58542f0a28ad04621d4471f649e9cacfa4ccf346a58d6ba158640c
MD5 eb453f3e430471ea75db37f8950fc1ff
BLAKE2b-256 82837dafb09fbc3efe9d00c4667d22b32b53d08e8a676fa164c6dd8f5debe85e

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