Skip to content

Commit bd656af

Browse files
Use MNE as source of truth for canonical montages
The previous hand-rolled spherical formulas in montages.js were off by up to 76° for Fp1/Fp2 and 43° for T7/T8 compared to MNE's canonical templates. The bug: sph(az, el) treated 'el' as elevation from equator, but the formula's call sites passed values intending polar-from-vertex. Symmetric 54° offset error throughout. Replacement: scripts/build-canonical-montages.py pulls MNE's 12 canonical templates (standard_1020, standard_1005 filtered for 10-10 / full 10-05, biosemi 16/32/64/128/256, GSN-HydroCel 128/256, mgh60, easycap-M1) and emits a frozen JSON. montages.js becomes a 16-line loader that just inlines the data. For BioSemi 256 specifically, A1 is now at (0, 0, 0.095m) = vertex, which matches BioSemi's published layout and FieldTrip's biosemi256.lay reference. Previously A1 rendered wherever the dataset-specific TSV placed it; now the built-in 'BioSemi 256' montage ships MNE's canonical positions. Also added biosemi256, egi256, mgh60, and easycap-M1 to the montage picker (previously only 8 options; now 12). Regenerate: python3 scripts/build-canonical-montages.py
1 parent 15611f7 commit bd656af

4 files changed

Lines changed: 32705 additions & 250 deletions

File tree

index.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
99
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap" />
1010
<link rel="stylesheet" href="styles.css?v=4" />
11-
<script src="montages.js?v=4"></script>
11+
<script src="montages.js?v=5"></script>
1212
<script src="bids-loader.js?v=2"></script>
1313
<script src="topo2d.js?v=6"></script>
1414
</head>
@@ -211,7 +211,12 @@ <h3 class="rail-title"><span>Quick actions</span></h3>
211211

212212
/* Montage list */
213213
const montageList = document.getElementById('montage-list');
214-
const MONTAGE_ORDER = ['10-20', '10-10', '10-05', 'biosemi16', 'biosemi32', 'biosemi64', 'biosemi128', 'egi128'];
214+
const MONTAGE_ORDER = [
215+
'10-20', '10-10', '10-05',
216+
'biosemi16', 'biosemi32', 'biosemi64', 'biosemi128', 'biosemi256',
217+
'egi128', 'egi256',
218+
'mgh60', 'easycap-M1',
219+
];
215220
function renderMontageButton(btn, label, count) {
216221
btn.textContent = '';
217222
const name = document.createElement('span');

0 commit comments

Comments
 (0)