pafsim.processor._processor

Module Contents

class pafsim.processor._processor.Processor(name: str, **kwargs)

Bases: abc.ABC

Inheritance diagram of pafsim.processor._processor.Processor

The base class for all processors. It is the API for creating new Processor classes A Processor has to implement a shape-property and a plot function.

Base constructor of the Processor. Can not be initiatied as this class is abstract

Parameters:

name (str) – The unique name of theProcessor

property default: str

Returns the default mode of the specific processor.

Returns:

The default mode

Return type:

str

abstract property shape: tuple
Abstract method should return the output array shape.

Needs to be implemented by inherited classes

Returns:

The shape of the output array

Return type:

tuple

property iformat: list

The input format

Returns:

The input format as a list (label)

Return type:

list

property oformat

The output format

Returns:

The output format as a list (label)

Return type:

list

N_INPUT: int = 0
I_FORMAT: list = []
O_FORMAT: list = []
process()
The process method calls the individual processing functions of the Processors.

The actual processing function which should be executed is specified by the Processors mode

Raises:

TypeError – When no pre-processor is set

abstract plot(path: str = '', figsize: tuple = (8, 4))
Abstract method to plot the output array.

Needs to be implemented by inherited classes

Parameters:
  • path (str, optional) – If set stores the plot in the directory. Defaults to “”.

  • figsize (tuple, optional) – Te size of the figure to plot. Defaults to (8,4).

dim(label: str) int

Returns the size of the requested dimension

Parameters:

label (str) – The label of the dimension (e.g. ‘A’, ‘F’, ‘P’)

Raises:

ValueError – When the processor has no dimension of the passed label

Returns:

The size of the dimension

Return type:

int

setPreProcessor(processor)

Connects the processor with a pre-processor

Parameters:

processor (Processor) – Concret object of the pre-processor

load() numpy.ndarray

Method to load a pickled output dataset. This method is used by sub-classes as a ‘mode’

Raises:

ValueError – When the output format does not match with the loaded dataset

Returns:

The dataset which was loaded

Return type:

np.ndarray

pafsim.processor._processor.getDim(label: str, processor: Processor) int

Returns the index position of the passed processor by its label

Parameters:
  • label (str) – The label of the dimension (e.g. ‘A’, ‘F’, ‘P’)

  • processor (Processor) – The processor

Raises:

ValueError – When the processor has no dimension of the passed label

Returns:

Index of the specific label

Return type:

int