Skip to content

Scoring & Profiles

After loading and preprocessing, the next steps are extracting PSD epochs and scoring them for True Coherence via the AIME API.

Extracting PSD Epochs

The extract_epochs() method segments the continuous EEG into fixed-duration epochs and computes the Power Spectral Density (PSD) using Welch's method.

epochs = recording.extract_epochs(duration=2.0)

Parameters

Parameter Default Description
duration 2.0 Epoch length in seconds
nperseg 256 Welch window length (samples)
noverlap 128 Welch overlap (samples)
fmin 0.5 Minimum frequency (Hz)
fmax 45.0 Maximum frequency (Hz)
subject None Subject ID for metadata
task None Task label for metadata

Inspecting Epochs

print(epochs)
# EpochSet(n_epochs=150, freq_range=0.5-45.0 Hz)

print(f"Shape: {epochs.shape}")          # (150, 90)
print(f"Epochs: {epochs.n_epochs}")      # 150
print(f"Freq range: {epochs.freq_range}") # (0.5, 45.0)
print(f"Duration: {epochs.duration}s")   # 298.0

Epoch Duration Guidance

Duration Epochs from 5min recording Frequency resolution Use case
1.0s ~300 ~1.0 Hz Real-time, high temporal resolution
2.0s ~150 ~0.5 Hz Standard (recommended)
4.0s ~75 ~0.25 Hz Better frequency resolution

Recommendation: 2.0s epochs balance temporal and frequency resolution for most research.

Scoring

Send PSD epochs to the server for True Coherence scoring:

profile = eeg.score(epochs)

Optionally tag with metadata:

profile = eeg.score(epochs, subject="sub-01", task="nback")

What the Server Computes

The server receives your PSD array and applies proprietary algorithms to compute True Coherence — a measure of how coherently the 13 cognitive functions operate together across all epochs. The scoring method is entirely server-side and not disclosed.

The EEG Cognitive Profile

print(profile.tc_score)         # 23.4
print(profile.n_epochs)         # 150
print(profile.sfreq)            # 500.0
print(profile.n_channels)       # 32
print(profile.subject_id)       # "sub-01"
print(profile.task)             # "nback"
print(profile.source)           # "eeg"

Per-Function Scores

scores = profile.tc_by_function()
for func, score in scores.items():
    print(f"  {func}: {score:.2f}%")

Best and Worst Functions

print(f"Best: {profile.best_function}")
print(f"Worst: {profile.worst_function}")

Typical EEG TC Scores

EEG TC scores are generally higher than LLM TC scores because brain activity naturally exhibits more hierarchical structure:

Condition Typical TC Range
Resting eyes-closed 25–40%
Resting eyes-open 20–35%
Focused attention (n-back) 15–30%
Meditation 30–50%
Sleep (N2) 35–55%
Task switching 10–20%

Export

# JSON
profile.to_json("eeg_profile.json")

# CSV
profile.to_csv("eeg_scores.csv")

# LaTeX
print(profile.to_latex())

# Dictionary
data = profile.to_dict()

Next Steps