Skip to content

Commit

Permalink
Merge pull request #839 from jbellister-slac/add_pva_plugin
Browse files Browse the repository at this point in the history
ENH: Add pva plugin
  • Loading branch information
YektaY authored May 27, 2022
2 parents 62c413d + cf5a16f commit d64a24b
Show file tree
Hide file tree
Showing 13 changed files with 1,447 additions and 2 deletions.
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ pytest>=3.6
pytest-qt
pytest-cov
pytest-timeout
p4p
pyca
61 changes: 61 additions & 0 deletions docs/source/data_plugins/p4p_plugin.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
==========
P4P Plugin
==========

The P4P data plugin is defined in ``pydm/data_plugins/p4p_plugin_component.py`` and supports the pvAccess
protocol using the `P4P package`_.

.. _P4P package: https://mdavidsaver.github.io/p4p/

Usage
-----

The P4P plugin is the default pvAccess plugin, so any address using the "pva://" protocol will be
routed to it as in the example below::

pva://MTEST:Voltage:LI30


P4P is not currently specified as a required package of PyDM, and as such, will not be automatically included
alongside PyDM when installing it into an environment. P4P must therefore be installed manually. The versions
on conda-forge and PyPI are both supported, so feel free to choose whichever is most convenient::

conda install -c conda-forge p4p
pip install p4p

The choice of plugin to use can be controlled with the ``PYDM_PVA_LIB`` environment variable. As of now
P4P is the only option (and will be chosen automatically if this variable is not set) but more may be added
in the future.

Supported Types
---------------

Currently this data plugin supports all `normative types`_. The values and control variables are pulled out of
the data received and sent through the existing PyDM signals to be read by widgets via the channels they are
connected to.

In order to support compatibility with all existing signals and widgets, full structured data support is not
currently possible in this version of the plugin. For example, defining a group PV using Q:Group will not
result in the named fields being sent to the widgets. Full support for structured data is planned to be supported
as part of a future release.

Image decompression is performed when image data is specified using an ``NTNDArray`` with the ``codec`` field set.
The decompression algorithm to apply will be determined by what the ``codec`` field is set to. In order
for decompression to happen, the python package for the associated codec must be installed in the environment
PyDM is running in. Since we do not want to require all of these packages to be installed alongside PyDM when they
may not all be used in many cases, they must be installed manually as needed in the same way as P4P. Each package
is available on both conda-forge and PyPI and may be installed from either.

::

Pillow (for jpeg), blosc, lz4, bitshuffle (for bslz4)

.. _normative types: https://github.com/epics-base/normativeTypesCPP/wiki/Normative+Types+Specification


Examples
--------

A small pva testing ioc is included under ``examples/testing/pva_testing_ioc.py``. This can be run in order to
generate a couple of test PVs, which can be connected to using the example .ui file under
``examples/pva/pva.ui``.
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ as well as a straightforward python framework to build complex applications.

data_plugins/local_plugin.rst
data_plugins/calc_plugin.rst
data_plugins/p4p_plugin.rst
data_plugins/external_plugins.rst

.. toctree::
Expand Down
42 changes: 42 additions & 0 deletions examples/pva/image.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>279</width>
<height>231</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="PyDMImageView" name="PyDMImageView">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>261</width>
<height>211</height>
</rect>
</property>
<property name="toolTip">
<string/>
</property>
<property name="imageChannel" stdset="0">
<string>pva://PyDM:PVA:Image</string>
</property>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>PyDMImageView</class>
<extends>QWidget</extends>
<header>pydm.widgets.image</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Loading

0 comments on commit d64a24b

Please sign in to comment.