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

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: 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

AdOutputFileProcessor

class pvapy.hpc.adOutputFileProcessor.AdOutputFileProcessor

Bases: AdImageProcessor

Streaming framework processor class that can be used for saving Area Detector images into files. Configuration dictionary should provide the following settings:

- outputDirectory (str) : defines full path to the output directory

- outputFileNameFormat (str) : defines format to be used for naming output files, e.g. ‘{uniqueId:06}.{processorId}.tiff’

AdImageProcessor(configDict)

Parameter:

configDict (dict) - dictionary containing configuration parameters

BYTES_IN_MEGABYTE = 1000000
configure(configDict)

Method invoked at user initiated runtime configuration changes. It looks for ‘outputDirectory’ and ‘outputFileNameFormat’ in the configuration dictionary and reconfigures processor behavior according to the specified values.

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 processor statistics (number of files and bytes saved and corresponding processing/storage rates).

Returns:

Dictionary containing processor statistics parameters

getStatsPvaTypes()

Method invoked at processing startup. It defines processor part of the status PvObject published on the status PVA channel.

Returns:

Dictionary containing PVA types for the processor statistics parameters

process(pvObject)

Method invoked every time input channel updates its PV record. It reshapes input NtNdArray object and saves image data into output file.

Parameter:

pvObject (NtNdArray) - 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. It resets total processing time, as well as counters for the number of files and for the total number of bytes saved.

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

DataDecryptor

class pvapy.hpc.dataDecryptor.DataDecryptor

Bases: UserDataProcessor

Processor class for decrypting data and publishing it on the output channel. This class should be used as a base for decrypting specific PVA types. The configuration dictionary should provide the following settings:

- privateKeyFilePath (str) : defines full path to the RSA private key in PEM format.

- verify (bool) : if True, encrypted data will be verified (default: False)

DataDecryptor(configDict)

Parameter:

configDict (dict) - dictionary containing configuration parameters

configure(configDict)

Method invoked at user initiated runtime configuration changes. It looks for ‘privateKeyFilePath’ and ‘verify’ in the configuration dictionary and reconfigures processor according to the specified value.

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 processor statistics (number of files and bytes saved and corresponding processing/storage rates).

Returns:

Dictionary containing processor statistics parameters

getStatsPvaTypes()

Method invoked at processing startup. It defines processor part of the status PvObject published on the status PVA channel.

Returns:

Dictionary containing PVA types for the processor statistics parameters

process(pvObject)

Method invoked every time input channel updates its PV record. It encrypts input object and publishes result on the output channel

Parameter:

pvObject (PvObject) - channel monitor update object

resetStats()

Method invoked at user initiated application statistics reset. It resets total processing time, as well as counters for the number of processed objects.

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

AdImageDataDecryptor

class pvapy.hpc.adImageDataDecryptor.AdImageDataDecryptor

Bases: DataDecryptor

Processor for decrypting Area Detector image data. The configuration dictionary should provide the following settings:

- privateKeyFilePath (str) : defines full path to the RSA private key in PEM format.

- verify (bool) : if True, encrypted data will be verified (default: False)

AdImageDataDecryptor(configDict)

Parameter:

configDict (dict) - dictionary containing configuration parameters

configure(configDict)

Method invoked at user initiated runtime configuration changes. It looks for ‘privateKeyFilePath’ and ‘verify’ in the configuration dictionary and reconfigures processor according to the specified value.

Parameter:

configDict (dict) - dictionary containing configuration parameters

getOutputPvObjectType()

Method invoked at processing startup. It defines PVA structure of the output (processed) PvObject.

Returns:

NtNdArray object

getStats()

Method invoked periodically for generating processor statistics (number of files and bytes saved and corresponding processing/storage rates).

Returns:

Dictionary containing processor statistics parameters

getStatsPvaTypes()

Method invoked at processing startup. It defines processor part of the status PvObject published on the status PVA channel.

Returns:

Dictionary containing PVA types for the processor statistics parameters

process(pvObject)

Method invoked every time input channel updates its PV record. It encrypts input object and publishes result on the output channel

Parameter:

pvObject (PvObject) - channel monitor update object

resetStats()

Method invoked at user initiated application statistics reset. It resets total processing time, as well as counters for the number of processed objects.

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

DataEncryptor

class pvapy.hpc.dataEncryptor.DataEncryptor

Bases: UserDataProcessor

Processor class for encrypting data and publishing it on the output channel. This class should be used as a base for encrypting specific PVA types. The configuration dictionary should provide the following settings:

- privateKeyFilePath (str) : defines full path to the RSA private key in PEM format.

- sign (bool) : if True, encrypted data will be signed (default: False)

DataEncryptor(configDict)

Parameter:

configDict (dict) - dictionary containing configuration parameters

configure(configDict)

Method invoked at user initiated runtime configuration changes. It looks for ‘privateKeyFilePath’ and ‘sign’ in the configuration dictionary and reconfigures processor according to the specified value.

Parameter:

configDict (dict) - dictionary containing configuration parameters

getOutputPvObjectType()

Method invoked at processing startup. It defines PVA structure of the output (processed) PvObject.

Returns:

PvObject with the same structure as generated by the process() method

getStats()

Method invoked periodically for generating processor statistics (number of files and bytes saved and corresponding processing/storage rates).

Returns:

Dictionary containing processor statistics parameters

getStatsPvaTypes()

Method invoked at processing startup. It defines processor part of the status PvObject published on the status PVA channel.

Returns:

Dictionary containing PVA types for the processor statistics parameters

process(pvObject)

Method invoked every time input channel updates its PV record. It encrypts input object and publishes result on the output channel

Parameter:

pvObject (PvObject) - channel monitor update object

resetStats()

Method invoked at user initiated application statistics reset. It resets total processing time, as well as counters for the number of processed objects.

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

AdImageDataEncryptor

class pvapy.hpc.adImageDataEncryptor.AdImageDataEncryptor

Bases: DataEncryptor

Processor for encrypting Area Detector image data. The configuration dictionary should provide the following settings:

- privateKeyFilePath (str) : defines full path to the RSA private key in PEM format.

- sign (bool) : if True, encrypted data will be signed (default: False)

AdImageDataEncryptor(configDict)

Parameter:

configDict (dict) - dictionary containing configuration parameters

configure(configDict)

Method invoked at user initiated runtime configuration changes. It looks for ‘privateKeyFilePath’ and ‘sign’ in the configuration dictionary and reconfigures processor according to the specified value.

Parameter:

configDict (dict) - dictionary containing configuration parameters

getOutputPvObjectType()

Method invoked at processing startup. It defines PVA structure of the output (processed) PvObject.

Returns:

PvObject with the same structure as generated by the process() method

getStats()

Method invoked periodically for generating processor statistics (number of files and bytes saved and corresponding processing/storage rates).

Returns:

Dictionary containing processor statistics parameters

getStatsPvaTypes()

Method invoked at processing startup. It defines processor part of the status PvObject published on the status PVA channel.

Returns:

Dictionary containing PVA types for the processor statistics parameters

process(pvObject)

Method invoked every time input channel updates its PV record. It encrypts input object and publishes result on the output channel

Parameter:

pvObject (PvObject) - channel monitor update object

resetStats()

Method invoked at user initiated application statistics reset. It resets total processing time, as well as counters for the number of processed objects.

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