git clone https://github.com/htil/phygo.git
> cd .\phygo\
python -m venv venv
Python Tutorial: VENV (Windows) - How to Use Virtual Environments with the Built-In venv Module
.\venv\Scripts\activate
python -m pip install -r requirements.txt
python -m pip freeze > requirements.txt
cd .\scripts
python .\scripts\phygo_app.py
analyze.ipynb
Get-Command python | Select-Object Source
pyinstaller .\ganglion_tester.py --collect-all brainflow --onedir --windowed
winget install --id Git.Git -e --source winget
Set-ExecutionPolicy Unrestricted -Scope Process
The combined PhyGo app handles event design, Ganglion recording, and file export in one workflow.
From the repo root (with your virtual environment activated):
cd scripts
python phygo_app.py- Enter Event Labels as comma-separated values (for example:
Relax,Thumb,Index). - Set Events per Label (how many times each label appears in the sequence).
- Set Sampling Frequency (Hz) (default
200for Ganglion /analyze.ipynb). - Set Latency (ms) — how long each stimulus label stays on screen before Rest.
- Set Rest (ms) — how long the Rest label is shown between stimuli (default
3000). - Set Session Name (for example:
study1). This name is used for saved files. - Confirm Project Directory points to the
scriptsfolder (or the folder that containsdata/andevents/). - Click Generate Event to build the preview table.
- Review the event table. Sample times are shown in column 1;
Restrows are inserted automatically between stimuli. - Click Confirm Events for Recording when ready.
- Enter the Ganglion COM Port (for example:
COM19). - Optionally enable Play sound on each event (beeps play on stimulus labels, not Rest).
- Click Connect Ganglion.
- Click Start Study.
- Recording begins immediately.
- The app waits 5 seconds before the first label.
- Stimulus labels alternate with Rest periods.
- After the final event, recording continues for one additional latency period.
- Click Stop Study to end early, or let the sequence finish automatically.
For session name study1, the app saves:
| File | Location |
|---|---|
| Physiological data | scripts/data/study1_data.csv |
| Event timing | scripts/events/study1.txt |
| Event labels | scripts/events/study1_event_labels.txt |
Event timing values in column 1 are in samples (not milliseconds), aligned to when labels were actually shown during recording.
Use the notebook after completing a PhyGo recording session.
- Open
scripts/analyze.ipynbin Jupyter. - Use the same virtual environment where
requirements.txtis installed. - Run the notebook cell that defines the
Studyclass.
- Set
study_nameto match your session name (without_data):
study_name = "study1"- Create and run the study:
study = Study(
f"data/{study_name}_data.csv",
f"events/{study_name}.txt",
f"events/{study_name}_event_labels.txt",
setup_type="emg",
tmin=-1.0,
tmax=4.0,
)
study.run(plot_epochs=True, plot_tfr=True)
study.train()- Adjust analysis settings as needed:
setup_type:"emg"or"eeg"depending on your setup.tmin/tmax: epoch window in seconds relative to each event (also controls ERDS plot x-axis range).plot_epochs: show epoch plots.plot_tfr: show time-frequency plots.
The notebook expects these files under scripts/:
data/{study_name}_data.csvevents/{study_name}.txtevents/{study_name}_event_labels.txt
If epochs are missing or dropped, check that:
- The recording is long enough for the full event sequence plus
tmax. - Event sample times in
events/{study_name}.txtalign with when labels were shown. tminandtmaxfit within the recorded data duration.
Running the notebook produces ERDS plots (including plot_ersd_linegraph()), band-power summaries, and classifier training output from study.train().
