pafsim.chain

Module Contents

class pafsim.chain.ProcessingChain(conf: dict, name: str = '')

The ProcessingChain class provides an interface to connect Processor objects together by constructing a directed acyclic graph (DAG).

Construct a ProcessingChain object

Parameters:
  • conf (dict) – A dictionary that describes the DAG. See ‘example/pafsim_config.json’ for a concrect example.

  • name (str, optional) – When creating multiple ProcessingChain objects with dependencies, a name can be provided to refer to dependend ProcessingChains. Defaults to “”.

setup()

Sets up the DAG by instantiating Processor object and populating the edges and nodes

populate()

Populate the DAG under the use of the networkx-module

addProcessor(obj: pafsim.processor.Processor)

Adds a processor object to the Graph. Can be used to construct a Graph from objects rather than from configurations (input dictionary). However, this function can be used to inject a new Processor to an existing Graph

Parameters:

obj (processing.Processor) – The processor object to add

getProcessor(name: str) pafsim.processor.Processor

Returns a Processor object by its name / ID

Parameters:

name (str) – The name of the Processor

Returns:

The Processor if the ID exists in the chain, otherwise returns

None

Return type:

processing.Processor

plot(path: str = '', figsize: tuple = (8, 4))

Plots the DAG

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

  • figsize (tuple, optional) – Size of the plotted figure. Defaults to (8,4).

process()

Starts the processing of all Processors from top to bottom

Raises:

Exception – If the ProcessingChain.setup() method was not called before ProcessingChain.process()

plotAll(path: str = '', figsize: tuple = (8, 4))

Calls all plot methods of the processors

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

  • figsize (tuple, optional) – Size of the plotted figure. Defaults to (8,4).

Raises:

Exception – If the ProcessingChain.process() method was not called before ProcessingChain.plotAll()

save(plot: bool = True, overwrite: bool = True)

Stores the configurations and marked vectors of the procesing chains in dedicated folders

Parameters:
  • plot (bool, optional) – If set to True, stores the plots of all data. Defaults to True.

  • overwrite (bool, optional) – If set to True, overwrites existing dataset with the same storage location. Defaults to True