Reproducing Wang et al. (2025) from DANDI:000363¶
Paper. Wang ZA, Kurgyis B, Chen S, Kang B, Chen F, Liu Y, Liu D, Svoboda K, Li N, Druckmann S
(2025). Brain-wide analysis reveals movement encoding structured across and within brain areas.
Nature Neuroscience. doi:10.1038/s41593-025-02114-x.
The claims file (claims/wang-2025.yaml) was written from the version of record (main text,
legends, Methods, Extended Data legends) and the Supplementary Information.
Dataset. DANDI:000363, Mesoscale
Activity Map Dataset, version 0.230822.0128. This is the version the paper cites (its data
reference, doi:10.48324/dandi.000363/0.230822.0128), so it is pinned. The most recent published
version, 0.231012.2129 (the one the code's README cites), holds the same 174 sessions in much
larger files (65.7 TB in total, against 53.6 GB): 169 of its files add the raw electrophysiology
(ElectricalSeries), and the 71 of them renamed +image also add the raw video (28.9 TB). The
video, from which the paper's autoencoder embedding and end-to-end networks are computed, is in
no other version, and it covers 34 of the 106 sessions the authors used for Figs. 6 and 7. The
difference, a check that the units, trials and markers of four sessions are the same in both, and
the cost of reading the video are shown in the data check.
What the dataset holds. 174 sessions of 28 mice in the delayed-response task: sorted units with CCF annotations, the trial table, behavioural events (licks, epochs), and three side-camera DeepLabCut markers (jaw, nose, tongue, with a likelihood) per frame. It does not hold the paper's 16-dimensional autoencoder embedding, nor the trained networks.
Outside inputs. From the authors' processed-data deposit, Zenodo doi:10.5281/zenodo.16740783
(named in the claims file), two small members read by HTTP range requests: area2anno.json, the
code's grouping of CCF annotation names into areas, and the session names of cal4cat-delay.pickle,
the authors' Fig. 6 and 7 file, which name the 106 sessions the paper used. Both are tested by
the link claim link-authors-deposit.
| Claim | Tested here |
|---|---|
| link-authors-deposit (link claim, added to the claims file by this attempt) | tested |
| data-scale | tested |
| fig6e-marker-clustering | tested |
| fig2b-medulla-vs-midbrain, fig2b-area-ordering, edfig3-epochs, fig2e-method-improvement, fig2-ordering-across-methods, edfig1-reliable-unpredicted | blocked: need the autoencoder embedding and end-to-end networks, whose video is missing for most sessions (data_missing) |
| fig3-thalamus-nonuniform, fig3e-nearest-neighbor, fig3f-thalamic-nuclei, thalamus-ev-not-rate, supfig2-noise-injection | blocked: same |
| fig4b-medulla-leads, edfig6-offset-ev-correlation, fig5a-somatosensory-vs-alm, fig5b-po-vs-vm, fig5c-pretectal-vs-scm, fig5-significant-offsets, fig4e-alm-depth | blocked: same |
| fig6a-choice-from-video, fig6d-mouse-clustering, fig6-marker-vs-embedding-decoding, edfig7-performance-correlation | blocked: same (the marker half of fig6-marker-vs-embedding-decoding is computed, not as an outcome) |
| fig7b-jaw-differs, fig7c-modulation-nonuniform, fig7d-alm-midbrain-vs-medulla, edfig10-subtraction-consistent, supp-session-independent-autoencoder | blocked: same, or depend on the embedding decoder |
import os
os.environ["OMP_NUM_THREADS"] = "1"
os.environ["OPENBLAS_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1"
import collections
import json
import multiprocessing as mp
import resource
import time
import warnings
import zlib
import numpy as np
import pandas as pd
from scipy import stats
import mapvideo as mv
warnings.filterwarnings("ignore")
pd.set_option("display.width", 200)
pd.set_option("display.max_rows", 300)
pd.set_option("display.max_columns", 30)
PAPER = "wang-2025"
SEED_FIG6E = zlib.crc32(f"{PAPER}/fig6e-marker-clustering".encode())
SEED_RESP = zlib.crc32(f"{PAPER}/fig6-marker-vs-embedding-decoding".encode())
N_SESSIONS = int(os.environ.get("N_SESSIONS", "0")) # 0 = all; a subset only while developing
started = time.time()
assets = mv.list_assets()
print(f"dandiset {mv.DANDISET} version {mv.VERSION}: {len(assets)} assets, "
f"{sum(a['size'] for a in assets) / 1e9:.1f} GB")
todo = assets[:N_SESSIONS] if N_SESSIONS else assets
# Six workers on four CPUs, so that reading one session overlaps decoding others; each session
# has its own seeds and imap keeps the order, so the results do not depend on the number of workers.
with mp.get_context("fork").Pool(6) as pool:
S = list(pool.imap(mv.session_summary_retry, [(a, SEED_FIG6E, SEED_RESP) for a in todo], chunksize=1))
failed = [s for s in S if "error" in s]
S = [s for s in S if "error" not in s]
print(f"read and decoded {len(S)} sessions in {(time.time() - started) / 60:.1f} min; failed: {len(failed)}")
for s in failed:
print(" failed:", s["path"], s["error"])
print("peak memory of this process (GB):", resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6)
dandiset 000363 version 0.230822.0128: 174 assets, 53.6 GB
read and decoded 174 sessions in 30.7 min; failed: 0 peak memory of this process (GB): 0.513476
Data check¶
Each check of the metadata against the values is stated under its output.
info = pd.DataFrame([{
"path": s["path"], "key": s["key"], "subject": s["subject"], "mouse": s["key"].split("_")[0],
"units": len(s["units"]["anno"]), "trials": s["n_trials"], "included": s["n_included"],
"correct": s["n_correct"], "left": s["n_left"], "right": s["n_right"],
"performance": s["performance"], "go_missing": s["n_go_missing"],
"frames": s["frame_dt"]["n_frames"], "frame_dt_ms": 1000 * s["frame_dt"]["median"],
"dt_exact": s["frame_dt"]["within_1us"], "video_gaps": s["frame_dt"]["n_gaps"],
"cameras": len(s["cameras"]), **{f"excl_{k}": v for k, v in s["excluded"].items()},
"fp_trials": s["fp_trials"], "fp_spikes": s["fp_spikes"], "fp_jaw": s["fp_jaw"]} for s in S])
print("Sessions:", len(info), "; subjects (subject_id):", info.subject.nunique(),
"; subject descriptions (the authors' mouse names):", info.mouse.nunique())
print("Each subject_id has one description:", bool((info.groupby("subject").mouse.nunique() == 1).all()))
print("\nSessions per mouse:")
print(info.groupby("mouse").size().to_string())
print("\nTrials: total", info.trials.sum(), "; included after the paper's exclusions", info.included.sum(),
"; correct among included", info.correct.sum())
print("Excluded trials (a trial can have several reasons):",
{k: int(info[f"excl_{k}"].sum()) for k in ["ignore", "early", "free_water", "auto_water", "photostim"]})
print("Trials without a go cue:", int(info.go_missing.sum()))
print("Correct trials per session: min", info.correct.min(), "median", info.correct.median(), "max", info.correct.max())
print("Performance (correct / included) per session: min %.3f median %.3f max %.3f"
% (info.performance.min(), info.performance.median(), info.performance.max()))
Sessions: 174 ; subjects (subject_id): 28 ; subject descriptions (the authors' mouse names): 28
Each subject_id has one description: True
Sessions per mouse:
mouse
SC011 8
SC013 5
SC015 4
SC016 4
SC017 5
SC022 5
SC023 6
SC026 4
SC027 6
SC030 4
SC031 3
SC032 4
SC033 4
SC035 4
SC038 10
SC043 6
SC045 7
SC048 9
SC049 7
SC050 7
SC052 9
SC053 10
SC060 6
SC061 6
SC064 9
SC065 9
SC066 7
SC067 6
Trials: total 94990 ; included after the paper's exclusions 54146 ; correct among included 44280
Excluded trials (a trial can have several reasons): {'ignore': 14095, 'early': 10805, 'free_water': 2450, 'auto_water': 1339, 'photostim': 18588}
Trials without a go cue: 0
Correct trials per session: min 36 median 255.5 max 502
Performance (correct / included) per session: min 0.527 median 0.835 max 0.989
All 174 sessions have the three side-camera markers. The trial table has 28 subjects, as the paper's
Methods state (28 mice); the files' subject/description (for example SC015) is the authors' mouse
name, used below to match the authors' session names. Trials are excluded as the Methods say
(photoinhibition, free water, early licks, no response); auto_water trials are counted as free
water.
# Duplicate recordings: identical trial start times, spike times or jaw traces in two files.
for col in ["fp_trials", "fp_spikes", "fp_jaw"]:
dup = info[info.duplicated(col, keep=False)]
print(f"{col}: {info[col].nunique()} distinct among {len(info)} sessions; duplicated:",
dup[["path", col]].values.tolist() if len(dup) else "none")
print("Sessions with the same mouse and date:", int(info.duplicated("key").sum()))
fp_trials: 174 distinct among 174 sessions; duplicated: none fp_spikes: 174 distinct among 174 sessions; duplicated: none fp_jaw: 174 distinct among 174 sessions; duplicated: none Sessions with the same mouse and date: 5
# Marker frames and their clock.
print("Marker frame interval (ms): median over sessions", np.round(info.frame_dt_ms.median(), 4),
"; range", np.round(info.frame_dt_ms.min(), 4), "to", np.round(info.frame_dt_ms.max(), 4))
print("Fraction of within-trial intervals equal to 3.4 ms (to 1 us): min %.4f median %.4f"
% (info.dt_exact.min(), info.dt_exact.median()))
print("Video gaps (intervals > 10 ms) per session minus trials: median",
int((info.video_gaps - info.trials).median()), "; range", int((info.video_gaps - info.trials).min()),
"to", int((info.video_gaps - info.trials).max()))
print("Frames per session: min", info.frames.min(), "median", int(info.frames.median()), "max", info.frames.max())
out = pd.DataFrame([{**{"key": s["key"]}, **{f"{m}_outliers_per_1e4": 1e4 * s["outliers"][m][0] / s["outliers"][m][1]
for m in s["outliers"]}} for s in S])
print("Five-sigma velocity outliers imputed, per 10,000 frames: jaw median %.1f (max %.1f), nose median %.1f (max %.1f)"
% (out.Jaw_outliers_per_1e4.median(), out.Jaw_outliers_per_1e4.max(),
out.Nose_outliers_per_1e4.median(), out.Nose_outliers_per_1e4.max()))
print("Correct trials dropped for missing marker frames in the delay epoch: jaw",
sum(s["n_missing_frames"].get("Jaw", 0) for s in S), "; nose", sum(s["n_missing_frames"].get("Nose", 0) for s in S))
miss = pd.DataFrame([{"key": s["key"], "correct": s["n_correct"], "without_jaw_frames": s["n_missing_frames"].get("Jaw", 0)}
for s in S if s["n_missing_frames"].get("Jaw", 0)])
print("Sessions with correct trials lacking marker frames in the delay epoch:")
print(miss.to_string(index=False))
Marker frame interval (ms): median over sessions 3.4 ; range 3.4 to 3.4
Fraction of within-trial intervals equal to 3.4 ms (to 1 us): min 0.9989 median 0.9995
Video gaps (intervals > 10 ms) per session minus trials: median -1 ; range -544 to -1
Frames per session: min 13995 median 1021949 max 1521636
Five-sigma velocity outliers imputed, per 10,000 frames: jaw median 8.7 (max 71.9), nose median 8.7 (max 44.4)
Correct trials dropped for missing marker frames in the delay epoch: jaw 487 ; nose 487
Sessions with correct trials lacking marker frames in the delay epoch:
key correct without_jaw_frames
SC065_050521 354 140
SC066_041321 351 347
The marker timestamps advance by exactly 3.4 ms within a trial, a frame rate of 294 Hz where the Methods say 300 Hz; the video is recorded per trial (one gap per trial). The 3.4 ms step is the stride the Methods give for binning, so the paper worked at the same step. The timestamps are regular to the microsecond, so they were most likely written from a nominal rate, not measured; whether they hold the camera's true timing cannot be told from the files.
# Clock check: the tongue (DeepLabCut likelihood > 0.9) against the trial table's go cue and the
# lick events, true and shifted in time.
rel = np.array(S[0]["tongue_vs_go"][0])
prof = np.array([s["tongue_vs_go"][1] for s in S])
print("Fraction of frames with the tongue visible, in 100 ms windows from the go cue (mean over sessions):")
print(pd.Series(prof.mean(0).round(3), index=np.round(rel, 1)).to_string())
pre, post = prof[:, rel < -0.05].mean(1), prof[:, (rel > 0.05) & (rel < 0.5)].mean(1)
print(f"Per session, 0.1 to 0.5 s after the go cue minus 1 s to 0 before: min {np.min(post - pre):.3f}, "
f"median {np.median(post - pre):.3f}; sessions where it is not positive: {int(np.sum(post - pre <= 0))}")
lk = pd.DataFrame([s["tongue_at_licks"] for s in S])
print("\nFraction of lick events with the tongue visible within one frame, by shift of the lick times (s):")
print(lk.describe().loc[["min", "50%", "max"]].round(3).to_string())
print("Sessions where the unshifted fraction is below 0.9:", int((lk[0.0] < 0.9).sum()))
Fraction of frames with the tongue visible, in 100 ms windows from the go cue (mean over sessions):
-1.0 0.026
-0.9 0.025
-0.8 0.025
-0.7 0.025
-0.6 0.026
-0.5 0.027
-0.4 0.029
-0.3 0.031
-0.2 0.037
-0.1 0.044
-0.0 0.136
0.1 0.537
0.2 0.587
0.3 0.597
0.4 0.584
0.5 0.551
0.6 0.519
0.7 0.489
0.8 0.439
0.9 0.391
Per session, 0.1 to 0.5 s after the go cue minus 1 s to 0 before: min -0.124, median 0.560; sessions where it is not positive: 5
Fraction of lick events with the tongue visible within one frame, by shift of the lick times (s):
0.00 0.05 0.10 -0.05
min 0.063 0.034 0.016 0.011
50% 1.000 0.840 0.131 0.304
max 1.000 0.991 0.769 0.882
Sessions where the unshifted fraction is below 0.9: 6
In most sessions the tongue appears only after the go cue of the trial table, and it is visible at nearly every lick event, while lick times shifted by 50 or 100 ms find it much less often. The sessions where this fails are listed and examined in the next cell. The spike times are not used by a tested claim except through unit counts, and their clock was not checked here.
# Sessions where the check fails: scan the shift of the lick times from -1 to 1 s.
flag = info.assign(contrast=post - pre, at_licks=lk[0.0].values)
flag = flag[(flag.contrast <= 0) | (flag.at_licks < 0.9) | (flag.frames < 0.5 * flag.frames.median())]
print(flag[["key", "path", "frames", "trials", "included", "correct", "contrast", "at_licks"]].round(3).to_string(index=False))
by_path = {a["path"]: a for a in assets}
scan = []
for p in flag.path:
r = mv.lick_alignment(by_path[p])
best = int(np.nanargmax(r["frac"]))
scan.append({"key": info.set_index("path").key[p], "licks": r["n_licks"],
"included": r["included"], "included_with_frames_at_go": r["included_with_frames"],
"frac_at_0": round(float(r["frac"][r["shifts"] == 0][0]), 3),
"best_shift_s": float(r["shifts"][best]), "frac_at_best": round(float(r["frac"][best]), 3),
"video_span_s": np.round(r["video_span"], 1).tolist(), "trial_span_s": np.round(r["trial_span"], 1).tolist(),
"trial_videos": r["segments"], "frames_per_trial_video": r["frames_per_segment"],
"videos_with_licks": r["segments_with_licks"], "aligned_gt_0.8": r["segments_aligned"],
"misaligned_lt_0.3": r["segments_misaligned"],
**{f"stretch_x{k}": round(v, 3) for k, v in r["stretch"].items()}})
scan = pd.DataFrame(scan)
print(scan.T.to_string())
print("Median frames per trial video over all sessions:", int(np.median([s["frame_dt"]["n_frames"] / max(s["frame_dt"]["n_gaps"] + 1, 1) for s in S])))
CLOCK_FLAGGED = set(flag.key)
key path frames trials included correct contrast at_licks SC011_022419 sub-440959/sub-440959_ses-20190224T133648_behavior+ecephys+ogen.nwb 410322 444 276 218 -0.010 0.132 SC011_022519 sub-440959/sub-440959_ses-20190225T142613_behavior+ecephys+ogen.nwb 442972 481 336 275 -0.015 0.083 SC011_022619 sub-440959/sub-440959_ses-20190226T140636_behavior+ecephys+ogen.nwb 409020 440 273 227 -0.013 0.066 SC022_022719 sub-442571/sub-442571_ses-20190227T134351_behavior+ecephys+ogen.nwb 503779 540 303 238 -0.124 0.063 SC022_022819 sub-442571/sub-442571_ses-20190228T140832_behavior+ecephys+ogen.nwb 434174 460 301 279 -0.081 0.100 SC026_080719 sub-455219/sub-455219_ses-20190807T134913_behavior+ecephys+ogen.nwb 1165514 630 457 386 0.562 0.597 SC066_041321 sub-484676/sub-484676_ses-20210413T112028_behavior+ecephys+ogen.nwb 13995 550 373 351 0.007 1.000
0 1 2 3 4 5 6 key SC011_022419 SC011_022519 SC011_022619 SC022_022719 SC022_022819 SC026_080719 SC066_041321 licks 2091 2531 1964 3393 2813 3219 2577 included 276 336 273 303 301 457 373 included_with_frames_at_go 179 235 194 228 243 457 4 frac_at_0 0.132 0.083 0.066 0.063 0.1 0.597 1.0 best_shift_s 0.49 0.42 0.27 0.52 0.88 0.0 -0.17 frac_at_best 0.407 0.125 0.119 0.406 0.484 0.597 1.0 video_span_s [0.0, 3014.4] [0.0, 3263.3] [0.0, 3004.3] [0.0, 3725.9] [0.0, 3187.3] [0.0, 5168.9] [0.0, 49.3] trial_span_s [0.0, 3016.1] [0.0, 3265.0] [0.0, 3005.5] [0.0, 3727.6] [0.0, 3189.0] [0.0, 5167.7] [0.0, 3911.7] trial_videos 444 481 440 540 460 539 7 frames_per_trial_video 937.0 934.0 938.0 946.0 944.0 1878.0 1936.0 videos_with_licks 49 38 27 85 49 535 7 aligned_gt_0.8 1 0 0 3 3 214 7 misaligned_lt_0.3 45 35 26 79 43 117 0 stretch_x1.0 0.132 0.083 0.066 0.063 0.1 0.597 1.0 stretch_x1.5 0.019 0.012 0.007 0.173 0.132 0.034 0.109 stretch_x2.0 1.0 1.0 0.999 1.0 1.0 0.035 0.32 stretch_x2.5 0.062 0.119 0.098 0.276 0.215 0.207 0.358 Median frames per trial video over all sessions: 1904
# The frame spacing of the flagged sessions, without the licks: frames per trial video against trial
# duration, in every session of the two mice; and the timing the later version's video carries.
same_mice = info[info.mouse.isin(["SC011", "SC022"])].sort_values("key")
tv = pd.DataFrame([mv.trial_video_timing(by_path[p]) for p in same_mice.path])
tv.insert(0, "key", same_mice.key.values)
tv.insert(1, "clock_flagged", tv.key.isin(CLOCK_FLAGGED))
tv["frame_interval_if_same_span_ms"] = 1000 * tv.groupby(tv.key.str[:5]).video_span_s.transform(
lambda s: s[~tv.loc[s.index, "clock_flagged"]].median()) / tv.frames_per_video
print(tv.drop(columns="path").round(3).to_string(index=False))
lv = mv.later_video_series(info.set_index("key").path[sorted(CLOCK_FLAGGED & set(same_mice.key))[0]])
print("Later version, side-view video of", lv["path"].split("/")[1][:40], ":", lv)
key clock_flagged trial_videos frames_per_video video_span_s trial_duration_s video_start_after_trial_start_s frame_interval_if_same_span_ms SC011_021919 False 437 1864.0 6.334 4.832 0.0 3.411 SC011_022019 False 525 1886.0 6.409 4.900 0.0 3.371 SC011_022119 False 521 1876.0 6.375 4.865 0.0 3.389 SC011_022219 False 571 1871.0 6.358 4.858 0.0 3.398 SC011_022319 False 448 1865.5 6.339 4.839 0.0 3.408 SC011_022419 True 444 937.0 3.182 4.868 0.0 6.785 SC011_022519 True 481 934.0 3.172 4.850 0.0 6.807 SC011_022619 True 440 938.0 3.186 4.875 0.0 6.778 SC022_022719 True 540 946.0 3.213 4.894 0.0 6.764 SC022_022819 True 460 944.0 3.206 4.898 0.0 6.778 SC022_030119 False 501 1884.0 6.402 4.899 0.0 3.396 SC022_030219 False 501 1883.0 6.399 4.898 0.0 3.398 SC022_030319 False 692 1882.0 6.395 4.898 0.0 3.400
Later version, side-view video of sub-440959_ses-20190224T133648_behavior+ : {'path': 'sub-440959/sub-440959_ses-20190224T133648_behavior+ecephys+image+ogen.nwb', 'side_series': 444, 'frames_per_series': 937.0, 'fields': ['data', 'format', 'starting_time'], 'rate': 1.0, 'has_timestamps': False}
In seven sessions the check fails, and the table above shows why. In five (SC011 on 24, 25 and 26 February 2019, SC022 on 27 and 28 February 2019) the tongue is visible at 6 to 13% of lick events as deposited and at no shift of the lick times within 1 s does this reach 0.49, while stretching each trial's video timestamps by a factor of 2 from its first frame puts the tongue at 99.9 to 100% of the licks. Their trial videos hold about 940 frames, against a median of 1904 over all sessions. The cell above checks this without the licks: in the same two mice, the trials last as long in the five sessions as in the others (median 4.85 to 4.90 s) and each trial video starts at the trial's start, but holds 934 to 946 frames against 1864 to 1886, so if the camera ran as long per trial as on the mice's other days, the frames are 6.8 ms apart. The video itself cannot settle it: the later version's side-view series of these sessions hold the same frame counts and carry no timing (a starting time with a rate of 1.0, no timestamps). In these five sessions the frames are 6.8 ms apart, not the 3.4 ms the timestamps give, so their markers are on a time base half as long as the trial table's; nothing in the files shows this. In SC026_080719 the tongue is at 60% of lick events: 214 trial videos match the licks and 117 do not, and the session has 539 trial videos for 630 trials, so some videos are likely attached to the wrong trials (the cause is not established). SC066_041321 has markers for 7 trial videos (49 s) only. None of these seven sessions is among the 106 sessions the authors used, the main set of fig6e; they are also left out of its clock-checked variant.
# Units and their quality labels.
U = pd.concat([pd.DataFrame({"key": s["key"], "mouse": s["key"].split("_")[0], "anno": s["units"]["anno"],
"quality": s["units"]["quality"], "classification": s["units"]["classification"],
"rate": s["units"]["rate"], "group_location": s["units"]["group_location"]})
for s in S], ignore_index=True)
print("Units:", len(U))
print("unit_quality:", U.quality.value_counts().to_dict())
print("classification:", U.classification.value_counts().to_dict())
print(pd.crosstab(U.quality, U.classification).to_string())
print("Units without a CCF annotation (empty anno_name):", int((U.anno == "").sum()),
"; of these, classification unlabelled:", int(((U.anno == "") & (U.classification == "unlabelled")).sum()),
"; unlabelled units with an annotation:", int(((U.anno != "") & (U.classification == "unlabelled")).sum()))
print("unit_quality good units without a CCF annotation:", int(((U.quality == "good") & (U.anno == "")).sum()),
"; with one:", int(((U.quality == "good") & (U.anno != "")).sum()))
print("avg_firing_rate (Hz): min %.3g median %.3g max %.3g; NaN %d" % (U.rate.min(), U.rate.median(), U.rate.max(), U.rate.isna().sum()))
loc = U.group_location.str.extract(r'"brain_regions": "([^"]*)"')[0]
U["probe_region"] = loc.fillna(U.group_location)
print("Probe targets (electrode group location, brain_regions):")
print(U.probe_region.value_counts().to_string())
Units: 272227
unit_quality: {'good': 154948, 'multi': 117279}
classification: {'unlabelled': 200922, 'good': 69453, 'nan': 1852}
classification good nan unlabelled
quality
good 60978 1201 92769
multi 8475 651 108153
Units without a CCF annotation (empty anno_name): 200922 ; of these, classification unlabelled: 200922 ; unlabelled units with an annotation: 0
unit_quality good units without a CCF annotation: 92769 ; with one: 62179
avg_firing_rate (Hz): min 0.000174 median 2.29 max 217; NaN 0
Probe targets (electrode group location, brain_regions): probe_region left ALM 44515 right ALM 41839 right Midbrain 25968 left Midbrain 24645 left Thalamus 23981 right Striatum 23795 left Striatum 20844 right Thalamus 18406 left Medulla 13679 right Medulla 11913 left ECT 10064 right ECT 4771 left BLA 4006 right BLA 3801
# The later version: what it adds, and what reading its video would cost.
v = mv.video_read_estimate()
print(f"Version {v['version']}: {v['n_assets']} assets, {v['bytes_total'] / 1e12:.1f} TB; "
f"{v['n_video_assets']} files with video ({v['bytes_video_assets'] / 1e12:.1f} TB)")
print(f"Example {v['example']}: {v['side_series']} side-view series, {v['side_frames']} side-view frames of "
f"{v['frame_shape']} uint8, read at {v['frames_per_s']:.0f} frames/s")
later = {a["path"].replace("+image", ""): a for a in mv.list_assets(v["version"])}
print("Sessions in both versions, by path without '+image':", sum(a["path"] in later for a in assets), "of", len(assets))
grown = sum(later[a["path"]]["size"] > 10 * a["size"] for a in assets if a["path"] in later)
print("Of these, files more than 10 times larger in the later version:", grown, "; named '+image':",
sum("+image" in later[a["path"]]["path"] for a in assets if a["path"] in later))
rng_v = np.random.default_rng(zlib.crc32(f"{PAPER}/version-check".encode()))
pick = [assets[i] for i in sorted(rng_v.choice(len(assets), 4, replace=False))]
rows = []
for a in pick:
old_fp = mv.version_fingerprints(a)
new_fp = mv.version_fingerprints(later[a["path"]], v["version"])
rows.append({"path": a["path"].split("/")[1][:40], "later_path_has_image": "+image" in later[a["path"]]["path"],
**{k: (old_fp[k] == new_fp[k]) for k in old_fp}})
print("Same values in both versions (4 sessions drawn at random):")
print(pd.DataFrame(rows).to_string(index=False))
files = pd.DataFrame(mv.later_version_files(v["version"]))
files["raw_ephys"] = files.measured.apply(lambda m: "ElectricalSeries" in m)
print("\nLater version's files by content (archive metadata; '+image' in the path marks the raw video):")
print(files.groupby(["image", "raw_ephys"]).agg(files=("path", "size"), TB=("size", lambda x: round(x.sum() / 1e12, 2))).to_string())
ex_noimg = files[~files.image & files.raw_ephys].sort_values("size").path.iloc[-1]
ex_img = files[files.image].path.iloc[0]
print("Acquisition objects by type, largest file without '+image':", ex_noimg, mv.acquisition_listing(ex_noimg, v["version"]))
print("Acquisition objects by type, a file with '+image':", ex_img, mv.acquisition_listing(ex_img, v["version"]))
hours = v["side_frames"] / v["frames_per_s"] / 3600
print(f"Reading the side view of one session: {hours:.1f} h; of the paper's 106 sessions: {106 * hours:.0f} h, "
"before any network is trained")
Version 0.231012.2129: 174 assets, 65.7 TB; 71 files with video (28.9 TB) Example sub-440956/sub-440956_ses-20190207T120657_behavior+ecephys+image+ogen.nwb: 368 side-view series, 680502 side-view frames of (400, 384, 3) uint8, read at 151 frames/s
Sessions in both versions, by path without '+image': 174 of 174 Of these, files more than 10 times larger in the later version: 169 ; named '+image': 71
Same values in both versions (4 sessions drawn at random):
path later_path_has_image units spikes fp_spikes fp_anno trials fp_trials jaw_frames fp_jaw
sub-460432_ses-20191217T123303_behavior+ True True True True True True True True True
sub-479121_ses-20200925T153348_behavior+ False True True True True True True True True
sub-480135_ses-20210302T140243_behavior+ False True True True True True True True True
sub-484673_ses-20210505T131153_behavior+ False True True True True True True True True
Later version's files by content (archive metadata; '+image' in the path marks the raw video):
files TB
image raw_ephys
False False 5 0.00
True 98 36.85
True True 71 28.85
Acquisition objects by type, largest file without '+image': sub-484673/sub-484673_ses-20210507T135524_behavior+ecephys+ogen.nwb {'BehavioralEvents': 1, 'BehavioralTimeSeries': 1, 'ElectricalSeries': 5}
Acquisition objects by type, a file with '+image': sub-440956/sub-440956_ses-20190207T120657_behavior+ecephys+image+ogen.nwb {'BehavioralEvents': 1, 'BehavioralTimeSeries': 1, 'ElectricalSeries': 4, 'ImageSeries': 368}
Reading the side view of one session: 1.3 h; of the paper's 106 sessions: 133 h, before any network is trained
# Which sessions have video in the later version, and the sessions the authors used (Fig. 6 and 7 file,
# matched by mouse and date as in link-authors-deposit below).
has_video = {p.replace("+image", ""): img for p, img in zip(files.path, files.image)}
info["video_later"] = info.path.map(has_video).fillna(False).astype(bool)
authors_days = {"_".join(k.split("_")[:2]) for k in mv.authors_sessions()}
info["authors"] = info.key.isin(authors_days)
print("Sessions with video in the later version, by whether the authors used them for Figs. 6 and 7:")
print(pd.crosstab(info.authors, info.video_later, margins=True).to_string())
print("Mice with any video:", info[info.video_later].mouse.nunique(), "of", info.mouse.nunique(),
"; mice of the authors' sessions with video:", info[info.video_later & info.authors].mouse.nunique())
print("Sessions with video, by year of recording:",
info[info.video_later].key.str[-2:].map(lambda y: "20" + y).value_counts().sort_index().to_dict())
print("Mice and their sessions with video / all:")
print(info.groupby("mouse").agg(sessions=("key", "size"), with_video=("video_later", "sum"),
authors=("authors", "sum")).T.to_string())
n_av = int((info.video_later & info.authors).sum())
print(f"Reading the side view of the {n_av} authors' sessions that have video, at the rate above: {n_av * hours:.0f} h")
Sessions with video in the later version, by whether the authors used them for Figs. 6 and 7:
video_later False True All
authors
False 31 37 68
True 72 34 106
All 103 71 174
Mice with any video: 16 of 28 ; mice of the authors' sessions with video: 8
Sessions with video, by year of recording: {'2019': 66, '2020': 4, '2021': 1}
Mice and their sessions with video / all:
mouse SC011 SC013 SC015 SC016 SC017 SC022 SC023 SC026 SC027 SC030 SC031 SC032 SC033 SC035 SC038 SC043 SC045 SC048 SC049 SC050 SC052 SC053 SC060 SC061 SC064 SC065 SC066 SC067
sessions 8 5 4 4 5 5 6 4 6 4 3 4 4 4 10 6 7 9 7 7 9 10 6 6 9 9 7 6
with_video 8 5 2 4 4 4 6 3 6 3 3 4 4 4 10 0 0 0 0 0 0 0 0 0 0 0 1 0
authors 0 0 0 0 0 0 0 3 6 3 2 3 3 4 10 4 5 8 6 7 2 5 4 4 8 8 5 6
Reading the side view of the 34 authors' sessions that have video, at the rate above: 43 h
# The authors' processed-data deposit (Zenodo doi:10.5281/zenodo.16740783): every member and its size.
listing = pd.DataFrame(mv.zenodo_listing(), columns=["member", "bytes"])
print(listing.assign(MB=(listing.bytes / 1e6).round(1)).drop(columns="bytes").to_string(index=False))
import pickle
lat = pickle.loads(mv.zenodo_member("session_latents.pkl"))
shapes = collections.Counter((len(v), tuple(np.shape(v[0]))) for v in lat.values())
print(f"\nsession_latents.pkl: {len(lat)} sessions; per session (number of arrays, shape of each):", dict(shapes))
del lat
member MB
area2anno.json 0.0
auc_analysis.pickle 2086.7
auc_delay_data_new.pickle 13.6
cal4cat-delay.pickle 1.2
combined_methods_r2_new.pickle 14.3
e2e_saliency_map_session_goode2e_bad_other.pickle 2.2
example_e2e_data.pickle 759.8
example_e2e_data_response.pickle 220.5
example_images.npy 0.3
fig6_example_jaw_data.pickle 0.5
fig6_example_marker.pickle 4.9
fig6_example_neurons.pickle 83.9
mousebrainontology_2.csv 0.1
mousebrainontology_heirarchy_cortexMaskExclusions21_sc.xlsx 0.1
nn_and_shuffle_r2_thalamus_subnuclei_new.pkl 57.0
r2_embed_cv_timeshift_long.pkl 1279.4
s1_like_neuron_fr.pkl 281.9
SC035_20200108_right_Medulla.pickle 217.4
session_latents.pkl 91.3
ephys_for_e2e/ 0.0
ephys_for_e2e/map-export_SC065_20210506_174036_s7_p1.mat 140.2
ephys_for_e2e/1_right_ALM.pickle 572.8
final/ 0.0
final/r2_embed_cv_timeshift.pkl 650.2
final/noisy_ccf_labels_coords.pkl 797.5
final/r2_marker_single_split_noshift.pkl 21.0
final/r2_embed_single_split_noshift.pkl 21.0
final/nn_and_shuffle_r2_thalamus_subnuclei.pkl 54.5
2_right_Medulla.pickle 842.3
576_ant_res=20um_PTITtract_masked.tif 150.6
all_session_delay_choice_selectivity_data_withAUC.pkl 17.3
AllenRefVolCoronal_10_ds222.tif 150.6
Annotation_new_10_ds222_16bit.tif 301.1
Annotation_new_10_ds222_32bit.tif 602.0
session_latents.pkl: 106 sessions; per session (number of arrays, shape of each): {(16, (120, 112)): 106}
The paper's embedding is computed by a convolutional autoencoder trained on each session's
side-view video, and its end-to-end networks are trained on the frames themselves (Methods,
Convolutional autoencoder; End-to-end learning). The pinned version has no video. The later
version has it in 71 files, from 16 of the 28 mice (66 recorded in 2019); the other 103 files of
that version have no +image in their names; 98 of them add the raw electrophysiology, and the
largest of these, opened above, holds no ImageSeries. Of the authors' 106 sessions, 34
(from 8 of their 21 mice) have video and 72 have none in any version, so for most of the paper's
sessions the input is missing (data_missing). For the 34 that have it, reading the side view
alone takes more than an hour a session and tens of hours in all (at the rate printed above),
before any of the autoencoders and end-to-end networks is trained on four CPUs, which is also
beyond the five-hour run and the sixty-minute notebook limit (too_large).
The authors' processed-data deposit does not supply the input either. Its session_latents.pkl
holds, for each of the 106 sessions, 16 images of 120 by 112 pixels (the decoder's components, as
printed above), not per-frame values. The go-cue-aligned embeddings the code's README links are in
a Google Drive folder, which has no DOI and no fixed version; the protocol (author step 1.4) allows
outside data only when it is pinned, so they are not used, by that rule. The deposit does hold the
authors' own results: per-neuron explained variance (final/r2_marker_single_split_noshift.pkl,
final/r2_embed_single_split_noshift.pkl, combined_methods_r2_new.pickle, the time-shift files
r2_embed_cv_timeshift*.pkl) and choice AUCs (auc_analysis.pickle, auc_delay_data_new.pickle).
These are outputs of the paper's analysis, not data: outside data may only supply what the dataset
lacks, and the analysis must run on the dataset's data, so they are not used to test any claim.
Two parts of blocked claims need only the markers. The marker half of fig6-marker-vs-embedding-decoding (response-epoch AUC 0.88) is computed below, after the tested claims, and does not decide its claim, which compares it with the embedding. The marker arm of fig2-ordering-across-methods (ridge regression from five-frame jaw, nose and tongue features to each neuron's rate) could also be computed from the dataset; it was not run, because it needs every neuron's binned rate in every session and decides nothing without the other two methods.
link-authors-deposit¶
A link claim, which this attempt added to the claims file (protocol, author step 1.4).
The authors' deposit (Zenodo doi:10.5281/zenodo.16740783) can be linked to the dataset: the CCF annotation names of its area grouping (
area2anno.json) are the dataset'sanno_namevalues with the commas removed, and the 106 session names of its Fig. 6 and 7 file (cal4cat-delay.pickle) are sessions of the dataset, named by mouse and date.
Result: reproduced. Every one of the 16 areas of the authors' grouping has CCF annotation
names that occur in the dataset, spelled the same once commas are removed; 162 of the dataset's 294
distinct annotations fall in the map, the rest being structures outside its 16 areas (the map has
no isocortex group except the orbital area). All 106 session names of the authors' Fig. 6 and 7 file
match a dataset session by mouse and date; the five days with two sessions (SC038, suffix _s<n>)
each have two dataset files, and the 106 sessions come from 21 of the 28 mice. Seven mice (SC011,
SC013, SC015, SC016, SC017, SC022, SC023) have no session in the authors' set.
data-scale¶
The analysis covers more than 50,000 neurons recorded in more than a dozen cortical and subcortical structures, simultaneously with high-speed video of orofacial movements.
Criterion: units passing the dataset's quality labels in the sessions with video, before and after
the 2 Hz filter; more than 12 distinct structures at the level of the areas the paper names (the
criterion's examples: ALM, other isocortex, striatum, thalamus, midbrain, medulla, pons,
cerebellum). Structures are counted without nesting, each unit once: its major division of the
Allen CCF, from the authors' structure tree in their deposit, with isocortex split into ALM (units
on probes targeted to ALM, as the code's get_single_area_inds takes them) and other isocortex.
The 16 areas of the code's grouping (area2anno.json) are also shown; they nest (Thalamus holds VM,
VAL and MD), so they are not a count of distinct structures. The rate is the dataset's
avg_firing_rate (see the notes); the quality labels are read two ways, unit_quality good and
classification good.
U["clean"] = U.anno.str.replace(",", "", regex=False)
for area, names in amap.items():
U[f"A:{area}"] = U.clean.isin(names)
U["A:ALM"] = U.probe_region.str.contains("ALM")
area_cols = [c for c in U.columns if c.startswith("A:")]
rows = []
for label, sel in [("all units", np.ones(len(U), bool)),
("unit_quality good", U.quality == "good"),
("classification good", U.classification == "good")]:
for rate_label, r in [("no rate filter", np.ones(len(U), bool)), ("rate > 2 Hz", U.rate > 2)]:
for sess_label, ss in [("174 sessions", np.ones(len(U), bool)), ("authors' 106", U.key.isin(authors_set))]:
m = sel & r & ss
n_areas = int(sum(U.loc[m, c].any() for c in area_cols))
n_areas100 = int(sum(U.loc[m, c].sum() >= 100 for c in area_cols))
rows.append({"units": label, "rate": rate_label, "sessions": sess_label, "n": int(m.sum()),
"areas_with_units": n_areas, "areas_with_100_units": n_areas100,
"distinct_annotations": U.loc[m & (U.anno != ""), "anno"].nunique()})
scale = pd.DataFrame(rows)
print(scale.to_string(index=False))
m = (U.quality == "good")
print("\nUnits per area, unit_quality good, all sessions (an area can contain another):")
print(pd.Series({c[2:]: int(U.loc[m, c].sum()) for c in area_cols}).sort_values(ascending=False).to_string())
print("\nunit_quality good units per mouse: min", U[m].groupby("mouse").size().min(), "max", U[m].groupby("mouse").size().max(),
"; mice:", U[m].mouse.nunique())
units rate sessions n areas_with_units areas_with_100_units distinct_annotations
all units no rate filter 174 sessions 272227 17 17 294
all units no rate filter authors' 106 159967 17 16 269
all units rate > 2 Hz 174 sessions 143837 17 17 286
all units rate > 2 Hz authors' 106 85604 17 16 263
unit_quality good no rate filter 174 sessions 154948 17 17 293
unit_quality good no rate filter authors' 106 90324 17 16 269
unit_quality good rate > 2 Hz 174 sessions 88647 17 16 285
unit_quality good rate > 2 Hz authors' 106 52649 17 16 263
classification good no rate filter 174 sessions 69453 17 17 293
classification good no rate filter authors' 106 42259 17 16 269
classification good rate > 2 Hz 174 sessions 46658 17 17 285
classification good rate > 2 Hz authors' 106 28606 17 16 263
Units per area, unit_quality good, all sessions (an area can contain another):
ALM 50245
Thalamus 11825
Orbital area 9135
Midbrain 6668
Striatum 6380
Medulla 2349
Mediodorsal nucleus of thalamus 2171
Superior colliculus 2104
Midbrain reticular nucleus 2053
Hippocampal formation 1550
Ventral anterior-lateral complex of the thalamus 1233
Cerebellum 1216
Hypothalamus 743
Ventral medial nucleus of the thalamus 699
Substantia nigra reticular part 313
Pons 297
Pedunculopontine nucleus 113
unit_quality good units per mouse: min 1999 max 12226 ; mice: 28
# Distinct structures without nesting: each unit counted once, in its major division of the Allen CCF
# (the authors' structure tree from the deposit), isocortex split into ALM (units on probes targeted to
# ALM, as the code's get_single_area_inds) and other isocortex.
dmap = mv.division_map()
U["division"] = U.anno.map(dmap).fillna("no annotation")
U.loc[U.anno == "", "division"] = "no annotation"
U["structure"] = U.division
U.loc[(U.division == "Isocortex") & U.probe_region.str.contains("ALM"), "structure"] = "ALM"
U.loc[(U.division == "Isocortex") & ~U.probe_region.str.contains("ALM"), "structure"] = "other isocortex"
NOT_STRUCT = ["no annotation", "fiber tracts", "ventricular systems", "above division level", "not in tree"]
print("Annotations by kind (distinct names among the dataset's):",
U.loc[U.anno != ""].drop_duplicates("anno").division.value_counts().to_dict())
print("Annotated units in names missing from the structure tree:",
U.loc[U.division == "not in tree"].anno.value_counts().to_dict())
rows = []
for label, sel in [("unit_quality good", U.quality == "good"), ("classification good", U.classification == "good")]:
for rate_label, r in [("no rate filter", np.ones(len(U), bool)), ("rate > 2 Hz", U.rate > 2)]:
for sess_label, ss in [("174 sessions", np.ones(len(U), bool)), ("authors' 106", U.key.isin(authors_set))]:
m = sel & r & ss
cnt = U.loc[m & ~U.structure.isin(NOT_STRUCT)].structure.value_counts()
rows.append({"units": label, "rate": rate_label, "sessions": sess_label,
"structures": int((cnt > 0).sum()), "with_100_units": int((cnt >= 100).sum()),
"with_1000_units": int((cnt >= 1000).sum()),
"units_in_a_structure": int(cnt.sum())})
print(pd.DataFrame(rows).to_string(index=False))
m = (U.quality == "good")
print("\nUnits per structure, each counted once (unit_quality good, all sessions; then classification good, rate > 2 Hz):")
print(pd.concat([U.loc[m].structure.value_counts().rename("unit_quality good"),
U.loc[(U.classification == "good") & (U.rate > 2)].structure.value_counts().rename("classification good, > 2 Hz")],
axis=1).fillna(0).astype(int).to_string())
print("\nThe 16 areas of area2anno.json without nesting (each unit in its most specific area, the rest of a "
"containing area kept as its own group), unit_quality good:")
nested = {"Midbrain": ["Superior colliculus", "Midbrain reticular nucleus", "Substantia nigra reticular part",
"Pedunculopontine nucleus"],
"Thalamus": ["Ventral medial nucleus of the thalamus", "Ventral anterior-lateral complex of the thalamus",
"Mediodorsal nucleus of thalamus"]}
inner = {a for v in nested.values() for a in v}
for outer_area, parts in nested.items():
print(f" {outer_area} contains {parts}:", {a: bool((U[f"A:{a}"] & ~U[f"A:{outer_area}"]).sum() == 0) for a in parts})
top = [a for a in amap if a not in inner]
print(" Top-level areas of the map with units (plus ALM):", int(sum(U.loc[m, f"A:{a}"].any() for a in top)) + 1, top)
Annotations by kind (distinct names among the dataset's): {'Isocortex': 119, 'Thalamus': 37, 'Medulla': 29, 'Midbrain': 24, 'Cerebellum': 16, 'Striatum': 14, 'Hippocampal formation': 11, 'Cortical subplate': 11, 'Hypothalamus': 10, 'Pons': 7, 'Pallidum': 6, 'Olfactory areas': 6, 'not in tree': 3, 'no annotation': 1}
Annotated units in names missing from the structure tree: {'Dorsal part of the lateral geniculate complex, core': 39, 'Dorsal part of the lateral geniculate complex, ipsilateral zone': 6, 'Dorsal part of the lateral geniculate complex, shell': 4}
units rate sessions structures with_100_units with_1000_units units_in_a_structure
unit_quality good no rate filter 174 sessions 13 13 11 60938
unit_quality good no rate filter authors' 106 13 13 8 37007
unit_quality good rate > 2 Hz 174 sessions 13 13 8 41902
unit_quality good rate > 2 Hz authors' 106 13 13 6 25696
classification good no rate filter 174 sessions 13 13 11 69404
classification good no rate filter authors' 106 13 13 10 42210
classification good rate > 2 Hz 174 sessions 13 13 9 46615
classification good rate > 2 Hz authors' 106 13 13 6 28563
Units per structure, each counted once (unit_quality good, all sessions; then classification good, rate > 2 Hz):
unit_quality good classification good, > 2 Hz
structure
no annotation 93970 0
ALM 17975 11415
Thalamus 11785 11533
Midbrain 6668 6192
Striatum 6380 4075
other isocortex 5644 3713
Olfactory areas 3579 2085
Medulla 2349 2430
Cortical subplate 1710 739
Hippocampal formation 1550 1450
Cerebellum 1216 1046
Pallidum 1042 973
Hypothalamus 743 671
Pons 297 293
not in tree 40 43
The 16 areas of area2anno.json without nesting (each unit in its most specific area, the rest of a containing area kept as its own group), unit_quality good:
Midbrain contains ['Superior colliculus', 'Midbrain reticular nucleus', 'Substantia nigra reticular part', 'Pedunculopontine nucleus']: {'Superior colliculus': True, 'Midbrain reticular nucleus': True, 'Substantia nigra reticular part': True, 'Pedunculopontine nucleus': True}
Thalamus contains ['Ventral medial nucleus of the thalamus', 'Ventral anterior-lateral complex of the thalamus', 'Mediodorsal nucleus of thalamus']: {'Ventral medial nucleus of the thalamus': True, 'Ventral anterior-lateral complex of the thalamus': True, 'Mediodorsal nucleus of thalamus': True}
Top-level areas of the map with units (plus ALM): 10 ['Medulla', 'Midbrain', 'Striatum', 'Thalamus', 'Orbital area', 'Hypothalamus', 'Pons', 'Cerebellum', 'Hippocampal formation']
Result: reproduced. The 174 sessions, all with video markers, hold 272,227 units; 154,948
have unit_quality good and 69,453 have classification good, both above 50,000. With the 2 Hz
filter on the dataset's avg_firing_rate, 88,647 and 46,658 remain, so the count is above 50,000
after the filter under unit_quality and below it under classification; the criterion holds when
either count exceeds 50,000. Only units with classification good carry a CCF annotation: the
200,922 units with an empty anno_name are exactly the classification unlabelled ones, so 92,769
of the 154,948 unit_quality good units have no CCF location and 62,179 have one. Counted without
nesting, each annotated unit once in its major Allen division with isocortex split into ALM and
other isocortex, the units fall in 13 structures (ALM, other isocortex, olfactory areas,
hippocampal formation, cortical subplate, striatum, pallidum, thalamus, hypothalamus, midbrain,
pons, medulla, cerebellum), each with at least 100 units, under both labels, with or without the
2 Hz filter, and over the 174 sessions or the authors' 106; that is more than 12, by one, and it
rests on counting ALM and other isocortex apart, as the criterion's list of areas does. ALM
here is the isocortex units on probes targeted to ALM, so it may include neighbouring motor cortex;
the margin is narrow. About 40
units are in names the structure tree lacks (parts of the dorsal lateral geniculate complex, in
the thalamus), which adds no structure. The 16 areas of the authors' grouping nest: their
top-level areas, with ALM, give 10, so they are not used for the count. Over the authors' 106
sessions, 90,324 units have unit_quality good and 42,259 classification good (28,606 above
2 Hz).
fig6e-marker-clustering¶
With single markers the mouse-specific structure of uninstructed movements remains; for some mice the nose is more informative than the jaw and for others the jaw more than the nose.
Per session, choice is decoded from the jaw marker alone and from the nose marker alone in the delay epoch (correct trials, 20-fold stratified cross-validation, L2 logistic regression with the penalty chosen by nested cross-validation; decoder reading (a), the five-frame window, and (b), one frame). The session's AUC is the mean over the time bins of the delay epoch (-1.2 to 0 s, every 68 ms) of the AUC at each bin. The paper does not say how the AUC at a bin is formed from the 20 folds; the main reading averages the test-fold AUCs, as the Methods do for the other cross-validated measures (see the helper's docstring), and one AUC over the pooled out-of-fold decision values is a variant. Kept: sessions with jaw or nose AUC of at least 0.65, and mice with two or more such sessions. Calinski-Harabasz score of the two AUCs with mouse labels against 1,000 random reassignments of the labels. The main session set is the 106 sessions the paper used, named in the authors' Fig. 6 and 7 file and matched by link-authors-deposit; the sessions that pass the clock check above, and all decoded sessions, are variants.
bt = mv.bin_times()
trim = (bt >= -1.05) & (bt <= -0.15)
print("Delay-epoch bins (s from the go cue):", np.round(bt, 3).tolist())
dec = [s for s in S if s["auc"]]
print(f"Sessions decoded: {len(dec)} of {len(S)}; not decoded (fewer than 20 correct trials of a side, "
"counting only trials with marker frames over the delay epoch):",
[(s['key'], s['n_left'], s['n_right'], s['n_correct'] - s['n_missing_frames'].get('Jaw', 0)) for s in S if not s["auc"]])
def session_aucs(reading="a", off=0, window=None, auc="fold mean"):
"""auc: 'fold mean' (test-fold AUCs averaged, the main reading) or 'pooled' (one AUC over the
pooled out-of-fold decision values)."""
w = np.ones(len(bt), bool) if window is None else window
key = "auc_fold" if auc == "fold mean" else "auc"
return pd.DataFrame([{"key": s["key"], "mouse": s["key"].split("_")[0],
"jaw": s[key][("Jaw", reading, off)][w].mean(),
"nose": s[key][("Nose", reading, off)][w].mean()} for s in dec])
def clustering(A, rng, thr=0.65, n_null=1000):
keep = A[(A.jaw >= thr) | (A.nose >= thr)]
mice = keep.mouse.value_counts()
keep = keep[keep.mouse.isin(mice[mice >= 2].index)]
if keep.mouse.nunique() < 2:
return dict(sessions=len(keep), mice=keep.mouse.nunique(), ch=np.nan, null_mean=np.nan, null_sd=np.nan, p=np.nan,
nose_mice=0, jaw_mice=0), keep
obs, null, p = mv.ch_null(keep[["nose", "jaw"]].values, keep.mouse.values, rng, n_null)
frac_nose = keep.assign(n=keep.nose > keep.jaw).groupby("mouse").n.mean()
return dict(sessions=len(keep), mice=keep.mouse.nunique(), ch=obs, null_mean=null.mean(), null_sd=null.std(),
p=p, nose_mice=int((frac_nose > 0.5).sum()), jaw_mice=int((frac_nose < 0.5).sum())), keep
CLOCKED = set(info.key) - CLOCK_FLAGGED
MAIN = authors_set
print("Main session set: the authors' 106 sessions (link-authors-deposit),", int(info.key.isin(MAIN).sum()),
"dataset files (five SC038 days hold two sessions under one mouse-and-date name; both are kept);",
"clock-flagged among them:", sorted(CLOCK_FLAGGED & MAIN))
for auc_kind in ["fold mean", "pooled"]:
Ak = session_aucs("a", 0, auc=auc_kind)
Ak = Ak[Ak.key.isin(MAIN)]
print(f"Session AUCs, {auc_kind}, reading (a), claim's seed: jaw mean %.3f (range %.3f to %.3f), nose mean %.3f (range %.3f to %.3f)"
% (Ak.jaw.mean(), Ak.jaw.min(), Ak.jaw.max(), Ak.nose.mean(), Ak.nose.min(), Ak.nose.max()))
A = session_aucs("a", 0)
A = A[A.key.isin(MAIN)]
res_main, keep_main = clustering(A, np.random.default_rng(SEED_FIG6E))
print("Main (fold-mean AUC, reading (a), the authors' 106 sessions, threshold 0.65):",
{k: (round(v, 4) if isinstance(v, float) else v) for k, v in res_main.items()})
print("Paper: CH 12.57, null 1.05 +/- 0.54 s.d., P < 0.001")
Delay-epoch bins (s from the go cue): [-1.2, -1.132, -1.064, -0.996, -0.928, -0.86, -0.792, -0.724, -0.656, -0.588, -0.52, -0.452, -0.384, -0.316, -0.248, -0.18, -0.112]
Sessions decoded: 172 of 174; not decoded (fewer than 20 correct trials of a side, counting only trials with marker frames over the delay epoch): [('SC032_121719', 8, 28, 36), ('SC066_041321', 182, 169, 4)]
Main session set: the authors' 106 sessions (link-authors-deposit), 106 dataset files (five SC038 days hold two sessions under one mouse-and-date name; both are kept); clock-flagged among them: []
Session AUCs, fold mean, reading (a), claim's seed: jaw mean 0.614 (range 0.462 to 0.902), nose mean 0.590 (range 0.462 to 0.852)
Session AUCs, pooled, reading (a), claim's seed: jaw mean 0.606 (range 0.458 to 0.894), nose mean 0.582 (range 0.463 to 0.849)
Main (fold-mean AUC, reading (a), the authors' 106 sessions, threshold 0.65): {'sessions': 37, 'mice': 11, 'ch': 6.8278, 'null_mean': np.float64(1.0324), 'null_sd': np.float64(0.419), 'p': 0.0, 'nose_mice': 4, 'jaw_mice': 5}
Paper: CH 12.57, null 1.05 +/- 0.54 s.d., P < 0.001
print("Per mouse, kept sessions (main):")
per_mouse = keep_main.groupby("mouse").agg(sessions=("key", "size"), jaw=("jaw", "mean"), nose=("nose", "mean"),
nose_above_jaw=("key", lambda k: int((keep_main.loc[k.index, "nose"] > keep_main.loc[k.index, "jaw"]).sum())))
print(per_mouse.round(3).to_string())
print("\nAll sessions per mouse, before the filter:")
allm = A.groupby("mouse").agg(sessions=("key", "size"), passing=("key", lambda k: int(((A.loc[k.index, "jaw"] >= 0.65) | (A.loc[k.index, "nose"] >= 0.65)).sum())),
jaw=("jaw", "mean"), nose=("nose", "mean"))
print(allm.round(3).to_string())
Per mouse, kept sessions (main):
sessions jaw nose nose_above_jaw
mouse
SC026 3 0.681 0.587 0
SC027 3 0.554 0.687 3
SC035 2 0.700 0.743 2
SC038 5 0.553 0.656 4
SC043 4 0.795 0.742 0
SC050 2 0.625 0.641 1
SC053 4 0.720 0.744 2
SC061 4 0.857 0.570 0
SC065 3 0.686 0.529 0
SC066 3 0.694 0.681 2
SC067 4 0.702 0.558 0
All sessions per mouse, before the filter:
sessions passing jaw nose
mouse
SC026 3 3 0.681 0.587
SC027 6 3 0.573 0.648
SC030 3 0 0.579 0.587
SC031 2 1 0.600 0.610
SC032 3 1 0.609 0.549
SC033 3 0 0.609 0.593
SC035 4 2 0.631 0.643
SC038 10 5 0.547 0.617
SC043 4 4 0.795 0.742
SC045 5 0 0.559 0.552
SC048 8 1 0.593 0.574
SC049 6 0 0.566 0.550
SC050 7 2 0.563 0.560
SC052 2 0 0.609 0.514
SC053 5 4 0.702 0.719
SC060 4 1 0.560 0.565
SC061 4 4 0.857 0.570
SC064 8 0 0.565 0.544
SC065 8 3 0.602 0.521
SC066 5 3 0.639 0.626
SC067 6 4 0.678 0.566
# Variants: decoder reading, epoch trimming, session set, threshold; each with its own null.
rows = []
auth = authors_set
for auc_kind in ["fold mean", "pooled"]:
for reading in ["a", "b"]:
for wlabel, w in [("full delay", None), ("trimmed -1.05 to -0.15", trim)]:
Av = session_aucs(reading, 0, w, auc_kind)
for slabel, sset in [("authors' 106", auth), ("clock-checked", CLOCKED), ("all decoded", None)]:
Avs = Av if sset is None else Av[Av.key.isin(sset)]
for thr in [0.6, 0.65, 0.7]:
r, _ = clustering(Avs, np.random.default_rng(SEED_FIG6E), thr)
rows.append({"auc": auc_kind, "reading": reading, "window": wlabel, "sessions_set": slabel,
"threshold": thr, "n_sessions_decoded": len(Avs), **r})
variants = pd.DataFrame(rows)
print(variants.round(4).to_string(index=False))
for auc_kind in ["fold mean", "pooled"]:
x = variants[variants.auc == auc_kind]
print(f"{auc_kind}: CH from {x.ch.min():.2f} to {x.ch.max():.2f}; largest p {x.p.max():.3f}; "
f"variants within 11.31 to 13.83: {int(x.ch.between(11.31, 13.83).sum())} of {len(x)}")
x = variants[(variants.reading == "a") & (variants.window == "full delay") & (variants.threshold == 0.65)]
print("\nReading (a), full delay, threshold 0.65, pooled against fold-mean AUC:")
print(x[["auc", "sessions_set", "sessions", "mice", "ch", "null_mean", "p", "nose_mice", "jaw_mice"]].round(3).to_string(index=False))
kp = {}
for auc_kind in ["fold mean", "pooled"]:
_, k = clustering(session_aucs("a", 0, None, auc_kind).pipe(lambda d: d[d.key.isin(auth)]), np.random.default_rng(SEED_FIG6E))
kp[auc_kind] = set(k.key)
print("Authors' 106, sessions kept under both AUC readings:", len(kp["fold mean"] & kp["pooled"]),
"; only under fold mean:", len(kp["fold mean"] - kp["pooled"]), "; only under pooled:", len(kp["pooled"] - kp["fold mean"]))
auc reading window sessions_set threshold n_sessions_decoded sessions mice ch null_mean null_sd p nose_mice jaw_mice
fold mean a full delay authors' 106 0.60 106 60 16 6.1554 1.0222 0.3359 0.000 4 10
fold mean a full delay authors' 106 0.65 106 37 11 6.8278 1.0324 0.4190 0.000 4 5
fold mean a full delay authors' 106 0.70 106 17 6 4.2963 1.0655 0.5823 0.000 1 4
fold mean a full delay clock-checked 0.60 166 102 25 4.3796 1.0108 0.2635 0.000 6 17
fold mean a full delay clock-checked 0.65 166 56 15 5.6440 1.0289 0.3160 0.000 4 10
fold mean a full delay clock-checked 0.70 166 34 10 3.5909 1.0403 0.4220 0.000 1 8
fold mean a full delay all decoded 0.60 172 108 26 4.1739 1.0156 0.2448 0.000 7 18
fold mean a full delay all decoded 0.65 172 56 15 5.6440 1.0289 0.3160 0.000 4 10
fold mean a full delay all decoded 0.70 172 34 10 3.5909 1.0403 0.4220 0.000 1 8
fold mean a trimmed -1.05 to -0.15 authors' 106 0.60 106 62 16 5.4304 1.0293 0.3110 0.000 5 9
fold mean a trimmed -1.05 to -0.15 authors' 106 0.65 106 36 11 5.8535 1.0603 0.3958 0.000 4 5
fold mean a trimmed -1.05 to -0.15 authors' 106 0.70 106 19 7 4.8458 1.0797 0.5599 0.000 1 5
fold mean a trimmed -1.05 to -0.15 clock-checked 0.60 166 104 25 3.8962 1.0032 0.2508 0.000 6 16
fold mean a trimmed -1.05 to -0.15 clock-checked 0.65 166 58 16 4.6808 1.0256 0.3227 0.000 5 10
fold mean a trimmed -1.05 to -0.15 clock-checked 0.70 166 35 11 3.9949 1.0560 0.4336 0.001 1 9
fold mean a trimmed -1.05 to -0.15 all decoded 0.60 172 110 26 3.8554 1.0341 0.2577 0.000 6 18
fold mean a trimmed -1.05 to -0.15 all decoded 0.65 172 58 16 4.6808 1.0256 0.3227 0.000 5 10
fold mean a trimmed -1.05 to -0.15 all decoded 0.70 172 35 11 3.9949 1.0560 0.4336 0.001 1 9
fold mean b full delay authors' 106 0.60 106 64 17 6.4359 1.0309 0.3151 0.000 3 12
fold mean b full delay authors' 106 0.65 106 38 11 6.4088 1.0298 0.3878 0.000 3 7
fold mean b full delay authors' 106 0.70 106 17 6 4.2400 1.0618 0.5723 0.000 1 4
fold mean b full delay clock-checked 0.60 166 107 26 4.7633 1.0178 0.2614 0.000 5 17
fold mean b full delay clock-checked 0.65 166 61 17 5.2968 1.0271 0.3119 0.000 4 12
fold mean b full delay clock-checked 0.70 166 34 10 3.5230 1.0395 0.4236 0.000 1 8
fold mean b full delay all decoded 0.60 172 112 26 4.7804 1.0094 0.2493 0.000 6 18
fold mean b full delay all decoded 0.65 172 61 17 5.2968 1.0271 0.3119 0.000 4 12
fold mean b full delay all decoded 0.70 172 34 10 3.5230 1.0395 0.4236 0.000 1 8
fold mean b trimmed -1.05 to -0.15 authors' 106 0.60 106 67 18 4.8489 1.0148 0.2964 0.000 4 12
fold mean b trimmed -1.05 to -0.15 authors' 106 0.65 106 36 11 7.9069 1.0464 0.4248 0.000 3 7
fold mean b trimmed -1.05 to -0.15 authors' 106 0.70 106 20 7 4.9934 1.0926 0.5770 0.000 1 5
fold mean b trimmed -1.05 to -0.15 clock-checked 0.60 166 110 26 4.1174 1.0231 0.2569 0.000 5 16
fold mean b trimmed -1.05 to -0.15 clock-checked 0.65 166 62 18 6.0635 1.0285 0.3093 0.000 4 13
fold mean b trimmed -1.05 to -0.15 clock-checked 0.70 166 37 11 3.7466 1.0414 0.4157 0.000 1 9
fold mean b trimmed -1.05 to -0.15 all decoded 0.60 172 115 26 4.2787 1.0082 0.2495 0.000 6 17
fold mean b trimmed -1.05 to -0.15 all decoded 0.65 172 64 19 5.8155 1.0398 0.3158 0.000 4 13
fold mean b trimmed -1.05 to -0.15 all decoded 0.70 172 37 11 3.7466 1.0414 0.4157 0.000 1 9
pooled a full delay authors' 106 0.60 106 53 14 7.1258 1.0399 0.3445 0.000 3 9
pooled a full delay authors' 106 0.65 106 36 11 7.6324 1.0668 0.4082 0.000 3 6
pooled a full delay authors' 106 0.70 106 17 6 4.3635 1.0682 0.5890 0.000 1 4
pooled a full delay clock-checked 0.60 166 94 24 4.3576 1.0239 0.2691 0.000 5 16
pooled a full delay clock-checked 0.65 166 55 15 5.9211 1.0230 0.3319 0.000 3 11
pooled a full delay clock-checked 0.70 166 34 10 3.6209 1.0320 0.4524 0.003 1 8
pooled a full delay all decoded 0.60 172 100 25 4.1598 1.0272 0.2686 0.000 5 18
pooled a full delay all decoded 0.65 172 55 15 5.9211 1.0230 0.3319 0.000 3 11
pooled a full delay all decoded 0.70 172 34 10 3.6209 1.0320 0.4524 0.003 1 8
pooled a trimmed -1.05 to -0.15 authors' 106 0.60 106 58 15 5.8905 1.0357 0.3355 0.000 4 9
pooled a trimmed -1.05 to -0.15 authors' 106 0.65 106 35 11 7.4894 1.0362 0.4014 0.000 4 6
pooled a trimmed -1.05 to -0.15 authors' 106 0.70 106 17 6 4.3346 1.0690 0.5879 0.000 1 4
pooled a trimmed -1.05 to -0.15 clock-checked 0.60 166 98 25 3.7051 1.0248 0.2599 0.000 6 17
pooled a trimmed -1.05 to -0.15 clock-checked 0.65 166 55 15 5.6851 1.0243 0.3362 0.000 4 10
pooled a trimmed -1.05 to -0.15 clock-checked 0.70 166 33 10 3.6847 1.0600 0.4481 0.000 1 8
pooled a trimmed -1.05 to -0.15 all decoded 0.60 172 104 26 3.6895 1.0159 0.2527 0.000 6 19
pooled a trimmed -1.05 to -0.15 all decoded 0.65 172 55 15 5.6851 1.0243 0.3362 0.000 4 10
pooled a trimmed -1.05 to -0.15 all decoded 0.70 172 33 10 3.6847 1.0600 0.4481 0.000 1 8
pooled b full delay authors' 106 0.60 106 60 16 6.5292 1.0269 0.3384 0.000 4 11
pooled b full delay authors' 106 0.65 106 36 11 7.9051 1.0635 0.4072 0.000 3 6
pooled b full delay authors' 106 0.70 106 15 5 5.1449 1.1462 0.7621 0.003 1 4
pooled b full delay clock-checked 0.60 166 101 25 4.6230 1.0205 0.2584 0.000 5 17
pooled b full delay clock-checked 0.65 166 55 15 6.1319 1.0243 0.3327 0.000 3 11
pooled b full delay clock-checked 0.70 166 31 9 4.2579 1.0421 0.4646 0.000 1 8
pooled b full delay all decoded 0.60 172 107 26 4.4531 1.0101 0.2588 0.000 6 18
pooled b full delay all decoded 0.65 172 55 15 6.1319 1.0243 0.3327 0.000 3 11
pooled b full delay all decoded 0.70 172 31 9 4.2579 1.0421 0.4646 0.000 1 8
pooled b trimmed -1.05 to -0.15 authors' 106 0.60 106 61 16 6.0242 1.0153 0.3125 0.000 4 11
pooled b trimmed -1.05 to -0.15 authors' 106 0.65 106 34 11 7.6819 1.0463 0.3964 0.000 4 6
pooled b trimmed -1.05 to -0.15 authors' 106 0.70 106 15 5 5.2225 1.1486 0.7636 0.002 1 4
pooled b trimmed -1.05 to -0.15 clock-checked 0.60 166 102 25 4.2433 1.0044 0.2480 0.000 5 17
pooled b trimmed -1.05 to -0.15 clock-checked 0.65 166 56 16 5.9810 1.0439 0.3146 0.000 4 11
pooled b trimmed -1.05 to -0.15 clock-checked 0.70 166 30 9 4.3088 1.0684 0.4645 0.000 1 8
pooled b trimmed -1.05 to -0.15 all decoded 0.60 172 106 26 4.0963 1.0086 0.2586 0.000 5 19
pooled b trimmed -1.05 to -0.15 all decoded 0.65 172 56 16 5.9810 1.0439 0.3146 0.000 4 11
pooled b trimmed -1.05 to -0.15 all decoded 0.70 172 30 9 4.3088 1.0684 0.4645 0.000 1 8
fold mean: CH from 3.52 to 7.91; largest p 0.001; variants within 11.31 to 13.83: 0 of 36
pooled: CH from 3.62 to 7.91; largest p 0.003; variants within 11.31 to 13.83: 0 of 36
Reading (a), full delay, threshold 0.65, pooled against fold-mean AUC:
auc sessions_set sessions mice ch null_mean p nose_mice jaw_mice
fold mean authors' 106 37 11 6.828 1.032 0.0 4 5
fold mean clock-checked 56 15 5.644 1.029 0.0 4 10
fold mean all decoded 56 15 5.644 1.029 0.0 4 10
pooled authors' 106 36 11 7.632 1.067 0.0 3 6
pooled clock-checked 55 15 5.921 1.023 0.0 3 11
pooled all decoded 55 15 5.921 1.023 0.0 3 11
Authors' 106, sessions kept under both AUC readings: 35 ; only under fold mean: 1 ; only under pooled: 0
# Seed check: the decoders' splits and the null under the claim's seed and seed + 1000 ... 4000.
rows = []
for off in mv.SEED_OFFSETS:
Ao = session_aucs("a", off)
for slabel, sset in [("authors' 106", auth), ("clock-checked", CLOCKED)]:
Aos = Ao[Ao.key.isin(sset)]
r, _ = clustering(Aos, np.random.default_rng(SEED_FIG6E + off))
rows.append({"seed_offset": off, "sessions_set": slabel, **r})
seeds = pd.DataFrame(rows)
print(seeds.round(4).to_string(index=False))
print("Clock-flagged sessions among the authors' 106:", sorted(CLOCK_FLAGGED & auth))
for slabel in ["authors' 106", "clock-checked"]:
x = seeds[seeds.sessions_set == slabel]
print(f"{slabel}: CH from {x.ch.min():.3f} to {x.ch.max():.3f}; p from {x.p.min():.3f} to {x.p.max():.3f}")
seed_offset sessions_set sessions mice ch null_mean null_sd p nose_mice jaw_mice
0 authors' 106 37 11 6.8278 1.0324 0.4190 0.0 4 5
0 clock-checked 56 15 5.6440 1.0289 0.3160 0.0 4 10
1000 authors' 106 39 12 7.8242 1.0475 0.3896 0.0 4 5
1000 clock-checked 61 17 6.7225 1.0179 0.3079 0.0 5 11
2000 authors' 106 37 11 6.6830 1.0287 0.4019 0.0 4 5
2000 clock-checked 60 17 5.6261 1.0211 0.3061 0.0 4 12
3000 authors' 106 36 11 7.8009 1.0331 0.4028 0.0 3 6
3000 clock-checked 57 16 5.9020 1.0422 0.3376 0.0 4 11
4000 authors' 106 37 11 7.0689 1.0416 0.4188 0.0 4 5
4000 clock-checked 60 17 5.7927 1.0169 0.3244 0.0 5 11
Clock-flagged sessions among the authors' 106: []
authors' 106: CH from 6.683 to 7.824; p from 0.000 to 0.000
clock-checked: CH from 5.626 to 6.723; p from 0.000 to 0.000
Result: partially reproduced. Over the authors' 106 sessions (106 dataset files, none of them flagged by the clock check), with the session AUC as the mean of the test-fold AUCs, 37 sessions of 11 mice pass the paper's filter, and their nose and jaw AUCs cluster by mouse: Calinski-Harabasz score 6.83 against a null of 1.03 ± 0.42 s.d. (paper 1.05 ± 0.54), and no shuffled score reaches it (p < 0.001). Both kinds of mice occur: 4 mice have the nose above the jaw in most of their kept sessions and 5 the jaw above the nose (2 are even). The score is about half the paper's 12.57 and outside its tolerance (11.31 to 13.83); the null mean is within its own. With one AUC over the pooled out-of-fold predictions the score is 7.63 (36 sessions, 11 mice; 35 sessions are kept under both readings). Over all 72 variants printed (AUC reading, decoder reading, epoch trimming, session set, threshold) it ranges from 3.52 to 7.91, never within tolerance, with p of at most 0.003. Under the five seeds the score is 6.68 to 7.82 on the authors' sessions (5.63 to 6.72 on the clock-checked ones) and p < 0.001 throughout, so the outcome does not depend on the seed. The mouse-specific structure is present and significant, but weaker under this decoder than the paper reports. The decoder is itself weaker than the paper's: its mean delay-epoch AUCs are 0.614 for the jaw and 0.590 for the nose, and for the better of the two markers its response-epoch AUC is 0.754 against the paper's 0.88 (see the marker half of fig6-marker-vs-embedding-decoding below), so the lower score may come from the decoder and not from the data.
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.
Blocked claims¶
Every other claim needs the paper's video embedding, its end-to-end networks, or the choice decoder run on the embedding (Figs. 6 and 7). None of these is in the pinned version, and none is in a pinned outside deposit; the raw video is in the later version for 34 of the authors' 106 sessions only, and reading even those does not fit (data check). The claims and the reason for each are in the attempt record.
Marker half of fig6-marker-vs-embedding-decoding (not an outcome)¶
Single markers predict choice less well than the full-video embedding in the response epoch (AUC 0.88 against 0.96).
The claim compares the markers with the embedding, which cannot be computed here, so it stays blocked. Its marker half needs only the markers and is computed here with the same decoder as Fig. 6e (reading (a), five-frame window, L2 logistic regression with a nested choice of penalty, correct trials, 20-fold stratified cross-validation), under the claim's seed only, on the authors' 106 sessions. The claims file's readings are run: the window, (a) the whole response epoch (0 to 1.5 s) or (b) its second half; the features, (a) the jaw and nose markers each alone, taking the better per session, (b) the jaw alone, (c) all three markers together (tongue set to its mean while not visible). Both session-AUC readings (fold mean, pooled) are shown.
bt_r = mv.bin_times(mv.RESPONSE)
half2 = bt_r >= 0.75
print("Response-epoch bins (s from the go cue):", np.round(bt_r, 3).tolist())
resp = [s for s in S if s["auc_resp"] and s["key"] in authors_set]
print("Authors' 106: dataset files with response-epoch decoding:", len(resp), "; files without:",
sorted(s["key"] for s in S if s["key"] in authors_set and not s["auc_resp"]))
rows = []
for auc_kind, key in [("fold mean", "auc_resp_fold"), ("pooled", "auc_resp")]:
for wlabel, w in [("whole response epoch", np.ones(len(bt_r), bool)), ("second half", half2)]:
per = pd.DataFrame([{"key": s["key"], **{n: s[key][n][w].mean() if n in s[key] else np.nan
for n in ("Jaw", "Nose", "All")}} for s in resp],
columns=["key", "Jaw", "Nose", "All"])
per["better of jaw and nose"] = per[["Jaw", "Nose"]].max(1)
for flabel, col in [("better of jaw and nose", "better of jaw and nose"), ("jaw", "Jaw"), ("all three markers", "All")]:
v = per[col].dropna()
rows.append({"auc": auc_kind, "window": wlabel, "features": flabel, "n_sessions": len(v),
"mean": v.mean(), "sem": v.std(ddof=1) / np.sqrt(len(v)), "min": v.min(), "max": v.max(),
"within_0.87_to_0.89": bool(abs(v.mean() - 0.88) <= 0.01)})
marker_resp = pd.DataFrame(rows)
print(marker_resp.round(3).to_string(index=False))
print("Paper: marker 0.88 +/- 0.01 s.e.m., n = 106 sessions (embedding 0.96)")
print("Trials with marker frames over the response epoch, summed over these files:",
sum(s["n_resp_trials"]["All"] for s in resp), "of", sum(s["n_correct"] for s in resp), "correct trials")
Response-epoch bins (s from the go cue): [0.0, 0.068, 0.136, 0.204, 0.272, 0.34, 0.408, 0.476, 0.544, 0.612, 0.68, 0.748, 0.816, 0.884, 0.952, 1.02, 1.088, 1.156, 1.224, 1.292, 1.36, 1.428]
Authors' 106: dataset files with response-epoch decoding: 106 ; files without: []
auc window features n_sessions mean sem min max within_0.87_to_0.89
fold mean whole response epoch better of jaw and nose 106 0.754 0.006 0.619 0.896 False
fold mean whole response epoch jaw 106 0.732 0.007 0.570 0.880 False
fold mean whole response epoch all three markers 106 0.819 0.005 0.713 0.955 False
fold mean second half better of jaw and nose 106 0.754 0.008 0.548 0.940 False
fold mean second half jaw 106 0.725 0.009 0.543 0.940 False
fold mean second half all three markers 106 0.798 0.008 0.591 0.966 False
pooled whole response epoch better of jaw and nose 106 0.749 0.006 0.603 0.892 False
pooled whole response epoch jaw 106 0.726 0.007 0.565 0.876 False
pooled whole response epoch all three markers 106 0.813 0.006 0.707 0.951 False
pooled second half better of jaw and nose 106 0.747 0.008 0.537 0.938 False
pooled second half jaw 106 0.718 0.010 0.529 0.938 False
pooled second half all three markers 106 0.792 0.009 0.582 0.963 False
Paper: marker 0.88 +/- 0.01 s.e.m., n = 106 sessions (embedding 0.96)
Trials with marker frames over the response epoch, summed over these files: 27806 of 27806 correct trials
Not an outcome: fig6-marker-vs-embedding-decoding stays blocked, as it compares the markers with the embedding. On the authors' 106 sessions, with the test-fold AUCs averaged, the better of the jaw and nose markers gives a response-epoch choice AUC of 0.754 ± 0.006 s.e.m. (0.754 ± 0.008 over the second half), the jaw alone 0.732 ± 0.007 (0.725 ± 0.009), and all three markers together 0.819 ± 0.005 (0.798 ± 0.008); the pooled AUCs are within 0.007 of these. Every reading is below the paper's 0.88 ± 0.01 and outside its tolerance, so the marker half falls short under this decoder, whose details the paper does not give.
Summary¶
| Claim | Outcome |
|---|---|
| link-authors-deposit (link) | reproduced |
| data-scale | reproduced |
| fig6e-marker-clustering | partially reproduced |
| The other 27 claims (Figs. 2 to 7, Extended Data Figs. 1 to 10, Supplementary Discussion) | blocked: data_missing |
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 paper's embedding, its end-to-end networks and
its embedding-based choice decoder could not be computed: the cited version has no video, the later
version has video for 34 of the 106 sessions the authors used and none for the other 72, and the
authors' per-frame embeddings are in no pinned deposit. Only the claims that rest on the markers or
on unit counts were tested. Structures for data-scale are the major Allen divisions with isocortex
split into ALM and other isocortex, each unit counted once. The marker choice decoder of Fig. 6e is
not described in the paper and its code is not public; the claims file's two readings were run
(five-frame window and single frame, L2 logistic regression with a nested choice of penalty) and
give the same outcome. The session AUC averages the test-fold AUCs (pooled out-of-fold AUCs are a
variant with the same outcome), computed every 68 ms in the delay epoch, not every frame. The 2 Hz
filter uses the dataset's whole-session avg_firing_rate, not the rate over included trials. The
main session set for Fig. 6e is the authors' 106 sessions, from their deposit; the 167 sessions that
pass the clock check (166 of them decoded) are a variant.
What was found about the dataset. In five sessions (SC011 and SC022, February 2019) the marker
timestamps run twice as fast as the video: the frames are 6.8 ms apart, not 3.4 ms, and only with
the stretch do the tongue markers meet the lick events; their trial videos hold half the frames of
the same mice's other sessions over trials of the same length. In SC026_080719 117 trial videos do not
match the lick events, SC066_041321 has markers for 7 trial videos only, and SC065_050521 lacks
marker frames for 140 of its 354 correct trials. Elsewhere the timestamps
step by exactly 3.4 ms (294 Hz, where the paper says 300 Hz). Only units with classification
good have a CCF annotation, so 92,769 of the 154,948 unit_quality good units have no location.
The version the paper cites has no video and no embedding; the later version adds the raw video for
71 sessions of 16 mice, 34 of them among the authors' 106. The dataset holds 174 sessions of 28 mice,
of which the authors used 106 sessions of 21 mice for Figs. 6 and 7, a selection the paper does not
describe.