pafsim

Subpackages

Submodules

Package Contents

class pafsim.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

class pafsim.Executor(conf: dict = None)

The Executor enables the simulation of comprehensive simulation configuration with nested Processing chains.

Construct an Executor object

Parameters:

conf (dict, optional) – The discrition of the simulation. Defaults to None.

update(conf: dict)

Updates the current configuration

Parameters:

conf (dict) – the dictionary to update with

Raises:

Exception – raises if the update fails

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

Starts with the execution of the defined processing components

Parameters:

plot (bool, optional) – Plots the data of all components. Defaults to False.

add(chain: pafsim.chain.ProcessingChain)

Adds a processing chain to the execution

Parameters:

chain (ProcessingChain) – Another chain to execute

getVectorById(name: str)

Get a test vector by its ID

Parameters:

name (str) – The ID of a test vector

Returns:

The Vector

Return type:

Vector

getChain(name: str) pafsim.chain.ProcessingChain

Get a registered ProcessingChain object by its name

Parameters:

name (str) – The name of the ProcessingChain

Returns:

The ProcessingChain object if it exists, otherwise None

Return type:

ProcessingChain

class pafsim.Vector(processor: pafsim.processor._processor.Processor = None)

Class to maintain datasets as vectors. Vector objects can be stored and loaded to use them in different simulation setups.

setProcessor(processor: pafsim.processor._processor.Processor)

Set the processor to gather its properties

Parameters:

processor (Processor) – The processor

store(path: str)

Store the vector in a specific directory

Parameters:

path (str) – The location where to store the Vector

load(path: str)

Load a stored vector from disk

Parameters:

path (str) – The location where the vector was stored