pathsim.utils.portreference module¶
- class pathsim.utils.portreference.PortReference(block=None, ports=None)[source]¶
Bases:
objectContainer class that holds a reference to a block and a list of ports. Optimized with cached integer indices for ultra-fast transfers.
Note
The default port, when no ports are defined in the arguments is 0.
- Parameters:
- block¶
- ports¶
- to(other)[source]¶
Transfer the data between two PortReference instances, in this direction self -> other. From outputs to inputs.
Uses numpy fancy indexing with cached integer indices.
- Parameters:
other (PortReference) – the PortReference instance to transfer data to from self
- get_inputs()[source]¶
Return the input values of the block at specified ports
- Returns:
out – input values of block
- Return type:
- set_inputs(vals)[source]¶
Set the block inputs with values at specified ports
- Parameters:
vals (array-like) – values to set at block input ports
- get_outputs()[source]¶
Return the output values of the block at specified ports
- Returns:
out – output values of block
- Return type: