Skip to content

ChenYY-Offical/EEG-ECG-TGAM-Toolkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EEG/ECG Acquisition & Analysis (TGAM-Style Protocol)

English | 中文

Python GUI Plotting Protocol License

This is an engineering-oriented repo for getting the whole pipeline running: serial acquisition → real-time visualization → CSV logging → basic plots + PDF report. Treat it as a starting point for protocol parsing + visualization + reporting, not as a polished product.

Stars, forks, issues, and PRs are welcome. If you can reproduce, diagnose, or improve the signal processing / band-power analysis, a PR would be greatly appreciated.

Disclaimer: for learning/research/engineering experiments only. Not for medical diagnosis. Make sure you have proper authorization and privacy compliance before collecting or sharing data.

Language note

Many scripts, UI strings, and notes in this repo are written in Chinese. Non-native speakers may need extra effort (or use a translator) when navigating the code and outputs.

A quick observation (help wanted)

I’m not sure whether this comes from my algorithms, the hardware, electrode contact/placement, or general noise. In my setup (single-electrode, single-channel EEG near Fp1), I’ve noticed the “usefulness/accuracy” can look very different across bands.

Intuitively, Alpha/Beta should show clearer changes between “focus” and “relaxation”, but in my recordings:

  • Alpha and Beta fluctuate only slightly
  • Theta changes more noticeably: around 2000–1200 during focus, and 500–800 during relaxation (these are the amplitude ranges from my current pipeline/device output, not standardized physiological units)

I don’t have a strong biology/neuroscience background, so I can’t confidently tell whether the problem is in acquisition, preprocessing, band computation, or the device itself. If you have the setup to validate this and can propose a fix, please open an issue or submit a PR.

What you’ll likely use

  • EEG (serial capture / CSV replay): edupython/Main.py
  • ECG (serial capture / CSV replay): edupython/ecg/ecg_main.py
  • TGAM-style parser (EEG): edupython/tgam_parser.py
  • EEG visualizer: edupython/visualizer.py
  • ECG visualizer: edupython/ecg/ecg_visualizer.py
  • EEG report from CSV (plots + PDF): edupython/ecg/eeg_report_generator.py

There are also older/experimental scripts (e.g. edupython/EEG_project/, edupython/eeg/, edupython/ECG.py). They are kept for reference and iteration, not promised as stable features.

Install

From repo root:

pip install -r requirements.txt

This covers the core features (UI + capture + reports). The training/ball prototypes under edupython/eeg/ may require extra deps like torch, scikit-learn, joblib, depending on what you run.

Quick start

Run from repo root.

EEG live capture

python edupython/Main.py --port COM5 --baud 57600 --fs 512

EEG CSV replay (no device needed)

python edupython/Main.py --csv path/to/your.csv --replay-hz 64 --fs 512

ECG live capture

python edupython/ecg/ecg_main.py --port COM5 --baud 57600 --fs 512

ECG CSV replay (no device)

python edupython/ecg/ecg_main.py --csv path/to/ecg.csv --replay-hz 512 --fs 512 --duration 10

Sample outputs

EEG analysis report (PDF)

Preview images generated alongside the PDF:

EEG Attention EEG Meditation EEG Spectrum

ECG “pseudo medical” chart (PNG)

ECG Output

Single-lead / Multi-lead note

My own hardware is single-channel (single-lead) for both EEG/ECG. If you use a multi-channel / multi-lead device, you will likely need to adapt:

  • The parser / protocol mapping (per-channel fields)
  • The CSV schema (multiple columns per channel)
  • The visualizers and any filtering/feature logic (per-channel plotting and analysis)

License

AGPL-3.0 dual-licensing. See LICENSE. For commercial closed-source/proprietary use, contact: 1374552774@qq.com (WeChat: Akuri2133).

About

Engineering experimental toolkit for single-channel EEG/ECG acquisition, real-time visualization, analysis and report generation based on TGAM/ThinkGear-like protocol. For learning/research only, not for medical use.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages