Thesis acceptance#
modewise generalises the analysis pipeline of the author’s master’s thesis. This document checks how far modewise reproduces that pipeline. Where modewise deliberately differs, it gives the sourced reason.
The test is tests/acceptance/test_thesis.py. It is opt-in and runs on local data: the thesis’s own outputs, which are not public in this form, and a ds005237 checkout (see the test’s docstring). The cohort is the 14 subjects for which thesis outputs exist.
What was rebuilt#
Thesis stage |
modewise |
Where |
|---|---|---|
Parcellation (Schaefer 400, 17 networks, plus Tian scale II; 432 channels, z-scored) |
the thesis’s parcellated series as input, named by the same atlas label files |
|
Subject selection (SHAPS and TEPS anhedonia rules) |
|
|
MVMD (K = 10, α = 1000, exponential init, tolerance 1e-8, τ = 1e-3) |
|
|
HHT (Hilbert spectrum of the modes) |
|
same |
CWT (Morlet, 224 frequencies, 0.01–0.25 Hz) |
|
same |
Face and shape blocks |
|
same |
FC per block (Pearson, per mode) |
|
same |
ROI selection (PFCv, PFCm, amygdala) |
|
same |
Group FC statistics (planned in the thesis code, never finished) |
|
|
DenseNet features and kNN / random forest |
not in modewise: |
|
Where modewise reproduces the thesis exactly#
Check |
Result |
|---|---|
Whole-run MVMD on resting-state runs, all 14 subjects |
identical modes: correlation 1.0 for every mode of every subject |
Centre-frequency labels of those modes |
within 0.00036 Hz. The modes are identical; the labels differ by one update step (which iteration’s estimate is reported), far below the 0.0026 Hz frequency resolution of a 488-sample run. |
Per-block MVMD on the thesis’s own blocks |
identical modes and centre frequencies |
Pearson FC of the thesis’s own blocks |
identical (largest difference 1e-15) |
Fisher z of those blocks |
identical once the thesis’s ±0.9999 clip is applied |
Block count and onsets (hammerAP) |
18 and 18, same onsets |
Subject grouping of the cohort |
identical (7 anhedonic, 7 control) |
Where modewise differs, and why#
Topic |
Thesis |
modewise |
Reason |
|---|---|---|---|
Decomposition scope |
the stored task outputs decompose each block separately; the thesis code was later changed to decompose the run and slice |
decompose the full run, then cut |
|
Haemodynamic lag |
none |
explicit ( |
|
Block length |
from onset to the next event, about 17.9 s (23–24 samples) |
the merged events’ own duration, 16.8–17.6 s |
events.tsv durations; the thesis blocks include the following cue |
Fisher z |
r clipped to ±0.9999 first |
no clip; diagonal undefined |
|
Instantaneous frequency |
backward phase difference |
centred difference |
|
Envelope features |
|
raw amplitude |
feature scaling for a network, not part of the method ( |
CWT |
|
Torrence & Compo with the Fourier factor (λ ≈ 1.033), checked against pycwt; unscaled power |
|
TEPS anhedonia rule |
the missing-value codes −300, −900 and 99 averaged as answers |
same in |
the NDA definitions file marks them as codes. Cohort-wide, the correction moves 8 subjects between groups; none of the 14 here. |
Stored thesis outputs that could not be reproduced#
Task HHT envelope and instantaneous frequency do not follow from the stored block modes by the thesis’s own formula. Checked:
the scipy-convention analytic signal (the thesis used
scirs2’s copy of it)the backward difference
log1pwith per-channel max-dividemode reordering
a full-run decomposition sliced to the block
Correlations stay at 0.4–0.8. These groups lack the
decomposition_scopeattribute, which the thesis code itself treats as stale, so they were most likely written by a different code version from the stored modes.Resting-state HHT follows from the stored whole-run modes only approximately: envelope r ≥ 0.94 and frequency r ≥ 0.83 across subjects.
Neither affects modewise: its Hilbert transform is checked independently against scipy and the emd package (docs/time-frequency.md).
Results on the cohort#
From whole-run MVMD, ROI selection, blocks with a 5 s lag, and Pearson FC per mode (3780 edge features, 2646 of them resolvable in a block):
Test |
Result |
|---|---|
Face vs shape, paired, 14 subjects; all 16384 sign flips enumerated (exact) |
no edge survives FWER (smallest p = 0.73) or FDR (q < 0.05: none) |
Anhedonic vs control, face blocks, 7 vs 7, 5000 permutations |
no edge survives FWER (smallest p = 0.71) or FDR (none) |
With 14 subjects these tests have little power, so the null results say nothing about the thesis’s classification findings, which used other features (DenseNet on spectra). They show that the full chain, from parcellated series to corrected group statistics, runs from one pipeline file and one dataset spec.
Not reproduced#
DenseNet feature extraction and kNN / random forest classification: these sit outside modewise by design. The
FeatureTableandResults.stackhandovers provide their inputs.Parcellation from volumes: the thesis’s parcellated series is the input. modewise can parcellate volumes (
docs/volumes.md, matched against nilearn), but rebuilding from the fMRIPrep runs needs gigabytes of downloads and is not part of this test.