Reproducing Gable et al. (2026), Figure S4 and Table 5, from DANDI:000010¶
Paper. Gable J, Newman ZL, Young S, Scheib J, Bliese S, Miller N, Kerlin A (2026). Tuft dendrite
spikes are accompanied by selective input from distinct functional networks. J Neurosci 46(38)
e0974262026, doi:10.1523/jneurosci.0974-26.2026.
The claims file (claims/gable-2026.yaml) was written from the version of record (PMC13612898)
with its supplement, and from the paper's code, github.com/kerlin-lab/Gable_2026 at commit 688e662.
Dataset. DANDI:000010, version 0.220126.1905, "A motor cortex circuit for motor planning and movement" (Li, Chen, Guo, Gerfen and Svoboda 2015). The paper reuses its silicon-probe recordings of ALM for Figure S4 and Table 5 only. It cites the dataset without a version. 0.220126.1905 is the only published version; the draft holds the same 158 assets (same paths, asset ids and sizes, checked below) and differs only in dandiset metadata, so the published version is pinned.
What can be tested. The four claims on the silicon-probe recordings (figs4-*). Every other claim
rests on the paper's own two-photon imaging, which is not in this dataset nor in any public archive
the paper or its code names. The claims file marks them data: dataset, and they are blocked as
data_missing (a reader's answer in questions/gable-2026.yaml changed them from data: elsewhere).
| Claim | Tested here |
|---|---|
| figs4-session-selection | yes |
| figs4-lowest-couplers-correlated | yes |
| figs4-high-couplers-correlated | yes |
| figs4-middle-couplers-not-correlated | yes (run; blocked as methods_underspecified, see its section) |
| 30 imaging claims (fig1 to fig5, figs1 to figs3, table1) | no, blocked (data_missing): the imaging data are not public |
Method. The claims file's E1 to E8 (selection, binning, trial-specific activity, population
coupling, pairs, bootstrap test) are implemented in alm_coupling.py, whose docstring says where
each parameter comes from. The open details O1 to O3 are run under every reading:
- O1 (a) all high-quality units of a selected session, (b) only those above 0.5 Hz;
- O2 (a) rate over the time each unit was observed, (b) rate within the analysis windows;
- O3 (a) only the four trial types CL, CR, IL, IR, (b) all trials with sample and GO times.
Each combination is written as three letters, aaa to bbb. A fourth detail, which the claims
file does not name, is how to treat units stored twice in a file (see the data check): counted once
(baa) or every stored row kept (baa-r). All sixteen combinations are run through every claim.
The paper's code at commit 688e662 is read for its printed outputs (FigureS4.ipynb: the neurons per session and the pair counts per bin), which are compared with each reading; it is an input of the attempt, fetched from GitHub at the pinned commit.
import re
import resource
import time
from collections import Counter
import warnings
import zlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import requests
import alm_coupling as ac
pd.set_option("display.width", 220)
pd.set_option("display.max_columns", 40)
pd.set_option("display.max_rows", 200)
warnings.filterwarnings("ignore", category=RuntimeWarning)
PAPER = "gable-2026"
started = time.time()
assets = ac.ecephys_assets()
sessions = ac.load_all(assets)
url_of = dict(assets)
print(f"loaded {len(sessions)} ecephys files of dandiset {ac.DANDISET_ID} version {ac.DANDISET_VERSION} "
f"in {time.time() - started:.0f} s")
loaded 99 ecephys files of dandiset 000010 version 0.220126.1905 in 123 s
Data check¶
Each check of the metadata against the values is stated under its output.
api = "https://api.dandiarchive.org/api/dandisets/000010/versions/{}/assets/?page_size=500"
listing = {v: {(a["path"], a["asset_id"], a["size"]) for a in requests.get(api.format(v)).json()["results"]}
for v in [ac.DANDISET_VERSION, "draft"]}
print("assets, published:", len(listing[ac.DANDISET_VERSION]), " draft:", len(listing["draft"]),
" differing (path, asset id, size):", len(listing[ac.DANDISET_VERSION] ^ listing["draft"]))
info = pd.DataFrame([{
"subject": s["subject"], "session": s["session"], "genotype": s["genotype"], "strains": s["strains"],
"group": ac.strain_group(s["strains"]), "sex": s["sex"],
"trials": len(s["trials"]), "task": "/".join(sorted(s["trials"].task.unique())),
"units": len(s["units"]), "unique_units": len(ac.unique_units(s)),
"quality": "/".join(sorted(s["units"].quality.unique())),
"photostim_events": int(s["trials"].photostim_start_time.notna().sum()),
"events_nan_time": int(sum(s["nan_events"].values())),
"events_outside_trials": int(sum(s["unmatched_events"].values()) - sum(s["nan_events"].values())),
} for s in sessions])
print("\nFiles:", len(info), " subjects:", info.subject.nunique())
print("\nMice and sessions per genotype (subject description):")
print(info.groupby(["group", "genotype", "strains"], dropna=False).agg(
mice=("subject", "nunique"), sessions=("subject", "size"), units=("units", "sum")).to_string())
print("\nQuality labels over all units:", info.quality.unique().tolist())
print("Task label of the trials:", info.task.unique().tolist())
print("Cell types:", pd.Series(np.concatenate([s["units"].cell_type for s in sessions])).value_counts().to_dict())
print("Units per file: min", info.units.min(), "median", info.units.median(), "max", info.units.max())
print("\n", info.drop(columns=["strains"]).to_string(index=False))
assets, published: 158 draft: 158 differing (path, asset id, size): 0
Files: 99 subjects: 19
Mice and sessions per genotype (subject description):
mice sessions units
group genotype strains
Sim1 chr2-eyfp x sim1-cre source: GENSAT; strains: ai32,kj18 1 3 57
sim1-cre source: GENSAT; strains: kj18 9 48 750
Tlx chr2-eyfp x tlx-cre source: GENSAT; strains: ai32,pl56 2 11 172
tlx-cre source: GENSAT; strains: pl56 4 25 341
NaN rbp4-cre source: GENSAT; strains: kl100 3 12 121
Quality labels over all units: ['good']
Task label of the trials: ['audio delay']
Cell types: {'Pyr': 1245, 'FS': 124, 'PT': 45, 'IT': 27}
Units per file: min 3 median 14.0 max 34
subject session genotype group sex trials task units unique_units quality photostim_events events_nan_time events_outside_trials
sub-210861 20130701 sim1-cre Sim1 M 423 audio delay 27 27 good 0 0 0
sub-210861 20130702 sim1-cre Sim1 M 384 audio delay 15 15 good 0 0 0
sub-210861 20130703 sim1-cre Sim1 M 483 audio delay 12 12 good 0 0 0
sub-210862 20130626 sim1-cre Sim1 M 292 audio delay 25 25 good 0 0 0
sub-210862 20130627 sim1-cre Sim1 M 299 audio delay 21 21 good 0 0 0
sub-210862 20130628 sim1-cre Sim1 M 380 audio delay 7 7 good 0 0 0
sub-210863 20130626 sim1-cre Sim1 M 350 audio delay 27 27 good 0 0 0
sub-210863 20130627 sim1-cre Sim1 M 319 audio delay 26 26 good 0 0 0
sub-210863 20130628 sim1-cre Sim1 M 362 audio delay 34 34 good 0 0 0
sub-214427 20130805 rbp4-cre NaN M 320 audio delay 12 12 good 71 6 0
sub-214427 20130806 rbp4-cre NaN M 243 audio delay 5 3 good 55 6 0
sub-214427 20130807 rbp4-cre NaN M 550 audio delay 5 5 good 119 0 0
sub-214427 20130808 rbp4-cre NaN M 372 audio delay 8 6 good 73 0 0
sub-214429 20130805 rbp4-cre NaN M 467 audio delay 9 9 good 102 6 0
sub-214429 20130806 rbp4-cre NaN M 575 audio delay 11 9 good 94 1 319
sub-214429 20130807 rbp4-cre NaN M 524 audio delay 15 14 good 115 6 0
sub-214429 20130808 rbp4-cre NaN M 485 audio delay 16 15 good 149 0 0
sub-214430 20130820 rbp4-cre NaN F 333 audio delay 10 10 good 120 0 0
sub-214430 20130821 rbp4-cre NaN F 375 audio delay 17 17 good 165 6 0
sub-214430 20130822 rbp4-cre NaN F 343 audio delay 6 6 good 171 0 0
sub-214430 20130823 rbp4-cre NaN F 194 audio delay 7 7 good 79 6 0
sub-218453 20131014 chr2-eyfp x tlx-cre Tlx M 327 audio delay 18 16 good 0 0 0
sub-218453 20131015 chr2-eyfp x tlx-cre Tlx M 306 audio delay 11 10 good 0 0 0
sub-218453 20131016 chr2-eyfp x tlx-cre Tlx M 307 audio delay 12 12 good 0 0 0
sub-218453 20131017 chr2-eyfp x tlx-cre Tlx M 289 audio delay 9 8 good 0 0 0
sub-218453 20131018 chr2-eyfp x tlx-cre Tlx M 337 audio delay 8 7 good 0 0 0
sub-218457 20131003 chr2-eyfp x tlx-cre Tlx M 300 audio delay 19 19 good 0 0 0
sub-218457 20131004 chr2-eyfp x tlx-cre Tlx M 289 audio delay 21 21 good 0 0 0
sub-218457 20131005 chr2-eyfp x tlx-cre Tlx M 344 audio delay 15 15 good 0 0 0
sub-218457 20131006 chr2-eyfp x tlx-cre Tlx M 403 audio delay 17 15 good 0 0 0
sub-218457 20131007 chr2-eyfp x tlx-cre Tlx M 297 audio delay 24 23 good 0 0 0
sub-218457 20131008 chr2-eyfp x tlx-cre Tlx M 273 audio delay 18 18 good 0 0 0
sub-218693 20131203 chr2-eyfp x sim1-cre Sim1 M 366 audio delay 13 13 good 0 0 0
sub-218693 20131204 chr2-eyfp x sim1-cre Sim1 M 325 audio delay 20 20 good 0 0 0
sub-218693 20131205 chr2-eyfp x sim1-cre Sim1 M 331 audio delay 24 24 good 0 0 0
sub-219030 20130829 sim1-cre Sim1 M 308 audio delay 20 19 good 100 0 0
sub-219030 20130830 sim1-cre Sim1 M 344 audio delay 6 6 good 118 0 0
sub-219030 20130831 sim1-cre Sim1 M 391 audio delay 10 9 good 131 2 0
sub-219030 20130901 sim1-cre Sim1 M 270 audio delay 13 13 good 97 0 0
sub-219030 20130903 sim1-cre Sim1 M 363 audio delay 11 9 good 141 0 0
sub-219031 20131021 sim1-cre Sim1 M 396 audio delay 22 22 good 129 0 0
sub-219031 20131022 sim1-cre Sim1 M 316 audio delay 22 21 good 91 0 0
sub-219031 20131023 sim1-cre Sim1 M 318 audio delay 14 14 good 92 0 0
sub-219031 20131024 sim1-cre Sim1 M 145 audio delay 11 11 good 33 10 99
sub-219031 20131025 sim1-cre Sim1 M 312 audio delay 24 24 good 85 0 0
sub-219033 20131116 sim1-cre Sim1 M 216 audio delay 17 17 good 64 7 0
sub-219033 20131117 sim1-cre Sim1 M 214 audio delay 6 6 good 53 2 0
sub-219033 20131118 sim1-cre Sim1 M 309 audio delay 10 10 good 68 0 0
sub-219033 20131119 sim1-cre Sim1 M 360 audio delay 7 6 good 92 0 0
sub-219033 20131120 sim1-cre Sim1 M 314 audio delay 3 2 good 84 0 0
sub-219033 20131121 sim1-cre Sim1 M 403 audio delay 4 3 good 96 0 0
sub-219033 20131122 sim1-cre Sim1 M 253 audio delay 10 10 good 64 1 0
sub-219036 20131116 sim1-cre Sim1 F 275 audio delay 19 16 good 79 0 0
sub-219036 20131117 sim1-cre Sim1 F 303 audio delay 19 18 good 84 0 0
sub-219036 20131118 sim1-cre Sim1 F 208 audio delay 11 10 good 64 0 0
sub-219036 20131119 sim1-cre Sim1 F 233 audio delay 14 13 good 73 2 0
sub-219036 20131120 sim1-cre Sim1 F 217 audio delay 23 23 good 56 1 0
sub-219036 20131121 sim1-cre Sim1 F 319 audio delay 13 12 good 83 0 0
sub-219036 20131122 sim1-cre Sim1 F 285 audio delay 6 5 good 86 1 0
sub-219037 20131116 sim1-cre Sim1 F 292 audio delay 12 11 good 84 0 0
sub-219037 20131117 sim1-cre Sim1 F 357 audio delay 19 17 good 92 1 0
sub-219037 20131118 sim1-cre Sim1 F 315 audio delay 22 20 good 80 1 0
sub-219037 20131119 sim1-cre Sim1 F 363 audio delay 18 17 good 97 0 0
sub-219037 20131120 sim1-cre Sim1 F 319 audio delay 12 11 good 83 0 0
sub-219037 20131121 sim1-cre Sim1 F 312 audio delay 12 11 good 74 0 0
sub-219037 20131122 sim1-cre Sim1 F 251 audio delay 16 12 good 84 6 0
sub-219038 20131021 sim1-cre Sim1 F 328 audio delay 27 25 good 82 0 0
sub-219038 20131022 sim1-cre Sim1 F 318 audio delay 23 22 good 93 0 0
sub-219038 20131023 sim1-cre Sim1 F 313 audio delay 24 22 good 81 0 0
sub-219038 20131024 sim1-cre Sim1 F 321 audio delay 9 8 good 95 0 0
sub-219038 20131025 sim1-cre Sim1 F 246 audio delay 13 11 good 85 0 0
sub-219038 20131026 sim1-cre Sim1 F 275 audio delay 12 11 good 67 12 0
sub-219038 20131027 sim1-cre Sim1 F 294 audio delay 10 9 good 78 6 0
sub-219038 20131028 sim1-cre Sim1 F 325 audio delay 12 10 good 85 0 0
sub-219247 20130919 tlx-cre Tlx M 343 audio delay 18 17 good 115 0 0
sub-219247 20130920 tlx-cre Tlx M 311 audio delay 14 12 good 109 0 0
sub-219247 20130921 tlx-cre Tlx M 366 audio delay 14 13 good 113 0 0
sub-219247 20130922 tlx-cre Tlx M 376 audio delay 14 13 good 115 0 0
sub-219247 20130923 tlx-cre Tlx M 294 audio delay 5 5 good 113 0 0
sub-219248 20130919 tlx-cre Tlx M 414 audio delay 25 25 good 122 0 0
sub-219248 20130920 tlx-cre Tlx M 406 audio delay 27 27 good 114 0 0
sub-219248 20130921 tlx-cre Tlx M 365 audio delay 24 22 good 107 0 0
sub-219248 20130922 tlx-cre Tlx M 395 audio delay 20 20 good 108 0 0
sub-219248 20130923 tlx-cre Tlx M 398 audio delay 31 28 good 109 0 0
sub-219248 20130924 tlx-cre Tlx M 350 audio delay 15 13 good 104 0 0
sub-219248 20130925 tlx-cre Tlx M 412 audio delay 7 7 good 114 0 0
sub-219253 20140117 tlx-cre Tlx F 337 audio delay 11 10 good 104 0 0
sub-219253 20140118 tlx-cre Tlx F 149 audio delay 16 16 good 50 6 0
sub-219253 20140118 tlx-cre Tlx F 150 audio delay 10 9 good 60 6 0
sub-219253 20140119 tlx-cre Tlx F 153 audio delay 4 4 good 57 7 0
sub-219253 20140119 tlx-cre Tlx F 144 audio delay 4 4 good 50 6 0
sub-219253 20140120 tlx-cre Tlx F 191 audio delay 12 12 good 57 6 0
sub-219253 20140120 tlx-cre Tlx F 128 audio delay 9 9 good 41 6 0
sub-219253 20140121 tlx-cre Tlx F 149 audio delay 6 6 good 0 0 0
sub-219253 20140121 tlx-cre Tlx F 115 audio delay 4 4 good 46 6 0
sub-219253 20140122 tlx-cre Tlx F 295 audio delay 16 15 good 89 6 0
sub-221977 20140115 tlx-cre Tlx M 337 audio delay 7 7 good 103 0 0
sub-221977 20140116 tlx-cre Tlx M 415 audio delay 14 13 good 105 0 0
sub-221977 20140118 tlx-cre Tlx M 178 audio delay 14 14 good 48 2 0
The subject records give five genotypes. KJ18 is the Sim1-Cre line and PL56 the Tlx3-Cre line
named by the paper; ten mice carry KJ18 (one of them crossed with Ai32) and six PL56 (two crossed
with Ai32); three Rbp4-Cre (KL100) mice are not among the paper's genotypes and are left out. Every
unit is labelled "good", so the paper's "high-quality units, as labeled in the original dataset"
keeps every unit. Every trial is labelled audio delay, while the dataset's experiment description
("object location discrimination task") and the paper (tactile sample cue) describe a tactile
task: the task label disagrees with the description.
dup_rows, dup_identical, files_with_dups = 0, 0, 0
for s in sessions:
ids = s["units"].id.to_numpy()
vals, counts = np.unique(ids, return_counts=True)
if (counts > 1).any():
files_with_dups += 1
for v in vals[counts > 1]:
w = np.where(ids == v)[0]
dup_rows += len(w) - 1
dup_identical += all(np.array_equal(s["spikes"][w[0]], s["spikes"][j]) for j in w[1:])
print(f"files with a repeated unit id: {files_with_dups} of {len(sessions)}; extra rows: {dup_rows}; "
f"repeated ids whose rows hold identical spike trains: {dup_identical}")
print("units in all files:", int(info.units.sum()), " counted once:", int(info.unique_units.sum()))
example = info[info.units > info.unique_units].iloc[0]
s = next(x for x in sessions if x["subject"] == example.subject and x["session"] == example.session)
print("example", s["path"], "unit ids:", s["units"].id.tolist())
# identical spike trains across files (a recording deposited twice)
keys = {}
for s in sessions:
for j in ac.unique_units(s):
keys.setdefault((len(s["spikes"][j]), s["spikes"][j][:20].tobytes()), set()).add(s["path"])
print("spike trains found in more than one file:", sum(len(v) > 1 for v in keys.values()))
starts = {}
for s in sessions:
starts.setdefault(np.round(s["trials"].start.to_numpy(), 3).tobytes(), []).append(s["path"])
print("files sharing an identical list of trial start times:", [v for v in starts.values() if len(v) > 1])
# spike times against the observation intervals
rows = []
for s in sessions:
ob0 = s["obs"][0]
tr = s["trials"]
has = tr["sample"].notna().to_numpy()
out = 0
for sp, ob in zip(s["spikes"], s["obs"]):
i = np.searchsorted(ob[:, 0], sp, side="right") - 1
out += int(np.sum(~((i >= 0) & (sp <= ob[np.clip(i, 0, None), 1]))))
rows.append({"path": s["path"], "units_share_intervals": all(np.array_equal(o, ob0) for o in s["obs"]),
"intervals": len(ob0), "trials_with_sample": int(has.sum()),
"trials_with_interval": int(np.isfinite(ac.observed_until(s)).sum()),
"sample_but_no_interval": int((has & ~np.isfinite(ac.observed_until(s))).sum()),
"interval_lengths": "/".join(map(str, np.unique(np.round(ob0[:, 1] - ob0[:, 0], 3)))),
"stop_minus_interval_end_max": float(np.nanmax(np.abs(tr.stop.to_numpy() - ac.observed_until(s)))),
"spikes_outside": out, "unsorted_units": s["unsorted_units"]})
obs_check = pd.DataFrame(rows)
print("files whose units share one set of observation intervals:", int(obs_check.units_share_intervals.sum()), "of", len(obs_check))
print("intervals:", int(obs_check.intervals.sum()), " intervals starting at a trial start:", int(obs_check.trials_with_interval.sum()),
" trials with a sample time:", int(obs_check.trials_with_sample.sum()),
" of these without an interval:", int(obs_check.sample_but_no_interval.sum()),
"in", int((obs_check.sample_but_no_interval > 0).sum()), "files")
print("interval lengths (s):", obs_check.interval_lengths.unique().tolist())
print("largest difference between a trial's stop time and its interval's end (s):",
round(obs_check.stop_minus_interval_end_max.max(), 3))
print("spikes outside their unit's observation intervals, by file:")
print(obs_check[obs_check.spikes_outside > 0][["path", "spikes_outside"]].to_string(index=False))
print("units whose spike times are stored out of order (sorted on loading), by file:")
print(obs_check[obs_check.unsorted_units > 0][["path", "unsorted_units"]].to_string(index=False))
files with a repeated unit id: 50 of 99; extra rows: 72; repeated ids whose rows hold identical spike trains: 72 units in all files: 1441 counted once: 1369 example sub-214427/sub-214427_ses-20130806_behavior+ecephys+ogen.nwb unit ids: [3, 4, 4, 5, 5] spike trains found in more than one file: 0 files sharing an identical list of trial start times: []
files whose units share one set of observation intervals: 99 of 99
intervals: 28140 intervals starting at a trial start: 27891 trials with a sample time: 28235 of these without an interval: 574 in 65 files
interval lengths (s): ['5.5']
largest difference between a trial's stop time and its interval's end (s): 13.066
spikes outside their unit's observation intervals, by file:
path spikes_outside
sub-214429/sub-214429_ses-20130806_behavior+ecephys+ogen.nwb 10895
sub-219031/sub-219031_ses-20131024_behavior+ecephys+ogen.nwb 4665
units whose spike times are stored out of order (sorted on loading), by file:
path unsorted_units
sub-214429/sub-214429_ses-20130806_behavior+ecephys+ogen.nwb 7
sub-219030/sub-219030_ses-20130829_behavior+ecephys+ogen.nwb 1
sub-219030/sub-219030_ses-20130831_behavior+ecephys+ogen.nwb 1
sub-219247/sub-219247_ses-20130920_behavior+ecephys+ogen.nwb 1
In 50 of the 99 files some unit ids appear twice; in every case the two rows hold the same spike train (for example ids 3, 4, 4, 5, 5), so the file stores one unit twice. Whether another unit was lost in its place cannot be told from the files. The two rows are one recorded unit, so the adopted reading counts each such unit once; every reading is also run with every stored row kept. No spike train or list of trial starts is repeated across files. Every unit of a file shares one set of observation intervals, one per trial with a sample time, starting at the trial start and lasting 5.5 s; the trials' stop times differ from the interval ends. Spikes are stored only within these intervals (apart from the files listed), so a unit's "session-wide" rate is its rate over those intervals. A few units store spike times out of order; they are sorted on loading.
allt = pd.concat([s["trials"].assign(path=s["path"]) for s in sessions], ignore_index=True)
print("trials:", len(allt))
print("\noutcome by early lick:")
print(pd.crosstab(allt.early_lick, allt.outcome).to_string())
print("\ntrials without a sample time, by outcome:")
print(allt[allt["sample"].isna()].outcome.value_counts().to_string())
d_sd = (allt.delay - allt["sample"]).dropna()
d_dg = (allt.go - allt.delay).dropna()
print(f"\nsample to delay onset (s): median {d_sd.median():.4f}, within 10 ms of 1.3 s: {np.mean(abs(d_sd - 1.3) < 0.01):.3f}")
print(f"delay to GO (s): median {d_dg.median():.4f}, within 10 ms of 1.3 s: {np.mean(abs(d_dg - 1.3) < 0.01):.3f}")
print(f"trial length (stop - start, s): median {(allt.stop - allt.start).median():.2f}, "
f"range {(allt.stop - allt.start).min():.2f} to {(allt.stop - allt.start).max():.2f}")
print(f"sample onset after trial start (s): median {(allt['sample'] - allt.start).median():.3f}")
ph = allt.dropna(subset=["photostim_start_time"])
print(f"\nphotostimulation onset relative to sample onset (s): median {(ph.photostim_start_time - ph['sample']).median():.3f}, "
f"range {(ph.photostim_start_time - ph['sample']).min():.3f} to {(ph.photostim_start_time - ph['sample']).max():.3f}")
print("events with a NaN timestamp, by event:",
pd.DataFrame([s["nan_events"] for s in sessions]).sum().astype(int).to_dict())
print("events with a timestamp outside every trial, by event:",
(pd.DataFrame([s["unmatched_events"] for s in sessions]) - pd.DataFrame([s["nan_events"] for s in sessions])).sum().astype(int).to_dict())
trials: 31439
outcome by early lick:
outcome hit ignore miss non-performing
early_lick
early 2880 21 775 0
no early 19986 436 5687 1654
trials without a sample time, by outcome:
outcome
non-performing 1581
hit 1559
miss 64
sample to delay onset (s): median 1.3003, within 10 ms of 1.3 s: 0.913
delay to GO (s): median 1.3005, within 10 ms of 1.3 s: 0.939
trial length (stop - start, s): median 5.50, range 4.67 to 19.91
sample onset after trial start (s): median 0.572
photostimulation onset relative to sample onset (s): median 1.300, range -0.533 to 12.144
events with a NaN timestamp, by event: {'sample': 0, 'delay': 0, 'go': 0, 'photostim_start_time': 140}
events with a timestamp outside every trial, by event: {'sample': 126, 'delay': 121, 'go': 130, 'photostim_start_time': 41}
The sample and delay epochs are each 1.3 s in most trials (Li et al. 2015), so the window from sample onset to 2 s after GO is 4.6 s; an early lick restarts the epoch and lengthens the window. In the BehavioralEvents series, 140 photostimulation onsets have a NaN timestamp, and 126 sample, 121 delay, 130 GO and 41 photostimulation events have a timestamp outside every trial; neither can be placed in a trial. Whether a trial was photostimulated is read from the photostimulation onsets; it is checked below against the stored laser trace for the selected sessions.
Clock check¶
The spikes and the trial events must share a clock. ALM activity predicts the instructed lick
direction after the sample cue and most strongly after GO (Li et al. 2015), and should not predict
it before the sample cue. The instructed side of correct trials is decoded (nearest class mean,
five interleaved folds, balanced accuracy) from each unit's spike count in windows relative to
sample onset, in every selected session of reading baa (adopted below); as a control each trial
takes the next trial's label.
main = ("b", "a", "a") # O1 to O3 of the reading adopted below, under "Population coupling"
MAIN = "baa" # units stored twice counted once
W = [(-0.5, 0.0), (0.0, 0.5), (0.8, 1.3), (1.8, 2.6), (2.6, 3.1), (3.1, 3.6), (3.6, 4.6)]
wnames = ["-0.5-0 (pre-sample)", "0-0.5 (sample)", "0.8-1.3", "1.8-2.6 (delay)", "2.6-3.1 (after GO)", "3.1-3.6", "3.6-4.6"]
rows, rows_shift = [], []
for s in sessions:
if ac.strain_group(s["strains"]) is None:
continue
sel = ac.select_session(s, *main, dedupe=True)
if not sel["passes"]:
continue
rows.append(ac.decode_side(s, sel["units"], sel["trial_mask"], "sample", W))
rows_shift.append(ac.decode_side(s, sel["units"], sel["trial_mask"], "sample", W, shift_labels=True))
clock = pd.DataFrame({"window from sample onset (s)": wnames,
"median accuracy": np.median(rows, 0), "min": np.min(rows, 0), "max": np.max(rows, 0),
"median, labels shifted one trial": np.median(rows_shift, 0)})
print(f"sessions: {len(rows)}")
print(clock.round(3).to_string(index=False))
sessions: 16
window from sample onset (s) median accuracy min max median, labels shifted one trial
-0.5-0 (pre-sample) 0.517 0.440 0.600 0.502
0-0.5 (sample) 0.615 0.537 0.758 0.505
0.8-1.3 0.665 0.527 0.939 0.487
1.8-2.6 (delay) 0.797 0.616 0.970 0.500
2.6-3.1 (after GO) 0.882 0.679 0.991 0.518
3.1-3.6 0.866 0.709 0.989 0.526
3.6-4.6 0.888 0.644 1.000 0.537
The accuracy printed before sample onset and with shifted labels is the chance reference; the accuracies after sample onset and after GO are compared with it in the cell's output. A rise only after the cue, and the loss of that rise with shifted labels, is consistent with spikes and trial events on one clock.
# photostimulated trials: onsets in BehavioralEvents against the stored laser power trace, in every
# session selected under reading baa (units counted once) or baa-r (every stored row)
rows = []
for s in sessions:
if ac.strain_group(s["strains"]) is None:
continue
sel = ac.select_session(s, *main, dedupe=True)
sel_r = ac.select_session(s, *main, dedupe=False)
if not (sel["passes"] or sel_r["passes"]):
continue
mx, names, ogen_meta = ac.laser_max_per_trial(url_of[s["path"]], s["trials"])
ph = s["trials"].photostim_start_time.notna().to_numpy()
rows.append({"session": s["path"].split("/")[1][:23], "ai32": "ai32" in s["strains"],
"ogen_in_name": "ogen" in s["path"], "optogenetics_metadata": ogen_meta,
"laser": "/".join(names) or "none",
"onset_trials": int(ph.sum()), "onset_trials_with_power>1": int((mx[ph] > 1).sum()),
"other_trials_with_power>1": int((mx[~ph] > 1).sum()),
"included_trials_with_power>1": int((mx[(sel if sel["passes"] else sel_r)["trial_mask"]] > 1).sum()),
"selected": "baa and baa-r" if sel["passes"] else "baa-r only",
"nan_sample/delay/go/photostim": "/".join(str(s["nan_events"].get(k, 0)) for k in ["sample", "delay", "go", "photostim_start_time"]),
"max_power": float(mx.max())})
laser = pd.DataFrame(rows)
print(laser.to_string(index=False))
with_trace = laser[laser.laser != "none"]
print(f"\nsessions listed: {len(laser)}; with a laser trace: {len(with_trace)}; of these where every onset trial has "
f"power and no other trial has: {int(((with_trace.onset_trials == with_trace['onset_trials_with_power>1']) & (with_trace['other_trials_with_power>1'] == 0)).sum())}")
print("sessions with a trace where onsets and power disagree:")
print(with_trace[(with_trace.onset_trials != with_trace["onset_trials_with_power>1"]) | (with_trace["other_trials_with_power>1"] > 0)][
["session", "onset_trials", "onset_trials_with_power>1", "other_trials_with_power>1", "included_trials_with_power>1"]].to_string(index=False))
print("sessions without Ai32 that have optogenetics metadata but no laser trace and no onsets:",
laser[~laser.ai32 & laser.optogenetics_metadata & (laser.laser == "none") & (laser.onset_trials == 0)].session.tolist())
print("\nselected sessions of Ai32 mice:", int(laser.ai32.sum()), "; of these with a laser trace or photostimulation onsets:",
int((laser.ai32 & ((laser.laser != "none") | (laser.onset_trials > 0))).sum()))
session ai32 ogen_in_name optogenetics_metadata laser onset_trials onset_trials_with_power>1 other_trials_with_power>1 included_trials_with_power>1 selected nan_sample/delay/go/photostim max_power
sub-210862_ses-20130626 False True True none 0 0 0 0 baa and baa-r 0/0/0/0 0.0
sub-210863_ses-20130626 False True True none 0 0 0 0 baa and baa-r 0/0/0/0 0.0
sub-210863_ses-20130628 False True True none 0 0 0 0 baa and baa-r 0/0/0/0 0.0
sub-218453_ses-20131014 True False False none 0 0 0 0 baa-r only 0/0/0/0 0.0
sub-218457_ses-20131004 True False False none 0 0 0 0 baa and baa-r 0/0/0/0 0.0
sub-218457_ses-20131007 True False False none 0 0 0 0 baa and baa-r 0/0/0/0 0.0
sub-218693_ses-20131205 True False False none 0 0 0 0 baa and baa-r 0/0/0/0 0.0
sub-219030_ses-20130829 False True True left PONS_laser_power 100 100 0 0 baa and baa-r 0/0/0/0 82.0
sub-219031_ses-20131022 False True True left PONS_laser_power 91 91 0 0 baa and baa-r 0/0/0/0 82.0
sub-219031_ses-20131025 False True True left PONS_laser_power 85 85 0 0 baa and baa-r 0/0/0/0 82.0
sub-219036_ses-20131120 False True True left PONS_laser_power 56 56 1 0 baa and baa-r 0/0/0/1 82.0
sub-219038_ses-20131021 False True True left PONS_laser_power 82 82 0 0 baa and baa-r 0/0/0/0 82.0
sub-219038_ses-20131022 False True True left PONS_laser_power 93 93 0 0 baa and baa-r 0/0/0/0 82.0
sub-219038_ses-20131023 False True True left PONS_laser_power 81 81 0 0 baa and baa-r 0/0/0/0 82.0
sub-219248_ses-20130919 False True True bilateral ALM_laser_power 122 121 0 0 baa and baa-r 0/0/0/0 47.1
sub-219248_ses-20130921 False True True bilateral ALM_laser_power 107 107 0 0 baa and baa-r 0/0/0/0 47.1
sub-219248_ses-20130923 False True True bilateral ALM_laser_power 109 109 0 0 baa and baa-r 0/0/0/0 47.1
sessions listed: 17; with a laser trace: 10; of these where every onset trial has power and no other trial has: 8
sessions with a trace where onsets and power disagree:
session onset_trials onset_trials_with_power>1 other_trials_with_power>1 included_trials_with_power>1
sub-219036_ses-20131120 56 56 1 0
sub-219248_ses-20130919 122 121 0 0
sessions without Ai32 that have optogenetics metadata but no laser trace and no onsets: ['sub-210862_ses-20130626', 'sub-210863_ses-20130626', 'sub-210863_ses-20130628']
selected sessions of Ai32 mice: 4 ; of these with a laser trace or photostimulation onsets: 0
In 8 of the 10 sessions with a laser trace, the trials with a photostimulation onset are exactly the trials with laser power. The two exceptions: in sub-219248 ses-20130919, 121 of 122 onset trials have power; in sub-219036 ses-20131120, one trial has power and no onset, and that file holds one photostimulation onset with a NaN timestamp (whether it belongs to that trial cannot be told from the files). No included trial has laser power in any session with a trace. Three sessions of KJ18 mice without Ai32 (sub-210862 ses-20130626, sub-210863 ses-20130626 and ses-20130628) have optogenetics metadata but no laser trace and no onsets. The selected sessions of the Ai32 mice (KJ18 or PL56 crossed with ChR2) hold no laser trace, no photostimulation onsets and no optogenetics metadata. In these seven sessions whether trials had light cannot be checked from the files; they are kept, as nothing in them marks a trial as photostimulated, and the selection is also shown without the Ai32 mice.
figs4-session-selection¶
The reanalysis of the Li et al. (2015) ALM silicon-probe recordings includes eight Sim1_KJ18-Cre and three Tlx_PL56-Cre mice, 20 sessions, and yields 753 same-coupling-range and 6,586 different-coupling-range neuron pairs.
Criterion: under one reading of O1 to O3, mice exactly 11 (8 Sim1, 3 Tlx), sessions 20 ± 2, same 753 ± 75, different 6,586 ± 659 (summed over the 7 bins). Mice are counted by the strain of the subject record; the KJ18 and PL56 mice crossed with Ai32 are counted with their Cre line, and the count without them is shown too. Each reading is run with units stored twice counted once and with every stored row. Beside the result are the counts printed by the paper's FigureS4.ipynb, read from the notebook at commit 688e662.
READINGS = [(a, b, c, d) for d in (True, False) for a in "ab" for b in "ab" for c in "ab"]
results = {"".join(r[:3]) + ("" if r[3] else "-r"): ac.analyse(sessions, *r[:3], dedupe=r[3]) for r in READINGS}
NAMES = list(results)
code_nb = requests.get("https://raw.githubusercontent.com/kerlin-lab/Gable_2026/"
"688e662767ed32b6ea60a2827c3483408edf6deb/Figures/FigureS4.ipynb").json()
code_text = "\n".join("".join(o.get("text", "")) + "".join(o.get("data", {}).get("text/plain", ""))
for c in code_nb["cells"] for o in c.get("outputs", []))
code_units = [int(x) for x in re.findall(r"Calculating sess \d+ population coupling:[^\n]*?\| 0/(\d+)", code_text)]
code_same = [int(x) for x in re.findall(r"n_same=(\d+)", code_text)]
code_diff = [int(x) for x in re.findall(r"n_diff=(\d+)", code_text)]
code_md = [float(x) for x in re.findall(r"mean diff = ([-+\d.e]+)", code_text)]
print(f"the code's printed output: {len(code_units)} sessions, {sum(code_units)} neurons, "
f"{min(code_units)} to {max(code_units)} per session; same-range pairs per bin {code_same} (sum {sum(code_same)}); "
f"different-range {code_diff} (sum {sum(code_diff)})")
print("the code's neurons per session, sorted:", sorted(code_units))
def counts(res):
ss = res["sessions"]
mice = ss.drop_duplicates("subject")
return {"mice": len(mice), "Sim1": int((mice.group == "Sim1").sum()), "Tlx": int((mice.group == "Tlx").sum()),
"mice_without_Ai32": int((~mice.ai32).sum()), "sessions": len(ss), "neurons": int(ss.n_units.sum()),
"units_min": int(ss.n_units.min()), "units_max": int(ss.n_units.max()),
"sessions_sharing_code_count": sum((Counter(ss.n_units) & Counter(code_units)).values()),
"same": int(sum(sum(len(v) for v in b) for b in res["same"])),
"different": int(sum(sum(len(v) for v in b) for b in res["diff"]))}
sel_table = pd.DataFrame([{"reading": n, "units": "counted once" if "-r" not in n else "every stored row",
**counts(results[n])} for n in NAMES])
sel_table["match"] = ((sel_table.mice == 11) & (sel_table.Sim1 == 8) & (sel_table.Tlx == 3)
& (abs(sel_table.sessions - 20) <= 2) & (abs(sel_table.same - 753) <= 75)
& (abs(sel_table.different - 6586) <= 659))
print("paper: 11 mice (8 Sim1, 3 Tlx), 20 sessions, 753 same and 6,586 different pairs")
print(sel_table.to_string(index=False))
print("\nreadings matching all four values:", sel_table[sel_table.match].reading.tolist())
for n in ["baa", "baa-r", "bba", "bba-r"]:
print(f"{n} neurons per session, sorted:", sorted(results[n]["sessions"].n_units))
the code's printed output: 20 sessions, 411 neurons, 18 to 25 per session; same-range pairs per bin [90, 112, 120, 83, 90, 114, 162] (sum 771); different-range [992, 964, 927, 987, 951, 929, 836] (sum 6586)
the code's neurons per session, sorted: [18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 22, 23, 24, 25, 25]
paper: 11 mice (8 Sim1, 3 Tlx), 20 sessions, 753 same and 6,586 different pairs
reading units mice Sim1 Tlx mice_without_Ai32 sessions neurons units_min units_max sessions_sharing_code_count same different match
aaa counted once 9 7 2 7 16 385 19 34 8 695 7674 False
aab counted once 9 7 2 7 16 385 19 34 8 733 7598 False
aba counted once 9 7 2 7 15 361 19 34 8 644 7208 False
abb counted once 9 7 2 7 15 361 19 34 8 668 7160 False
baa counted once 9 7 2 7 16 318 18 25 12 501 5060 False
bab counted once 9 7 2 7 16 318 18 25 12 515 5032 False
bba counted once 9 7 2 7 15 295 18 24 12 452 4650 False
bbb counted once 9 7 2 7 15 298 18 26 11 478 4736 False
aaa-r every stored row 10 7 3 7 17 416 18 34 8 803 8390 False
aab-r every stored row 10 7 3 7 17 416 18 34 8 826 8344 False
aba-r every stored row 10 7 3 7 17 419 18 34 8 843 8454 False
abb-r every stored row 10 7 3 7 18 442 18 34 8 893 8860 False
baa-r every stored row 10 7 3 7 17 348 18 25 14 575 5686 False
bab-r every stored row 10 7 3 7 17 348 18 25 14 592 5652 False
bba-r every stored row 10 7 3 7 17 340 18 24 15 549 5414 False
bbb-r every stored row 10 7 3 7 18 361 18 26 13 591 5776 False
readings matching all four values: []
baa neurons per session, sorted: [18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 21, 22, 22, 22, 25]
baa-r neurons per session, sorted: [18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 21, 22, 22, 22, 24, 25]
bba neurons per session, sorted: [18, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 21, 22, 22, 24]
bba-r neurons per session, sorted: [18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 21, 22, 22, 23, 24]
print(f"reading {MAIN}; sessions kept:")
print(results[MAIN]["sessions"][["subject", "session", "group", "ai32", "n_units", "n_trials"]].to_string(index=False))
per_mouse = pd.concat([results[n]["sessions"].assign(reading=n) for n in NAMES])
print("\nsessions per mouse under each reading:")
print(pd.crosstab(per_mouse.subject + " " + per_mouse.group, per_mouse.reading)[NAMES].to_string())
print("\nKJ18 and PL56 mice in the dataset with no selected session under any reading:",
sorted(set(info[info.group.notna()].subject) - set(per_mouse.subject)))
# candidate sessions per mouse: which filter removes a mouse
rows = []
for s in sessions:
g = ac.strain_group(s["strains"])
if g is None:
continue
row = {"subject": s["subject"], "group": g, "ai32": "ai32" in s["strains"],
">=18 stored rows": len(s["units"]) >= 18, ">=18 units once": len(ac.unique_units(s)) >= 18}
for d, dn in [(True, "once"), (False, "rows")]:
for o2 in "ab":
row[f">=18 above 0.5 Hz, O2 {o2}, {dn}"] = ac.select_session(s, "b", o2, "a", dedupe=d)["passes"]
rows.append(row)
cand = pd.DataFrame(rows).groupby(["subject", "group", "ai32"]).sum().reset_index()
print("\nsessions per KJ18 and PL56 mouse passing each filter (O3 a; O3 b gives the same sessions):")
print(cand.to_string(index=False))
print("mice with at least one session:", cand.drop(columns=["subject", "group", "ai32"]).gt(0).sum().to_dict())
print("by group:", {c: cand[cand[c] > 0].group.value_counts().to_dict() for c in cand.columns[3:]})
types = pd.DataFrame([{"session": f"{r.subject} {r.session}", **r.types} for r in results["bab-r"]["sessions"].itertuples()]).fillna(0)
print("\ntrials per type in each selected session, reading bab-r (under O3 a only CL, CR, IL, IR are kept):")
print(types.set_index("session").astype(int).to_string())
reading baa; sessions kept: subject session group ai32 n_units n_trials sub-210862 20130626 Sim1 False 20 146 sub-210863 20130626 Sim1 False 22 267 sub-210863 20130628 Sim1 False 25 231 sub-218457 20131004 Tlx True 19 246 sub-218457 20131007 Tlx True 19 259 sub-218693 20131205 Sim1 True 19 266 sub-219030 20130829 Sim1 False 18 163 sub-219031 20131022 Sim1 False 21 183 sub-219031 20131025 Sim1 False 19 187 sub-219036 20131120 Sim1 False 19 150 sub-219038 20131021 Sim1 False 22 196 sub-219038 20131022 Sim1 False 18 181 sub-219038 20131023 Sim1 False 18 192 sub-219248 20130919 Tlx False 22 238 sub-219248 20130921 Tlx False 19 215 sub-219248 20130923 Tlx False 18 245 sessions per mouse under each reading: reading aaa aab aba abb baa bab bba bbb aaa-r aab-r aba-r abb-r baa-r bab-r bba-r bbb-r row_0 sub-210862 Sim1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 sub-210863 Sim1 2 2 3 3 2 2 3 3 2 2 3 3 2 2 3 3 sub-218453 Tlx 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 sub-218457 Tlx 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 sub-218693 Sim1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 sub-219030 Sim1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 sub-219031 Sim1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 sub-219036 Sim1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 sub-219038 Sim1 3 3 2 2 3 3 2 2 3 3 2 3 3 3 2 3 sub-219248 Tlx 3 3 2 2 3 3 2 2 3 3 3 3 3 3 3 3 KJ18 and PL56 mice in the dataset with no selected session under any reading: ['sub-210861', 'sub-219033', 'sub-219037', 'sub-219247', 'sub-219253', 'sub-221977']
sessions per KJ18 and PL56 mouse passing each filter (O3 a; O3 b gives the same sessions):
subject group ai32 >=18 stored rows >=18 units once >=18 above 0.5 Hz, O2 a, once >=18 above 0.5 Hz, O2 b, once >=18 above 0.5 Hz, O2 a, rows >=18 above 0.5 Hz, O2 b, rows
sub-210861 Sim1 False 1 1 0 0 0 0
sub-210862 Sim1 False 2 2 1 1 1 1
sub-210863 Sim1 False 3 3 2 3 2 3
sub-218453 Tlx True 1 0 0 0 1 1
sub-218457 Tlx True 4 4 2 2 2 2
sub-218693 Sim1 True 2 2 1 1 1 1
sub-219030 Sim1 False 1 1 1 1 1 1
sub-219031 Sim1 False 3 3 2 2 2 2
sub-219033 Sim1 False 0 0 0 0 0 0
sub-219036 Sim1 False 3 2 1 1 1 1
sub-219037 Sim1 False 3 1 0 0 0 0
sub-219038 Sim1 False 3 3 3 2 3 2
sub-219247 Tlx False 1 0 0 0 0 0
sub-219248 Tlx False 5 5 3 2 3 3
sub-219253 Tlx False 0 0 0 0 0 0
sub-221977 Tlx False 0 0 0 0 0 0
mice with at least one session: {'>=18 stored rows': 13, '>=18 units once': 11, '>=18 above 0.5 Hz, O2 a, once': 9, '>=18 above 0.5 Hz, O2 b, once': 9, '>=18 above 0.5 Hz, O2 a, rows': 10, '>=18 above 0.5 Hz, O2 b, rows': 10}
by group: {'>=18 stored rows': {'Sim1': 9, 'Tlx': 4}, '>=18 units once': {'Sim1': 9, 'Tlx': 2}, '>=18 above 0.5 Hz, O2 a, once': {'Sim1': 7, 'Tlx': 2}, '>=18 above 0.5 Hz, O2 b, once': {'Sim1': 7, 'Tlx': 2}, '>=18 above 0.5 Hz, O2 a, rows': {'Sim1': 7, 'Tlx': 3}, '>=18 above 0.5 Hz, O2 b, rows': {'Sim1': 7, 'Tlx': 3}}
trials per type in each selected session, reading bab-r (under O3 a only CL, CR, IL, IR are kept):
CR CL hit-early-L hit-early-R miss-early-R IR miss-early-L IL ignore-no early-R ignore-no early-L ignore-early-L
session
sub-210862 20130626 54 52 34 32 29 22 20 18 0 0 0
sub-210863 20130626 105 101 11 18 4 28 6 33 0 0 0
sub-210863 20130628 95 80 60 47 8 29 4 27 0 0 0
sub-218453 20131014 67 49 42 27 22 40 3 7 3 2 0
sub-218457 20131004 106 99 7 5 2 12 3 29 1 8 1
sub-218457 20131007 103 105 6 9 3 35 3 16 4 0 1
sub-218693 20131205 115 106 1 7 2 31 2 14 11 7 0
sub-219030 20130829 47 56 1 3 1 22 4 38 0 0 0
sub-219031 20131022 68 79 0 2 0 11 3 25 0 0 0
sub-219031 20131025 72 91 4 4 0 5 0 19 0 0 0
sub-219036 20131120 52 62 2 1 0 28 1 8 0 0 0
sub-219038 20131021 69 51 6 3 0 16 3 60 0 0 0
sub-219038 20131022 61 55 1 3 0 19 2 46 0 0 0
sub-219038 20131023 65 64 1 1 1 19 0 44 0 0 0
sub-219248 20130919 117 102 9 7 1 9 0 10 0 0 1
sub-219248 20130921 103 79 0 1 1 31 0 2 1 1 0
sub-219248 20130923 109 106 4 0 0 7 0 23 0 0 0
Result: not reproduced. No reading selects the paper's 11 mice. With units counted once every
reading gives 9 mice (7 Sim1, 2 Tlx) and 15 or 16 sessions; with every stored row, 10 mice (7 Sim1,
3 Tlx) and 17 or 18 sessions, against 8 Sim1 and 3 Tlx mice and 20 sessions. The third Tlx mouse
(sub-218453) enters only with every stored row: its session of 18 stored rows holds 16 distinct
units. No reading reaches an eighth Sim1 mouse: nine of the ten KJ18 mice have a session of at least
18 stored units, but only seven have one with 18 units above 0.5 Hz under either rate. Under reading
baa, adopted below, there are 16 sessions of 18 to 25 neurons (318 neurons, against the code's
20 sessions and 411; 12 of the 16 sessions have a neuron count that appears in the code's list),
501 same-range and 5,060 different-range pairs (paper 753 and 6,586; the code printed 771 and
6,586). Over all sixteen readings the pair counts run from 452 to 893 and from 4,650 to 8,860.
Population coupling and same against different coupling range¶
The three remaining claims share one computation (E4 to E8) and differ in the bins they judge. No reading matched the selection claim, so, as the claims file directs, every reading is run and shown. A claim's outcome is the one all readings give. Where they differ, the outcome is taken under an assumed reading only for a detail with a basis in the paper, its code or the data:
- Units stored twice are counted once (
baa). The two rows of such a unit hold the same spike train under one id, so they are one recorded unit, and the protocol counts a recording deposited twice once. Every reading is also run with every stored row (-r), and how the duplicated rows enter the result is shown below. The paper's code does not show which the authors did. - O1 (b), only the units above 0.5 Hz: the code's printed output gives 18 to 25 neurons per session, which the O1 (b) readings give and the O1 (a) readings do not (up to 34).
- O2 and O3 have no such basis. "Session-wide firing rate" (Methods, Secondary analysis) can be the
rate over the recording, (a), but the same paragraph says the coupling was "estimated
session-wide from activity recorded between the tactile stimulus onset and 2 s after the GO
signal", which reads as (b). TSA is defined on CL, CR, IR and IL (Methods, Activity extraction),
which supports O3 (a), but the claims file allows (b), and the code's output cannot tell them
apart. Where an outcome depends on O2 or O3, the claim is blocked as
methods_underspecified.
An earlier version of this notebook adopted every stored row (baa-r); the verifier's second
round found that reading unreasonable, as the duplicated rows are not distinct neurons. With units
counted once, the lowest and high coupling claims turn on O2 and O3, and the verifier's third round
agreed that both are blocked.
Each claim takes its own bootstrap generator, seeded from the claim, and is repeated under the four further seeds (claim seed plus 1000 to 4000). The distribution of population coupling and the seven bin edges are printed first.
BIN_NAMES = ["0.00-14.29", "14.29-28.57", "28.57-42.86", "42.86-57.14", "57.14-71.43", "71.43-85.71", "85.71-100.00"]
PAPER_MD = [0.06, 0.004, 0.001, -0.002, 0.02, 0.06, 0.1]
PAPER_P = [7e-4, 0.12, 0.61, 0.76, 7e-4, 7e-4, 7e-4]
def run_claim(claim_id):
seed = zlib.crc32(f"{PAPER}/{claim_id}".encode())
out = {}
for n in NAMES:
for extra in [0, 1000, 2000, 3000, 4000]:
rng = np.random.default_rng(seed + extra)
out[(n, extra)] = ac.same_vs_diff_test(results[n]["same"], results[n]["diff"], rng)
return seed, out
def table(out, extra=0):
rows = []
for n in NAMES:
t = out[(n, extra)]
for k in range(7):
rows.append({"reading": n, "bin": BIN_NAMES[k], "n_same": t.n_same[k], "n_diff": t.n_diff[k],
"same": t.same_mean[k], "different": t.diff_mean[k],
"mean_difference": t.mean_difference[k], "p_holm": t.p_holm[k]})
return pd.DataFrame(rows)
def seed_range(out, bins):
rows = []
for n in NAMES:
for k in bins:
md_ = [out[(n, e)].mean_difference[k] for e in [0, 1000, 2000, 3000, 4000]]
p_ = [out[(n, e)].p_holm[k] for e in [0, 1000, 2000, 3000, 4000]]
rows.append({"reading": n, "bin": BIN_NAMES[k], "md_min": min(md_), "md_max": max(md_),
"p_holm_min": min(p_), "p_holm_max": max(p_)})
return pd.DataFrame(rows)
for n in NAMES:
c = np.concatenate(results[n]["coupling"])
print(f"{n:6s} neurons {len(c)}, coupling median {np.median(c):.3f}, range {c.min():.3f} to {c.max():.3f}, "
f"edges {np.round(results[n]['edges'], 3).tolist()}")
c = np.concatenate(results[MAIN]["coupling"])
fig, ax = plt.subplots(figsize=(5, 3))
ax.hist(c, bins=40, color="0.3")
for e in results[MAIN]["edges"]:
ax.axvline(e, color="C1", lw=0.8)
ax.set_xlabel(f"population coupling (r), reading {MAIN}")
ax.set_ylabel("neurons")
plt.tight_layout()
plt.show()
print("all values are inside the axes; range", round(c.min(), 3), "to", round(c.max(), 3))
aaa neurons 385, coupling median 0.014, range -0.262 to 0.257, edges [-0.017, -0.003, 0.009, 0.021, 0.037, 0.064] aab neurons 385, coupling median 0.014, range -0.260 to 0.257, edges [-0.017, -0.002, 0.009, 0.021, 0.037, 0.064] aba neurons 361, coupling median 0.012, range -0.174 to 0.165, edges [-0.016, -0.002, 0.008, 0.018, 0.034, 0.059] abb neurons 361, coupling median 0.012, range -0.179 to 0.166, edges [-0.016, -0.002, 0.008, 0.018, 0.034, 0.06] baa neurons 318, coupling median 0.019, range -0.262 to 0.263, edges [-0.016, -0.0, 0.013, 0.026, 0.044, 0.069] bab neurons 318, coupling median 0.018, range -0.260 to 0.263, edges [-0.017, -0.001, 0.013, 0.025, 0.044, 0.07] bba neurons 295, coupling median 0.016, range -0.174 to 0.163, edges [-0.016, -0.002, 0.01, 0.023, 0.04, 0.064] bbb neurons 298, coupling median 0.016, range -0.179 to 0.163, edges [-0.018, -0.002, 0.01, 0.022, 0.04, 0.064] aaa-r neurons 416, coupling median 0.020, range -0.262 to 0.299, edges [-0.015, 0.0, 0.012, 0.028, 0.046, 0.086] aab-r neurons 416, coupling median 0.019, range -0.260 to 0.299, edges [-0.014, 0.0, 0.012, 0.027, 0.048, 0.088] aba-r neurons 419, coupling median 0.017, range -0.262 to 0.299, edges [-0.015, 0.0, 0.012, 0.026, 0.046, 0.086] abb-r neurons 442, coupling median 0.017, range -0.260 to 0.299, edges [-0.015, 0.0, 0.011, 0.024, 0.045, 0.085] baa-r neurons 348, coupling median 0.025, range -0.262 to 0.300, edges [-0.015, 0.005, 0.017, 0.033, 0.055, 0.093] bab-r neurons 348, coupling median 0.024, range -0.260 to 0.300, edges [-0.014, 0.004, 0.016, 0.032, 0.056, 0.095] bba-r neurons 340, coupling median 0.023, range -0.262 to 0.300, edges [-0.015, 0.003, 0.016, 0.032, 0.052, 0.091] bbb-r neurons 361, coupling median 0.022, range -0.260 to 0.300, edges [-0.015, 0.001, 0.014, 0.03, 0.052, 0.09]
all values are inside the axes; range -0.262 to 0.263
Where the units stored twice fall¶
For each selected session of reading baa-r that holds a unit stored twice: the two rows' coupling
and bin, the correlation of their trial-specific activity, and the coupling and bin of the same unit
under baa (units counted once), where that session is selected too.
by_path = {s["path"]: s for s in sessions}
once = results["baa"]
once_pos = {p: i for i, p in enumerate(once["sessions"].path)}
rows = []
ROWS = "baa-r"
for i, ss in enumerate(results[ROWS]["sessions"].itertuples()):
ses = by_path[ss.path]
pairs = ac.duplicate_pairs(ses, ss.units)
if not pairs:
continue
x = ac.session_tsa(ses, ac.select_session(ses, *main, dedupe=False)).reshape(len(ss.units), -1)
lab, cpl = results[ROWS]["labels"][i], results[ROWS]["coupling"][i]
for a, b in pairs:
row = {"session": f"{ss.subject} {ss.session}", "unit_id": int(ses["units"].id[ss.units[a]]),
"coupling_rows": round(cpl[a], 3), "bin_rows": int(lab[a]) + 1, "twin_bin_rows": int(lab[b]) + 1,
"r_twins": round(float(np.corrcoef(x[a], x[b])[0, 1]), 6)}
if ss.path in once_pos:
j = once_pos[ss.path]
k = int(np.where(once["sessions"].units.iloc[j] == ss.units[a])[0][0])
row.update({"coupling_once": round(once["coupling"][j][k], 3), "bin_once": int(once["labels"][j][k]) + 1})
rows.append(row)
dups = pd.DataFrame(rows)
print(dups.to_string(index=False))
same_n = [sum(len(v) for v in results[ROWS]["same"][k]) for k in range(7)]
dup_bins = dups.bin_rows.value_counts().reindex(range(1, 8), fill_value=0)
print("\nduplicate pairs (r = 1) among the same-range pairs of each bin, reading", ROWS)
print(pd.DataFrame({"bin": BIN_NAMES, "duplicate_pairs": dup_bins.to_numpy(), "same_range_pairs": same_n}).to_string(index=False))
session unit_id coupling_rows bin_rows twin_bin_rows r_twins coupling_once bin_once
sub-218453 20131014 10 0.193 7 7 1.0 NaN NaN
sub-218453 20131014 21 0.102 7 7 1.0 NaN NaN
sub-218457 20131007 26 0.039 5 5 1.0 -0.089 1.0
sub-219030 20130829 1 0.192 7 7 1.0 0.054 6.0
sub-219031 20131022 1 0.166 7 7 1.0 -0.014 2.0
sub-219038 20131021 2 0.193 7 7 1.0 -0.019 1.0
sub-219038 20131021 5 0.187 7 7 1.0 -0.004 2.0
sub-219038 20131022 2 0.086 6 6 1.0 -0.007 2.0
sub-219038 20131023 1 0.196 7 7 1.0 0.067 6.0
sub-219038 20131023 2 0.300 7 7 1.0 0.053 6.0
sub-219248 20130921 1 0.096 7 7 1.0 0.014 4.0
sub-219248 20130921 2 0.164 7 7 1.0 0.049 6.0
sub-219248 20130923 2 0.148 7 7 1.0 0.059 6.0
sub-219248 20130923 3 0.218 7 7 1.0 0.128 7.0
duplicate pairs (r = 1) among the same-range pairs of each bin, reading baa-r
bin duplicate_pairs same_range_pairs
0.00-14.29 0 74
14.29-28.57 0 75
28.57-42.86 0 77
42.86-57.14 0 70
57.14-71.43 1 69
71.43-85.71 1 86
85.71-100.00 12 124
Each unit stored twice forms a pair with r = 1 with its copy, and both rows always fall in the same
bin. Its coupling rises when the copy is kept, as the copy is part of the summed activity of the
other neurons: under baa-r 12 of the 14 duplicated units in the selected sessions are in the top
bin and one each in bins 5 and 6. The 12 of them in sessions also selected under baa have a
coupling of -0.089 to 0.128 when counted once and fall in bins 1, 2, 4, 6 and 7. These r = 1 pairs
are 12 of the 124 same-range pairs of the top bin and 1 of the 69 of bin 5. Only these 14 units, in
the sessions selected under baa-r, are shown here, not all 72 duplicated units of the dataset.
figs4-lowest-couplers-correlated¶
In the ALM silicon-probe recordings, neurons in the lowest population-coupling bin (0 to 14.29%) are more correlated with each other than with neurons of other coupling bins, as the synapses with the lowest coupling are.
Criterion: reproduced when the bin 1 mean difference is positive with Holm-corrected one-tailed p < 0.05 and within 0.06 ± 0.006; partially reproduced when positive and significant but outside tolerance; not reproduced when the Holm-corrected p is 0.05 or more.
Result: blocked (methods_underspecified), as the outcome turns on O2. Under baa the lowest bin's mean difference is 0.048 (same 0.028, different -0.020;
Holm p = 0.0007), positive and significant but below the tolerance of 0.054 to 0.066; over the five
seeds it is 0.0478 to 0.0479. It is significant under all sixteen readings (0.032 to 0.055). Only
bba, with units counted once, falls within tolerance (0.0548, 0.0546 to 0.0548 over the seeds,
just inside the lower edge of 0.054) and gives reproduced; the other three readings with units
counted once and O1 (b) (baa, bab, bbb) and all eight readings with every stored row give
partially reproduced. The readings baa and bba differ only in O2, which has no basis, so the
outcome is not the one every reading gives and the claim's rule makes it blocked
(methods_underspecified). The split holds with units counted once and O1 (b), over all eight
readings with units counted once, and over all sixteen. Only the size of the effect is open: it is
positive and significant under every reading. The difference is positive in each of the 8 mice with
same-range pairs in the bin under baa.
figs4-high-couplers-correlated¶
In the ALM silicon-probe recordings, neurons in the three highest coupling bins (57.14 to 100%) are more correlated with neurons of the same bin than with neurons of other bins (Table 5 differences 0.02, 0.06 and 0.1), as for the synapses.
Criterion: reproduced when all three bins have a positive mean difference with Holm-corrected one-tailed p < 0.05 and within tolerance (0.015 to 0.025, 0.054 to 0.066, 0.05 to 0.15); partially reproduced when all three are significant and one or more is outside tolerance, or two of three are significant and within tolerance.
Result: blocked (methods_underspecified), as the outcome turns on O3. Under baa the 57.14 to 71.43% bin is not significant (0.008, Holm p 0.074, 0.066 to 0.090
over the five seeds), the 71.43 to 85.71% and top bins are (0.021 and 0.067, Holm p 0.0007), and
the criterion gives not reproduced. Among the readings with units counted once and O1 (b), baa,
bba and bbb give not reproduced and bab gives partially reproduced (all three bins
significant, 0.012, 0.019 and 0.069, of which only 0.069 is within tolerance). baa and bab
differ only in O3, which has no basis, so the claims file's rule makes the claim blocked
(methods_underspecified). Under bab the result is weak: the first two bins are well below the
paper's values, but the criterion gives partially reproduced there. The earlier outcome, partially
reproduced, rested on the reading baa-r.
With every stored row seven of eight readings give partially reproduced (baa-r 0.026, 0.035
and 0.130, each Holm p 0.0007). Keeping the rows adds the third Tlx mouse's session (sub-218453),
moves the bin edges and changes which units fall in each bin; the duplicate pairs themselves are 1
of the 69 same-range pairs of bin 5 and 12 of the 124 of bin 7, so the change in bin 5 does not
come from them alone. Under baa-r the bin 5 and bin 7 differences (0.026 and 0.130) lie nearer
the values the paper's code printed (0.0188 and 0.122) than under baa (0.008 and 0.067), which
is consistent with the paper's pipeline having kept the duplicated rows too; the code does not
show this. The 71.43 to 85.71% difference is below the paper's 0.06 under every reading (0.014 to
0.035). Per mouse under baa, the difference is positive in 7 of 9, 6 of 7 and 5 of 5 mice in the
three bins.
figs4-middle-couplers-not-correlated¶
In the ALM silicon-probe recordings, the three middle coupling bins (14.29 to 57.14%) show no significant excess of same-bin over different-bin correlation.
Criterion: a claim of absence on the paper's test (E8, one-tailed, Holm across the 7 bins, alpha 0.05). Reproduced when none of bins 2, 3 and 4 has a Holm-corrected one-tailed p below 0.05; not reproduced when any does. The three mean differences are reported either way.
Result: blocked (methods_underspecified). The outcome turns on O2 or O3, for which the paper
gives no defensible choice. With units counted once and O1 (b), baa and bba give reproduced
(smallest Holm p 0.54 under baa), while bab and bbb give not reproduced (14.29 to 28.57%:
0.008 with Holm p 0.041, and 0.008 with Holm p 0.020), so the outcome turns on O3. With every
stored row it turns on O2: baa-r and bab-r give reproduced, bba-r and bbb-r not. Over all
sixteen readings eight give reproduced and eight not reproduced. Where a middle bin is
significant, the mean difference is at most 0.0084; the paper's are 0.004, 0.001 and -0.002. Under
baa the three differences are -0.0010, -0.0030 and 0.0049.
print(f"notebook run time {(time.time() - started) / 60:.1f} min; peak memory "
f"{resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6:.2f} GB")
notebook run time 3.7 min; peak memory 1.25 GB
Summary¶
| Claim | Outcome |
|---|---|
| figs4-session-selection | not reproduced (9 or 10 mice and 15 to 18 sessions, against 11 and 20) |
| figs4-lowest-couplers-correlated | blocked (methods_underspecified): partially reproduced under 15 of 16 readings (baa 0.048 against 0.06, significant), but bba gives reproduced, so it turns on O2 |
| figs4-high-couplers-correlated | blocked (methods_underspecified): under baa not reproduced (0.008, 0.021, 0.067; the first not significant), but bab gives partially reproduced, so it turns on O3 |
| figs4-middle-couplers-not-correlated | blocked (methods_underspecified): reproduced under eight readings and not under eight; it turns on O2 or O3 |
| 30 claims on the paper's imaging | blocked (data_missing), the data are not public |
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 step that builds the paper's per-session arrays from
these files is not in its code, so the unit filter (O1), the rate (O2), the trial set (O3) and the
treatment of units stored twice are run under every combination. The adopted reading baa counts
each unit stored twice once and keeps only units above 0.5 Hz; O2 and O3 are not assumed, and the
window is a fixed 4.6 s from sample onset (O5). The selection does not reach the paper's 11 mice
and 20 sessions under any reading, so the population differs from the paper's, which bears on the
three test claims.
What was found about the dataset. Every unit is labelled "good"; 50 of 99 files store 72 units
twice under a repeated id, and an analysis that keeps both rows pairs each with its copy at r = 1:
of the 14 such units in the sessions selected under baa-r, 12 fall in the top coupling bin. Every
trial is labelled audio delay though the task described is tactile; 140 photostimulation onsets
have a NaN timestamp, and some sample, delay, GO and photostimulation events fall outside every
trial; a few trials with sample times have no observation interval; a few units store spike times
out of order, and two files hold spikes outside the observation intervals. The spikes and trial
events share a clock as far as the decoding check shows. In 8 of the 10 selected sessions with a
laser trace the onset trials are exactly the trials with laser power, and in the other two one
trial differs; no included trial has laser power. Seven selected sessions (four of Ai32 mice,
three of KJ18 mice with optogenetics metadata) hold no laser trace or onsets.