RecordingInterfaceTemplate#

class myogestic.gui.widgets.templates.RecordingInterfaceTemplate(*args, **kwargs)[source]#

Base class for the recording interface of a visual interface.

This class contains the logic and the UI elements of the recording interface of a visual interface.

Parameters:
  • name (str)

  • ui (object | None)

  • incoming_message_signal (SignalInstance | None)

  • ground_truth__nr_of_recording_values (int)

  • ground_truth__task_map (dict[str, int] | None)

_main_window#

The _main_window widget of the visual interface.

Type:

Optional[QObject]

name#

The name of the visual interface.

Type:

str

ui#

The UI layout of the recording interface.

Type:

object

incoming_message_signal#

The incoming message signal of the visual interface.

Type:

PySide6.QtCore.SignalInstance

ground_truth__nr_of_recording_values#

The number of recording values the visual interface sends to MyoGestic.

Type:

int

ground_truth__task_map#

The task map. The keys are the task names and the values are the task indices.

Type:

dict[str, int]

_current_task#

The current task name, set by the RecordProtocol before each recording.

Type:

str

Methods

__init__(main_window[, name, ui, ...])

_set_progress_bar(progress_bar, value, total)

Set the value of a progress bar.

check_recording_completion()

Check if this VI's recording is complete and notify the protocol.

close_event(event)

Close the interface and stop necessary processes.

disable()

Disable all UI elements.

enable()

Enable all UI elements.

get_ground_truth_data()

Get ground truth data collected during recording.

initialize_ui_logic()

Initialize the logic of the UI elements.

save_recording(biosignal, biosignal_timings, ...)

Save the recording.

save_recording_cursor(biosignal, ...)

Save the recording for the cursor.

start_recording_preparation()

Validate state and prepare for recording.

update_ground_truth_buffer(data)

Append incoming ground truth data and update the progress bar.

check_recording_completion()[source]#

Check if this VI’s recording is complete and notify the protocol.

Called after each buffer update to determine whether enough samples have been collected.

Return type:

None

abstractmethod close_event(event)[source]#

Close the interface and stop necessary processes.

Parameters:

event (PySide6.QtGui.QCloseEvent)

Return type:

None

abstractmethod disable()[source]#

Disable all UI elements.

Return type:

None

abstractmethod enable()[source]#

Enable all UI elements.

Return type:

None

get_ground_truth_data()[source]#

Get ground truth data collected during recording.

Returns a dict with ground truth arrays and metadata. Base implementation returns empty data (classification-only). Override in subclasses that collect kinematics.

Return type:

dict

abstractmethod initialize_ui_logic()[source]#

Initialize the logic of the UI elements.

Return type:

None

save_recording(biosignal, biosignal_timings, ground_truth, ground_truth_timings, record_duration, use_as_classification, recording_label, task, ground_truth_sampling_frequency, **kwargs)[source]#

Save the recording.

Parameters:
  • biosignal (numpy.ndarray) – The recorded biosignal data.

  • biosignal_timings (numpy.ndarray) – The recorded biosignal timings.

  • ground_truth (numpy.ndarray) – The recorded ground truth data.

  • ground_truth_timings (numpy.ndarray) – The recorded ground truth timings.

  • record_duration (int | float) – The duration of the recording in seconds.

  • use_as_classification (bool) – Whether to use the recording as classification data.

  • recording_label (str) – The label of the recording.

  • task (str) – The task of the recording.

  • ground_truth_sampling_frequency (int | float) – The sampling frequency of the ground truth data.

  • kwargs (dict) – Additional custom data to save.

Return type:

None

save_recording_cursor(biosignal, biosignal_timings, ground_truth, ground_truth_timings, record_duration, use_as_classification, recording_label, task, movement, task_label_map, ground_truth_sampling_frequency, **kwargs)[source]#

Save the recording for the cursor.

Parameters:
  • biosignal (numpy.ndarray) – The recorded biosignal data.

  • biosignal_timings (numpy.ndarray) – The recorded biosignal timings.

  • ground_truth (numpy.ndarray) – The recorded ground truth data.

  • ground_truth_timings (numpy.ndarray) – The recorded ground truth timings.

  • record_duration (int | float) – The duration of the recording in seconds.

  • use_as_classification (bool) – Whether to use the recording as classification data.

  • recording_label (str) – The label of the recording.

  • task (str) – The task of the recording (cursor direction).

  • movement (str) – The movement associated with the cursor task label.

  • task_label_map (dict[str, int]) – String task to numerical table mapping.

  • ground_truth_sampling_frequency (int | float) – The sampling frequency of the ground truth data.

  • kwargs (dict) – Additional custom data to save.

Return type:

None

start_recording_preparation()[source]#

Validate state and prepare for recording.

Called by the RecordProtocol before each recording starts. Override to clear buffers, calculate expected samples, and validate that the VI is ready to record.

Returns True if the VI is ready, False otherwise.

Return type:

bool

update_ground_truth_buffer(data)[source]#

Append incoming ground truth data and update the progress bar.

Called for each incoming data sample during recording. Override to buffer kinematics data and track progress.

Parameters:

data (ndarray)

Return type:

None