UserDataProcessor
- class pvapy.hpc.userDataProcessor.UserDataProcessor
Bases:
object
Class that serves as a base for any user implementation of a processor class suitable for usage with the streaming framework. Interface methods will be called at different stages of the processing workflow.
The following variables will be set after processor instance is created and before processing starts:
- logger (logging.Logger) : logger object
- processorId (int) : processor id
- outputChannel (str) : output channel
- objectIdField (str) : name of the object id field
- pvaServer (PvaServer) : PVA Server instance for publishing output objects
- metadataQueueMap (dict) : dictionary of available PvObject queues for metadata channels
UserDataProcessor(configDict={})
- Parameter
configDict (dict) - dictionary containing configuration parameters
- configure(configDict)
Method invoked at user initiated runtime configuration changes.
- Parameter
configDict (dict) - dictionary containing configuration parameters
- getOutputPvObjectType()
Method invoked at processing startup. It defines PVA structure of the output (processed) PvObject. There is no need to override this method if the structure of input and output objects are the same, or if the application will not publish processing output.
- Returns
PvObject with the same structure as generated by the process() method
- getStats()
Method invoked periodically for generating application statistics.
- Returns
Dictionary containing application statistics parameters
- getStatsPvaTypes()
Method invoked at processing startup. It defines user application part of the status PvObject published on the status PVA channel.
- Returns
Dictionary containing PVA types for the application statistics parameters
- process(pvObject)
Method invoked every time input channel updates its PV record.
- Parameter
pvObject (PvObject) - channel monitor update object
- resetStats()
Method invoked at user initiated application statistics reset.
- start()
Method invoked at processing startup.
- stop()
Method invoked at processing shutdown.
- updateOutputChannel(pvObject)
Method that can be used for publishing processed object on the output PVA channel. It should be invoked by the user application itself as part of the process() method. Typically, there should be no need for overriding this method in the derived class.
- Parameter
pvObject (PvObject) - processed object
AdImageProcessor
- class pvapy.hpc.adImageProcessor.AdImageProcessor
Bases:
pvapy.hpc.userDataProcessor.UserDataProcessor
Class that can be used as a base for user implementation of an Area Detector image processor class suitable for usage with the streaming framework.
AdImageProcessor(configDict={})
- Parameter
configDict (dict) - dictionary containing configuration parameters
- configure(configDict)
Method invoked at user initiated runtime configuration changes.
- Parameter
configDict (dict) - dictionary containing configuration parameters
- classmethod generateNtNdArray2D(imageId, image, extraFieldsPvObject=None)
Generate new NtNdArray object from NumPy array containing 2D image data.
- Parameter
imageId (int) - Value for the ‘uniqueId’ field
- Parameter
image (numpy.array) - Image data
- Parameter
extraFieldsPvbject (PvObject) - optional PvObject to be used for setting additional fields in the generated NtNdArray object
- Returns
NtNdArray object
- classmethod getNtNdArrayDataFieldKey(image)
Get NtNdArray value (union) field key suitable for the given NumPy array.
- Parameter
image (numpy.array) - array containing image data
- Returns
NtNdArray union value field key. Possible return values are ‘ubyteValue’, ‘byteValue’, ‘ushortValue’, ‘shortValue’, ‘uintValue’, ‘intValue’, ‘ulongValue’, ‘longValue’, ‘floatValue’, or ‘doubleValue’.
- getOutputPvObjectType()
Method invoked at processing startup. It defines PVA structure of the output (processed) PvObject. There is no need to override this method if the structure of input and output objects are the same, or if the application will not publish processing output.
- Returns
PvObject with the same structure as generated by the process() method
- getStats()
Method invoked periodically for generating application statistics.
- Returns
Dictionary containing application statistics parameters
- getStatsPvaTypes()
Method invoked at processing startup. It defines user application part of the status PvObject published on the status PVA channel.
- Returns
Dictionary containing PVA types for the application statistics parameters
- process(pvObject)
Method invoked every time input channel updates its PV record.
- Parameter
pvObject (PvObject) - channel monitor update object
- classmethod replaceNtNdArrayImage2D(ntNdArray, imageId, image, extraFieldsPvObject=None)
Replace 2D image data in the existing NtNdArray object. This method is slightly faster than generateNtNdArray2D().
- Parameter
ntNdArray (NtNdArray) - target NtNdArray object
- Parameter
imageId (int) - Value for the ‘uniqueId’ field
- Parameter
image (numpy.array) - Image data
- Parameter
extraFieldsPvbject (PvObject) - optional PvObject to be used for setting additional fields in the generated NtNdArray object
- Returns
NtNdArray object
- resetStats()
Method invoked at user initiated application statistics reset.
- classmethod reshapeNtNdArray(ntNdArray)
Reshape NtNdArray object and return tuple with image id, NumPy image array, image dimensions, color mode and NtNdArray value (union) field key.
- Parameter
ntNdArray (NtNdArray) - NtNdArray object
- Returns
Tuple (imageId,image,nx,ny,nz,colorMode,fieldKey).
- start()
Method invoked at processing startup.
- stop()
Method invoked at processing shutdown.
- updateOutputChannel(pvObject)
Method that can be used for publishing processed object on the output PVA channel. It should be invoked by the user application itself as part of the process() method. Typically, there should be no need for overriding this method in the derived class.
- Parameter
pvObject (PvObject) - processed object