| | |
- Ezca
class Ezca |
| |
Ezca: Epics EZCA interface in Python
example:
import Ezca
ez = Ezca.Ezca(timeout = 0.001, retry=20)
x = ez.caget('XX:m1.VAL')
if (ez.status == 0):
print x
else:
print ' not connected, status = ', ez.status
The Ezca class provides an interface to the EPICS Ezca library
from Python. The supported functions are:
caput(pv,val) : set a PV value
caget(pv) : get a PV value
set_debug() : set debug flag
show_config : show configuration of Ezca instance.
get_status : return last Ezca exit status
connect : connect to a pv, saving count,type in local cache
use_numeric : set the use of Numeric Python arrays for array types
GetCountAndType : return PV count and _python_ type
GetNelem : return PV count
GetStatus : Get time, status, and severity for a PV
GetUnits : return units of a PV
GetPrecision : return precision of a PV
SetMonitor : set a PV monitor
ClearMonitor : unset a PV monitor
CheckMonitor : check status of a PV monitor
StartGroup : start a group of efficient Ezca calls
EndGroup : end a group of efficient Ezca calls
delay : set an Ezca time delay
getpv(pv, options) : enhanced PV get (see doc below), largely
obsolete by caget(...,type='char') option.
options for creating each instance are:
import Ezca
ez = Ezca.Ezca(option=value, ....)
Several optional arguments can be given to affect the
behavior of the Ezca instance:
option meaning default
timeout ca timeout (in sec) 0.001
retry ca retry count 300
debug debug flag (1: on, 0: off) 0
trace flag to turn ezcaTraceOn on/off 0
autoerror flag to turn ezcaAutoError on/off 0
use_char flag to usw string output where appropriate 0
use_numeric flag to use Numeric arrays for array data 0
Both 'use_char' and 'use_numeric' are recommended! |
| |
- CheckMonitor(self, pv)
- Check the Status of Monitored PV:
status = ezca.CheckMonitor(pv)
- ClearMonitor(self, pv)
- Clear a Monitor on a PV:
status = ezca.ClearMonitor(pv)
- EndGroup(self)
- End a 'Group' for efficient get/puts:
status = ezca.EndGroup()
- GetCountAndType(self, pv)
- Get Count and Type (python type!) of a PV:
(count,type) = ezca.GetNelem(pv)
- GetNelem(self, pv)
- Get Number of Elements (count) of a PV:
count = ezca.GetNelem(pv)
- GetPrecision(self, pv)
- Get Precision of a PV:
prec = ezca.GetPrecision(pv)
- GetStatus(self, pv)
- Get time, status, and severity for a PV:
(time, status, severity) = ezca.GetStatus(pv)
- GetUnits(self, pv)
- Get Units (as a character string) of a PV:
units = ezca.GetUnits(pv)
- SetMonitor(self, pv)
- Set a Monitor on a PV:
status = ezca.SetMonitor(pv)
- StartGroup(self)
- Start a 'Group' for efficient get/puts:
status = ezca.StartGroup()
- __init__(self, **args)
- caget(self, pv, fromcache=None, type=None)
- get a Process Variable:
x = ezca.caget(pv)
options:
fromcache=1 do _not_ do a real caget, but get
the last read value, as after a set
of StartGroup/EndGroup.
type='char' try to force output as string (useful for
bo//bi/mbbi/mbbo output)
- caput(self, pv, data, wait=0)
- set a Process Variable:
x = ezca.caput(pv,val)
options:
wait=1 wait for record to completely process before returning
- connect(self, pv)
- initiate a connection to a PV,
internally storing useful information about the PV
such as count, type, rtype, and allocating a pointer
for the data.
res = ezca.connect(pv)
returns a tuple of count, ezcatype, python_type, and pointer
- delay(self, time)
- Do an Ezca time delay:
status = ezca.delay(time)
- get_status(self)
- get Ezca status
- getpv(self, pv, type='scalar', format=None, descpv=None)
- Enhanced caget of a PV:
(val, desc) = ezca.getpv(pv, options)
where the options controlling what the output value and
and description are, and how they are formatted.
In general, a PV is assumed to have a '.VAL' (which is
optional), and the corresponding '.VAL' and '.DESC'
fields will be found and passed back:
val,desc = ezca.getpv('XXX:m1')
will return the values of XXX:m1.VAL and XXX:m1.DESC
option meaning
type PV type (full, bo, mbbi)
'bo': PV is a binary out, lookup '.ZNAM'
or '.ONAM' field as appropriate
for the output VALUE
'mbbi': PV is a mbbi, lookup '.ZRST', ...
as appropriate for the output VALUE
'full': Do _NOT_ append '.VAL' and '.DESC'
to PV.
'yes/no': translate 1/0 to 'Yes/No'
desc PV to use to lookup description field (instead
of using the '.DESC' field.
format C/Python format string to use to format output
- set_debug(self, d=1)
- set debug status:
ezca.set_debug(1) turn debugging on
ezca.set_debug() turn debugging on
ezca.set_debug(0) turn debugging off
- show_config(self)
- print current configuration to standard output
- use_numeric(self, val=1)
- set the use of Numeric Python arrays for array types
ez.use_numeric() turn on Numeric arrays
ez.use_numeric(val=0) turn off Numeric arrays
| |