# moberndo/mirage91 architecture

> Architecture diagram of the GitHub repository moberndo/mirage91, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moberndo/mirage91
- Repository: https://github.com/moberndo/mirage91

## Overview

Mirage91 is a Graz BCI racing-team codebase with offline EEG analysis and an online brain-computer-interface path. The online entry point resolves an EEG stream, preprocesses chunks, applies a loaded EEGNet model, and publishes predictions to an LSL outlet. Offline modules cover EEG loading/epoch processing and LMDA or sLDA classification. The README gives no detailed architecture; relationships beyond the shown calls are omitted, so game integration and paradigm-to-recording wiring are not asserted.

Main entry points: [`online_scripts/main.py`](https://github.com/moberndo/mirage91/blob/main/online_scripts/main.py) (Online decoder), [`offline_scripts/custom_functions/eeg.py`](https://github.com/moberndo/mirage91/blob/main/offline_scripts/custom_functions/eeg.py) (EEG preprocessing), [`paradigm/bci_racingteam.py`](https://github.com/moberndo/mirage91/blob/main/paradigm/bci_racingteam.py) (Recording paradigm), [`recordings`](https://github.com/moberndo/mirage91/tree/main/recordings) (EEG recordings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Paradigm &amp; Acquisition"]
  node_paradigm["Recording paradigm<br/>[bci_racingteam.py]"]
  node_recordings["EEG recordings"]
end

subgraph group_online["Online Decoding"]
  node_online_entry["Online decoder<br/>[main.py]"]
  node_online_pipeline["Stream preprocessing"]
  node_predictions["Prediction LSL outlet"]
end

subgraph group_offline["Offline Analysis"]
  node_offline_run["Offline training runner<br/>[run.py]"]
  node_eeg_data["EEG preprocessing<br/>[eeg.py]"]
  node_pilot["Pilot session<br/>[pilot.py]"]
  node_feature_extract["Feature extraction"]
  node_lmda_train["LMDA training"]
  node_slda_analysis["CSP and sLDA analysis"]
end

subgraph group_models["Classifier Models"]
  node_eegnet["EEGNet<br/>[EEGNet.py]"]
  node_lmda_model["LMDA network<br/>[LMDA_modified.py]"]
  node_slda["sLDA classifier<br/>[slda.py]"]
end

node_participant(("BCI participant"))
node_lsl_eeg["EEG LSL stream"]
node_game(("Racing game"))

node_participant -.->|"performs"| node_paradigm
node_paradigm -.->|"records data"| node_recordings
node_lsl_eeg -->|"streams samples"| node_online_entry
node_online_entry -->|"preprocesses chunks"| node_online_pipeline
node_online_entry -->|"classifies chunks"| node_eegnet
node_online_entry -->|"publishes predictions"| node_predictions
node_predictions -.->|"supplies control"| node_game
node_offline_run -->|"starts training"| node_lmda_train
node_lmda_train -->|"uses network"| node_lmda_model
node_pilot -->|"creates EEG data"| node_eeg_data
node_feature_extract -->|"uses EEG utilities"| node_eeg_data
node_recordings -.->|"loads sessions"| node_eeg_data
node_slda_analysis -.->|"uses classifier"| node_slda

click node_paradigm "https://github.com/moberndo/mirage91/blob/main/paradigm/bci_racingteam.py"
click node_recordings "https://github.com/moberndo/mirage91/tree/main/recordings"
click node_online_entry "https://github.com/moberndo/mirage91/blob/main/online_scripts/main.py"
click node_online_pipeline "https://github.com/moberndo/mirage91/blob/main/online_scripts/OnlineProcessingPipeline.py"
click node_eegnet "https://github.com/moberndo/mirage91/blob/main/online_scripts/classifier_functions/EEGNet.py"
click node_offline_run "https://github.com/moberndo/mirage91/blob/main/offline_scripts/run.py"
click node_eeg_data "https://github.com/moberndo/mirage91/blob/main/offline_scripts/custom_functions/eeg.py"
click node_pilot "https://github.com/moberndo/mirage91/blob/main/offline_scripts/custom_functions/pilot.py"
click node_feature_extract "https://github.com/moberndo/mirage91/blob/main/offline_scripts/feature_extraction.py"
click node_lmda_train "https://github.com/moberndo/mirage91/blob/main/offline_scripts/classifier_LMDA_PhS.py"
click node_lmda_model "https://github.com/moberndo/mirage91/blob/main/offline_scripts/classifier_functions/LMDA_modified.py"
click node_slda "https://github.com/moberndo/mirage91/blob/main/offline_scripts/classifier_functions/slda.py"
click node_slda_analysis "https://github.com/moberndo/mirage91/blob/main/offline_scripts/classifier_sLDA_ObM.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_paradigm,node_recordings toneBlue
class node_online_entry,node_online_pipeline,node_predictions toneAmber
class node_offline_run,node_eeg_data,node_pilot,node_feature_extract,node_lmda_train,node_slda_analysis toneMint
class node_eegnet,node_lmda_model,node_slda toneRose
class node_participant,node_lsl_eeg,node_game toneIndigo
```

## Components

### Paradigm & Acquisition

- [Recording paradigm](https://github.com/moberndo/mirage91/blob/main/paradigm/bci_racingteam.py): `paradigm/bci_racingteam.py`
- [EEG recordings](https://github.com/moberndo/mirage91/tree/main/recordings): `recordings`

### Online Decoding

- [Online decoder](https://github.com/moberndo/mirage91/blob/main/online_scripts/main.py): `online_scripts/main.py`
- [Stream preprocessing](https://github.com/moberndo/mirage91/blob/main/online_scripts/OnlineProcessingPipeline.py): `online_scripts/OnlineProcessingPipeline.py`
- **Prediction LSL outlet**

### Offline Analysis

- [Offline training runner](https://github.com/moberndo/mirage91/blob/main/offline_scripts/run.py): `offline_scripts/run.py`
- [EEG preprocessing](https://github.com/moberndo/mirage91/blob/main/offline_scripts/custom_functions/eeg.py): `offline_scripts/custom_functions/eeg.py`
- [Pilot session](https://github.com/moberndo/mirage91/blob/main/offline_scripts/custom_functions/pilot.py): `offline_scripts/custom_functions/pilot.py`
- [Feature extraction](https://github.com/moberndo/mirage91/blob/main/offline_scripts/feature_extraction.py): `offline_scripts/feature_extraction.py`
- [LMDA training](https://github.com/moberndo/mirage91/blob/main/offline_scripts/classifier_LMDA_PhS.py): `offline_scripts/classifier_LMDA_PhS.py`
- [CSP and sLDA analysis](https://github.com/moberndo/mirage91/blob/main/offline_scripts/classifier_sLDA_ObM.py): `offline_scripts/classifier_sLDA_ObM.py`

### Classifier Models

- [EEGNet](https://github.com/moberndo/mirage91/blob/main/online_scripts/classifier_functions/EEGNet.py): `online_scripts/classifier_functions/EEGNet.py`
- [LMDA network](https://github.com/moberndo/mirage91/blob/main/offline_scripts/classifier_functions/LMDA_modified.py): `offline_scripts/classifier_functions/LMDA_modified.py`
- [sLDA classifier](https://github.com/moberndo/mirage91/blob/main/offline_scripts/classifier_functions/slda.py): `offline_scripts/classifier_functions/slda.py`

### Other components

- **BCI participant**
- **EEG LSL stream**
- **Racing game**

## Connections

- BCI participant → Recording paradigm: performs
- Recording paradigm → EEG recordings: records data
- EEG LSL stream → Online decoder: streams samples (evidence: `online_scripts/main.py`)
- Online decoder → Stream preprocessing: preprocesses chunks (evidence: `online_scripts/main.py`)
- Online decoder → EEGNet: classifies chunks (evidence: `online_scripts/main.py`)
- Online decoder → Prediction LSL outlet: publishes predictions (evidence: `online_scripts/main.py`)
- Prediction LSL outlet → Racing game: supplies control
- Offline training runner → LMDA training: starts training (evidence: `offline_scripts/run.py`)
- LMDA training → LMDA network: uses network (evidence: `offline_scripts/classifier_LMDA_PhS.py`)
- Pilot session → EEG preprocessing: creates EEG data (evidence: `offline_scripts/custom_functions/pilot.py`)
- Feature extraction → EEG preprocessing: uses EEG utilities (evidence: `offline_scripts/feature_extraction.py`)
- EEG recordings → EEG preprocessing: loads sessions
- CSP and sLDA analysis → sLDA classifier: uses classifier
