Sennesh et al. (2025) on dandiset 000253: V1 spectral and laminar claims¶
Paper. Sennesh E, Westerberg JA, Spencer-Smith J, Bastos AM (2025). Ubiquitous predictive
processing in the spectral domain of sensory cortex. bioRxiv,
doi:10.1101/2025.07.31.667946. The claims file
(claims/sennesh-2025.yaml) was written from the preprint's full text (Results, legends of
Figures 1 to 5 and Supplementary Figures 1 to 4, Methods) and the code at
github.com/BastosLab/epych commit cee2e6f.
Dandiset. DANDI:000253, version 0.240923.1441, the most recent published version. The paper cites version 0.240503.0152. That version cannot be used for half of the mice: in 42 of its 84 probe files (7 of the 14 mice) the LFP timestamps run 0, 24, 48, ... (not seconds), so the LFP cannot be put on the stimulus clock; two of those mice hold almost the same LFP as two others; and one mouse holds one LFP channel in four. Version 0.240923.1441 replaced those 42 files and holds 14 mice with LFP timestamps in seconds. The differences are shown in the data check below. The session files (stimulus tables, eye tracking) are the same blobs in both versions.
What this notebook tests. The claims that rest on V1 alone: the trial counts, the
V1 condition spectrograms, cluster-tested contrasts and laminar panels (Figures 2 to 4, a to f),
the trough-locked CSD (Figures 2 to 4, g to i), the V1 gamma peak frequency, the theta peaks,
and the pupil (Supplementary Figure 4). The claims across all six areas are in
areas.ipynb.
| Claim | Tested here |
|---|---|
| trial-counts | yes |
| three-contrasts-gamma-increase | yes (V1) |
| fig2ab to fig2i, fig3ab to fig3i, fig4ab to fig4i (25 claims) | yes |
| dd-gamma-peak-frequency-v1, go-theta-peaks | yes |
| suppfig4-pupil-dd-no-difference | yes |
| claims on all six areas (10 claims) | in areas.ipynb |
import time
import resource
import zlib
import warnings
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import stats
import glo
warnings.filterwarnings("ignore", category=RuntimeWarning)
pd.set_option("display.width", 220)
pd.set_option("display.max_columns", 40)
pd.set_option("display.max_rows", 300)
PAPER = "sennesh-2025"
OFFS = [0, 1000, 2000, 3000, 4000] # seed offsets (protocol: the claim's seed and four more)
started = time.time()
def seed(claim):
return zlib.crc32(f"{PAPER}/{claim}".encode())
sess, smeta, pmeta = glo.survey()
mice = sorted(smeta)
print(f"dandiset {glo.DANDISET_ID} version {glo.DANDISET_VERSION}: {len(mice)} subjects, "
f"{sum(len(v) for v in sess.values())} files; survey {time.time() - started:.0f} s")
dandiset 000253 version 0.240923.1441: 14 subjects, 98 files; survey 12 s
Data check¶
subj = pd.DataFrame([{"mouse": m, **smeta[m][2], "eye_tracking": smeta[m][3] is not None,
"habituated": smeta[m][1].attrs["habituated"]} for m in mice])
print(subj.to_string(index=False))
print("\nsex:", subj.sex.value_counts().to_dict(), " genotype:",
subj.genotype.str.split("/").str[0].value_counts().to_dict())
print("age range (days):", subj.age.str.strip("PD").astype(int).min(), "to", subj.age.str.strip("PD").astype(int).max())
print("habituated sequence (a = 45 deg, b = 135 deg):", subj.habituated.value_counts().to_dict())
mouse age sex genotype subject_id eye_tracking habituated
sub-621890 P128D F Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt 621890 True bbba
sub-632485 P121D F Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt 632485 True bbba
sub-632487 P122D F Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt 632487 True bbba
sub-637542 P98D F Pvalb-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt 637542 True aaab
sub-637908 P103D M Pvalb-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt 637908 True bbba
sub-637909 P101D M Pvalb-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt 637909 False bbba
sub-640507 P104D F Pvalb-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt 640507 False bbba
sub-642507 P103D F Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt 642507 False aaab
sub-645322 P103D M Pvalb-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt 645322 True aaab
sub-645324 P104D M Pvalb-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt 645324 True aaab
sub-645495 P95D F Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt 645495 True bbba
sub-647836 P88D F Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt 647836 False bbba
sub-649323 P99D F Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt 649323 True aaab
sub-649324 P100D F Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt 649324 False aaab
sex: {'F': 10, 'M': 4} genotype: {'Sst-IRES-Cre': 8, 'Pvalb-IRES-Cre': 6}
age range (days): 88 to 128
habituated sequence (a = 45 deg, b = 135 deg): {'bbba': 8, 'aaab': 6}
The paper reports 16 mice (6 male, 10 female, 95 to 128 days old), of which 14 were kept. The dandiset holds 14 subjects, 4 male and 10 female, so the two excluded mice are not deposited and both were male if the paper's counts are right. One mouse is 88 days old, below the paper's range of 95 to 128 days. Eight mice were habituated to "bbba" and six to "aaab", where the paper describes two cohorts of 7. Five sessions have no eye tracking.
rows = []
for m in mice:
s = smeta[m][1]
blk = s.groupby("kind").agg(sequences=("pattern", "size"), blocks=("block", "nunique"))
c = glo.conditions(s)
odd = s[(s.kind == "main") & ~s.xy.isin(["xxxy", "xxxx"])]
rows.append({"mouse": m, **{f"{k}_seq": int(blk.loc[k, "sequences"]) for k in blk.index},
**{k: len(v) for k, v in c.items()}, "odd_main": len(odd),
"first50_end_block": int(c["lonaive"].block.max()),
"p4_dur_ms": f"{1000 * (s.p4_off - s.p4_on).min():.0f}-{1000 * (s.p4_off - s.p4_on).max():.0f}"})
counts = pd.DataFrame(rows).set_index("mouse")
print(counts.to_string())
print("\ntotals:", counts[glo.CONDITIONS].sum().to_dict())
first = smeta[mice[0]][1]
print("\nsequence period (s), median over sessions:", np.round(np.median([np.median(np.diff(smeta[m][1].p4_on)) for m in mice]), 3))
main_seq random_seq seqctl_seq lonaive lo_gloexp go_gloexp lo_rndctl go_seqctl igo_seqctl odd_main first50_end_block p4_dur_ms
mouse
sub-621890 807 300 100 50 649 157 43 50 50 1 5 500-501
sub-632485 748 300 200 50 601 145 37 100 100 2 5 500-501
sub-632487 748 300 200 50 602 145 38 100 100 1 5 500-501
sub-637542 746 300 202 50 601 145 38 101 101 0 5 500-501
sub-637908 748 300 200 50 601 145 37 100 100 2 5 498-584
sub-637909 748 300 200 50 601 145 39 100 100 2 5 500-567
sub-640507 748 300 200 50 602 145 37 100 100 1 5 500-501
sub-642507 748 300 200 50 601 146 39 100 100 1 5 500-501
sub-645322 748 300 200 50 601 146 38 100 100 1 5 500-501
sub-645324 748 300 200 50 601 145 38 100 100 2 5 500-501
sub-645495 748 300 200 50 601 146 38 100 100 1 5 500-501
sub-647836 748 300 200 50 601 146 39 100 100 1 5 500-501
sub-649323 748 300 200 50 602 145 39 100 100 1 5 500-501
sub-649324 748 300 200 50 601 145 38 100 100 2 5 500-501
totals: {'lonaive': 700, 'lo_gloexp': 8465, 'go_gloexp': 2046, 'lo_rndctl': 538, 'go_seqctl': 1351, 'igo_seqctl': 1351}
sequence period (s), median over sessions: 5.004
The stimulus table (init_grating_presentations) has no labels for blocks or conditions. Each
sequence is four gratings, 0.5 s on and 0.5 s apart, followed by a blank row; sequences start
every 5 s. Blocks are told apart by their patterns: the main block holds only the habituated
sequence and its global oddball, the random block every pattern, the sequence block only "xxxx"
and "yyyy". The main block starts with 25 habituated sequences only (block 1) and the global
oddballs begin in block 3, so the first 50 "xxxy" (the code's lonaive) include about 25 from
the main block proper. A few main-block sequences (odd_main) match neither pattern, likely
stimulus or table glitches; they are left out. Sub-621890 has a different schedule (807
main-block sequences, 100 sequence-control sequences, the others 748 and 200).
pm = pd.DataFrame([{"mouse": x[0], "probe": x[1], "area": x[5], "lfp_rows": x[6][0], "lfp_channels": x[6][1],
"chunk": x[7], "ts0": x[8]["ts"][0], "ts1": x[8]["ts"][1], "ts_last": x[8]["ts"][2],
"n_area_channels": int((x[4].location.map(glo.area_of) == x[5]).sum()) if x[5] else 0}
for x in pmeta])
pm["rate_hz"] = 1 / (pm.ts1 - pm.ts0)
pm["duration_s"] = pm.ts_last - pm.ts0
print(pm.drop(columns=["ts1"]).to_string(index=False))
print("\nprobes per area label:", pm.area.value_counts(dropna=False).to_dict())
print("mice without an AL probe:", sorted(set(mice) - set(pm[pm.area == "AL"].mouse)))
print("mice with two probes of one area:", pm.groupby(["mouse", "area"]).size().loc[lambda s: s > 1].to_dict())
mouse probe area lfp_rows lfp_channels chunk ts0 ts_last n_area_channels rate_hz duration_s
sub-621890 0 AM 9646342 360 (37682, 2) 4.832188 7721.899021 70 1250.000967 7717.066833
sub-621890 1 PM 9646319 365 (37681, 2) 4.832380 7721.899162 73 1249.997994 7717.066783
sub-621890 2 V1 9646380 276 (37682, 2) 4.832479 7721.899040 94 1250.005935 7717.066561
sub-621890 3 LM 9646335 273 (37681, 2) 4.832537 7721.898056 100 1250.000272 7717.065519
sub-621890 4 LM 9646363 340 (37682, 2) 4.832294 7721.897946 89 1250.003879 7717.065652
sub-621890 5 RL 9646366 339 (37682, 2) 4.832339 7721.897478 67 1250.004351 7717.065139
sub-632485 0 AM 10076592 326 (39362, 2) 4.490925 8065.759176 73 1250.000705 8061.268251
sub-632485 1 PM 10076568 341 (39362, 2) 4.490882 8065.759703 78 1249.997640 8061.268821
sub-632485 2 V1 10076632 373 (39362, 2) 4.490968 8065.759547 103 1250.005617 8061.268578
sub-632485 3 LM 10076582 343 (39362, 2) 4.494164 8065.759391 92 1249.999934 8061.265227
sub-632485 4 LM 10076610 380 (39362, 2) 4.494254 8065.759757 94 1250.003364 8061.265503
sub-632485 5 RL 10076616 350 (39362, 2) 4.494080 8065.759743 90 1250.004084 8061.265664
sub-632487 0 AM 9981264 384 (38990, 2) 4.476340 7989.481433 90 1250.000831 7985.005093
sub-632487 1 PM 9981239 384 (38990, 2) 4.476120 7989.481117 87 1249.997715 7985.004997
sub-632487 2 V1 9981303 349 (38990, 2) 4.476411 7989.481187 110 1250.005764 7985.004777
sub-632487 3 NaN 9981254 346 (38990, 2) 4.479453 7989.481279 0 1250.000090 7985.001826
sub-632487 4 AL 9981281 382 (38990, 2) 4.479181 7989.480924 83 1250.003484 7985.001743
sub-632487 5 RL 9981287 335 (38990, 2) 4.479335 7989.481079 97 1250.004235 7985.001744
sub-637542 0 AM 10053228 265 (39271, 2) 4.471495 8047.047343 82 1250.000894 8042.575848
sub-637542 1 PM 10053203 255 (39271, 2) 4.471597 8047.047280 82 1249.997811 8042.575683
sub-637542 2 V1 10053268 356 (39271, 2) 4.471338 8047.047364 91 1250.005840 8042.576025
sub-637542 3 LM 10053221 281 (39271, 2) 4.472364 8047.047326 80 1250.000161 8042.574963
sub-637542 4 AL 10053248 339 (39271, 2) 4.472640 8047.047483 85 1250.003537 8042.574842
sub-637542 5 RL 10053254 343 (39271, 2) 4.472541 8047.047065 84 1250.004333 8042.574524
sub-637908 0 AM 10445974 287 (40805, 2) 4.482820 8361.255612 89 1250.000839 8356.772792
sub-637908 1 PM 10445948 345 (40805, 2) 4.482707 8361.255311 82 1249.997756 8356.772605
sub-637908 2 V1 10446016 347 (40805, 2) 4.482689 8361.255873 83 1250.005806 8356.773184
sub-637908 3 LM 10445966 343 (40805, 2) 4.483616 8361.255262 90 1250.000053 8356.771646
sub-637908 4 RL 10445994 345 (40805, 2) 4.483775 8361.255391 86 1250.003408 8356.771615
sub-637908 5 RL 10446001 355 (40805, 2) 4.483651 8361.254972 86 1250.004290 8356.771321
sub-637909 0 AM 10272738 318 (40128, 2) 4.665094 8222.846025 101 1250.001319 8218.180931
sub-637909 1 PM 10272713 318 (40128, 2) 4.664806 8222.846037 85 1249.998231 8218.181230
sub-637909 2 V1 10272778 342 (40129, 2) 4.665170 8222.845373 86 1250.006297 8218.180203
sub-637909 3 LM 10272730 335 (40128, 2) 4.667740 8222.847195 88 1250.000570 8218.179455
sub-637909 4 AL 10272758 335 (40128, 2) 4.667669 8222.847415 67 1250.003932 8218.179746
sub-637909 5 RL 10272764 357 (40128, 2) 4.667758 8222.847313 84 1250.004692 8218.179555
sub-640507 0 AM 9964074 324 (38923, 2) 4.334343 7975.588034 63 1250.000738 7971.253691
sub-640507 1 PM 9964050 324 (38923, 2) 4.334168 7975.587934 88 1249.997716 7971.253765
sub-640507 2 V1 9964114 353 (38923, 2) 4.334289 7975.588157 92 1250.005729 7971.253869
sub-640507 3 LM 9964066 335 (38923, 2) 4.335216 7975.587284 87 1249.999989 7971.252067
sub-640507 4 AL 9964094 339 (38923, 2) 4.335106 7975.587742 58 1250.003413 7971.252636
sub-640507 5 RL 9964100 342 (38923, 2) 4.335067 7975.587625 81 1250.004178 7971.252558
sub-642507 0 AM 10375520 384 (40530, 2) 3.549851 8303.958788 98 1250.000943 8300.408938
sub-642507 1 PM 10375518 384 (40530, 2) 3.543826 8303.972150 86 1249.997783 8300.428324
sub-642507 2 V1 10375569 357 (40530, 2) 3.545347 8303.960343 96 1250.005934 8300.414995
sub-642507 3 LM 10375499 359 (40530, 2) 3.561719 8303.959229 94 1250.000134 8300.397510
sub-642507 4 AL 10375522 343 (40530, 2) 3.561819 8303.955265 91 1250.003517 8300.393446
sub-642507 5 RL 10375551 384 (40530, 2) 3.554849 8303.966358 79 1250.004291 8300.411508
sub-645322 0 AM 9951540 340 (38874, 2) 3.588156 7964.811642 83 1250.001211 7961.223486
sub-645322 1 PM 9951482 346 (38873, 2) 3.594332 7964.791005 109 1249.998136 7961.196673
sub-645322 2 V1 9951542 348 (38874, 2) 3.594403 7964.787574 91 1250.006222 7961.193170
sub-645322 3 LM 9951498 336 (38874, 2) 3.606164 7964.801392 88 1250.000372 7961.195228
sub-645322 4 AL 9951534 345 (38874, 2) 3.606969 7964.808420 81 1250.003917 7961.201452
sub-645322 5 RL 9951502 353 (38874, 2) 3.606853 7964.778808 88 1250.004529 7961.171955
sub-645324 0 AM 9984172 361 (39001, 2) 3.750481 7991.077665 78 1250.001505 7987.327184
sub-645324 1 PM 9984117 347 (39001, 2) 3.764599 7991.067872 83 1249.998361 7987.303273
sub-645324 2 V1 9984189 353 (39001, 2) 3.760852 7991.069379 98 1250.006553 7987.308527
sub-645324 3 LM 9984129 370 (39001, 2) 3.784179 7991.081782 95 1250.000751 7987.297604
sub-645324 4 AL 9984169 384 (39001, 2) 3.779705 7991.087636 85 1250.004142 7987.307930
sub-645324 5 RL 9984177 364 (39001, 2) 3.777572 7991.087419 92 1250.004844 7987.309847
sub-645495 0 AM 9939248 340 (38826, 2) 3.541325 7954.930936 76 1250.001256 7951.389611
sub-645495 1 PM 9939245 357 (38826, 2) 3.536901 7954.944413 86 1249.998065 7951.407511
sub-645495 2 V1 9939308 351 (38826, 2) 3.530855 7954.936320 74 1250.006309 7951.405465
sub-645495 3 LM 9939239 342 (38826, 2) 3.544861 7954.932405 92 1250.000449 7951.387544
sub-645495 4 AL 9939253 339 (38826, 2) 3.545191 7954.922595 75 1250.003804 7951.377404
sub-645495 5 RL 9939250 344 (38826, 2) 3.552858 7954.922326 74 1250.004674 7951.369467
sub-647836 0 AM 9989774 265 (39023, 2) 3.576777 7995.386190 89 1250.001406 7991.809414
sub-647836 1 PM 9989748 357 (39023, 2) 3.575662 7995.384230 96 1249.998284 7991.808568
sub-647836 2 V1 9989832 339 (39023, 2) 3.570652 7995.393779 89 1250.006518 7991.823127
sub-647836 3 LM 9989755 357 (39023, 2) 3.578871 7995.378359 104 1250.000581 7991.799488
sub-647836 4 AL 9989767 342 (39023, 2) 3.581864 7995.369318 92 1250.003964 7991.787454
sub-647836 5 RL 9989764 339 (39023, 2) 3.584973 7995.364383 87 1250.004847 7991.779410
sub-649323 0 AM 11400955 350 (44535, 2) 3.569701 9124.323072 79 1250.001347 9120.753372
sub-649323 1 PM 11400920 347 (44535, 2) 3.566102 9124.313515 78 1249.998326 9120.747413
sub-649323 2 V1 11401009 353 (44536, 2) 3.562598 9124.322490 85 1250.006374 9120.759892
sub-649323 3 LM 11400930 347 (44535, 2) 3.574608 9124.313842 108 1250.000544 9120.739234
sub-649323 4 AL 11400966 345 (44536, 2) 3.582855 9124.325330 95 1250.004046 9120.742475
sub-649323 5 RL 11400972 344 (44536, 2) 3.580174 9124.323229 90 1250.004625 9120.743055
sub-649324 0 AM 10164532 345 (39706, 2) 3.578891 8135.193877 77 1250.001509 8131.614986
sub-649324 1 PM 10164494 335 (39706, 2) 3.573852 8135.178597 85 1249.998410 8131.604746
sub-649324 2 V1 10164578 341 (39706, 2) 3.571417 8135.190692 92 1250.006506 8131.619275
sub-649324 3 LM 10164509 343 (39706, 2) 3.590957 8135.192557 86 1250.000738 8131.601601
sub-649324 4 AL 10164549 349 (39706, 2) 3.584912 8135.196132 62 1250.004178 8131.611220
sub-649324 5 RL 10164553 350 (39706, 2) 3.584705 8135.195288 88 1250.004768 8131.610583
probes per area label: {'LM': 15, 'RL': 15, 'AM': 14, 'PM': 14, 'V1': 14, 'AL': 11, nan: 1}
mice without an AL probe: ['sub-621890', 'sub-632485', 'sub-637908']
mice with two probes of one area: {('sub-621890', 'LM'): 2, ('sub-632485', 'LM'): 2, ('sub-637908', 'RL'): 2}
# Interval tables of the first session file: is there a habituation table apart from
# init_grating_presentations, and which stimulus blocks does each table cover?
f_ = glo.open_h5(sess[mice[0]]["ogen"])
for k in f_["intervals"]:
g = f_[f"intervals/{k}"]
n_ = len(g["start_time"]) if "start_time" in g else None
blk = sorted(set(np.asarray(g["stimulus_block"][:]).tolist())) if "stimulus_block" in g else None
print(f"{mice[0]} intervals/{k}: {n_} rows; stimulus_block values {blk}; columns {sorted(g.keys())}")
s_ = smeta[mice[0]][1]
print(s_.groupby("block").agg(kind=("kind", "first"), sequences=("pattern", "size"),
patterns=("xy", lambda x: x.value_counts().to_dict())).to_string())
# invalid_times of every session, and whether any analysed P4 trial (epoch -0.5 to 1.0 s) overlaps one.
def invalid_of(m):
g = glo.open_h5(sess[m]["ogen"])["intervals/invalid_times"]
return m, g["start_time"][:], g["stop_time"][:]
from concurrent.futures import ThreadPoolExecutor
with ThreadPoolExecutor(14) as ex:
inv = dict((m, (a, b)) for m, a, b in ex.map(invalid_of, mice))
for m in mice:
a, b = inv[m]
on = np.concatenate([c.p4_on.to_numpy() for c in glo.conditions(smeta[m][1]).values()])
hit = sum(int(((on - 0.5 < y) & (on + 1.0 > x)).sum()) for x, y in zip(a, b))
print(f"{m}: invalid_times {[(round(float(x), 1), round(float(y), 1)) for x, y in zip(a, b)]}; analysed P4 epochs overlapping: {hit}")
sub-621890 intervals/create_receptive_field_mapping_presentations: 1944 rows; stimulus_block values [96.0]; columns ['color', 'contrast', 'id', 'mask', 'opacity', 'orientation', 'phase', 'size', 'spatial_frequency', 'start_time', 'stimulus_block', 'stimulus_index', 'stimulus_name', 'stop_time', 'tags', 'tags_index', 'temporal_frequency', 'timeseries', 'timeseries_index', 'units', 'x_position', 'y_position']
sub-621890 intervals/init_grating_presentations: 6035 rows; stimulus_block values [1.0, 3.0, 5.0, 7.0, 9.0, 11.0, 13.0, 15.0, 17.0, 19.0, 21.0, 23.0, 25.0, 27.0, 29.0, 31.0, 33.0, 35.0, 37.0, 39.0, 41.0, 43.0, 45.0, 47.0, 49.0, 51.0, 53.0, 55.0, 57.0, 59.0, 61.0, 63.0, 65.0, 67.0, 69.0, 71.0, 73.0, 75.0, 77.0, 79.0, 81.0, 83.0, 85.0, 87.0, 89.0, 91.0, 93.0, 95.0, 98.0, 100.0]; columns ['color', 'contrast', 'id', 'mask', 'opacity', 'orientation', 'phase', 'size', 'spatial_frequency', 'start_time', 'stimulus_block', 'stimulus_index', 'stimulus_name', 'stop_time', 'tags', 'tags_index', 'temporal_frequency', 'timeseries', 'timeseries_index', 'units']
sub-621890 intervals/init_intermission_presentations: 50 rows; stimulus_block values [0.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 22.0, 24.0, 26.0, 28.0, 30.0, 32.0, 34.0, 36.0, 38.0, 40.0, 42.0, 44.0, 46.0, 48.0, 50.0, 52.0, 54.0, 56.0, 58.0, 60.0, 62.0, 64.0, 66.0, 68.0, 70.0, 72.0, 74.0, 76.0, 78.0, 80.0, 82.0, 84.0, 86.0, 88.0, 90.0, 92.0, 94.0, 97.0, 99.0]; columns ['color', 'contrast', 'id', 'mask', 'opacity', 'orientation', 'phase', 'size', 'spatial_frequency', 'start_time', 'stimulus_block', 'stimulus_index', 'stimulus_name', 'stop_time', 'tags', 'tags_index', 'temporal_frequency', 'timeseries', 'timeseries_index', 'units']
sub-621890 intervals/invalid_times: 1 rows; stimulus_block values None; columns ['id', 'start_time', 'stop_time', 'tags', 'tags_index']
sub-621890 intervals/spontaneous_presentations: 51 rows; stimulus_block values None; columns ['id', 'start_time', 'stimulus_name', 'stop_time', 'tags', 'tags_index', 'timeseries', 'timeseries_index']
kind sequences patterns
block
1 main 25 {'xxxy': 25}
3 main 25 {'xxxy': 21, 'xxxx': 4}
5 main 25 {'xxxy': 18, 'xxxx': 7}
7 main 25 {'xxxy': 22, 'xxxx': 3}
9 main 25 {'xxxy': 22, 'xxxx': 3}
11 main 25 {'xxxy': 19, 'xxxx': 6}
13 main 25 {'xxxy': 20, 'xxxx': 5}
15 main 25 {'xxxy': 21, 'xxxx': 4}
17 main 25 {'xxxy': 16, 'xxxx': 9}
19 main 25 {'xxxy': 22, 'xxxx': 3}
21 main 25 {'xxxy': 20, 'xxxx': 5}
23 main 25 {'xxxy': 18, 'xxxx': 7}
25 main 25 {'xxxy': 19, 'xxxx': 6}
27 main 25 {'xxxy': 20, 'xxxx': 5}
29 main 25 {'xxxy': 21, 'xxxx': 4}
31 main 25 {'xxxy': 20, 'xxxx': 5}
33 main 25 {'xxxy': 21, 'xxxx': 4}
35 main 25 {'xxxy': 18, 'xxxx': 7}
37 main 25 {'xxxy': 17, 'xxxx': 8}
39 main 25 {'xxxy': 23, 'xxxx': 2}
41 main 25 {'xxxy': 19, 'xxxx': 6}
43 main 25 {'xxxy': 22, 'xxxx': 3}
45 main 25 {'xxxy': 19, 'xxxx': 6}
47 main 25 {'xxxy': 19, 'xxxx': 6}
49 main 25 {'xxxy': 23, 'xxxx': 2}
51 main 25 {'xxxy': 17, 'xxxx': 8}
53 main 25 {'xxxy': 19, 'xxxx': 6}
55 main 25 {'xxxy': 18, 'xxxx': 7}
57 main 25 {'xxxy': 21, 'xxxx': 4}
59 main 25 {'xxxy': 21, 'xxxx': 4}
61 main 25 {'xxxy': 23, 'xxxx': 2}
63 main 25 {'xxxy': 21, 'xxxx': 4}
65 main 5 {'xxxy': 4, 'xxxx': 1}
67 random 25 {'xxxx': 7, 'xxxy': 4, 'xyyx': 3, 'xyyy': 2, 'xyxy': 2, 'yyyx': 2, 'xxyy': 1, 'yxyy': 1, 'xxyx': 1, 'yxyx': 1, 'yyyy': 1}
69 random 25 {'yyyx': 5, 'yxyx': 3, 'xxyx': 3, 'xxxy': 3, 'xxxx': 2, 'xyxy': 2, 'yyyy': 2, 'yxxx': 1, 'xyyx': 1, 'xyyy': 1, 'xyxx': 1, 'yyxx': 1}
71 random 25 {'xxxy': 7, 'xxyx': 2, 'xyyy': 2, 'yxxx': 2, 'xyyx': 2, 'xxxx': 2, 'yyyx': 2, 'yxyy': 2, 'xxyy': 1, 'yyxy': 1, 'yxxy': 1, 'xyxx': 1}
73 random 25 {'xxxx': 4, 'yyxx': 4, 'yxxx': 3, 'xxxy': 3, 'xyyx': 2, 'yyyx': 2, 'xxyy': 2, 'xyyy': 1, 'yyyy': 1, 'yyxy': 1, 'xyxx': 1, 'yxxy': 1}
75 random 25 {'xxxy': 5, 'xxxx': 3, 'yxyx': 3, 'yyxy': 3, 'yyyx': 3, 'xyxy': 2, 'yxxy': 2, 'xxyx': 1, 'yxxx': 1, 'xxyy': 1, 'yyyy': 1}
77 random 25 {'xxxx': 7, 'xyxx': 6, 'xyyy': 3, 'yxxy': 2, 'yyyx': 2, 'xxxy': 2, 'xyxy': 1, 'yyxy': 1, 'yyxx': 1}
79 random 25 {'xxxx': 4, 'yxxy': 3, 'xxyx': 3, 'yyxy': 2, 'xxyy': 2, 'yyyy': 2, 'xxxy': 2, 'yxyy': 2, 'xyyx': 1, 'xyxx': 1, 'yxyx': 1, 'yxxx': 1, 'yyyx': 1}
81 random 25 {'yyyx': 5, 'xxxx': 3, 'yxyx': 3, 'yxyy': 3, 'xyxy': 2, 'xxxy': 2, 'yxxx': 2, 'yyyy': 2, 'yyxy': 1, 'xyyy': 1, 'yyxx': 1}
83 random 25 {'yyyx': 6, 'xxxx': 3, 'xxxy': 3, 'yyxx': 2, 'yyxy': 2, 'yxyy': 2, 'xxyx': 1, 'yyyy': 1, 'xyxy': 1, 'xyyy': 1, 'xyxx': 1, 'yxxy': 1, 'yxxx': 1}
85 random 25 {'yyyx': 6, 'xxxy': 3, 'yyyy': 2, 'xxyy': 2, 'xxyx': 2, 'yxxy': 2, 'yxxx': 2, 'xyxy': 2, 'yyxx': 2, 'yxyy': 1, 'xyyx': 1}
87 random 25 {'yyyx': 6, 'xxxy': 5, 'xxxx': 4, 'xxyy': 2, 'yyxx': 2, 'yxyy': 1, 'yxyx': 1, 'xyyy': 1, 'xyxx': 1, 'yyyy': 1, 'xyyx': 1}
89 random 25 {'xxxy': 4, 'yyxy': 4, 'xxyy': 3, 'xxxx': 3, 'xyyx': 2, 'yyyx': 2, 'xyxy': 1, 'xyxx': 1, 'yxxy': 1, 'xyyy': 1, 'yxyy': 1, 'yxyx': 1, 'yxxx': 1}
91 main 2 {'yyyx': 1, 'xxxx': 1}
93 seqctl 25 {'xxxx': 13, 'yyyy': 12}
95 seqctl 25 {'yyyy': 13, 'xxxx': 12}
98 seqctl 25 {'xxxx': 13, 'yyyy': 12}
100 seqctl 25 {'yyyy': 13, 'xxxx': 12}
sub-621890: invalid_times [(0.0, 0.0)]; analysed P4 epochs overlapping: 0 sub-632485: invalid_times [(0.0, 0.0)]; analysed P4 epochs overlapping: 0 sub-632487: invalid_times [(0.0, 0.0)]; analysed P4 epochs overlapping: 0 sub-637542: invalid_times [(0.0, 0.0)]; analysed P4 epochs overlapping: 0 sub-637908: invalid_times [(0.0, 0.0)]; analysed P4 epochs overlapping: 0 sub-637909: invalid_times [(0.0, 0.0)]; analysed P4 epochs overlapping: 0 sub-640507: invalid_times [(0.0, 0.0)]; analysed P4 epochs overlapping: 0 sub-642507: invalid_times [(0.0, 0.0)]; analysed P4 epochs overlapping: 0 sub-645322: invalid_times [(0.0, 0.0)]; analysed P4 epochs overlapping: 0 sub-645324: invalid_times [(0.0, 0.0)]; analysed P4 epochs overlapping: 0 sub-645495: invalid_times [(0.0, 0.0)]; analysed P4 epochs overlapping: 0 sub-647836: invalid_times [(0.0, 0.0)]; analysed P4 epochs overlapping: 0 sub-649323: invalid_times [(0.0, 0.0)]; analysed P4 epochs overlapping: 0 sub-649324: invalid_times [(0.0, 0.0)]; analysed P4 epochs overlapping: 0
Every probe file holds its LFP at 1250 Hz (sampling interval 0.8 ms) in volts, not the 2.5 kHz of the paper's Methods (the Neuropixels LFP band is acquired at 2.5 kHz and the files hold it downsampled). Area labels come from the electrodes table: three mice have no probe labelled AL (two have two probes labelled LM, one has two labelled RL), and one probe of sub-632487 has no visual-cortex label at all. Every mouse has one V1 probe. The paper says six probes targeted V1, LM, RL, AL, PM and AM in all mice.
# Recordings deposited twice: correlate a 0.2 s, 8-channel LFP sample of every pair of probe files.
keys = [(x[0], x[1]) for x in pmeta]
samples = np.array([x[8]["sample"].ravel() for x in pmeta])
z = (samples - samples.mean(1, keepdims=True)) / samples.std(1, keepdims=True)
r = z @ z.T / z.shape[1]
np.fill_diagonal(r, 0)
i, j = np.nonzero(np.triu(np.abs(r) > 0.95))
print("pairs of probe files with |r| > 0.95 on the sample:", [(keys[a], keys[b], round(r[a, b], 3)) for a, b in zip(i, j)])
print("largest |r| between files of different mice:",
round(max(abs(r[a, b]) for a in range(len(keys)) for b in range(len(keys)) if keys[a][0] != keys[b][0]), 3))
seq_sig = {m: tuple(smeta[m][1].pattern) for m in mice}
print("sessions with identical stimulus sequences:", [(a, b) for a in mice for b in mice if a < b and seq_sig[a] == seq_sig[b]])
pairs of probe files with |r| > 0.95 on the sample: [(('sub-632487', 4), ('sub-632487', 5), np.float64(0.962)), (('sub-637909', 0), ('sub-637909', 1), np.float64(0.951)), (('sub-637909', 4), ('sub-637909', 5), np.float64(0.982)), (('sub-640507', 0), ('sub-640507', 1), np.float64(0.971)), (('sub-640507', 2), ('sub-640507', 4), np.float64(0.956)), (('sub-640507', 2), ('sub-640507', 5), np.float64(0.964)), (('sub-640507', 4), ('sub-640507', 5), np.float64(0.976)), (('sub-642507', 2), ('sub-642507', 5), np.float64(0.96))]
largest |r| between files of different mice: 0.844
sessions with identical stimulus sequences: []
# The cited version, 0.240503.0152: the same check on its V1 files, and its LFP clocks.
old_sess, old_smeta, old_pmeta = glo.survey(version=glo.CITED_VERSION)
old_assets, new_assets = glo.assets(glo.CITED_VERSION), glo.assets()
changed = sorted(p for p in new_assets if p in old_assets and new_assets[p]["blob"] != old_assets[p]["blob"])
print(f"files that differ between {glo.CITED_VERSION} and {glo.DANDISET_VERSION}: {len(changed)} of {len(new_assets)};",
"mice:", sorted(set(p.split('/')[0] for p in changed)))
op = pd.DataFrame([{"mouse": x[0], "probe": x[1], "area": x[5], "channels": x[6][1], "ts0": x[8]["ts"][0],
"ts1": x[8]["ts"][1], "ts_last": x[8]["ts"][2]} for x in old_pmeta if x[5] == "V1"])
print(op.to_string(index=False))
# Every probe file of the mice whose files changed: the first two timestamps and the last.
bad = sorted(set(p.split('/')[0] for p in changed))
oa = pd.DataFrame([{"mouse": x[0], "probe": x[1], "area": x[5], "ts0": x[8]["ts"][0], "ts1": x[8]["ts"][1],
"ts_last": x[8]["ts"][2]} for x in old_pmeta if x[0] in bad])
print(f"\ncited version, all {len(oa)} probe files of those {len(bad)} mice:")
print(oa.to_string(index=False))
print("files with timestamps 0, 24, ...:", int(((oa.ts0 == 0) & (oa.ts1 == 24)).sum()), "of", len(oa))
okeys = [(x[0], x[1]) for x in old_pmeta]
osamp = np.array([x[8]["sample"][:, :4].ravel() for x in old_pmeta])
oz = (osamp - osamp.mean(1, keepdims=True)) / osamp.std(1, keepdims=True)
orr = oz @ oz.T / oz.shape[1]
np.fill_diagonal(orr, 0)
i, j = np.nonzero(np.triu(orr > 0.95))
print("\ncited version, probe files of different mice with r > 0.95 (first 4 channels):")
for a, b in zip(i, j):
if okeys[a][0] != okeys[b][0]:
print(" ", okeys[a], okeys[b], round(orr[a, b], 4))
files that differ between 0.240503.0152 and 0.240923.1441: 42 of 98; mice: ['sub-642507', 'sub-645322', 'sub-645324', 'sub-645495', 'sub-647836', 'sub-649323', 'sub-649324']
mouse probe area channels ts0 ts1 ts_last
sub-621890 2 V1 276 4.832479 4.833279 7.721899e+03
sub-632485 2 V1 373 4.490968 4.491768 8.065760e+03
sub-632487 2 V1 349 4.476411 4.477211 7.989481e+03
sub-637542 2 V1 356 4.471338 4.472138 8.047047e+03
sub-637908 2 V1 347 4.482689 4.483489 8.361256e+03
sub-637909 2 V1 342 4.665170 4.665970 8.222845e+03
sub-640507 2 V1 353 4.334289 4.335089 7.975588e+03
sub-642507 2 V1 357 0.000000 24.000000 2.490136e+08
sub-645322 2 V1 348 0.000000 24.000000 2.388370e+08
sub-645324 2 V1 353 0.000000 24.000000 2.397559e+08
sub-645495 2 V1 351 0.000000 24.000000 2.388370e+08
sub-647836 2 V1 339 0.000000 24.000000 2.397559e+08
sub-649323 2 V1 88 0.000000 24.000000 2.736242e+08
sub-649324 2 V1 341 0.000000 24.000000 2.439498e+08
cited version, all 42 probe files of those 7 mice:
mouse probe area ts0 ts1 ts_last
sub-642507 0 AM 0.0 24.0 249012456.0
sub-642507 1 PM 0.0 24.0 249012408.0
sub-642507 2 V1 0.0 24.0 249013632.0
sub-642507 3 LM 0.0 24.0 249011952.0
sub-642507 4 AL 0.0 24.0 249012504.0
sub-642507 5 RL 0.0 24.0 249013200.0
sub-645322 0 AM 0.0 24.0 238836936.0
sub-645322 1 PM 0.0 24.0 238835544.0
sub-645322 2 V1 0.0 24.0 238836984.0
sub-645322 3 LM 0.0 24.0 238835928.0
sub-645322 4 AL 0.0 24.0 238836792.0
sub-645322 5 RL 0.0 24.0 238836024.0
sub-645324 0 AM 0.0 24.0 239754552.0
sub-645324 1 PM 0.0 24.0 239753928.0
sub-645324 2 V1 0.0 24.0 239755944.0
sub-645324 3 LM 0.0 24.0 239754096.0
sub-645324 4 AL 0.0 24.0 239754384.0
sub-645324 5 RL 0.0 24.0 239754312.0
sub-645495 0 AM 0.0 24.0 238836936.0
sub-645495 1 PM 0.0 24.0 238835544.0
sub-645495 2 V1 0.0 24.0 238836984.0
sub-645495 3 LM 0.0 24.0 238835928.0
sub-645495 4 AL 0.0 24.0 238836792.0
sub-645495 5 RL 0.0 24.0 238836024.0
sub-647836 0 AM 0.0 24.0 239754552.0
sub-647836 1 PM 0.0 24.0 239753928.0
sub-647836 2 V1 0.0 24.0 239755944.0
sub-647836 3 LM 0.0 24.0 239754096.0
sub-647836 4 AL 0.0 24.0 239754384.0
sub-647836 5 RL 0.0 24.0 239754312.0
sub-649323 0 AM 0.0 24.0 273622896.0
sub-649323 1 PM 0.0 24.0 273622056.0
sub-649323 2 V1 0.0 24.0 273624192.0
sub-649323 3 LM 0.0 24.0 273622296.0
sub-649323 4 AL 0.0 24.0 273623160.0
sub-649323 5 RL 0.0 24.0 273623304.0
sub-649324 0 AM 0.0 24.0 243948744.0
sub-649324 1 PM 0.0 24.0 243947832.0
sub-649324 2 V1 0.0 24.0 243949848.0
sub-649324 3 LM 0.0 24.0 243948192.0
sub-649324 4 AL 0.0 24.0 243949152.0
sub-649324 5 RL 0.0 24.0 243949248.0
files with timestamps 0, 24, ...: 42 of 42
cited version, probe files of different mice with r > 0.95 (first 4 channels):
('sub-645322', 0) ('sub-645495', 0) 1.0
('sub-645322', 1) ('sub-645495', 1) 0.9994
('sub-645322', 2) ('sub-645495', 2) 0.9998
('sub-645322', 3) ('sub-645495', 3) 1.0
('sub-645322', 4) ('sub-645495', 4) 0.9996
('sub-645322', 5) ('sub-645495', 5) 0.999
('sub-645324', 0) ('sub-647836', 0) 0.9985
('sub-645324', 1) ('sub-647836', 1) 0.9996
('sub-645324', 2) ('sub-647836', 2) 0.9998
('sub-645324', 3) ('sub-647836', 3) 1.0
('sub-645324', 4) ('sub-647836', 4) 0.9993
('sub-645324', 5) ('sub-647836', 5) 0.9998
In the cited version, 0.240503.0152, all 42 probe files of 7 mice (printed above) have timestamps 0, 24, 48, ... with no unit of time, so their LFP cannot be put on the stimulus clock; in sub-649323 the probe files hold one channel in four; and the LFP of sub-645495 is almost the same as that of sub-645322, and that of sub-645324 almost the same as that of sub-647836 (correlations printed above), while their stimulus tables differ. The pinned version replaced all 42 probe files of those 7 mice, and in it no two probe files of different mice are alike (above). This attempt uses the pinned version.
Reading V1¶
The V1 probe of each mouse is read whole, for its visual-cortex channels, from the HDF5 chunk index. The time taken and the peak memory are printed, as they bound what else can be run.
v1 = {x[0]: x for x in pmeta if x[5] == "V1"}
chans = {m: glo.cortical_channels(v1[m][4], "V1") for m in mice}
spans, labels, kept, raw_labels = glo.alignment(chans)
kl = [labels[k] for k in kept]
print("aligned rows:", len(labels), " kept (every fourth):", len(kept))
print("kept rows' layers:", kl)
print("kept rows (top-down aligned row numbers, every fourth from the deepest):", list(kept))
print("aligned rows labelled L1:", [j for j, l in enumerate(labels) if l == "L1"])
for k in [1, 2, 3]:
lk = [labels[j] for j in glo.kept_rows(len(labels), k)]
print(f"start moved up by {k} rows: {len(lk)} kept rows, L1 rows {lk.count('L1')}, first three {lk[:3]}")
print("LFP columns in local-index order (tip first), every V1 file:",
all(bool((np.diff(v1[m][4].local_index.to_numpy()) > 0).all()) for m in mice))
print("cortical V1 channels per mouse:", {m: len(c) for m, c in chans.items()})
t = time.time()
metas = glo.chunk_indexes([(v1[m][2], v1[m][3]) for m in mice], workers=14)
metas = dict(zip(mice, metas))
print(f"chunk indexes of {len(mice)} V1 files read in {time.time() - t:.0f} s")
conds = {m: glo.conditions(smeta[m][1]) for m in mice}
passes = {}
for m in mice:
t = time.time()
passes[m] = glo.mouse_pass(v1[m][2], metas[m], chans[m], spans[m], labels, kept, conds[m])
print(f"{m}: {passes[m]['n_pairs']} chunk columns read in {passes[m]['read_s']:.0f} s, pass {time.time() - t:.0f} s; "
f"peak memory {resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6:.1f} GB")
print(f"V1 read in {(time.time() - started) / 60:.1f} min since the start")
aligned rows: 73 kept (every fourth): 19
kept rows' layers: ['L1', 'L2/3', 'L2/3', 'L2/3', 'L2/3', 'L2/3', 'L2/3', 'L4', 'L4', 'L4', 'L5/6', 'L5/6', 'L5/6', 'L5/6', 'L5/6', 'L5/6', 'L5/6', 'L5/6', 'L5/6']
kept rows (top-down aligned row numbers, every fourth from the deepest): [np.int64(0), np.int64(4), np.int64(8), np.int64(12), np.int64(16), np.int64(20), np.int64(24), np.int64(28), np.int64(32), np.int64(36), np.int64(40), np.int64(44), np.int64(48), np.int64(52), np.int64(56), np.int64(60), np.int64(64), np.int64(68), np.int64(72)]
aligned rows labelled L1: [0, 1]
start moved up by 1 rows: 18 kept rows, L1 rows 0, first three ['L2/3', 'L2/3', 'L2/3']
start moved up by 2 rows: 18 kept rows, L1 rows 0, first three ['L2/3', 'L2/3', 'L2/3']
start moved up by 3 rows: 18 kept rows, L1 rows 1, first three ['L1', 'L2/3', 'L2/3']
LFP columns in local-index order (tip first), every V1 file: True
cortical V1 channels per mouse: {'sub-621890': 94, 'sub-632485': 103, 'sub-632487': 110, 'sub-637542': 91, 'sub-637908': 83, 'sub-637909': 86, 'sub-640507': 92, 'sub-642507': 96, 'sub-645322': 91, 'sub-645324': 98, 'sub-645495': 74, 'sub-647836': 89, 'sub-649323': 85, 'sub-649324': 92}
chunk indexes of 14 V1 files read in 81 s
sub-621890: 38 chunk columns read in 25 s, pass 45 s; peak memory 2.5 GB
sub-632485: 38 chunk columns read in 24 s, pass 44 s; peak memory 2.9 GB
sub-632487: 38 chunk columns read in 25 s, pass 45 s; peak memory 3.3 GB
sub-637542: 38 chunk columns read in 26 s, pass 46 s; peak memory 3.8 GB
sub-637908: 38 chunk columns read in 27 s, pass 47 s; peak memory 4.2 GB
sub-637909: 38 chunk columns read in 25 s, pass 45 s; peak memory 4.6 GB
sub-640507: 38 chunk columns read in 25 s, pass 46 s; peak memory 5.1 GB
sub-642507: 38 chunk columns read in 26 s, pass 46 s; peak memory 5.6 GB
sub-645322: 38 chunk columns read in 26 s, pass 45 s; peak memory 6.0 GB
sub-645324: 38 chunk columns read in 26 s, pass 46 s; peak memory 6.4 GB
sub-645495: 38 chunk columns read in 25 s, pass 45 s; peak memory 6.9 GB
sub-647836: 38 chunk columns read in 25 s, pass 45 s; peak memory 7.3 GB
sub-649323: 38 chunk columns read in 27 s, pass 47 s; peak memory 7.8 GB
sub-649324: 38 chunk columns read in 25 s, pass 46 s; peak memory 8.2 GB V1 read in 12.5 min since the start
clock = pd.DataFrame([{"mouse": m, "t0": passes[m]["t0"], "fs_fitted": passes[m]["fs"],
"max_residual_ms": 1000 * passes[m]["clock_resid"]} for m in mice])
print("LFP clock fitted to 12 timestamps spread over each file:")
print(clock.to_string(index=False))
# Clock check: the evoked LFP of P4 for xxxY (main block, P4 = y) against xxxX (main block,
# P4 = x). The two differ only in P4's orientation, so a true onset shows their difference
# starting after P4 onset, and not before it.
tt = glo.epoch_times()
win = [(-0.3, -0.2), (-0.2, -0.1), (-0.1, 0.0), (0.0, 0.03), (0.03, 0.06), (0.06, 0.1), (0.1, 0.2), (0.2, 0.4)]
rows = []
for m in mice:
a = passes[m]["erp_sum"]["lo_gloexp"] / passes[m]["n"]["lo_gloexp"]
b = passes[m]["erp_sum"]["go_gloexp"] / passes[m]["n"]["go_gloexp"]
d = np.abs(a - b).mean(0) * 1e6
rows.append({"mouse": m, **{f"{int(w0 * 1000)}..{int(w1 * 1000)}ms": d[(tt >= w0) & (tt < w1)].mean() for w0, w1 in win}})
ck = pd.DataFrame(rows).set_index("mouse")
print("\nMean |ERP(xxxY) - ERP(xxxX)| over channels (microvolts), by window around P4 onset:")
print(ck.round(1).to_string())
print("\nratio of 60-100 ms to -100-0 ms:", (ck["60..100ms"] / ck["-100..0ms"]).round(2).to_dict())
LFP clock fitted to 12 timestamps spread over each file:
mouse t0 fs_fitted max_residual_ms
sub-621890 4.832479 1250.005935 3.637979e-09
sub-632485 4.490968 1250.005617 1.070255e-09
sub-632487 4.476411 1250.005764 2.728484e-09
sub-637542 4.471338 1250.005840 1.364242e-09
sub-637908 4.482689 1250.005806 1.818989e-09
sub-637909 4.665170 1250.006297 3.183231e-09
sub-640507 4.334289 1250.005729 3.637979e-09
sub-642507 3.545347 1250.005934 1.560974e-09
sub-645322 3.594403 1250.006222 1.818989e-09
sub-645324 3.760852 1250.006553 2.159606e-09
sub-645495 3.530855 1250.006309 9.947598e-10
sub-647836 3.570652 1250.006518 1.818989e-09
sub-649323 3.562598 1250.006374 2.728484e-09
sub-649324 3.571417 1250.006506 9.094947e-10
Mean |ERP(xxxY) - ERP(xxxX)| over channels (microvolts), by window around P4 onset:
-300..-200ms -200..-100ms -100..0ms 0..30ms 30..60ms 60..100ms 100..200ms 200..400ms
mouse
sub-621890 20.0 5.8 5.6 7.8 11.4 71.800003 109.500000 53.400002
sub-632485 5.0 7.6 7.6 6.9 5.8 19.400000 36.500000 29.100000
sub-632487 19.6 10.7 14.7 12.6 8.7 29.700001 114.300003 50.200001
sub-637542 9.2 11.2 6.9 11.2 7.2 33.799999 39.200001 52.099998
sub-637908 10.3 12.3 10.1 14.0 14.7 33.200001 108.099998 79.199997
sub-637909 18.5 9.4 14.0 10.1 13.9 39.599998 42.700001 30.900000
sub-640507 13.3 9.5 11.7 6.4 6.8 44.500000 52.400002 73.199997
sub-642507 8.3 7.3 6.4 4.0 4.7 20.900000 70.599998 46.700001
sub-645322 12.2 25.4 4.4 3.7 13.3 57.000000 158.600006 74.000000
sub-645324 5.5 11.6 7.6 5.4 12.6 19.600000 59.799999 51.200001
sub-645495 6.2 5.9 6.7 6.2 5.4 12.800000 50.799999 53.700001
sub-647836 13.2 4.1 3.8 3.2 3.7 17.299999 35.900002 15.300000
sub-649323 4.5 4.2 4.1 3.5 3.3 26.700001 41.000000 30.000000
sub-649324 10.8 6.0 3.7 4.4 6.0 29.500000 59.799999 37.099998
ratio of 60-100 ms to -100-0 ms: {'sub-621890': 12.760000228881836, 'sub-632485': 2.5399999618530273, 'sub-632487': 2.0199999809265137, 'sub-637542': 4.880000114440918, 'sub-637908': 3.2799999713897705, 'sub-637909': 2.819999933242798, 'sub-640507': 3.799999952316284, 'sub-642507': 3.240000009536743, 'sub-645322': 12.970000267028809, 'sub-645324': 2.5899999141693115, 'sub-645495': 1.899999976158142, 'sub-647836': 4.610000133514404, 'sub-649323': 6.579999923706055, 'sub-649324': 8.0600004196167}
All V1 files have a linear clock in seconds (residuals printed). In every mouse the evoked difference between the two P4 orientations is small before P4 onset and grows after about 30 to 60 ms, as a visual response does; so the LFP and the stimulus table share a clock in each session, as far as this contrast shows.
Spectrograms, aperiodic removal and cluster tests (S2 to S5)¶
Trials are pooled over mice as observations. FOOOF is fitted per condition and kept channel to the spectrogram averaged over trials and time (reading a: all frequencies, 5 to 150 Hz; reading b: 5 to 90 Hz). The fast cluster test is first checked against MNE's on a small subset.
The first time bin is centred at -10 ms, and its 200 ms window runs from -110 to +90 ms, so a value there already holds up to 90 ms of the response. A "first" time of -10 ms in the laminar tables means within the first 90 ms after onset, and an order between -10 and 0 ms (or any two bins 10 ms apart) is finer than the window resolves.
import mne
rng = np.random.default_rng(0) # standard choice: synthetic check data only
a_ = rng.normal(size=(30, 8, 6, 5))
b_ = rng.normal(size=(25, 8, 6, 5))
a_[:, 2:5, 1:4, 1:3] += 1.0
thr = glo.f_threshold(30, 25)
f_m, cl_m, p_m, _ = mne.stats.spatio_temporal_cluster_test([a_, b_], threshold=thr, n_permutations=1000, tail=1,
seed=1, out_type="mask", verbose=False)
f_g, lab_g, p_g = glo.cluster_test(a_, b_, np.random.default_rng(1), threshold=thr)
print("F maps equal:", np.allclose(f_m, f_g))
print("MNE clusters (size, p):", sorted([(int(c.sum()), round(p, 3)) for c, p in zip(cl_m, p_m)], reverse=True)[:4])
print("glo clusters (size, p): ", sorted([(int((lab_g == k + 1).sum()), round(p, 3)) for k, p in enumerate(p_g)], reverse=True)[:4])
Use rng= instead of seed= in new code
/home/runner/work/encore/encore/executed/sennesh-2025/.venv/lib/python3.13/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html from .autonotebook import tqdm as notebook_tqdm
F maps equal: True MNE clusters (size, p): [(14, np.float64(0.001)), (1, np.float64(0.579))] glo clusters (size, p): [(14, np.float64(0.001)), (1, np.float64(0.603))]
freqs = glo.FOI
times = glo.TOI
print("spectrogram frequencies, label: FFT bin (Hz):", ", ".join(f"{a:.0f}: {b:.1f}" for a, b in zip(freqs, glo.FOI_HZ)))
power = {}
for c in glo.CONDITIONS:
power[c] = np.concatenate([passes[m]["spec"][c] for m in mice])
for m in mice:
passes[m]["spec"][c] = None
trial_mouse = {c: np.concatenate([[m] * passes[m]["n"][c] for m in mice]) for c in glo.CONDITIONS}
print({c: power[c].shape for c in power})
FIT = {"a": [5, 150], "b": [5, 90]}
aperiodic = {}
for r, rng_ in FIT.items():
for c in glo.CONDITIONS:
mean = power[c].mean((0, 1)) # freq, channel
for k in range(mean.shape[1]):
ap, params, fm = glo.fooof_aperiodic(freqs, mean[:, k], rng_)
aperiodic[(r, c, k)] = (ap, params, fm.r_squared_)
fit = pd.DataFrame([{"reading": r, "condition": c, "channel": k, "offset": p[0], "exponent": p[1], "r2": q}
for (r, c, k), (ap, p, q) in aperiodic.items()])
print(fit.groupby(["reading", "condition"])[["offset", "exponent", "r2"]].agg(["min", "max"]).round(3).to_string())
def db(c, r):
ap = np.stack([aperiodic[(r, c, k)][0] for k in range(power[c].shape[-1])], -1) # freq, channel
return (10 * (np.log10(power[c]) - ap[None, None])).astype(np.float32)
spectrogram frequencies, label: FFT bin (Hz): 5: 4.9, 10: 9.8, 15: 14.6, 20: 19.5, 25: 24.4, 30: 29.3, 35: 34.2, 40: 39.1, 45: 43.9, 50: 48.8, 55: 53.7, 60: 58.6, 65: 63.5, 70: 68.4, 75: 73.2, 80: 78.1, 85: 83.0, 90: 87.9, 95: 92.8, 100: 97.7, 105: 107.4, 110: 112.3, 115: 117.2, 120: 122.1, 125: 127.0, 130: 131.8, 135: 136.7, 140: 141.6, 145: 146.5, 150: 151.4
{'lonaive': (700, 53, 30, 19), 'lo_gloexp': (8465, 53, 30, 19), 'go_gloexp': (2046, 53, 30, 19), 'lo_rndctl': (538, 53, 30, 19), 'go_seqctl': (1351, 53, 30, 19), 'igo_seqctl': (1351, 53, 30, 19)}
offset exponent r2
min max min max min max
reading condition
a go_gloexp -4.062 -2.582 1.679 2.040 0.992 0.999
go_seqctl -3.849 -2.429 1.733 2.081 0.992 0.999
igo_seqctl -3.644 -2.198 1.836 2.131 0.994 1.000
lo_gloexp -3.798 -2.058 1.783 2.114 0.996 1.000
lo_rndctl -4.003 -2.127 1.698 2.081 0.993 1.000
lonaive -4.377 -2.155 1.669 2.105 0.995 0.999
b go_gloexp -4.343 -2.773 1.409 1.917 0.975 0.997
go_seqctl -4.158 -2.564 1.452 2.030 0.984 0.999
igo_seqctl -3.952 -2.335 1.560 2.093 0.989 1.000
lo_gloexp -4.085 -2.277 1.495 2.105 0.989 1.000
lo_rndctl -4.293 -2.357 1.419 2.029 0.988 0.997
lonaive -4.593 -2.277 1.444 2.103 0.986 0.999
results = {}
SEEDS = {"DD": "fig2c-dd-v1-contrast", "GO": "fig3c-go-v1-contrast", "SSA": "fig4c-ssa-v1-contrast"}
F5SEED = "fig5-l23-gamma-by-area" # the areas notebook's seed, for the comparison with its light pass
for r in FIT:
cond_mean = {}
for name, (ca, cb) in glo.CONTRASTS.items():
da, dbb = db(ca, r), db(cb, r)
cond_mean[ca], cond_mean[cb] = da.mean(0), dbb.mean(0)
for off in OFFS + ["fig5"]:
t = time.time()
s_ = seed(F5SEED) if off == "fig5" else seed(SEEDS[name]) + off
f_obs, lab, pv = glo.cluster_test(da, dbb, np.random.default_rng(s_))
sig = np.isin(lab, 1 + np.flatnonzero(pv < 0.01))
diff = cond_mean[ca] - cond_mean[cb]
results[(r, name, off)] = {"mask": sig, "diff": diff, "masked": np.where(sig, diff, 0.0),
"n_clusters": len(pv), "n_sig": int((pv < 0.01).sum()),
"p_sorted": np.sort(pv)[:5]}
if off == 0:
print(f"reading {r} {name}: {len(da)} vs {len(dbb)} trials, {len(pv)} clusters, "
f"{int((pv < 0.01).sum())} with p < 0.01, smallest p {np.round(np.sort(pv)[:4], 3)}; "
f"{time.time() - t:.0f} s")
del da, dbb
# S6, two readings: the trial mean of per-trial dB (cond_mean), and dB of the trial-mean power
# over the aperiodic fit (cond_lin, the code's oscillatory() -> erp() -> decibels()); both
# then averaged over channels.
results[(r, "cond_mean")] = {c: cond_mean[c].mean(-1) for c in glo.CONDITIONS} # time, freq
results[(r, "cond_lin")] = {}
for c in glo.CONDITIONS:
ap = np.stack([aperiodic[(r, c, k)][0] for k in range(power[c].shape[-1])], -1)
results[(r, "cond_lin")][c] = (10 * (np.log10(power[c].mean(0)) - ap[None])).mean(-1)
del cond_mean
n_trials = {c: int(power[c].shape[0]) for c in glo.CONDITIONS}
del power
print(f"cluster tests done, {(time.time() - started) / 60:.1f} min since the start; "
f"peak memory {resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6:.1f} GB")
reading a DD: 538 vs 700 trials, 88 clusters, 1 with p < 0.01, smallest p [0.001 0.061 0.081 0.175]; 2 s
reading a GO: 2046 vs 1351 trials, 106 clusters, 3 with p < 0.01, smallest p [0.001 0.001 0.001 0.118]; 3 s
reading a SSA: 8465 vs 1351 trials, 37 clusters, 1 with p < 0.01, smallest p [0.001 0.061 0.416 0.547]; 7 s
reading b DD: 538 vs 700 trials, 100 clusters, 3 with p < 0.01, smallest p [0.001 0.004 0.009 0.146]; 2 s
reading b GO: 2046 vs 1351 trials, 63 clusters, 2 with p < 0.01, smallest p [0.001 0.001 0.055 0.159]; 3 s
reading b SSA: 8465 vs 1351 trials, 35 clusters, 1 with p < 0.01, smallest p [0.001 0.032 0.118 0.126]; 7 s
cluster tests done, 14.9 min since the start; peak memory 10.7 GB
L = np.array(kl)
GROUPS = {"L1": L == "L1", "L2/3": L == "L2/3", "L4": L == "L4", "L5/6": L == "L5/6"}
def fbins(lo, hi):
"""Frequency bins from lo to hi inclusive (claims' ranges such as 40-55 Hz)."""
return (freqs >= lo) & (freqs <= hi)
def band(name):
return glo.band_bins(freqs, glo.BANDS[name])
def tsel(lo, hi):
return (times >= lo) & (times <= hi)
def panel_c(r, name, off=0):
"""Masked contrast averaged over channels: time, freq."""
return results[(r, name, off)]["masked"].mean(-1)
def laminar(r, name, bname, off=0):
"""Masked contrast averaged over a band's bins: time, channel."""
return results[(r, name, off)]["masked"][:, band(bname), :].mean(1)
def show(arr, title, ylab, yt=None):
fig, ax = plt.subplots(figsize=(5, 3))
v = np.nanmax(np.abs(arr)) or 1
ax.imshow(arr.T, aspect="auto", origin="lower" if yt is None else "upper", cmap="RdBu_r", vmin=-v, vmax=v,
extent=[times[0] * 1000, times[-1] * 1000, 0, arr.shape[1]])
ax.set_title(title, fontsize=9)
ax.set_xlabel("ms from P4 onset")
ax.set_ylabel(ylab)
plt.show()
print(f"{title}: range {np.nanmin(arr):.2f} to {np.nanmax(arr):.2f} dB (colour scale symmetric, nothing clipped)")
Variants: the median filter and where the downsampling starts¶
Two checks asked for in verification. (1) The areas notebook reads only the kept rows, without
the S1 median filter. Here the V1 cluster tests are repeated on the kept rows without the filter
(nofilt), under the areas notebook's seed, and its Figure 5 values (L2/3 gamma) are set beside
the filtered ones under the same seed. (2) The kept rows follow the code: every fourth row from
the deepest, the topmost common row being left out by the code's crop (see glo.alignment).
The tests are repeated with the start moved up by 1 and by 3 rows (shift1, shift3), under
each contrast's own seed. The printout above gives which rows are L1: the main analysis and
shift3 each keep one L1 row, a different one, and shift1 keeps none (nor would a shift of 2,
not run, to stay within memory). The laminar claims that rest on L1 print these variants.
VLAB = {"nofilt": np.array(kl), **{f"shift{k}": np.array([labels[j] for j in glo.kept_rows(len(labels), k)]) for k in glo.KEPT_SHIFTS}}
variant = {}
for vname in VLAB:
t = time.time()
vpow = {}
for c in glo.CONDITIONS:
vpow[c] = glo.variant_power([passes[m]["variants"][vname][c] for m in mice])
for m in mice:
passes[m]["variants"][vname][c] = None
for r, rng_ in FIT.items():
ap = {}
for c in glo.CONDITIONS:
mean = vpow[c].mean((0, 1))
ap[c] = np.stack([glo.fooof_aperiodic(freqs, mean[:, k], rng_)[0] for k in range(mean.shape[1])], -1)
for name, (ca, cb) in glo.CONTRASTS.items():
da = (10 * (np.log10(vpow[ca]) - ap[ca][None, None])).astype(np.float32)
dbb = (10 * (np.log10(vpow[cb]) - ap[cb][None, None])).astype(np.float32)
s_ = seed(F5SEED) if vname == "nofilt" else seed(SEEDS[name])
f_obs, lab, pv = glo.cluster_test(da, dbb, np.random.default_rng(s_))
sig = np.isin(lab, 1 + np.flatnonzero(pv < 0.01))
variant[(vname, r, name)] = {"mask": sig, "masked": np.where(sig, da.mean(0) - dbb.mean(0), 0.0),
"n_sig": int((pv < 0.01).sum())}
del da, dbb
del vpow
print(f"variant {vname}: {len(VLAB[vname])} rows; tests done in {time.time() - t:.0f} s; "
f"peak memory {resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6:.1f} GB")
def l23_v1(masked, mask, lab, bname):
"""Figure 5 value as the areas notebook computes it: L2/3 rows, band bins, mean over bins,
time and rows of the masked contrast; and the number of significant L2/3 band points."""
bb, rows_ = band(bname), lab == "L2/3"
return float(masked[:, bb][:, :, rows_].mean(1).mean(0).mean()), int(mask[:, bb][:, :, rows_].sum())
rows = []
for r in FIT:
for name in glo.CONTRASTS:
a_, b_ = results[(r, name, "fig5")], variant[("nofilt", r, name)]
for bname in ["gamma", "gamma_code"]:
v0, n0 = l23_v1(a_["masked"], a_["mask"], L, bname)
v1_, n1_ = l23_v1(b_["masked"], b_["mask"], VLAB["nofilt"], bname)
rows.append({"S3": r, "contrast": name, "band": bname, "filtered_value": v0, "filtered_sig_points": n0,
"nofilt_value": v1_, "nofilt_sig_points": n1_})
both, either = (a_["mask"] & b_["mask"]).sum(), (a_["mask"] | b_["mask"]).sum()
print(f"S3 {r} {name}: significant points filtered {int(a_['mask'].sum())}, without filter {int(b_['mask'].sum())}, "
f"shared {int(both)} of {int(either)} in either; significant clusters {a_['n_sig']} and {b_['n_sig']}")
print("V1 L2/3 gamma (Figure 5 value, whole window), with and without the S1 median filter, areas notebook's seed:")
print(pd.DataFrame(rows).round(3).to_string(index=False))
def layer_table(name, bname):
"""Per start of the kept rows and S3 reading: per layer group, the largest increase and decrease
of the masked band contrast and the first time bin with a positive and a negative value."""
out = []
for vname, lab_ in [("shift0", L)] + [(f"shift{k}", VLAB[f"shift{k}"]) for k in glo.KEPT_SHIFTS]:
for r in FIT:
lam = laminar(r, name, bname) if vname == "shift0" else variant[(vname, r, name)]["masked"][:, band(bname), :].mean(1)
for g in ["L1", "L2/3", "L4", "L5/6"]:
x = lam[:, lab_ == g]
if x.shape[1] == 0: # no kept row in this group
out.append({"start_row": vname, "reading": r, "group": g, "rows": 0})
continue
tp, tn = np.flatnonzero((x > 0).any(1)), np.flatnonzero((x < 0).any(1))
out.append({"start_row": vname, "reading": r, "group": g, "rows": int((lab_ == g).sum()),
"max": x.max(), "min": x.min(), "pos_points": int((x > 0).sum()), "neg_points": int((x < 0).sum()),
"first_pos_ms": 1000 * times[tp[0]] if len(tp) else np.nan,
"first_neg_ms": 1000 * times[tn[0]] if len(tn) else np.nan})
df = pd.DataFrame(out)
print(f"{name} {bname} laminar panel by start of the kept rows (shift0 is the main analysis):")
print(df.round(3).to_string(index=False))
return df
variant nofilt: 19 rows; tests done in 32 s; peak memory 10.7 GB
variant shift1: 18 rows; tests done in 30 s; peak memory 10.7 GB
variant shift3: 18 rows; tests done in 30 s; peak memory 10.7 GB S3 a DD: significant points filtered 5601, without filter 5393, shared 4530 of 6464 in either; significant clusters 1 and 1 S3 a GO: significant points filtered 4772, without filter 4008, shared 3606 of 5174 in either; significant clusters 3 and 4 S3 a SSA: significant points filtered 15945, without filter 15997, shared 14533 of 17409 in either; significant clusters 1 and 1 S3 b DD: significant points filtered 6096, without filter 6093, shared 5002 of 7187 in either; significant clusters 3 and 3 S3 b GO: significant points filtered 11290, without filter 10272, shared 9168 of 12394 in either; significant clusters 2 and 2 S3 b SSA: significant points filtered 19843, without filter 19454, shared 18378 of 20919 in either; significant clusters 1 and 1 V1 L2/3 gamma (Figure 5 value, whole window), with and without the S1 median filter, areas notebook's seed: S3 contrast band filtered_value filtered_sig_points nofilt_value nofilt_sig_points a DD gamma 0.797 1447 0.745 1366 a DD gamma_code 1.466 817 1.466 808 a GO gamma 0.121 1316 0.134 1307 a GO gamma_code 0.154 518 0.156 526 a SSA gamma -0.040 2231 -0.041 2265 a SSA gamma_code 0.509 1002 0.493 1011 b DD gamma 0.696 1590 0.643 1582 b DD gamma_code 1.394 810 1.398 801 b GO gamma 0.085 1269 0.140 1030 b GO gamma_code 0.111 439 0.201 314 b SSA gamma -0.498 2609 -0.549 2734 b SSA gamma_code 0.059 951 0.008 963
trial-counts¶
Pooled over the 14 mice, the analysed P4 trials number 541 for "XXXY" (random control) and 700 for "xxxy" (habituation), 2041 for "xxxX" and 1355 for "xxxx", and 8462 for "xxxY" and 1352 for "yyyy".
exp = {"lo_rndctl": 541, "lonaive": 700, "go_gloexp": 2041, "go_seqctl": 1355, "lo_gloexp": 8462, "igo_seqctl": 1352}
tc = pd.DataFrame({"paper": exp, "dandiset": {c: n_trials[c] for c in exp}})
tc["difference"] = tc.dandiset - tc.paper
tc["percent"] = (100 * tc.difference / tc.paper).round(1)
print(tc.to_string())
print("\nper mouse:")
print(counts[list(exp)].to_string())
alt = counts.drop(index="sub-621890", errors="ignore")[list(exp)].sum()
print("\nwithout sub-621890 (other schedule):", alt.to_dict())
paper dandiset difference percent
lo_rndctl 541 538 -3 -0.6
lonaive 700 700 0 0.0
go_gloexp 2041 2046 5 0.2
go_seqctl 1355 1351 -4 -0.3
lo_gloexp 8462 8465 3 0.0
igo_seqctl 1352 1351 -1 -0.1
per mouse:
lo_rndctl lonaive go_gloexp go_seqctl lo_gloexp igo_seqctl
mouse
sub-621890 43 50 157 50 649 50
sub-632485 37 50 145 100 601 100
sub-632487 38 50 145 100 602 100
sub-637542 38 50 145 101 601 101
sub-637908 37 50 145 100 601 100
sub-637909 39 50 145 100 601 100
sub-640507 37 50 145 100 602 100
sub-642507 39 50 146 100 601 100
sub-645322 38 50 146 100 601 100
sub-645324 38 50 145 100 601 100
sub-645495 38 50 146 100 601 100
sub-647836 39 50 146 100 601 100
sub-649323 39 50 145 100 602 100
sub-649324 38 50 145 100 601 100
without sub-621890 (other schedule): {'lo_rndctl': 495, 'lonaive': 650, 'go_gloexp': 1889, 'go_seqctl': 1301, 'lo_gloexp': 7816, 'igo_seqctl': 1301}
Result: partially reproduced. The dandiset's stimulus tables give 538, 700, 2046, 1351, 8465
and 1351 trials against the paper's 541, 700, 2041, 1355, 8462 and 1352: the habituation count
matches and the other five differ by 1 to 5 trials (at most 0.6%), inside the criterion's 5% bound.
The table holds 25 pure "xxxy" sequences in its first block (printed above for sub-621890), so the
50 habituation trials are those 25 and the first 25 of the main block; no other interval table
holds a habituation block (invalid_times holds one empty row per session).
three-contrasts-gamma-increase¶
Each of the three oddball contrasts (deviance detection, global oddball, stimulus-specific adaptation) shows a significant increase in gamma power between 30 and 60 Hz for the oddball over its control.
rows = []
for r in FIT:
for name in glo.CONTRASTS:
for off in OFFS:
mk = results[(r, name, off)]["masked"][:, fbins(30, 60), :]
rows.append({"reading": r, "contrast": name, "seed_offset": off, "pos_points_30_60": int((mk > 0).sum()),
"max_dB": round(float(mk.max()), 3), "neg_points_30_60": int((mk < 0).sum())})
g3 = pd.DataFrame(rows)
print(g3.to_string(index=False))
reading contrast seed_offset pos_points_30_60 max_dB neg_points_30_60
a DD 0 2277 5.588 509
a DD 1000 2277 5.588 509
a DD 2000 2277 5.588 509
a DD 3000 2277 5.588 509
a DD 4000 2277 5.588 509
a GO 0 1554 1.367 389
a GO 1000 1554 1.367 389
a GO 2000 1554 1.367 389
a GO 3000 1554 1.367 389
a GO 4000 1554 1.367 389
a SSA 0 2060 2.816 2134
a SSA 1000 2060 2.816 2134
a SSA 2000 2060 2.816 2134
a SSA 3000 2060 2.816 2134
a SSA 4000 2060 2.816 2134
b DD 0 1832 5.586 682
b DD 1000 1832 5.586 682
b DD 2000 1832 5.586 682
b DD 3000 1832 5.586 682
b DD 4000 1832 5.586 604
b GO 0 460 1.625 477
b GO 1000 460 1.625 477
b GO 2000 460 1.625 477
b GO 3000 460 1.625 477
b GO 4000 460 1.625 477
b SSA 0 1748 2.961 2771
b SSA 1000 1748 2.961 2771
b SSA 2000 1748 2.961 2771
b SSA 3000 1748 2.961 2771
b SSA 4000 1748 2.961 2771
Result: reproduced. In V1 each contrast has significant positive values between 30 and 60 Hz under both S3 readings: DD 2277, GO 1554 and SSA 2060 masked points (reading a; 1832, 460 and 1748 under reading b), largest 5.59, 1.37 and 2.82 dB. The counts are the same under all five seeds.
fig2ab-dd-condition-spectra¶
In V1, the response to "XXXY" (random) shows an increase then a decrease of alpha/beta power after onset and a long-lasting 2.5-5 dB gamma (40-55 Hz) increase; the response to habituated "xxxy" shows a fast increase of alpha/beta power above 5 dB that returns to baseline, followed by a long-lasting 2.5-5 dB gamma increase.
S6 = {"lin": "dB of trial-mean power (code)", "dbmean": "trial mean of dB"}
def cond_panel(r, c, s6="lin"):
"""Condition panel (time, freq), dB over the aperiodic fit, channel mean; s6 picks the reading."""
return results[(r, "cond_lin" if s6 == "lin" else "cond_mean")][c]
def bandmean(arr, lo, hi):
return arr[:, fbins(lo, hi)].mean(1)
AB = (10, 25) # alpha/beta bins 10-30 Hz by S5's rule: 10, 15, 20, 25 Hz
def summary_cond(r, c, s6):
p = cond_panel(r, c, s6)
ab = p[:, fbins(*AB)].mean(1)
g = p[:, fbins(40, 55)]
return {"S3": r, "S6": s6, "condition": c, "ab_at_-10ms": ab[0],
"ab_max_0_150": ab[tsel(0, 0.15)].max(), "ab_t_max_ms": 1000 * times[tsel(0, 0.5)][ab[tsel(0, 0.5)].argmax()],
"ab_min_150_500": ab[tsel(0.15, 0.5)].min(),
"g4055_max_0_500": g[tsel(0, 0.5)].max(), "g4055_max_250_500": g[tsel(0.25, 0.5)].max(),
"g4055_max_150_500": g[tsel(0.15, 0.5)].max(), "g4055_mean_150_500": g[tsel(0.15, 0.5)].mean(),
"panel_min": p.min(), "panel_max": p.max()}
for r in FIT:
for c in ["lo_rndctl", "lonaive"]:
show(cond_panel(r, c), f"reading {r}: {c} dB of trial-mean power over aperiodic, channel mean", "frequency bin (5-150 Hz)")
print(pd.DataFrame([summary_cond(r, c, s6) for r in FIT for s6 in S6 for c in ["lo_rndctl", "lonaive"]]).round(2).to_string(index=False))
reading a: lo_rndctl dB of trial-mean power over aperiodic, channel mean: range -3.14 to 6.27 dB (colour scale symmetric, nothing clipped)
reading a: lonaive dB of trial-mean power over aperiodic, channel mean: range -3.13 to 4.45 dB (colour scale symmetric, nothing clipped)
reading b: lo_rndctl dB of trial-mean power over aperiodic, channel mean: range -3.26 to 5.41 dB (colour scale symmetric, nothing clipped)
reading b: lonaive dB of trial-mean power over aperiodic, channel mean: range -3.70 to 3.84 dB (colour scale symmetric, nothing clipped) S3 S6 condition ab_at_-10ms ab_max_0_150 ab_t_max_ms ab_min_150_500 g4055_max_0_500 g4055_max_250_500 g4055_max_150_500 g4055_mean_150_500 panel_min panel_max a lin lo_rndctl -2.27 1.28 250.0 -1.53 6.27 6.27 6.27 3.94 -3.14 6.27 a lin lonaive -2.54 2.36 80.0 -1.36 4.27 4.27 4.27 2.08 -3.13 4.45 a dbmean lo_rndctl -6.28 -1.92 80.0 -5.09 1.58 1.58 1.58 -0.90 -7.72 1.58 a dbmean lonaive -6.98 -0.87 80.0 -5.10 -0.50 -0.50 -0.50 -2.24 -7.64 -0.08 b lin lo_rndctl -2.53 1.02 250.0 -1.79 5.41 5.41 5.41 2.97 -3.26 5.41 b lin lonaive -2.79 2.12 80.0 -1.61 3.59 3.59 3.59 1.32 -3.70 3.84 b dbmean lo_rndctl -6.54 -2.18 80.0 -5.35 0.72 0.72 0.72 -1.87 -7.17 0.72 b dbmean lonaive -7.23 -1.12 80.0 -5.35 -1.18 -1.18 -1.18 -3.00 -7.84 -0.53
rows = []
for r in FIT:
for s6 in S6:
x = cond_panel(r, "lo_rndctl", s6)
n = cond_panel(r, "lonaive", s6)
abx, abn = bandmean(x, *AB), bandmean(n, *AB)
gx = x[:, fbins(40, 55)]
tpk = np.flatnonzero(tsel(0, 0.5))[abx[tsel(0, 0.5)].argmax()]
rise = abx[tpk] - abx[0]
fall = abx[tpk] - abx[tpk:][times[tpk:] <= 0.5].min()
rows.append({"S3": r, "S6": s6,
"XXXY_g4055_max": gx[tsel(0, 0.5)].max(),
"XXXY_g_in_range": 2.25 <= gx[tsel(0, 0.5)].max() <= 5.5,
"XXXY_g4055_max_after_250": gx[tsel(0.25, 0.5)].max(),
"XXXY_g_lasts_past_250 (max after 250 >= 2.25)": gx[tsel(0.25, 0.5)].max() >= 2.25,
"xxxy_ab_at_-10ms": abn[0],
"xxxy_ab_max_0_150": abn[tsel(0, 0.15)].max(),
"xxxy_ab_ge_4.5": abn[tsel(0, 0.15)].max() >= 4.5,
"xxxy_ab_min_150_500": abn[tsel(0.15, 0.5)].min(),
"xxxy_ab_back_below_1": abn[tsel(0.15, 0.5)].min() < 1,
"XXXY_ab_at_-10ms": abx[0], "XXXY_ab_peak": abx[tpk], "XXXY_ab_peak_ms": 1000 * times[tpk],
"XXXY_ab_rise_from_-10ms": rise, "XXXY_ab_fall_after_peak": fall,
"XXXY_ab_rise_then_fall (each > 1 dB)": rise > 1 and fall > 1})
f2ab = pd.DataFrame(rows)
print(f2ab.round(2).T.to_string())
0 1 2 3 S3 a a b b S6 lin dbmean lin dbmean XXXY_g4055_max 6.27 1.58 5.41 0.72 XXXY_g_in_range False False True False XXXY_g4055_max_after_250 6.27 1.58 5.41 0.72 XXXY_g_lasts_past_250 (max after 250 >= 2.25) True False True False xxxy_ab_at_-10ms -2.54 -6.98 -2.79 -7.23 xxxy_ab_max_0_150 2.36 -0.87 2.12 -1.12 xxxy_ab_ge_4.5 False False False False xxxy_ab_min_150_500 -1.36 -5.1 -1.61 -5.35 xxxy_ab_back_below_1 True True True True XXXY_ab_at_-10ms -2.27 -6.28 -2.53 -6.54 XXXY_ab_peak 1.71 -1.92 1.45 -2.18 XXXY_ab_peak_ms 250.0 80.0 250.0 80.0 XXXY_ab_rise_from_-10ms 3.98 4.36 3.98 4.36 XXXY_ab_fall_after_peak 2.76 3.17 2.76 3.17 XXXY_ab_rise_then_fall (each > 1 dB) True True True True
Result: partially reproduced, resting on an assumption. Read as the code draws the panels (dB of the trial-mean power over the aperiodic fit), the shapes hold: the "XXXY" 40-55 Hz maximum lasts past 250 ms (6.27 dB in S3 reading a, 5.41 dB in reading b, the same after 250 ms); the "xxxy" alpha/beta rises from -2.54 dB at -10 ms to 2.36 dB at 80 ms and falls back below 1 dB (down to -1.36 dB after 150 ms); "XXXY" alpha/beta rises 3.98 dB from its -10 ms level to a peak at 250 ms and falls 2.76 dB after it. The values do not all hold: the "xxxy" alpha/beta maximum is 2.36 and 2.12 dB against at least 4.5, and the "XXXY" gamma maximum is in range only under reading b. Taken as the trial mean of per-trial dB values, the printed values lie 3.2 to 4.8 dB lower: the "XXXY" gamma maximum (1.58 and 0.72 dB) is reached after 250 ms, so the gamma lasts, but it is below the 2.25 dB lower bound (the column "lasts past 250" tests that level), and the "xxxy" alpha/beta maximum stays below 0 dB. The shapes hold and the values do not, which is partially reproduced under that reading too.
fig2c-dd-v1-contrast¶
In V1, deviance detection ("XXXY" against "xxxy") gives a significant decrease of about 1 dB in alpha/beta power after onset and a 1-2 dB increase in gamma power, the gamma starting near 40-65 Hz and descending toward 35-55 Hz over time.
G = band("gamma")
ABb = band("alphabeta")
def contrast_summary(r, name, off=0):
p = panel_c(r, name, off)
post = tsel(0, 0.51)
g = p[post][:, G]
a = p[post][:, ABb]
gm = np.where(g > 0, g, 0)
early, late = p[tsel(0, 0.15)][:, G], p[tsel(0.3, 0.5)][:, G]
return {"reading": r, "seed_offset": off, "gamma_max": g.max(), "gamma_pos_points": int((g > 0).sum()),
"ab_min": a.min(), "ab_neg_points": int((a < 0).sum()),
"gamma_peak_freq_early": freqs[G][early.max(0).argmax()] if early.max() > 0 else np.nan,
"gamma_peak_freq_late": freqs[G][late.max(0).argmax()] if late.max() > 0 else np.nan}
for r in FIT:
show(panel_c(r, "DD"), f"reading {r}: DD masked contrast, channel mean", "frequency bin (5-150 Hz)")
show(results[(r, "DD", 0)]["diff"].mean(-1), f"reading {r}: DD unmasked contrast, channel mean", "frequency bin")
f2c = pd.DataFrame([contrast_summary(r, "DD", off) for r in FIT for off in OFFS])
f2c["gamma_in_0.9_2.2"] = f2c.gamma_max.between(0.9, 2.2)
f2c["ab_in_-2.2_-0.9"] = f2c.ab_min.between(-2.2, -0.9)
print(f2c.round(3).to_string(index=False))
reading a: DD masked contrast, channel mean: range -1.48 to 2.66 dB (colour scale symmetric, nothing clipped)
reading a: DD unmasked contrast, channel mean: range -1.45 to 2.66 dB (colour scale symmetric, nothing clipped)
reading b: DD masked contrast, channel mean: range -1.57 to 2.46 dB (colour scale symmetric, nothing clipped)
reading b: DD unmasked contrast, channel mean: range -1.55 to 2.46 dB (colour scale symmetric, nothing clipped)
reading seed_offset gamma_max gamma_pos_points ab_min ab_neg_points gamma_peak_freq_early gamma_peak_freq_late gamma_in_0.9_2.2 ab_in_-2.2_-0.9
a 0 2.664 503 -1.478 56 45.0 45.0 False True
a 1000 2.664 503 -1.478 56 45.0 45.0 False True
a 2000 2.664 503 -1.478 56 45.0 45.0 False True
a 3000 2.664 503 -1.478 56 45.0 45.0 False True
a 4000 2.664 503 -1.478 56 45.0 45.0 False True
b 0 2.457 445 -1.569 59 45.0 45.0 False True
b 1000 2.457 445 -1.569 59 45.0 45.0 False True
b 2000 2.457 445 -1.569 59 45.0 45.0 False True
b 3000 2.457 445 -1.569 59 45.0 45.0 False True
b 4000 2.457 495 -1.569 59 45.0 45.0 False True
Result: partially reproduced. Both clusters are significant: the largest positive gamma value is 2.66 dB (reading a) and 2.46 dB (reading b), above the 0.9-2.2 dB range, and the largest alpha/beta decrease is -1.48 and -1.57 dB, in range. The largest gamma value is at 45 Hz both early and late, so the descent from 40-65 to 35-55 Hz is not seen. The same under the five seeds.
fig2d-dd-gamma-laminar¶
In V1 the deviance-induced gamma increase is strongest in superficial layers 1 to 4 (about 2 dB; the legend places it earliest and strongest at the L1 and L2/3 boundary), while after about 100 ms a weak (under 1 dB) loss of gamma power appears in L5/6.
def lam_summary(r, name, bname, off=0):
lam = laminar(r, name, bname, off) # time, channel
pos = lam.max()
k = np.unravel_index(lam.argmax(), lam.shape)[1]
sup = np.isin(L, ["L1", "L2/3", "L4"])
late = lam[times > 0.1][:, GROUPS["L5/6"]]
return {"reading": r, "band": bname, "seed_offset": off, "max": pos, "max_layer": L[k],
"sup_mean_pos": np.clip(lam[:, sup], 0, None).mean(), "deep_mean_pos": np.clip(lam[:, GROUPS["L5/6"]], 0, None).mean(),
"L56_neg_after_100_min": late.min(), "L56_neg_points_after_100": int((late < 0).sum())}
for r in FIT:
for bname in ["gamma", "gamma_code"]:
show(laminar(r, "DD", bname), f"reading {r}: DD laminar {bname}", "kept channel (top = surface)", yt=True)
print("kept channel layers, top to bottom:", list(L))
reading a: DD laminar gamma: range -0.31 to 3.02 dB (colour scale symmetric, nothing clipped)
reading a: DD laminar gamma_code: range -0.93 to 3.94 dB (colour scale symmetric, nothing clipped)
reading b: DD laminar gamma: range -0.33 to 3.02 dB (colour scale symmetric, nothing clipped)
reading b: DD laminar gamma_code: range -0.96 to 3.93 dB (colour scale symmetric, nothing clipped)
kept channel layers, top to bottom: [np.str_('L1'), np.str_('L2/3'), np.str_('L2/3'), np.str_('L2/3'), np.str_('L2/3'), np.str_('L2/3'), np.str_('L2/3'), np.str_('L4'), np.str_('L4'), np.str_('L4'), np.str_('L5/6'), np.str_('L5/6'), np.str_('L5/6'), np.str_('L5/6'), np.str_('L5/6'), np.str_('L5/6'), np.str_('L5/6'), np.str_('L5/6'), np.str_('L5/6')]
f2d = pd.DataFrame([lam_summary(r, "DD", b, off) for r in FIT for b in ["gamma", "gamma_code"] for off in OFFS])
f2d["max_superficial"] = f2d.max_layer.isin(["L1", "L2/3", "L4"])
f2d["max_in_1.8_2.2"] = f2d["max"].between(1.8, 2.2)
f2d["sup_gt_deep"] = f2d.sup_mean_pos > f2d.deep_mean_pos
f2d["L56_loss_under_1.1"] = (f2d.L56_neg_points_after_100 > 0) & (f2d.L56_neg_after_100_min > -1.1)
print(f2d.round(3).to_string(index=False))
reading band seed_offset max max_layer sup_mean_pos deep_mean_pos L56_neg_after_100_min L56_neg_points_after_100 max_superficial max_in_1.8_2.2 sup_gt_deep L56_loss_under_1.1
a gamma 0 3.017 L2/3 0.697 0.124 -0.310 162 True False True True
a gamma 1000 3.017 L2/3 0.697 0.124 -0.310 162 True False True True
a gamma 2000 3.017 L2/3 0.697 0.124 -0.310 162 True False True True
a gamma 3000 3.017 L2/3 0.697 0.124 -0.310 162 True False True True
a gamma 4000 3.017 L2/3 0.697 0.124 -0.310 162 True False True True
a gamma_code 0 3.937 L2/3 1.376 0.231 -0.931 175 True False True True
a gamma_code 1000 3.937 L2/3 1.376 0.231 -0.931 175 True False True True
a gamma_code 2000 3.937 L2/3 1.376 0.231 -0.931 175 True False True True
a gamma_code 3000 3.937 L2/3 1.376 0.231 -0.931 175 True False True True
a gamma_code 4000 3.937 L2/3 1.376 0.231 -0.931 175 True False True True
b gamma 0 3.025 L2/3 0.538 0.058 -0.320 207 True False True True
b gamma 1000 3.025 L2/3 0.538 0.058 -0.320 207 True False True True
b gamma 2000 3.025 L2/3 0.538 0.058 -0.320 207 True False True True
b gamma 3000 3.025 L2/3 0.538 0.058 -0.320 207 True False True True
b gamma 4000 3.025 L2/3 0.601 0.058 -0.320 207 True False True True
b gamma_code 0 3.932 L2/3 1.223 0.161 -0.960 209 True False True True
b gamma_code 1000 3.932 L2/3 1.223 0.161 -0.960 209 True False True True
b gamma_code 2000 3.932 L2/3 1.223 0.161 -0.960 209 True False True True
b gamma_code 3000 3.932 L2/3 1.223 0.161 -0.960 209 True False True True
b gamma_code 4000 3.932 L2/3 1.223 0.161 -0.960 209 True False True True
Result: partially reproduced. Under every reading (two S3 ranges, two gamma bands) the largest gamma increase is in an L2/3 channel, the mean positive gamma over L1 to L4 (0.54 to 1.38 dB) exceeds that over L5/6 (0.06 to 0.23 dB), and L5/6 has a significant loss after 100 ms of at most 0.31 to 0.96 dB. The largest increase is 3.02 to 3.94 dB, above 1.8-2.2 dB.
fig2e-dd-alphabeta-laminar¶
In V1, deviance detection gives a strong (about 2 dB) alpha/beta desynchronization starting in L2/3 and spreading into L4 and L5/6, and an alpha/beta increase of 1-1.5 dB in L1 during the stimulus.
def first_time(lam, group, sign):
x = lam[:, GROUPS[group]]
hit = (x < 0) if sign < 0 else (x > 0)
t = np.flatnonzero(hit.any(1))
return 1000 * times[t[0]] if len(t) else np.nan
def ab_summary(r, name, off=0):
lam = laminar(r, name, "alphabeta", off)
deep = np.isin(L, ["L2/3", "L4", "L5/6"])
return {"reading": r, "seed_offset": off, "dec_L23_L56": lam[:, deep].min(), "inc_L1": lam[:, GROUPS["L1"]].max(),
**{f"first_neg_{g}": first_time(lam, g, -1) for g in GROUPS},
**{f"first_pos_{g}": first_time(lam, g, +1) for g in GROUPS}}
for r in FIT:
show(laminar(r, "DD", "alphabeta"), f"reading {r}: DD laminar alpha/beta", "kept channel (top = surface)", yt=True)
reading a: DD laminar alpha/beta: range -2.04 to 2.76 dB (colour scale symmetric, nothing clipped)
reading b: DD laminar alpha/beta: range -2.12 to 2.73 dB (colour scale symmetric, nothing clipped)
f2e = pd.DataFrame([ab_summary(r, "DD", off) for r in FIT for off in OFFS])
f2e["dec_in_1.35_2.2"] = (-f2e.dec_L23_L56).between(1.35, 2.2)
f2e["L1_in_0.9_1.65"] = f2e.inc_L1.between(0.9, 1.65)
f2e["L23_first"] = (f2e["first_neg_L2/3"] <= f2e["first_neg_L4"].fillna(np.inf)) & (f2e["first_neg_L2/3"] <= f2e["first_neg_L5/6"].fillna(np.inf))
f2e["outcome"] = np.where(f2e["dec_in_1.35_2.2"] & f2e["L1_in_0.9_1.65"] & f2e.L23_first, "reproduced",
np.where((f2e.dec_L23_L56 < 0) & (f2e.inc_L1 > 0), "partially reproduced", "not reproduced"))
print(f2e.round(3).to_string(index=False))
print("\noutcome by S3 reading:")
print(f2e[f2e.seed_offset == 0][["reading", "outcome"]].to_string(index=False))
lt2e = layer_table("DD", "alphabeta")
reading seed_offset dec_L23_L56 inc_L1 first_neg_L1 first_neg_L2/3 first_neg_L4 first_neg_L5/6 first_pos_L1 first_pos_L2/3 first_pos_L4 first_pos_L5/6 dec_in_1.35_2.2 L1_in_0.9_1.65 L23_first outcome
a 0 -2.043 0.744 NaN 20.0 20.0 30.0 -10.0 -10.0 130.0 120.0 True False True partially reproduced
a 1000 -2.043 0.744 NaN 20.0 20.0 30.0 -10.0 -10.0 130.0 120.0 True False True partially reproduced
a 2000 -2.043 0.744 NaN 20.0 20.0 30.0 -10.0 -10.0 130.0 120.0 True False True partially reproduced
a 3000 -2.043 0.744 NaN 20.0 20.0 30.0 -10.0 -10.0 130.0 120.0 True False True partially reproduced
a 4000 -2.043 0.744 NaN 20.0 20.0 30.0 -10.0 -10.0 130.0 120.0 True False True partially reproduced
b 0 -2.124 1.072 NaN 20.0 20.0 30.0 -10.0 -10.0 140.0 120.0 True True True reproduced
b 1000 -2.124 1.072 NaN 20.0 20.0 30.0 -10.0 -10.0 140.0 120.0 True True True reproduced
b 2000 -2.124 1.072 NaN 20.0 20.0 30.0 -10.0 -10.0 140.0 120.0 True True True reproduced
b 3000 -2.124 1.072 NaN 20.0 20.0 30.0 -10.0 -10.0 140.0 120.0 True True True reproduced
b 4000 -2.124 1.072 NaN 20.0 20.0 30.0 -10.0 -10.0 140.0 120.0 True True True reproduced
outcome by S3 reading:
reading outcome
a partially reproduced
b reproduced
DD alphabeta laminar panel by start of the kept rows (shift0 is the main analysis):
start_row reading group rows max min pos_points neg_points first_pos_ms first_neg_ms
shift0 a L1 1 0.744 0.000 19.0 0.0 -10.0 NaN
shift0 a L2/3 6 2.762 -2.043 99.0 71.0 -10.0 20.0
shift0 a L4 3 0.764 -1.732 41.0 35.0 130.0 20.0
shift0 a L5/6 9 0.895 -1.269 100.0 110.0 120.0 30.0
shift0 b L1 1 1.072 0.000 29.0 0.0 -10.0 NaN
shift0 b L2/3 6 2.733 -2.124 112.0 71.0 -10.0 20.0
shift0 b L4 3 0.716 -1.736 39.0 37.0 140.0 20.0
shift0 b L5/6 9 0.726 -1.355 97.0 137.0 120.0 30.0
shift1 a L1 0 NaN NaN NaN NaN NaN NaN
shift1 a L2/3 6 3.145 -2.121 103.0 69.0 -10.0 20.0
shift1 a L4 3 0.721 -1.743 39.0 33.0 130.0 20.0
shift1 a L5/6 9 0.859 -1.148 104.0 87.0 120.0 40.0
shift1 b L1 0 NaN NaN NaN NaN NaN NaN
shift1 b L2/3 6 3.157 -2.148 123.0 66.0 -10.0 20.0
shift1 b L4 3 0.919 -1.669 43.0 38.0 140.0 20.0
shift1 b L5/6 9 0.709 -1.392 96.0 134.0 130.0 30.0
shift3 a L1 1 2.298 0.378 53.0 0.0 -10.0 NaN
shift3 a L2/3 5 2.452 -2.081 72.0 66.0 -10.0 20.0
shift3 a L4 3 0.707 -1.800 35.0 37.0 140.0 20.0
shift3 a L5/6 9 1.301 -1.200 132.0 97.0 -10.0 30.0
shift3 b L1 1 2.442 0.431 53.0 0.0 -10.0 NaN
shift3 b L2/3 5 2.405 -2.070 86.0 61.0 -10.0 20.0
shift3 b L4 3 0.763 -1.868 36.0 43.0 140.0 20.0
shift3 b L5/6 9 0.754 -1.570 102.0 143.0 120.0 20.0
Result: partially reproduced, resting on an assumption. The desynchronization is in range (-2.04 dB in S3 reading a, -2.12 dB in reading b) and starts in L2/3 at 20 ms, with L4 (20 ms) and before L5/6 (30 ms). The kept L1 row has a significant alpha/beta increase and no decrease: 0.74 dB under reading a, below the 0.9-1.65 dB range, and 1.07 dB under reading b, in range. By reading (printed): partially reproduced under reading a, reproduced under reading b; reading a, the code's fitting range, is adopted. The value rests on the single kept L1 row: the start moved up by 3 rows keeps the other L1 row, where the increase is 2.30 and 2.44 dB, and the start moved up by 1 row keeps no L1 row.
fig2f-dd-theta¶
Deviance detection gives only a weak (0.5-1 dB), late increase in theta power in V1, in L1.
print("theta bins (2-10 Hz by S5's rule):", freqs[band("theta")])
rows = []
for r in FIT:
for off in OFFS:
lam = laminar(r, "DD", "theta", off)
sig = lam != 0
rows.append({"reading": r, "seed_offset": off, "n_sig": int(sig.sum()), "n_pos": int((lam > 0).sum()), "n_neg": int((lam < 0).sum()),
"max": lam.max(), "min": lam.min(),
"layers_with_sig": sorted(set(L[np.flatnonzero(sig.any(0))])),
"first_sig_ms": 1000 * times[np.flatnonzero(sig.any(1))[0]] if sig.any() else np.nan})
f2f = pd.DataFrame(rows)
print(f2f.round(3).to_string(index=False))
for r in FIT:
show(laminar(r, "DD", "theta"), f"reading {r}: DD laminar theta", "kept channel (top = surface)", yt=True)
lt2f = layer_table("DD", "theta")
theta bins (2-10 Hz by S5's rule): [5.]
reading seed_offset n_sig n_pos n_neg max min layers_with_sig first_sig_ms
a 0 270 102 168 2.268 -1.747 [L2/3, L4, L5/6] -10.0
a 1000 270 102 168 2.268 -1.747 [L2/3, L4, L5/6] -10.0
a 2000 270 102 168 2.268 -1.747 [L2/3, L4, L5/6] -10.0
a 3000 270 102 168 2.268 -1.747 [L2/3, L4, L5/6] -10.0
a 4000 270 102 168 2.268 -1.747 [L2/3, L4, L5/6] -10.0
b 0 182 144 38 2.557 -1.437 [L2/3, L4, L5/6] -10.0
b 1000 182 144 38 2.557 -1.437 [L2/3, L4, L5/6] -10.0
b 2000 182 144 38 2.557 -1.437 [L2/3, L4, L5/6] -10.0
b 3000 182 144 38 2.557 -1.437 [L2/3, L4, L5/6] -10.0
b 4000 182 144 38 2.557 -1.437 [L2/3, L4, L5/6] -10.0
reading a: DD laminar theta: range -1.75 to 2.27 dB (colour scale symmetric, nothing clipped)
reading b: DD laminar theta: range -1.44 to 2.56 dB (colour scale symmetric, nothing clipped) DD theta laminar panel by start of the kept rows (shift0 is the main analysis): start_row reading group rows max min pos_points neg_points first_pos_ms first_neg_ms shift0 a L1 1 0.000 0.000 0.0 0.0 NaN NaN shift0 a L2/3 6 1.906 0.000 53.0 0.0 -10.0 NaN shift0 a L4 3 2.251 0.000 25.0 0.0 90.0 NaN shift0 a L5/6 9 2.268 -1.747 24.0 168.0 70.0 70.0 shift0 b L1 1 0.000 0.000 0.0 0.0 NaN NaN shift0 b L2/3 6 1.842 0.000 83.0 0.0 -10.0 NaN shift0 b L4 3 2.557 0.000 45.0 0.0 60.0 NaN shift0 b L5/6 9 1.993 -1.437 16.0 38.0 90.0 80.0 shift1 a L1 0 NaN NaN NaN NaN NaN NaN shift1 a L2/3 6 2.107 0.000 55.0 0.0 100.0 NaN shift1 a L4 3 2.115 0.000 22.0 0.0 90.0 NaN shift1 a L5/6 9 2.228 -1.760 24.0 147.0 80.0 70.0 shift1 b L1 0 NaN NaN NaN NaN NaN NaN shift1 b L2/3 6 2.197 0.000 84.0 0.0 -10.0 NaN shift1 b L4 3 3.130 0.000 52.0 0.0 50.0 NaN shift1 b L5/6 9 2.047 -1.485 19.0 34.0 90.0 80.0 shift3 a L1 1 1.549 0.000 11.0 0.0 160.0 NaN shift3 a L2/3 5 1.780 0.000 37.0 0.0 100.0 NaN shift3 a L4 3 2.020 0.000 22.0 0.0 90.0 NaN shift3 a L5/6 9 2.356 -1.836 34.0 129.0 70.0 70.0 shift3 b L1 1 1.844 0.000 20.0 0.0 140.0 NaN shift3 b L2/3 5 1.753 0.000 47.0 0.0 80.0 NaN shift3 b L4 3 2.659 0.000 44.0 0.0 60.0 NaN shift3 b L5/6 9 2.154 -1.502 25.0 32.0 90.0 80.0
Result: not reproduced. Theta (the 5 Hz bin, the only bin of 2-10 Hz by S5's rule) has significant values in L2/3, L4 and L5/6, of both signs (102 positive and 168 negative points in reading a), starting at -10 ms, and reaching 2.27 dB (reading a) and 2.56 dB (reading b), above 1.1 dB. The kept L1 row has no significant theta; the other L1 row (start moved up by 3 rows) has a late increase (1.55 and 1.84 dB, from 140 to 160 ms). The first bin at -10 ms already holds up to 90 ms after onset.
Trough-locked CSD (S7)¶
Windows are pooled over mice. The evoked potential subtracted is the trial average of each condition over all mice, applied through the trough positions (the windows are averaged, so the subtraction is exact). First sinks are found per layer group in the kept rows; the CSD repeats the edge rows (Vaknin electrodes, Elephant's default), so every kept row has a value.
S7's rule (the time of the first displayed sink in each layer group) cannot order the groups here: the display threshold, 2 SD over the number of windows, passes most points, so every group holds a displayed sink at the first lag and the first-sink times tie. The tables then also give, as an assumption of this attempt (not the claims file's rule), the sink onset of each group's mean CSD: the first lag at which it turns from source to sink, counted only for a sink that is displayed (a row of the group shows a sink) and lasts at least 1/8 of a period of the band centre (3 or 4 samples for gamma, 8 or 9 for alpha/beta, 27 for theta). Runs of sink or source shorter than that are first merged into their neighbours, shortest first; a group that is then a sink throughout has its onset at the window start, and one with no turn has none (inf). In the second verification round the verifier found that the single-sample version of this rule, used until then, let one-sample or undisplayed sign flips decide fig3h and fig3i; the single-sample onsets are printed beside the sustained ones, with the rule at 1/16 and 1/4 of a cycle. For each claim and reading the sign of each group's mean CSD, and where a group holds a displayed sink, is printed at every lag (subsampled for the longer windows), so that the patterns can be read without the images.
csd_rows = L
raw_kept = np.array([raw_labels[k] for k in kept])
seg = (tt >= glo.CSD_SEGMENT[0]) & (tt < glo.CSD_SEGMENT[1])
erp = {c: sum(passes[m]["erp_sum"][c] for m in mice) / sum(passes[m]["n"][c] for m in mice) for c in glo.CONDITIONS}
MIN_CYCLE = 1 / 8 # minimum sink and source duration, as a fraction of the band centre's period
MIN_CYCLE_VARIANTS = [1 / 16, 1 / 4]
def sustained_onset(sink, lag, k):
"""First source-to-sink turn of a boolean sink series after runs shorter than k samples are merged
into their neighbours (shortest first); the window start when the merged series is a sink throughout."""
s = sink.copy()
while True:
edges = np.flatnonzero(np.diff(s.astype(int))) + 1
starts, ends = np.r_[0, edges], np.r_[edges, len(s)]
short = [(e - b, b, e) for b, e in zip(starts, ends) if e - b < k]
if len(starts) == 1 or not short:
break
_, b, e = min(short)
s[b:e] = ~s[b:e]
turn = np.flatnonzero(~s[:-1] & s[1:])
return lag[turn[0] + 1] if len(turn) else (lag[0] if s.all() else np.inf)
def csd_result(claim, r):
c = glo.CSD_JOBS[claim][0]
S = sum(passes[m]["csd"][(claim, r)][0] for m in mice)
N = sum(passes[m]["csd"][(claim, r)][1] for m in mice)
Q = sum(passes[m]["csd"][(claim, r)][2] for m in mice)
half = passes[mice[0]]["csd"][(claim, r)][3]
e = erp[c][kept][:, seg]
W = N.sum()
tot = np.zeros((len(kept), 2 * half + 1))
cross = np.zeros((len(kept), 2 * half + 1))
esq = np.zeros_like(cross)
for s in np.flatnonzero(N):
ew = e[:, s - half:s + half + 1]
Ss = S[s].astype(np.float64)
tot += Ss - N[s] * ew
ce = glo.csd(ew[None], 1.0)[0]
cross += glo.csd(Ss[None], 1.0)[0] * ce
esq += N[s] * ce ** 2
mean_csd = glo.csd(tot[None], 1.0)[0] / W
sumsq = Q - 2 * cross + esq
sd = np.sqrt(np.maximum(sumsq / W - mean_csd ** 2, 0))
shown = np.abs(mean_csd) > 2 * sd / W
lag = 1000 * np.arange(-half, half + 1) / glo.FS
first = {}
for g in ["L1", "L2/3", "L4", "L5/6"]:
rowsg = csd_rows == g
hit = ((mean_csd < 0) & shown)[rowsg].any(0)
first[g] = lag[np.flatnonzero(hit)[0]] if hit.any() else np.inf
for g, mask in {"L5": np.char.endswith(raw_kept.astype(str), "5"), "L6": np.char.find(raw_kept.astype(str), "6") >= 0}.items():
hit = ((mean_csd < 0) & shown)[mask].any(0)
first[g] = lag[np.flatnonzero(hit)[0]] if hit.any() else np.inf
# Tie-break (S7's first-sink times tie at the window start when every group holds a sink
# there): the sink onset of each group, the first lag at which the group's mean CSD turns
# from source (>= 0) to sink (< 0); the window start when it is a sink throughout.
onset = {}
gmask = {"L1": csd_rows == "L1", "L2/3": csd_rows == "L2/3", "L4": csd_rows == "L4", "L5/6": csd_rows == "L5/6",
"L5": np.char.endswith(raw_kept.astype(str), "5"), "L6": np.char.find(raw_kept.astype(str), "6") >= 0}
for g, mask in gmask.items():
gm = mean_csd[mask].mean(0)
cross = np.flatnonzero((gm[:-1] >= 0) & (gm[1:] < 0))
onset[g] = lag[cross[0] + 1] if len(cross) else (lag[0] if (gm < 0).all() else np.inf)
gsign = {g: mean_csd[mask].mean(0) < 0 for g, mask in gmask.items()}
gshown = {g: ((mean_csd < 0) & shown)[mask].any(0) for g, mask in gmask.items()}
# Sustained onset (round-2 revision of the tie-break): the same source-to-sink turn, counted
# only for a displayed sink (the group's mean CSD is a sink and a row of the group shows a sink)
# that lasts at least MIN_CYCLE of a period of the band centre; runs of sink or source shorter
# than that are merged into their neighbours first. MIN_CYCLE_VARIANTS are shown beside it.
lo, hi = glo.CSD_BANDS[r][glo.CSD_JOBS[claim][1]]
period = glo.FS / ((lo + hi) / 2)
sustained = {f: {g: sustained_onset(gsign[g] & gshown[g], lag, int(np.ceil(f * period)))
for g in gmask} for f in [MIN_CYCLE] + MIN_CYCLE_VARIANTS}
return {"windows": int(W), "mean": mean_csd, "shown": shown, "lag": lag, "first": first, "onset": onset,
"frac_shown": shown.mean(), "gsign": gsign, "gshown": gshown, "sustained": sustained,
"min_samples": int(np.ceil(MIN_CYCLE * period))}
def csd_show(claim, r, res):
fig, ax = plt.subplots(figsize=(4, 3))
v = np.abs(res["mean"]).max()
ax.imshow(np.where(res["shown"], res["mean"], 0), aspect="auto", cmap="RdBu", vmin=-v, vmax=v,
extent=[res["lag"][0], res["lag"][-1], len(csd_rows), 0])
ax.set_title(f"{claim} reading {r} (sinks red)", fontsize=9)
ax.set_xlabel("ms from trough")
ax.set_ylabel("kept row (top = surface)")
plt.show()
print(f"{claim} reading {r}: {res['windows']} windows; CSD range {res['mean'].min():.3g} to {res['mean'].max():.3g} "
f"(V/row^2, arbitrary scale); shown fraction {res['frac_shown']:.2f}; first sink (ms from trough): "
+ ", ".join(f"{g} {v:.1f}" for g, v in res["first"].items())
+ "; sustained displayed sink onset of the group mean: "
+ ", ".join(f"{g} {v:.1f}" for g, v in res["sustained"][MIN_CYCLE].items()))
CSD = {(cl, r): csd_result(cl, r) for cl in glo.CSD_JOBS for r in ["a", "b"]}
print("CSD rows' layers (top to bottom):", list(csd_rows))
print("CSD rows' labels:", list(raw_kept))
def ff(f): # feedforward: L4 sink before the L2/3 and L5/6 sinks
return f["L4"] < f["L2/3"] and f["L4"] < f["L5/6"]
def fb(f): # feedback: L1 sink before the L2/3 and L4 sinks
return f["L1"] < f["L2/3"] and f["L1"] < f["L4"]
def csd_table(claim, rule, expected):
out = []
for r in ["a", "b"]:
res = CSD[(claim, r)]
csd_show(claim, r, res)
tied = len(set(res["first"][g] for g in ["L1", "L2/3", "L4", "L5/6"])) == 1
step = max(1, len(res["lag"]) // 64)
print(f"reading {r}, by lag from {res['lag'][0]:.1f} to {res['lag'][-1]:.1f} ms, every {step * 0.8:.1f} ms: "
"S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group")
for g in res["gsign"]:
print(f" {g:5s} mean {''.join('S' if v else '.' for v in res['gsign'][g][::step])}")
print(f" {g:5s} shown {''.join('x' if v else '.' for v in res['gshown'][g][::step])}")
out.append({"reading": r, "windows": res["windows"], "expected_windows": expected,
"within_10pct": abs(res["windows"] - expected) <= 0.1 * expected,
"S7_first_tied": tied, "S7_rule_holds": rule(res["first"]),
"single_sample_onset_rule_holds": rule(res["onset"]), "min_samples": res["min_samples"],
**{f"onset_{g}": v for g, v in res["sustained"][MIN_CYCLE].items()},
"onset_rule_holds": rule(res["sustained"][MIN_CYCLE]),
**{f"holds_at_1/{round(1 / f)}_cycle": rule(res["sustained"][f]) for f in MIN_CYCLE_VARIANTS}})
print("single-sample sink onsets (round-2 tie-break, a variant now):")
for o, r in zip(out, ["a", "b"]):
print(f" reading {r}: " + ", ".join(f"{g} {v:.1f}" for g, v in CSD[(claim, r)]["onset"].items()))
print("sustained displayed sink onsets (ms from trough), adopted at 1/8 cycle, and the rule at 1/16 and 1/4 cycle:")
print(pd.DataFrame(out).to_string(index=False))
CSD rows' layers (top to bottom): [np.str_('L1'), np.str_('L2/3'), np.str_('L2/3'), np.str_('L2/3'), np.str_('L2/3'), np.str_('L2/3'), np.str_('L2/3'), np.str_('L4'), np.str_('L4'), np.str_('L4'), np.str_('L5/6'), np.str_('L5/6'), np.str_('L5/6'), np.str_('L5/6'), np.str_('L5/6'), np.str_('L5/6'), np.str_('L5/6'), np.str_('L5/6'), np.str_('L5/6')]
CSD rows' labels: [np.str_('VISp1'), np.str_('VISp2/3'), np.str_('VISp2/3'), np.str_('VISp2/3'), np.str_('VISp2/3'), np.str_('VISp2/3'), np.str_('VISp2/3'), np.str_('VISp4'), np.str_('VISp4'), np.str_('VISp4'), np.str_('VISp5'), np.str_('VISp5'), np.str_('VISp5'), np.str_('VISp5'), np.str_('VISp5'), np.str_('VISp6a'), np.str_('VISp6a'), np.str_('VISp6a'), np.str_('VISp6a')]
fig2g-dd-gamma-csd-feedforward¶
Trough-locked gamma oscillations in P4 of "XXXY" in V1 show a feedforward laminar pattern, with sinks beginning in L4 and spreading to L2/3 and later to L5/6.
csd_table("fig2g", ff, 125)
fig2g reading a: 120 windows; CSD range -1.78e-05 to 1.64e-05 (V/row^2, arbitrary scale); shown fraction 0.89; first sink (ms from trough): L1 -12.8, L2/3 -12.8, L4 -12.8, L5/6 -12.8, L5 -12.8, L6 -12.8; sustained displayed sink onset of the group mean: L1 6.4, L2/3 -3.2, L4 -8.0, L5/6 1.6, L5 -12.8, L6 4.8 reading a, by lag from -12.8 to 12.8 ms, every 0.8 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group L1 mean SSSSSSSSSSSS............SSSSSSSSS L1 shown xxxxxxxxxxxx............xxxxxxxxx L2/3 mean ............SSSSSSSSSSSSS........ L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L4 mean ......SSSS.S...................SS L4 shown x.xxxxxxxxxxxxxxx............xxx. L5/6 mean SSSSSSSSSSSS...S..SSSSSSSSSSSSSSS L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L5 mean SSSSSS.S..SSSS.SSSSSSSSSSSSSSSSS. L5 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L6 mean SSSSSSSSSSSS..........SSSSSSSSSSS L6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
fig2g reading b: 110 windows; CSD range -1.55e-05 to 1.54e-05 (V/row^2, arbitrary scale); shown fraction 0.86; first sink (ms from trough): L1 -18.4, L2/3 -18.4, L4 -18.4, L5/6 -18.4, L5 -18.4, L6 -18.4; sustained displayed sink onset of the group mean: L1 8.8, L2/3 -4.0, L4 -12.0, L5/6 4.8, L5 1.6, L6 9.6
reading b, by lag from -18.4 to 18.4 ms, every 0.8 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group
L1 mean SSSSSSSSSSSSSSSSS................SSSSSSSSSSSSSS
L1 shown xxxxxxxxxxxxxxxxx.................xxxxxxxxxxxxx
L2/3 mean ..................SSSSSSSSSSSSSSS..............
L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L4 mean ...S...SSSS.SSSSSSSSSSSSSSS.........SSSSSSSSSSS
L4 shown xxxx....xxxxxxxxxxxxxxxxxxxxx.xx..xxxxxxxxxxxxx
L5/6 mean SSSSSSSSSSSSS................SSSSSSSSSSSSSSS...
L5/6 shown xxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxx
L5 mean SSSSSSS..................SS.SSSSSSSSS..SSSS....
L5 shown xxxxxxxxxxxxxxx.xxxxxx.xxxxxxxxxxxxxxxxxxxxx.xx
L6 mean .S.SSSSSSSSSSSSS.S.................SSSSSSSSSSSS
L6 shown xxxxxxxxxxxxxxxxxxxxxx.xxxxxxxx.xxxxxxxxxxxxxxx
single-sample sink onsets (round-2 tie-break, a variant now):
reading a: L1 6.4, L2/3 -3.2, L4 -8.0, L5/6 -0.8, L5 -7.2, L6 4.8
reading b: L1 8.0, L2/3 -4.0, L4 -16.0, L5/6 4.8, L5 1.6, L6 -17.6
sustained displayed sink onsets (ms from trough), adopted at 1/8 cycle, and the rule at 1/16 and 1/4 cycle:
reading windows expected_windows within_10pct S7_first_tied S7_rule_holds single_sample_onset_rule_holds min_samples onset_L1 onset_L2/3 onset_L4 onset_L5/6 onset_L5 onset_L6 onset_rule_holds holds_at_1/16_cycle holds_at_1/4_cycle
a 120 125 True True False True 3 6.4 -3.2 -8.0 1.6 -12.8 4.8 True True True
b 110 125 False True False True 4 8.8 -4.0 -12.0 4.8 1.6 9.6 True True True
Result: reproduced, resting on an assumption. S7's first-sink times tie at the first lag in both readings (every layer group holds a displayed sink there), so S7's rule cannot order them. With the tie-break stated above (sustained, displayed sink onset of each group's mean CSD), the L4 sink starts before the L2/3 and L5/6 sinks under both bands (L4 -8.0, L2/3 -3.2, L5/6 1.6 ms in reading a; -12.0, -4.0 and 4.8 ms in reading b), and the rule holds at 1/16 and 1/4 of a cycle and with single-sample onsets. 120 windows (reading a, within 10% of 125) and 110 (reading b).
fig2h-dd-alphabeta-csd-feedback¶
Trough-locked alpha/beta oscillations in P4 of habituated "xxxy" in V1 show a weak feedback pattern, beginning in L1 and moving down through L2/3 and L4 to meet activity rising from L5.
csd_table("fig2h", fb, 189)
fig2h reading a: 138 windows; CSD range -9.93e-06 to 1.07e-05 (V/row^2, arbitrary scale); shown fraction 0.88; first sink (ms from trough): L1 -37.6, L2/3 -37.6, L4 -37.6, L5/6 -37.6, L5 -37.6, L6 -37.6; sustained displayed sink onset of the group mean: L1 inf, L2/3 19.2, L4 12.0, L5/6 -14.4, L5 -14.4, L6 inf reading a, by lag from -37.6 to 37.6 ms, every 0.8 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group L1 mean SSSS.S........................................................SSSSSS.SS......................SS L1 shown x.x............................................................xx.x..x.......................xx L2/3 mean S..SS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS....SSSSSSSSSSSSSSSS.............SSSSSSSSSSSSSSSSSSSSSS.. L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L4 mean ..S..SSSSSS....S..SSS..SSSS.S.SS....SSSSSSSSSSSSSSSSS..S..S...SSS..SS.SS...............SSS....S L4 shown x.xxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx L5/6 mean SS.S..S.......S.......S......SS.SSSSS..S..S.....SS.S.SSSSSSSSSSSSSSSSSS..S....SS....SS.....S..S L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L5 mean S.....................S......SS.SSSSS..S.SSSSS.SSSSSSSSSSSSSSSSSSSSSSSS..S..S.SSS...SSS....SSSS L5 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L6 mean .SSSSSSSSSSSSSSSSSSS.SS.SS.....................................S...SS..S.SSS.......S.....SS.... L6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
fig2h reading b: 148 windows; CSD range -1.31e-05 to 1.01e-05 (V/row^2, arbitrary scale); shown fraction 0.87; first sink (ms from trough): L1 -31.2, L2/3 -41.6, L4 -40.8, L5/6 -41.6, L5 -41.6, L6 -41.6; sustained displayed sink onset of the group mean: L1 -31.2, L2/3 -13.6, L4 inf, L5/6 -41.6, L5 inf, L6 8.0
reading b, by lag from -41.6 to 41.6 ms, every 0.8 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group
L1 mean ............SSSSSSS..SSSSSSSSSSS..........................SS..SSS.SS..........SSSSSSSSSSSSSSSSSSSSSSSS.SS
L1 shown .............xxxx.x...xxxxxxxx............................x....xx..x...........xxxxxxxxxxxxxxxx.xxxxxx.xx
L2/3 mean SSSSSSSSSSSSSSS....SSSS............SSSSSSSSSSS.SSSSSSSSS..............SSSSSS..SSSSSS..........SSSSS...S..
L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L4 mean .................SS..............SS..........SSS.......SSS.SS........S.....................S.........S.SS
L4 shown .x.xx...xx......xxxx...x.xxxxx..xxxx..xxxxxxxxxxxxxxx.xxxxxxxxxxxxx.xx..xxxx.xx........xxxxxxx....xxxxxxx
L5/6 mean SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS...SSSSSSSS.
L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L5 mean .SSSSSSSSSSSSSSS..S..SSSSSSSSSSSS.SSSSSSSSSSSSSSSSSSSSSSSSS.SSSS.SSSS.S....S.SSS..S..............S.......
L5 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L6 mean SSSSSSSSSSSSS.SSSS.SSSSSSSSSSSSSSSSSS...SS.................S..SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
L6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
single-sample sink onsets (round-2 tie-break, a variant now):
reading a: L1 -33.6, L2/3 -35.2, L4 -36.0, L5/6 -35.2, L5 -20.0, L6 -36.8
reading b: L1 -32.0, L2/3 -26.4, L4 -28.0, L5/6 6.4, L5 -40.8, L6 -30.4
sustained displayed sink onsets (ms from trough), adopted at 1/8 cycle, and the rule at 1/16 and 1/4 cycle:
reading windows expected_windows within_10pct S7_first_tied S7_rule_holds single_sample_onset_rule_holds min_samples onset_L1 onset_L2/3 onset_L4 onset_L5/6 onset_L5 onset_L6 onset_rule_holds holds_at_1/16_cycle holds_at_1/4_cycle
a 138 189 False True False False 8 inf 19.2 12.0 -14.4 -14.4 inf False False False
b 148 189 False False False True 9 -31.2 -13.6 inf -41.6 inf 8.0 True True True
Result: not reproduced, resting on an assumption. With the tie-break, the Methods' band (10-30 Hz, reading a) has no L1 sink onset in the window, and the L5/6 sink (-14.4 ms) starts before L4 (12.0 ms) and L2/3 (19.2 ms); the code's band (12-24 Hz, reading b) gives L1 first (-31.2 ms, against L2/3 -13.6 ms, and no L4 onset). The readings disagree, and the Methods' band is adopted. The same holds at 1/16 and 1/4 of a cycle and with single-sample onsets. S7's own rule fails in both (tied in a; in b the first L1 sink, -31.2 ms, is after L2/3, -41.6 ms). 138 and 148 windows against 189.
fig2i-dd-theta-csd-mixed¶
Trough-locked theta oscillations in P4 of "XXXY" in V1 begin in L1 and L6 and converge through L4 to L2/3, followed by spread from L2/3 to L1 and L5/6, a mixed feedback and feedforward pattern.
csd_table("fig2i", lambda f: min(f["L1"], f["L5/6"], f["L6"]) < f["L4"] and f["L2/3"] > f["L4"], 77)
fig2i reading a: 163 windows; CSD range -1.97e-05 to 3.07e-05 (V/row^2, arbitrary scale); shown fraction 0.91; first sink (ms from trough): L1 inf, L2/3 -124.8, L4 -124.8, L5/6 -124.8, L5 -124.8, L6 -124.8; sustained displayed sink onset of the group mean: L1 inf, L2/3 -124.8, L4 -124.8, L5/6 65.6, L5 -67.2, L6 inf reading a, by lag from -124.8 to 124.8 ms, every 3.2 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group L1 mean ............................................................................... L1 shown ............................................................................... L2/3 mean SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS...SSSSS.SSSSSSSSSS L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L4 mean SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.S.S...SSSSS L4 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxx.xxxxxxx L5/6 mean ..........................................................S.SSS.S..SSS.SSS..S.S L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L5 mean ....S..S...SS...S.SSS.SS.SSS..SS...SSSSSSSSS...SSSSSSSSSSSSSSSS.S.SSSS.SSSSSSSS L5 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L6 mean ............................................................................... L6 shown xxxxxxxxxxxxxxxxxxxxxxx.xxxx.x..xxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
fig2i reading b: 117 windows; CSD range -2.23e-05 to 3.52e-05 (V/row^2, arbitrary scale); shown fraction 0.88; first sink (ms from trough): L1 -83.2, L2/3 -124.8, L4 -124.8, L5/6 -124.8, L5 -124.8, L6 -124.0; sustained displayed sink onset of the group mean: L1 inf, L2/3 inf, L4 -124.8, L5/6 57.6, L5 15.2, L6 73.6
reading b, by lag from -124.8 to 124.8 ms, every 3.2 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group
L1 mean .............S.............................................SSSSSS...SSS........
L1 shown .............x.............................................xxxxxx...xxx........
L2/3 mean SSSSSSSSSSSS..SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS..........SSS.....S...SS
L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L4 mean SSSSS.SSS.SSSS.SSS.SS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSSSSSSSS..SS.SSSSSSS.S
L4 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxx
L5/6 mean .S.SSS...........S...................................SSS.SSSSSSSSSSSSSS....SSSS
L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L5 mean SSSSSSS..SSS.....SS.SS.....SS..S....SS.S..SSSSSS..SSSSSSSSSSSSSSSSSS.SS....SSSS
L5 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxx
L6 mean ...............S.............................................SSSSSSSSSS.SSSS.S.
L6 shown .xxxxxxxxxx.x.xx.xxx.x.xxxxx.x.xx.x.....x.....x.x.x..xxxxxxxxxxxxxxxxxxxxxxxxxx
single-sample sink onsets (round-2 tie-break, a variant now):
reading a: L1 inf, L2/3 -52.0, L4 82.4, L5/6 -56.0, L5 -124.0, L6 72.0
reading b: L1 -84.8, L2/3 -112.0, L4 -108.0, L5/6 -124.0, L5 -107.2, L6 -79.2
sustained displayed sink onsets (ms from trough), adopted at 1/8 cycle, and the rule at 1/16 and 1/4 cycle:
reading windows expected_windows within_10pct S7_first_tied S7_rule_holds single_sample_onset_rule_holds min_samples onset_L1 onset_L2/3 onset_L4 onset_L5/6 onset_L5 onset_L6 onset_rule_holds holds_at_1/16_cycle holds_at_1/4_cycle
a 163 77 False False False False 27 inf -124.8 -124.8 65.6 -67.2 inf False False False
b 117 77 False False False False 27 inf inf -124.8 57.6 15.2 73.6 False False False
Result: not reproduced, resting on an assumption. With the tie-break, under the Methods' band (reading a) L2/3 and L4 are sinks from the window start (-124.8 ms), the L5/6 sink starts at 65.6 ms and L1 and L6 have no sink onset; under the code's band (reading b) L4 is a sink from the window start, L5/6 and L6 start at 57.6 and 73.6 ms, and L1 and L2/3 have no onset. No L1, L5/6 or L6 sink comes before L4 in either reading, and the rule fails at 1/16 and 1/4 of a cycle and with single-sample onsets. S7's own rule fails too. 163 and 117 windows against 77.
dd-gamma-peak-frequency-v1¶
In V1 the gamma peak frequency is higher for "XXXY" than for habituated "xxxy", by about 3 Hz (38 Hz, 99% CI 35.2-40.5, against 35 Hz, 99% CI 32.6-36.8).
Per mouse and condition: the trial-mean power spectrum per aligned channel, FOOOF per channel (fixed mode, the Methods' settings), oscillatory spectrum in dB, averaged over channels. Readings (a) window 50 ms before onset to 50 ms after offset, FOOOF 2 to 90 Hz; (b) 20 ms margins, FOOOF 2 to 150 Hz.
pf = passes[mice[0]]["psd_freqs"]
SPEC_FIT = {"a": [2, 90], "b": [2, 150]}
osc, ap_params = {}, {}
for r in ["a", "b"]:
for c in ["lo_rndctl", "lonaive", "go_gloexp", "go_seqctl"]:
for m in mice:
P = passes[m]["psd"][(r, c)] # channels, freq
ok = pf > 0
per = []
for k in range(P.shape[0]):
ap, prm, fm = glo.fooof_aperiodic(pf[ok], P[k, ok], SPEC_FIT[r])
per.append(10 * (np.log10(P[k, ok]) - ap))
osc[(r, c, m)] = np.mean(per, 0)
ap_params[(r, c, m)] = glo.fooof_aperiodic(pf[ok], P[:, ok].mean(0), SPEC_FIT[r])[1]
fo = pf[pf > 0]
print("per-mouse oscillatory spectra:", len(osc), "; frequencies", fo[0], "to", fo[-1], "Hz in 2 Hz steps")
per-mouse oscillatory spectra: 112 ; frequencies 2.0 to 624.0 Hz in 2 Hz steps
gsel = (fo >= 30) & (fo <= 90)
rows, tests = [], []
for r in ["a", "b"]:
pk = {c: np.array([fo[gsel][osc[(r, c, m)][gsel].argmax()] for m in mice]) for c in ["lo_rndctl", "lonaive"]}
for c in pk:
mu, se = pk[c].mean(), pk[c].std(ddof=1) / np.sqrt(len(mice))
z99 = stats.norm.ppf(0.995)
rows.append({"reading": r, "condition": c, "mean_peak_hz": mu, "ci99_low": mu - z99 * se, "ci99_high": mu + z99 * se,
"per_mouse": pk[c].tolist()})
for off in OFFS:
tstat, p = glo.welch_perm_test(pk["lo_rndctl"], pk["lonaive"], np.random.default_rng(seed("dd-gamma-peak-frequency-v1") + off))
tests.append({"reading": r, "seed_offset": off, "t": tstat, "p": p})
pkv1 = pd.DataFrame(rows)
print(pkv1.drop(columns="per_mouse").round(2).to_string(index=False))
print(pkv1[["reading", "condition", "per_mouse"]].to_string(index=False))
print(pd.DataFrame(tests).round(4).to_string(index=False))
fig, ax = plt.subplots(figsize=(5, 3))
for c, col in [("lo_rndctl", "C3"), ("lonaive", "C0")]:
y = np.array([osc[("a", c, m)] for m in mice])
ax.plot(fo, y.mean(0), col, label=c)
ax.fill_between(fo, y.mean(0) - 2 * y.std(0, ddof=1) / np.sqrt(len(y)), y.mean(0) + 2 * y.std(0, ddof=1) / np.sqrt(len(y)), color=col, alpha=0.2)
ax.set_xlim(2, 100)
ax.set_xlabel("Hz")
ax.set_ylabel("dB over aperiodic")
ax.legend()
plt.show()
print("plotted range (reading a, mean over mice):", round(float(min(np.array([osc[('a', c, m)] for m in mice]).mean(0)[fo <= 100].min() for c in ['lo_rndctl', 'lonaive'])), 2),
"to", round(float(max(np.array([osc[('a', c, m)] for m in mice]).mean(0)[fo <= 100].max() for c in ['lo_rndctl', 'lonaive'])), 2), "dB")
reading condition mean_peak_hz ci99_low ci99_high
a lo_rndctl 37.57 34.92 40.23
a lonaive 33.71 31.37 36.06
b lo_rndctl 37.57 34.92 40.23
b lonaive 33.71 31.37 36.06
reading condition per_mouse
a lo_rndctl [44.0, 38.0, 34.0, 42.0, 36.0, 40.0, 36.0, 36.0, 30.0, 38.0, 32.0, 40.0, 40.0, 40.0]
a lonaive [40.0, 34.0, 32.0, 36.0, 32.0, 30.0, 34.0, 30.0, 30.0, 30.0, 32.0, 38.0, 38.0, 36.0]
b lo_rndctl [44.0, 38.0, 34.0, 42.0, 36.0, 40.0, 36.0, 36.0, 30.0, 38.0, 32.0, 40.0, 40.0, 40.0]
b lonaive [40.0, 34.0, 32.0, 36.0, 32.0, 30.0, 34.0, 30.0, 30.0, 30.0, 32.0, 38.0, 38.0, 36.0]
reading seed_offset t p
a 0 2.8044 0.018
a 1000 2.8044 0.026
a 2000 2.8044 0.016
a 3000 2.8044 0.012
a 4000 2.8044 0.016
b 0 2.8044 0.018
b 1000 2.8044 0.026
b 2000 2.8044 0.016
b 3000 2.8044 0.012
b 4000 2.8044 0.016
plotted range (reading a, mean over mice): -1.41 to 5.27 dB
Result: reproduced. The mean gamma peak is 37.57 Hz (99% interval 34.92 to 40.23) for "XXXY" and 33.71 Hz (31.37 to 36.06) for "xxxy", both within tolerance; the permutation Welch test gives p = 0.018 (0.012 to 0.026 over the five seeds). Both readings give the same per-mouse peaks.
go-theta-peaks¶
Oscillatory spectra with finer frequency resolution have peaks at 5-9 Hz, within the theta band, supporting the reading of the global oddball's low-frequency increase as theta.
th = (fo >= 4.5) & (fo <= 9.9)
rows = []
for r in ["a", "b"]:
for c in ["go_gloexp", "go_seqctl"]:
y = np.array([osc[(r, c, m)] for m in mice]).mean(0)
locmax = [f for i, f in enumerate(fo) if th[i] and 0 < i < len(fo) - 1 and y[i] > y[i - 1] and y[i] > y[i + 1] and y[i] > 0]
rows.append({"reading": r, "condition": c, "spectrum_2_to_12Hz": dict(zip(fo[fo <= 12], y[fo <= 12].round(2))),
"local_max_above_0_in_4.5_9.9": locmax})
print(pd.DataFrame(rows).to_string(index=False))
centres = []
for c in ["go_gloexp", "go_seqctl"]:
for m in mice:
_, _, fm = glo.fooof_aperiodic(fo, passes[m]["psd"][("a", c)][:, pf > 0].mean(0), SPEC_FIT["a"])
centres += [(c, m, round(p[0], 1)) for p in fm.peak_params_ if 4.5 <= p[0] <= 9.9]
print("FOOOF peak centres in 4.5-9.9 Hz (reading a, channel-mean spectra per mouse):", len(centres), "peaks in",
len(set((c, m) for c, m, _ in centres)), "of", 2 * len(mice), "mouse-condition spectra:", centres)
reading condition spectrum_2_to_12Hz local_max_above_0_in_4.5_9.9
a go_gloexp {2.0: -0.86, 4.0: 2.06, 6.0: 3.56, 8.0: 2.81, 10.0: 0.26, 12.0: -0.01} [6.0]
a go_seqctl {2.0: -0.79, 4.0: 1.81, 6.0: 3.27, 8.0: 2.88, 10.0: 0.6, 12.0: 0.1} [6.0]
b go_gloexp {2.0: -2.27, 4.0: 1.59, 6.0: 3.31, 8.0: 2.83, 10.0: 0.51, 12.0: 0.21} [6.0]
b go_seqctl {2.0: -2.13, 4.0: 1.45, 6.0: 3.01, 8.0: 2.83, 10.0: 0.77, 12.0: 0.28} [6.0]
FOOOF peak centres in 4.5-9.9 Hz (reading a, channel-mean spectra per mouse): 19 peaks in 19 of 28 mouse-condition spectra: [('go_gloexp', 'sub-632485', np.float64(6.1)), ('go_gloexp', 'sub-637542', np.float64(5.8)), ('go_gloexp', 'sub-637909', np.float64(7.0)), ('go_gloexp', 'sub-640507', np.float64(5.8)), ('go_gloexp', 'sub-642507', np.float64(6.0)), ('go_gloexp', 'sub-645324', np.float64(6.6)), ('go_gloexp', 'sub-645495', np.float64(6.6)), ('go_gloexp', 'sub-647836', np.float64(5.6)), ('go_gloexp', 'sub-649323', np.float64(6.9)), ('go_gloexp', 'sub-649324', np.float64(6.1)), ('go_seqctl', 'sub-632485', np.float64(5.7)), ('go_seqctl', 'sub-632487', np.float64(6.9)), ('go_seqctl', 'sub-637542', np.float64(6.9)), ('go_seqctl', 'sub-637908', np.float64(5.6)), ('go_seqctl', 'sub-637909', np.float64(6.4)), ('go_seqctl', 'sub-642507', np.float64(7.5)), ('go_seqctl', 'sub-645495', np.float64(6.4)), ('go_seqctl', 'sub-649323', np.float64(6.9)), ('go_seqctl', 'sub-649324', np.float64(6.9))]
Result: reproduced. The mean oscillatory spectrum has a local maximum above 0 dB at 6 Hz for both "xxxX" (3.56 dB) and "xxxx" (3.27 dB) under reading (a), and at 6 Hz under reading (b); FOOOF finds a peak between 4.5 and 9.9 Hz in 19 of the 28 mouse and condition spectra.
fig3ab-go-condition-spectra¶
In V1, the P4 response to the unpredicted repetition "xxxX" shows a fast 2-4 dB alpha/beta increase that returns to baseline and long-lasting increases under 2 dB in 40-55 Hz and 80-90 Hz gamma; the predictable "xxxx" shows a 4-6 dB alpha/beta increase and a smaller gamma increase, both lasting through the first 200 ms.
rows = []
for r in FIT:
for s6 in S6:
X, x = cond_panel(r, "go_gloexp", s6), cond_panel(r, "go_seqctl", s6)
abX, abx = bandmean(X, *AB), bandmean(x, *AB)
tX = np.flatnonzero(tsel(0, 0.15))[abX[tsel(0, 0.15)].argmax()]
after = (times > times[tX]) & (times < 0.25)
rows.append({"S3": r, "S6": s6, "xxxX_ab_at_-10ms": abX[0], "xxxx_ab_at_-10ms": abx[0],
"xxxX_ab_max_0_150": abX[tsel(0, 0.15)].max(), "xxxx_ab_max_0_150": abx[tsel(0, 0.15)].max(),
"xxxX_in_1.8_4.4": 1.8 <= abX[tsel(0, 0.15)].max() <= 4.4, "xxxx_in_3.6_6.6": 3.6 <= abx[tsel(0, 0.15)].max() <= 6.6,
"xxxX_ab_min_peak_to_250": abX[after].min(), "xxxX_below_1_before_250": abX[after].min() < 1,
"xxxx_ab_min_50_200": abx[tsel(0.05, 0.2)].min(), "xxxx_above_1_through_200": abx[tsel(0.05, 0.2)].min() > 1,
"xxxX_g4055_mean_150_500": X[tsel(0.15, 0.5)][:, fbins(40, 55)].mean(),
"xxxx_g4055_mean_150_500": x[tsel(0.15, 0.5)][:, fbins(40, 55)].mean()})
f3ab = pd.DataFrame(rows)
f3ab["xxxX_gamma_higher"] = f3ab.xxxX_g4055_mean_150_500 > f3ab.xxxx_g4055_mean_150_500
print(f3ab.round(3).T.to_string())
for r in FIT:
for c in ["go_gloexp", "go_seqctl"]:
show(cond_panel(r, c), f"reading {r}: {c} dB of trial-mean power over aperiodic", "frequency bin (5-150 Hz)")
0 1 2 3 S3 a a b b S6 lin dbmean lin dbmean xxxX_ab_at_-10ms -0.802 -4.99 -1.148 -5.336 xxxx_ab_at_-10ms -0.263 -4.941 -0.511 -5.19 xxxX_ab_max_0_150 2.857 -0.567 2.511 -0.912 xxxx_ab_max_0_150 2.767 -1.013 2.519 -1.262 xxxX_in_1.8_4.4 True False True False xxxx_in_3.6_6.6 False False False False xxxX_ab_min_peak_to_250 -0.93 -4.986 -1.275 -5.332 xxxX_below_1_before_250 True True True True xxxx_ab_min_50_200 -0.967 -4.92 -1.215 -5.168 xxxx_above_1_through_200 False False False False xxxX_g4055_mean_150_500 2.073 -1.788 1.019 -2.842 xxxx_g4055_mean_150_500 1.616 -2.047 0.906 -2.757 xxxX_gamma_higher True True True False
reading a: go_gloexp dB of trial-mean power over aperiodic: range -2.59 to 3.73 dB (colour scale symmetric, nothing clipped)
reading a: go_seqctl dB of trial-mean power over aperiodic: range -2.50 to 3.18 dB (colour scale symmetric, nothing clipped)
reading b: go_gloexp dB of trial-mean power over aperiodic: range -2.93 to 3.16 dB (colour scale symmetric, nothing clipped)
reading b: go_seqctl dB of trial-mean power over aperiodic: range -2.70 to 3.16 dB (colour scale symmetric, nothing clipped)
Result: not reproduced. Read as the code draws the panels, the "xxxX" alpha/beta maximum in the first 150 ms is in range (2.86 dB in S3 reading a, 2.51 dB in b) and falls below 1 dB before 250 ms, but the "xxxx" maximum (2.77 and 2.52 dB) is below 3.6 dB and its alpha/beta does not stay above 1 dB through 200 ms (minimum -0.97 and -1.22 dB from 50 to 200 ms), so the time courses do not hold. The 40-55 Hz power over 150-500 ms is higher for "xxxX" (2.07 against 1.62 dB, reading a). The trial mean of per-trial dB values gives every alpha/beta maximum below 0 dB.
fig3c-go-v1-contrast¶
In V1 the global oddball ("xxxX" against "xxxx") gives a significant fast increase in high gamma (55-90 Hz) trailing into a sustained 40-55 Hz gamma increase, an immediate rise in theta power, and a fall in alpha/beta power over time.
rows = []
TH = band("theta")
for r in FIT:
for off in OFFS:
p = panel_c(r, "GO", off)
hg = p[tsel(0, 0.149)][:, fbins(55, 90) & (freqs < 90)]
g4 = p[times > 0.3][:, fbins(40, 55)]
th_ = p[:, TH]
tpos = np.flatnonzero((th_ > 0).any(1))
rows.append({"reading": r, "seed_offset": off, "hg_pos_0_150": int((hg > 0).sum()), "hg_max": hg.max(),
"g4055_pos_after_300": int((g4 > 0).sum()), "g4055_max_after_300": g4.max(),
"theta_first_pos_ms": 1000 * times[tpos[0]] if len(tpos) else np.nan, "theta_max": th_.max(),
"ab_neg_points": int((p[:, ABb] < 0).sum()), "ab_min": p[:, ABb].min()})
f3c = pd.DataFrame(rows)
f3c["hg_fast"] = f3c.hg_pos_0_150 > 0
f3c["g_sustained"] = f3c.g4055_pos_after_300 > 0
f3c["theta_before_150"] = f3c.theta_first_pos_ms < 150
f3c["ab_decrease"] = f3c.ab_neg_points > 0
print(f3c.round(3).to_string(index=False))
for r in FIT:
show(panel_c(r, "GO"), f"reading {r}: GO masked contrast, channel mean", "frequency bin (5-150 Hz)")
show(results[(r, "GO", 0)]["diff"].mean(-1), f"reading {r}: GO unmasked contrast, channel mean", "frequency bin")
reading seed_offset hg_pos_0_150 hg_max g4055_pos_after_300 g4055_max_after_300 theta_first_pos_ms theta_max ab_neg_points ab_min hg_fast g_sustained theta_before_150 ab_decrease
a 0 93 1.047 47 0.576 -10.0 0.364 71 -0.186 True True True True
a 1000 93 1.047 47 0.576 -10.0 0.364 71 -0.186 True True True True
a 2000 93 1.047 47 0.576 -10.0 0.364 71 -0.186 True True True True
a 3000 93 1.047 47 0.576 -10.0 0.364 71 -0.186 True True True True
a 4000 93 1.047 47 0.576 -10.0 0.364 71 -0.186 True True True True
b 0 92 0.448 30 0.246 -10.0 0.715 87 -0.197 True True True True
b 1000 92 0.448 30 0.246 -10.0 0.715 87 -0.197 True True True True
b 2000 92 0.448 30 0.246 -10.0 0.715 87 -0.197 True True True True
b 3000 92 0.448 30 0.246 -10.0 0.715 87 -0.197 True True True True
b 4000 92 0.448 30 0.246 -10.0 0.715 87 -0.197 True True True True
reading a: GO masked contrast, channel mean: range -0.20 to 1.05 dB (colour scale symmetric, nothing clipped)
reading a: GO unmasked contrast, channel mean: range -0.47 to 1.05 dB (colour scale symmetric, nothing clipped)
reading b: GO masked contrast, channel mean: range -1.02 to 0.77 dB (colour scale symmetric, nothing clipped)
reading b: GO unmasked contrast, channel mean: range -1.02 to 0.75 dB (colour scale symmetric, nothing clipped)
Result: reproduced. Under both readings the masked contrast has positive 55-90 Hz values in the first 150 ms (93 and 92 points, largest 1.05 and 0.45 dB), positive 40-55 Hz values after 300 ms (largest 0.58 and 0.25 dB), positive theta from -10 ms (largest 0.36 and 0.72 dB) and negative alpha/beta values (down to -0.19 and -0.20 dB). The same under the five seeds.
fig3d-go-gamma-laminar¶
In V1 the global oddball raises gamma power by 0.2-0.4 dB in L2/3, L4 and L5/6 at onset, strengthening to about 0.6 dB by the end of the stimulus, while gamma power falls in L1.
rows = []
for r in FIT:
for bname in ["gamma", "gamma_code"]:
for off in OFFS:
lam = laminar(r, "GO", bname, off)
early = lam[tsel(0, 0.099)]
rows.append({"reading": r, "band": bname, "seed_offset": off,
**{f"pos_0_100_{g}": int((early[:, GROUPS[g]] > 0).sum()) for g in ["L2/3", "L4", "L5/6"]},
**{f"max_0_100_{g}": early[:, GROUPS[g]].max() for g in ["L2/3", "L4", "L5/6"]},
"max_last_100": lam[tsel(0.4, 0.5)].max(), "L1_neg_points": int((lam[:, GROUPS["L1"]] < 0).sum()),
"L1_min": lam[:, GROUPS["L1"]].min()})
f3d = pd.DataFrame(rows)
f3d["onset_all_three"] = (f3d[["pos_0_100_L2/3", "pos_0_100_L4", "pos_0_100_L5/6"]] > 0).all(axis=1)
f3d["late_in_0.54_0.66"] = f3d.max_last_100.between(0.54, 0.66)
f3d["L1_decrease"] = f3d.L1_neg_points > 0
f3d["outcome"] = np.where(f3d.onset_all_three & f3d["late_in_0.54_0.66"] & f3d.L1_decrease, "reproduced",
np.where(f3d.onset_all_three, "partially reproduced", "not reproduced"))
print(f3d.round(3).to_string(index=False))
print("\noutcome by reading (S3 fitting range, gamma band):")
print(f3d[f3d.seed_offset == 0][["reading", "band", "outcome"]].to_string(index=False))
for r in FIT:
show(laminar(r, "GO", "gamma"), f"reading {r}: GO laminar gamma 30-90", "kept channel (top = surface)", yt=True)
lt3d = pd.concat([layer_table("GO", "gamma"), layer_table("GO", "gamma_code")])
reading band seed_offset pos_0_100_L2/3 pos_0_100_L4 pos_0_100_L5/6 max_0_100_L2/3 max_0_100_L4 max_0_100_L5/6 max_last_100 L1_neg_points L1_min onset_all_three late_in_0.54_0.66 L1_decrease outcome
a gamma 0 50 30 89 0.723 0.565 0.747 0.634 46 -0.513 True True True reproduced
a gamma 1000 50 30 89 0.723 0.565 0.747 0.634 46 -0.513 True True True reproduced
a gamma 2000 50 30 89 0.723 0.565 0.747 0.634 46 -0.513 True True True reproduced
a gamma 3000 50 30 89 0.723 0.565 0.747 0.634 46 -0.513 True True True reproduced
a gamma 4000 50 30 89 0.723 0.565 0.747 0.634 46 -0.513 True True True reproduced
a gamma_code 0 40 13 24 0.654 0.457 0.185 0.943 45 -0.788 True False True partially reproduced
a gamma_code 1000 40 13 24 0.654 0.457 0.185 0.943 45 -0.788 True False True partially reproduced
a gamma_code 2000 40 13 24 0.654 0.457 0.185 0.943 45 -0.788 True False True partially reproduced
a gamma_code 3000 40 13 24 0.654 0.457 0.185 0.943 45 -0.788 True False True partially reproduced
a gamma_code 4000 40 13 24 0.654 0.457 0.185 0.943 45 -0.788 True False True partially reproduced
b gamma 0 46 28 0 1.124 0.193 0.000 0.742 48 -0.702 False False True not reproduced
b gamma 1000 46 28 0 1.124 0.193 0.000 0.742 48 -0.702 False False True not reproduced
b gamma 2000 46 28 0 1.124 0.193 0.000 0.742 48 -0.702 False False True not reproduced
b gamma 3000 46 28 0 1.124 0.193 0.000 0.742 48 -0.702 False False True not reproduced
b gamma 4000 46 28 0 1.124 0.193 0.000 0.742 48 -0.702 False False True not reproduced
b gamma_code 0 14 0 0 0.964 0.000 0.000 1.215 48 -0.971 False False True not reproduced
b gamma_code 1000 14 0 0 0.964 0.000 0.000 1.215 48 -0.971 False False True not reproduced
b gamma_code 2000 14 0 0 0.964 0.000 0.000 1.215 48 -0.971 False False True not reproduced
b gamma_code 3000 14 0 0 0.964 0.000 0.000 1.215 48 -0.971 False False True not reproduced
b gamma_code 4000 14 0 0 0.964 0.000 0.000 1.215 48 -0.971 False False True not reproduced
outcome by reading (S3 fitting range, gamma band):
reading band outcome
a gamma reproduced
a gamma_code partially reproduced
b gamma not reproduced
b gamma_code not reproduced
reading a: GO laminar gamma 30-90: range -0.97 to 0.80 dB (colour scale symmetric, nothing clipped)
reading b: GO laminar gamma 30-90: range -1.02 to 1.12 dB (colour scale symmetric, nothing clipped) GO gamma laminar panel by start of the kept rows (shift0 is the main analysis): start_row reading group rows max min pos_points neg_points first_pos_ms first_neg_ms shift0 a L1 1 0.000 -0.513 0.0 46.0 NaN 60.0 shift0 a L2/3 6 0.799 -0.971 233.0 49.0 -10.0 30.0 shift0 a L4 3 0.565 0.000 141.0 0.0 -10.0 NaN shift0 a L5/6 9 0.747 0.000 374.0 0.0 -10.0 NaN shift0 b L1 1 0.000 -0.702 0.0 48.0 NaN 40.0 shift0 b L2/3 6 1.124 -1.019 185.0 71.0 -10.0 -10.0 shift0 b L4 3 0.195 -0.106 49.0 17.0 -10.0 -10.0 shift0 b L5/6 9 0.000 -0.175 0.0 135.0 NaN -10.0 shift1 a L1 0 NaN NaN NaN NaN NaN NaN shift1 a L2/3 6 0.820 -1.199 217.0 70.0 -10.0 -10.0 shift1 a L4 3 0.600 0.000 147.0 0.0 -10.0 NaN shift1 a L5/6 9 0.754 0.000 362.0 0.0 -10.0 NaN shift1 b L1 0 NaN NaN NaN NaN NaN NaN shift1 b L2/3 6 1.169 -1.177 162.0 93.0 -10.0 -10.0 shift1 b L4 3 0.202 -0.062 42.0 11.0 -10.0 -10.0 shift1 b L5/6 9 0.277 -0.138 26.0 94.0 -10.0 -10.0 shift3 a L1 1 -0.076 -0.998 0.0 53.0 NaN -10.0 shift3 a L2/3 5 0.821 -0.821 193.0 48.0 -10.0 -10.0 shift3 a L4 3 0.682 0.000 149.0 0.0 -10.0 NaN shift3 a L5/6 9 0.664 0.000 292.0 0.0 -10.0 NaN shift3 b L1 1 -0.352 -1.191 0.0 53.0 NaN -10.0 shift3 b L2/3 5 0.508 -1.113 62.0 81.0 -10.0 -10.0 shift3 b L4 3 0.201 -0.174 51.0 26.0 -10.0 210.0 shift3 b L5/6 9 0.066 -0.191 17.0 149.0 20.0 -10.0 GO gamma_code laminar panel by start of the kept rows (shift0 is the main analysis): start_row reading group rows max min pos_points neg_points first_pos_ms first_neg_ms shift0 a L1 1 0.000 -0.788 0.0 45.0 NaN 60.0 shift0 a L2/3 6 0.943 -0.964 198.0 49.0 -10.0 30.0 shift0 a L4 3 0.560 0.000 87.0 0.0 20.0 NaN shift0 a L5/6 9 0.817 0.000 178.0 0.0 20.0 NaN shift0 b L1 1 0.000 -0.971 0.0 48.0 NaN 40.0 shift0 b L2/3 6 1.215 -0.976 133.0 58.0 -10.0 30.0 shift0 b L4 3 0.172 0.000 6.0 0.0 440.0 NaN shift0 b L5/6 9 0.000 0.000 0.0 0.0 NaN NaN shift1 a L1 0 NaN NaN NaN NaN NaN NaN shift1 a L2/3 6 0.940 -1.324 178.0 64.0 -10.0 -10.0 shift1 a L4 3 0.610 0.000 96.0 0.0 0.0 NaN shift1 a L5/6 9 0.827 0.000 178.0 0.0 -10.0 NaN shift1 b L1 0 NaN NaN NaN NaN NaN NaN shift1 b L2/3 6 1.252 -1.294 123.0 69.0 -10.0 -10.0 shift1 b L4 3 0.000 0.000 0.0 0.0 NaN NaN shift1 b L5/6 9 0.000 0.000 0.0 0.0 NaN NaN shift3 a L1 1 -0.227 -1.159 0.0 53.0 NaN -10.0 shift3 a L2/3 5 0.910 -0.689 170.0 44.0 -10.0 -10.0 shift3 a L4 3 0.646 0.000 111.0 0.0 0.0 NaN shift3 a L5/6 9 0.774 0.000 98.0 0.0 20.0 NaN shift3 b L1 1 -0.699 -1.313 0.0 53.0 NaN -10.0 shift3 b L2/3 5 0.183 -0.896 8.0 52.0 60.0 -10.0 shift3 b L4 3 0.000 0.000 0.0 0.0 NaN NaN shift3 b L5/6 9 0.000 0.000 0.0 0.0 NaN NaN
Result: reproduced, resting on an assumption. Under S3 reading (a), the code's fitting range, with the Methods' 30-90 Hz band, L2/3, L4 and L5/6 have significant positive gamma in the first 100 ms (50, 30 and 89 points), the largest value in the last 100 ms is 0.634 dB (in 0.54-0.66) and L1 has a decrease (down to -0.51 dB). By reading (printed), this is the only one of the four that reproduces: with the 30-50 Hz band the late value is 0.94 dB (partially reproduced), and under reading (b) L5/6 has no early increase (0 points) with either band (not reproduced), the late value being 0.74 dB (30-90 Hz) and 1.22 dB (30-50 Hz). The outcome therefore rests on taking the code's fitting range with the Methods' band; the verifier of the second round rates it partially reproduced. The onset values (0.57 to 0.75 dB) are above the paper's 0.2 to 0.4 dB, which the criterion does not test. The L1 decrease is also in the other L1 row (start moved up by 3 rows, down to -1.00 dB).
fig3e-go-alphabeta-laminar¶
In V1 the global oddball gives an alpha/beta decrease in L1 (upper supragranular layers) and an alpha/beta increase starting in L5/6 that spreads up to L4 and L2/3 while weakening.
f3e = pd.DataFrame([ab_summary(r, "GO", off) for r in FIT for off in OFFS])
f3e["L56_pos"] = f3e["first_pos_L5/6"].notna()
f3e["L56_first"] = f3e.L56_pos & (f3e["first_pos_L5/6"] < f3e["first_pos_L4"].fillna(np.inf)) & (f3e["first_pos_L5/6"] < f3e["first_pos_L2/3"].fillna(np.inf))
f3e["L1_neg"] = f3e["first_neg_L1"].notna()
print(f3e.round(3).to_string(index=False))
for r in FIT:
lam = laminar(r, "GO", "alphabeta")
print(f"reading {r}: largest positive per layer group:", {g: round(float(lam[:, GROUPS[g]].max()), 3) for g in GROUPS},
"; most negative in L1:", round(float(lam[:, GROUPS['L1']].min()), 3))
show(lam, f"reading {r}: GO laminar alpha/beta", "kept channel (top = surface)", yt=True)
lt3e = layer_table("GO", "alphabeta")
reading seed_offset dec_L23_L56 inc_L1 first_neg_L1 first_neg_L2/3 first_neg_L4 first_neg_L5/6 first_pos_L1 first_pos_L2/3 first_pos_L4 first_pos_L5/6 L56_pos L56_first L1_neg
a 0 -0.911 0.0 190.0 170.0 NaN NaN NaN 0.0 20.0 20.0 True False True
a 1000 -0.911 0.0 190.0 170.0 NaN NaN NaN 0.0 20.0 20.0 True False True
a 2000 -0.911 0.0 190.0 170.0 NaN NaN NaN 0.0 20.0 20.0 True False True
a 3000 -0.911 0.0 190.0 170.0 NaN NaN NaN 0.0 20.0 20.0 True False True
a 4000 -0.911 0.0 190.0 170.0 NaN NaN NaN 0.0 20.0 20.0 True False True
b 0 -0.883 0.0 180.0 170.0 NaN NaN NaN -10.0 30.0 30.0 True False True
b 1000 -0.883 0.0 180.0 170.0 NaN NaN NaN -10.0 30.0 30.0 True False True
b 2000 -0.883 0.0 180.0 170.0 NaN NaN NaN -10.0 30.0 30.0 True False True
b 3000 -0.883 0.0 180.0 170.0 NaN NaN NaN -10.0 30.0 30.0 True False True
b 4000 -0.883 0.0 180.0 170.0 NaN NaN NaN -10.0 30.0 30.0 True False True
reading a: largest positive per layer group: {'L1': 0.0, 'L2/3': 0.344, 'L4': 0.339, 'L5/6': 1.251} ; most negative in L1: -0.809
reading a: GO laminar alpha/beta: range -0.91 to 1.25 dB (colour scale symmetric, nothing clipped)
reading b: largest positive per layer group: {'L1': 0.0, 'L2/3': 0.767, 'L4': 0.298, 'L5/6': 1.216} ; most negative in L1: -0.996
reading b: GO laminar alpha/beta: range -1.00 to 1.22 dB (colour scale symmetric, nothing clipped) GO alphabeta laminar panel by start of the kept rows (shift0 is the main analysis): start_row reading group rows max min pos_points neg_points first_pos_ms first_neg_ms shift0 a L1 1 0.000 -0.809 0.0 33.0 NaN 190.0 shift0 a L2/3 6 0.344 -0.911 159.0 38.0 0.0 170.0 shift0 a L4 3 0.339 0.000 114.0 0.0 20.0 NaN shift0 a L5/6 9 1.251 0.000 227.0 0.0 20.0 NaN shift0 b L1 1 0.000 -0.996 0.0 34.0 NaN 180.0 shift0 b L2/3 6 0.767 -0.883 190.0 41.0 -10.0 170.0 shift0 b L4 3 0.298 0.000 106.0 0.0 30.0 NaN shift0 b L5/6 9 1.216 0.000 218.0 0.0 30.0 NaN shift1 a L1 0 NaN NaN NaN NaN NaN NaN shift1 a L2/3 6 0.343 -1.350 148.0 71.0 0.0 -10.0 shift1 a L4 3 0.399 0.000 126.0 0.0 0.0 NaN shift1 a L5/6 9 1.272 0.000 250.0 0.0 -10.0 NaN shift1 b L1 0 NaN NaN NaN NaN NaN NaN shift1 b L2/3 6 0.836 -1.302 168.0 75.0 -10.0 -10.0 shift1 b L4 3 0.297 0.000 104.0 0.0 30.0 NaN shift1 b L5/6 9 1.278 0.000 218.0 0.0 30.0 NaN shift3 a L1 1 0.000 -1.386 0.0 49.0 NaN -10.0 shift3 a L2/3 5 0.338 -0.969 119.0 42.0 0.0 -10.0 shift3 a L4 3 0.332 0.000 122.0 0.0 0.0 NaN shift3 a L5/6 9 1.282 0.000 222.0 0.0 20.0 NaN shift3 b L1 1 0.000 -1.583 0.0 52.0 NaN -10.0 shift3 b L2/3 5 0.356 -1.085 121.0 45.0 70.0 -10.0 shift3 b L4 3 0.329 0.000 102.0 0.0 30.0 NaN shift3 b L5/6 9 1.171 0.000 214.0 0.0 30.0 NaN
Result: partially reproduced. L1 has a significant alpha/beta decrease under both readings (down to -0.81 and -1.00 dB) and L5/6 the largest increase (1.25 and 1.22 dB), but the first positive bin is in L2/3 (0 and -10 ms) before L5/6 (20 and 30 ms), so the increase does not start in L5/6. The bins 10 ms apart are within the 200 ms window's resolution.
fig3f-go-theta-laminar¶
In V1 the global oddball increases theta power, beginning in L5/6 (about 0.5 dB) within 100 ms of onset and spreading through the column while strengthening to 1-1.5 dB.
rows = []
for r in FIT:
for off in OFFS:
lam = laminar(r, "GO", "theta", off)
firsts = {g: first_time(lam, g, +1) for g in GROUPS}
t_all = np.flatnonzero((lam > 0).any(1))
first_layer = sorted(set(L[np.flatnonzero(lam[t_all[0]] > 0)])) if len(t_all) else []
rows.append({"reading": r, "seed_offset": off, **{f"first_pos_{g}": v for g, v in firsts.items()},
"first_layers": first_layer, "max": lam.max(), "neg_points": int((lam < 0).sum())})
f3f = pd.DataFrame(rows)
f3f["L56_first_before_100"] = f3f.first_layers.map(lambda x: "L5/6" in x) & (f3f["first_pos_L5/6"] < 100)
f3f["reaches_all"] = f3f[["first_pos_L4", "first_pos_L2/3", "first_pos_L1"]].notna().all(axis=1)
f3f["max_in_0.9_1.65"] = f3f["max"].between(0.9, 1.65)
print(f3f.round(3).to_string(index=False))
for r in FIT:
show(laminar(r, "GO", "theta"), f"reading {r}: GO laminar theta", "kept channel (top = surface)", yt=True)
lt3f = layer_table("GO", "theta")
reading seed_offset first_pos_L1 first_pos_L2/3 first_pos_L4 first_pos_L5/6 first_layers max neg_points L56_first_before_100 reaches_all max_in_0.9_1.65
a 0 NaN 90.0 90.0 -10.0 [L5/6] 1.316 0 True False True
a 1000 NaN 90.0 90.0 -10.0 [L5/6] 1.316 0 True False True
a 2000 NaN 90.0 90.0 -10.0 [L5/6] 1.316 0 True False True
a 3000 NaN 90.0 90.0 -10.0 [L5/6] 1.316 0 True False True
a 4000 NaN 90.0 90.0 -10.0 [L5/6] 1.316 0 True False True
b 0 NaN -10.0 -10.0 -10.0 [L2/3, L4, L5/6] 1.435 0 True False True
b 1000 NaN -10.0 -10.0 -10.0 [L2/3, L4, L5/6] 1.435 0 True False True
b 2000 NaN -10.0 -10.0 -10.0 [L2/3, L4, L5/6] 1.435 0 True False True
b 3000 NaN -10.0 -10.0 -10.0 [L2/3, L4, L5/6] 1.435 0 True False True
b 4000 NaN -10.0 -10.0 -10.0 [L2/3, L4, L5/6] 1.435 0 True False True
reading a: GO laminar theta: range 0.00 to 1.32 dB (colour scale symmetric, nothing clipped)
reading b: GO laminar theta: range 0.00 to 1.44 dB (colour scale symmetric, nothing clipped) GO theta laminar panel by start of the kept rows (shift0 is the main analysis): start_row reading group rows max min pos_points neg_points first_pos_ms first_neg_ms shift0 a L1 1 0.000 0.000 0.0 0.0 NaN NaN shift0 a L2/3 6 1.316 0.000 59.0 0.0 90.0 NaN shift0 a L4 3 0.512 0.000 1.0 0.0 90.0 NaN shift0 a L5/6 9 1.068 0.000 85.0 0.0 -10.0 NaN shift0 b L1 1 0.000 0.000 0.0 0.0 NaN NaN shift0 b L2/3 6 1.435 0.000 115.0 0.0 -10.0 NaN shift0 b L4 3 0.950 0.000 44.0 0.0 -10.0 NaN shift0 b L5/6 9 1.255 0.000 142.0 0.0 -10.0 NaN shift1 a L1 0 NaN NaN NaN NaN NaN NaN shift1 a L2/3 6 1.214 0.000 55.0 0.0 120.0 NaN shift1 a L4 3 0.752 0.000 15.0 0.0 -10.0 NaN shift1 a L5/6 9 1.169 0.000 81.0 0.0 -10.0 NaN shift1 b L1 0 NaN NaN NaN NaN NaN NaN shift1 b L2/3 6 1.330 0.000 96.0 0.0 40.0 NaN shift1 b L4 3 0.936 0.000 44.0 0.0 -10.0 NaN shift1 b L5/6 9 1.315 0.000 133.0 0.0 -10.0 NaN shift3 a L1 1 0.000 0.000 0.0 0.0 NaN NaN shift3 a L2/3 5 1.266 0.000 54.0 0.0 130.0 NaN shift3 a L4 3 0.672 0.000 12.0 0.0 70.0 NaN shift3 a L5/6 9 1.071 -0.629 76.0 2.0 -10.0 190.0 shift3 b L1 1 0.000 -0.813 0.0 10.0 NaN -10.0 shift3 b L2/3 5 1.402 0.000 86.0 0.0 40.0 NaN shift3 b L4 3 0.897 0.000 56.0 0.0 -10.0 NaN shift3 b L5/6 9 1.283 0.000 140.0 0.0 -10.0 NaN
Result: partially reproduced. Theta increases with no significant decrease; the first positive bin is in L5/6 at -10 ms (alone under reading a; with L2/3 and L4 under reading b), the largest value is 1.32 dB (reading a) and 1.44 dB (reading b), in range, but the increase never reaches the kept L1 row, nor the other L1 row (start moved up by 3 rows).
fig3g-go-gamma-csd-feedforward¶
gamma oscillations under global oddballs in V1 show a feedforward laminar CSD pattern, starting in L4 and spreading toward L2/3 and L5/6.
csd_table("fig3g", ff, 496)
fig3g reading a: 471 windows; CSD range -8.17e-06 to 7.31e-06 (V/row^2, arbitrary scale); shown fraction 0.94; first sink (ms from trough): L1 -12.8, L2/3 -12.8, L4 -12.8, L5/6 -12.8, L5 -12.8, L6 -12.8; sustained displayed sink onset of the group mean: L1 5.6, L2/3 -2.4, L4 -8.0, L5/6 4.0, L5 3.2, L6 6.4 reading a, by lag from -12.8 to 12.8 ms, every 0.8 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group L1 mean SSSSSSSSSSSSS..........SSSSSSSSSS L1 shown xxxxxxxxxxxxx..........xxxxxxxxxx L2/3 mean .............SSSSSSSSSS.......... L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L4 mean ......SSSSSSSSSSSS...........S.SS L4 shown x.x...xxxxxxxxxxxxxxxx.xx.xxxxxxx L5/6 mean SSSSSSSSS............SSSSSSSSSSSS L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L5 mean SSSSSS..............SSSSSSSSSSSS. L5 shown xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxx L6 mean SSSSSSSSSSS.............SSSSSSSSS L6 shown xxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxx
fig3g reading b: 476 windows; CSD range -9.05e-06 to 6.96e-06 (V/row^2, arbitrary scale); shown fraction 0.95; first sink (ms from trough): L1 -18.4, L2/3 -18.4, L4 -13.6, L5/6 -18.4, L5 -18.4, L6 -18.4; sustained displayed sink onset of the group mean: L1 7.2, L2/3 -3.2, L4 -12.0, L5/6 6.4, L5 5.6, L6 6.4
reading b, by lag from -18.4 to 18.4 ms, every 0.8 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group
L1 mean SSSSSSSSSSSSSSSSSS..............SSSSSSSSSSSSSSS
L1 shown xxxxxxxxxxxxxxxxxx..............xxxxxxxxxxxxxxx
L2/3 mean ...................SSSSSSSSSSSSSS..............
L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L4 mean ........SSSSSSSSSSSSSSSSSS.....................
L4 shown ......x.xxxxxxxxxxxxxxxxxxxxx.....x......xxxxxx
L5/6 mean SSSSSSSSSSSSSS.................SSSSSSSSSSSSSSSS
L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L5 mean SSSSSSSS..................S...SSSSSSSSSSSSSSSSS
L5 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L6 mean SSSSSSSSSSSSSSSS...............SSSSSSSSSSSSSSSS
L6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
single-sample sink onsets (round-2 tie-break, a variant now):
reading a: L1 5.6, L2/3 -2.4, L4 -8.0, L5/6 4.0, L5 3.2, L6 6.4
reading b: L1 7.2, L2/3 -3.2, L4 -12.0, L5/6 6.4, L5 2.4, L6 6.4
sustained displayed sink onsets (ms from trough), adopted at 1/8 cycle, and the rule at 1/16 and 1/4 cycle:
reading windows expected_windows within_10pct S7_first_tied S7_rule_holds single_sample_onset_rule_holds min_samples onset_L1 onset_L2/3 onset_L4 onset_L5/6 onset_L5 onset_L6 onset_rule_holds holds_at_1/16_cycle holds_at_1/4_cycle
a 471 496 True True False True 3 5.6 -2.4 -8.0 4.0 3.2 6.4 True True True
b 476 496 True False False True 4 7.2 -3.2 -12.0 6.4 5.6 6.4 True True True
Result: reproduced, resting on an assumption. With the tie-break, the L4 sink starts before the L2/3 and L5/6 sinks under both bands (L4 -8.0, L2/3 -2.4, L5/6 4.0 ms in reading a; -12.0, -3.2 and 6.4 ms in reading b), also at 1/16 and 1/4 of a cycle. S7's own rule ties in reading a and in reading b puts the first L4 sink (-13.6 ms) after the others at the window start. 471 and 476 windows against 496.
fig3h-go-alphabeta-csd-feedback¶
alpha/beta oscillations in "xxxx" in V1 show a weak feedback CSD pattern, starting in L1 and continuing down to L2/3 and L4, with later contributions from L5/6.
csd_table("fig3h", fb, 300)
fig3h reading a: 279 windows; CSD range -7.18e-06 to 9.9e-06 (V/row^2, arbitrary scale); shown fraction 0.91; first sink (ms from trough): L1 28.0, L2/3 -37.6, L4 -37.6, L5/6 -37.6, L5 -37.6, L6 -37.6; sustained displayed sink onset of the group mean: L1 28.0, L2/3 -28.8, L4 -37.6, L5/6 -5.6, L5 -5.6, L6 5.6 reading a, by lag from -37.6 to 37.6 ms, every 0.8 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group L1 mean .......S..........................................................................SSSSSSSS.SSSS L1 shown ..................................................................................xxx.xxxx.xxxx L2/3 mean ........S..SSSS..SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS...SSSS.SSSSS.SSS.SS.SS.S.... L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L4 mean SSSSSSSSSSSSSS.SSSSSSS....SSSSSSSSSSSSSS.SSSSS.SSSSSSSSSSSSS.SSSSSSSS.S..SSSS.SS.SSSSSSS.SS.S.S L4 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxx L5/6 mean ..........SS...S........................SS.S.SS.SSSSSSSSS.SSS.SS..SSSSSSS.S..S..........S..S.S. L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L5 mean ..............................S......S..SS.S.SSSSSSSSSSS...S........S..S....................... L5 shown xxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L6 mean SSSSSSSSSSSSSSSSSSSSSS..S.................SS..S..SS...SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS L6 shown xxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
fig3h reading b: 275 windows; CSD range -1e-05 to 7.51e-06 (V/row^2, arbitrary scale); shown fraction 0.93; first sink (ms from trough): L1 -41.6, L2/3 -41.6, L4 -41.6, L5/6 -41.6, L5 -41.6, L6 -41.6; sustained displayed sink onset of the group mean: L1 -12.0, L2/3 -20.0, L4 -27.2, L5/6 -12.8, L5 -13.6, L6 inf
reading b, by lag from -41.6 to 41.6 ms, every 0.8 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group
L1 mean SSSSSSSSSSSSSSSSSSSSSSSSSSSS.........SSSSSSSSS.SSS.SSSS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
L1 shown xxxxxxxxxxxxxxxxxxxxxxxxxx...........xxxxxxxxx.xxx.xxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L2/3 mean ...........................SSSSSSSSSS.........S.....................................SS..S.SS.............
L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxx.xxxx
L4 mean SSS..SSSS......S..SSSSSSSSSSSSSSSSSS.....SSSSS.SS.SS.SSSSSSSS.SSSSSS.......SSSSSSSS...SS....S...SSSSSSSSS
L4 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L5/6 mean SSSSS.SS.SSSS.S.SS..................SSSSSSSSSSSSSSSSSSS.SSSSSS..S.SS.SSSSSSSSSSS...S....S.S..SSSS........
L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L5 mean SSSSS.SS.S.SS...SS.................SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSSSSSSSSSS..S...S...SSSS..S..SS....SS.
L5 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L6 mean ......SSSSSS.SSS..SSSSSS..S.....................................S.....S.SSS.SSS..S...S.....S..SSS........
L6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xx.xxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
single-sample sink onsets (round-2 tie-break, a variant now):
reading a: L1 -32.0, L2/3 -31.2, L4 -25.6, L5/6 -29.6, L5 -13.6, L6 -18.4
reading b: L1 -12.0, L2/3 -20.0, L4 -37.6, L5/6 -36.8, L5 -36.8, L6 -36.8
sustained displayed sink onsets (ms from trough), adopted at 1/8 cycle, and the rule at 1/16 and 1/4 cycle:
reading windows expected_windows within_10pct S7_first_tied S7_rule_holds single_sample_onset_rule_holds min_samples onset_L1 onset_L2/3 onset_L4 onset_L5/6 onset_L5 onset_L6 onset_rule_holds holds_at_1/16_cycle holds_at_1/4_cycle
a 279 300 True False False True 8 28.0 -28.8 -37.6 -5.6 -5.6 5.6 False False False
b 275 300 True True False False 9 -12.0 -20.0 -27.2 -12.8 -13.6 inf False False True
Result: not reproduced, resting on an assumption. Recorded as reproduced before the second verification round; the third round agreed with the change. With the sustained tie-break, under the Methods' band (reading a) the only L1 sink that is displayed and lasts begins at 28.0 ms, after L4 (a sink from the window start, -37.6 ms) and L2/3 (-28.8 ms). The single-sample onset at -32.0 ms that the earlier tie-break counted is one sample, not displayed. Under the code's band (reading b) L1 (-12.0 ms) also comes after L2/3 (-20.0 ms) and L4 (-27.2 ms). The rule fails at 1/16 of a cycle in both readings and holds at 1/4 of a cycle only in reading b. S7's own rule fails in both. 279 and 275 windows against 300.
fig3i-go-theta-csd¶
theta oscillations under global oddballs in V1 show sinks beginning in L5 and L4 and spreading to L2/3.
G4 = ["L1", "L2/3", "L4", "L5/6"] # the four layer groups; L5 and L6 are rows within L5/6
csd_table("fig3i", lambda f: min(f["L4"], f["L5/6"]) <= min(f[g] for g in G4) and f["L2/3"] > min(f["L4"], f["L5/6"]), 335)
fig3i reading a: 685 windows; CSD range -9.46e-06 to 1.94e-05 (V/row^2, arbitrary scale); shown fraction 0.96; first sink (ms from trough): L1 inf, L2/3 -124.8, L4 -124.8, L5/6 -124.8, L5 -124.8, L6 -124.8; sustained displayed sink onset of the group mean: L1 inf, L2/3 -124.8, L4 -124.8, L5/6 inf, L5 -92.8, L6 inf reading a, by lag from -124.8 to 124.8 ms, every 3.2 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group L1 mean ............................................................................... L1 shown ............................................................................... L2/3 mean SSSSSSSSSSSS..S.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L4 mean S.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSSSSSSSSSSSSS L4 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L5/6 mean ................................................................S..........S.SS L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L5 mean ......S...SSS.SS.S.SSSSS...S................S.S...S.S.S....SS.SSSS.SS.....SSSSS L5 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L6 mean SSS......................................................................S..... L6 shown xxxxxxxxxxxxxxxxxxxx.x..xxxx...x.x....xx.xx.xxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
fig3i reading b: 575 windows; CSD range -1.24e-05 to 1.81e-05 (V/row^2, arbitrary scale); shown fraction 0.96; first sink (ms from trough): L1 -88.8, L2/3 -124.8, L4 -124.8, L5/6 -124.8, L5 -124.8, L6 -124.8; sustained displayed sink onset of the group mean: L1 inf, L2/3 -58.4, L4 -124.8, L5/6 inf, L5 inf, L6 inf
reading b, by lag from -124.8 to 124.8 ms, every 3.2 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group
L1 mean ............S....S.............................................................
L1 shown .................x.............................................................
L2/3 mean SSSSSSSSSSS..........SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.....S.......S.S.SS
L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L4 mean SSSSS..SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
L4 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L5/6 mean ...S.SS..S.S.S.....................................................SS.SS...SS.S
L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L5 mean .S.S.SS....S.S..S.S..SS..........SS...........S.....SSS...S..SS..SSSS.SSS..S..S
L5 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxx
L6 mean S..SS.SSSSSSSSS......................................................S.....SSS.
L6 shown xxxxxxxxxxxxxxxxxxxx.xxx.x....x.x.......x.x....x..x.xxxxxxxxxxxxxxxxxxxxxxxxxxx
single-sample sink onsets (round-2 tie-break, a variant now):
reading a: L1 inf, L2/3 -84.0, L4 -120.8, L5/6 80.0, L5 -105.6, L6 -122.4
reading b: L1 -88.8, L2/3 -122.4, L4 -108.0, L5/6 -122.4, L5 -122.4, L6 -120.8
sustained displayed sink onsets (ms from trough), adopted at 1/8 cycle, and the rule at 1/16 and 1/4 cycle:
reading windows expected_windows within_10pct S7_first_tied S7_rule_holds single_sample_onset_rule_holds min_samples onset_L1 onset_L2/3 onset_L4 onset_L5/6 onset_L5 onset_L6 onset_rule_holds holds_at_1/16_cycle holds_at_1/4_cycle
a 685 335 False False False True 27 inf -124.8 -124.8 inf -92.8 inf False True False
b 575 335 False False False False 27 inf -58.4 -124.8 inf inf inf True True True
Result: not reproduced, resting on an assumption. Recorded as reproduced before the second verification round; the third round agreed with the change. With the sustained tie-break, under the Methods' band (reading a) L2/3 and L4 are both sinks from the window start (-124.8 ms) once flips shorter than 1/8 of a cycle (27 samples) are merged, so the L2/3 sink does not follow the L4 sink; the earlier -120.8 against -84.0 ms order came from brief flips. Under the code's band (reading b) L4 is a sink from the window start and L2/3 starts at -58.4 ms, so the rule holds there. The Methods' band is adopted. At 1/16 of a cycle reading a holds too; at 1/4 it fails. S7's own rule fails in both readings. The outcome depends on the minimum duration, which was set for all CSD claims together. 685 and 575 windows against 335.
fig4ab-ssa-condition-spectra¶
In V1, the response to "xxxY" shows a 2.5-5 dB alpha/beta increase at onset (returning to baseline, then rising again) with fast and long-lasting 2.5-5 dB increases in 40-55 Hz and 80-90 Hz gamma; "yyyy" shows a 2-4 dB alpha/beta increase followed by smaller (under 2 dB) gamma increases.
rows = []
for r in FIT:
for s6 in S6:
Y, y = cond_panel(r, "lo_gloexp", s6), cond_panel(r, "igo_seqctl", s6)
rows.append({"S3": r, "S6": s6, "xxxY_g4055_max": Y[tsel(0, 0.5)][:, fbins(40, 55)].max(),
"yyyy_ab_max_0_150": bandmean(y, *AB)[tsel(0, 0.15)].max(),
"xxxY_ab_max_0_150": bandmean(Y, *AB)[tsel(0, 0.15)].max(),
"yyyy_g4055_max_after_150": y[tsel(0.15, 0.5)][:, fbins(40, 55)].max()})
f4ab = pd.DataFrame(rows)
f4ab["xxxY_g_in_2.25_5.5"] = f4ab.xxxY_g4055_max.between(2.25, 5.5)
f4ab["yyyy_ab_in_1.8_4.4"] = f4ab.yyyy_ab_max_0_150.between(1.8, 4.4)
f4ab["xxxY_ab_in_2.25_5.5"] = f4ab.xxxY_ab_max_0_150.between(2.25, 5.5)
f4ab["yyyy_g_below_2.2_and_xxxY"] = (f4ab.yyyy_g4055_max_after_150 < 2.2) & (f4ab.yyyy_g4055_max_after_150 < f4ab.xxxY_g4055_max)
print(f4ab.round(3).T.to_string())
for r in FIT:
for c in ["lo_gloexp", "igo_seqctl"]:
show(cond_panel(r, c), f"reading {r}: {c} dB of trial-mean power over aperiodic", "frequency bin (5-150 Hz)")
0 1 2 3 S3 a a b b S6 lin dbmean lin dbmean xxxY_g4055_max 5.292 0.331 4.529 -0.432 yyyy_ab_max_0_150 2.382 -1.199 2.207 -1.374 xxxY_ab_max_0_150 1.205 -2.174 1.018 -2.361 yyyy_g4055_max_after_150 2.919 -0.993 2.342 -1.571 xxxY_g_in_2.25_5.5 True False True False yyyy_ab_in_1.8_4.4 True False True False xxxY_ab_in_2.25_5.5 False False False False yyyy_g_below_2.2_and_xxxY False True False True
reading a: lo_gloexp dB of trial-mean power over aperiodic: range -3.61 to 5.29 dB (colour scale symmetric, nothing clipped)
reading a: igo_seqctl dB of trial-mean power over aperiodic: range -2.34 to 2.92 dB (colour scale symmetric, nothing clipped)
reading b: lo_gloexp dB of trial-mean power over aperiodic: range -3.88 to 4.53 dB (colour scale symmetric, nothing clipped)
reading b: igo_seqctl dB of trial-mean power over aperiodic: range -2.47 to 2.67 dB (colour scale symmetric, nothing clipped)
Result: partially reproduced. Read as the code draws the panels, the "xxxY" 40-55 Hz maximum (5.29 dB in S3 reading a, 4.53 dB in b) and the "yyyy" alpha/beta maximum (2.38 and 2.21 dB) are in range, and the "yyyy" 40-55 Hz maximum after 150 ms is below the "xxxY" one (2.92 and 2.34 dB), but it is above 2.2 dB, and the "xxxY" alpha/beta maximum in the first 150 ms (1.21 and 1.02 dB) is below 2.25 dB. The ordering holds with values out of range; the trial mean of per-trial dB values gives the same (ordering holds, every value out of range).
fig4c-ssa-v1-contrast¶
In V1 stimulus-specific adaptation ("xxxY" against "yyyy") gives a broad, non-frequency-specific decrease of power (0.5-1.5 dB) at onset, followed by a gamma increase (1-1.5 dB) throughout the stimulus.
rows = []
for r in FIT:
for off in OFFS:
p = panel_c(r, "SSA", off)
e = p[tsel(0, 0.15)]
lt = p[times > 0.15][:, G]
rows.append({"reading": r, "seed_offset": off, "early_neg_theta": int((e[:, TH] < 0).sum()), "early_neg_ab": int((e[:, ABb] < 0).sum()),
"early_neg_gamma": int((e[:, G] < 0).sum()), "early_min": e.min(), "late_gamma_pos": int((lt > 0).sum()), "late_gamma_max": lt.max()})
f4c = pd.DataFrame(rows)
f4c["broad_early_decrease"] = (f4c[["early_neg_theta", "early_neg_ab", "early_neg_gamma"]] > 0).all(axis=1)
f4c["early_in_0.45_1.65"] = (-f4c.early_min).between(0.45, 1.65)
f4c["early_in_legend_0.9_2.2"] = (-f4c.early_min).between(0.9, 2.2)
f4c["late_in_0.9_1.65"] = f4c.late_gamma_max.between(0.9, 1.65)
f4c["late_in_legend_0.9_2.2"] = f4c.late_gamma_max.between(0.9, 2.2)
print(f4c.round(3).to_string(index=False))
for r in FIT:
show(panel_c(r, "SSA"), f"reading {r}: SSA masked contrast, channel mean", "frequency bin (5-150 Hz)")
show(results[(r, "SSA", 0)]["diff"].mean(-1), f"reading {r}: SSA unmasked contrast, channel mean", "frequency bin")
reading seed_offset early_neg_theta early_neg_ab early_neg_gamma early_min late_gamma_pos late_gamma_max broad_early_decrease early_in_0.45_1.65 early_in_legend_0.9_2.2 late_in_0.9_1.65 late_in_legend_0.9_2.2
a 0 16 61 192 -1.986 192 1.910 True False True False True
a 1000 16 61 192 -1.986 192 1.910 True False True False True
a 2000 16 61 192 -1.986 192 1.910 True False True False True
a 3000 16 61 192 -1.986 192 1.910 True False True False True
a 4000 16 61 192 -1.986 192 1.910 True False True False True
b 0 10 59 192 -1.980 133 1.751 True False True False True
b 1000 10 59 192 -1.980 133 1.751 True False True False True
b 2000 10 59 192 -1.980 133 1.751 True False True False True
b 3000 10 59 192 -1.980 133 1.751 True False True False True
b 4000 10 59 192 -1.980 133 1.751 True False True False True
reading a: SSA masked contrast, channel mean: range -1.99 to 1.91 dB (colour scale symmetric, nothing clipped)
reading a: SSA unmasked contrast, channel mean: range -1.99 to 1.91 dB (colour scale symmetric, nothing clipped)
reading b: SSA masked contrast, channel mean: range -1.98 to 1.75 dB (colour scale symmetric, nothing clipped)
reading b: SSA unmasked contrast, channel mean: range -1.98 to 1.75 dB (colour scale symmetric, nothing clipped)
Result: reproduced. Significant decreases in the first 150 ms span theta, alpha/beta and gamma bins (largest -1.99 and -1.98 dB), followed by significant gamma increases after 150 ms (largest 1.91 and 1.75 dB). Both are outside the Results' ranges and inside the legend's 1-2 dB (0.9 to 2.2 dB), which the criterion names as its second reading. The same under the five seeds.
fig4def-ssa-laminar¶
In V1 the release from adaptation gives a fast, broad loss of gamma, alpha/beta and theta power in all layers, followed after about 150 ms by increases in gamma, alpha/beta and theta power that begin in L5/6 and spread up through L4 into L2/3.
rows = []
for r in FIT:
for bname in ["gamma", "gamma_code", "alphabeta", "theta"]:
for off in OFFS:
lam = laminar(r, "SSA", bname, off)
e = lam[tsel(0, 0.15)]
late = lam.copy()
late[times <= 0.15] = 0
fp = {g: first_time(late, g, +1) for g in GROUPS}
rows.append({"reading": r, "band": bname, "seed_offset": off,
**{f"early_neg_{g}": int((e[:, GROUPS[g]] < 0).sum()) for g in GROUPS},
**{f"late_first_pos_{g}": v for g, v in fp.items()}})
f4d = pd.DataFrame(rows)
f4d["early_loss_all_layers"] = (f4d[[f"early_neg_{g}" for g in GROUPS]] > 0).all(axis=1)
f4d["late_L56_first"] = f4d["late_first_pos_L5/6"].notna() & (f4d["late_first_pos_L5/6"] < f4d["late_first_pos_L4"].fillna(np.inf)) & (f4d["late_first_pos_L5/6"] < f4d["late_first_pos_L2/3"].fillna(np.inf))
f4d["band_holds"] = f4d.early_loss_all_layers & f4d.late_L56_first
print(f4d.round(1).to_string(index=False))
nb4 = {(r, gb): int(f4d[(f4d.reading == r) & (f4d.seed_offset == 0) & f4d.band.isin([gb, "alphabeta", "theta"])].band_holds.sum())
for r in FIT for gb in ["gamma", "gamma_code"]}
print("\noutcome by reading (S3 fitting range, gamma band): bands that hold of three")
for (r, gb), n in nb4.items():
print(f" {r} {gb:10s} {n} {'reproduced' if n == 3 else 'partially reproduced' if n else 'not reproduced'}")
for r in FIT:
for bname in ["gamma", "alphabeta", "theta"]:
show(laminar(r, "SSA", bname), f"reading {r}: SSA laminar {bname}", "kept channel (top = surface)", yt=True)
lt4 = {b: layer_table("SSA", b) for b in ["gamma", "alphabeta", "theta"]}
reading band seed_offset early_neg_L1 early_neg_L2/3 early_neg_L4 early_neg_L5/6 late_first_pos_L1 late_first_pos_L2/3 late_first_pos_L4 late_first_pos_L5/6 early_loss_all_layers late_L56_first band_holds
a gamma 0 16 96 48 137 220.0 200.0 220.0 200.0 True False False
a gamma 1000 16 96 48 137 220.0 200.0 220.0 200.0 True False False
a gamma 2000 16 96 48 137 220.0 200.0 220.0 200.0 True False False
a gamma 3000 16 96 48 137 220.0 200.0 220.0 200.0 True False False
a gamma 4000 16 96 48 137 220.0 200.0 220.0 200.0 True False False
a gamma_code 0 16 90 48 99 220.0 200.0 220.0 160.0 True True True
a gamma_code 1000 16 90 48 99 220.0 200.0 220.0 160.0 True True True
a gamma_code 2000 16 90 48 99 220.0 200.0 220.0 160.0 True True True
a gamma_code 3000 16 90 48 99 220.0 200.0 220.0 160.0 True True True
a gamma_code 4000 16 90 48 99 220.0 200.0 220.0 160.0 True True True
a alphabeta 0 16 91 48 144 230.0 190.0 170.0 160.0 True True True
a alphabeta 1000 16 91 48 144 230.0 190.0 170.0 160.0 True True True
a alphabeta 2000 16 91 48 144 230.0 190.0 170.0 160.0 True True True
a alphabeta 3000 16 91 48 144 230.0 190.0 170.0 160.0 True True True
a alphabeta 4000 16 91 48 144 230.0 190.0 170.0 160.0 True True True
a theta 0 8 76 34 45 NaN 180.0 180.0 160.0 True True True
a theta 1000 8 76 34 45 NaN 180.0 180.0 160.0 True True True
a theta 2000 8 76 34 45 NaN 180.0 180.0 160.0 True True True
a theta 3000 8 76 34 45 NaN 180.0 180.0 160.0 True True True
a theta 4000 8 76 34 45 NaN 180.0 180.0 160.0 True True True
b gamma 0 16 96 48 131 NaN 210.0 240.0 170.0 True True True
b gamma 1000 16 96 48 131 NaN 210.0 240.0 170.0 True True True
b gamma 2000 16 96 48 131 NaN 210.0 240.0 170.0 True True True
b gamma 3000 16 96 48 131 NaN 210.0 240.0 170.0 True True True
b gamma 4000 16 96 48 131 NaN 210.0 240.0 170.0 True True True
b gamma_code 0 16 96 48 108 230.0 200.0 230.0 160.0 True True True
b gamma_code 1000 16 96 48 108 230.0 200.0 230.0 160.0 True True True
b gamma_code 2000 16 96 48 108 230.0 200.0 230.0 160.0 True True True
b gamma_code 3000 16 96 48 108 230.0 200.0 230.0 160.0 True True True
b gamma_code 4000 16 96 48 108 230.0 200.0 230.0 160.0 True True True
b alphabeta 0 16 92 42 136 NaN 190.0 160.0 160.0 True False False
b alphabeta 1000 16 92 42 136 NaN 190.0 160.0 160.0 True False False
b alphabeta 2000 16 92 42 136 NaN 190.0 160.0 160.0 True False False
b alphabeta 3000 16 92 42 136 NaN 190.0 160.0 160.0 True False False
b alphabeta 4000 16 92 42 136 NaN 190.0 160.0 160.0 True False False
b theta 0 10 73 4 36 NaN 170.0 160.0 160.0 True False False
b theta 1000 10 73 4 36 NaN 170.0 160.0 160.0 True False False
b theta 2000 10 73 4 36 NaN 170.0 160.0 160.0 True False False
b theta 3000 10 73 4 36 NaN 170.0 160.0 160.0 True False False
b theta 4000 10 73 4 36 NaN 170.0 160.0 160.0 True False False
outcome by reading (S3 fitting range, gamma band): bands that hold of three
a gamma 2 partially reproduced
a gamma_code 3 reproduced
b gamma 1 partially reproduced
b gamma_code 1 partially reproduced
reading a: SSA laminar gamma: range -1.47 to 1.33 dB (colour scale symmetric, nothing clipped)
reading a: SSA laminar alphabeta: range -2.10 to 1.39 dB (colour scale symmetric, nothing clipped)
reading a: SSA laminar theta: range -2.31 to 2.12 dB (colour scale symmetric, nothing clipped)
reading b: SSA laminar gamma: range -1.98 to 0.76 dB (colour scale symmetric, nothing clipped)
reading b: SSA laminar alphabeta: range -2.46 to 1.79 dB (colour scale symmetric, nothing clipped)
reading b: SSA laminar theta: range -2.97 to 2.46 dB (colour scale symmetric, nothing clipped) SSA gamma laminar panel by start of the kept rows (shift0 is the main analysis): start_row reading group rows max min pos_points neg_points first_pos_ms first_neg_ms shift0 a L1 1 0.374 -0.956 17.0 36.0 220.0 -10.0 shift0 a L2/3 6 1.332 -1.465 164.0 154.0 200.0 -10.0 shift0 a L4 3 0.342 -1.443 58.0 80.0 220.0 -10.0 shift0 a L5/6 9 0.622 -0.849 273.0 197.0 200.0 -10.0 shift0 b L1 1 -0.095 -1.425 0.0 53.0 NaN -10.0 shift0 b L2/3 6 0.718 -1.979 106.0 212.0 210.0 -10.0 shift0 b L4 3 0.190 -1.963 6.0 153.0 240.0 -10.0 shift0 b L5/6 9 0.758 -1.287 235.0 233.0 110.0 -10.0 shift1 a L1 0 NaN NaN NaN NaN NaN NaN shift1 a L2/3 6 1.369 -1.650 160.0 157.0 200.0 -10.0 shift1 a L4 3 0.395 -1.458 59.0 87.0 220.0 -10.0 shift1 a L5/6 9 0.612 -1.018 267.0 201.0 190.0 -10.0 shift1 b L1 0 NaN NaN NaN NaN NaN NaN shift1 b L2/3 6 0.655 -2.128 103.0 215.0 210.0 -10.0 shift1 b L4 3 0.263 -1.876 10.0 149.0 240.0 -10.0 shift1 b L5/6 9 0.784 -1.678 230.0 242.0 120.0 -10.0 shift3 a L1 1 0.222 -1.405 5.0 48.0 230.0 -10.0 shift3 a L2/3 5 1.348 -1.285 152.0 112.0 190.0 -10.0 shift3 a L4 3 0.486 -1.435 67.0 76.0 220.0 -10.0 shift3 a L5/6 9 0.639 -1.190 266.0 205.0 200.0 -10.0 shift3 b L1 1 -0.412 -1.817 0.0 53.0 NaN -10.0 shift3 b L2/3 5 0.628 -1.842 98.0 167.0 210.0 -10.0 shift3 b L4 3 0.278 -1.968 11.0 148.0 240.0 -10.0 shift3 b L5/6 9 0.721 -1.755 210.0 259.0 110.0 -10.0 SSA alphabeta laminar panel by start of the kept rows (shift0 is the main analysis): start_row reading group rows max min pos_points neg_points first_pos_ms first_neg_ms shift0 a L1 1 0.211 -1.578 4.0 24.0 230.0 -10.0 shift0 a L2/3 6 1.344 -1.975 158.0 121.0 190.0 -10.0 shift0 a L4 3 1.392 -1.742 101.0 56.0 170.0 -10.0 shift0 a L5/6 9 1.360 -2.096 280.0 163.0 160.0 -10.0 shift0 b L1 1 0.000 -1.944 0.0 35.0 NaN -10.0 shift0 b L2/3 6 1.220 -2.457 143.0 154.0 190.0 -10.0 shift0 b L4 3 1.757 -1.552 106.0 48.0 60.0 -10.0 shift0 b L5/6 9 1.794 -2.452 291.0 173.0 60.0 -10.0 shift1 a L1 0 NaN NaN NaN NaN NaN NaN shift1 a L2/3 6 1.305 -2.127 153.0 125.0 190.0 -10.0 shift1 a L4 3 1.361 -1.771 99.0 58.0 170.0 -10.0 shift1 a L5/6 9 1.702 -2.342 272.0 170.0 150.0 -10.0 shift1 b L1 0 NaN NaN NaN NaN NaN NaN shift1 b L2/3 6 1.113 -2.573 135.0 160.0 200.0 -10.0 shift1 b L4 3 1.683 -1.590 107.0 48.0 60.0 -10.0 shift1 b L5/6 9 1.755 -2.499 289.0 176.0 60.0 -10.0 shift3 a L1 1 0.000 -1.945 0.0 26.0 NaN -10.0 shift3 a L2/3 5 1.301 -1.801 143.0 100.0 190.0 -10.0 shift3 a L4 3 1.414 -1.618 103.0 56.0 170.0 -10.0 shift3 a L5/6 9 1.560 -2.103 299.0 161.0 160.0 -10.0 shift3 b L1 1 -0.204 -2.342 0.0 53.0 NaN -10.0 shift3 b L2/3 5 1.217 -2.322 114.0 131.0 190.0 -10.0 shift3 b L4 3 1.643 -1.845 103.0 54.0 60.0 -10.0 shift3 b L5/6 9 1.803 -2.519 293.0 170.0 60.0 -10.0 SSA theta laminar panel by start of the kept rows (shift0 is the main analysis): start_row reading group rows max min pos_points neg_points first_pos_ms first_neg_ms shift0 a L1 1 0.000 -1.038 0.0 9.0 NaN -10.0 shift0 a L2/3 6 0.962 -2.310 20.0 166.0 180.0 -10.0 shift0 a L4 3 1.028 -2.312 14.0 79.0 180.0 -10.0 shift0 a L5/6 9 2.116 -2.245 250.0 52.0 90.0 -10.0 shift0 b L1 1 0.000 -1.336 0.0 16.0 NaN -10.0 shift0 b L2/3 6 1.167 -2.972 15.0 179.0 170.0 -10.0 shift0 b L4 3 2.341 -1.428 111.0 7.0 40.0 -10.0 shift0 b L5/6 9 2.457 -1.873 349.0 47.0 40.0 -10.0 shift1 a L1 0 NaN NaN NaN NaN NaN NaN shift1 a L2/3 6 0.947 -2.323 18.0 152.0 180.0 -10.0 shift1 a L4 3 1.049 -2.302 14.0 82.0 180.0 -10.0 shift1 a L5/6 9 2.087 -2.070 279.0 57.0 90.0 -10.0 shift1 b L1 0 NaN NaN NaN NaN NaN NaN shift1 b L2/3 6 1.203 -2.925 10.0 194.0 170.0 -10.0 shift1 b L4 3 2.244 -1.539 106.0 7.0 40.0 -10.0 shift1 b L5/6 9 2.483 -1.807 355.0 46.0 30.0 -10.0 shift3 a L1 1 0.000 -1.455 0.0 18.0 NaN -10.0 shift3 a L2/3 5 0.962 -2.298 16.0 120.0 180.0 -10.0 shift3 a L4 3 1.153 -2.060 16.0 40.0 180.0 -10.0 shift3 a L5/6 9 2.223 -2.090 253.0 51.0 90.0 -10.0 shift3 b L1 1 0.000 -1.836 0.0 33.0 NaN -10.0 shift3 b L2/3 5 1.172 -2.843 12.0 134.0 170.0 -10.0 shift3 b L4 3 2.206 -1.945 73.0 14.0 40.0 -10.0 shift3 b L5/6 9 2.398 -1.654 359.0 46.0 40.0 -10.0
Result: partially reproduced, resting on an assumption. Under S3 reading (a) with the Methods' 30-90 Hz gamma band, alpha/beta and theta hold (an early loss in every layer group, later increases first in L5/6 at 160 ms, before L4 and L2/3), but in gamma the later increase starts in L5/6 and L2/3 together (200 ms): two of three bands. With the code's 30-50 Hz band all three hold (reproduced); under reading (b) only gamma holds, as L4 ties with L5/6 in alpha/beta and theta. By reading (printed): partially reproduced in three of the four, reproduced with S3 (a) and 30-50 Hz.
fig4g-ssa-gamma-csd-feedforward¶
gamma oscillations in P4 of "xxxY" in V1 show a feedforward CSD pattern beginning in L4 and L5 and spreading into L2/3 and L6.
boundary = int(np.flatnonzero(csd_rows == "L5/6")[0])
print("L4/L5 boundary row (first L5/6 CSD row):", boundary)
csd_table("fig4g", lambda f: min(f["L4"], f["L5"]) <= min(f[g] for g in G4) and f["L2/3"] > min(f["L4"], f["L5"]) and f["L6"] > min(f["L4"], f["L5"]), 1910)
for r in ["a", "b"]:
res = CSD[("fig4g", r)]
hit = ((res["mean"] < 0) & res["shown"])
t_bd = res["lag"][np.flatnonzero(hit[boundary])[0]] if hit[boundary].any() else np.inf
print(f"reading {r}: first sink in the boundary row {t_bd:.1f} ms; first L4 {res['first']['L4']:.1f}, first L5 (any) {res['first']['L5']:.1f}")
L4/L5 boundary row (first L5/6 CSD row): 10
fig4g reading a: 1868 windows; CSD range -1.02e-05 to 1.43e-05 (V/row^2, arbitrary scale); shown fraction 0.99; first sink (ms from trough): L1 -12.8, L2/3 -12.8, L4 -12.8, L5/6 -12.8, L5 -12.8, L6 -12.8; sustained displayed sink onset of the group mean: L1 6.4, L2/3 -4.0, L4 -9.6, L5/6 4.0, L5 2.4, L6 6.4 reading a, by lag from -12.8 to 12.8 ms, every 0.8 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group L1 mean SSSSSSSSSSS.............SSSSSSSSS L1 shown xxxxxxxxxxx.............xxxxxxxxx L2/3 mean ...........SSSSSSSSSSSSSS........ L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L4 mean ....SSSSSSSSSSSSS.............SSS L4 shown xxxxxxxxxxxxxxxxxx..........xxxxx L5/6 mean SSSSSSSS.............SSSSSSSSSSSS L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L5 mean SSSS...............SSSSSSSSSSSS.. L5 shown xxxxxxxxxxxxx.x.xxxxxxxxxxxxxxxxx L6 mean SSSSSSSSSSS.............SSSSSSSSS L6 shown xxxxxxxxxxxxxxxxxxx.xx.xxxxxxxxxx
fig4g reading b: 1943 windows; CSD range -1.36e-05 to 1.44e-05 (V/row^2, arbitrary scale); shown fraction 0.99; first sink (ms from trough): L1 -18.4, L2/3 -18.4, L4 -13.6, L5/6 -18.4, L5 -18.4, L6 -18.4; sustained displayed sink onset of the group mean: L1 7.2, L2/3 -4.8, L4 -12.8, L5/6 4.8, L5 2.4, L6 7.2
reading b, by lag from -18.4 to 18.4 ms, every 0.8 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group
L1 mean SSSSSSSSSSSSSSSS................SSSSSSSSSSSSSSS
L1 shown xxxxxxxxxxxxxxxx................xxxxxxxxxxxxxxx
L2/3 mean .................SSSSSSSSSSSSSSSS..............
L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L4 mean .......SSSSSSSSSSSSSSSSS..............SSSSSSSSS
L4 shown ......xxxxxxxxxxxxxxxxxxxx........xxxxxxxxxxxxx
L5/6 mean SSSSSSSSSSSSS................SSSSSSSSSSSSSSSS..
L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L5 mean SSSSSSSSSS................SSSSSSSSSSSSSSS......
L5 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L6 mean SSSSSSSSSSSSSSSSS...............SSSSSSSSSSSSSSS
L6 shown xxxxxxxxxxxxxxxxxxxxxx....xxxxxxxxxxxxxxxxxxxxx
single-sample sink onsets (round-2 tie-break, a variant now):
reading a: L1 6.4, L2/3 -4.0, L4 -9.6, L5/6 4.0, L5 2.4, L6 6.4
reading b: L1 7.2, L2/3 -4.8, L4 -12.8, L5/6 4.8, L5 2.4, L6 7.2
sustained displayed sink onsets (ms from trough), adopted at 1/8 cycle, and the rule at 1/16 and 1/4 cycle:
reading windows expected_windows within_10pct S7_first_tied S7_rule_holds single_sample_onset_rule_holds min_samples onset_L1 onset_L2/3 onset_L4 onset_L5/6 onset_L5 onset_L6 onset_rule_holds holds_at_1/16_cycle holds_at_1/4_cycle
a 1868 1910 True True False True 3 6.4 -4.0 -9.6 4.0 2.4 6.4 True True False
b 1943 1910 True False False True 4 7.2 -4.8 -12.8 4.8 2.4 7.2 True True False
reading a: first sink in the boundary row -12.0 ms; first L4 -12.8, first L5 (any) -12.8
reading b: first sink in the boundary row -18.4 ms; first L4 -13.6, first L5 (any) -18.4
Result: reproduced, resting on an assumption. With the tie-break, L4 starts first under both bands (-9.6 and -12.8 ms) and the L2/3 (-4.0 and -4.8 ms) and L6 (6.4 and 7.2 ms) sinks follow. The rule holds at 1/16 of a cycle and with single-sample onsets, and fails at 1/4 of a cycle in both readings. 1868 and 1943 windows against 1910.
fig4h-ssa-alphabeta-csd¶
alpha/beta oscillations in P4 of "yyyy" in V1 show sinks spreading from L5/6 and L1 into L5, L4 and L2/3, a feedback pattern (the Results call it mixed feedforward and feedback).
csd_table("fig4h", lambda f: min(f["L1"], f["L5/6"]) < f["L4"], 319)
fig4h reading a: 303 windows; CSD range -8.58e-06 to 8.95e-06 (V/row^2, arbitrary scale); shown fraction 0.93; first sink (ms from trough): L1 -37.6, L2/3 -37.6, L4 -37.6, L5/6 -37.6, L5 -37.6, L6 -37.6; sustained displayed sink onset of the group mean: L1 16.0, L2/3 -29.6, L4 -21.6, L5/6 -12.0, L5 -16.0, L6 11.2 reading a, by lag from -37.6 to 37.6 ms, every 0.8 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group L1 mean SSSSS.SSSSSSSSSSSSS..........................................SS.S.SSSSSSSSSSSSSSSSSSSSSSSSSSSSS L1 shown xxxx...xxxxxx.xxxx..............................................x..xxxxxxxxxxxxxxxxxxxxxxxxxxxx L2/3 mean ....SS..S.SSSSSSS.SSSSSSSSSSSSS..SSSSSSSSSSSSSSSSSSS..S.S.......SS...........S................. L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxx..xxx.x L4 mean ..S......S.......S..SSS.SSS..SSSSSS...SSSSSSS...SS....SS.S..SSSS..S....SS.......S.............. L4 shown xxxxxxxxxxxx..x.xxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L5/6 mean SSSSSSSSS..SSSSS............S...SS.SSSSSSSSS.SSS..SSSSSSSSSS....S..SSSSS..SSSSSS.SSSSSSSSSSSSSS L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L5 mean SS.SS.SS..S.SS.............SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS...S..SSSS...S..S....S.S..SSS.SSSS L5 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L6 mean SSSSSSS.SS.SSSSSSSS..SSS.....................................SS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS L6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxx.xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
fig4h reading b: 272 windows; CSD range -8.25e-06 to 6.62e-06 (V/row^2, arbitrary scale); shown fraction 0.92; first sink (ms from trough): L1 -40.0, L2/3 -41.6, L4 -41.6, L5/6 -41.6, L5 -41.6, L6 -41.6; sustained displayed sink onset of the group mean: L1 -34.4, L2/3 -29.6, L4 25.6, L5/6 inf, L5 -13.6, L6 20.8
reading b, by lag from -41.6 to 41.6 ms, every 0.8 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group
L1 mean ..SS.....SSS.SSSSSSSSSSSSS............................................SS...S.............................
L1 shown ..x......xxx.xxx.xxxxxxxx.............................................xx...x.............................
L2/3 mean SS....SSSS.....SS.S.SS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSS.SSSSSSSSSSSSS....SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L4 mean .SSSSSS...SSSS.SSS.S......SSSSSSSSSSS.SSSSSSSSSSS.SSSSSSSSS.SSSSSSSS.SSSSS........S.SS.S..SSS..S.........
L4 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xx.xxxxxxxxxxxxxxx.xx..xxx.xx
L5/6 mean S......SSS...........S......................S....S...S....SSSS......S.....S...S.S.......................S
L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L5 mean S....S..S.........S..SSSS..........SSSS...SSS..SSSS.SS..SSSSSSSSSSSSSSSS.SS...S..............SS..S....SSS
L5 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L6 mean ...S..SSSSSS..SSSS..S.........................................................SSSSSSSS..SS...........S...
L6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
single-sample sink onsets (round-2 tie-break, a variant now):
reading a: L1 -32.8, L2/3 -34.4, L4 -36.0, L5/6 -28.8, L5 -35.2, L6 -31.2
reading b: L1 -40.0, L2/3 -36.8, L4 -40.8, L5/6 -36.0, L5 -37.6, L6 -39.2
sustained displayed sink onsets (ms from trough), adopted at 1/8 cycle, and the rule at 1/16 and 1/4 cycle:
reading windows expected_windows within_10pct S7_first_tied S7_rule_holds single_sample_onset_rule_holds min_samples onset_L1 onset_L2/3 onset_L4 onset_L5/6 onset_L5 onset_L6 onset_rule_holds holds_at_1/16_cycle holds_at_1/4_cycle
a 303 319 True True False False 8 16.0 -29.6 -21.6 -12.0 -16.0 11.2 False False False
b 272 319 False False False False 9 -34.4 -29.6 25.6 inf -13.6 20.8 True True False
Result: not reproduced, resting on an assumption. With the tie-break, under the Methods' band (reading a) the L4 sink (-21.6 ms) starts before the L5/6 (-12.0 ms) and L1 (16.0 ms) sinks; under the code's band (reading b) the L1 sink (-34.4 ms) starts before L4 (25.6 ms), so the rule holds there. The readings disagree, and the Methods' band is adopted. The same split holds at 1/16 of a cycle; at 1/4 both readings fail. With single-sample onsets both fail (reading a, L4 -36.0 against L1 -32.8 and L5/6 -28.8 ms; reading b, L4 -40.8 against L1 -40.0 and L5/6 -36.0 ms, an L1 margin of 0.8 ms). In reading a, L1 and L5/6 are sinks at the first lag while L4 is a source, so a reading by eye could come out the other way. S7's own rule fails too. 303 and 272 windows against 319.
fig4i-ssa-theta-csd¶
theta oscillations in P4 of "xxxY" in V1 show sinks starting in L1 and L6, then activity in L2/3 at the trough spreading down through L4 and L5 into L6.
csd_table("fig4i", lambda f: min(f["L1"], f["L6"]) <= min(f[g] for g in G4 + ["L6"]) and f["L2/3"] < f["L4"] and f["L2/3"] < f["L5"], 1266)
fig4i reading a: 2481 windows; CSD range -1.26e-05 to 2.18e-05 (V/row^2, arbitrary scale); shown fraction 0.99; first sink (ms from trough): L1 inf, L2/3 -124.8, L4 -124.8, L5/6 -124.8, L5 -124.8, L6 -124.8; sustained displayed sink onset of the group mean: L1 inf, L2/3 inf, L4 -124.8, L5/6 44.8, L5 -124.8, L6 inf reading a, by lag from -124.8 to 124.8 ms, every 3.2 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group L1 mean ............................................................................... L1 shown ............................................................................... L2/3 mean SSSSSSSSS..SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.............SSSS L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L4 mean SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS L4 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L5/6 mean SS..SS.SS.SSS........................................S.SSSS.SSSSSSSSSSSSSSSSSSS L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L5 mean SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS L5 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx L6 mean ............................................................................... L6 shown xxxxxxxxxxxx...xx..xxx.....................x..x.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
fig4i reading b: 2054 windows; CSD range -1.38e-05 to 2.53e-05 (V/row^2, arbitrary scale); shown fraction 0.99; first sink (ms from trough): L1 -100.8, L2/3 -124.8, L4 -124.8, L5/6 -124.8, L5 -124.8, L6 -124.8; sustained displayed sink onset of the group mean: L1 inf, L2/3 -76.8, L4 inf, L5/6 52.0, L5 -124.8, L6 inf
reading b, by lag from -124.8 to 124.8 ms, every 3.2 ms: S = the group's mean CSD is a sink (< 0), . = a source; then x = a displayed sink in a row of the group
L1 mean ........SS...S..............................................S......SSS.........
L1 shown ........xx..................................................x......xxx.........
L2/3 mean ...SS.....S....SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS................S..SSS
L2/3 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L4 mean SSSS.S.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSS.S.S...SSS
L4 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L5/6 mean SSSSSSSS................................................SSSSSSSSSSSSSSSSSSSSSSS
L5/6 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L5 mean SSSSSSSSSSSSSSSSSSSSSSSSSS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
L5 shown xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
L6 mean ..........................................................................S....
L6 shown xxxxxxxxxxxxxxxxx..x............................x.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
single-sample sink onsets (round-2 tie-break, a variant now):
reading a: L1 inf, L2/3 -91.2, L4 -124.8, L5/6 -121.6, L5 -124.8, L6 inf
reading b: L1 -100.8, L2/3 -120.0, L4 -111.2, L5/6 -122.4, L5 -40.8, L6 93.6
sustained displayed sink onsets (ms from trough), adopted at 1/8 cycle, and the rule at 1/16 and 1/4 cycle:
reading windows expected_windows within_10pct S7_first_tied S7_rule_holds single_sample_onset_rule_holds min_samples onset_L1 onset_L2/3 onset_L4 onset_L5/6 onset_L5 onset_L6 onset_rule_holds holds_at_1/16_cycle holds_at_1/4_cycle
a 2481 1266 False False False False 27 inf inf -124.8 44.8 -124.8 inf False False False
b 2054 1266 False False False False 27 inf -76.8 inf 52.0 -124.8 inf False False False
Result: not reproduced, resting on an assumption. With the tie-break, neither band has an L1 or L6 sink onset in the window; L4 (reading a) and L5 (both readings) are sinks from the window start. The rule fails at 1/16 and 1/4 of a cycle and with single-sample onsets. S7's own rule fails too. 2481 and 2054 windows against 1266.
suppfig4-pupil-dd-no-difference¶
Pupil size, z-scored, does not differ significantly between P4 of the random "XXXY" sequences and P4 of the habituation "xxxy" sequences.
Pupil area from pupil_tracking, blinks (likely_blink) set missing and filled by linear
interpolation, sampled at 30 points from P4 onset to offset (about the camera's 60 Hz). A trial
with no valid sample in the window is dropped.
pt = np.linspace(0, 0.5, 30, endpoint=False)
tr = {"lo_rndctl": [], "lonaive": []}
mouse_of = {"lo_rndctl": [], "lonaive": []}
dropped = 0
for m in mice:
eye = smeta[m][3]
if eye is None:
continue
a = eye["area"].astype(float).copy()
a[eye["blink"].astype(bool) | ~np.isfinite(a)] = np.nan
ok = np.isfinite(a)
for c in tr:
for on in conds[m][c].p4_on:
sel = (eye["t"] >= on - 0.1) & (eye["t"] <= on + 0.6) & ok
if sel.sum() < 5:
dropped += 1
continue
tr[c].append(np.interp(on + pt, eye["t"][sel], a[sel]))
mouse_of[c].append(m)
X = {c: np.array(v) for c, v in tr.items()}
print("mice with eye tracking:", len(set(mouse_of["lo_rndctl"])), "; trials", {c: len(v) for c, v in X.items()}, "; dropped", dropped)
pooled = np.concatenate([X["lo_rndctl"], X["lonaive"]])
mu, sd = np.nanmean(pooled), np.nanstd(pooled)
Z = {c: (X[c] - mu) / sd for c in X}
Zm = {c: np.empty_like(X[c]) for c in X}
for m in set(mouse_of["lo_rndctl"]):
both = np.concatenate([X[c][np.array(mouse_of[c]) == m] for c in X])
for c in X:
sel = np.array(mouse_of[c]) == m
Zm[c][sel] = (X[c][sel] - both.mean()) / both.std()
rows = []
for name, ZZ in [("pooled z", Z), ("per-mouse z", Zm)]:
for off in OFFS:
f_obs, lab, pv = glo.cluster_test(ZZ["lo_rndctl"][:, :, None, None], ZZ["lonaive"][:, :, None, None],
np.random.default_rng(seed("suppfig4-pupil-dd-no-difference") + off))
d = ZZ["lo_rndctl"].mean(0) - ZZ["lonaive"].mean(0)
rows.append({"z-scoring": name, "seed_offset": off, "clusters": len(pv), "min_p": pv.min() if len(pv) else np.nan,
"max_abs_mean_diff_z": np.abs(d).max(), "max_F": f_obs.max()})
print(pd.DataFrame(rows).round(4).to_string(index=False))
for name, ZZ in [("pooled z", Z), ("per-mouse z", Zm)]:
m1, m2 = ZZ["lo_rndctl"].mean(0), ZZ["lonaive"].mean(0)
s1 = 2 * ZZ["lo_rndctl"].std(0) / np.sqrt(len(ZZ["lo_rndctl"]))
s2 = 2 * ZZ["lonaive"].std(0) / np.sqrt(len(ZZ["lonaive"]))
overlap = (np.abs(m1 - m2) <= s1 + s2)
print(f"{name}: XXXY mean z {m1.mean():.3f}, xxxy mean z {m2.mean():.3f}; 2-SEM bands overlap at {overlap.sum()} of {len(pt)} time points")
mice with eye tracking: 9 ; trials {'lo_rndctl': 343, 'lonaive': 450} ; dropped 3
z-scoring seed_offset clusters min_p max_abs_mean_diff_z max_F pooled z 0 2 0.002 0.3298 15.2175 pooled z 1000 2 0.001 0.3298 15.2175 pooled z 2000 2 0.001 0.3298 15.2175 pooled z 3000 2 0.002 0.3298 15.2175 pooled z 4000 2 0.001 0.3298 15.2175 per-mouse z 0 1 0.001 0.3914 27.0650 per-mouse z 1000 1 0.001 0.3914 27.0650 per-mouse z 2000 1 0.001 0.3914 27.0650 per-mouse z 3000 1 0.001 0.3914 27.0650 per-mouse z 4000 1 0.001 0.3914 27.0650 pooled z: XXXY mean z 0.129, xxxy mean z -0.098; 2-SEM bands overlap at 6 of 30 time points per-mouse z: XXXY mean z 0.183, xxxy mean z -0.140; 2-SEM bands overlap at 0 of 30 time points
# Checks asked for in verification. (1) The eye-tracking clock against the stimulus table.
# (2) A stimulus-locked pupil response: the mean z-scored pupil area over one sequence cycle (5 s,
# from 3 s before to 2 s after P4 onset) of every main-block sequence, against the same mean around as many random times in the main block
# (200 draws, the claim's second generator). (3) Time in session: XXXY against the last 50
# main-block "xxxy" of each mouse, which come just before the random block, in place of the first 50.
rng_p = np.random.default_rng(seed("suppfig4-pupil-dd-no-difference") + 1)
lag_p = np.arange(-3.0, 2.0, 0.05)
rows, late = [], {"lo_rndctl": [], "late_xxxy": []}
for m in mice:
eye = smeta[m][3]
if eye is None:
continue
s = smeta[m][1]
a = eye["area"].astype(float).copy()
a[eye["blink"].astype(bool) | ~np.isfinite(a)] = np.nan
ok = np.isfinite(a) & np.isfinite(eye["t"])
z = (a - np.nanmean(a[ok])) / np.nanstd(a[ok])
zt, zz = eye["t"][ok], z[ok]
main_on = s[s.kind == "main"].p4_on.to_numpy()
locked = np.mean([np.interp(on + lag_p, zt, zz) for on in main_on], 0)
null = []
for _ in range(200):
ons = rng_p.uniform(main_on.min(), main_on.max(), len(main_on))
null.append(np.std(np.mean([np.interp(on + lag_p, zt, zz) for on in ons], 0)))
rows.append({"mouse": m, "eye_t_first_s": np.nanmin(eye["t"]), "eye_t_last_s": np.nanmax(eye["t"]),
"eye_t_missing": int(np.isnan(eye["t"]).sum()), "lfp_v1_t0_s": passes[m]["t0"],
"stim_first_p4_s": s.p4_on.min(), "stim_last_p4_s": s.p4_on.max(),
"eye_dt_ms_median": 1000 * np.nanmedian(np.diff(eye["t"])),
"locked_sd_z": np.std(locked), "null_sd_z_95pct": np.quantile(null, 0.95),
"locked_above_null": np.std(locked) > np.quantile(null, 0.95),
"locked_min_lag_s": lag_p[locked.argmin()], "locked_max_lag_s": lag_p[locked.argmax()]})
lo = s[(s.kind == "main") & (s.xy == "xxxy")]
for c, ons in [("lo_rndctl", conds[m]["lo_rndctl"].p4_on), ("late_xxxy", lo.p4_on.iloc[-50:])]:
for on in ons:
sel = (eye["t"] >= on - 0.1) & (eye["t"] <= on + 0.6) & ok
if sel.sum() >= 5:
late[c].append(np.interp(on + pt, eye["t"][sel], a[sel]))
print(pd.DataFrame(rows).round(3).to_string(index=False))
XL = {c: np.array(v) for c, v in late.items()}
pl = np.concatenate([XL["lo_rndctl"], XL["late_xxxy"]])
ZL = {c: (XL[c] - np.nanmean(pl)) / np.nanstd(pl) for c in XL}
f_obs, lab, pv = glo.cluster_test(ZL["lo_rndctl"][:, :, None, None], ZL["late_xxxy"][:, :, None, None],
np.random.default_rng(seed("suppfig4-pupil-dd-no-difference")))
dl = ZL["lo_rndctl"].mean(0) - ZL["late_xxxy"].mean(0)
print(f"time-in-session variant, XXXY ({len(XL['lo_rndctl'])} trials) against the last 50 main-block xxxy "
f"({len(XL['late_xxxy'])} trials), pooled z: {len(pv)} clusters, smallest p {pv.min() if len(pv) else np.nan:.3f}; "
f"mean z {ZL['lo_rndctl'].mean():.3f} against {ZL['late_xxxy'].mean():.3f}; largest |mean difference| {np.abs(dl).max():.3f} z")
mouse eye_t_first_s eye_t_last_s eye_t_missing lfp_v1_t0_s stim_first_p4_s stim_last_p4_s eye_dt_ms_median locked_sd_z null_sd_z_95pct locked_above_null locked_min_lag_s locked_max_lag_s sub-621890 2.127 7724.675 1 4.832 43.102 6568.587 16.66 0.062 0.024 True -0.30 -2.95 sub-632485 1.362 8073.124 1 4.491 68.870 6829.573 16.66 0.031 0.018 True 0.35 -2.85 sub-632487 1.270 7996.882 1 4.476 63.676 6824.412 16.66 0.074 0.035 True 1.90 -3.00 sub-637542 1.277 8054.438 1 4.471 127.850 6888.568 16.66 0.094 0.038 True 0.70 -3.00 sub-637908 1.265 8369.437 1 4.483 394.707 7157.278 16.66 0.031 0.027 True 0.55 -3.00 sub-645322 1.332 7972.694 1 3.594 41.655 6802.339 16.66 0.051 0.028 True 0.60 -2.95 sub-645324 1.278 7998.956 1 3.761 41.836 6802.519 16.66 0.062 0.028 True 0.85 -3.00 sub-645495 1.309 7962.840 1 3.531 41.480 6802.165 16.66 0.047 0.027 True 0.50 -2.90 sub-649323 1.362 9132.683 1 3.563 106.497 6867.179 16.66 0.055 0.035 True 0.75 -2.90 time-in-session variant, XXXY (343 trials) against the last 50 main-block xxxy (415 trials), pooled z: 4 clusters, smallest p 0.005; mean z -0.104 against 0.086; largest |mean difference| 0.268 z
Result: not reproduced. In the 9 mice with eye tracking (343 "XXXY" and 450 "xxxy" trials, 3 dropped), the cluster test over P4 finds significant differences in z-scored pupil area (smallest cluster p 0.001 to 0.002 over the five seeds, pooled z-scoring; 0.001 per mouse), the pupil being larger in "XXXY" (mean z 0.129 against -0.098). The eye clock is consistent with the stimulus table: in all 9 mice the pupil averaged over the main-block sequences varies more than at random times (SD 0.031 to 0.094 z against a 95th percentile of 0.018 to 0.038 z). The difference depends on time in session: against the last 50 main-block "xxxy", which come just before the random block, "XXXY" has the smaller pupil (mean z -0.104 against 0.086, cluster p 0.005).
Summary¶
| Claim | Outcome |
|---|---|
| trial-counts | partially reproduced (5 of 6 counts differ by 1 to 5 trials) |
| three-contrasts-gamma-increase | reproduced |
| fig2ab-dd-condition-spectra | partially reproduced (assumption) |
| fig2c-dd-v1-contrast | partially reproduced |
| fig2d-dd-gamma-laminar | partially reproduced |
| fig2e-dd-alphabeta-laminar | partially reproduced (assumption) |
| fig2f-dd-theta | not reproduced |
| fig2g-dd-gamma-csd-feedforward | reproduced (assumption) |
| fig2h-dd-alphabeta-csd-feedback | not reproduced (assumption) |
| fig2i-dd-theta-csd-mixed | not reproduced (assumption) |
| dd-gamma-peak-frequency-v1 | reproduced |
| go-theta-peaks | reproduced |
| fig3ab-go-condition-spectra | not reproduced |
| fig3c-go-v1-contrast | reproduced |
| fig3d-go-gamma-laminar | reproduced (assumption) |
| fig3e-go-alphabeta-laminar | partially reproduced |
| fig3f-go-theta-laminar | partially reproduced |
| fig3g-go-gamma-csd-feedforward | reproduced (assumption) |
| fig3h-go-alphabeta-csd-feedback | not reproduced (assumption) |
| fig3i-go-theta-csd | not reproduced (assumption) |
| fig4ab-ssa-condition-spectra | partially reproduced |
| fig4c-ssa-v1-contrast | reproduced |
| fig4def-ssa-laminar | partially reproduced (assumption) |
| fig4g-ssa-gamma-csd-feedforward | reproduced (assumption) |
| fig4h-ssa-alphabeta-csd | not reproduced (assumption) |
| fig4i-ssa-theta-csd | not reproduced (assumption) |
| suppfig4-pupil-dd-no-difference | not reproduced |
| the ten claims across six areas | see areas.ipynb |
A failure to reproduce here may be a failure of this attempt, not of the paper: see the reasoning and the differences from the paper's method.
How the analysis differs from the paper's. The conditions are rebuilt from the stimulus tables, as the paper's condition file is not in the dandiset. The LFP is at 1250 Hz in the files, so the 200 ms window is 250 samples, and the spectrogram bins lie 4.88 Hz apart (the labels 5 to 150 Hz fall on 4.9 to 151.4 Hz). Each trial is de-meaned before the spectrogram (Syncopy's default, assumed). Three details are taken from the paper's code (epych cee2e6f): the channel alignment and where the every-fourth downsampling starts (from the deepest row, the topmost common row left out); the condition panels as dB of the trial-mean power over the aperiodic fit; and, for the spectrogram fit, the code's 5-150 Hz range (S3 reading a), as the Methods' "2 to 90 Hz with a frequency resolution of 2 Hz" fits the per-mouse spectra, not the 5 Hz spectrogram grid. Where the S3 range changes an outcome (fig2e, fig3d, fig4def) the outcome under each reading is printed. Where the CSD bands change an outcome the Methods' bands are adopted. S7's first-sink rule ties at the window start, so the sink onset of each layer group's mean CSD breaks the tie, counted for a displayed sink lasting at least 1/8 of a cycle; with that rule fig3h and fig3i do not hold under the Methods' bands; the FIR band-pass is an assumed windowed-sinc filter of at most 249 taps. The CSD repeats the edge rows (Elephant's default) so that L1 has a row. The L1 results rest on one kept row; the variant with the start moved up by 3 rows keeps the other L1 row and is printed with each L1 claim.
What was found about the dataset. The cited version, 0.240503.0152, has LFP timestamps that are not in seconds for 7 of 14 mice, near-identical LFP in two pairs of mice, and one channel in four for one mouse; version 0.240923.1441 fixes all three. The stimulus tables carry no block or condition labels, and the habituation block holds 25 sequences where the paper describes 50 habituation trials. The LFP is at 1250 Hz where the paper states 2.5 kHz. Three mice have no probe labelled AL (two labelled LM twice, one RL twice) and one probe has no area label. The cohorts are 8 and 6 mice, where the paper describes two of 7, and one mouse is 88 days old, below the paper's 95 to 128. Five sessions have no eye tracking; in the other nine the eye clock is consistent with the stimulus table.
print(f"notebook ran in {(time.time() - started) / 60:.1f} min; peak memory {resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6:.1f} GB")
notebook ran in 17.5 min; peak memory 10.7 GB