training_protocol_base
Classes
|
Class to hold training settings values. |
Base class for defining training protocols and managing settings. |
Exceptions
|
Exception raised for errors in the TrainingProtocol class. |
- exception TrainingError(message)[source]
Bases:
ExceptionException raised for errors in the TrainingProtocol class.
- class Settings[source]
Bases:
objectClass to hold training settings values.
- class TrainingProtocolBase[source]
Bases:
objectBase class for defining training protocols and managing settings.
Training protocols dictate how settings change over sessions based on subject performance.
- check_variables() None[source]
Validates that all required settings are present and of the correct type.
- Raises:
TrainingError – If a required variable is invalid or missing.
- default_training_settings() None[source]
Sets the default values for the training settings. Must be overridden.
- update_training_settings() None[source]
Updates the settings based on performance. Must be overridden.
- define_gui_tabs() None[source]
Defines the tabs and organization for the GUI settings editor.
- copy_settings() None[source]
Copies current settings to default settings and validates them.
- get_settings_names() list[str][source]
Returns a list of all setting names, including defaults and extras.
- Returns:
list of setting names.
- Return type:
list[str]
- get_dict(exclude: list[str] = []) dict[str, Any][source]
Returns the current settings as a dictionary.
- Parameters:
exclude (list[str], optional) – List of keys to exclude. Defaults to [].
- Returns:
Dictionary of settings.
- Return type:
dict[str, Any]
- get_default_dict() dict[str, Any][source]
Returns the default settings as a dictionary.
- Returns:
Dictionary of default settings.
- Return type:
dict[str, Any]
- get_jsonstring(exclude: list[str] = []) str[source]
Returns the current settings as a JSON string.
- Parameters:
exclude (list[str], optional) – List of keys to exclude. Defaults to [].
- Returns:
JSON representation of settings.
- Return type:
str
- load_settings_from_dict(current_dict: dict[str, Any]) list[str][source]
Loads settings from a dictionary, correcting types where necessary.
- Parameters:
current_dict (dict[str, Any]) – Dictionary containing new setting values.
- Returns:
List of keys that failed type correction.
- Return type:
list[str]
- load_settings_from_jsonstring(current_value: str) None[source]
Loads settings from a JSON string.
- Parameters:
current_value (str) – JSON string of settings.
- restore() None[source]
Restores all settings to their default values.
- get_jsonstring_from_jsonstring(current_value: str) str[source]
Merges a JSON string with defaults and returns a valid JSON string.
- Parameters:
current_value (str) – Input JSON string.
- Returns:
Merged JSON string.
- Return type:
str
- correct_types_in_dict(current_dict: dict[str, Any]) Tuple[list[str], dict[str, Any]][source]
Ensures that dictionary values match the types of default settings.
- get_string() str[source]
Returns the settings as a JSON string with corrected types.
- Returns:
JSON string of settings.
- Return type:
str