Using EPICS channels

kPyQt.ArchivedChannel module

class kPyQt.ArchivedChannel.ArchivedChannel(*args)

Bases: PyQt5.QtCore.QObject

Wrapper class for EPICS channel archiver data. For live appending of data, contains an instance of the Channel class.

channelCallback(pvname, value, timestamp, **args)

Register this callback for the most flexible means to access the channel when it changes. Callback will transmit the pyepics pv instance which can be directly accessed.

getArchiverValues(maxseries=1)

Get the raw values straight from the archiver, datetime and values as columns. Limiting the number of series is currently TBD.

getPlotValues()

Return two numpy arrays of the values in the data set, values vs. time, for use in a plot.

goLive(alternate='')

Enable live updating of the channel values from the EPICS channel. For demonstration purposes an alternate channel name can be provided to make the connection.

log = <RootLogger root (WARNING)>
setChannel(channel)

Assign an EPICS channel name to the archived channel instance.

setWindow(hours=0, minutes=0, seconds=0)

Set a time window in H/M/S for how far back into the archiver to read.

kPyQt.ArchivedChannel.factory(channel, new_class=<class 'kPyQt.ArchivedChannel.ArchivedChannel'>, *args)

The channel argument should be a string indicating the EPICS channel name; the remainder of the arguments passed to this function will be passed to the local ArchivedChannel. Cached instances will be returned when possible to avoid potential memory leaks from repeated calls to this function. You can still “roll your own” with respect to memory management by creating instances directly instead of using this factory function.

kPyQt.Channel module

class kPyQt.Channel.Channel(*args)

Bases: PyQt5.QtCore.QObject

Wrapper class for EPICS PV instances from the epics module.

connCallback(pvname=None, conn=None, **kws)
property connected
disconnect(QMetaObject.Connection)bool

disconnect(self)

emitBooleanCallback(value)

Convert the provided value to a bool and emit the callback.

emitChannelCallback(value)

Send the entire channel back in the callback.

emitFloatCallback(value)

Convert the provided value to a float and emit the callback.

emitIntegerCallback(value)

Convert the provided value to an integer and emit the callback.

emitStringCallback(value)

Convert the provided value to a string and emit the callback.

formatValue(value)

Use the cached format string to convert the raw value into a string.

getText()

Read the channel value and return as a string.

read()

Read the EPICS channel value, format it and return it.

receiveCallback(pvname, status, type, value, char_value, enum_strs, cb_info, **args)

Entry point for callback from the EPICS pv instance.

runCallbacks()

Run the callbacks once to update anything listening to the formatted value

setChannel(channel, waitfor=False, timeout=5)

Given the provided EPICS channel name, create an epics.PV instance and hook to its callbacks.

setFormat(format)

Set the format.

write(value, wait=True, timeout=1.0)

Set the EPICS channel value.

class kPyQt.Channel.ChannelAlarms(value)

Bases: enum.Enum

Enumerate EPICS alarm values

MAJOR = 2
MINOR = 1
NONE = 0
UNK = 3
exception kPyQt.Channel.ChannelError

Bases: Exception

Base class for exceptions in this module.

exception kPyQt.Channel.ChannelTimeoutError(message)

Bases: kPyQt.Channel.ChannelError

Exception raised for errors in the input.

Attributes:

message – explanation of the error

class kPyQt.Channel.caBoolean(*args)

Bases: kPyQt.Channel.Channel

Create a boolean channel.

readRaw()

Read the EPICS channel value and return the raw value

class kPyQt.Channel.caEnum(*args)

Bases: kPyQt.Channel.Channel

Create an enumerated value channel and default format as a string.

read()

Read the EPICS channel value, translate to enum, format it and return it.

receiveCallback(pvname, status, type, value, char_value, enum_strs, cb_info, **args)

Entry point for callback from the EPICS pv instance with enum translation.

class kPyQt.Channel.caFloat(*args)

Bases: kPyQt.Channel.Channel

Create a float channel and default format to 2 digits of precision.

readRaw()

Read the EPICS channel value and return the raw value

class kPyQt.Channel.caInteger(*args)

Bases: kPyQt.Channel.Channel

Create an integer channel.

class kPyQt.Channel.caString(*args)

Bases: kPyQt.Channel.Channel

Create a string channel.

setFormat(format)

Set the format. Caller must specify a format string appropriate for a string.

kPyQt.Channel.factory(channel, new_class=<class 'kPyQt.Channel.caString'>, *args, **kwargs)

The channel argument should be a string indicating the EPICS channel name; the remainder of the arguments passed to this function will be passed to the local Channel. Cached instances will be returned when possible to avoid potential memory leaks from repeated calls to this function. You can still “roll your own” with respect to memory management by creating instances directly instead of using this factory function. Defaults to caString if not otherwise specified.