EEG Visualization¶
AIME LOC provides publication-ready visualization tools for EEG cognitive profiles.
Requires: pip install aime-loc[eeg,viz]
PSD Plot¶
Shows the average Power Spectral Density across all epochs with standard deviation shading.
from aime_loc.eeg.viz import psd_plot
psd_plot(epochs)
# Customized
psd_plot(
epochs,
log_scale=True, # Log power axis (default)
title="Subject 01 — N-Back Task",
save="fig_psd.png",
dpi=300,
figsize=(12, 5),
show=False,
)
Use for: Signal quality inspection, verifying preprocessing worked, checking for artifacts or noise peaks.
Time Series Plot¶
Shows how mean PSD power evolves across epochs over the recording duration. Includes a rolling trend line.
from aime_loc.eeg.viz import timeseries_plot
# Basic
timeseries_plot(epochs)
# With TC annotation from profile
timeseries_plot(epochs, profile)
# Publication-ready
timeseries_plot(
epochs,
profile,
title="Power Stability Over Time",
save="fig_timeseries.png",
dpi=300,
show=False,
)
Use for: Checking signal stability, identifying drift or sudden artifacts, visualizing temporal dynamics.
Cognitive Radar Chart¶
The signature AIME LOC visualization — a 13-axis polar chart showing the cognitive profile.
from aime_loc.eeg.viz import cognitive_radar
# Single profile
cognitive_radar(profile)
# Compare two subjects
cognitive_radar([profile_a, profile_b])
# Publication-ready with journal preset
cognitive_radar(
profile,
title="EEG Cognitive Profile: Sub-01 (N-Back)",
save="fig_radar.pdf",
journal="nature", # "default", "nature", "ieee"
dpi=600,
show=False,
)
Journal Presets¶
| Preset | Font | Colors | Best For |
|---|---|---|---|
"default" |
System, 12pt | Blue/orange/green | General use |
"nature" |
Helvetica, 8pt | Colorblind-safe | Nature journals |
"ieee" |
Times New Roman, 10pt | Grayscale | IEEE papers |
Convenience Method¶
You can also call radar_chart() directly on the profile:
Scalp Topomap¶
Shows the spatial distribution of band power across the scalp. Requires electrode position information (standard 10-20 montage).
from aime_loc.eeg.viz import topomap
# Alpha band power distribution
topomap(recording, band="alpha")
# Other standard bands
topomap(recording, band="delta") # 1-4 Hz
topomap(recording, band="theta") # 4-8 Hz
topomap(recording, band="alpha") # 8-13 Hz
topomap(recording, band="beta") # 13-30 Hz
topomap(recording, band="gamma") # 30-45 Hz
# Save
topomap(recording, band="alpha", save="topo_alpha.png", show=False)
Standard EEG Bands
The topomap uses standard EEG frequency bands (delta, theta, alpha, beta, gamma) for spatial power visualization. The proprietary frequency-to-function mapping used for TC scoring is performed server-side and is not exposed in the SDK.
If electrode positions are not available (e.g., consumer devices without montage), the topomap falls back to a per-channel bar chart.
EpochSet Built-In PSD Plot¶
EpochSet has a built-in quick PSD plot:
Saving Figures¶
All visualization functions accept save and show parameters:
# Display interactively (default)
psd_plot(epochs, show=True)
# Save without displaying
psd_plot(epochs, show=False, save="psd.png")
# Both
psd_plot(epochs, show=True, save="psd.png")
Supported formats: PNG, SVG, PDF (inferred from file extension).
Return Value¶
All visualization functions return a matplotlib.figure.Figure object for further customization:
fig = cognitive_radar(profile, show=False)
# Customize with matplotlib
fig.suptitle("Custom Title", fontsize=20)
fig.savefig("custom.png", dpi=300, bbox_inches="tight")
Generating All Figures for a Paper¶
from aime_loc.eeg.viz import psd_plot, timeseries_plot, cognitive_radar
# Figure 1: PSD
psd_plot(epochs, show=False, save="figures/fig1_psd.pdf", dpi=600)
# Figure 2: Temporal dynamics
timeseries_plot(epochs, profile, show=False, save="figures/fig2_timeseries.pdf", dpi=600)
# Figure 3: Cognitive radar
cognitive_radar(profile, show=False, save="figures/fig3_radar.pdf",
journal="nature", dpi=600)
# Figure 4: Cross-substrate comparison
cognitive_radar(
[human_profile, llm_profile],
show=False,
save="figures/fig4_cross_substrate.pdf",
journal="nature",
dpi=600,
)
Next Steps¶
- EEG Quick Start — Full pipeline walkthrough
- Cross-Substrate Comparison — Compare human vs AI
- EEG Research Study Example — Publication workflow