finam.IAdapter#
- class finam.IAdapter[source]#
-
Interface for adapters.
- Attributes:
info
Info: The input’s data info.
is_static
Whether the input is static
memory_limit
The memory limit for this slot
memory_location
The memory-mapping location for this slot
metadata
The adapter’s meta data.
name
Input name.
needs_pull
bool: if the input needs pull.
needs_push
bool: if the input needs push.
source
Get the input’s source output or adapter
targets
Get target inputs and adapters for this output.
time
The output’s time of the latest available data
Methods
add_target
(target)Add a target input or adapter for this output.
chain
(other)Chain outputs and adapters.
exchange_info
(info)Exchange the data info with the input's source.
finalize
()Finalize the output
get_data
(time, target)Get the output's data-set for the given time.
get_info
(info)Exchange and get the output's data info.
has_info
()Returns if the output has a data info.
notify_targets
(time)Notify all targets by calling their
source_updated(time)
method.ping
()Pings upstream to inform outputs about the number of connected inputs.
pinged
(source)Called when receiving a ping from a downstream input.
pull_data
(time, target)Retrieve the data from the input's source.
push_data
(data, time)Push data into the output.
push_info
(info)Push data info into the output.
source_updated
(time)Informs the input that a new output is available.
- abstract property metadata#
The adapter’s meta data. Will only be called after the connect phase of the composition.
- abstract add_target(target)#
Add a target input or adapter for this output.
- Parameters:
target (
IInput
) – The target to add.
- abstract chain(other)#
Chain outputs and adapters.
- abstract exchange_info(info)#
Exchange the data info with the input’s source.
- abstract finalize()#
Finalize the output
- abstract get_data(time, target)#
Get the output’s data-set for the given time.
- Parameters:
- Returns:
data-set for the requested time.
- Return type:
- Raises:
FinamNoDataError – Raises the error if no data is available
- abstract get_info(info)#
Exchange and get the output’s data info.
- Parameters:
info (
Info
) – Requested data info- Returns:
Delivered data info
- Return type:
- Raises:
FinamNoDataError – Raises the error if no info is available
- abstract has_info()#
Returns if the output has a data info.
The info is not required to be validly exchanged.
- abstract property is_static#
Whether the input is static
- abstract property memory_limit#
The memory limit for this slot
- abstract property memory_location#
The memory-mapping location for this slot
- abstract property name#
Input name.
- abstract notify_targets(time)#
Notify all targets by calling their
source_updated(time)
method.- Parameters:
time (
datetime
) – Simulation time of the simulation.
- abstract ping()#
Pings upstream to inform outputs about the number of connected inputs.
Must be called after linking and before the connect phase.
- abstract pinged(source)#
Called when receiving a ping from a downstream input.
- Parameters:
source (
IInput
) – Pinging target end point
- abstract pull_data(time, target)#
Retrieve the data from the input’s source.
- Parameters:
- Returns:
Data set for the given simulation time.
- Return type:
- abstract push_data(data, time)#
Push data into the output.
Should notify targets, and can handle the provided date.
- Parameters:
data (array_like) – Data set to push.
time (
datetime
) – Simulation time of the data set.
- abstract push_info(info)#
Push data info into the output.
- Parameters:
info (
Info
) – Delivered data info
- abstract property source#
Get the input’s source output or adapter
- Returns:
The input’s source.
- Return type:
- abstract source_updated(time)#
Informs the input that a new output is available.
- Parameters:
time (
datetime
) – Simulation time of the notification.
- abstract property targets#
Get target inputs and adapters for this output.
- Returns:
List of targets.
- Return type:
- abstract property time#
The output’s time of the latest available data