hbp_nrp_cle.cle.CLEInterface module

This module represents the interfaces for the closed loop engine.

exception BrainRuntimeException(message)[source]

Bases: Exception

Represents that a exception was raised from the execution of the step in the brain control adapter.

exception BrainTimeoutException[source]

Bases: Exception

Represents that a brain file could not be loaded due to a Timeout

exception ForcedStopException[source]

Bases: Exception

Represents that a closed loop has been forced to quit

class IClosedLoopControl[source]

Bases: object

Represents the closed loop engine synchronization mechanism.

brainsim_elapsed_time()[source]

Gets the time share of the brain simulation

initialize(brain_file, configuration)[source]

Initializes the closed loop engine.

Parameters
  • brain_file – A python PyNN script or an h5 file containing the neural network definition

  • configuration – A set of populations

property is_initialized

Returns True if the simulation is initialized, False otherwise.

load_brain(brain_file, brain_populations=None)[source]

Load (or reload) the brain model from a file the neuronal network file

Parameters
  • brain_file – A python PyNN script or an h5 file containing the neural network definition

  • brain_populations – A (optional) dictionary indexed by population names and containing neuron indices. Neuron indices can be defined by lists of integers or slices. Slices are either python slices or dictionaries containing ‘from’, ‘to’ and ‘step’ values.

load_populations(populations)[source]

Load (or reload) populations into the brain

Parameters

populations – A dictionary indexed by population names and containing neuron indices. Neuron indices can be defined by a single integer, list of integers or python slices. Python slices can be replaced by a dictionary containing the ‘from’, ‘to’ and ‘step’ values.

property real_time

Get the total execution time.

reset()[source]

Reset the orchestrated simulations.

reset_world(sdf_world_string)[source]

Reset the world to the configuration described by sdf_world_string.

robotsim_elapsed_time()[source]

Gets the time share of the robot simulation

run_step(timestep_s)[source]

Runs both simulations for the given time step in seconds.

Parameters

timestep_s – The CLE time step in seconds

Returns

Updated simulation time, otherwise -1

shutdown()[source]

Shuts down both simulations.

property simulation_time

Get the current simulation time.

start()[source]

Starts the orchestrated simulations.

stop(forced=False, in_loop=False)[source]

Stops the orchestrated simulations. Also waits for the current simulation step to end.

Parameters
  • forced – If set, the CLE instance cancels pending tasks

  • in_loop – If set, do not wait for multi-threading signals of pending tasks. It must be set if and only if the function is called by the CLE main loop’s thread.

tf_elapsed_time()[source]

Gets the time share of the Transfer Functions

wait_step(timeout=None)[source]

Wait for the currently running simulation step to end.

Parameters

timeout – The maximum amount of time (in seconds) to wait for the end of this step