Reproducing Gillon, Lecoq et al. (2023) from dandiset 000037¶
Paper. Gillon CJ, Lecoq JA, Pina JE, et al. (2023). Responses of pyramidal cell somata and
apical dendrites in mouse visual cortex over multiple days. Scientific Data 10, 287.
doi:10.1038/s41597-023-02214-y. A data descriptor.
The claims file (claims/000037/10.1038-s41597-023-02214-y.yaml) was written from the version of
record as served by Europe PMC (PMC10192216), with Supplementary Table 1 read as metadata.csv of
the authors' metadata repository.
Dandiset. DANDI:000037, version
0.230426.0054. The paper cites this version: its reference 13 carries the DOI
10.48324/DANDI.000037/0.230426.0054 (in the Crossref record of the article; the Europe PMC text
prints the reference without it). The later version 0.240209.1623 holds the same 150 NWB files
with the same blobs, and adds a CHANGES file and links to the papers in its metadata (shown in
the data check). Only the basic files (behavior+ophys) are opened; each is streamed into memory
once and nothing is written to disk.
Outside inputs, all pinned and named in the helper openscope_ca.py: Supplementary Table 1
(metadata.csv of jeromelecoq/allen_openscope_metadata at commit 0e9c7ac), used for Tables 1 and
2 and for the local session numbers and QC results that select the paper's 33 analysed sessions;
and from the paper's repository colleenjg/OpenScope_CA_Analysis at commit 046e7fe, the ROI
matching files of the Fig. 8 example mice and the source data of Fig. 7a. Supplementary Table 1
agrees with Tables 1 and 2 of the paper text in every field (checked while preparing this entry,
not run here).
| Claim | Tested |
|---|---|
| table1-subjects, cohorts-by-plane, sex-split, sessions-total, table2-sessions | tested |
| qc-failures | blocked: no QC status in the dataset |
| session-schedule, imaging-depths, acquisition-rates | tested |
| roi-noise-rejection, roi-count-ranges | tested |
| tracked-roi-totals, tracked-sessions-overlap, fig8a-final-matches, fig8b-final-matches | tested |
| fig8a-conflicts, fig8b-conflicts (with the paper's ROI matching files) | tested |
| fig8-somata-less-order-dependent | blocked: per-ordering counts published for two mice only |
| gabor-sequence-structure, visual-flow-structure, session-stimulus-durations | tested |
| inconsistent-fractions, inconsistent-blocks | tested |
| fig5-example-responses | tested; blocked, its three Gabor panel readings disagree |
| fig5-consistent-vs-inconsistent | tested; blocked as it depends on fig5-example-responses |
| fig6-behaviour-all-mice | tested |
| fig7a-snr-above-1 | tested |
| fig7a-snr-stable, fig7b-signal-stable | tested; blocked, the criterion's readings disagree |
| fig7c-correlations-similar | tested; blocked, the criterion's readings disagree |
| fig7c-high-correlation-fraction | tested; blocked as it depends on fig7c-correlations-similar |
| fig7a-source-link (with the paper's Fig. 7a source data) | tested |
| fig9-onset-offset-transients | tested |
| file-sizes, download-33-files | tested |
The analysis streams about 25 GB and takes about 11 minutes (cell 2 prints the time taken to stream and reduce the files).
import ast
import time
import warnings
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.stats
import openscope_ca as oc
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)
# LOAD-CELL: stream the 50 basic files once each and reduce them to what the claims use.
started = time.time()
assets = oc.version_assets()
latest = oc.version_assets(oc.LATEST_VERSION)
supp = oc.supplementary_table()
supp["session_id"] = supp.session_id.astype(str)
supp["subject_id"] = supp.subject_id.astype(str)
basic = assets[assets.kind == "B"].reset_index(drop=True)
basic["url"] = oc.run_parallel(oc.s3_url, basic.asset_id.tolist(), workers=8)
basic = basic.merge(supp[["session_id", "local_session_n", "QC"]], left_on="session",
right_on="session_id", how="left")
# The paper's analyses use local sessions 1 to 3 that passed QC (Supplementary Table 1), as the
# claims file states; correlations are computed for those, Fig. 5 measures for their session 1.
basic["analysed"] = (basic.local_session_n <= 3) & (basic.QC == "passed")
order = np.argsort(basic["size"].to_numpy())[::-1]
def job(i):
r = basic.iloc[i]
return oc.analyse(r.url, masks=True, corr=bool(r.analysed),
fig5=bool(r.analysed and r.local_session_n == 1))
done = oc.run_parallel(job, order.tolist(), weights=basic["size"].to_numpy()[order] / 1e9,
workers=4, budget=3.0)
S, R = {}, {}
for k, i in enumerate(order):
S[basic.session[i]], R[basic.session[i]] = done[k]
print(f"streamed {len(S)} basic files ({basic['size'].sum() / 1e9:.1f} GB) of dandiset "
f"{oc.DANDISET_ID} version {oc.DANDISET_VERSION} in {time.time() - started:.0f} s")
streamed 50 basic files (25.2 GB) of dandiset 000037 version 0.230426.0054 in 667 s
Data check¶
Each check of the metadata against the values is stated under its output.
print("Assets at", oc.DANDISET_VERSION, ":", len(assets), "; at", oc.LATEST_VERSION, ":", len(latest))
both = assets.merge(latest, on="path", how="outer", suffixes=("_pinned", "_latest"), indicator=True)
print("Paths only in the latest version:", both.path[both._merge == "right_only"].tolist())
print("Paths only in the pinned version:", both.path[both._merge == "left_only"].tolist())
same = both[both._merge == "both"]
print("Common paths with a different blob:", int((same.blob_pinned != same.blob_latest).sum()), "of", len(same))
print("\nAssets by file version (B basic, I with stimulus images, S with imaging stack):")
print(assets.kind.value_counts(dropna=False).to_string())
per = assets.dropna(subset=["kind"]).pivot_table(index="session", columns="kind", values="size", aggfunc="count")
print("Sessions:", len(per), "; sessions with all three versions:", int((per.fillna(0) == 1).all(axis=1).sum()))
print("Subject folders:", assets.path.str.split("/").str[0].nunique())
Assets at 0.230426.0054 : 150 ; at 0.240209.1623 : 151 Paths only in the latest version: ['CHANGES'] Paths only in the pinned version: [] Common paths with a different blob: 0 of 150 Assets by file version (B basic, I with stimulus images, S with imaging stack): kind I 50 B 50 S 50 Sessions: 50 ; sessions with all three versions: 50 Subject folders: 13
The two published versions hold the same 150 NWB files, with the same blobs; 0.240209.1623 adds a CHANGES file and links to the two papers in its metadata. Nothing the analysis uses differs.
rows = []
for sid, s in S.items():
loc = ast.literal_eval(s["location"]) if s["location"].startswith("{") else {}
start = pd.Timestamp(s["session_start_time"])
rows.append({
"session": sid, "subject": s["subject_id"], "identifier": s["identifier"],
"start": s["session_start_time"], "date_file": start.strftime("%Y%m%d"),
# The same clock read as UTC (Supplementary Table 1 gives these clock values as UTC),
# converted to the Allen Institute's time zone.
"date_if_utc": start.tz_localize(None).tz_localize("UTC").tz_convert("America/Los_Angeles").strftime("%Y%m%d"),
"start_naive": start.tz_localize(None),
"area": loc.get("area"), "depth": int(loc.get("depth")), "genotype": s["genotype"],
"sex": s["sex"], "age_days": int(s["age"].strip("PD")), "species": s["species"],
"n_rois": s["dff_shape"][1], "n_frames": s["dff_shape"][0],
"n_tracked": int(np.isfinite(s["tracking_id"]).sum()),
"imaging_rate_stated": s["imaging_rate"], "fps_2p": 1 / np.median(np.diff(s["dff_t"])),
"fps_run": 1 / np.median(np.diff(s["run_t"])), "fps_pupil": 1 / np.median(np.diff(s["pupil_t"])),
"indicator": s["indicator"], "excitation_nm": s["excitation_lambda"],
"mask_shape": s["mask_shape"][1:], "max_proj_shape": s["max_projection_shape"]})
sess = pd.DataFrame(rows).sort_values(["subject", "start_naive"]).set_index("session")
sess["line"] = sess.genotype.map(lambda g: "L2/3" if g.startswith("Cux2") else "L5" if g.startswith("Rbp4") else "?")
# Plane from the recorded depth: layer 1 (dendrites) at 20 to 75 um, cell body layers at 175 and 375 um (Methods).
sess["plane"] = np.where(sess.depth < 100, "D", "S")
sess["group"] = sess.line + "-" + sess.plane
sess["local_n"] = sess.groupby("subject").cumcount() + 1
sess = sess.join(supp.set_index("session_id")[["local_session_n", "QC", "imaging_plane", "imaging_cell_layer"]])
sess["analysed"] = (sess.local_n <= 3) & (sess.QC == "passed")
print("Subjects:", sess.subject.nunique(), "; sessions:", len(sess), "; species:", sess.species.unique().tolist())
print("Session id equals file identifier and the id in the file name:", bool((sess.index == sess.identifier).all()))
print("Chronological session number equals Supplementary Table 1's local session number:",
bool((sess.local_n == sess.local_session_n).all()))
print("Plane from depth equals Supplementary Table 1's plane:",
bool((sess.plane.map({"D": "distal_apical_dendrites", "S": "somata"}) == sess.imaging_plane).all()))
print("Layer from genotype equals Supplementary Table 1's layer:", bool((sess.line == sess.imaging_cell_layer).all()))
print("\nSessions per subject and group:")
print(sess.groupby(["group", "subject"]).size().to_string())
print("\nAnalysed sessions (local 1 to 3, passed QC):", int(sess.analysed.sum()), "from",
sess[sess.analysed].subject.nunique(), "mice")
print(sess[["subject", "group", "start", "depth", "sex", "age_days", "n_rois", "n_tracked", "local_n", "QC"]].to_string())
Subjects: 13 ; sessions: 50 ; species: ['Mus musculus']
Session id equals file identifier and the id in the file name: True
Chronological session number equals Supplementary Table 1's local session number: True
Plane from depth equals Supplementary Table 1's plane: True
Layer from genotype equals Supplementary Table 1's layer: True
Sessions per subject and group:
group subject
L2/3-D 412933 6
413663 3
433414 3
L2/3-S 408021 3
411424 3
440889 6
L5-D 411400 6
420011 3
433448 4
433451 3
L5-S 411771 3
418779 3
433458 4
Analysed sessions (local 1 to 3, passed QC): 33 from 11 mice
subject group start depth sex age_days n_rois n_tracked local_n QC
session
758519303 408021 L2/3-S 2018-09-26T17:29:17.502000-07:00 175 M 95 96 59 1 passed
759189643 408021 L2/3-S 2018-09-27T18:26:32.037000-07:00 175 M 96 74 59 2 passed
759660390 408021 L2/3-S 2018-10-01T17:28:33.473000-07:00 175 M 100 107 59 3 passed
759666166 411400 L5-D 2018-10-01T18:02:56.523000-07:00 20 F 82 942 0 1 failed
759872185 411400 L5-D 2018-10-02T17:37:40.969000-07:00 20 F 83 289 0 2 failed
760269100 411400 L5-D 2018-10-03T18:02:53.798000-07:00 20 F 84 524 0 3 failed
761730740 411400 L5-D 2018-10-09T17:50:37.303000-07:00 20 F 90 630 162 4 passed
762415169 411400 L5-D 2018-10-11T17:40:57.661000-07:00 20 F 92 637 162 5 passed
763646681 411400 L5-D 2018-10-15T17:34:10.772000-07:00 20 F 96 597 162 6 passed
761624763 411424 L2/3-S 2018-10-09T15:22:54.883000-07:00 175 F 90 87 55 1 passed
761944562 411424 L2/3-S 2018-10-10T16:02:30.772000-07:00 175 F 91 90 55 2 passed
762250376 411424 L2/3-S 2018-10-11T15:59:36.175000-07:00 175 F 92 80 55 3 passed
760260459 411771 L5-S 2018-10-03T17:48:57.633000-07:00 375 M 82 90 47 1 passed
760659782 411771 L5-S 2018-10-04T17:38:16.282000-07:00 375 M 83 70 47 2 passed
761269197 411771 L5-S 2018-10-08T17:29:46.277000-07:00 375 M 87 79 47 3 passed
763949859 412933 L2/3-D 2018-10-16T22:02:26.850000-07:00 75 M 90 1041 0 1 failed
764897534 412933 L2/3-D 2018-10-17T22:15:05.815000-07:00 75 M 91 948 0 2 failed
765427689 412933 L2/3-D 2018-10-19T00:18:29.755000-07:00 75 M 92 836 0 3 failed
766755831 412933 L2/3-D 2018-10-22T22:51:31.646000-07:00 50 M 96 344 98 4 passed
767254594 412933 L2/3-D 2018-10-23T22:09:32.146000-07:00 50 M 97 168 98 5 passed
768807532 412933 L2/3-D 2018-10-25T22:27:58.489000-07:00 50 M 99 250 98 6 passed
764704289 413663 L2/3-D 2018-10-17T17:33:52.414000-07:00 50 M 88 628 136 1 passed
765193831 413663 L2/3-D 2018-10-18T17:30:52.785000-07:00 50 M 89 348 136 2 passed
766502238 413663 L2/3-D 2018-10-22T17:28:24.170000-07:00 50 M 93 512 136 3 passed
777496949 418779 L5-S 2018-11-13T01:51:48.328000-08:00 375 F 84 15 12 1 passed
778374308 418779 L5-S 2018-11-14T03:01:41.368000-08:00 375 F 85 26 12 2 passed
779152062 418779 L5-S 2018-11-15T01:06:09.988000-08:00 375 F 86 29 12 3 passed
777914830 420011 L5-D 2018-11-13T18:05:12.056000-08:00 20 F 79 205 51 1 passed
778864809 420011 L5-D 2018-11-14T18:06:24.853000-08:00 20 F 80 159 51 2 passed
779650018 420011 L5-D 2018-11-15T18:36:54.040000-08:00 20 F 81 182 51 3 passed
826187862 433414 L2/3-D 2019-02-20T21:26:44.454000-08:00 60 F 106 727 118 1 passed
826773996 433414 L2/3-D 2019-02-21T20:28:14.334000-08:00 60 F 107 300 118 2 passed
827833392 433414 L2/3-D 2019-02-22T22:18:48.574000-08:00 60 F 108 333 118 3 passed
826338612 433448 L5-D 2019-02-20T23:06:30.024000-08:00 20 M 106 1636 112 1 passed
826819032 433448 L5-D 2019-02-21T22:06:34.073000-08:00 20 M 107 445 112 2 passed
828816509 433448 L5-D 2019-02-25T21:49:52.435000-08:00 20 M 111 496 112 3 passed
829283315 433448 L5-D 2019-02-26T22:43:01.372000-08:00 20 M 112 436 0 4 passed
823453391 433451 L5-D 2019-02-15T16:53:28.746000-08:00 20 M 101 966 353 1 passed
824434038 433451 L5-D 2019-02-18T16:23:55.217000-08:00 20 M 104 1029 353 2 passed
825180479 433451 L5-D 2019-02-19T16:21:13.390000-08:00 20 M 105 986 353 3 passed
826659257 433458 L5-S 2019-02-21T16:28:38.330000-08:00 375 M 107 99 70 1 passed
827300090 433458 L5-S 2019-02-22T16:19:48.683000-08:00 375 M 108 87 70 2 passed
828475005 433458 L5-S 2019-02-25T16:22:14.668000-08:00 375 M 111 97 70 3 passed
829520904 433458 L5-S 2019-02-27T16:21:40.567000-08:00 375 M 113 88 0 4 passed
832883243 440889 L2/3-S 2019-03-06T16:39:03.280000-08:00 175 F 84 224 147 1 passed
833704570 440889 L2/3-S 2019-03-07T16:35:24.727000-08:00 175 F 85 224 147 2 passed
834403597 440889 L2/3-S 2019-03-08T16:45:55.361000-08:00 175 F 86 210 147 3 passed
836968429 440889 L2/3-S 2019-03-14T15:24:29.495000-07:00 175 F 92 205 0 4 passed
837360280 440889 L2/3-S 2019-03-15T15:22:24.904000-07:00 175 F 93 217 0 5 failed
838633305 440889 L2/3-S 2019-03-18T23:28:07.231000-07:00 175 F 96 227 0 6 failed
The files name 13 subjects and 50 sessions. Session numbers counted in order of start time within each subject equal the local session numbers of Supplementary Table 1, the plane read from the recorded depth equals the table's plane, and the layer read from the genotype equals its layer. The QC result is not in the files: the analysed sessions (local 1 to 3, passed QC) are taken from Supplementary Table 1.
print("Stated imaging rate (Hz):", sess.imaging_rate_stated.unique().tolist())
print("Two-photon rate from timestamps (Hz):", sess.fps_2p.min().round(3), "to", sess.fps_2p.max().round(3))
print("Running rate (Hz):", sess.fps_run.min().round(3), "to", sess.fps_run.max().round(3),
"; pupil rate (Hz):", sess.fps_pupil.min().round(3), "to", sess.fps_pupil.max().round(3))
print("Frames per session:", sess.n_frames.min(), "to", sess.n_frames.max(),
"; recording length (min):", round(sess.n_frames.min() / sess.fps_2p.max() / 60, 2), "to",
round(sess.n_frames.max() / sess.fps_2p.min() / 60, 2))
print("Indicator:", sess.indicator.unique().tolist(), "; excitation (nm):", sess.excitation_nm.unique().tolist(),
"; area:", sess.area.unique().tolist())
print("Mask shapes:", sess.mask_shape.astype(str).unique().tolist(), "; max projection:",
sess.max_proj_shape.astype(str).unique().tolist())
storage = pd.Series({sid: "contiguous" if S[sid]["dff_storage"][0] is None else f"{S[sid]['dff_storage'][1]}, chunks {S[sid]['dff_storage'][0]}" for sid in sess.index})
print("dF/F storage by plane:", pd.crosstab(sess.plane, storage.str.split(",").str[0]).to_dict())
chunks = [S[sid]["dff_storage"][0] for sid in sess.index if S[sid]["dff_storage"][0] is not None]
print("Chunk shapes (frames x ROIs) of the compressed files:", min(c[0] for c in chunks), "to", max(c[0] for c in chunks),
"frames by", min(c[1] for c in chunks), "to", max(c[1] for c in chunks), "ROIs")
units = pd.Series({k: {S[s][k] for s in S} for k in ("dff_unit", "run_unit", "pupil_unit", "pupil_x_unit")})
print("Stated units:", units.to_dict())
dff_ranges = pd.DataFrame({s: {"min": R[s]["roi"]["min"].min(), "median": R[s]["roi"]["median"].median(),
"max": R[s]["roi"]["max"].max()} for s in R}).T
print("dF/F over all ROIs and sessions: min", round(dff_ranges["min"].min(), 2), "; median of ROI medians",
round(dff_ranges["median"].median(), 4), "; max", round(dff_ranges["max"].max(), 2))
run = pd.DataFrame({s: {"min": np.nanmin(S[s]["run_v"]), "p1": np.nanpercentile(S[s]["run_v"], 1),
"median": np.nanmedian(S[s]["run_v"]), "p99": np.nanpercentile(S[s]["run_v"], 99),
"max": np.nanmax(S[s]["run_v"]), "nan": np.isnan(S[s]["run_v"]).mean()} for s in S}).T
pup = pd.DataFrame({s: {"min": np.nanmin(S[s]["pupil_d"]), "median": np.nanmedian(S[s]["pupil_d"]),
"max": np.nanmax(S[s]["pupil_d"]), "nan": np.isnan(S[s]["pupil_d"]).mean(),
"x_max": np.nanmax(S[s]["pupil_x"]), "y_max": np.nanmax(S[s]["pupil_y"])} for s in S}).T
print("\nRunning velocity (cm/s) over sessions:")
print(run.describe().loc[["min", "50%", "max"]].round(3).to_string())
print("\nPupil diameter and position (mm) over sessions:")
print(pup.describe().loc[["min", "50%", "max"]].round(3).to_string())
Stated imaging rate (Hz): [30.0]
Two-photon rate from timestamps (Hz): 30.075 to 30.148
Running rate (Hz): 59.952 to 59.952 ; pupil rate (Hz): 30.075 to 30.148
Frames per session: 126721 to 127588 ; recording length (min): 70.06 to 70.71
Indicator: ['GCaMP6f'] ; excitation (nm): [910.0] ; area: ['VISp']
Mask shapes: ['(512, 512)'] ; max projection: ['(512, 512)']
dF/F storage by plane: {'contiguous': {'D': 0, 'S': 22}, 'gzip': {'D': 28, 'S': 0}}
Chunk shapes (frames x ROIs) of the compressed files: 991 to 1994 frames by 5 to 26 ROIs
Stated units: {'dff_unit': {'Normalized fluorescence (A.U.)'}, 'run_unit': {'cm/s'}, 'pupil_unit': {'mm'}, 'pupil_x_unit': {'mm'}}
dF/F over all ROIs and sessions: min -10.35 ; median of ROI medians 0.0 ; max 53.51
Running velocity (cm/s) over sessions:
min p1 median p99 max nan
min -28.410 -6.256 0.007 2.242 10.826 0.0
50% -10.144 -1.367 0.081 27.453 44.618 0.0
max -2.039 5.341 33.123 68.327 88.645 0.0
Pupil diameter and position (mm) over sessions:
min median max nan x_max y_max
min 0.034 0.314 0.706 0.000 2.927 1.717
50% 0.218 0.476 0.887 0.004 3.526 2.643
max 0.530 0.678 1.131 0.049 4.465 3.354
The stated imaging rate (30 Hz) agrees with the timestamps (about 30.1 Hz), running is sampled at 60 Hz and pupil at the imaging rate. Running velocity is stated in cm/s, and its values (session medians of 0.007 to 33 cm/s, with a median of 0.08 cm/s over sessions, and 99th percentiles of 2 to 68 cm/s) are consistent with that, not shown by it. Pupil diameter is stated in mm, with medians under 1 mm; positions are within the 6.528 mm image width the files give. dF/F is stated as "Normalized fluorescence (A.U.)"; ROI medians near 0 are consistent with dF/F.
# Stimulus tables: counts by stimulus and condition, per session.
tab = []
for sid in sess.index:
t = S[sid]["trials"]
tab.append({"session": sid, "rows": len(t), "grey": int((t.stimulus_type == "grayscreen").sum()),
"gabor_images": int((t.stimulus_type == "gabors").sum()),
"U_images": int((t.gabor_frame == "U").sum()),
"flow_right": int((t.stimulus_template_name == "visflow_right").sum()),
"flow_left": int((t.stimulus_template_name == "visflow_left").sum()),
"flow_reversed": int(((t.stimulus_type == "visflow") & (t.unexpected == 1)).sum()),
"first_stimulus": t.stimulus_template_name[t.stimulus_type != "grayscreen"].iloc[0],
"stim_span_min": (t.stop_time.max() - t.start_time.min()) / 60})
tab = pd.DataFrame(tab).set_index("session")
print(tab.describe().round(2).to_string())
print("\nFirst stimulus after grey:", tab.first_stimulus.value_counts().to_dict())
print("Trial table columns:", S[sess.index[0]]["trial_columns"])
print("Stimulus types:", sorted({x for s in S.values() for x in s["trials"].stimulus_type.unique()}),
"; flow directions:", sorted({x for s in S.values() for x in s["trials"].main_flow_direction.unique() if x}))
rows grey gabor_images U_images flow_right flow_left flow_reversed stim_span_min
count 50.0 50.0 50.0 50.00 50.0 50.0 50.00 50.00
mean 8844.0 4.0 6800.0 94.72 1020.0 1020.0 95.46 70.08
std 0.0 0.0 0.0 5.64 0.0 0.0 7.62 0.07
min 8844.0 4.0 6800.0 82.00 1020.0 1020.0 80.00 70.06
25% 8844.0 4.0 6800.0 90.25 1020.0 1020.0 91.25 70.06
50% 8844.0 4.0 6800.0 94.00 1020.0 1020.0 95.00 70.06
75% 8844.0 4.0 6800.0 98.00 1020.0 1020.0 100.75 70.06
max 8844.0 4.0 6800.0 108.00 1020.0 1020.0 112.00 70.37
First stimulus after grey: {'gabors': 28, 'visflow_right': 12, 'visflow_left': 10}
Trial table columns: ['gabor_frame', 'gabor_kappa', 'gabor_locations_x', 'gabor_locations_x_index', 'gabor_locations_y', 'gabor_locations_y_index', 'gabor_mean_orientation', 'gabor_number', 'gabor_orientations', 'gabor_orientations_index', 'gabor_sizes', 'gabor_sizes_index', 'id', 'main_flow_direction', 'num_frames_stim', 'num_frames_twop', 'square_locations_x', 'square_locations_x_index', 'square_locations_y', 'square_locations_y_index', 'square_number', 'square_proportion_flipped', 'square_size', 'start_frame_stim', 'start_frame_stim_template', 'start_frame_twop', 'start_time', 'stimulus_template_name', 'stimulus_type', 'stop_frame_stim', 'stop_frame_twop', 'stop_time', 'unexpected']
Stimulus types: ['gabors', 'grayscreen', 'visflow'] ; flow directions: ['left (nasal)', 'right (temp)']
Every session holds four grey screen periods around three stimulus periods (Gabor sequences, and visual flow in each direction), in an order that varies between sessions. The trial table has no stimulus seed column, and no QC field is in the files.
# Clock check. The trial table gives each grey screen transition as a two-photon frame. For each
# session, the population mean of the robust-scaled dF/F changes across the six transitions; the
# same contrast is computed with the transitions shifted in time by 10 to 300 s (500 shifts, fixed
# seed), which keeps the response shape but breaks the alignment.
rng = np.random.default_rng(0)
def transition_contrast(pop, frames, fps):
w = int(round(fps))
vals = [abs(pop[f:f + w].mean() - pop[f - w:f].mean()) for f in frames if f - w >= 0 and f + w <= len(pop)]
return np.mean(vals)
clock = []
for sid in sess.index:
pop, fr, fps = R[sid]["popmean_scaled"], R[sid]["transitions"].frame.to_numpy(), R[sid]["fps"]
true = transition_contrast(pop, fr, fps)
shifts = rng.uniform(10, 300, 500) * rng.choice([-1, 1], 500)
null = np.array([transition_contrast(pop, fr + int(round(d * fps)), fps) for d in shifts])
clock.append({"session": sid, "true": true, "null_median": np.median(null), "null_p99": np.percentile(null, 99),
"rank": (null >= true).mean()})
clock = pd.DataFrame(clock).set_index("session")
print(clock.round(4).to_string())
print("Sessions whose true contrast exceeds every shifted one:", int((clock["rank"] == 0).sum()), "of", len(clock))
print("Sessions with the true contrast below the 99th percentile of the shifted ones:",
clock.index[clock.true <= clock.null_p99].tolist())
notes = supp.set_index("session_id")
print("Supplementary Table 1 QC and experimental notes of those sessions:")
print(notes.loc[clock.index[clock.true <= clock.null_p99], ["subject_id", "local_session_n", "QC", "experimental_notes"]].to_string())
true null_median null_p99 rank
session
758519303 0.1393 0.0508 0.1049 0.000
759189643 0.2315 0.0483 0.1009 0.000
759660390 0.1871 0.0480 0.0981 0.000
759666166 0.0581 0.0143 0.0331 0.002
759872185 0.1007 0.0174 0.0428 0.000
760269100 0.1069 0.0204 0.0475 0.000
761730740 0.1446 0.0260 0.0613 0.000
762415169 0.1187 0.0255 0.0621 0.000
763646681 0.0666 0.0227 0.0588 0.008
761624763 0.1929 0.0475 0.1182 0.000
761944562 0.1500 0.0445 0.0998 0.000
762250376 0.2359 0.0478 0.1140 0.000
760260459 0.1323 0.0558 0.1274 0.006
760659782 0.2183 0.0620 0.1237 0.000
761269197 0.2027 0.0556 0.1245 0.000
763949859 0.1072 0.0251 0.0539 0.000
764897534 0.0990 0.0253 0.0621 0.000
765427689 0.1116 0.0293 0.0694 0.002
766755831 0.0823 0.0176 0.0455 0.000
767254594 0.0734 0.0204 0.0413 0.002
768807532 0.1329 0.0190 0.0455 0.000
764704289 0.1120 0.0217 0.0507 0.000
765193831 0.0978 0.0223 0.0544 0.000
766502238 0.1121 0.0196 0.0448 0.000
777496949 0.1399 0.0725 0.1810 0.054
778374308 0.2003 0.0533 0.1374 0.000
779152062 0.2038 0.0493 0.1077 0.000
777914830 0.0554 0.0179 0.0538 0.008
778864809 0.0844 0.0175 0.0465 0.000
779650018 0.0606 0.0153 0.0402 0.006
826187862 0.0646 0.0167 0.0323 0.000
826773996 0.0857 0.0168 0.0357 0.000
827833392 0.1037 0.0176 0.0419 0.000
826338612 0.1273 0.0118 0.0346 0.000
826819032 0.1284 0.0160 0.0397 0.002
828816509 0.1260 0.0148 0.0425 0.000
829283315 0.0762 0.0171 0.0396 0.000
823453391 0.1086 0.0227 0.0530 0.000
824434038 0.0644 0.0232 0.0563 0.004
825180479 0.0611 0.0197 0.0468 0.004
826659257 0.1889 0.0539 0.1249 0.000
827300090 0.1625 0.0522 0.1224 0.000
828475005 0.2644 0.0650 0.1724 0.000
829520904 0.3207 0.0536 0.1169 0.000
832883243 0.2238 0.0492 0.0966 0.000
833704570 0.1871 0.0450 0.0980 0.000
834403597 0.2870 0.0509 0.1181 0.000
836968429 0.2692 0.0601 0.1215 0.000
837360280 0.2523 0.0609 0.1273 0.000
838633305 0.0267 0.0174 0.0429 0.156
Sessions whose true contrast exceeds every shifted one: 38 of 50
Sessions with the true contrast below the 99th percentile of the shifted ones: ['777496949', '838633305']
Supplementary Table 1 QC and experimental notes of those sessions:
subject_id local_session_n QC experimental_notes
session
777496949 418779 1 passed NaN
838633305 440889 6 failed *laser wavelength incorrectly set to 800 nm (instead of 910 nm)
The contrast at the true transitions is above every shifted contrast in 38 of 50 sessions, and above the 99th percentile of the shifted ones in 48. In those 48 sessions the dF/F shares the clock of the trial table. It is not established in two sessions: 777496949 (mouse 418779, 15 ROIs, rank 0.054) and 838633305 (440889 local session 6, which failed QC; Supplementary Table 1's experimental notes say the laser was set to 800 nm instead of 910 nm, printed above, though the file states 910 nm). The second is not among the 33 analysed sessions; the first is, and its group's results below are reported with the others. Running and pupil carry their own timestamps on the same time base; no stimulus contrast was used for them, so their alignment is stated, not shown.
# Recordings deposited twice: compare running traces, pupil traces, dF/F summaries and trial times
# of every pair of sessions.
sig = {}
for sid in sess.index:
s = S[sid]
sig[sid] = (np.round(s["run_v"][:5000], 6).tobytes(), np.round(np.nan_to_num(s["pupil_d"][:5000]), 6).tobytes(),
np.round(R[sid]["roi"]["mean"].to_numpy(), 6).tobytes(), np.round(s["trials"].start_time.to_numpy(), 4).tobytes())
pairs = []
ids = list(sig)
for i in range(len(ids)):
for j in range(i + 1, len(ids)):
same = [a == b for a, b in zip(sig[ids[i]], sig[ids[j]])]
if any(same):
pairs.append((ids[i], ids[j], same))
print("Pairs of sessions sharing running, pupil, dF/F means or trial times:", pairs if pairs else "none")
print("Pairs with the same ROI count:",
[(a, b) for a, b in zip(sess.index[:-1], sess.index[1:]) if sess.n_rois[a] == sess.n_rois[b]])
Pairs of sessions sharing running, pupil, dF/F means or trial times: none
Pairs with the same ROI count: [('832883243', '833704570')]
No two sessions share running or pupil traces, ROI means or trial times, so no recording is deposited twice among the basic files.
table1-subjects¶
The dataset holds 13 mice whose subject ids, sex, date of birth, imaged cell type (L2/3 or L5 pyramidal) and imaging plane (somata or distal apical dendrites) are as listed in Table 1.
Table 1's values are taken from Supplementary Table 1 (metadata.csv, which holds the columns of Tables 1 and 2). The files record sex and genotype (cell type through the line); they record no date of birth and no plane, which are listed and also shown as values implied by the recorded age and depth.
t1 = supp.groupby("subject_id").agg(sex=("subject_sex", "first"), dob=("subject_date_of_birth", "first"),
layer=("imaging_cell_layer", "first"), plane=("imaging_plane", "first"))
first = sess.groupby("subject").first()
dob_implied = (pd.to_datetime(first.date_file) - pd.to_timedelta(first.age_days, unit="D")).dt.strftime("%Y%m%d")
dob_implied_utc = (pd.to_datetime(first.date_if_utc) - pd.to_timedelta(first.age_days, unit="D")).dt.strftime("%Y%m%d")
cmp1 = pd.DataFrame({"sex_table": t1.sex, "sex_file": first.sex, "layer_table": t1.layer, "layer_file": first.line,
"dob_table": t1.dob, "dob_from_age": dob_implied, "dob_from_age_if_utc": dob_implied_utc,
"plane_table": t1.plane, "plane_from_depth": first.plane.map({"D": "distal_apical_dendrites", "S": "somata"})})
print(cmp1.to_string())
print("\nSubjects in Table 1:", len(t1), "; in the files:", sess.subject.nunique(),
"; in both:", len(set(t1.index) & set(sess.subject)))
recorded = {"sex": (cmp1.sex_table != cmp1.sex_file).sum(), "cell type (genotype)": (cmp1.layer_table != cmp1.layer_file).sum()}
print("Disagreements in recorded fields:", {k: int(v) for k, v in recorded.items()}, "; total", int(sum(recorded.values())))
print("Not recorded in the files: date of birth, plane")
print("Implied by the recorded age (variant): date of birth agrees for", int((cmp1.dob_table == cmp1.dob_from_age).sum()),
"of 13 (", int((cmp1.dob_table == cmp1.dob_from_age_if_utc).sum()), "if the start clock is read as UTC)")
print("Implied by the recorded depth (variant): plane agrees for", int((cmp1.plane_table == cmp1.plane_from_depth).sum()), "of 13")
sex_table sex_file layer_table layer_file dob_table dob_from_age dob_from_age_if_utc plane_table plane_from_depth
408021 M M L2/3 L2/3 20180623 20180623 20180623 somata somata
411400 F F L5 L5 20180711 20180711 20180711 distal_apical_dendrites distal_apical_dendrites
411424 F F L2/3 L2/3 20180711 20180711 20180711 somata somata
411771 M M L5 L5 20180713 20180713 20180713 somata somata
412933 M M L2/3 L2/3 20180718 20180718 20180718 distal_apical_dendrites distal_apical_dendrites
413663 M M L2/3 L2/3 20180721 20180721 20180721 distal_apical_dendrites distal_apical_dendrites
418779 F F L5 L5 20180820 20180821 20180820 somata somata
420011 F F L5 L5 20180826 20180826 20180826 distal_apical_dendrites distal_apical_dendrites
433414 F F L2/3 L2/3 20181106 20181106 20181106 distal_apical_dendrites distal_apical_dendrites
433448 M M L5 L5 20181106 20181106 20181106 distal_apical_dendrites distal_apical_dendrites
433451 M M L5 L5 20181106 20181106 20181106 distal_apical_dendrites distal_apical_dendrites
433458 M M L5 L5 20181106 20181106 20181106 somata somata
440889 F F L2/3 L2/3 20181212 20181212 20181212 somata somata
Subjects in Table 1: 13 ; in the files: 13 ; in both: 13
Disagreements in recorded fields: {'sex': 0, 'cell type (genotype)': 0} ; total 0
Not recorded in the files: date of birth, plane
Implied by the recorded age (variant): date of birth agrees for 12 of 13 ( 13 if the start clock is read as UTC)
Implied by the recorded depth (variant): plane agrees for 13 of 13
Result: reproduced. All 13 subjects of Table 1 are in the dataset, and their recorded sex and genotype (cell type) agree with Table 1 for all 13 (0 disagreements). The files record no date of birth and no plane. The variants agree: the plane implied by the recorded depth matches for 13 of 13, and the date of birth implied by the recorded age matches for 12 of 13; for mouse 418779 it is one day late, and matches when the start clock is read as UTC (see table2-sessions).
cohorts-by-plane¶
Thirteen mice were imaged, three L2/3 dendritic, three L2/3 somatic, four L5 dendritic and three L5 somatic, each with at least three imaging sessions.
mice = sess.groupby("subject").agg(group=("group", "first"), sessions=("group", "size"))
print(mice.groupby("group").agg(mice=("sessions", "size"), fewest_sessions=("sessions", "min"),
most_sessions=("sessions", "max")).to_string())
print("Expected: L2/3-D 3, L2/3-S 3, L5-D 4, L5-S 3; mice with fewer than three sessions:",
mice.index[mice.sessions < 3].tolist())
mice fewest_sessions most_sessions group L2/3-D 3 3 6 L2/3-S 3 3 6 L5-D 4 3 6 L5-S 3 3 4 Expected: L2/3-D 3, L2/3-S 3, L5-D 4, L5-S 3; mice with fewer than three sessions: []
Result: reproduced. By line and plane the dataset holds 3 L2/3 dendritic, 3 L2/3 somatic, 4 L5 dendritic and 3 L5 somatic mice, and every mouse has at least three sessions (3 to 6).
sex-split¶
Seven of the mice are male and six female, and only one L2/3 dendritic mouse is female.
mice["sex"] = sess.groupby("subject").sex.first()
print(pd.crosstab(mice.group, mice.sex, margins=True).to_string())
sex F M All group L2/3-D 1 2 3 L2/3-S 2 1 3 L5-D 2 2 4 L5-S 1 2 3 All 6 7 13
Result: reproduced. 7 mice are male and 6 female, and one L2/3 dendritic mouse is female.
sessions-total¶
The dataset holds 50 imaging sessions from 13 animals, each session in its own files grouped by subject.
folders = assets.path.str.split("/").str[0]
nwb = assets[assets.kind.notna()]
print("Distinct session ids:", nwb.session.nunique(), "; subject folders:", folders[assets.kind.notna()].nunique())
print("Every file sits in the folder of its subject:",
bool((nwb.path.str.split("/").str[0] == "sub-" + nwb.subject).all()))
print("Files per session:", nwb.groupby("session").size().value_counts().to_dict(),
"; sessions per subject:", nwb.groupby("subject").session.nunique().value_counts().sort_index().to_dict())
Distinct session ids: 50 ; subject folders: 13
Every file sits in the folder of its subject: True
Files per session: {3: 50} ; sessions per subject: {3: 8, 4: 2, 6: 3}
Result: reproduced. The dataset holds 50 distinct sessions in 13 subject folders, three files per session, each in the folder of its subject.
table2-sessions¶
The 50 sessions have the subject ids, session ids, imaging dates, imaging depths, ROI counts, tracked ROI counts, QC results and stimulus seeds listed in Table 2.
Table 2's values are taken from Supplementary Table 1. The date of a session is the date of its start time as the file states it; the same clock read as UTC (as Supplementary Table 1 labels it) and converted to Pacific time is shown as a variant.
t2 = supp.set_index("session_id")
tracked_table = t2.n_tracked_ROIs.clip(lower=0) # -1 in metadata.csv is 0 in Table 2
cmp2 = pd.DataFrame({
"subject": sess.subject == t2.subject_id.reindex(sess.index),
"date": sess.date_file == t2.imaging_date.reindex(sess.index),
"depth": sess.depth == t2.imaging_depth.reindex(sess.index),
"n_rois": sess.n_rois == t2.n_ROIs.reindex(sess.index),
"n_tracked": sess.n_tracked == tracked_table.reindex(sess.index)})
print("Sessions in Table 2:", len(t2), "; in the files:", len(sess), "; in both:", len(set(t2.index) & set(sess.index)))
print("Fields not recorded in the files: QC, stimulus seed")
print("Sessions agreeing, per field:", cmp2.sum().to_dict())
print("Sessions agreeing in every recorded field:", int(cmp2.all(axis=1).sum()), "of 50")
bad = cmp2[~cmp2.all(axis=1)]
print(pd.concat([bad, sess.loc[bad.index, ["subject", "start", "date_file", "date_if_utc", "depth"]],
t2.loc[bad.index, ["imaging_date", "imaging_UTC_date_time", "imaging_depth"]]], axis=1).to_string())
alt = cmp2.copy()
alt["date"] = sess.date_if_utc == t2.imaging_date.reindex(sess.index)
print("\nVariant, clock read as UTC: dates agree for", int(alt.date.sum()), "of 50; sessions agreeing in every field:",
int(alt.all(axis=1).sum()))
print("Supplementary Table 1's 'UTC' time equals the clock time of the file's start for",
int((sess.start_naive.dt.strftime("%Y%m%dT%H%M%S") == t2.imaging_UTC_date_time.reindex(sess.index)).sum()), "of 50")
print("\nEvery time and date field of the files whose stated date differs from Table 2, as stored:")
for sid in cmp2.index[~cmp2.date]:
tf = S[sid]["text_fields"]
print(" ", sid, {k: v for k, v in tf.items() if "time" in k.lower() or "date" in k.lower()},
"; Supplementary Table 1 imaging_UTC_date_time:", t2.imaging_UTC_date_time[sid])
Sessions in Table 2: 50 ; in the files: 50 ; in both: 50
Fields not recorded in the files: QC, stimulus seed
Sessions agreeing, per field: {'subject': 50, 'date': 46, 'depth': 47, 'n_rois': 50, 'n_tracked': 50}
Sessions agreeing in every recorded field: 43 of 50
subject date depth n_rois n_tracked subject start date_file date_if_utc depth imaging_date imaging_UTC_date_time imaging_depth
session
765427689 True False True True True 412933 2018-10-19T00:18:29.755000-07:00 20181019 20181018 75 20181018 20181019T001829 75
777496949 True False True True True 418779 2018-11-13T01:51:48.328000-08:00 20181113 20181112 375 20181112 20181113T015148 375
778374308 True False True True True 418779 2018-11-14T03:01:41.368000-08:00 20181114 20181113 375 20181113 20181114T030141 375
779152062 True False True True True 418779 2018-11-15T01:06:09.988000-08:00 20181115 20181114 375 20181114 20181115T010609 375
826187862 True True False True True 433414 2019-02-20T21:26:44.454000-08:00 20190220 20190220 60 20190220 20190220T212644 75
826773996 True True False True True 433414 2019-02-21T20:28:14.334000-08:00 20190221 20190221 60 20190221 20190221T202814 75
827833392 True True False True True 433414 2019-02-22T22:18:48.574000-08:00 20190222 20190222 60 20190222 20190222T221848 75
Variant, clock read as UTC: dates agree for 50 of 50; sessions agreeing in every field: 47
Supplementary Table 1's 'UTC' time equals the clock time of the file's start for 50 of 50
Every time and date field of the files whose stated date differs from Table 2, as stored:
765427689 {'file_create_date': "['2022-09-24T16:36:17.269880-07:00', '2023-04-03T21:37:17.086838-07:00']", 'session_start_time': '2018-10-19T00:18:29.755000-07:00', 'timestamps_reference_time': '2018-10-19T00:18:29.755000-07:00'} ; Supplementary Table 1 imaging_UTC_date_time: 20181019T001829
777496949 {'file_create_date': "['2022-09-25T01:03:09.398343-07:00', '2023-04-03T21:37:37.056598-07:00']", 'session_start_time': '2018-11-13T01:51:48.328000-08:00', 'timestamps_reference_time': '2018-11-13T01:51:48.328000-08:00'} ; Supplementary Table 1 imaging_UTC_date_time: 20181113T015148
778374308 {'file_create_date': "['2022-09-24T16:41:44.258107-07:00', '2023-04-03T21:37:45.675094-07:00']", 'session_start_time': '2018-11-14T03:01:41.368000-08:00', 'timestamps_reference_time': '2018-11-14T03:01:41.368000-08:00'} ; Supplementary Table 1 imaging_UTC_date_time: 20181114T030141
779152062 {'file_create_date': "['2022-09-24T23:02:17.804752-07:00', '2023-04-03T21:37:18.812455-07:00']", 'session_start_time': '2018-11-15T01:06:09.988000-08:00', 'timestamps_reference_time': '2018-11-15T01:06:09.988000-08:00'} ; Supplementary Table 1 imaging_UTC_date_time: 20181115T010609
Result: not reproduced. All 50 sessions of Table 2 are in the dataset, and subject, ROI count and
tracked ROI count agree for all 50. Only 43 of 50 agree in every recorded field, below the 45 the
criterion asks for partial reproduction. The three sessions of mouse 433414 are recorded at a depth
of 60 um where Table 2 gives 75. Four sessions (412933 local session 3 and the three of 418779)
start one day later in the files than the date in Table 2. Their start times are early-morning
clock values (00:18 to 03:01) stated with a Pacific offset (for example 2018-10-19T00:18-07:00);
read as UTC, the same clock values fall on the evening of the day before in Pacific time. Supplementary Table 1
gives the same clock values as UTC for all 50 sessions. Read as UTC, all 50 dates agree and 47 of
50 sessions agree in every field (the depth difference remains). The UTC reading is not one the
criterion gives, so it is a variant and does not decide the outcome. The files hold no other
wall-clock time that could settle which reading is right: timestamps_reference_time equals
session_start_time, and file_create_date gives the conversion dates (2022 and 2023). The
depth difference of 433414 holds under either reading. The files do not record QC or the
stimulus seed.
qc-failures¶
Two animals had at least one session that failed the Allen Institute's QC thresholds, and some animals had more than three sessions, for example when an early session failed QC.
Blocked: the files hold no QC status, and the criterion blocks the claim when the dataset records none. The counts from Supplementary Table 1 are shown for reference only.
qc_fields = [c for c in S[sess.index[0]]["trial_columns"] + S[sess.index[0]]["subject_fields"] if "qc" in c.lower() or "pass" in c.lower()]
print("QC fields in the files:", qc_fields if qc_fields else "none")
failed = sess[sess.QC == "failed"].groupby("subject").local_n.apply(list)
print("Supplementary Table 1, failed sessions by mouse (local numbers):", failed.to_dict())
print("(a) animals with any failed session:", len(failed),
"; (b) animals whose first three sessions failed:", int(failed.apply(lambda v: set([1, 2, 3]) <= set(v)).sum()))
print("Animals with more than three sessions in the files:", mice.index[mice.sessions > 3].tolist())
# Every small dataset and attribute under general and at the file's top level, in all 50 files.
words = ("qc", "quality", "pass", "fail", "exclu", "reject")
hits = {sid: {k: v[:150] for k, v in S[sid]["text_fields"].items() if any(w in (k + " " + v).lower() for w in words)}
for sid in sess.index}
print("\nText fields mentioning", words, "in any of the 50 files:", {k: v for k, v in hits.items() if v} or "none")
print("Text fields per file:", min(len(S[s]["text_fields"]) for s in sess.index), "to", max(len(S[s]["text_fields"]) for s in sess.index))
ex = "759666166"
print(f"\nEvery text field of {ex} (mouse {sess.subject[ex]}, local session {sess.local_n[ex]}, Supplementary Table 1 QC {sess.QC[ex]}):")
for k, v in S[ex]["text_fields"].items():
print(f" {k}: {v[:200]}")
QC fields in the files: none
Supplementary Table 1, failed sessions by mouse (local numbers): {'411400': [1, 2, 3], '412933': [1, 2, 3], '440889': [5, 6]}
(a) animals with any failed session: 3 ; (b) animals whose first three sessions failed: 2
Animals with more than three sessions in the files: ['411400', '412933', '433448', '433458', '440889']
Text fields mentioning ('qc', 'quality', 'pass', 'fail', 'exclu', 'reject') in any of the 50 files: none
Text fields per file: 23 to 23
Every text field of 759666166 (mouse 411400, local session 1, Supplementary Table 1 QC failed):
file_create_date: ['2022-09-24T22:32:36.231878-07:00', '2023-04-03T21:37:43.217912-07:00']
identifier: 759666166
session_description: Allen Institute OpenScope dataset
session_start_time: 2018-10-01T18:02:56.523000-07:00
timestamps_reference_time: 2018-10-01T18:02:56.523000-07:00
/@.specloc: <HDF5 object reference>
/@nwb_version: 2.5.0
general/devices/2p_microscope@description: Allen Institute two-photon pipeline: CAM2P.1
general/institution: Allen Institute for Brain Science
general/optophysiology/ImagingPlane/description: ImagingPlane
general/optophysiology/ImagingPlane/excitation_lambda: 910.0
general/optophysiology/ImagingPlane/imaging_rate: 30.0
general/optophysiology/ImagingPlane/indicator: GCaMP6f
general/optophysiology/ImagingPlane/location: {'area': 'VISp', 'depth': '20'}
general/optophysiology/ImagingPlane/optical_channel/description: 2P Optical Channel
general/optophysiology/ImagingPlane/optical_channel/emission_lambda: 520.0
general/optophysiology/ImagingPlane/reference_frame: Intrinsic imaging home
general/session_id: 759666166
general/subject/age: P82D
general/subject/genotype: Rbp4-Cre_KL100;Camk2a-tTA;Ai93
general/subject/sex: F
general/subject/species: Mus musculus
general/subject/subject_id: 411400
Result: blocked (metadata_insufficient). None of the 50 files holds a QC field: not in the
trial table or subject fields, and none of the 23 small datasets and attributes under general
and at each file's top level mentions QC, quality, pass, fail, exclusion or rejection (all of
them are printed for 759666166, a failed session of 411400). For reference only, Supplementary
Table 1 gives 3 animals with any failed session (reading a) and 2 whose first three sessions
failed (reading b). The part of the claim the files can test holds: 5 animals have more than
three sessions (411400, 412933, 433448, 433458, 440889).
session-schedule¶
Each mouse had three 70-minute imaging sessions within three to six days, with at most one session per day.
The criterion's four combinations: sessions (i) local 1 to 3, or (ii) the sessions of the paper's analyses (local 1 to 3 passing QC, or local 4 to 6 for mice 411400 and 412933); span (a) days from first to third session (3 to 6 allowed), or (b) calendar days counted inclusively (3 to 6 allowed). Dates are those of the start times as the files state them; the clock read as UTC is a variant.
def schedule(date_col):
out = []
for subj, g in sess.groupby("subject"):
sets = {"i": g[g.local_n <= 3]}
sets["ii"] = g[g.local_n >= 4] if subj in ("411400", "412933") else g[g.analysed]
for k, sub in sets.items():
d = pd.to_datetime(sub[date_col]).sort_values()
span = (d.iloc[-1] - d.iloc[0]).days
out.append({"subject": subj, "sessions": k, "dates": " ".join(sub[date_col]),
"span_a": span, "span_b": span + 1, "shared_date": d.duplicated().any(),
"all_dates_distinct_in_mouse": not pd.to_datetime(g[date_col]).duplicated().any()})
return pd.DataFrame(out)
for date_col in ("date_file", "date_if_utc"):
sch = schedule(date_col)
print(f"Dates from {date_col}:")
print(sch.to_string(index=False))
for k in ("i", "ii"):
for span in ("span_a", "span_b"):
sub = sch[sch.sessions == k]
ok = sub[span].between(3, 6) & ~sub.shared_date
print(f" sessions ({k}), span ({span[-1]}): mice meeting it {int(ok.sum())} of {len(sub)}; failing:",
sub.subject[~ok].tolist())
print()
dur = pd.Series({sid: (S[sid]["trials"].stop_time.max() - S[sid]["trials"].start_time.min()) / 60 for sid in sess.index})
rec = sess.n_frames / sess.fps_2p / 60
print("Session duration from the stimulus table (min):", dur.min().round(2), "to", dur.max().round(2),
"; two-photon recording (min):", rec.min().round(2), "to", rec.max().round(2), "; within 70 +/- 7:",
bool(dur.between(63, 77).all() and rec.between(63, 77).all()))
Dates from date_file: subject sessions dates span_a span_b shared_date all_dates_distinct_in_mouse 408021 i 20180926 20180927 20181001 5 6 False True 408021 ii 20180926 20180927 20181001 5 6 False True 411400 i 20181001 20181002 20181003 2 3 False True 411400 ii 20181009 20181011 20181015 6 7 False True 411424 i 20181009 20181010 20181011 2 3 False True 411424 ii 20181009 20181010 20181011 2 3 False True 411771 i 20181003 20181004 20181008 5 6 False True 411771 ii 20181003 20181004 20181008 5 6 False True 412933 i 20181016 20181017 20181019 3 4 False True 412933 ii 20181022 20181023 20181025 3 4 False True 413663 i 20181017 20181018 20181022 5 6 False True 413663 ii 20181017 20181018 20181022 5 6 False True 418779 i 20181113 20181114 20181115 2 3 False True 418779 ii 20181113 20181114 20181115 2 3 False True 420011 i 20181113 20181114 20181115 2 3 False True 420011 ii 20181113 20181114 20181115 2 3 False True 433414 i 20190220 20190221 20190222 2 3 False True 433414 ii 20190220 20190221 20190222 2 3 False True 433448 i 20190220 20190221 20190225 5 6 False True 433448 ii 20190220 20190221 20190225 5 6 False True 433451 i 20190215 20190218 20190219 4 5 False True 433451 ii 20190215 20190218 20190219 4 5 False True 433458 i 20190221 20190222 20190225 4 5 False True 433458 ii 20190221 20190222 20190225 4 5 False True 440889 i 20190306 20190307 20190308 2 3 False True 440889 ii 20190306 20190307 20190308 2 3 False True sessions (i), span (a): mice meeting it 7 of 13; failing: ['411400', '411424', '418779', '420011', '433414', '440889'] sessions (i), span (b): mice meeting it 13 of 13; failing: [] sessions (ii), span (a): mice meeting it 8 of 13; failing: ['411424', '418779', '420011', '433414', '440889'] sessions (ii), span (b): mice meeting it 12 of 13; failing: ['411400'] Dates from date_if_utc: subject sessions dates span_a span_b shared_date all_dates_distinct_in_mouse 408021 i 20180926 20180927 20181001 5 6 False True 408021 ii 20180926 20180927 20181001 5 6 False True 411400 i 20181001 20181002 20181003 2 3 False True 411400 ii 20181009 20181011 20181015 6 7 False True 411424 i 20181009 20181010 20181011 2 3 False True 411424 ii 20181009 20181010 20181011 2 3 False True 411771 i 20181003 20181004 20181008 5 6 False True 411771 ii 20181003 20181004 20181008 5 6 False True 412933 i 20181016 20181017 20181018 2 3 False True 412933 ii 20181022 20181023 20181025 3 4 False True 413663 i 20181017 20181018 20181022 5 6 False True 413663 ii 20181017 20181018 20181022 5 6 False True 418779 i 20181112 20181113 20181114 2 3 False True 418779 ii 20181112 20181113 20181114 2 3 False True 420011 i 20181113 20181114 20181115 2 3 False True 420011 ii 20181113 20181114 20181115 2 3 False True 433414 i 20190220 20190221 20190222 2 3 False True 433414 ii 20190220 20190221 20190222 2 3 False True 433448 i 20190220 20190221 20190225 5 6 False True 433448 ii 20190220 20190221 20190225 5 6 False True 433451 i 20190215 20190218 20190219 4 5 False True 433451 ii 20190215 20190218 20190219 4 5 False True 433458 i 20190221 20190222 20190225 4 5 False True 433458 ii 20190221 20190222 20190225 4 5 False True 440889 i 20190306 20190307 20190308 2 3 False True 440889 ii 20190306 20190307 20190308 2 3 False True sessions (i), span (a): mice meeting it 6 of 13; failing: ['411400', '411424', '412933', '418779', '420011', '433414', '440889'] sessions (i), span (b): mice meeting it 13 of 13; failing: [] sessions (ii), span (a): mice meeting it 8 of 13; failing: ['411424', '418779', '420011', '433414', '440889'] sessions (ii), span (b): mice meeting it 12 of 13; failing: ['411400']
Session duration from the stimulus table (min): 70.06 to 70.37 ; two-photon recording (min): 70.22 to 70.53 ; within 70 +/- 7: True
Result: reproduced. Under combination (i)(b), local sessions 1 to 3 with calendar days counted inclusively, all 13 mice have spans of 3 to 6 days with no two sessions on one date. This holds with both readings of the dates. The other combinations fail for several mice: with the dates as stated, (i)(a) and (ii)(a) give 2-day spans for 6 and 5 mice, and (ii)(b) gives 7 days for 411400. Sessions last 70.06 to 70.37 min by the stimulus table and 70.22 to 70.53 min by the imaging, within 70 min +/- 10%.
imaging-depths¶
Somata were imaged at 175 um (L2/3) and 375 um (L5) depth, and distal apical dendrites at 50 to 75 um (L2/3) and 20 um (L5).
# For L2/3 dendrites the criterion admits any depth from 50 to 75 um inclusive (answer of 2026-10-22).
allowed = {"L2/3-S": lambda d: d == 175, "L5-S": lambda d: d == 375, "L2/3-D": lambda d: 50 <= d <= 75, "L5-D": lambda d: d == 20}
sess["depth_ok"] = [allowed[g](d) for d, g in zip(sess.depth, sess.group)]
print(sess.groupby(["group", "depth"]).size().rename("sessions").to_string())
print("Sessions whose depth is the value for their line and plane (50 to 75 um for L2/3 dendrites):", int(sess.depth_ok.sum()), "of 50")
print("Sessions that do not:", sess[~sess.depth_ok][["subject", "group", "depth"]].to_dict("index"))
print("Sessions at exactly 50 or 75 um among L2/3 dendrites (the earlier criterion):",
int(sum(d in (50, 75) for d, g in zip(sess.depth, sess.group) if g == "L2/3-D")), "of", int((sess.group == "L2/3-D").sum()))
group depth
L2/3-D 50 6
60 3
75 3
L2/3-S 175 12
L5-D 20 16
L5-S 375 10
Sessions whose depth is the value for their line and plane (50 to 75 um for L2/3 dendrites): 50 of 50
Sessions that do not: {}
Sessions at exactly 50 or 75 um among L2/3 dendrites (the earlier criterion): 9 of 12
Result: reproduced. All 50 sessions are at the depth the criterion gives for their line and plane: 175 and 375 um for somata, 20 um for L5 dendrites, and from 50 to 75 um for L2/3 dendrites. The three sessions of L2/3 dendritic mouse 433414 are at 60 um, inside that range. An earlier reading of the criterion allowed only 50 or 75 um. The answer of 2026-10-22 replaced it with the range, which turned the result from not reproduced into reproduced. Table 2 gives 75 um for these sessions, so the dataset and the paper disagree on this depth (table2-sessions).
acquisition-rates¶
Calcium movies were recorded at 30 Hz over a 400 um field of view at 512 x 512 pixels, and running was recorded at 60 Hz in cm/s.
print("Imaging rate from dF/F timestamps (Hz): min", sess.fps_2p.min().round(3), "max", sess.fps_2p.max().round(3),
"; within 30 +/- 3 in", int(sess.fps_2p.between(27, 33).sum()), "of 50")
print("Running rate from timestamps (Hz): min", sess.fps_run.min().round(3), "max", sess.fps_run.max().round(3),
"; within 60 +/- 6 in", int(sess.fps_run.between(54, 66).sum()), "of 50; unit", units["run_unit"])
fs = sess.mask_shape.apply(lambda s: s[0] == 512 and s[1] == 512) & sess.max_proj_shape.apply(lambda s: tuple(s) == (512, 512))
print("Frame size 512 x 512 (masks and max projection) in", int(fs.sum()), "of 50")
print("Field of view in um: not recorded (the max projection carries a 'resolution' attribute of 0.000128, no unit)")
Imaging rate from dF/F timestamps (Hz): min 30.075 max 30.148 ; within 30 +/- 3 in 50 of 50
Running rate from timestamps (Hz): min 59.952 max 59.952 ; within 60 +/- 6 in 50 of 50; unit {'cm/s'}
Frame size 512 x 512 (masks and max projection) in 50 of 50
Field of view in um: not recorded (the max projection carries a 'resolution' attribute of 0.000128, no unit)
Result: reproduced. Imaging runs at 30.08 to 30.15 Hz by the timestamps (stated 30 Hz), running at 59.95 Hz in cm/s, and every mask and projection image is 512 x 512 pixels. The 400 um field of view is not recorded in the files.
roi-noise-rejection¶
ROIs that were too noisy, with a mean dF/F below 0 or a median dF/F above the midpoint between the trace's minimum and maximum, were rejected, so no retained ROI has either property.
noise = []
for sid in sess.index:
r = R[sid]["roi"]
mid = (r["min"] + r["max"]) / 2
noise.append({"session": sid, "group": sess.group[sid], "rois": len(r), "mean_below_0": int((r["mean"] < 0).sum()),
"median_above_midrange": int((r["median"] > mid).sum()),
"either": int(((r["mean"] < 0) | (r["median"] > mid)).sum()),
"lowest_mean": r["mean"].min(), "highest_median_minus_mid": (r["median"] - mid).max()})
noise = pd.DataFrame(noise).set_index("session")
print(noise.to_string())
print("ROIs with either property:", noise.either.sum(), "of", noise.rois.sum(),
f"({100 * noise.either.sum() / noise.rois.sum():.3f}%)", "; sessions with any:", int((noise.either > 0).sum()))
group rois mean_below_0 median_above_midrange either lowest_mean highest_median_minus_mid session 758519303 L2/3-S 96 0 0 0 0.001879 -0.263775 759189643 L2/3-S 74 0 0 0 0.001715 -0.305118 759660390 L2/3-S 107 0 0 0 0.001620 -0.204022 759666166 L5-D 942 0 0 0 0.005130 -0.174675 759872185 L5-D 289 0 0 0 0.003473 -0.543600 760269100 L5-D 524 0 0 0 0.003685 -0.460909 761730740 L5-D 630 0 0 0 0.002821 -0.360429 762415169 L5-D 637 0 0 0 0.002242 -0.393646 763646681 L5-D 597 0 0 0 0.002398 -0.325565 761624763 L2/3-S 87 0 0 0 0.001970 -0.124056 761944562 L2/3-S 90 0 0 0 0.001913 -0.161657 762250376 L2/3-S 80 0 0 0 0.002036 -0.272402 760260459 L5-S 90 0 0 0 0.003656 -0.292252 760659782 L5-S 70 0 0 0 0.002570 -0.288570 761269197 L5-S 79 0 0 0 0.002583 -0.222718 763949859 L2/3-D 1041 0 0 0 0.001398 -0.130350 764897534 L2/3-D 948 0 0 0 0.001122 -0.175637 765427689 L2/3-D 836 0 0 0 0.001916 -0.204589 766755831 L2/3-D 344 0 0 0 0.002738 -0.245717 767254594 L2/3-D 168 0 0 0 0.004136 -0.427518 768807532 L2/3-D 250 0 0 0 0.003766 -0.323328 764704289 L2/3-D 628 0 0 0 0.002793 -0.232364 765193831 L2/3-D 348 0 0 0 0.001634 -0.290536 766502238 L2/3-D 512 0 0 0 0.003392 -0.281249 777496949 L5-S 15 0 0 0 0.006467 -0.575961 778374308 L5-S 26 0 0 0 0.004118 -0.301149 779152062 L5-S 29 0 0 0 0.003722 -0.310080 777914830 L5-D 205 0 0 0 0.003982 -0.561610 778864809 L5-D 159 0 0 0 0.005077 -0.301615 779650018 L5-D 182 0 0 0 0.005117 -0.411303 826187862 L2/3-D 727 0 0 0 0.002277 -0.312510 826773996 L2/3-D 300 0 0 0 0.002680 -0.299917 827833392 L2/3-D 333 0 0 0 0.003563 -0.329251 826338612 L5-D 1636 0 0 0 0.000733 -0.113013 826819032 L5-D 445 0 0 0 0.003526 -0.367641 828816509 L5-D 496 0 0 0 0.003468 -0.431115 829283315 L5-D 436 0 0 0 0.003658 -0.330017 823453391 L5-D 966 0 0 0 0.003881 -0.214614 824434038 L5-D 1029 0 0 0 0.003999 -0.290768 825180479 L5-D 986 0 0 0 0.003315 -0.128793 826659257 L5-S 99 0 0 0 0.002920 -0.285210 827300090 L5-S 87 0 0 0 0.003558 -0.304372 828475005 L5-S 97 0 0 0 0.002531 -0.177430 829520904 L5-S 88 0 0 0 0.004114 -0.226148 832883243 L2/3-S 224 0 0 0 0.001547 -0.061100 833704570 L2/3-S 224 0 0 0 0.001655 -0.099646 834403597 L2/3-S 210 0 0 0 0.001785 -0.095232 836968429 L2/3-S 205 0 0 0 0.001800 -0.087876 837360280 L2/3-S 217 0 0 0 0.001844 -0.089690 838633305 L2/3-S 227 0 0 0 0.000576 -0.037646
ROIs with either property: 0 of 19115 (0.000%) ; sessions with any: 0
Result: reproduced. None of the 19115 ROIs in the 50 sessions has a mean dF/F below 0 or a median above its mid-range. The lowest ROI mean is 0.0006, and every median is below its mid-range.
roi-count-ranges¶
Somatic planes yielded 15 to 224 ROIs per mouse per session and dendritic planes 159 to 1636.
readings = {"(a) 33 analysed sessions": sess.analysed, "(b) all sessions passing QC": sess.QC == "passed",
"(c) all 50 sessions": pd.Series(True, index=sess.index)}
lim = {"S": ((15, 1.5), (224, 22.4)), "D": ((159, 15.9), (1636, 163.6))}
for name, sel in readings.items():
ok_all = True
for plane in ("S", "D"):
n = sess[sel & (sess.plane == plane)].n_rois
(lo, tlo), (hi, thi) = lim[plane]
ok = abs(n.min() - lo) <= tlo and abs(n.max() - hi) <= thi
ok_all &= ok
print(f"{name}, {'somata' if plane == 'S' else 'dendrites'}: {len(n)} sessions, {n.min()} to {n.max()} "
f"(expected {lo} +/- {tlo} to {hi} +/- {thi}): {'within' if ok else 'outside'}")
print(f" {name}: {'all within tolerance' if ok_all else 'not all within tolerance'}")
(a) 33 analysed sessions, somata: 18 sessions, 15 to 224 (expected 15 +/- 1.5 to 224 +/- 22.4): within (a) 33 analysed sessions, dendrites: 15 sessions, 159 to 1636 (expected 159 +/- 15.9 to 1636 +/- 163.6): within (a) 33 analysed sessions: all within tolerance (b) all sessions passing QC, somata: 20 sessions, 15 to 224 (expected 15 +/- 1.5 to 224 +/- 22.4): within (b) all sessions passing QC, dendrites: 22 sessions, 159 to 1636 (expected 159 +/- 15.9 to 1636 +/- 163.6): within (b) all sessions passing QC: all within tolerance (c) all 50 sessions, somata: 22 sessions, 15 to 227 (expected 15 +/- 1.5 to 224 +/- 22.4): within (c) all 50 sessions, dendrites: 28 sessions, 159 to 1636 (expected 159 +/- 15.9 to 1636 +/- 163.6): within (c) all 50 sessions: all within tolerance
Result: reproduced. In the 33 analysed sessions somatic planes hold 15 to 224 ROIs and dendritic planes 159 to 1636, as stated. The readings over all sessions that passed QC (15 to 224, 159 to 1636) and over all 50 sessions (15 to 227, 159 to 1636) are also within tolerance.
tracked-roi-totals¶
Matching produced 254 tracked ROIs in L2/3 dendritic planes, 261 in L2/3 somatic, 516 in L5 dendritic and 129 in L5 somatic, about 100 to 500 per plane and about 32 to 75% of the theoretical maximum number of trackable ROIs.
trk = sess[sess.n_tracked > 0]
per_mouse = trk.groupby("subject").agg(group=("group", "first"), tracked=("n_tracked", "first"),
tracked_sessions=("n_tracked", "size"), equal=("n_tracked", lambda v: v.nunique() == 1),
min_rois=("n_rois", "min"), mean_rois=("n_rois", "mean"),
local=("local_n", lambda v: sorted(v)))
print(per_mouse.to_string())
expected = {"L2/3-D": 254, "L2/3-S": 261, "L5-D": 516, "L5-S": 129}
for label, sel in (("11 mice of the paper's analyses", ~per_mouse.index.isin(["411400", "412933"])),
("all 13 tracked mice (variant)", per_mouse.index == per_mouse.index)):
pm = per_mouse[sel]
tot = pm.groupby("group").agg(tracked=("tracked", "sum"), max_a=("min_rois", "sum"), max_b=("mean_rois", "sum"))
tot["expected"] = pd.Series(expected)
tot["pct_a"] = 100 * tot.tracked / tot.max_a
tot["pct_b"] = 100 * tot.tracked / tot.max_b
print(f"\n{label}:")
print(tot.round(1).to_string())
print(" totals equal the expected:", bool((tot.tracked == tot.expected).all()))
for r in ("a", "b"):
lo, hi = tot[f"pct_{r}"].min(), tot[f"pct_{r}"].max()
print(f" reading ({r}): lowest {lo:.1f}% (32 +/- 3.2), highest {hi:.1f}% (75 +/- 7.5):",
"within" if abs(lo - 32) <= 3.2 and abs(hi - 75) <= 7.5 else "outside")
group tracked tracked_sessions equal min_rois mean_rois local
subject
408021 L2/3-S 59 3 True 74 92.333333 [1, 2, 3]
411400 L5-D 162 3 True 597 621.333333 [4, 5, 6]
411424 L2/3-S 55 3 True 80 85.666667 [1, 2, 3]
411771 L5-S 47 3 True 70 79.666667 [1, 2, 3]
412933 L2/3-D 98 3 True 168 254.000000 [4, 5, 6]
413663 L2/3-D 136 3 True 348 496.000000 [1, 2, 3]
418779 L5-S 12 3 True 15 23.333333 [1, 2, 3]
420011 L5-D 51 3 True 159 182.000000 [1, 2, 3]
433414 L2/3-D 118 3 True 300 453.333333 [1, 2, 3]
433448 L5-D 112 3 True 445 859.000000 [1, 2, 3]
433451 L5-D 353 3 True 966 993.666667 [1, 2, 3]
433458 L5-S 70 3 True 87 94.333333 [1, 2, 3]
440889 L2/3-S 147 3 True 210 219.333333 [1, 2, 3]
11 mice of the paper's analyses:
tracked max_a max_b expected pct_a pct_b
group
L2/3-D 254 648 949.3 254 39.2 26.8
L2/3-S 261 364 397.3 261 71.7 65.7
L5-D 516 1570 2034.7 516 32.9 25.4
L5-S 129 172 197.3 129 75.0 65.4
totals equal the expected: True
reading (a): lowest 32.9% (32 +/- 3.2), highest 75.0% (75 +/- 7.5): within
reading (b): lowest 25.4% (32 +/- 3.2), highest 65.7% (75 +/- 7.5): outside
all 13 tracked mice (variant):
tracked max_a max_b expected pct_a pct_b
group
L2/3-D 352 816 1203.3 254 43.1 29.3
L2/3-S 261 364 397.3 261 71.7 65.7
L5-D 678 2167 2656.0 516 31.3 25.5
L5-S 129 172 197.3 129 75.0 65.4
totals equal the expected: False
reading (a): lowest 31.3% (32 +/- 3.2), highest 75.0% (75 +/- 7.5): within
reading (b): lowest 25.5% (32 +/- 3.2), highest 65.7% (75 +/- 7.5): outside
Result: reproduced. Over the 11 mice of the paper's analyses, the tracked ROIs sum to 254 (L2/3 dendrites), 261 (L2/3 somata), 516 (L5 dendrites) and 129 (L5 somata), as stated. With the theoretical maximum read as (a), the smallest ROI count of each mouse's three tracked sessions, the percentages run from 32.9% to 75.0%, within 32 +/- 3.2 and 75 +/- 7.5. Reading (b), the mean count, gives 25.4% to 65.7%, outside. Over all 13 tracked mice (variant) the dendritic totals are 352 and 678, which do not match.
tracked-sessions-overlap¶
The same imaging planes were recorded over three days and many ROIs could be identified in each day's recording, so that individual dendritic segments and somata can be followed over the three sessions.
The criterion is on the tracking indices. The mask centroids of tracked ROIs are added as a check that an index names the same place in the field of view in each session (not part of the criterion; the masks are not registered, so small shifts between sessions remain).
ov = []
for subj, g in trk.groupby("subject"):
ids = [np.sort(S[sid]["tracking_id"][np.isfinite(S[sid]["tracking_id"])]) for sid in g.index]
one_each = all(len(np.unique(i)) == len(i) for i in ids)
same_set = all(np.array_equal(ids[0], i) for i in ids)
c = [S[sid]["tracked_centroids"] for sid in g.index]
d_same, d_other = [], []
for a in range(len(c)):
for b in range(a + 1, len(c)):
ca, cb = c[a].to_numpy(), c[b].reindex(c[a].index).to_numpy()
d_same.append(np.hypot(*(ca - cb).T))
dist = np.hypot(ca[:, None, 0] - cb[None, :, 0], ca[:, None, 1] - cb[None, :, 1])
np.fill_diagonal(dist, np.inf)
d_other.append(dist.min(axis=1))
d_same, d_other = np.concatenate(d_same), np.concatenate(d_other)
ov.append({"subject": subj, "group": g.group.iloc[0], "sessions": len(g), "tracked": len(ids[0]),
"equal_counts": len({len(i) for i in ids}) == 1, "each_index_once": one_each, "same_indices": same_set,
"median_px_same_index": np.median(d_same), "median_px_nearest_other": np.median(d_other),
"frac_same_closer": np.mean(d_same < d_other)})
ov = pd.DataFrame(ov).set_index("subject")
print(ov.round(2).to_string())
print("Tracked mice:", len(ov), "; with three sessions, equal counts, one-to-one indices:",
int((ov.sessions.eq(3) & ov.equal_counts & ov.each_index_once & ov.same_indices).sum()))
group sessions tracked equal_counts each_index_once same_indices median_px_same_index median_px_nearest_other frac_same_closer subject 408021 L2/3-S 3 59 True True True 5.15 31.34 0.96 411400 L5-D 3 162 True True True 14.54 16.00 0.55 411424 L2/3-S 3 55 True True True 2.82 28.35 1.00 411771 L5-S 3 47 True True True 11.83 36.09 0.87 412933 L2/3-D 3 98 True True True 1.94 12.82 0.97 413663 L2/3-D 3 136 True True True 6.76 15.79 0.83 418779 L5-S 3 12 True True True 8.93 62.44 1.00 420011 L5-D 3 51 True True True 4.76 25.27 0.94 433414 L2/3-D 3 118 True True True 9.00 12.84 0.66 433448 L5-D 3 112 True True True 6.58 18.79 0.88 433451 L5-D 3 353 True True True 5.63 11.54 0.79 433458 L5-S 3 70 True True True 3.40 26.80 1.00 440889 L2/3-S 3 147 True True True 2.24 20.01 1.00 Tracked mice: 13 ; with three sessions, equal counts, one-to-one indices: 13
Result: reproduced. All 13 tracked mice have three tracked sessions with equal numbers of tracked ROIs (12 to 353). In every one, each tracking index appears once per session and the three sessions carry the same indices. In the added mask check, the same index lies a median of 1.9 to 14.5 pixels apart between sessions, against 11.5 to 62.4 pixels to the nearest other tracked ROI. The same index is closer than any other tracked ROI for 55% (411400) to 100% of ROIs. The masks are not registered between sessions, so this check is consistent with the tracking, not a proof of it.
fig8a-final-matches and fig8b-final-matches¶
In the example L2/3 dendritic mouse of Fig. 8a, removing four conflicting pairwise matches from the union over session orderings left 136 final matches.
In the example L5 somatic mouse of Fig. 8b, removing two conflicting pairwise matches left 47 final matches.
for subj, exp in (("413663", 136), ("411771", 47)):
print(subj, sess.group[sess.subject == subj].iloc[0], "tracked ROIs per session:",
sess[sess.subject == subj].n_tracked.tolist(), "; expected", exp)
413663 L2/3-D tracked ROIs per session: [136, 136, 136] ; expected 136 411771 L5-S tracked ROIs per session: [47, 47, 47] ; expected 47
Result: reproduced (both). Mouse 413663 has 136 tracked ROIs in each of its three sessions, and mouse 411771 has 47.
fig8a-conflicts, fig8b-conflicts and fig8-somata-less-order-dependent¶
For the same mouse, the union of matches over all session orderings held four conflicting matches, which were removed.
For the same L5 somatic mouse, two conflicting matches were removed from the union over session orderings.
The number of matched ROIs varied less across session orderings for somata than for dendrites.
The union counts and the fewest and most matches over orderings come from the paper's roi_tracking/nway-matched-dfs files (commit in the helper); the tracked counts from the dataset.
ex_rows = []
for subj in ("413663", "411771"):
for sid in sess.index[sess.subject == subj]:
ex = oc.nway_example(subj, sid)["match_perm_examples"]
lv = {ex["match_level"][k]: ex["n_total"][k] for k in ex["match_level"]}
ex_rows.append({"subject": subj, "session": sid, "group": sess.group[sid], "union": lv["union"],
"fewest": lv["fewest"], "most": lv["most"], "tracked_in_dataset": sess.n_tracked[sid]})
ex_df = pd.DataFrame(ex_rows)
ex_df["conflicts"] = ex_df.union - ex_df.tracked_in_dataset
ex_df["range"] = ex_df.most - ex_df.fewest
ex_df["range_frac"] = ex_df.range / ex_df.tracked_in_dataset
print(ex_df.round(4).to_string(index=False))
listing = oc.github_listing(oc.OSCA_REPO, oc.OSCA_COMMIT, "roi_tracking/nway-matched-dfs")
with_perm = sorted({name.split("__")[0].split("_")[1] for name in listing
if "match_perm_examples" in oc.nway_example(*[p.split("_")[1] for p in name.split("__")[:2]])})
print("nway-matched-dfs files:", len(listing), "for", len({n.split("__")[0] for n in listing}),
"mice; mice whose files hold per-ordering counts (match_perm_examples):", with_perm)
subject session group union fewest most tracked_in_dataset conflicts range range_frac 413663 764704289 L2/3-D 140 129 132 136 4 3 0.0221 413663 765193831 L2/3-D 140 129 132 136 4 3 0.0221 413663 766502238 L2/3-D 140 129 132 136 4 3 0.0221 411771 760260459 L5-S 49 47 48 47 2 1 0.0213 411771 760659782 L5-S 49 47 48 47 2 1 0.0213 411771 761269197 L5-S 49 47 48 47 2 1 0.0213
nway-matched-dfs files: 39 for 13 mice; mice whose files hold per-ordering counts (match_perm_examples): ['411771', '413663']
Result: fig8a-conflicts and fig8b-conflicts reproduced; fig8-somata-less-order-dependent blocked. The repository gives union counts of 140 (413663) and 49 (411771), so 140 - 136 = 4 and 49 - 47 = 2 conflicts, as stated. The repository's files hold per-ordering counts for these two mice only, so the comparison across mice cannot be made. In the two examples the range over orderings is 3 matches for the dendritic mouse (129 to 132, 2.2% of its final count) and 1 for the somatic mouse (47 to 48, 2.1%). That is smaller for somata in absolute terms but about equal as a fraction.
gabor-sequence-structure¶
Gabor sequences are repeating 1.5-s sequences of five 300-ms images (A-B-C-D-G), each non-grey image holding 30 Gabor patches, with inconsistent sequences replacing D by U, whose mean orientation is shifted by 90 degrees (drawn from 90, 135, 180 and 225 degrees, against 0, 45, 90 and 135 degrees for the other images).
gs = []
for sid in sess.index:
g = S[sid]["trials"]
g = g[g.stimulus_type == "gabors"].reset_index(drop=True)
frames = g.gabor_frame.to_numpy()
seqs = frames.reshape(-1, 5) if len(frames) % 5 == 0 else None
order_ok = seqs is not None and all(tuple(r) in {("A", "B", "C", "D", "G"), ("A", "B", "C", "U", "G")} for r in seqs)
dur = (g.stop_time - g.start_time).to_numpy()
ori = g.gabor_mean_orientation.to_numpy().reshape(-1, 5)
is_u = seqs[:, 3] == "U"
abc_same = np.all(ori[:, :4][:, :3] == ori[:, [0]], axis=1)
gs.append({"session": sid, "images": len(g), "sequences": len(seqs), "order_ok": order_ok,
"dur_min": dur.min(), "dur_median": np.median(dur), "dur_max": dur.max(),
"dur_within_10pct": np.mean((dur >= 0.27) & (dur <= 0.33)),
"seq_dur_median": np.median(g.start_time.to_numpy()[5::5] - g.start_time.to_numpy()[:-5:5]),
"patches": sorted(set(g.n_patches[g.gabor_frame != "G"])),
"gabor_number": sorted(set(g.gabor_number.dropna())),
"ABCD_oris": sorted(set(ori[:, :3].ravel()) | set(ori[~is_u, 3])),
"U_oris": sorted(set(ori[is_u, 3])),
"U_is_seq_plus_90": bool(np.all(ori[is_u, 3] == ori[is_u, 0] + 90)),
"ABC_share_mean": bool(abc_same.all()), "kappa": sorted(set(g.gabor_kappa))})
gs = pd.DataFrame(gs).set_index("session")
print(gs.drop(columns=["patches", "gabor_number", "ABCD_oris", "U_oris", "kappa"]).round(4).to_string())
print("\nPatches per non-grey image:", {str(x) for x in gs.patches}, "; gabor_number:", {str(x) for x in gs.gabor_number})
print("A to D mean orientations:", {str(x) for x in gs.ABCD_oris}, "; U:", {str(x) for x in gs.U_oris}, "; kappa:", {str(x) for x in gs.kappa})
gs["images_outside"] = [int((~(S[sid]["trials"].query("stimulus_type == 'gabors'").eval("stop_time - start_time").between(0.27, 0.33))).sum()) for sid in gs.index]
print("Images outside 270 to 330 ms, per session where any:", gs.images_outside[gs.images_outside > 0].to_dict(),
"; total", gs.images_outside.sum(), "of", gs.images.sum())
print("Sessions with A-B-C-D/U-G order:", int(gs.order_ok.sum()), "; with every image within 300 ms +/- 10%:",
int((gs.dur_within_10pct == 1).sum()), "; image durations", gs.dur_min.min().round(4), "to", gs.dur_max.max().round(4), "s")
print("Sessions where U equals the sequence's mean + 90:", int(gs.U_is_seq_plus_90.sum()), "of 50")
out = gs.index[gs.images_outside > 0]
print("Supplementary Table 1 QC and experimental notes of the sessions with images outside:")
print(supp.set_index("session_id").loc[out, ["subject_id", "local_session_n", "QC", "experimental_notes"]].to_string())
images sequences order_ok dur_min dur_median dur_max dur_within_10pct seq_dur_median U_is_seq_plus_90 ABC_share_mean
session
758519303 6800 1360 True 0.2838 0.3002 0.3173 1.0000 1.5012 True True
759189643 6800 1360 True 0.2831 0.3002 0.3646 0.9999 1.5013 True True
759660390 6800 1360 True 0.2840 0.3002 0.3170 1.0000 1.5012 True True
759666166 6800 1360 True 0.2911 0.3003 0.3555 0.9994 1.5093 True True
759872185 6800 1360 True 0.2912 0.3005 0.3632 0.9996 1.5110 True True
760269100 6800 1360 True 0.2908 0.3003 0.6044 0.9993 1.5052 True True
761730740 6800 1360 True 0.2842 0.3002 0.3184 1.0000 1.5012 True True
762415169 6800 1360 True 0.2830 0.3002 0.3192 1.0000 1.5012 True True
763646681 6800 1360 True 0.2812 0.3002 0.3172 1.0000 1.5012 True True
761624763 6800 1360 True 0.2840 0.3002 0.3177 1.0000 1.5012 True True
761944562 6800 1360 True 0.2822 0.3002 0.3189 1.0000 1.5013 True True
762250376 6800 1360 True 0.2835 0.3002 0.3179 1.0000 1.5013 True True
760260459 6800 1360 True 0.2785 0.3002 0.3181 1.0000 1.5013 True True
760659782 6800 1360 True 0.2840 0.3001 0.3196 1.0000 1.5012 True True
761269197 6800 1360 True 0.2835 0.3002 0.3206 1.0000 1.5012 True True
763949859 6800 1360 True 0.2829 0.3002 0.3196 1.0000 1.5012 True True
764897534 6800 1360 True 0.2847 0.3002 0.3168 1.0000 1.5012 True True
765427689 6800 1360 True 0.2840 0.3002 0.3179 1.0000 1.5013 True True
766755831 6800 1360 True 0.2838 0.3002 0.3171 1.0000 1.5013 True True
767254594 6800 1360 True 0.2838 0.3002 0.3173 1.0000 1.5012 True True
768807532 6800 1360 True 0.2842 0.3002 0.3170 1.0000 1.5013 True True
764704289 6800 1360 True 0.2844 0.3002 0.3173 1.0000 1.5013 True True
765193831 6800 1360 True 0.2839 0.3002 0.3172 1.0000 1.5012 True True
766502238 6800 1360 True 0.2829 0.3002 0.3186 1.0000 1.5013 True True
777496949 6800 1360 True 0.2841 0.3002 0.3170 1.0000 1.5012 True True
778374308 6800 1360 True 0.2808 0.3002 0.3173 1.0000 1.5012 True True
779152062 6800 1360 True 0.2828 0.3002 0.3232 1.0000 1.5013 True True
777914830 6800 1360 True 0.2834 0.3002 0.3208 1.0000 1.5013 True True
778864809 6800 1360 True 0.2839 0.3002 0.3169 1.0000 1.5013 True True
779650018 6800 1360 True 0.2829 0.3002 0.3214 1.0000 1.5012 True True
826187862 6800 1360 True 0.2876 0.3001 0.3190 1.0000 1.5013 True True
826773996 6800 1360 True 0.2848 0.3001 0.3168 1.0000 1.5012 True True
827833392 6800 1360 True 0.2841 0.3002 0.3171 1.0000 1.5012 True True
826338612 6800 1360 True 0.2875 0.3002 0.3199 1.0000 1.5014 True True
826819032 6800 1360 True 0.2837 0.3002 0.3174 1.0000 1.5012 True True
828816509 6800 1360 True 0.2832 0.3002 0.3183 1.0000 1.5012 True True
829283315 6800 1360 True 0.2832 0.3002 0.3184 1.0000 1.5012 True True
823453391 6800 1360 True 0.2753 0.3002 0.3203 1.0000 1.5012 True True
824434038 6800 1360 True 0.2830 0.3002 0.3170 1.0000 1.5012 True True
825180479 6800 1360 True 0.2741 0.3002 0.3210 1.0000 1.5012 True True
826659257 6800 1360 True 0.2831 0.3002 0.3176 1.0000 1.5012 True True
827300090 6800 1360 True 0.2845 0.3002 0.3171 1.0000 1.5012 True True
828475005 6800 1360 True 0.2804 0.3002 0.3184 1.0000 1.5013 True True
829520904 6800 1360 True 0.2829 0.3002 0.3179 1.0000 1.5012 True True
832883243 6800 1360 True 0.2875 0.3003 0.3198 1.0000 1.5015 True True
833704570 6800 1360 True 0.2874 0.3002 0.3196 1.0000 1.5017 True True
834403597 6800 1360 True 0.2874 0.3002 0.3191 1.0000 1.5014 True True
836968429 6800 1360 True 0.2841 0.3002 0.3160 1.0000 1.5012 True True
837360280 6800 1360 True 0.2782 0.3002 0.3226 1.0000 1.5012 True True
838633305 6800 1360 True 0.2839 0.3002 0.3172 1.0000 1.5012 True True
Patches per non-grey image: {'[30]'} ; gabor_number: {'[30.0]'}
A to D mean orientations: {'[np.float64(0.0), np.float64(45.0), np.float64(90.0), np.float64(135.0)]'} ; U: {'[np.float64(90.0), np.float64(135.0), np.float64(180.0), np.float64(225.0)]'} ; kappa: {'[16.0]'}
Images outside 270 to 330 ms, per session where any: {'759189643': 1, '759666166': 4, '759872185': 3, '760269100': 5} ; total 13 of 340000
Sessions with A-B-C-D/U-G order: 50 ; with every image within 300 ms +/- 10%: 46 ; image durations 0.2741 to 0.6044 s
Sessions where U equals the sequence's mean + 90: 50 of 50
Supplementary Table 1 QC and experimental notes of the sessions with images outside:
subject_id local_session_n QC experimental_notes
session
759189643 408021 2 passed NaN
759666166 411400 1 failed dropped behavioral and/or eye tracking frames (5), *stimulus frames (953)
759872185 411400 2 failed eye tracking video truncated (half missing), dropped behavioral and/or eye tracking frames (4), *stimulus frames (1086)
760269100 411400 3 failed dropped behavioral and/or eye tracking frames (7), *stimulus frames (696)
Result: partially reproduced. In all 50 sessions the 1360 sequences follow A-B-C-D-G or A-B-C-U-G, every non-grey image holds 30 Gabor patches, A to D take mean orientations 0, 45, 90 and 135 degrees, and U takes 90, 135, 180 and 225 degrees, always the sequence's mean plus 90. Image durations have a median of 300 ms. Every image lies within 300 ms +/- 10% in 46 of 50 sessions. Four sessions hold 1 to 5 images outside it (up to 604 ms), 13 of 340000 images in all; the three sessions of mouse 411400 among them failed QC, and Supplementary Table 1's experimental notes record dropped stimulus frames for them (printed above). The criterion asks for every image in every session, so the duration part holds in 46 of 50 sessions. The criterion names no partial outcome; the claim holds in part, which is the protocol's partially reproduced, and a strict reading that admits only reproduced or not would give not reproduced.
visual-flow-structure¶
Visual flow is 105 white squares of 8 by 8 degrees moving at 50 degrees per second, in two consecutive periods (rightward and leftward) in random order, with 25% of squares reversed for 2 to 4 s during inconsistent flow.
vf = []
for sid in sess.index:
t = S[sid]["trials"].reset_index(drop=True)
v = t[t.stimulus_type == "visflow"]
dirs = v.main_flow_direction.to_numpy()
changes = int((dirs[1:] != dirs[:-1]).sum())
contiguous = all(np.all(np.diff(v.index[v.main_flow_direction == d]) == 1) for d in set(dirs))
runs = []
for d in set(dirs):
u = v[v.main_flow_direction == d].unexpected.to_numpy()
dd = v[v.main_flow_direction == d]
edges = np.flatnonzero(np.diff(np.concatenate([[0], u, [0]])))
for a, b in zip(edges[::2], edges[1::2]):
runs.append(dd.stop_time.iloc[b - 1] - dd.start_time.iloc[a])
sq = S[sid]["squares"]
speed = {}
for k, (x, y, d) in sq.items():
dx = np.diff(x.astype(float), axis=1)
step = np.median(np.abs(dx[np.abs(dx) < 100])) # px per stimulus frame (60 Hz), wraps excluded
speed[k] = step * 60
speed[k + "_dir"] = d
# Squares moving against the main flow at the trial's first frame (reversed squares that
# leave the screen re-enter with the main flow, so the fraction falls later in the trial).
moving = np.where(np.abs(dx[:, 0]) < 100, np.sign(dx[:, 0]), 0)
speed[k + "_frac_against"] = np.mean(moving == -np.sign(np.median(dx)))
vf.append({"session": sid, "squares": sorted(set(v.square_number)), "size_px": sorted(set(v.square_size)),
"flipped": sorted(set(v.square_proportion_flipped)), "direction_changes": changes,
"periods_contiguous": contiguous, "first_direction": dirs[0],
"reversal_min_s": min(runs), "reversal_max_s": max(runs), "reversals": len(runs),
"speed_px_s": speed["consistent"], "frac_squares_against_in_reversal": speed["inconsistent_frac_against"]})
vf = pd.DataFrame(vf).set_index("session")
print(vf.drop(columns=["squares", "size_px", "flipped"]).round(3).to_string())
print("\nSquares:", {str(x) for x in vf.squares}, "; size (px):", {str(x) for x in vf.size_px},
"; proportion reversed:", {str(x) for x in vf.flipped})
print("Sessions with two consecutive direction periods:", int(((vf.direction_changes == 1) & vf.periods_contiguous).sum()),
"; first direction:", vf.first_direction.value_counts().to_dict())
print("Reversal durations (s):", vf.reversal_min_s.min().round(3), "to", vf.reversal_max_s.max().round(3))
print("Square speed (px/s):", vf.speed_px_s.min(), "to", vf.speed_px_s.max(), "; speed / size (1/s):",
(vf.speed_px_s / 128).min(), "to", (vf.speed_px_s / 128).max(), "; paper 50 deg/s over 8 deg =", 50 / 8)
print("Fraction of squares moving against the flow at the first frame of the first reversed trial:",
vf.frac_squares_against_in_reversal.min().round(3), "to", vf.frac_squares_against_in_reversal.max().round(3),
"; median", vf.frac_squares_against_in_reversal.median().round(3), "; mean", vf.frac_squares_against_in_reversal.mean().round(3))
print("Not recorded: square size and speed in degrees (the table gives pixels of the unwarped stimulus).")
direction_changes periods_contiguous first_direction reversal_min_s reversal_max_s reversals speed_px_s frac_squares_against_in_reversal
session
758519303 1 True right (temp) 2.001 4.004 31 780.0 0.248
759189643 1 True right (temp) 1.998 4.004 34 780.0 0.229
759660390 1 True right (temp) 1.997 4.004 33 780.0 0.219
759666166 1 True right (temp) 1.997 4.004 31 780.0 0.210
759872185 1 True left (nasal) 2.001 4.009 35 780.0 0.257
760269100 1 True right (temp) 2.001 4.004 34 780.0 0.200
761730740 1 True right (temp) 1.997 4.004 31 780.0 0.305
762415169 1 True left (nasal) 1.998 4.005 34 780.0 0.248
763646681 1 True left (nasal) 1.999 4.004 32 780.0 0.229
761624763 1 True right (temp) 1.997 4.004 34 780.0 0.200
761944562 1 True right (temp) 1.994 4.004 30 780.0 0.324
762250376 1 True left (nasal) 1.997 4.008 35 780.0 0.295
760260459 1 True left (nasal) 1.997 4.004 32 780.0 0.238
760659782 1 True left (nasal) 1.997 4.004 29 780.0 0.286
761269197 1 True left (nasal) 1.999 4.004 34 780.0 0.295
763949859 1 True right (temp) 1.998 4.004 32 780.0 0.295
764897534 1 True right (temp) 1.995 4.004 34 780.0 0.229
765427689 1 True left (nasal) 1.997 4.004 37 780.0 0.257
766755831 1 True left (nasal) 2.000 4.004 30 780.0 0.210
767254594 1 True left (nasal) 2.001 4.004 35 780.0 0.276
768807532 1 True left (nasal) 2.001 4.004 30 780.0 0.305
764704289 1 True left (nasal) 2.001 4.004 33 780.0 0.248
765193831 1 True left (nasal) 2.001 4.006 34 780.0 0.305
766502238 1 True right (temp) 1.998 4.005 29 780.0 0.152
777496949 1 True right (temp) 1.998 4.004 30 780.0 0.219
778374308 1 True left (nasal) 1.997 4.004 31 780.0 0.276
779152062 1 True right (temp) 2.001 4.004 30 780.0 0.248
777914830 1 True right (temp) 2.001 4.004 32 780.0 0.276
778864809 1 True left (nasal) 1.997 4.014 29 780.0 0.257
779650018 1 True left (nasal) 1.999 4.004 32 780.0 0.238
826187862 1 True left (nasal) 1.998 4.010 34 780.0 0.267
826773996 1 True right (temp) 1.997 4.004 33 780.0 0.248
827833392 1 True left (nasal) 1.997 4.004 31 780.0 0.267
826338612 1 True left (nasal) 2.001 4.004 35 780.0 0.238
826819032 1 True right (temp) 1.998 4.007 31 780.0 0.219
828816509 1 True right (temp) 1.997 4.004 34 780.0 0.210
829283315 1 True right (temp) 1.997 4.004 30 780.0 0.210
823453391 1 True right (temp) 2.001 4.004 30 780.0 0.229
824434038 1 True right (temp) 2.001 4.004 34 780.0 0.229
825180479 1 True left (nasal) 2.001 4.004 34 780.0 0.257
826659257 1 True left (nasal) 1.998 4.004 31 780.0 0.238
827300090 1 True right (temp) 1.999 4.004 33 780.0 0.219
828475005 1 True left (nasal) 2.001 4.004 33 780.0 0.257
829520904 1 True left (nasal) 2.000 4.004 33 780.0 0.248
832883243 1 True left (nasal) 1.998 4.004 30 780.0 0.200
833704570 1 True right (temp) 2.001 4.004 35 780.0 0.305
834403597 1 True right (temp) 2.001 4.004 32 780.0 0.295
836968429 1 True right (temp) 2.001 4.005 31 780.0 0.257
837360280 1 True right (temp) 1.995 4.013 33 780.0 0.248
838633305 1 True right (temp) 1.997 4.004 31 780.0 0.248
Squares: {'[105.0]'} ; size (px): {'[128.0]'} ; proportion reversed: {'[0.0, 0.25]'}
Sessions with two consecutive direction periods: 50 ; first direction: {'right (temp)': 26, 'left (nasal)': 24}
Reversal durations (s): 1.994 to 4.014
Square speed (px/s): 780.0 to 780.0 ; speed / size (1/s): 6.09375 to 6.09375 ; paper 50 deg/s over 8 deg = 6.25
Fraction of squares moving against the flow at the first frame of the first reversed trial: 0.152 to 0.324 ; median 0.248 ; mean 0.249
Not recorded: square size and speed in degrees (the table gives pixels of the unwarped stimulus).
Result: reproduced. In all 50 sessions the table records 105 squares and a reversed proportion of 0.25, and the two directions run as two consecutive periods (rightward first in 26 sessions). Reversals last 1.99 to 4.01 s. From the square positions, a median of 24.8% of squares (15.2 to 32.4% by session) move against the flow at the first frame of a session's first reversal. The size (8 degrees) and speed (50 degrees/s) cannot be tested: the table gives the unwarped stimulus in pixels, 128 pixels and 780 pixels/s. Their ratio, 6.09 per second, is within 3% of the paper's 50/8 = 6.25.
session-stimulus-durations¶
Each imaging session lasted 70 min, with 34 min of Gabor sequences and 17 min of visual flow in each direction, each stimulus period flanked by 30 s of grey screen.
sd = []
for sid in sess.index:
t = S[sid]["trials"]
per = t.groupby("stimulus_template_name").agg(start=("start_time", "min"), stop=("stop_time", "max"))
grey = t[t.stimulus_type == "grayscreen"]
sd.append({"session": sid, "gabor_min": (per.stop - per.start)["gabors"] / 60,
"flow_right_min": (per.stop - per.start)["visflow_right"] / 60,
"flow_left_min": (per.stop - per.start)["visflow_left"] / 60,
"grey_min_s": (grey.stop_time - grey.start_time).min(), "grey_max_s": (grey.stop_time - grey.start_time).max(),
"grey_periods": len(grey)})
sd = pd.DataFrame(sd).set_index("session")
sd["ok"] = (sd.gabor_min.between(30.6, 37.4) & sd.flow_right_min.between(15.3, 18.7) & sd.flow_left_min.between(15.3, 18.7)
& (sd.grey_min_s >= 27) & (sd.grey_max_s <= 33))
print(sd.describe().round(3).to_string())
print("Sessions meeting all three:", int(sd.ok.sum()), "of 50")
gabor_min flow_right_min flow_left_min grey_min_s grey_max_s grey_periods count 50.000 50.000 50.000 50.000 50.000 50.0 mean 34.048 17.014 17.015 29.983 30.032 4.0 std 0.061 0.002 0.005 0.000 0.003 0.0 min 34.027 17.013 17.013 29.983 30.028 4.0 25% 34.028 17.014 17.014 29.983 30.030 4.0 50% 34.028 17.014 17.014 29.983 30.030 4.0 75% 34.028 17.014 17.014 29.983 30.033 4.0 max 34.310 17.029 17.043 29.983 30.039 4.0 Sessions meeting all three: 50 of 50
Result: reproduced. In all 50 sessions the Gabor period lasts 34.03 to 34.31 min, each flow period 17.01 to 17.04 min, and each of the four grey periods 29.98 to 30.04 s.
inconsistent-fractions¶
Inconsistent sequences make up about 7% of Gabor sequences and 5% of visual flow time.
fr = []
for sid in sess.index:
t = S[sid]["trials"]
g = t[t.stimulus_type == "gabors"]
v = t[t.stimulus_type == "visflow"]
vdur = v.stop_time - v.start_time
fr.append({"session": sid, "gabor_pct": 100 * (g.gabor_frame == "U").sum() / ((g.gabor_frame == "D").sum() + (g.gabor_frame == "U").sum()),
"flow_time_pct": 100 * vdur[v.unexpected == 1].sum() / vdur.sum()})
fr = pd.DataFrame(fr).set_index("session")
print(fr.round(2).T.to_string())
print("Mean over sessions: Gabor", fr.gabor_pct.mean().round(2), "% (7 +/- 0.7); flow", fr.flow_time_pct.mean().round(2),
"% (5 +/- 0.5); ranges", fr.gabor_pct.min().round(2), "to", fr.gabor_pct.max().round(2), "and",
fr.flow_time_pct.min().round(2), "to", fr.flow_time_pct.max().round(2))
session 758519303 759189643 759660390 759666166 759872185 760269100 761730740 762415169 763646681 761624763 761944562 762250376 760260459 760659782 761269197 763949859 764897534 765427689 766755831 767254594 768807532 764704289 765193831 766502238 777496949 778374308 779152062 777914830 778864809 779650018 826187862 826773996 827833392 826338612 826819032 828816509 829283315 823453391 824434038 825180479 826659257 827300090 828475005 829520904 832883243 833704570 834403597 836968429 837360280 838633305 gabor_pct 6.91 6.62 7.72 6.84 6.69 6.91 6.62 7.57 6.62 7.13 7.28 7.28 6.03 6.69 6.54 7.28 7.50 7.87 7.06 6.91 6.91 7.06 7.21 6.91 7.72 6.62 6.91 6.1 6.47 6.84 7.43 6.84 6.62 7.43 7.94 6.40 7.21 6.99 6.91 6.99 6.62 6.91 7.28 6.99 7.06 6.40 6.76 7.21 6.84 6.62 flow_time_pct 4.31 4.75 4.56 4.56 5.39 4.46 4.66 5.15 4.56 4.75 4.16 4.90 4.75 3.92 5.15 4.56 4.71 5.44 4.31 5.15 4.22 5.20 5.29 4.31 4.07 4.36 4.51 5.0 3.97 4.61 4.75 4.75 4.56 5.05 4.51 4.61 4.12 4.31 5.00 4.80 4.66 4.41 4.95 4.80 4.51 5.49 4.56 4.71 4.95 4.71 Mean over sessions: Gabor 6.96 % (7 +/- 0.7); flow 4.68 % (5 +/- 0.5); ranges 6.03 to 7.94 and 3.92 to 5.49
Result: reproduced. Over the 50 sessions, inconsistent sequences make up 6.96% of Gabor sequences (6.03 to 7.94% per session; 7 +/- 0.7) and reversed flow 4.68% of flow time (3.92 to 5.49%; 5 +/- 0.5).
inconsistent-blocks¶
Each session is divided into about 30 blocks, each of 30 to 90 s of consistent stimulus followed by 3 to 6 s (Gabor) or 2 to 4 s (visual flow) of inconsistent stimulus, in multiples of 1.5 s (Gabor) and 1 s (visual flow).
A block is a run of consistent stimulus followed by a run of inconsistent stimulus, within one stimulus period. Gabor runs are counted in sequences (the unexpected flag is set for the whole A-B-C-U-G sequence), flow runs in 1-s trials.
blocks = []
for sid in sess.index:
t = S[sid]["trials"]
for name in ("gabors", "visflow_right", "visflow_left"):
x = t[t.stimulus_template_name == name]
if name == "gabors":
x = x[x.gabor_frame == "A"] # one row per sequence
ends = t[(t.stimulus_template_name == name) & (t.gabor_frame == "G")].stop_time.to_numpy()
else:
ends = x.stop_time.to_numpy()
u, st = x.unexpected.to_numpy(), x.start_time.to_numpy()
i = 0
while i < len(u):
j = i
while j < len(u) and u[j] == 0:
j += 1
k = j
while k < len(u) and u[k] == 1:
k += 1
if k > j: # a consistent run followed by an inconsistent run
blocks.append({"session": sid, "stimulus": name, "consistent_s": st[j] - st[i], "inconsistent_s": ends[k - 1] - st[j],
"n_units_inconsistent": k - j, "n_units_consistent": j - i})
i = k if k > i else i + 1
blocks = pd.DataFrame(blocks)
blocks["kind"] = np.where(blocks.stimulus == "gabors", "gabor", "flow")
inc_lim = {"gabor": (3 * 0.9, 6 * 1.1), "flow": (2 * 0.9, 4 * 1.1)}
blocks["consistent_ok"] = blocks.consistent_s.between(30 * 0.9, 90 * 1.1)
blocks["inconsistent_ok"] = [inc_lim[k][0] <= v <= inc_lim[k][1] for k, v in zip(blocks.kind, blocks.inconsistent_s)]
print(blocks.groupby("stimulus")[["consistent_s", "inconsistent_s"]].describe().round(2).T.to_string())
print("\nInconsistent runs, in units (Gabor sequences of 1.5 s, flow trials of 1 s):",
blocks.groupby("kind").n_units_inconsistent.value_counts().sort_index().to_dict())
counts = {"(a) all stimuli": blocks.groupby("session").size(),
"(b) Gabor": blocks[blocks.kind == "gabor"].groupby("session").size(),
"(b) flow, both directions": blocks[blocks.kind == "flow"].groupby("session").size(),
"(c) flow right": blocks[blocks.stimulus == "visflow_right"].groupby("session").size(),
"(c) flow left": blocks[blocks.stimulus == "visflow_left"].groupby("session").size()}
for k, v in counts.items():
print(f"{k}: mean blocks per session {v.mean():.2f} (range {v.min()} to {v.max()}); within 30 +/- 3: {abs(v.mean() - 30) <= 3}")
for kind in ("gabor", "flow"):
b = blocks[blocks.kind == kind]
print(f"{kind}: blocks with consistent and inconsistent durations in range (widened 10%): "
f"{100 * (b.consistent_ok & b.inconsistent_ok).mean():.1f}% (consistent {100 * b.consistent_ok.mean():.1f}%, "
f"inconsistent {100 * b.inconsistent_ok.mean():.1f}%)")
print("All blocks:", f"{100 * (blocks.consistent_ok & blocks.inconsistent_ok).mean():.1f}%")
stimulus gabors visflow_left visflow_right
consistent_s count 1575.00 816.00 799.00
mean 60.34 59.60 60.92
std 17.94 17.41 17.90
min 30.02 30.02 30.02
25% 45.04 44.04 45.04
50% 60.06 60.05 61.05
75% 76.15 74.06 77.06
max 90.96 90.07 90.07
inconsistent_s count 1575.00 816.00 799.00
mean 4.52 2.95 2.96
std 1.22 0.83 0.80
min 2.99 1.99 1.99
25% 3.00 2.00 2.00
50% 4.50 3.00 3.00
75% 6.00 4.00 4.00
max 6.11 4.01 4.01
Inconsistent runs, in units (Gabor sequences of 1.5 s, flow trials of 1 s): {('flow', 2): 578, ('flow', 3): 531, ('flow', 4): 506, ('gabor', 2): 511, ('gabor', 3): 542, ('gabor', 4): 522}
(a) all stimuli: mean blocks per session 63.80 (range 59 to 71); within 30 +/- 3: False
(b) Gabor: mean blocks per session 31.50 (range 29 to 34); within 30 +/- 3: True
(b) flow, both directions: mean blocks per session 32.30 (range 29 to 37); within 30 +/- 3: True
(c) flow right: mean blocks per session 15.98 (range 14 to 19); within 30 +/- 3: False
(c) flow left: mean blocks per session 16.32 (range 14 to 19); within 30 +/- 3: False
gabor: blocks with consistent and inconsistent durations in range (widened 10%): 100.0% (consistent 100.0%, inconsistent 100.0%)
flow: blocks with consistent and inconsistent durations in range (widened 10%): 100.0% (consistent 100.0%, inconsistent 100.0%)
All blocks: 100.0%
Result: reproduced. Under reading (b), per stimulus, the sessions hold a mean of 31.5 Gabor blocks and 32.3 flow blocks (both directions together), both within 30 +/- 3. Reading (a), all stimuli together, gives 63.8, and reading (c), per flow direction, gives 16.0 and 16.3; both are outside. Every block has 30.0 to 91.0 s of consistent stimulus and 3.0 to 6.1 s (Gabor; 2 to 4 sequences of 1.5 s) or 2.0 to 4.0 s (flow; 2 to 4 one-second trials) of inconsistent stimulus.
fig5-example-responses¶
Both somatic and dendritic ROIs responded clearly to the Gabor and visual flow stimuli, many with increased fluorescence at stimulus onset.
Session 1 of the 11 mice of the paper's analyses. The selection is made within each mouse's
session (helper select_gabor_rois and select_flow_rois), on robust-scaled dF/F; the
selected ROIs are pooled per line and plane. Panels: (a) consistent sequences around D onset,
(b) inconsistent sequences around U onset, (c) temporal-to-nasal (leftward) flow and (d)
nasal-to-temporal (rightward) flow, around inconsistent flow onset.
s1 = sess[sess.analysed & (sess.local_n == 1)]
panels = {"a": ("gabor_D", "gabor_t"), "b": ("gabor_U", "gabor_t"), "c": ("flow_left", "flow_t"), "d": ("flow_right", "flow_t")}
groups = ["L2/3-D", "L2/3-S", "L5-D", "L5-S"]
def pooled(group, key, scaled="scaled", sel_key=None):
"""Selected ROIs' mean traces, pooled over the group's session-1 recordings, with the mouse of each."""
traces, mouse = [], []
for sid in s1.index[s1.group == group]:
f5 = R[sid]["fig5"]
sel = f5[f"{sel_key or key}_{scaled}_sel"]
traces.append(f5[f"{key}_{scaled}_mean"][sel])
mouse += [sess.subject[sid]] * len(sel)
return np.concatenate(traces), np.array(mouse)
rows5, per_mouse5 = [], []
for scaled in ("scaled", "unscaled"):
for p, (key, tkey) in panels.items():
for grp in groups:
tr, mouse = pooled(grp, key, scaled)
t = R[s1.index[0]]["fig5"][tkey]
pre = tr[:, t < 0].mean() if len(tr) else np.nan
post = tr[:, t >= 0].mean() if len(tr) else np.nan
rows5.append({"traces": scaled, "panel": p, "group": grp, "rois": len(tr), "mice": len(set(mouse)),
"pre": pre, "post": post, "post_minus_pre": post - pre, "higher_after": post > pre})
for m in sorted(set(s1.subject[s1.group == grp])):
sel = mouse == m
per_mouse5.append({"traces": scaled, "panel": p, "group": grp, "mouse": m, "rois": int(sel.sum()),
"post_minus_pre": (tr[sel][:, t >= 0].mean() - tr[sel][:, t < 0].mean()) if sel.any() else np.nan})
rows5 = pd.DataFrame(rows5)
print("Selected ROIs, robust-scaled dF/F (main):")
print(rows5[rows5.traces == "scaled"].round(4).to_string(index=False))
print("\nPer mouse (robust-scaled):")
print(pd.DataFrame(per_mouse5).query("traces == 'scaled'").pivot_table(index=["group", "mouse"], columns="panel",
values=["rois", "post_minus_pre"]).round(3).to_string())
n_sess1 = {sid: (R[sid]["n_rois"], int(R[sid]["fig5"]["snr_above"].sum()), R[sid]["fig5"]["gabor_D_n"], R[sid]["fig5"]["gabor_U_n"],
R[sid]["fig5"]["flow_left_n"], R[sid]["fig5"]["flow_right_n"]) for sid in s1.index}
thr5 = pd.DataFrame([{"session": sid, "mouse": sess.subject[sid], "group": sess.group[sid], "selection": key,
**R[sid]["fig5"][f"{key}_scaled_thr"], "selected": len(R[sid]["fig5"][f"{key}_scaled_sel"])}
for sid in s1.index for key in ("gabor_D", "gabor_U", "flow_left", "flow_right")])
print("\nSelection per session 1 (robust-scaled): candidates above median SNR, 75th-percentile thresholds, ROIs kept:")
print(thr5.round(4).to_string(index=False))
print("\nPer session 1: ROIs, ROIs above median SNR, D sequences, U sequences, left and right flow onsets:", n_sess1)
for scaled in ("scaled", "unscaled"):
r = rows5[rows5.traces == scaled]
for p in panels:
q = r[r.panel == p]
print(f"{scaled}, panel {p}: planes with selected ROIs {int((q.rois > 0).sum())} of 4; higher after onset {int(q.higher_after.sum())} of 4")
fig, axes = plt.subplots(4, 4, figsize=(13, 10), sharex="col")
for j, (p, (key, tkey)) in enumerate(panels.items()):
for i, grp in enumerate(groups):
tr, _ = pooled(grp, key)
t = R[s1.index[0]]["fig5"][tkey]
ax = axes[i, j]
if len(tr):
m, se = tr.mean(axis=0), tr.std(axis=0, ddof=1) / np.sqrt(len(tr)) if len(tr) > 1 else 0 * tr[0]
ax.plot(t, m, color="k")
ax.fill_between(t, m - se, m + se, color="0.7")
ax.axvline(0, ls="--", color="0.5")
ax.set_title(f"{grp}, panel {p}, n = {len(tr)}", fontsize=9)
for ax in axes[-1]:
ax.set_xlabel("time from D, U or inconsistent flow onset (s)")
fig.supylabel("robust-scaled dF/F, mean +/- SEM over selected ROIs")
fig.tight_layout()
plt.show()
lo_hi = [(pooled(g, k)[0].mean(axis=0).min(), pooled(g, k)[0].mean(axis=0).max()) for k, _ in panels.values() for g in groups if len(pooled(g, k)[0])]
print("Range of the plotted means:", round(min(a for a, _ in lo_hi), 3), "to", round(max(b for _, b in lo_hi), 3))
# Decision rule per plane, under the criterion's three readings of the Gabor panel (answer of 2026-10-22):
# (a) panel a, (b) panel b, (c) both panels; the two flow panels always enter.
readings5 = {"a": ["a"], "b": ["b"], "c": ["a", "b"]}
for scaled in ("scaled", "unscaled"):
r = rows5[rows5.traces == scaled].set_index(["panel", "group"])
for name, gab in readings5.items():
holds = {g: bool(all(r.loc[(p, g), "rois"] > 0 and r.loc[(p, g), "higher_after"] for p in gab + ["c", "d"])) for g in groups}
n = sum(holds.values())
out = "reproduced" if n == 4 else "partially reproduced" if n >= 2 else "not reproduced"
print(f"{scaled}, reading ({name}): rule holds in {n} of 4 planes {holds} -> {out}")
Selected ROIs, robust-scaled dF/F (main):
traces panel group rois mice pre post post_minus_pre higher_after
scaled a L2/3-D 56 2 0.0090 0.0745 0.0655 True
scaled a L2/3-S 14 3 0.1590 0.0964 -0.0626 False
scaled a L5-D 116 3 0.0403 0.0656 0.0253 True
scaled a L5-S 8 3 0.1323 0.1123 -0.0200 False
scaled b L2/3-D 50 2 0.0164 0.0502 0.0338 True
scaled b L2/3-S 19 3 0.1496 0.2116 0.0620 True
scaled b L5-D 101 3 0.0550 0.0536 -0.0014 False
scaled b L5-S 10 3 0.2472 0.5527 0.3056 True
scaled c L2/3-D 44 2 0.0162 0.0745 0.0583 True
scaled c L2/3-S 14 3 0.0692 0.2523 0.1831 True
scaled c L5-D 90 3 0.0238 0.0577 0.0339 True
scaled c L5-S 8 3 0.0410 0.2473 0.2063 True
scaled d L2/3-D 48 2 0.0094 0.0689 0.0596 True
scaled d L2/3-S 12 3 0.0580 0.2342 0.1763 True
scaled d L5-D 76 3 0.0276 0.0575 0.0299 True
scaled d L5-S 7 2 0.0303 0.1020 0.0717 True
Per mouse (robust-scaled):
post_minus_pre rois
panel a b c d a b c d
group mouse
L2/3-D 413663 0.051 0.004 0.073 0.079 23.0 19.0 25.0 18.0
433414 0.076 0.052 0.039 0.048 33.0 31.0 19.0 30.0
L2/3-S 408021 -0.170 0.215 0.148 0.216 3.0 3.0 4.0 5.0
411424 -0.241 -0.179 0.237 0.121 2.0 4.0 5.0 4.0
440889 0.013 0.104 0.158 0.183 9.0 12.0 5.0 3.0
L5-D 420011 0.059 -0.025 0.030 0.038 10.0 5.0 6.0 8.0
433448 0.007 0.035 0.038 0.023 58.0 47.0 54.0 47.0
433451 0.040 -0.034 0.028 0.041 48.0 49.0 30.0 21.0
L5-S 411771 -0.134 0.449 0.168 0.055 5.0 4.0 3.0 3.0
418779 0.085 0.083 0.157 NaN 1.0 1.0 1.0 0.0
433458 0.213 0.235 0.248 0.085 2.0 5.0 4.0 4.0
Selection per session 1 (robust-scaled): candidates above median SNR, 75th-percentile thresholds, ROIs kept:
session mouse group selection candidates std_p75 skew_p75 corr_p75 selected diff_p75
758519303 408021 L2/3-S gabor_D 48 0.0959 1.0009 0.0517 3 NaN
758519303 408021 L2/3-S gabor_U 48 0.1146 0.5903 0.0813 3 NaN
758519303 408021 L2/3-S flow_left 48 NaN NaN 0.0310 4 0.0263
758519303 408021 L2/3-S flow_right 48 NaN NaN 0.0133 5 0.0685
761624763 411424 L2/3-S gabor_D 43 0.1313 0.8824 0.0762 2 NaN
761624763 411424 L2/3-S gabor_U 43 0.1461 0.8762 0.0923 4 NaN
761624763 411424 L2/3-S flow_left 43 NaN NaN 0.0207 5 0.1604
761624763 411424 L2/3-S flow_right 43 NaN NaN 0.0091 4 0.0948
760260459 411771 L5-S gabor_D 45 0.0714 0.5734 0.0371 5 NaN
760260459 411771 L5-S gabor_U 45 0.0872 0.8322 0.0640 4 NaN
760260459 411771 L5-S flow_left 45 NaN NaN 0.0037 3 0.0663
760260459 411771 L5-S flow_right 45 NaN NaN 0.0058 3 0.0317
764704289 413663 L2/3-D gabor_D 314 0.0235 0.5549 0.0077 23 NaN
764704289 413663 L2/3-D gabor_U 314 0.0397 0.3876 0.0071 19 NaN
764704289 413663 L2/3-D flow_left 314 NaN NaN 0.0231 25 0.0334
764704289 413663 L2/3-D flow_right 314 NaN NaN 0.0155 18 0.0306
777496949 418779 L5-S gabor_D 7 0.0408 0.3775 0.0143 1 NaN
777496949 418779 L5-S gabor_U 7 0.0494 0.3436 0.0062 1 NaN
777496949 418779 L5-S flow_left 7 NaN NaN 0.0565 1 0.0056
777496949 418779 L5-S flow_right 7 NaN NaN 0.0201 0 0.0324
777914830 420011 L5-D gabor_D 102 0.0205 0.5080 0.0021 10 NaN
777914830 420011 L5-D gabor_U 102 0.0398 0.3468 0.0039 5 NaN
777914830 420011 L5-D flow_left 102 NaN NaN 0.0105 6 0.0134
777914830 420011 L5-D flow_right 102 NaN NaN 0.0165 8 0.0161
826187862 433414 L2/3-D gabor_D 363 0.0231 0.4166 0.0123 33 NaN
826187862 433414 L2/3-D gabor_U 363 0.0377 0.3506 0.0119 31 NaN
826187862 433414 L2/3-D flow_left 363 NaN NaN 0.0202 19 0.0206
826187862 433414 L2/3-D flow_right 363 NaN NaN 0.0162 30 0.0235
826338612 433448 L5-D gabor_D 818 0.0172 0.3048 0.0041 58 NaN
826338612 433448 L5-D gabor_U 818 0.0355 0.3445 0.0061 47 NaN
826338612 433448 L5-D flow_left 818 NaN NaN 0.0139 54 0.0121
826338612 433448 L5-D flow_right 818 NaN NaN 0.0173 47 0.0088
823453391 433451 L5-D gabor_D 483 0.0373 0.7811 0.0134 48 NaN
823453391 433451 L5-D gabor_U 483 0.0448 0.4644 0.0099 49 NaN
823453391 433451 L5-D flow_left 483 NaN NaN 0.0173 30 0.0119
823453391 433451 L5-D flow_right 483 NaN NaN 0.0166 21 0.0199
826659257 433458 L5-S gabor_D 49 0.0841 0.7462 0.0443 2 NaN
826659257 433458 L5-S gabor_U 49 0.1106 1.0101 0.1427 5 NaN
826659257 433458 L5-S flow_left 49 NaN NaN 0.0481 4 0.0860
826659257 433458 L5-S flow_right 49 NaN NaN 0.0143 4 0.0311
832883243 440889 L2/3-S gabor_D 112 0.0626 0.7592 0.0440 9 NaN
832883243 440889 L2/3-S gabor_U 112 0.0708 0.6289 0.0412 12 NaN
832883243 440889 L2/3-S flow_left 112 NaN NaN 0.0203 5 0.0674
832883243 440889 L2/3-S flow_right 112 NaN NaN 0.0248 3 0.0608
Per session 1: ROIs, ROIs above median SNR, D sequences, U sequences, left and right flow onsets: {'758519303': (96, 48, 1266, 94, 15, 16), '761624763': (87, 43, 1263, 97, 18, 16), '760260459': (90, 45, 1278, 82, 16, 16), '764704289': (628, 314, 1264, 96, 17, 16), '777496949': (15, 7, 1255, 105, 14, 16), '777914830': (205, 102, 1277, 83, 18, 14), '826187862': (727, 363, 1259, 101, 18, 16), '826338612': (1636, 818, 1259, 101, 18, 17), '823453391': (966, 483, 1265, 95, 15, 15), '826659257': (99, 49, 1270, 90, 14, 17), '832883243': (224, 112, 1264, 96, 15, 15)}
scaled, panel a: planes with selected ROIs 4 of 4; higher after onset 2 of 4
scaled, panel b: planes with selected ROIs 4 of 4; higher after onset 3 of 4
scaled, panel c: planes with selected ROIs 4 of 4; higher after onset 4 of 4
scaled, panel d: planes with selected ROIs 4 of 4; higher after onset 4 of 4
unscaled, panel a: planes with selected ROIs 4 of 4; higher after onset 2 of 4
unscaled, panel b: planes with selected ROIs 4 of 4; higher after onset 4 of 4
unscaled, panel c: planes with selected ROIs 4 of 4; higher after onset 4 of 4
unscaled, panel d: planes with selected ROIs 4 of 4; higher after onset 4 of 4
Range of the plotted means: -0.073 to 1.05
scaled, reading (a): rule holds in 2 of 4 planes {'L2/3-D': True, 'L2/3-S': False, 'L5-D': True, 'L5-S': False} -> partially reproduced
scaled, reading (b): rule holds in 3 of 4 planes {'L2/3-D': True, 'L2/3-S': True, 'L5-D': False, 'L5-S': True} -> partially reproduced
scaled, reading (c): rule holds in 1 of 4 planes {'L2/3-D': True, 'L2/3-S': False, 'L5-D': False, 'L5-S': False} -> not reproduced
unscaled, reading (a): rule holds in 2 of 4 planes {'L2/3-D': True, 'L2/3-S': False, 'L5-D': True, 'L5-S': False} -> partially reproduced
unscaled, reading (b): rule holds in 4 of 4 planes {'L2/3-D': True, 'L2/3-S': True, 'L5-D': True, 'L5-S': True} -> reproduced
unscaled, reading (c): rule holds in 2 of 4 planes {'L2/3-D': True, 'L2/3-S': False, 'L5-D': True, 'L5-S': False} -> partially reproduced
Result: blocked (methods_underspecified). The selection yields ROIs in every plane for each panel. The flow responses (panels c and d) are higher after inconsistent flow onset in all four planes. For Gabor sequences, panel a (consistent, around D) is higher after onset in 2 of 4 planes; L2/3 and L5 somata are lower (-0.063 and -0.020). Panel b (inconsistent, around U) is higher in 3 of 4; L5 dendrites are at -0.001. The answer of 2026-10-22 says the paper does not give the Gabor panel. The criterion now names three readings and gives the outcome they share, or methods_underspecified if they differ. With robust-scaled traces the rule holds in 2 planes under reading (a), panel a (partially reproduced), and in 3 under reading (b), panel b (partially reproduced). Under reading (c), both panels, it holds in 1 (not reproduced). The readings disagree, so the claim stays blocked, now as the criterion directs. With unscaled dF/F, panel a is higher in 2 of 4 planes and panel b in 4 of 4, and the three readings give partially reproduced (2 planes), reproduced (4) and partially reproduced (2), so they disagree there too. The selection keeps 0 to 58 ROIs per session and panel, from 7 to 818 candidates above the median SNR; mouse 418779 (7 candidates) gives 1 ROI in panels a to c and none in panel d.
fig5-consistent-vs-inconsistent¶
Responses to consistent and inconsistent stimuli differed clearly in the example ROIs.
Gabor: for the ROIs selected on consistent sequences (reading a) or on inconsistent sequences (reading b), the mean over ROIs of their mean trace after D onset and after U onset (0 to 0.6 s), with the SEM across ROIs. Clear when the two differ by more than the sum of their SEMs at some time point.
cvi = []
t = R[s1.index[0]]["fig5"]["gabor_t"]
post = t >= 0
for scaled in ("scaled", "unscaled"):
for reading, sel_key in (("a", "gabor_D"), ("b", "gabor_U")):
for grp in groups:
d, _ = pooled(grp, "gabor_D", scaled, sel_key)
u, _ = pooled(grp, "gabor_U", scaled, sel_key)
n = len(d)
if n < 2:
cvi.append({"traces": scaled, "reading": reading, "group": grp, "rois": n, "clear": False})
continue
md, mu = d.mean(axis=0)[post], u.mean(axis=0)[post]
sd, su = d.std(axis=0, ddof=1)[post] / np.sqrt(n), u.std(axis=0, ddof=1)[post] / np.sqrt(n)
gap = np.abs(mu - md) - (sd + su)
cvi.append({"traces": scaled, "reading": reading, "group": grp, "rois": n,
"max_abs_diff": np.abs(mu - md).max(), "sem_sum_there": (sd + su)[np.argmax(gap)],
"frames_clear": int((gap > 0).sum()), "frames": int(post.sum()), "clear": bool((gap > 0).any()),
"mean_U_minus_D": (mu - md).mean()})
cvi = pd.DataFrame(cvi)
print(cvi.round(4).to_string(index=False))
for scaled in ("scaled", "unscaled"):
for reading in ("a", "b"):
q = cvi[(cvi.traces == scaled) & (cvi.reading == reading)]
print(f"{scaled}, reading ({reading}): planes with a clear difference {int(q.clear.sum())} of 4")
w = cvi[cvi.traces == scaled].pivot_table(index="group", columns="reading", values="clear", aggfunc="first")
print(f"{scaled}: planes clear under (a) and (b) at once: {int((w.a & w.b).sum())} of 4 {w[w.a & w.b].index.tolist()}")
# Visual flow: reported, not judged (the selection requires a larger response after onset).
for p in ("c", "d"):
q = rows5[(rows5.traces == "scaled") & (rows5.panel == p)]
print(f"flow panel {p}: post minus pre over selected ROIs", dict(zip(q.group, q.post_minus_pre.round(3))))
traces reading group rois max_abs_diff sem_sum_there frames_clear frames clear mean_U_minus_D
scaled a L2/3-D 56 0.0902 0.0225 13 18 True -0.0354
scaled a L2/3-S 14 0.0541 0.0612 0 18 False 0.0226
scaled a L5-D 116 0.0457 0.0154 13 18 True -0.0235
scaled a L5-S 8 0.2918 0.0722 0 18 False 0.1308
scaled b L2/3-D 50 0.0189 0.0229 0 18 False -0.0051
scaled b L2/3-S 19 0.2039 0.1594 12 18 True 0.1041
scaled b L5-D 101 0.0144 0.0117 1 18 True -0.0017
scaled b L5-S 10 0.9556 0.6828 12 18 True 0.4822
unscaled a L2/3-D 45 0.0599 0.0182 11 18 True -0.0245
unscaled a L2/3-S 11 0.0095 0.0198 0 18 False -0.0018
unscaled a L5-D 95 0.0261 0.0148 11 18 True -0.0141
unscaled a L5-S 8 0.1342 0.0272 0 18 False 0.0615
unscaled b L2/3-D 25 0.0283 0.0296 0 18 False -0.0100
unscaled b L2/3-S 15 0.0449 0.0512 0 18 False 0.0194
unscaled b L5-D 74 0.0206 0.0168 2 18 True 0.0052
unscaled b L5-S 10 0.2911 0.1972 12 18 True 0.1470
scaled, reading (a): planes with a clear difference 2 of 4
scaled, reading (b): planes with a clear difference 3 of 4
scaled: planes clear under (a) and (b) at once: 1 of 4 ['L5-D']
unscaled, reading (a): planes with a clear difference 2 of 4
unscaled, reading (b): planes with a clear difference 2 of 4
unscaled: planes clear under (a) and (b) at once: 1 of 4 ['L5-D']
flow panel c: post minus pre over selected ROIs {'L2/3-D': 0.058, 'L2/3-S': 0.183, 'L5-D': 0.034, 'L5-S': 0.206}
flow panel d: post minus pre over selected ROIs {'L2/3-D': 0.06, 'L2/3-S': 0.176, 'L5-D': 0.03, 'L5-S': 0.072}
Result: blocked (methods_underspecified), as it depends on fig5-example-responses. That claim stays blocked after the answer of 2026-10-22, since its three readings disagree. Its own test ran: with robust-scaled traces, the D and U responses of the selected ROIs differ by more than the sum of their SEMs in 2 of 4 planes under reading (a), the ROIs selected on consistent sequences, and in 3 of 4 under reading (b), the ROIs selected on inconsistent sequences. By its criterion this is partially reproduced under both readings, read as at least two planes under each. Read as planes where both readings hold at once, it holds in 1 of 4 (L5 dendrites), which would be not reproduced. The claim stays blocked because the protocol blocks a claim that depends on a blocked claim, for the same reason. The flow differences (post minus pre, 0.030 to 0.206) are reported only, as the selection requires them.
fig6-behaviour-all-mice¶
Running velocity and pupil diameter were recorded in sessions 1 to 3 of all 11 mice, so their distributions can be shown per session across mice.
b6 = pd.DataFrame({sid: {"subject": sess.subject[sid], "local_n": sess.local_n[sid],
"run_unit": S[sid]["run_unit"], "run_finite": np.isfinite(S[sid]["run_v"]).mean(),
"pupil_unit": S[sid]["pupil_unit"], "pupil_finite": np.isfinite(S[sid]["pupil_d"]).mean()}
for sid in sess.index[sess.analysed]}).T
b6["counts"] = (b6.run_unit == "cm/s") & (b6.pupil_unit == "mm") & (b6.run_finite > 0) & (b6.pupil_finite > 0)
print(b6.to_string())
print("Sessions counting:", int(b6.counts.sum()), "of", len(b6), "; mice:", b6[b6.counts].subject.nunique(),
"; fewest finite fractions: running", b6.run_finite.min(), ", pupil", round(b6.pupil_finite.min(), 4))
subject local_n run_unit run_finite pupil_unit pupil_finite counts 758519303 408021 1 cm/s 1.0 mm 0.985948 True 759189643 408021 2 cm/s 0.999996 mm 0.990138 True 759660390 408021 3 cm/s 1.0 mm 0.99323 True 761624763 411424 1 cm/s 1.0 mm 0.996189 True 761944562 411424 2 cm/s 0.999972 mm 0.996467 True 762250376 411424 3 cm/s 1.0 mm 0.995984 True 760260459 411771 1 cm/s 1.0 mm 0.996678 True 760659782 411771 2 cm/s 0.999996 mm 0.996694 True 761269197 411771 3 cm/s 1.0 mm 0.997625 True 764704289 413663 1 cm/s 1.0 mm 0.993317 True 765193831 413663 2 cm/s 1.0 mm 0.99753 True 766502238 413663 3 cm/s 1.0 mm 0.997814 True 777496949 418779 1 cm/s 0.999988 mm 0.995968 True 778374308 418779 2 cm/s 1.0 mm 0.989561 True 779152062 418779 3 cm/s 1.0 mm 0.989617 True 777914830 420011 1 cm/s 1.0 mm 0.993404 True 778864809 420011 2 cm/s 1.0 mm 0.996197 True 779650018 420011 3 cm/s 1.0 mm 0.984473 True 826187862 433414 1 cm/s 0.999956 mm 0.998875 True 826773996 433414 2 cm/s 0.999992 mm 0.992827 True 827833392 433414 3 cm/s 1.0 mm 0.998777 True 826338612 433448 1 cm/s 0.999996 mm 0.999378 True 826819032 433448 2 cm/s 1.0 mm 0.998674 True 828816509 433448 3 cm/s 1.0 mm 0.99839 True 823453391 433451 1 cm/s 1.0 mm 0.989963 True 824434038 433451 2 cm/s 1.0 mm 0.977071 True 825180479 433451 3 cm/s 1.0 mm 0.992378 True 826659257 433458 1 cm/s 1.0 mm 0.994808 True 827300090 433458 2 cm/s 1.0 mm 0.995013 True 828475005 433458 3 cm/s 1.0 mm 0.997885 True 832883243 440889 1 cm/s 0.999988 mm 0.996036 True 833704570 440889 2 cm/s 1.0 mm 0.996108 True 834403597 440889 3 cm/s 0.999968 mm 0.998214 True Sessions counting: 33 of 33 ; mice: 11 ; fewest finite fractions: running 0.9999563490331311 , pupil 0.9771
Result: reproduced. All 33 analysed sessions, from 11 mice, hold running velocity in cm/s and pupil diameter in mm. At least 99.99% of running samples and 97.7% of pupil samples are finite.
fig7a-snr-above-1¶
ROI dF/F traces have a relatively high SNR, above 1.
SNR per ROI on its full-session unscaled dF/F (helper calculate_snr, a port of the paper's
code). The 33 analysed sessions; ROIs pooled over mice per line, plane and session (12 groups).
Readings: (a) each group's median above 1, (b) each group's 5th percentile above 1, (c) every
ROI above 1.
roi_all = pd.concat([R[sid]["roi"].assign(session=sid, subject=sess.subject[sid], group=sess.group[sid],
local_n=sess.local_n[sid]) for sid in sess.index[sess.analysed]], ignore_index=True)
g7 = roi_all.groupby(["group", "local_n"])
snr_tab = g7.snr.agg(rois="size", mice=lambda v: 0, p5=lambda v: np.percentile(v, 5), q25=lambda v: np.percentile(v, 25),
median="median", q75=lambda v: np.percentile(v, 75), p95=lambda v: np.percentile(v, 95), min="min", max="max")
snr_tab["mice"] = g7.subject.nunique()
print(snr_tab.round(3).to_string())
print("(a) groups with median above 1:", int((snr_tab["median"] > 1).sum()), "of 12")
print("(b) groups with 5th percentile above 1:", int((snr_tab.p5 > 1).sum()), "of 12")
print("(c) ROIs above 1:", int((roi_all.snr > 1).sum()), "of", len(roi_all), "; lowest SNR", roi_all.snr.min().round(3))
print("ROIs with median dF/F below 0 (the only case where SNR can fall below 1.645):", int((roi_all["median"] < 0).sum()))
print("\nPer mouse, lowest and median SNR:")
print(roi_all.groupby(["group", "subject"]).snr.agg(["size", "min", "median"]).round(3).to_string())
rois mice p5 q25 median q75 p95 min max
group local_n
L2/3-D 1 1355 2 2.284 2.337 2.388 2.470 2.925 2.176 7.920
2 648 2 2.292 2.335 2.382 2.460 3.075 2.232 4.887
3 845 2 2.271 2.318 2.372 2.442 2.885 2.173 6.701
L2/3-S 1 407 3 2.285 2.529 3.090 4.593 9.067 2.198 18.931
2 388 3 2.273 2.479 2.924 4.173 7.947 2.206 19.233
3 397 3 2.273 2.475 2.831 3.769 7.605 2.180 17.709
L5-D 1 2807 3 2.367 2.455 2.552 2.688 3.178 2.163 5.865
2 1633 3 2.356 2.438 2.540 2.707 3.341 2.248 7.722
3 1664 3 2.350 2.431 2.519 2.660 3.132 2.193 5.455
L5-S 1 204 3 2.411 2.793 3.430 4.632 8.130 2.244 17.568
2 183 3 2.359 2.673 3.226 4.161 6.885 2.290 16.467
3 205 3 2.308 2.606 3.188 4.138 7.467 2.226 15.052
(a) groups with median above 1: 12 of 12
(b) groups with 5th percentile above 1: 12 of 12
(c) ROIs above 1: 10736 of 10736 ; lowest SNR 2.163
ROIs with median dF/F below 0 (the only case where SNR can fall below 1.645): 0
Per mouse, lowest and median SNR:
size min median
group subject
L2/3-D 413663 1488 2.173 2.381
433414 1360 2.232 2.383
L2/3-S 408021 277 2.229 3.496
411424 257 2.222 2.958
440889 658 2.180 2.760
L5-D 420011 546 2.265 2.524
433448 2577 2.163 2.516
433451 2981 2.193 2.567
L5-S 411771 239 2.303 3.513
418779 70 2.272 3.209
433458 283 2.226 3.005
Result: reproduced. Under all three readings: every one of the 12 groups has a median SNR above 1 (2.37 to 3.43) and a 5th percentile above 1 (2.27 to 2.41), and all 10736 ROIs exceed 1 (lowest 2.16). No ROI has a negative median dF/F, so by the SNR's construction none could fall below 1.645.
fig7a-snr-stable and fig7b-signal-stable¶
ROI SNR is stable over the three days.
The mean dF/F signal of ROIs is stable over days.
Signal is the mean of the dF/F values above the noise threshold (calculate_snr). Readings:
(a) the notches (median +/- 1.57 IQR / sqrt(n)) of the three sessions of a plane overlap
pairwise; (b) each session's median lies inside the interquartile range of every other session
of the plane.
def stability(col):
rows = []
for grp in groups:
st = {}
for n in (1, 2, 3):
v = roi_all[(roi_all.group == grp) & (roi_all.local_n == n)][col].to_numpy()
q1, med, q3 = np.percentile(v, [25, 50, 75])
half = 1.57 * (q3 - q1) / np.sqrt(len(v))
st[n] = (med, q1, q3, med - half, med + half, len(v))
notch = all(st[a][3] <= st[b][4] and st[b][3] <= st[a][4] for a, b in ((1, 2), (1, 3), (2, 3)))
iqr = all(st[b][1] <= st[a][0] <= st[b][2] for a in (1, 2, 3) for b in (1, 2, 3) if a != b)
rows.append({"group": grp, **{f"median_s{n}": st[n][0] for n in (1, 2, 3)},
**{f"notch_s{n}": f"{st[n][3]:.3f}-{st[n][4]:.3f}" for n in (1, 2, 3)},
**{f"iqr_s{n}": f"{st[n][1]:.3f}-{st[n][2]:.3f}" for n in (1, 2, 3)},
"notches_overlap": notch, "medians_in_iqrs": iqr})
return pd.DataFrame(rows).set_index("group")
for col, name in (("snr", "SNR"), ("signal", "signal (dF/F)")):
stab = stability(col)
print(f"{name}:")
print(stab.round(3).to_string())
print(f" planes stable under (a): {int(stab.notches_overlap.sum())} of 4; under (b): {int(stab.medians_in_iqrs.sum())} of 4;"
f" under both: {int((stab.notches_overlap & stab.medians_in_iqrs).sum())} of 4\n")
print("Signal range (dF/F) over ROIs:", roi_all.signal.min().round(3), "to", roi_all.signal.max().round(3))
print("\nPer mouse, median SNR and signal by session:")
print(roi_all.pivot_table(index=["group", "subject"], columns="local_n", values=["snr", "signal"], aggfunc="median").round(3).to_string())
fig, axes = plt.subplots(1, 2, figsize=(12, 4))
for ax, col in zip(axes, ("snr", "signal")):
data = [roi_all[(roi_all.group == g) & (roi_all.local_n == n)][col] for g in groups for n in (1, 2, 3)]
ax.boxplot(data, notch=True, whis=(5, 95), showfliers=False)
ax.set_xticks(range(1, 13), [f"{g} s{n}" for g in groups for n in (1, 2, 3)], rotation=90, fontsize=8)
ax.set_ylabel(col)
if col == "snr":
ax.axhline(1, ls="--", color="0.5")
fig.tight_layout()
plt.show()
print("Outliers not drawn (beyond the 5th to 95th percentile whiskers).")
SNR:
median_s1 median_s2 median_s3 notch_s1 notch_s2 notch_s3 iqr_s1 iqr_s2 iqr_s3 notches_overlap medians_in_iqrs
group
L2/3-D 2.388 2.382 2.372 2.382-2.393 2.374-2.389 2.365-2.378 2.337-2.470 2.335-2.460 2.318-2.442 False True
L2/3-S 3.090 2.924 2.831 2.929-3.251 2.789-3.059 2.729-2.933 2.529-4.593 2.479-4.173 2.475-3.769 True True
L5-D 2.552 2.540 2.519 2.545-2.558 2.529-2.550 2.510-2.528 2.455-2.688 2.438-2.707 2.431-2.660 False True
L5-S 3.430 3.226 3.188 3.228-3.632 3.053-3.398 3.020-3.356 2.793-4.632 2.673-4.161 2.606-4.138 True True
planes stable under (a): 2 of 4; under (b): 4 of 4; under both: 2 of 4
signal (dF/F):
median_s1 median_s2 median_s3 notch_s1 notch_s2 notch_s3 iqr_s1 iqr_s2 iqr_s3 notches_overlap medians_in_iqrs
group
L2/3-D 0.467 0.448 0.432 0.458-0.476 0.437-0.459 0.421-0.443 0.362-0.575 0.352-0.536 0.333-0.535 False True
L2/3-S 0.202 0.191 0.187 0.192-0.211 0.182-0.199 0.181-0.193 0.160-0.284 0.157-0.265 0.162-0.242 True True
L5-D 0.517 0.446 0.454 0.507-0.527 0.437-0.455 0.444-0.464 0.375-0.709 0.351-0.582 0.354-0.604 False True
L5-S 0.253 0.222 0.237 0.237-0.268 0.210-0.234 0.224-0.249 0.214-0.355 0.186-0.289 0.195-0.309 False True
planes stable under (a): 1 of 4; under (b): 4 of 4; under both: 1 of 4
Signal range (dF/F) over ROIs: 0.097 to 2.879
Per mouse, median SNR and signal by session:
signal snr
local_n 1 2 3 1 2 3
group subject
L2/3-D 413663 0.405 0.417 0.392 2.391 2.393 2.361
433414 0.522 0.482 0.490 2.386 2.375 2.382
L2/3-S 408021 0.248 0.218 0.186 3.849 3.801 3.009
411424 0.213 0.212 0.200 3.013 2.969 2.839
440889 0.185 0.182 0.184 2.887 2.755 2.731
L5-D 420011 0.521 0.526 0.557 2.538 2.521 2.513
433448 0.592 0.443 0.444 2.543 2.470 2.479
433451 0.440 0.435 0.444 2.577 2.584 2.542
L5-S 411771 0.240 0.188 0.217 3.645 3.377 3.407
418779 0.226 0.221 0.262 3.554 3.131 2.955
433458 0.278 0.252 0.257 3.001 3.100 2.989
Outliers not drawn (beyond the 5th to 95th percentile whiskers).
Result: both blocked (methods_underspecified), as their readings disagree. For SNR, every session's median lies inside the other sessions' interquartile ranges in all four planes (reading b). The notches overlap pairwise in only 2 of 4 planes (reading a); in L2/3 and L5 dendrites, whose sessions hold 648 to 2807 ROIs, the notches are narrow and the medians drift by 0.016 and 0.033. For signal, reading (b) holds in 4 of 4 planes and reading (a) in 1 of 4. Under reading (a) both claims would be not reproduced, under (b) reproduced. The criteria name methods_underspecified for this case.
fig7c-correlations-similar and fig7c-high-correlation-fraction¶
The distributions of pairwise ROI correlations are very similar for apical dendrite ROIs and somatic ROIs, which suggests the dendrites are not heavily over-segmented.
About 0.01% of possible pairs of L2/3 dendritic ROIs have correlations above 0.8.
Pearson correlation of every pair of ROIs within a session, on full-session dF/F smoothed with a centred 4-point moving average (mode mirror), pooled over mice per line, plane and session. Similar: medians, and 95th percentiles, of the dendritic and somatic distributions of the same line and session differ by less than (a) 0.05 or (b) 0.1.
corr = {}
for grp in groups:
for n in (1, 2, 3):
sids = sess.index[sess.analysed & (sess.group == grp) & (sess.local_n == n)]
corr[(grp, n)] = np.concatenate([R[sid]["corr"] for sid in sids])
ctab = pd.DataFrame({k: {"pairs": len(v), "median": np.median(v), "p95": np.percentile(v, 95), "min": v.min(), "max": v.max(),
"pct_above_0.8": 100 * np.mean(v > 0.8), "pct_at_least_0.8": 100 * np.mean(v >= 0.8)}
for k, v in corr.items()}).T
print(ctab.round(4).to_string())
sim = []
for line in ("L2/3", "L5"):
for n in (1, 2, 3):
d, s_ = ctab.loc[(f"{line}-D", n)], ctab.loc[(f"{line}-S", n)]
sim.append({"line": line, "session": n, "median_diff": abs(d["median"] - s_["median"]), "p95_diff": abs(d.p95 - s_.p95)})
sim = pd.DataFrame(sim)
for k, thr in (("a", 0.05), ("b", 0.1)):
sim[f"similar_{k}"] = (sim.median_diff < thr) & (sim.p95_diff < thr)
print(sim.round(4).to_string(index=False))
print("Comparisons similar under (a):", int(sim.similar_a.sum()), "of 6; under (b):", int(sim.similar_b.sum()), "of 6;"
" under both:", int((sim.similar_a & sim.similar_b).sum()))
print("\nPer mouse and session, median and 95th percentile of correlations:")
print(pd.DataFrame({(sess.group[sid], sess.subject[sid], sess.local_n[sid]): {"pairs": len(R[sid]["corr"]), "median": np.median(R[sid]["corr"]),
"p95": np.percentile(R[sid]["corr"], 95)} for sid in sess.index[sess.analysed]}).T.sort_index().round(4).to_string())
fig, ax = plt.subplots(figsize=(7, 4))
bins = np.linspace(-1, 1, 41)
for (grp, n), v in corr.items():
if n == 1:
ax.hist(v, bins=bins, histtype="step", density=True, label=grp, log=True)
ax.set_xlabel("pairwise correlation (session 1)")
ax.set_ylabel("density (log)")
ax.legend()
plt.show()
print("All correlations lie in [-1, 1]; bins of 0.05 as in the code.")
print("\nL2/3 dendritic pairs with r > 0.8 (expected 0.01 +/- 0.005 %, so 0.005 to 0.015 %):")
l23d = {n: corr[("L2/3-D", n)] for n in (1, 2, 3)}
l23d_mice = sorted(set(sess.subject[sess.analysed & (sess.group == "L2/3-D")]))
print(" Analysed L2/3 dendritic mice (reading a pools over these):", l23d_mice)
pooled_all = np.concatenate(list(l23d.values()))
per_ms = {(sess.subject[sid], sess.local_n[sid]): R[sid]["corr"] for sid in sess.index[sess.analysed & (sess.group == "L2/3-D")]}
inside = lambda v: 0.005 <= v <= 0.015
for op, name in ((np.greater, "r > 0.8"), (np.greater_equal, "r >= 0.8 (variant)")):
a = 100 * np.mean(op(pooled_all, 0.8))
b = np.mean([100 * np.mean(op(v, 0.8)) for v in l23d.values()])
c = {int(n): float(100 * np.mean(op(v, 0.8))) for n, v in l23d.items()}
print(f" {name}: (a) pooled over the three sessions and two mice {a:.4f}% ({int(op(pooled_all, 0.8).sum())} of {len(pooled_all)} pairs),"
f" within tolerance: {inside(a)}")
print(f" (b) mean of the three per-session fractions {b:.4f}%, within tolerance: {inside(b)}")
print(f" (c) per local session, pooled over the two mice {({k: round(v, 4) for k, v in c.items()})},"
f" every session within tolerance: {all(inside(v) for v in c.values())}")
c2 = {(m, int(n)): round(float(100 * np.mean(op(v, 0.8))), 4) for (m, n), v in per_ms.items()}
print(f" by mouse and session, for description only (not a reading of the criterion): {c2}")
pairs median p95 min max pct_above_0.8 pct_at_least_0.8
L2/3-D 1 460779.0 0.0277 0.0513 -0.2634 0.9534 0.0211 0.0211
2 105228.0 0.0245 0.0489 -0.1066 0.9038 0.0276 0.0276
3 186094.0 0.0269 0.0531 -0.4325 0.8862 0.0043 0.0043
L2/3-S 1 33277.0 0.0337 0.1043 -0.0866 0.8990 0.0150 0.0150
2 31682.0 0.0453 0.1223 -0.1002 0.9377 0.0095 0.0095
3 30776.0 0.0479 0.1247 -0.0908 0.8970 0.0097 0.0097
L5-D 1 1824435.0 0.0162 0.0428 -0.2948 0.9555 0.0058 0.0058
2 640257.0 0.0188 0.0565 -0.3176 0.9476 0.0114 0.0114
3 624836.0 0.0186 0.0551 -0.5311 0.9190 0.0062 0.0062
L5-S 1 8961.0 0.0234 0.0956 -0.1070 0.6034 0.0000 0.0000
2 6481.0 0.0306 0.1053 -0.0624 0.5784 0.0000 0.0000
3 8143.0 0.0435 0.1445 -0.1296 0.6180 0.0000 0.0000
line session median_diff p95_diff similar_a similar_b
L2/3 1 0.0060 0.0530 False True
L2/3 2 0.0208 0.0734 False True
L2/3 3 0.0210 0.0716 False True
L5 1 0.0072 0.0529 False True
L5 2 0.0118 0.0488 True True
L5 3 0.0249 0.0894 False True
Comparisons similar under (a): 1 of 6; under (b): 6 of 6; under both: 1
Per mouse and session, median and 95th percentile of correlations:
pairs median p95
L2/3-D 413663 1 196878.0 0.0221 0.0498
2 60378.0 0.0231 0.0529
3 130816.0 0.0248 0.0528
433414 1 263901.0 0.0313 0.0518
2 44850.0 0.0262 0.0458
3 55278.0 0.0316 0.0535
L2/3-S 408021 1 4560.0 0.0225 0.1234
2 2701.0 0.0223 0.1085
3 5671.0 0.0283 0.1037
411424 1 3741.0 0.0267 0.1043
2 4005.0 0.0236 0.0852
3 3160.0 0.0292 0.0916
440889 1 24976.0 0.0365 0.1024
2 24976.0 0.0516 0.1256
3 21945.0 0.0562 0.1294
L5-D 420011 1 20910.0 0.0166 0.0650
2 12561.0 0.0166 0.0604
3 16471.0 0.0192 0.0665
433448 1 1337430.0 0.0162 0.0404
2 98790.0 0.0190 0.0421
3 122760.0 0.0168 0.0463
433451 1 466095.0 0.0162 0.0488
2 528906.0 0.0188 0.0589
3 485605.0 0.0191 0.0566
L5-S 411771 1 4005.0 0.0236 0.0990
2 2415.0 0.0267 0.1075
3 3081.0 0.0238 0.0992
418779 1 105.0 0.0142 0.0977
2 325.0 0.0205 0.0932
3 406.0 0.0163 0.0740
433458 1 4851.0 0.0233 0.0929
2 3741.0 0.0337 0.1042
3 4656.0 0.0657 0.1601
All correlations lie in [-1, 1]; bins of 0.05 as in the code.
L2/3 dendritic pairs with r > 0.8 (expected 0.01 +/- 0.005 %, so 0.005 to 0.015 %):
Analysed L2/3 dendritic mice (reading a pools over these): ['413663', '433414']
r > 0.8: (a) pooled over the three sessions and two mice 0.0178% (134 of 752101 pairs), within tolerance: False
(b) mean of the three per-session fractions 0.0176%, within tolerance: False
(c) per local session, pooled over the two mice {1: 0.0211, 2: 0.0276, 3: 0.0043}, every session within tolerance: False
by mouse and session, for description only (not a reading of the criterion): {('413663', 1): 0.0457, ('413663', 2): 0.0431, ('413663', 3): 0.0054, ('433414', 1): 0.0027, ('433414', 2): 0.0067, ('433414', 3): 0.0018}
r >= 0.8 (variant): (a) pooled over the three sessions and two mice 0.0178% (134 of 752101 pairs), within tolerance: False
(b) mean of the three per-session fractions 0.0176%, within tolerance: False
(c) per local session, pooled over the two mice {1: 0.0211, 2: 0.0276, 3: 0.0043}, every session within tolerance: False
by mouse and session, for description only (not a reading of the criterion): {('413663', 1): 0.0457, ('413663', 2): 0.0431, ('413663', 3): 0.0054, ('433414', 1): 0.0027, ('433414', 2): 0.0067, ('433414', 3): 0.0018}
Result: fig7c-correlations-similar blocked (methods_underspecified), as its readings disagree; fig7c-high-correlation-fraction blocked as it depends on it. The dendritic and somatic medians differ by 0.006 to 0.025 and the 95th percentiles by 0.049 to 0.089. That is similar for 6 of 6 comparisons under reading (b), 0.1, and for 1 of 6 under reading (a), 0.05. For the high correlations, the analysed L2/3 dendritic sessions come from the two mice the criterion now names (413663 and 433414, answer of 2026-10-22). Pooled over them, 0.0178% of pairs exceed 0.8 (134 of 752101, reading a), and the mean of the three sessions is 0.0176% (reading b). By local session they are 0.0211, 0.0276 and 0.0043% (reading c), so not every session is within tolerance. None of the three readings is within 0.005 to 0.015%, so the claim would not be reproduced if its dependency were decided. It stays blocked because the protocol blocks a claim that depends on a blocked claim, for the same reason. The answer rules out per-mouse sessions as a reading, so the two mouse sessions inside the band (0.0054 and 0.0067%) no longer bear on the outcome. r >= 0.8 gives the same counts.
fig7a-source-link¶
The per-ROI SNRs computed from the dataset agree with those in the source data of Figure 7a in the paper's repository.
src = oc.fig7a_source()
src["sessids"] = src.sessids.astype(int).astype(str)
link = []
for _, r in src.iterrows():
sid = r.sessids
mine = R[sid]["roi"].snr.to_numpy() if sid in R else np.array([])
theirs = np.asarray(r.snrs, dtype=float)
same_n = len(mine) == len(theirs)
rel = np.abs(mine - theirs) / np.abs(theirs) if same_n else np.array([np.nan])
link.append({"session": sid, "in_dataset": sid in R, "rois_source": len(theirs), "rois_dataset": len(mine),
"frac_within_1pct": np.mean(rel <= 0.01) if same_n else np.nan, "max_rel_diff": np.nanmax(rel)})
link = pd.DataFrame(link).set_index("session")
link["ok"] = (link.rois_source == link.rois_dataset) & (link.frac_within_1pct >= 0.95)
print(link.to_string())
print("Source sessions:", len(link), "; in the analysed set:", int(link.index.isin(sess.index[sess.analysed]).sum()),
"; sessions meeting the rule:", int(link.ok.sum()))
in_dataset rois_source rois_dataset frac_within_1pct max_rel_diff ok session 758519303 True 96 96 1.0 8.000173e-09 True 759189643 True 74 74 1.0 9.311883e-09 True 759660390 True 107 107 1.0 6.993179e-09 True 760260459 True 90 90 1.0 4.422876e-09 True 760659782 True 70 70 1.0 1.608760e-09 True 761269197 True 79 79 1.0 3.609244e-09 True 761624763 True 87 87 1.0 2.330648e-09 True 761944562 True 90 90 1.0 1.014809e-09 True 762250376 True 80 80 1.0 1.113377e-09 True 764704289 True 628 628 1.0 1.150385e-09 True 765193831 True 348 348 1.0 9.434958e-10 True 766502238 True 512 512 1.0 1.250688e-09 True 777496949 True 15 15 1.0 4.495059e-09 True 777914830 True 205 205 1.0 1.129568e-09 True 778374308 True 26 26 1.0 7.944407e-10 True 778864809 True 159 159 1.0 1.083846e-09 True 779152062 True 29 29 1.0 2.940576e-09 True 779650018 True 182 182 1.0 2.288022e-05 True 823453391 True 966 966 1.0 1.312162e-09 True 824434038 True 1029 1029 1.0 3.351683e-05 True 825180479 True 986 986 1.0 3.065873e-05 True 826187862 True 727 727 1.0 1.223841e-09 True 826338612 True 1636 1636 1.0 1.213731e-09 True 826659257 True 99 99 1.0 1.704845e-09 True 826773996 True 300 300 1.0 8.241804e-10 True 826819032 True 445 445 1.0 1.167454e-09 True 827300090 True 87 87 1.0 1.762261e-09 True 827833392 True 333 333 1.0 9.520523e-10 True 828475005 True 97 97 1.0 1.779109e-09 True 828816509 True 496 496 1.0 8.518430e-10 True 832883243 True 224 224 1.0 1.494878e-09 True 833704570 True 224 224 1.0 1.420924e-09 True 834403597 True 210 210 1.0 1.114308e-09 True Source sessions: 33 ; in the analysed set: 33 ; sessions meeting the rule: 33
Result: reproduced. All 33 sessions of the Fig. 7a source data are in the dataset with the same number of ROIs. Every ROI's SNR computed here is within 1% of the source value; the largest relative difference is 3.4e-05.
fig9-onset-offset-transients¶
Mean dF/F responses across ROIs show distinct transients aligned to stimulus onsets (grey screen to stimulus) and offsets (stimulus to grey screen), which validates the temporal alignment of stimuli and recordings.
Onsets are the ends of every grey period but the last, offsets the starts of every grey period but the first, -2 to 2 s around each. Per ROI, the mean trace over transitions; then mean and SEM across ROIs pooled over mice per line, plane and session. A group shows a transient when at some time in 0 to 2 s the mean differs from its mean over -2 to 0 s by more than k SEM. Readings: transitions (a) all, (b) Gabor only; k 1 or 2. Robust-scaled dF/F; unscaled as a variant.
def transient_table(scaled):
rows = []
for grp in groups:
for n in (1, 2, 3):
sids = sess.index[sess.analysed & (sess.group == grp) & (sess.local_n == n)]
for kind in ("onset", "offset"):
for reading in ("a", "b"):
per_roi = []
for sid in sids:
tr = R[sid]["transitions"]
sel = (tr.kind == kind) & ((reading == "a") | (tr.stimulus == "gabors"))
per_roi.append(R[sid][f"trans_{scaled}"][:, sel.to_numpy()].mean(axis=1))
x = np.concatenate(per_roi)
t = R[sids[0]]["trans_t"]
m, se = x.mean(axis=0), x.std(axis=0, ddof=1) / np.sqrt(len(x))
base = m[t < 0].mean()
z = np.abs(m[t >= 0] - base) / se[t >= 0]
rows.append({"traces": scaled, "group": grp, "session": n, "kind": kind, "reading": reading,
"rois": len(x), "max_dev_in_sem": z.max(), "k1": bool((z > 1).any()), "k2": bool((z > 2).any()),
"peak_change": (m[t >= 0] - base)[np.argmax(z)]})
return pd.DataFrame(rows)
for scaled in ("scaled", "unscaled"):
tt9 = transient_table(scaled)
wide = tt9.pivot_table(index=["group", "session"], columns=["kind", "reading"], values="max_dev_in_sem")
print(f"{scaled} dF/F, largest deviation from baseline in 0 to 2 s, in SEMs:")
print(wide.round(2).to_string())
for reading in ("a", "b"):
for k in ("k1", "k2"):
q = tt9[tt9.reading == reading]
both = q.pivot_table(index=["group", "session"], columns="kind", values=k).all(axis=1)
print(f" reading ({reading}), {k}: groups with a transient at onset and at offset {int(both.sum())} of 12")
print()
pm9 = []
for sid in sess.index[sess.analysed]:
tr, t = R[sid]["transitions"], R[sid]["trans_t"]
row = {"session_id": sid, "group": sess.group[sid], "mouse": sess.subject[sid], "session": sess.local_n[sid], "rois": R[sid]["n_rois"]}
for kind in ("onset", "offset"):
x = R[sid]["trans_scaled"][:, (tr.kind == kind).to_numpy()].mean(axis=1)
if len(x) > 1:
m, se = x.mean(axis=0), x.std(axis=0, ddof=1) / np.sqrt(len(x))
row[kind] = (np.abs(m[t >= 0] - m[t < 0].mean()) / se[t >= 0]).max()
pm9.append(row)
pm9 = pd.DataFrame(pm9)
print("Per mouse and session, reading (a), robust-scaled: largest deviation in SEMs over that mouse's ROIs")
print(pm9.round(2).to_string(index=False))
print("Range over mouse sessions (SEMs):", round(min(pm9.onset.min(), pm9.offset.min()), 2), "to",
round(max(pm9.onset.max(), pm9.offset.max()), 2))
unshown = clock.index[clock.true <= clock.null_p99]
print("Analysed sessions whose clock check (data check) did not establish alignment:")
print(pm9[pm9.session_id.isin(unshown)].round(2).to_string(index=False))
print("Mouse sessions below 2 SEM at onset or offset:", pm9[(pm9.onset <= 2) | (pm9.offset <= 2)][["mouse", "session"]].values.tolist())
fig, axes = plt.subplots(2, 4, figsize=(14, 6), sharex=True)
for j, grp in enumerate(groups):
for i, kind in enumerate(("onset", "offset")):
ax = axes[i, j]
for n in (1, 2, 3):
sids = sess.index[sess.analysed & (sess.group == grp) & (sess.local_n == n)]
x = np.concatenate([R[sid]["trans_scaled"][:, (R[sid]["transitions"].kind == kind).to_numpy()].mean(axis=1) for sid in sids])
t = R[sids[0]]["trans_t"]
m, se = x.mean(axis=0), x.std(axis=0, ddof=1) / np.sqrt(len(x))
ax.plot(t, m, label=f"session {n}")
ax.fill_between(t, m - se, m + se, alpha=0.3)
ax.axvline(0, ls="--", color="0.5")
ax.set_title(f"{grp} {kind}", fontsize=9)
axes[0, 0].legend(fontsize=8)
fig.supxlabel("time from transition (s)")
fig.supylabel("robust-scaled dF/F, mean +/- SEM over ROIs")
fig.tight_layout()
plt.show()
scaled dF/F, largest deviation from baseline in 0 to 2 s, in SEMs:
kind offset onset
reading a b a b
group session
L2/3-D 1 10.13 5.31 27.12 10.58
2 10.82 7.55 17.93 11.14
3 9.33 3.42 19.55 7.88
L2/3-S 1 19.35 7.20 15.73 10.74
2 10.94 5.71 19.07 9.08
3 16.30 6.79 20.85 11.82
L5-D 1 9.45 5.40 35.34 12.81
2 11.95 9.97 22.16 11.48
3 12.62 12.23 22.59 11.08
L5-S 1 14.37 6.85 8.80 3.26
2 9.83 4.00 10.14 4.71
3 9.95 2.28 9.97 4.79
reading (a), k1: groups with a transient at onset and at offset 12 of 12
reading (a), k2: groups with a transient at onset and at offset 12 of 12
reading (b), k1: groups with a transient at onset and at offset 12 of 12
reading (b), k2: groups with a transient at onset and at offset 12 of 12
unscaled dF/F, largest deviation from baseline in 0 to 2 s, in SEMs:
kind offset onset
reading a b a b
group session
L2/3-D 1 8.12 5.31 24.22 9.39
2 8.79 6.96 16.30 9.45
3 7.96 2.84 18.87 7.27
L2/3-S 1 18.78 8.52 12.11 8.34
2 8.74 3.46 11.91 6.40
3 19.38 8.70 17.08 10.25
L5-D 1 7.05 4.86 32.55 9.97
2 9.81 8.65 18.90 9.89
3 8.83 9.74 19.61 10.04
L5-S 1 13.28 6.56 8.47 3.31
2 8.74 3.59 9.13 5.23
3 8.82 2.09 9.75 5.17
reading (a), k1: groups with a transient at onset and at offset 12 of 12 reading (a), k2: groups with a transient at onset and at offset 12 of 12 reading (b), k1: groups with a transient at onset and at offset 12 of 12 reading (b), k2: groups with a transient at onset and at offset 12 of 12 Per mouse and session, reading (a), robust-scaled: largest deviation in SEMs over that mouse's ROIs session_id group mouse session rois onset offset 758519303 L2/3-S 408021 1 96 6.17 10.92 759189643 L2/3-S 408021 2 74 8.53 11.22 759660390 L2/3-S 408021 3 107 8.72 10.53 761624763 L2/3-S 411424 1 87 8.08 9.80 761944562 L2/3-S 411424 2 90 8.66 10.21 762250376 L2/3-S 411424 3 80 8.49 12.28 760260459 L5-S 411771 1 90 6.09 11.54 760659782 L5-S 411771 2 70 10.14 4.26 761269197 L5-S 411771 3 79 7.53 4.53 764704289 L2/3-D 413663 1 628 20.34 7.13 765193831 L2/3-D 413663 2 348 13.97 10.89 766502238 L2/3-D 413663 3 512 16.10 8.99 777496949 L5-S 418779 1 15 4.07 6.77 778374308 L5-S 418779 2 26 4.77 6.98 779152062 L5-S 418779 3 29 4.12 6.81 777914830 L5-D 420011 1 205 7.72 5.97 778864809 L5-D 420011 2 159 6.98 4.99 779650018 L5-D 420011 3 182 7.72 5.09 826187862 L2/3-D 433414 1 727 18.56 7.76 826773996 L2/3-D 433414 2 300 13.56 6.04 827833392 L2/3-D 433414 3 333 13.98 5.92 826338612 L5-D 433448 1 1636 30.16 5.65 826819032 L5-D 433448 2 445 19.96 6.11 828816509 L5-D 433448 3 496 19.93 6.18 823453391 L5-D 433451 1 966 21.11 11.84 824434038 L5-D 433451 2 1029 13.41 12.60 825180479 L5-D 433451 3 986 12.62 14.22 826659257 L5-S 433458 1 99 7.52 9.25 827300090 L5-S 433458 2 87 6.86 11.56 828475005 L5-S 433458 3 97 11.41 12.35 832883243 L2/3-S 440889 1 224 15.16 16.30 833704570 L2/3-S 440889 2 224 16.64 5.94 834403597 L2/3-S 440889 3 210 18.21 10.89 Range over mouse sessions (SEMs): 4.07 to 30.16 Analysed sessions whose clock check (data check) did not establish alignment: session_id group mouse session rois onset offset 777496949 L5-S 418779 1 15 4.07 6.77 Mouse sessions below 2 SEM at onset or offset: []
Result: reproduced. In all 12 groups the mean robust-scaled response departs from its pre-transition mean by more than 2 SEM, at both onset and offset. With all transitions (reading a) the largest deviations are 8.8 to 35.3 SEM, and with Gabor transitions only (reading b) 2.3 to 12.8 SEM, so it holds under every reading. Unscaled dF/F gives 2.1 to 32.6 SEM, and every mouse session taken alone gives 4.1 to 30.2 SEM (reading a). The analysed session whose alignment the clock check did not establish, 777496949 (418779 session 1, 15 ROIs), deviates by 4.07 SEM at onset and 6.77 at offset.
file-sizes and download-33-files¶
Each session has three file versions; basic files are about 130 MB to 1.7 GB, the stimulus images add about 1.5 GB, and the motion-corrected stack adds about 45 GB.
The basic files of the sessions 1 to 3 that passed QC are 33 files totalling about 15 GB.
sz = assets.dropna(subset=["kind"]).pivot_table(index="session", columns="kind", values="size", aggfunc="first")
print("Sessions with all three versions:", int(sz.notna().all(axis=1).sum()), "of", len(sz))
for unit, mb, gb in (("decimal", 1e6, 1e9), ("binary", 2**20, 2**30)):
vals = {"smallest basic (MB)": sz.B.min() / mb, "largest basic (GB)": sz.B.max() / gb,
"I minus B, median (GB)": (sz.I - sz.B).median() / gb, "S minus I, median (GB)": (sz.S - sz.I).median() / gb}
exp = {"smallest basic (MB)": (130, 13), "largest basic (GB)": (1.7, 0.17), "I minus B, median (GB)": (1.5, 0.15),
"S minus I, median (GB)": (45, 4.5)}
within = {k: abs(v - exp[k][0]) <= exp[k][1] for k, v in vals.items()}
print(f"{unit}:", {k: round(v, 3) for k, v in vals.items()}, "; within tolerance:", within, "; all:", all(within.values()))
print("I minus B range (GB, decimal):", round((sz.I - sz.B).min() / 1e9, 3), "to", round((sz.I - sz.B).max() / 1e9, 3),
"; S minus I range:", round((sz.S - sz.I).min() / 1e9, 2), "to", round((sz.S - sz.I).max() / 1e9, 2))
sel33 = sz.loc[sess.index[sess.analysed]]
print("\nBasic files of local sessions 1 to 3 passing QC:", len(sel33), "; total", round(sel33.B.sum() / 1e9, 2), "GB decimal,",
round(sel33.B.sum() / 2**30, 2), "GB binary (expected 15 +/- 1.5)")
Sessions with all three versions: 50 of 50
decimal: {'smallest basic (MB)': np.float64(136.659), 'largest basic (GB)': np.float64(1.703), 'I minus B, median (GB)': np.float64(1.489), 'S minus I, median (GB)': np.float64(45.456)} ; within tolerance: {'smallest basic (MB)': np.True_, 'largest basic (GB)': np.True_, 'I minus B, median (GB)': np.True_, 'S minus I, median (GB)': np.True_} ; all: True
binary: {'smallest basic (MB)': np.float64(130.328), 'largest basic (GB)': np.float64(1.586), 'I minus B, median (GB)': np.float64(1.387), 'S minus I, median (GB)': np.float64(42.335)} ; within tolerance: {'smallest basic (MB)': np.True_, 'largest basic (GB)': np.True_, 'I minus B, median (GB)': np.True_, 'S minus I, median (GB)': np.True_} ; all: True
I minus B range (GB, decimal): 1.387 to 1.566 ; S minus I range: 41.27 to 47.55
Basic files of local sessions 1 to 3 passing QC: 33 ; total 14.82 GB decimal, 13.8 GB binary (expected 15 +/- 1.5)
Result: both reproduced. Every session has the three file versions. In decimal units the basic files run from 136.7 MB to 1.70 GB, the stimulus images add a median of 1.49 GB and the imaging stack a median of 45.5 GB; in binary units 130.3 MB, 1.59 GB, 1.39 GB and 42.3 GB. All are within tolerance in both. The 33 basic files of local sessions 1 to 3 that passed QC total 14.82 GB (13.80 GiB).
Summary¶
| Claim | Outcome |
|---|---|
| table1-subjects | reproduced |
| cohorts-by-plane | reproduced |
| sex-split | reproduced |
| sessions-total | reproduced |
| table2-sessions | not reproduced (43 of 50 sessions agree in every recorded field) |
| qc-failures | blocked: metadata insufficient (no QC status in the dataset) |
| session-schedule | reproduced |
| imaging-depths | reproduced (mouse 433414 at 60 um, within 50 to 75 um) |
| acquisition-rates | reproduced |
| roi-noise-rejection | reproduced |
| roi-count-ranges | reproduced |
| tracked-roi-totals | reproduced |
| tracked-sessions-overlap | reproduced |
| fig8a-final-matches | reproduced |
| fig8a-conflicts (with the paper's matching files) | reproduced |
| fig8b-final-matches | reproduced |
| fig8b-conflicts (with the paper's matching files) | reproduced |
| fig8-somata-less-order-dependent | blocked: data missing (per-ordering counts for two mice only) |
| gabor-sequence-structure | partially reproduced (13 images in four sessions outside 300 ms +/- 10%) |
| visual-flow-structure | reproduced (size and speed in degrees not testable) |
| session-stimulus-durations | reproduced |
| inconsistent-fractions | reproduced |
| inconsistent-blocks | reproduced |
| fig5-example-responses | blocked: methods underspecified (the three Gabor panel readings disagree) |
| fig5-consistent-vs-inconsistent | blocked: methods underspecified (depends on fig5-example-responses) |
| fig6-behaviour-all-mice | reproduced |
| fig7a-snr-above-1 | reproduced |
| fig7a-snr-stable | blocked: methods underspecified (readings disagree) |
| fig7b-signal-stable | blocked: methods underspecified (readings disagree) |
| fig7c-correlations-similar | blocked: methods underspecified (readings disagree) |
| fig7c-high-correlation-fraction | blocked: methods underspecified (depends on fig7c-correlations-similar) |
| fig7a-source-link (with the paper's Fig. 7a source data) | reproduced |
| fig9-onset-offset-transients | reproduced |
| file-sizes | reproduced |
| download-33-files | reproduced |
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 33 analysed sessions are selected with the QC results and local session numbers of Supplementary Table 1, as the dataset holds no QC; the local numbers equal the order of the start times in the files. Table 1 and Table 2 values are read from Supplementary Table 1, which agrees with the paper's tables. Windows around events are taken as whole two-photon frames from the trial table's frame numbers, which is a standard choice. All ROIs in each file are used, as in the paper's code.
What was found about the dataset.
- The session start times are stated with a Pacific offset (-07:00 or -08:00), but their clock values are those Supplementary Table 1 gives as UTC. For four sessions this puts the date a day after the date in Table 2, and the date of birth implied by the age of mouse 418779 a day after Table 1's. The files hold no other wall-clock time to tell which is right.
- The three sessions of mouse 433414 are recorded at a depth of 60 um; Tables 2 and S1 give 75 um.
- The files hold no QC result, local session number or stimulus seed. The paper's analyses use
only sessions that passed QC, and the dandiset's description points to an outside table for
them. No small dataset or attribute under
general, or at the files' top level, mentions QC. - The dF/F of the 28 dendritic sessions is stored gzip-chunked in small chunks, which makes streaming it through h5py slow; the somatic files store it contiguous.
- The plane (somata or dendrites) is not recorded; it follows from the depth.
- Square size and speed are given in pixels of the unwarped stimulus, without the geometry needed to convert them to the degrees the paper states.
- The clock check fails in two sessions (777496949, 15 ROIs; 838633305, failed QC).