Utility Classes

This is a collection of utility classes that are used within various examples of ThoughtForge clients.

Behavior Interface

class thoughtforge_client.utils.behavior_interface.BehaviorInterface
This class acts as an interface for composable behaviors for use with the ThoughtForge platform. Internalizes.
the specification of network topology and interfacing with the sensors and Motors.

get_motor_outputs(motor_dict)
This function is intended to return an array of motor outputs but can be composed from separate behaviors.

preprocess_specification(json_specification)
This function takes the parameters from the ‘preprocessor_specification’ of the specification file, and uses it to generate an output json specification for a network topology and sensor/motor definitions

update_sensor_values(obs, reset=False)
This function takes in the observation space and returns a dictionary of sensor names and values calculated from the observation space. If Reset is true, then this indicates an interruption in the temporal steam.

Client Param Utilities

thoughtforge_client.utils.client_param_utils.load_client_params(file_name)
return json client configuration from the given filename

thoughtforge_client.utils.client_param_utils.safe_dict_get(dict, keyName, default)
Utility function for accessing dictionary values

Sensor and Motor Groups

class thoughtforge_client.utils.sensor_motor_groups.SensorGroup(update_function, base_sensor_name)

This is a simple abstraction to consolidate handling for a simple sensor value with possibly multiple entry points into the network.

update_sensor_group(sensor_values_dict)

Queries for updated sensor values and sets the sensor values appropriately.

Signals and Derivatives Utilities

class
thoughtforge_client.utils.signals_and_derivatives.SignalAndDerivatives(num_derivatives)
Utility class for simple tracking of derivatives of sensor signal values.


get_value(deriv=0)
Returns the current value for the requested derivative.

reset(new_signal_value=0)
Reset derivative trackers to zero.

update(new_value)
Update the derivative value chain.

Value Delta class

class
thoughtforge_client.utils.value_delta.ValueDelta(last_value=0)
ValueDelta is a utility class for tracking the change in a value over time. This is commonly used in sensor definitions to get the derivative of a changing continuous value.

reset(reset_value=0)
Indicates an interruption in the data stream.

‍‍update_and_get_delta(new_value)
Updates the current value of the value stream and returns the delta from last value.