eegprep.EEGPrepSession#

class eegprep.EEGPrepSession(EEG=<factory>, ALLEEG=<factory>, CURRENTSET=<factory>, ALLCOM=<factory>, LASTCOM='', STUDY=None, CURRENTSTUDY=0, PLUGINLIST=<factory>)#

Bases: object

EEGLAB-like GUI state without module globals.

Parameters:
__init__(EEG=<factory>, ALLEEG=<factory>, CURRENTSET=<factory>, ALLCOM=<factory>, LASTCOM='', STUDY=None, CURRENTSTUDY=0, PLUGINLIST=<factory>)#
Parameters:
Return type:

None

Methods

__init__([EEG, ALLEEG, CURRENTSET, ALLCOM, ...])

add_change_listener(listener)

Register a callback that runs after session state changes.

add_command_echo_listener(listener)

Register a callback for GUI commands to display in the console.

add_gui_action_listener(listener)

Register a callback for GUI action start/end notifications.

add_history(command, *[, notify])

Append an EEGLAB-style command to session history.

begin_gui_action(action)

Notify listeners that a GUI action is about to run.

clear_all()

Clear all datasets and study state.

clone_current()

Return a deep copy of the current EEG selection.

current_eeg()

Return the current EEG selection.

current_set_value()

Return EEGLAB-style CURRENTSET scalar/list value.

dataset_summaries()

Return (index, label, selected) tuples for the Datasets menu.

delete_current()

Delete the current dataset selection from memory.

echo_command(command)

Display a GUI command without mutating session history.

end_gui_action(action)

Notify listeners that a GUI action has finished.

gui_action(action)

Wrap a user-triggered GUI action for console/output synchronization.

mark_current_saved()

Mark the current dataset selection as saved in EEG and ALLEEG.

menu_statuses()

Return EEGLAB-style menu status tokens for the current state.

notify_changed()

Notify listeners that session-backed state changed.

remove_change_listener(listener)

Remove a previously registered session change callback.

remove_command_echo_listener(listener)

Remove a previously registered command echo callback.

remove_gui_action_listener(listener)

Remove a previously registered GUI action callback.

retrieve(indices)

Select dataset(s) from ALLEEG using 1-based indices.

select_study(*[, command])

Select the current STUDY set in the shared workspace.

selected_dataset_indices()

Return the selected EEGLAB-facing dataset indices in order.

set_study(study[, alleeg, command])

Set STUDY/CURRENTSTUDY and optionally replace loaded datasets.

store_current(eeg, *[, new, command, ...])

Store eeg in ALLEEG and select it.

Attributes

EEG: dict[str, Any] | list[dict[str, Any]]#
ALLEEG: list[dict[str, Any]]#
CURRENTSET: list[int]#
ALLCOM: list[str]#
LASTCOM: str = ''#
STUDY: dict[str, Any] | None = None#
CURRENTSTUDY: int = 0#
PLUGINLIST: list[dict[str, Any]]#
add_change_listener(listener)#

Register a callback that runs after session state changes.

Parameters:

listener (Callable[[EEGPrepSession], None])

Return type:

None

remove_change_listener(listener)#

Remove a previously registered session change callback.

Parameters:

listener (Callable[[EEGPrepSession], None])

Return type:

None

add_command_echo_listener(listener)#

Register a callback for GUI commands to display in the console.

Parameters:

listener (Callable[[str], None])

Return type:

None

remove_command_echo_listener(listener)#

Remove a previously registered command echo callback.

Parameters:

listener (Callable[[str], None])

Return type:

None

add_gui_action_listener(listener)#

Register a callback for GUI action start/end notifications.

Parameters:

listener (Callable[[str, str], None])

Return type:

None

remove_gui_action_listener(listener)#

Remove a previously registered GUI action callback.

Parameters:

listener (Callable[[str, str], None])

Return type:

None

begin_gui_action(action)#

Notify listeners that a GUI action is about to run.

Parameters:

action (str)

Return type:

None

end_gui_action(action)#

Notify listeners that a GUI action has finished.

Parameters:

action (str)

Return type:

None

gui_action(action)#

Wrap a user-triggered GUI action for console/output synchronization.

Parameters:

action (str)

Return type:

Iterator[None]

echo_command(command)#

Display a GUI command without mutating session history.

Parameters:

command (str | None)

Return type:

None

notify_changed()#

Notify listeners that session-backed state changed.

Return type:

None

current_eeg()#

Return the current EEG selection.

Return type:

dict[str, Any] | list[dict[str, Any]]

current_set_value()#

Return EEGLAB-style CURRENTSET scalar/list value.

Return type:

int | list[int]

selected_dataset_indices()#

Return the selected EEGLAB-facing dataset indices in order.

Return type:

list[int]

store_current(eeg, *, new=False, command='', mark_saved=False, index=None)#

Store eeg in ALLEEG and select it.

Parameters:
Return type:

int | list[int]

retrieve(indices)#

Select dataset(s) from ALLEEG using 1-based indices.

Parameters:

indices (int | list[int])

Return type:

dict[str, Any] | list[dict[str, Any]]

apply_workspace_state(*, eeg=<object object>, alleeg=<object object>, currentset=<object object>, allcom=<object object>, lastcom=<object object>, study=<object object>, currentstudy=<object object>, command='', append_dataset_history=False)#

Apply a GUI/console workspace update as one session transaction.

Parameters:
  • eeg (Any)

  • alleeg (Any)

  • currentset (Any)

  • allcom (Any)

  • lastcom (Any)

  • study (Any)

  • currentstudy (Any)

  • command (str)

  • append_dataset_history (bool)

Return type:

None

delete_current()#

Delete the current dataset selection from memory.

Return type:

None

clear_all()#

Clear all datasets and study state.

Return type:

None

set_study(study, alleeg=None, *, command='')#

Set STUDY/CURRENTSTUDY and optionally replace loaded datasets.

Parameters:
Return type:

None

select_study(*, command='CURRENTSTUDY = 1')#

Select the current STUDY set in the shared workspace.

Parameters:

command (str)

Return type:

None

add_history(command, *, notify=True)#

Append an EEGLAB-style command to session history.

Parameters:
  • command (str | None)

  • notify (bool)

Return type:

None

clear_history(*, notify=True)#

Clear command history and LASTCOM as one session mutation.

Parameters:

notify (bool)

Return type:

None

remove_history(count, *, notify=True)#

Remove the most recent count command-history entries.

Parameters:
Return type:

None

history_command_at(index)#

Return the 1-based command from most recent history first.

Parameters:

index (int)

Return type:

str

clear_last_command(*, notify=True)#

Clear LASTCOM without deleting ALLCOM.

Parameters:

notify (bool)

Return type:

None

mark_current_saved()#

Mark the current dataset selection as saved in EEG and ALLEEG.

Return type:

None

menu_statuses()#

Return EEGLAB-style menu status tokens for the current state.

Return type:

set[str]

dataset_summaries()#

Return (index, label, selected) tuples for the Datasets menu.

Return type:

list[tuple[int, str, bool]]

clone_current()#

Return a deep copy of the current EEG selection.

Return type:

dict[str, Any] | list[dict[str, Any]]