Jump to content

User Reference:BCI2000Watchdog: Difference between revisions

From BCI2000 Wiki
Mellinger (talk | contribs)
Mellinger (talk | contribs)
Line 38: Line 38:
The following command line arguments are supported:
The following command line arguments are supported:
===--Ini=<IniFile>===
===--Ini=<IniFile>===
Specify a .ini file as written by BCI2000Watchdog program. To create a suitable .ini file, run the BCI2000Watchdog program interactively and configure as desired. '''After closing''' the program's window, rename and optionally move the BCI2000Watchdog.ini file as you see fit.
Specify the path of a .ini file to use instead of the default. The given .ini file will be used both for reading and writing at program termination.


===--Autostart===
===--Autostart===

Revision as of 20:54, 16 July 2024

Introduction

BCI2000Watchdog is a program that monitors the function of a running BCI2000 instance, and restarts it if malfunction is detected. Functioning of BCI2000 is determined by monitoring "Canary expressions" which are evaluated in the context of BCI2000 and are expected to change on a regular basis, e.g. the time stamp of the currently processed data block, and/or the frame number of a video recorded alongside brain signal signal data.

Using BCI2000Watchdog Interactively

Selecting a BCI2000 Startup Batch File

The top element of BCI2000Watchdog holds the full path to a BCI2000 startup batch file. This may be any BCI2000 batch file, except that it must contain the SET CONFIG and START commands. If the batch file does not contain these commands, SetConfig and Start must be presses manually, so the watchdog will be unable to start operation of BCI2000 when it tries to restart it.

Pressing the "..." button at the right side of the edit field will bring up a file selection dialog, so you don't need to enter the full path manually.

Also, dragging a batch file onto the edit field will enter the file's full path.

In addition, a batch file may be given on the command line when starting up BCI2000Watchdog, or by dragging-and-dropping onto the program's icon.

Entering Canary Expressions (Watches)

By default, the watchdog observes changes in the SourceTime BCI2000 state and gives alarm when the SourceTime state has not changed for 2 seconds. In a live BCI2000 system, the SourceTime state changes with each BCI2000 data block, so if it stays constant for 2 seconds, this is an indication that the BCI2000 system has ceased to function. The default of 2 seconds has been chosen to make sure not to interfere with recordings that have very large sample block duration.

For testing data acquisition functionality in BCI2000, observing the SourceTime state should be sufficient. However, when recording video or other auxiliary data, the respective data stream might be broken without affecting the SourceTime state. In these cases, it will be useful to add an expression that covers the respective partial functionality. E.g., to ensure functionality of recording from the first attached webcam, you would enter an expression of WebcamFrame0.

Starting BCI20000

To start up BCI20000 by executing the specified BCI2000 batch file, click the "Start BCI20000" button at the bottom of the window. Whenever BCI20000 is running, the "Start BCI2000" button is disabled, and the "Terminate BCI20000" button is enabled. Clicking the "Terminate BCI20000" button will terminate BCI20000, and then switch the watchdog to idle mode.

Recovering from an Error

Certain conditions may put the watchdog into an error state. Typically, these represent unexpected behavior of BCI2000. If an error condition is met, an error message is appended to the log, and printed in red. Also, both the start and the termination button will be disabled, and the watchdog will not perform any actions any more. To recover from an error condition, click "Reset" at the bottom left of the watchdog window.

Automating BCI2000Watchdog from the Command Line

For scenarios in which interactive use is not desired (e.g., in a clinical setting), BCI2000Watchdog's behavior may be determined through command line arguments which may be put into an operating system batch or script file.

The following command line arguments are supported:

--Ini=<IniFile>

Specify the path of a .ini file to use instead of the default. The given .ini file will be used both for reading and writing at program termination.

--Autostart

Start BCI2000 operation as if "Start BCI2000" had been clicked after startup.

--UILevel=<n>

User interface level from 1 to 3:

1 Only display "Start BCI2000" and "Terminate BCI2000" buttons, disable the "Close" button,
2 Display "Reset", "Start BCI2000", "Terminate BCI2000" buttons and the log,
3 Display full UI.