pathsim.blocks.function module
- class pathsim.blocks.function.Function(func=<function Function.<lambda>>)[source]
Bases:
BlockArbitrary MIMO function block, defined by a callable object, i.e. function or lambda expression.
The function can have multiple arguments that are then provided by the input channels of the function block.
Form multi input, the function has to specify multiple arguments and for multi output, the aoutputs have to be provided as a tuple or list.
- Parameters:
func (callable) – MIMO function that defines block IO behaviour
Notes
If the outputs are provided as a single numpy array, they are considered a single output
Example
consider the function:
func = lambda a, b, c : (a**2, a*b, b/c)
then the input channels of the block are assigned to the function arguments following this scheme:
inputs[0] -> a inputs[1] -> b inputs[2] -> c
and the function outputs are assigned to the output channels of the block in the same way:
a**2 -> outputs[0] a*b -> outputs[1] b/c -> outputs[2]