Skip to content

Commit

Permalink
Adding the areadetector.PluginBase PVGroup and associated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
awalter-bnl committed Apr 19, 2024
1 parent cb86e33 commit bacee2a
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .idea/ARI_SXN_SimBeamline.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
from caproto.server import (PVGroup, pvproperty, get_pv_pair_wrapper,
ioc_arg_parser, run)
from textwrap import dedent

# A shortcut to use for PVs with a readback partner given by the suffix '_RBV'
pvproperty_rbv = get_pv_pair_wrapper(setpoint_suffix='', readback_suffix='_RBV')


class PluginBase(PVGroup):
"""
A PVGroup that generates the PVs associated with a generic areadetector plugin.
This class should be used to define the PVs for a generic areadetector plugin.
It is based on the 'ophyd.areadetector.plugins.PluginBase' object.
NOTES:
1. Unless otherwise listed in the notes below the PVs generated are 'Dummy' PVs
that are not modified by any inputs, or modify any other PVs, except there own
values when they are updated.
TODO:
1. ...
"""

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) # call the PVGroup __init__ function

array_counter = pvproperty_rbv(name=':ArrayCounter', dtype=int)
array_rate = pvproperty(name=':ArrayRate_RBV', dtype=float, read_only=True)
array_size0 = pvproperty(name=':ArraySize0_RBV', dtype=int, read_only=True)
array_size1 = pvproperty(name=':ArraySize1_RBV', dtype=int, read_only=True)
array_size2 = pvproperty(name=':ArraySize2_RBV', dtype=int, read_only=True)

nd_attributes_file = pvproperty(name=':NDAttributesFile', dtype=str, max_length=256)

pool_alloc_buffers = pvproperty(name=':PoolAllocBuffers', dtype=int, read_only=True)
pool_free_buffers = pvproperty(name=':PoolFreeBuffers', dtype=int, read_only=True)
pool_max_buffers = pvproperty(name=':PoolMaxBuffers', dtype=int, read_only=True)
pool_max_mem = pvproperty(name=':PoolMaxMem', dtype=float, read_only=True)
pool_used_buffers = pvproperty(name=':PoolUsedBuffers', dtype=float, read_only=True)
pool_used_mem = pvproperty(name=':PoolUsedMem', dtype=float, read_only=True)
port_name = pvproperty(name=':PortName_RBV', dtype=str, read_only=True)

bayer_pattern = pvproperty(name=':BayerPattern_RBV', dtype=int, read_only=True)
blocking_callbacks = pvproperty_rbv(name=':BlockingCallbacks', dtype=str)
color_mode = pvproperty(name=':ColorMode_RBV', dtype=int, read_only=True)
data_type = pvproperty(name=':DataType_RBV', dtype=str, read_only=True)

dim0_sa = pvproperty(name=':Dim0SA', dtype=int, max_length=10)
dim1_sa = pvproperty(name=':Dim1SA', dtype=int, max_length=10)
dim2_sa = pvproperty(name=':Dim2SA', dtype=int, max_length=10)

dimensions = pvproperty(name=':Dimensions_RBV', dtype=int, max_length=10,
read_only=True)
dropped_arrays = pvproperty_rbv(name=':DroppedArrays', dtype=int)
enable = pvproperty_rbv(name=':EnableCallbacks', dtype=str)
min_callback_time = pvproperty_rbv(name=':MinCallbackTime', dtype=float)
nd_array_address = pvproperty_rbv(name=':NDArrayAddress', dtype=int)
nd_array_port = pvproperty_rbv(name=':NDArrayPort', dtype=str)
ndimensions = pvproperty(name=':NDimensions_RBV', dtype=int, read_only=True)
plugin_type = pvproperty(name=':PluginType_RBV', dtype=str, read_only=True)
queue_free = pvproperty(name=':QueueFree', dtype=int)
queue_free_low = pvproperty(name=':QueueFreeLow', dtype=float)
queue_size = pvproperty(name=':QueueSize', dtype=int)
queue_use = pvproperty(name=':QueueUse', dtype=float)
queue_use_high = pvproperty(name=':QueueUseHIGH', dtype=float)
queue_use_hihi = pvproperty(name=':QueueUseHIHI', dtype=float)
time_stamp = pvproperty(name=':TimeStamp_RBV', dtype=float, read_only=True)
unique_id = pvproperty(name=':UniqueId_RBV', dtype=int, read_only=True)
array_data = pvproperty(name=':ArrayData', dtype=int, max_length=300000)


# Add some code to start a version of the server if this file is 'run'.
if __name__ == "__main__":
ioc_options, run_options = ioc_arg_parser(
default_prefix="PluginBase",
desc=dedent(PluginBase.__doc__))
ioc = PluginBase(**ioc_options)
run(ioc.pvdb, **run_options)
4 changes: 4 additions & 0 deletions tests/test_caproto_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
dict(group_cls='Diagnostic',
kwargs={},
marks=[pytest.mark.skipif(numpy is None, reason="Requires numpy")],)
"ARI_SXN_SimBeamline.caproto_servers.area_detector.plugin_base":
dict(group_cls='PluginBase',
kwargs={},
marks=[pytest.mark.skipif(numpy is None, reason="Requires numpy")],)
}


Expand Down

0 comments on commit bacee2a

Please sign in to comment.