Reproducing Burman et al. (2023) on DANDI:000458: Neuropixels claims¶
Paper. Burman RJ, Brodersen PJN, Raimondo JV, Sen A, Akerman CJ (2023). Active cortical networks promote shunting fast synaptic inhibition in vivo. Neuron 111, 3531-3540. doi:10.1016/j.neuron.2023.08.005
Dataset. DANDI:000458, version 0.230317.0039 (doi:10.48324/dandi.000458/0.230317.0039), the Allen Institute recordings of Claar et al. (2023) that the paper reuses (Figure 4A to 4D, Figure S6). This is the only published version of the dandiset, and the one the paper's analysis code names in its docstring (gist a77bcf5e, revision 43a13d89), so it is pinned. The draft has the same 24 assets (checked below).
Text the claims were written from. The version of record (Europe PMC, PMC11913778), with STAR Methods; the supplement (Figures S1 to S7) was not available (claims file, opening comment).
What this notebook tests. The claims on the dandiset. The network model claims are in
network_model.ipynb. The patch-clamp claims (Figures 1 to 3, S1 to S5) rest on recordings that
are not in the dandiset nor deposited anywhere ("available on request"), and are blocked.
| Claim | Here |
|---|---|
| dataset-sessions-link | tested |
| fig4c-sample | tested |
| fig4d-synchrony-lower-awake | tested |
| fig4d-entropy-higher-awake | tested |
| fig4-rate-higher-awake | tested |
| figs6-rate-regressed | tested (regression readings R1 to R3) |
| fig4f-model-hyperpolarizing-less-activity, fig4h-model-synchrony, fig4h-model-entropy, figs7-model-decoding | tested in network_model.ipynb |
| figs4-intrinsic-properties | blocked: methods_underspecified (see below) |
| 24 patch-clamp claims (fig1b to fig3j, rm-*, figs2, figs3, figs5) | blocked: data_missing |
Every method is the claims file's (opening comment N1 to N8); where it lacks a detail, the passage
of the paper used is cited in the cell or in npx.py.
figs4-intrinsic-properties. The paper's NEURON model of an L2/3 pyramidal neuron and its analysis are public (github.com/richardjburman/burman-et-al-2022---Awake-EGABAAR at commit a404c3e: hoc files and a Matlab analysis, NEURON_Egaba_Analysis.m), and the Methods ("Simulating measurements of synaptic EGABAAR", Table 2) give its parameters: membrane properties per state, 20 synapses within 75 µm of the soma, E_GABA set from -85 to -35 mV in 5 mV steps, two voltage ramps before and during GABA_A activation, estimates with 0% or 90% series resistance correction. A simulation of the ramp estimates under the anesthetized and awake membrane properties could be run. What it would be judged against is not fixed: the measure Figure S4 shows and the comparison that supports "could not be explained" are in the Figure S4 legend, which was not in the text read, and the claims file gives no criterion. Any choice (for example, the estimation error under each state's properties against the measured difference in synaptic E_GABA of Figure 2H) would be arbitrary, so the claim is blocked as methods_underspecified and not simulated. The question is for the paper's authors (attempt record, findings).
import time, resource
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.formula.api as smf
from scipy import stats
import npx
pd.set_option("display.width", 200)
pd.set_option("display.max_columns", 30)
T0 = time.time()
Data check¶
The archive's listing and metadata first, then every file the paper's code reads.
assets = npx.assets()
assets["session"] = assets.path.str.split("/").str[1].str.replace("_behavior+ecephys.nwb", "", regex=False)
meta = npx.version_metadata()
print("version", meta["version"], "| name:", meta["name"])
print("related resources:", [r.get("identifier") or r.get("url") for r in meta.get("relatedResource", [])])
print("assets:", len(assets), "| total size %.1f GB" % (assets["size"].sum() / 1e9))
import requests
draft = requests.get(f"{npx.API}/dandisets/{npx.DANDISET}/versions/draft/assets/?page_size=200", timeout=60).json()["results"]
same = sorted((a["path"], a["size"]) for a in draft) == sorted(zip(assets.path, assets["size"]))
print("draft assets identical in path and size to", npx.VERSION, ":", same)
print("the 17 sessions the gist reads are all assets:", set(npx.SESSIONS) <= set(assets.session))
print("assets not read by the paper's code:", sorted(set(assets.session) - set(npx.SESSIONS)))
version 0.230317.0039 | name: Simultaneous electroencephalography, extracellular electrophysiology, and cortical electrical stimulation in head-fixed mice related resources: ['Reviewed preprint (eLife)', 'Manuscript preprint (bioRxiv)'] assets: 24 | total size 361.5 GB
draft assets identical in path and size to 0.230317.0039 : True the 17 sessions the gist reads are all assets: True assets not read by the paper's code: ['sub-521885_ses-20200709', 'sub-521886_ses-20200716', 'sub-521887_ses-20200730', 'sub-543393_ses-20200820', 'sub-543394_ses-20200827', 'sub-569070_ses-20210401', 'sub-599017_ses-20220210']
t = time.time()
S_all = {}
for _, a in assets.sort_values("session").iterrows():
S_all[a.session] = npx.read_session(a.asset_id)
S = {k: S_all[k] for k in npx.SESSIONS}
print(f"loaded {len(S_all)} files in {time.time() - t:.0f} s; peak memory "
f"{resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6:.2f} GB")
rows = []
for k, s in S_all.items():
m = s["meta"]
if not m["has_units"]:
rows.append(dict(session=k, in_gist=k in npx.SESSIONS, units=0, note="no units table; acquisition " + ",".join(m["acquisition"])))
continue
tr, u = s["trials"], s["units"]
el = tr[tr.stimulus_type == "electrical"]
rows.append(dict(
session=k, in_gist=k in npx.SESSIONS, units=len(u), target=",".join(npx.target_regions(tr)),
depth=",".join(sorted(el.estim_target_depth.unique())),
aw_valid=int((el.is_valid & (el.behavioral_epoch == "awake")).sum()),
iso_valid=int((el.is_valid & (el.behavioral_epoch == "isoflurane")).sum()),
invalid=int((~el.is_valid.astype(bool)).sum()),
currents=",".join(sorted(el.estim_current.unique(), key=lambda x: float(x))),
pulse_ms="%.2f-%.2f" % ((el.stop_time - el.start_time).min() * 1e3, (el.stop_time - el.start_time).max() * 1e3),
ids_are_rows=m["ids_are_rows"], sorted=m["spike_times_sorted"]))
info = pd.DataFrame(rows)
print(info.to_string())
print("\nsubjects among the 17:", len({k.split('_')[0] for k in npx.SESSIONS}))
loaded 24 files in 199 s; peak memory 1.07 GB
session in_gist units note target depth aw_valid iso_valid invalid currents pulse_ms ids_are_rows sorted
0 sub-521885_ses-20200709 False 0 no units table; acquisition ElectricalSeriesEEG NaN NaN NaN NaN NaN NaN NaN NaN NaN
1 sub-521886_ses-20200716 False 0 no units table; acquisition ElectricalSeriesEEG NaN NaN NaN NaN NaN NaN NaN NaN NaN
2 sub-521887_ses-20200730 False 0 no units table; acquisition ElectricalSeriesEEG NaN NaN NaN NaN NaN NaN NaN NaN NaN
3 sub-543393_ses-20200820 False 0 no units table; acquisition ElectricalSeriesEEG NaN NaN NaN NaN NaN NaN NaN NaN NaN
4 sub-543394_ses-20200827 False 0 no units table; acquisition ElectricalSeriesEEG NaN NaN NaN NaN NaN NaN NaN NaN NaN
5 sub-546655_ses-20201023 True 265 NaN MOs deep 359.0 301.0 216.0 50,70,90 0.40-0.41 True True
6 sub-551397_ses-20210211 True 607 NaN MOs deep 360.0 360.0 0.0 10,30,50 0.40-0.41 True True
7 sub-551399_ses-20210128 True 593 NaN MOs deep 358.0 359.0 4.0 40,60,80 0.40-0.41 True True
8 sub-569062_ses-20210218 True 902 NaN MOs deep 360.0 360.0 1.0 15,35,60 0.40-0.41 True True
9 sub-569064_ses-20210408 True 481 NaN MOs deep 360.0 357.0 3.0 15,40,60 0.40-0.41 True True
10 sub-569068_ses-20210304 True 338 NaN MOs deep 359.0 357.0 5.0 10,20,40 0.40-0.41 True True
11 sub-569069_ses-20210312 True 520 NaN MOs deep 357.0 359.0 25.0 20,40,70 0.40-0.41 True True
12 sub-569070_ses-20210401 False 0 no units table; acquisition ElectricalSeriesEEG NaN NaN NaN NaN NaN NaN NaN NaN NaN
13 sub-569072_ses-20210422 True 995 NaN SSp deep 359.0 360.0 1.0 30,50,70 0.40-0.41 True True
14 sub-569073_ses-20210415 True 631 NaN MOs deep 336.0 360.0 25.0 20,40,70 0.40-0.41 True True
15 sub-569073_ses-20210416 True 705 NaN SSp deep 355.0 360.0 5.0 60,80,100 0.40-0.41 True True
16 sub-571619_ses-20210319 True 859 NaN MOs deep,superficial 694.0 719.0 27.0 20,40,60 0.40-0.41 True True
17 sub-571620_ses-20210513 True 771 NaN SSp deep,superficial 720.0 720.0 0.0 60,80,100 0.40-0.41 True True
18 sub-575102_ses-20210603 True 528 NaN MOs superficial 360.0 360.0 1.0 50,70,90 0.40-0.41 True True
19 sub-586466_ses-20210729 True 470 NaN SSp deep,superficial 717.0 712.0 11.0 20,40,60 0.40-0.41 True True
20 sub-586468_ses-20210819 True 977 NaN SSp deep,superficial 360.0 360.0 720.0 25,35,45 0.40-0.41 True True
21 sub-590479_ses-20210921 True 616 NaN SSp deep,superficial 719.0 719.0 2.0 40,60,80 0.40-0.41 True True
22 sub-590480_ses-20211111 True 948 NaN SSp deep,superficial 717.0 720.0 3.0 30,50,70 0.40-0.41 True True
23 sub-599017_ses-20220210 False 943 NaN SSp deep,superficial 718.0 720.0 2.0 30,50,70 0.40-0.41 True True
subjects among the 17: 16
The paper's 17 recordings in 16 mice are the 17 files the gist lists (sub-569073 has two sessions,
one stimulating MOs and one SSp). Seven other files are in the version: six hold only EEG and no
units, and one, sub-599017, has units and SSp stimulation but is not in the gist's list; the paper
does not say why it was left out. Each electrical trial lasts 0.4 ms (a biphasic pulse), so
stop_time is the pulse's end and start_time its onset.
# Units, variables and ranges used. waveform_duration is described in the Allen data as ms.
U = pd.concat([s["units"].assign(session=k) for k, s in S.items()], ignore_index=True)
print("units in the 17 files:", len(U))
print("waveform_duration range %.3f to %.3f (ms); values exactly 0.4: %d; between 0.399 and 0.401: %d"
% (U.waveform_duration.min(), U.waveform_duration.max(), (U.waveform_duration == 0.4).sum(),
U.waveform_duration.between(0.399, 0.401).sum()))
print("distinct waveform_duration steps near 0.4:", np.unique(np.round(U.waveform_duration[U.waveform_duration.between(0.35, 0.45)], 4)))
print("unit locations in stimulated areas (first three characters among estim_target_region):")
for k, s in S.items():
u = s["units"]; reg = npx.target_regions(s["trials"])
print(" ", k, reg, u.location[u.location.str[:3].isin(reg)].value_counts().to_dict())
# spike and trial clocks: ranges in seconds
for k, s in list(S.items())[:17]:
tr = s["trials"]; ep = s["meta"]["epochs"]
iso = tr[(tr.behavioral_epoch == "isoflurane") & (tr.stimulus_type == "electrical")]
an = ep[ep.tags.str.contains("anesthesia")]
inside = ((iso.start_time.values[:, None] >= an.start.values) & (iso.start_time.values[:, None] < an.stop.values)).any(1).mean()
print(f"{k}: trials {tr.start_time.min():.0f} to {tr.stop_time.max():.0f} s; isoflurane trials inside the "
f"isoflurane_anesthesia epoch: {inside:.0%}; epochs {list(ep.tags)}")
units in the 17 files: 11206
waveform_duration range 0.096 to 2.074 (ms); values exactly 0.4: 0; between 0.399 and 0.401: 0
distinct waveform_duration steps near 0.4: [0.3571 0.3709 0.3846 0.3983 0.4121 0.4258 0.4395]
unit locations in stimulated areas (first three characters among estim_target_region):
sub-546655_ses-20201023 ['MOs'] {'MOs': 18}
sub-551397_ses-20210211 ['MOs'] {'MOs': 89}
sub-551399_ses-20210128 ['MOs'] {'MOs': 99}
sub-569062_ses-20210218 ['MOs'] {'MOs': 132}
sub-569064_ses-20210408 ['MOs'] {'MOs': 29}
sub-569068_ses-20210304 ['MOs'] {'MOs': 62}
sub-569069_ses-20210312 ['MOs'] {'MOs': 32}
sub-569072_ses-20210422 ['SSp'] {'SSp-tr': 51, 'SSp-ll': 48}
sub-569073_ses-20210415 ['MOs'] {'MOs': 29}
sub-569073_ses-20210416 ['SSp'] {'SSp-ll': 11, 'SSp-tr': 2}
sub-571619_ses-20210319 ['MOs'] {'MOs': 103}
sub-571620_ses-20210513 ['SSp'] {'SSp-ll': 14}
sub-575102_ses-20210603 ['MOs'] {'MOs': 15}
sub-586466_ses-20210729 ['SSp'] {'SSp-tr': 27}
sub-586468_ses-20210819 ['SSp'] {'SSp-tr': 57}
sub-590479_ses-20210921 ['SSp'] {'SSp-tr': 105}
sub-590480_ses-20211111 ['SSp'] {'SSp-tr': 94}
sub-546655_ses-20201023: trials 83 to 6987 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-551397_ses-20210211: trials 313 to 8564 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-551399_ses-20210128: trials 326 to 6787 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-569062_ses-20210218: trials 310 to 7716 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-569064_ses-20210408: trials 375 to 10134 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-569068_ses-20210304: trials 315 to 8944 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-569069_ses-20210312: trials 314 to 8691 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-569072_ses-20210422: trials 342 to 5041 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-569073_ses-20210415: trials 357 to 10753 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-569073_ses-20210416: trials 320 to 4090 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-571619_ses-20210319: trials 319 to 7903 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-571620_ses-20210513: trials 478 to 9351 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-575102_ses-20210603: trials 365 to 9331 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-586466_ses-20210729: trials 412 to 8485 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-586468_ses-20210819: trials 316 to 8567 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-590479_ses-20210921: trials 379 to 7420 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
sub-590480_ses-20211111: trials 319 to 8223 s; isoflurane trials inside the isoflurane_anesthesia epoch: 100%; epochs ['isoflurane_induction', 'isoflurane_anesthesia']
The isoflurane trials fall inside the file's isoflurane_anesthesia epoch, which supports the
behavioral_epoch labels. Unit ids equal row numbers in all 17 files, so the gist's keying of
units by row index and lookup by id (claims file, checks, last point) select the same units here.
No unit has a waveform duration of exactly 0.4 ms (the values come in steps of about 0.0137 ms,
0.398 and 0.412 on either side), so the Methods' cut (>= 0.4) and the gist's (> 0.4) select the
same units.
Clock check. If the spike times share the trials' clock, spiking 2 to 12 ms after each pulse should exceed spiking in the same window at times shifted away from the pulses, and differ between awake and isoflurane trials.
# Population spike count per trial 2 to 12 ms after stop_time, against the same window placed
# 1.5 s before and after each pulse (npx.SHIFTS; inter-pulse intervals are 3.5 to 4.5 s), for
# the selected units (reading A1) of all 17 files. read_session counts the shifted windows from
# the full spike trains as it streams them. Per trial, the evoked count is compared with the
# mean of the two shifted counts by a Wilcoxon signed-rank test.
clock = []
for k, s in S.items():
rows_ = npx.select_units(s, "A1", "ge")
for c in npx.CONDITIONS:
tr = npx.condition_trials(s["trials"], c)
u, pos, x = npx.peristimulus(s, rows_, tr)
ev = np.bincount(pos, minlength=len(tr))
row = dict(session=k, condition=c, trials=len(tr), units=len(rows_), evoked=ev.mean())
sh = []
for lag, (uu, tt) in s["shifted"].items():
m = np.isin(uu, rows_) & np.isin(tt, tr)
where = {t: i for i, t in enumerate(tr)}
sh.append(np.bincount([where[t] for t in tt[m]], minlength=len(tr)))
row[f"shift {lag / 1000:+.1f} s"] = sh[-1].mean()
base = (sh[0] + sh[1]) / 2
row["evoked / shifted"] = ev.mean() / base.mean() if base.mean() else np.inf
row["wilcoxon p"] = stats.wilcoxon(ev, base).pvalue
clock.append(row)
clock = pd.DataFrame(clock)
with pd.option_context("display.float_format", "{:.3g}".format):
print(clock.to_string())
print("\nconditions with evoked above shifted at p < 0.001: %d of %d"
% ((clock["wilcoxon p"] < 0.001).sum(), len(clock)))
aw = clock.pivot(index="session", columns="condition", values="evoked")
print("files where the evoked count differs between conditions by more than 10%%: %d of %d"
% ((abs(aw.awake / aw.isoflurane - 1) > 0.1).sum(), len(aw)))
session condition trials units evoked shift -1.5 s shift +1.5 s evoked / shifted wilcoxon p 0 sub-546655_ses-20201023 awake 359 18 1.74 0.398 0.354 4.64 5.31e-43 1 sub-546655_ses-20201023 isoflurane 301 18 0.9 0.0532 0.00664 30.1 2.53e-37 2 sub-551397_ses-20210211 awake 360 84 12.2 3.7 3.53 3.36 5.27e-37 3 sub-551397_ses-20210211 isoflurane 360 84 6.03 1.4 1.46 4.22 1.87e-35 4 sub-551399_ses-20210128 awake 358 89 14.8 2.22 2.1 6.86 2.83e-60 5 sub-551399_ses-20210128 isoflurane 359 89 5.41 0.0947 0.184 38.8 2.27e-57 6 sub-569062_ses-20210218 awake 360 120 8.17 4.45 4.24 1.88 4.88e-14 7 sub-569062_ses-20210218 isoflurane 360 120 2.9 1.01 1.33 2.48 2.76e-15 8 sub-569064_ses-20210408 awake 360 24 2.79 0.506 0.378 6.32 1.91e-49 9 sub-569064_ses-20210408 isoflurane 357 24 0.717 0.112 0.042 9.31 1.98e-33 10 sub-569068_ses-20210304 awake 359 49 7.36 1.67 1.87 4.16 2.34e-42 11 sub-569068_ses-20210304 isoflurane 357 49 2.24 0.793 0.742 2.92 1.05e-12 12 sub-569069_ses-20210312 awake 357 29 1.55 1.53 1.36 1.07 0.591 13 sub-569069_ses-20210312 isoflurane 359 29 0.967 0.39 0.482 2.22 2.13e-12 14 sub-569072_ses-20210422 awake 359 83 9.27 3.84 3.42 2.55 5.64e-53 15 sub-569072_ses-20210422 isoflurane 360 83 6.22 0.819 0.875 7.34 6.77e-56 16 sub-569073_ses-20210415 awake 336 28 3.93 0.872 0.69 5.03 2.2e-45 17 sub-569073_ses-20210415 isoflurane 360 28 1.69 0.361 0.386 4.54 2.55e-29 18 sub-569073_ses-20210416 awake 355 12 8.69 0.639 0.501 15.2 7.84e-60 19 sub-569073_ses-20210416 isoflurane 360 12 9.26 0.2 0.289 37.9 6.92e-61 20 sub-571619_ses-20210319 awake 694 95 9.26 2.28 2.27 4.07 6.29e-91 21 sub-571619_ses-20210319 isoflurane 719 95 3.07 0.659 0.726 4.44 9.43e-46 22 sub-571620_ses-20210513 awake 720 9 1.43 0.289 0.292 4.92 2.95e-91 23 sub-571620_ses-20210513 isoflurane 720 9 0.565 0.0458 0.0319 14.5 1.01e-47 24 sub-575102_ses-20210603 awake 360 12 3.73 0.244 0.258 14.8 5.82e-60 25 sub-575102_ses-20210603 isoflurane 360 12 1.01 0.0694 0.0889 12.7 5.07e-40 26 sub-586466_ses-20210729 awake 717 14 1.04 0.335 0.382 2.89 4.45e-42 27 sub-586466_ses-20210729 isoflurane 712 14 0.204 0.0941 0.0871 2.25 1.18e-07 28 sub-586468_ses-20210819 awake 360 39 6.64 2.24 2.2 2.98 3.81e-53 29 sub-586468_ses-20210819 isoflurane 360 39 3.29 0.706 0.692 4.7 2.12e-39 30 sub-590479_ses-20210921 awake 719 81 8.54 3.91 4.19 2.11 3.87e-77 31 sub-590479_ses-20210921 isoflurane 719 81 5.35 1.05 0.982 5.27 1.38e-77 32 sub-590480_ses-20211111 awake 717 79 6.65 4.57 4.16 1.52 7.38e-46 33 sub-590480_ses-20211111 isoflurane 720 79 7.07 0.726 0.701 9.9 2.44e-108 conditions with evoked above shifted at p < 0.001: 33 of 34 files where the evoked count differs between conditions by more than 10%: 15 of 17
In 33 of the 34 file and condition pairs, the 2 to 12 ms window after the pulse holds 1.5 to 39 times the spikes of the same window 1.5 s before and after it (Wilcoxon p below 0.001), and in 15 of 17 files the evoked count differs between awake and isoflurane by more than 10%. The exception is the awake trials of sub-569069_ses-20210312 (1.55 against 1.45 spikes per trial, p = 0.59), where the selected units barely respond awake; its isoflurane trials, on the same file clock, pass (2.2 times, p = 2e-12). This is consistent with spikes and trials sharing one clock in all 17 files; for that file it rests on its isoflurane trials.
Duplicates. sub-569073 has two files; they are distinct recordings if their trials and spike counts differ.
sig = []
for k, s in S.items():
sig.append(dict(session=k, units=len(s["units"]), spikes=int(s["units"].n_spikes.sum()),
first_trial=round(float(s["trials"].start_time.iloc[0]), 5), trials=len(s["trials"])))
sig = pd.DataFrame(sig)
print(sig.to_string())
print("duplicate (units, spikes) pairs:", int(sig.duplicated(["units", "spikes"]).sum()),
"| duplicate first-trial times:", int(sig.duplicated(["first_trial"]).sum()))
session units spikes first_trial trials 0 sub-546655_ses-20201023 265 7034400 82.58399 1459 1 sub-551397_ses-20210211 607 30495283 313.21234 1800 2 sub-551399_ses-20210128 593 19228639 326.23190 1440 3 sub-569062_ses-20210218 902 22684156 310.40707 1440 4 sub-569064_ses-20210408 481 17086406 375.08634 1920 5 sub-569068_ses-20210304 338 17090527 314.97941 1800 6 sub-569069_ses-20210312 520 21554044 314.33655 1800 7 sub-569072_ses-20210422 995 21431190 342.48195 960 8 sub-569073_ses-20210415 631 29838639 356.66166 2040 9 sub-569073_ses-20210416 705 11165893 319.85838 720 10 sub-571619_ses-20210319 859 26124840 319.16422 1440 11 sub-571620_ses-20210513 771 28234593 477.89069 1680 12 sub-575102_ses-20210603 528 23611019 365.22333 1882 13 sub-586466_ses-20210729 470 15768233 411.65569 1680 14 sub-586468_ses-20210819 977 32363831 316.24158 1680 15 sub-590479_ses-20210921 616 15720936 379.02524 1440 16 sub-590480_ses-20211111 948 35167206 318.77278 1680 duplicate (units, spikes) pairs: 0 | duplicate first-trial times: 0
No two files share unit and spike counts or trial times, so each recording is counted once. The same unit in the awake and isoflurane epochs is the same row of one file's units table, sorted over the whole session, so no matching across sessions is needed.
The paper's own code. The analysis gist (gist a77bcf5e, revision 43a13d89) is run unmodified
on the loaded data: npx.run_gist gives it the trials and units through a stand-in for pynwb and
captures the table it would save. Its values are compared per unit with npx's for the gist's
selection (reading A2, waveform > 0.4 ms) and rate (F2).
# The paper's analysis gist, run unmodified on the loaded data (npx.run_gist), against npx's
# measures for the gist's own selection (reading A2, waveform > 0.4 ms) and rate (F2), per unit.
G = npx.run_gist(S)
cols = {"rate_F2": "Firing rate [Hz] ({})", "entropy": "Entropy [nats] ({})", "synchrony": "Synchrony ({})"}
cmp_rows, gist_all = [], []
for k in npx.SESSIONS:
g, T = G[k], npx.unit_table(S[k], "A2", "gt")
m = g.merge(T, left_on="id", right_on="row", how="outer", indicator=True)
row = dict(session=k, gist_units=len(g), npx_units=len(T), matched=int((m._merge == "both").sum()))
for c, sfx in zip(npx.CONDITIONS, ("_aw", "_an")):
for ours, theirs in cols.items():
a, b = m[theirs.format(c)].to_numpy(float), m[ours + sfx].to_numpy(float)
same = np.isclose(a, b, rtol=1e-8, atol=0) | (np.isnan(a) & np.isnan(b))
row[f"{ours}{sfx} differ"] = int((~same).sum())
cmp_rows.append(row)
gist_all.append(g)
cmp_ = pd.DataFrame(cmp_rows)
print(cmp_.to_string())
print("\nunits in the gist's tables:", int(cmp_.gist_units.sum()), "| matched to npx by id:", int(cmp_.matched.sum()),
"| values differing (relative tolerance 1e-8):", int(cmp_.filter(like="differ").to_numpy().sum()))
ga = pd.concat(gist_all, ignore_index=True)
fr = ga[["Firing rate [Hz] (awake)", "Firing rate [Hz] (isoflurane)"]]
exc = ((fr < 0.1) | (fr > 200)).any(axis=1)
print("the Methods' exclusion applied to the gist's rate column: %d kept, %d excluded" % ((~exc).sum(), exc.sum()))
K = ga[~exc]
for m in ("Synchrony", "Entropy [nats]"):
a, b = K[f"{m} (awake)"], K[f"{m} (isoflurane)"]
ok = a.notna() & b.notna()
print(f"{m} of the kept units from the gist's table: awake {a[ok].mean():.4f}, isoflurane {b[ok].mean():.4f} (n = {ok.sum()})")
session gist_units npx_units matched rate_F2_aw differ entropy_aw differ synchrony_aw differ rate_F2_an differ entropy_an differ synchrony_an differ 0 sub-546655_ses-20201023 18 18 18 0 0 0 0 0 0 1 sub-551397_ses-20210211 84 84 84 0 0 0 0 0 0 2 sub-551399_ses-20210128 89 89 89 0 0 0 0 0 0 3 sub-569062_ses-20210218 120 120 120 0 0 0 0 0 0 4 sub-569064_ses-20210408 24 24 24 0 0 0 0 0 0 5 sub-569068_ses-20210304 49 49 49 0 0 0 0 0 0 6 sub-569069_ses-20210312 29 29 29 0 0 0 0 0 0 7 sub-569072_ses-20210422 83 83 83 0 0 0 0 0 0 8 sub-569073_ses-20210415 28 28 28 0 0 0 0 0 0 9 sub-569073_ses-20210416 12 12 12 0 0 0 0 0 0 10 sub-571619_ses-20210319 95 95 95 0 0 0 0 0 0 11 sub-571620_ses-20210513 9 9 9 0 0 0 0 0 0 12 sub-575102_ses-20210603 12 12 12 0 0 0 0 0 0 13 sub-586466_ses-20210729 14 14 14 0 0 0 0 0 0 14 sub-586468_ses-20210819 39 39 39 0 0 0 0 0 0 15 sub-590479_ses-20210921 81 81 81 0 0 0 0 0 0 16 sub-590480_ses-20211111 79 79 79 0 0 0 0 0 0 units in the gist's tables: 865 | matched to npx by id: 865 | values differing (relative tolerance 1e-8): 0 the Methods' exclusion applied to the gist's rate column: 662 kept, 203 excluded Synchrony of the kept units from the gist's table: awake 0.3253, isoflurane 0.3928 (n = 662) Entropy [nats] of the kept units from the gist's table: awake 1.3474, isoflurane 1.1106 (n = 597)
The gist's tables hold the same 865 units as npx's A2 selection, and every rate, entropy and
synchrony value agrees with npx's F2 reading in both conditions (0 differ). Applying the Methods'
exclusion to the gist's rate column keeps 662 units and excludes 203, the paper's numbers, and the
kept units' means are the paper's Figure 4D values (synchrony 0.3253 and 0.3928, entropy 1.3474
and 1.1106 over the 597 units defined in both conditions). So npx's F2 denominator and trial
order are the gist's, and the paper's numbers are what its code gives on this version.
dataset-sessions-link¶
The 17 sessions the paper's analysis code reads are in DANDI:000458 and carry the fields the code uses.
need_units = {"spike_times", "location", "waveform_duration"}
need_trials = {"stimulus_type", "behavioral_epoch", "is_valid", "estim_target_region", "stop_time"}
link = []
for k in npx.SESSIONS:
s = S[k]
el = s["trials"][s["trials"].stimulus_type == "electrical"]
link.append(dict(session=k, file=k in set(assets.session),
units_fields=need_units <= set(s["units"].columns) | {"spike_times"},
trials_fields=need_trials <= set(s["trials"].columns),
awake=(el.behavioral_epoch == "awake").any(),
isoflurane=(el.behavioral_epoch == "isoflurane").any()))
link = pd.DataFrame(link)
print(link.to_string())
print("all 17 present with every field and both epochs:", bool(link.drop(columns="session").all().all()))
session file units_fields trials_fields awake isoflurane 0 sub-546655_ses-20201023 True True True True True 1 sub-551397_ses-20210211 True True True True True 2 sub-551399_ses-20210128 True True True True True 3 sub-569062_ses-20210218 True True True True True 4 sub-569064_ses-20210408 True True True True True 5 sub-569068_ses-20210304 True True True True True 6 sub-569069_ses-20210312 True True True True True 7 sub-569072_ses-20210422 True True True True True 8 sub-569073_ses-20210415 True True True True True 9 sub-569073_ses-20210416 True True True True True 10 sub-571619_ses-20210319 True True True True True 11 sub-571620_ses-20210513 True True True True True 12 sub-575102_ses-20210603 True True True True True 13 sub-586466_ses-20210729 True True True True True 14 sub-586468_ses-20210819 True True True True True 15 sub-590479_ses-20210921 True True True True True 16 sub-590480_ses-20211111 True True True True True all 17 present with every field and both epochs: True
Result: reproduced. All 17 files are in version 0.230317.0039, each with the units fields (spike_times read through its index, location, waveform_duration) and the trial fields the code uses, and with awake and isoflurane electrical trials.
fig4c-sample¶
After excluding 203 neurons with evoked rates below 0.1 Hz or above 200 Hz, 662 regular spiking neurons remain, from 17 recordings in 16 mice, a median of 34 per recording (1 to 93).
Judged under the Methods reading A1F1 (the spike count rate); A1F2, A2F1, A2F2 and the gist's waveform cut are variants (claims file, N7).
tables, kept = {}, {}
for name, (area, wf, rate) in npx.READINGS.items():
T = npx.all_units(S, area, wf)
ex = npx.excluded(T, rate)
tables[name], kept[name] = T, T[~ex].copy()
rows = []
for name, (area, wf, rate) in npx.READINGS.items():
T, K = tables[name], kept[name]
per = K.groupby("session").size().reindex(npx.SESSIONS, fill_value=0)
low = ((T[f"rate_{rate}_aw"] < 0.1) | (T[f"rate_{rate}_an"] < 0.1)).sum()
high = ((T[f"rate_{rate}_aw"] > 200) | (T[f"rate_{rate}_an"] > 200)).sum()
rows.append(dict(reading=name, selected=len(T), kept=len(K), excluded=len(T) - len(K),
below_0_1Hz=int(low), above_200Hz=int(high), recordings=int((per > 0).sum()),
mice=K.subject.nunique(), median=float(per[per > 0].median()),
min=int(per[per > 0].min()), max=int(per.max())))
sample = pd.DataFrame(rows).set_index("reading")
print(sample.to_string())
print("\nexpected: kept 662 +- 66.2, excluded 203 +- 20.3, recordings 17, mice 16, median 34 +- 3.4, min 1 +- 0.1, max 93 +- 9.3")
per = pd.DataFrame({n: kept[n].groupby("session").size().reindex(npx.SESSIONS, fill_value=0) for n in ("A1F1", "A1F2")})
per["selected"] = tables["A1F1"].groupby("session").size().reindex(npx.SESSIONS, fill_value=0)
print("\nper recording:\n" + per.to_string())
selected kept excluded below_0_1Hz above_200Hz recordings mice median min max
reading
A1F1 865 721 144 143 1 17 16 37.0 7 95
A1F2 865 662 203 143 61 17 16 34.0 1 93
A2F1 865 721 144 143 1 17 16 37.0 7 95
A2F2 865 662 203 143 61 17 16 34.0 1 93
A1F1 gist cut (> 0.4 ms) 865 721 144 143 1 17 16 37.0 7 95
A2F2 gist cut (> 0.4 ms) 865 662 203 143 61 17 16 34.0 1 93
expected: kept 662 +- 66.2, excluded 203 +- 20.3, recordings 17, mice 16, median 34 +- 3.4, min 1 +- 0.1, max 93 +- 9.3
per recording:
A1F1 A1F2 selected
session
sub-546655_ses-20201023 13 13 18
sub-551397_ses-20210211 67 63 84
sub-551399_ses-20210128 54 37 89
sub-569062_ses-20210218 95 93 120
sub-569064_ses-20210408 16 16 24
sub-569068_ses-20210304 48 47 49
sub-569069_ses-20210312 25 25 29
sub-569072_ses-20210422 75 73 83
sub-569073_ses-20210415 21 17 28
sub-569073_ses-20210416 11 1 12
sub-571619_ses-20210319 78 73 95
sub-571620_ses-20210513 7 7 9
sub-575102_ses-20210603 12 9 12
sub-586466_ses-20210729 12 12 14
sub-586468_ses-20210819 37 34 39
sub-590479_ses-20210921 73 67 81
sub-590480_ses-20211111 77 75 79
# What the F2 rate is: the gist sums spike times (in ms after the stimulus) where a count is
# expected, so F2 is the mean spike latency (in ms) times F1. Its 200 Hz bound is then a bound
# of 200 Hz divided by the mean latency on the spike-count rate.
T = tables["A1F1"]
ratio = (T.rate_F2_aw / T.rate_F1_aw).replace([np.inf], np.nan)
print("F2 / F1 (awake), median %.2f, 5th to 95th percentile %.2f to %.2f" % (ratio.median(), *ratio.quantile([.05, .95])))
K2 = kept["A1F2"]
print("F1 rate of the units F2 keeps: awake max %.1f Hz, isoflurane max %.1f Hz" % (K2.rate_F1_aw.max(), K2.rate_F1_an.max()))
ex_only_F2 = npx.excluded(T, "F2") & ~npx.excluded(T, "F1")
print("excluded under F2 but not F1:", int(ex_only_F2.sum()), "| under F1 but not F2:", int((npx.excluded(T, "F1") & ~npx.excluded(T, "F2")).sum()))
F2 / F1 (awake), median 4.50, 5th to 95th percentile 2.93 to 7.22 F1 rate of the units F2 keeps: awake max 51.0 Hz, isoflurane max 54.2 Hz excluded under F2 but not F1: 59 | under F1 but not F2: 0
Result: partially reproduced. Under the Methods reading A1F1, 865 units are selected, the paper's total (662 + 203), and 721 are kept and 144 excluded: the kept count is within tolerance of 662 but the excluded count is outside 203 +- 20.3. Recordings (17) and mice (16) match; the median per recording is 37 (range 7 to 95). Under the gist's rate (A1F2, and A2F2, which selects the same units here), every number matches exactly: 662 kept, 203 excluded (143 below 0.1 Hz, 61 above 200 Hz, one unit both), median 34, range 1 to 93. The gist's rate sums spike latencies (F2 / F1 median 4.50), so its 200 Hz bound acts on spike-count rates near 45 Hz (the kept units reach 54.2 Hz); the paper's exclusion matches this rate, not the Methods' count rate. The gist itself, run on the same data in the data check, gives the same 662 and 203.
fig4d-synchrony-lower-awake¶
Neurons show lower stimulus-evoked synchrony with the population awake than under isoflurane (0.325 against 0.393).
def stat_table(measure, readings=npx.READINGS):
out = []
for name in readings:
r = npx.paired(kept[name], measure)
out.append(dict(reading=name, **{k: (f"{v:.2e}" if k == "p" else round(v, 4) if isinstance(v, float) else v) for k, v in r.items()}))
return pd.DataFrame(out).set_index("reading")
syn = stat_table("synchrony")
print(syn.to_string())
print("\nexpected awake 0.325 +- 0.005 (0.320 to 0.330), isoflurane 0.393 +- 0.007 (0.386 to 0.400)")
r = npx.paired(kept["A1F1"], "synchrony")
print("A1F1 unrounded: awake %.5f, isoflurane %.5f, p = %.2e" % (r["awake"], r["anesthetized"], r["p"]))
n awake awake_sem anesthetized anesthetized_sem t p dropped reading A1F1 721 0.3188 0.0046 0.3862 0.0067 -12.4948 1.45e-32 0 A1F2 662 0.3253 0.0049 0.3928 0.0071 -11.7850 3.12e-29 0 A2F1 721 0.3188 0.0046 0.3862 0.0067 -12.4948 1.45e-32 0 A2F2 662 0.3253 0.0049 0.3928 0.0071 -11.7850 3.12e-29 0 A1F1 gist cut (> 0.4 ms) 721 0.3188 0.0046 0.3862 0.0067 -12.4948 1.45e-32 0 A2F2 gist cut (> 0.4 ms) 662 0.3253 0.0049 0.3928 0.0071 -11.7850 3.12e-29 0 expected awake 0.325 +- 0.005 (0.320 to 0.330), isoflurane 0.393 +- 0.007 (0.386 to 0.400) A1F1 unrounded: awake 0.31885, isoflurane 0.38624, p = 1.45e-32
# Variants: (a) the synchrony population restricted to the kept units (claims file, N6);
# (b) times from start_time, the pulse onset (the Methods say only "following an electrical
# stimulus"; the gist uses stop_time), for A1F1.
def kept_population(reading):
area, wf, rate = npx.READINGS[reading]
keep = {(r.session, r.row) for r in kept[reading].itertuples()}
def pop(session, rows, c, _name=[None]):
name = [k for k, v in S.items() if v is session][0]
return np.array([r for r in rows if (name, r) in keep], dtype=int)
return pop
var = []
for name in ("A1F1", "A1F2"):
area, wf, rate = npx.READINGS[name]
T = npx.all_units(S, area, wf, population=kept_population(name))
K = T.merge(kept[name][["session", "row"]], on=["session", "row"])
var.append(dict(variant=f"{name}, population = kept units", **npx.paired(K, "synchrony")))
Tst = npx.all_units(S, "A1", "ge", offset=-0.4)
Kst = Tst[~npx.excluded(Tst, "F1")]
var.append(dict(variant="A1F1, times from start_time", **npx.paired(Kst, "synchrony")))
var = pd.DataFrame(var)
var["p"] = var.p.map(lambda p: f"{p:.2e}") # formatted before rounding, so small p are kept
var = var.round(4)
print(var.to_string())
variant n awake awake_sem anesthetized anesthetized_sem t p dropped 0 A1F1, population = kept units 721 0.3225 0.0046 0.3876 0.0068 -12.0295 1.68e-30 0 1 A1F2, population = kept units 662 0.3686 0.0051 0.4333 0.0073 -10.4410 1.00e-23 0 2 A1F1, times from start_time 734 0.3073 0.0041 0.3720 0.0063 -12.9581 1.00e-34 0
# By recording (A1F1), and the range of the plotted values
K = kept["A1F1"]
by = K.groupby("session").apply(lambda d: pd.Series(dict(n=len(d), awake=d.synchrony_aw.mean(),
isoflurane=d.synchrony_an.mean(), lower_awake=(d.synchrony_aw < d.synchrony_an).mean())), include_groups=False)
print(by.round(3).to_string())
print("recordings with awake mean lower: %d of %d" % ((by.awake < by.isoflurane).sum(), len(by)))
print("units with awake lower: %d of %d" % ((K.synchrony_aw < K.synchrony_an).sum(), len(K)))
fig, axes = plt.subplots(1, 2, figsize=(8, 4))
for ax, m, lab in zip(axes, ("synchrony", "entropy"), ("Synchrony", "Entropy (nats)")):
ax.scatter(K[m + "_an"], K[m + "_aw"], s=4)
lim = [np.nanmin(K[[m + "_an", m + "_aw"]].values), np.nanmax(K[[m + "_an", m + "_aw"]].values)]
ax.plot(lim, lim, "k--", lw=1); ax.set_xlabel(lab + ", isoflurane"); ax.set_ylabel(lab + ", awake")
print(f"{m} plotted range: {lim[0]:.3f} to {lim[1]:.3f}; all points inside the axes")
fig.suptitle("A1F1 kept units"); fig.tight_layout(); plt.show()
n awake isoflurane lower_awake session sub-546655_ses-20201023 13.0 0.529 0.561 0.462 sub-551397_ses-20210211 67.0 0.293 0.365 0.776 sub-551399_ses-20210128 54.0 0.206 0.237 0.667 sub-569062_ses-20210218 95.0 0.314 0.404 0.705 sub-569064_ses-20210408 16.0 0.453 0.837 1.000 sub-569068_ses-20210304 48.0 0.383 0.439 0.667 sub-569069_ses-20210312 25.0 0.598 0.594 0.640 sub-569072_ses-20210422 75.0 0.320 0.358 0.600 sub-569073_ses-20210415 21.0 0.308 0.534 0.905 sub-569073_ses-20210416 11.0 0.208 0.187 0.182 sub-571619_ses-20210319 78.0 0.219 0.287 0.795 sub-571620_ses-20210513 7.0 0.670 0.795 0.857 sub-575102_ses-20210603 12.0 0.414 0.785 1.000 sub-586466_ses-20210729 12.0 0.631 0.782 0.750 sub-586468_ses-20210819 37.0 0.331 0.369 0.649 sub-590479_ses-20210921 73.0 0.269 0.310 0.630 sub-590480_ses-20211111 77.0 0.298 0.299 0.506 recordings with awake mean lower: 15 of 17 units with awake lower: 489 of 721 synchrony plotted range: 0.071 to 1.000; all points inside the axes entropy plotted range: -0.000 to 2.236; all points inside the axes
Result: partially reproduced. Under A1F1 (721 units) synchrony is lower awake, 0.3188 against 0.3862 (paired t test p = 1.45e-32), in the paper's direction and at its significance, but the awake mean is just outside 0.325 +- 0.005; the isoflurane mean is inside its tolerance, at its lower edge. Awake is lower in 15 of 17 recordings. Under the gist's rate (A1F2, A2F2) the means are 0.3253 and 0.3928, the paper's values. Restricting the population to kept units (0.3225 against 0.3876) or timing from pulse onset (0.3073 against 0.3720) keeps the direction.
fig4d-entropy-higher-awake¶
Peri-stimulus histogram entropy is higher awake than under isoflurane (1.347 against 1.111 nats), so responses are more variable in time.
ent = stat_table("entropy")
print(ent.to_string())
print("\nexpected awake 1.347 +- 0.018 (1.329 to 1.365), isoflurane 1.111 +- 0.020 (1.091 to 1.131)")
# units left out: entropy is undefined with fewer than two spikes in a condition (N5, N8)
K = kept["A1F1"]
print("A1F1 kept units with fewer than two spikes awake / isoflurane:", int((K.count_aw < 2).sum()), "/", int((K.count_an < 2).sum()))
# means over all units with a value in each condition separately (pandas skipna), a variant
for name in ("A1F1", "A1F2"):
K = kept[name]
print(f"{name}, each condition over its own defined values: awake {K.entropy_aw.mean():.3f} (n = {K.entropy_aw.notna().sum()}), "
f"isoflurane {K.entropy_an.mean():.3f} (n = {K.entropy_an.notna().sum()})")
Kst = Tst[~npx.excluded(Tst, "F1")]
print("A1F1 from start_time:", {k: (f"{v:.2e}" if k == "p" else round(float(v), 4)) for k, v in npx.paired(Kst, "entropy").items()})
by = kept["A1F1"].groupby("session").apply(lambda d: pd.Series(dict(n=d.entropy_aw.notna().sum(),
awake=d.entropy_aw.mean(), isoflurane=d.entropy_an.mean())), include_groups=False)
print(by.round(3).to_string())
print("recordings with awake mean higher: %d of %d" % ((by.awake > by.isoflurane).sum(), by.awake.notna().sum()))
n awake awake_sem anesthetized anesthetized_sem t p dropped
reading
A1F1 656 1.3887 0.0182 1.1502 0.0205 12.0189 3.28e-30 65
A1F2 597 1.3474 0.0188 1.1106 0.0211 11.1306 2.82e-26 65
A2F1 656 1.3887 0.0182 1.1502 0.0205 12.0189 3.28e-30 65
A2F2 597 1.3474 0.0188 1.1106 0.0211 11.1306 2.82e-26 65
A1F1 gist cut (> 0.4 ms) 656 1.3887 0.0182 1.1502 0.0205 12.0189 3.28e-30 65
A2F2 gist cut (> 0.4 ms) 597 1.3474 0.0188 1.1106 0.0211 11.1306 2.82e-26 65
expected awake 1.347 +- 0.018 (1.329 to 1.365), isoflurane 1.111 +- 0.020 (1.091 to 1.131)
A1F1 kept units with fewer than two spikes awake / isoflurane: 18 / 52
A1F1, each condition over its own defined values: awake 1.365 (n = 703), isoflurane 1.144 (n = 669)
A1F2, each condition over its own defined values: awake 1.324 (n = 644), isoflurane 1.104 (n = 610)
A1F1 from start_time: {'n': 674.0, 'awake': 1.4106, 'awake_sem': 0.0176, 'anesthetized': 1.1738, 'anesthetized_sem': 0.0191, 't': 12.781, 'p': '1.21e-33', 'dropped': 60.0}
n awake isoflurane
session
sub-546655_ses-20201023 13.0 1.287 0.698
sub-551397_ses-20210211 66.0 1.269 1.048
sub-551399_ses-20210128 54.0 1.460 1.093
sub-569062_ses-20210218 90.0 1.253 1.036
sub-569064_ses-20210408 16.0 1.027 0.640
sub-569068_ses-20210304 46.0 1.153 0.776
sub-569069_ses-20210312 23.0 0.863 0.772
sub-569072_ses-20210422 71.0 1.112 0.976
sub-569073_ses-20210415 20.0 1.346 1.224
sub-569073_ses-20210416 11.0 2.013 2.084
sub-571619_ses-20210319 78.0 1.748 1.457
sub-571620_ses-20210513 7.0 1.209 0.849
sub-575102_ses-20210603 12.0 1.263 0.730
sub-586466_ses-20210729 11.0 1.562 1.009
sub-586468_ses-20210819 36.0 1.264 1.330
sub-590479_ses-20210921 73.0 1.496 1.293
sub-590480_ses-20211111 76.0 1.552 1.410
recordings with awake mean higher: 15 of 17
Result: partially reproduced. Under A1F1 entropy is higher awake, 1.389 against 1.150 nats over 656 units with a value in both conditions (65 dropped with fewer than two spikes in a condition; paired t test p below 0.001, table above), in the paper's direction and at its significance, but both means are outside tolerance. Awake is higher in 15 of 17 recordings. Under the gist's rate (A1F2, A2F2) they are 1.347 and 1.111 nats over 597 units, the paper's values.
fig4-rate-higher-awake¶
The same electrical stimuli evoke more spiking awake than under isoflurane; the mean evoked firing rate is higher in the awake state.
rows = []
for name, (area, wf, rate) in npx.READINGS.items():
K = kept[name]
r = npx.paired(K, f"rate_{rate}")
rows.append(dict(reading=name, rate=rate, **r))
if rate != "F1":
rows.append(dict(reading=name, rate="F1 (spike count)", **npx.paired(K, "rate_F1")))
rt = pd.DataFrame(rows)
rt["p"] = rt.p.map(lambda p: f"{p:.2e}") # formatted before rounding, so small p are kept
rt = rt.round(3)
print(rt.to_string())
K = kept["A1F1"]
print("units with a higher awake rate: %d of %d" % ((K.rate_F1_aw > K.rate_F1_an).sum(), len(K)))
by = K.groupby("session")[["rate_F1_aw", "rate_F1_an"]].mean()
print("recordings with higher awake mean rate: %d of %d" % ((by.rate_F1_aw > by.rate_F1_an).sum(), len(by)))
print(by.round(2).to_string())
reading rate n awake awake_sem anesthetized anesthetized_sem t p dropped
0 A1F1 F1 721 14.000 0.658 7.591 0.471 12.361 5.75e-32 0
1 A1F2 F2 662 45.051 1.750 24.294 1.225 13.446 1.31e-36 0
2 A1F2 F1 (spike count) 662 10.156 0.404 5.401 0.280 13.610 2.28e-37 0
3 A2F1 F1 721 14.000 0.658 7.591 0.471 12.361 5.75e-32 0
4 A2F2 F2 662 45.051 1.750 24.294 1.225 13.446 1.31e-36 0
5 A2F2 F1 (spike count) 662 10.156 0.404 5.401 0.280 13.610 2.28e-37 0
6 A1F1 gist cut (> 0.4 ms) F1 721 14.000 0.658 7.591 0.471 12.361 5.75e-32 0
7 A2F2 gist cut (> 0.4 ms) F2 662 45.051 1.750 24.294 1.225 13.446 1.31e-36 0
8 A2F2 gist cut (> 0.4 ms) F1 (spike count) 662 10.156 0.404 5.401 0.280 13.610 2.28e-37 0
units with a higher awake rate: 539 of 721
recordings with higher awake mean rate: 15 of 17
rate_F1_aw rate_F1_an
session
sub-546655_ses-20201023 12.15 6.93
sub-551397_ses-20210211 16.53 9.00
sub-551399_ses-20210128 24.35 10.01
sub-569062_ses-20210218 8.17 3.04
sub-569064_ses-20210408 16.34 4.45
sub-569068_ses-20210304 15.15 4.67
sub-569069_ses-20210312 6.17 3.80
sub-569072_ses-20210422 12.26 8.06
sub-569073_ses-20210415 18.55 8.03
sub-569073_ses-20210416 58.10 66.57
sub-571619_ses-20210319 11.28 3.93
sub-571620_ses-20210513 17.82 8.08
sub-575102_ses-20210603 31.04 8.40
sub-586466_ses-20210729 8.45 1.70
sub-586468_ses-20210819 17.94 8.88
sub-590479_ses-20210921 11.52 7.33
sub-590480_ses-20211111 8.61 9.18
Result: reproduced. Under A1F1 the mean evoked rate is 14.0 Hz awake against 7.59 Hz under isoflurane (paired t test, t = 12.36, p = 5.75e-32, table above), higher awake in 539 of 721 units and 15 of 17 recordings; every reading gives the same direction.
figs6-rate-regressed¶
The awake decrease in synchrony and increase in entropy remain after the effect of firing rate is regressed out.
Readings from the criterion: (R1) one linear regression of the measure on the evoked rate across all unit and condition values, residuals compared by the paired t test; (R2) OLS of the measure on condition and rate, condition coefficient tested; (R3) per unit, the awake minus isoflurane difference of the measure regressed on the difference of rate, intercept tested. The rate is the reading's own (F1 under A1F1).
def regressed(K, measure, rate):
a, b = K[measure + "_aw"], K[measure + "_an"]
ok = a.notna() & b.notna()
K = K[ok]
long = pd.DataFrame({"y": np.r_[K[measure + "_aw"], K[measure + "_an"]],
"rate": np.r_[K[f"rate_{rate}_aw"], K[f"rate_{rate}_an"]],
"awake": np.r_[np.ones(len(K)), np.zeros(len(K))]})
# R1
slope, icpt = np.polyfit(long.rate, long.y, 1)
res = long.y - (icpt + slope * long.rate)
n = len(K)
t1 = stats.ttest_rel(res[:n], res[n:])
# R2
m2 = smf.ols("y ~ awake + rate", data=long).fit()
# R3
d = pd.DataFrame({"dy": K[measure + "_aw"].values - K[measure + "_an"].values,
"dr": K[f"rate_{rate}_aw"].values - K[f"rate_{rate}_an"].values})
m3 = smf.ols("dy ~ dr", data=d).fit()
return dict(n=n, R1_diff=res[:n].mean() - res[n:].mean(), R1_p=t1.pvalue,
R2_awake_coef=m2.params["awake"], R2_p=m2.pvalues["awake"],
R3_intercept=m3.params["Intercept"], R3_p=m3.pvalues["Intercept"])
rows = []
for name, (area, wf, rate) in npx.READINGS.items():
for m in ("synchrony", "entropy"):
rows.append(dict(reading=name, measure=m, **regressed(kept[name], m, rate)))
reg = pd.DataFrame(rows)
with pd.option_context("display.float_format", "{:.3g}".format):
print(reg.to_string())
print("\nexpected signs: synchrony awake difference negative, entropy positive, p < 0.05 under every regression reading")
for m, sign in (("synchrony", -1), ("entropy", 1)):
r = reg[(reg.reading == "A1F1") & (reg.measure == m)].iloc[0]
ok = all(np.sign(r[k]) == sign and r[p] < 0.05 for k, p in (("R1_diff", "R1_p"), ("R2_awake_coef", "R2_p"), ("R3_intercept", "R3_p")))
print(f"A1F1 {m}: holds under R1, R2 and R3: {ok}")
reading measure n R1_diff R1_p R2_awake_coef R2_p R3_intercept R3_p 0 A1F1 synchrony 721 -0.0593 3.32e-26 -0.0619 1.52e-13 -0.0625 2.79e-24 1 A1F1 entropy 656 0.171 7.08e-17 0.179 4.17e-11 0.21 1.07e-20 2 A1F2 synchrony 662 -0.0569 4.73e-22 -0.061 9.2e-12 -0.0583 1.28e-18 3 A1F2 entropy 597 0.138 6.89e-11 0.149 8.92e-08 0.172 5.45e-13 4 A2F1 synchrony 721 -0.0593 3.32e-26 -0.0619 1.52e-13 -0.0625 2.79e-24 5 A2F1 entropy 656 0.171 7.08e-17 0.179 4.17e-11 0.21 1.07e-20 6 A2F2 synchrony 662 -0.0569 4.73e-22 -0.061 9.2e-12 -0.0583 1.28e-18 7 A2F2 entropy 597 0.138 6.89e-11 0.149 8.92e-08 0.172 5.45e-13 8 A1F1 gist cut (> 0.4 ms) synchrony 721 -0.0593 3.32e-26 -0.0619 1.52e-13 -0.0625 2.79e-24 9 A1F1 gist cut (> 0.4 ms) entropy 656 0.171 7.08e-17 0.179 4.17e-11 0.21 1.07e-20 10 A2F2 gist cut (> 0.4 ms) synchrony 662 -0.0569 4.73e-22 -0.061 9.2e-12 -0.0583 1.28e-18 11 A2F2 gist cut (> 0.4 ms) entropy 597 0.138 6.89e-11 0.149 8.92e-08 0.172 5.45e-13 expected signs: synchrony awake difference negative, entropy positive, p < 0.05 under every regression reading A1F1 synchrony: holds under R1, R2 and R3: True A1F1 entropy: holds under R1, R2 and R3: True
# By recording, R2 under A1F1 (a breakdown; recordings with fewer than 5 units are skipped)
rows = []
for k, d in kept["A1F1"].groupby("session"):
if len(d) < 5:
continue
for m in ("synchrony", "entropy"):
r = regressed(d, m, "F1")
rows.append(dict(session=k, measure=m, n=r["n"], R2_awake_coef=r["R2_awake_coef"], R2_p=r["R2_p"]))
br = pd.DataFrame(rows)
with pd.option_context("display.float_format", "{:.3g}".format):
print(br.pivot(index="session", columns="measure", values=["R2_awake_coef", "R2_p"]).to_string())
for m, sign in (("synchrony", -1), ("entropy", 1)):
d = br[br.measure == m]
print(f"{m}: awake coefficient in the expected direction in {int((np.sign(d.R2_awake_coef) == sign).sum())} of {len(d)} recordings")
print(f"\nnotebook run time so far {(time.time() - T0) / 60:.1f} min")
R2_awake_coef R2_p measure entropy synchrony entropy synchrony session sub-546655_ses-20201023 0.691 -0.0616 0.00343 0.315 sub-551397_ses-20210211 0.169 -0.0656 0.0228 0.000184 sub-551399_ses-20210128 0.268 -0.0386 0.0122 0.000179 sub-569062_ses-20210218 0.118 -0.0796 0.0977 2.91e-05 sub-569064_ses-20210408 0.438 -0.412 0.0437 5.49e-08 sub-569068_ses-20210304 0.262 -0.0403 0.00808 0.144 sub-569069_ses-20210312 0.0731 -0.00905 0.536 0.836 sub-569072_ses-20210422 0.0967 -0.0399 0.148 0.0155 sub-569073_ses-20210415 0.00362 -0.226 0.985 1.36e-05 sub-569073_ses-20210416 -0.0731 0.0218 0.164 0.00179 sub-571619_ses-20210319 0.221 -0.0725 0.00194 1.42e-06 sub-571620_ses-20210513 0.12 -0.106 0.618 0.0703 sub-575102_ses-20210603 0.434 -0.372 0.0248 3.51e-11 sub-586466_ses-20210729 0.449 -0.148 0.0427 0.034 sub-586468_ses-20210819 -0.0687 -0.0431 0.521 0.0366 sub-590479_ses-20210921 0.156 -0.0385 0.0298 0.00277 sub-590480_ses-20211111 0.144 0.000137 0.0608 0.988 synchrony: awake coefficient in the expected direction in 15 of 17 recordings entropy: awake coefficient in the expected direction in 15 of 17 recordings notebook run time so far 3.5 min
Result: reproduced. Under A1F1, with the evoked rate regressed out, synchrony stays lower and entropy higher awake under each of R1, R2 and R3 (all six p below 1e-10, table above), and the same holds under every other reading, so the outcome does not depend on which regression the unread Figure S6 legend describes.
Times from start_time¶
The claims file (N3) takes spike times from each trial's stop_time, as the gist does; the Methods say only "following an electrical stimulus". Under A1F1 with times from start_time, the pulse onset 0.4 ms earlier, the sample, the rate test and the regressions (synchrony and entropy are in the variant tables of their claims above).
# Tst and Kst (A1F1, times from start_time) are built in the synchrony variants above
per = Kst.groupby("session").size().reindex(npx.SESSIONS, fill_value=0)
print("start_time, A1F1: selected %d, kept %d, excluded %d, recordings %d, mice %d, median %.0f per recording (%d to %d)"
% (len(Tst), len(Kst), len(Tst) - len(Kst), (per > 0).sum(), Kst.subject.nunique(),
per[per > 0].median(), per[per > 0].min(), per.max()))
r = npx.paired(Kst, "rate_F1")
print("evoked rate: " + ", ".join(f"{k} {v:.3g}" for k, v in r.items()))
reg_st = pd.DataFrame([dict(measure=m, **regressed(Kst, m, "F1")) for m in ("synchrony", "entropy")])
with pd.option_context("display.float_format", "{:.3g}".format):
print(reg_st.to_string())
start_time, A1F1: selected 865, kept 734, excluded 131, recordings 17, mice 16, median 37 per recording (8 to 96)
evoked rate: n 734, awake 14.9, awake_sem 0.687, anesthetized 8.14, anesthetized_sem 0.482, t 13, p 9.58e-35, dropped 0
measure n R1_diff R1_p R2_awake_coef R2_p R3_intercept R3_p
0 synchrony 734 -0.0579 8.79e-29 -0.0605 7.64e-15 -0.06 1.57e-25
1 entropy 674 0.175 1.03e-19 0.183 1.49e-12 0.213 1.34e-23
Result. With times from start_time, 734 units are kept and 131 excluded (median 37 per recording, 8 to 96); the evoked rate is higher awake (14.9 against 8.14 Hz, p = 9.58e-35); with the rate regressed out synchrony stays lower and entropy higher awake under R1, R2 and R3 (all p below 1e-11). The directions are those under stop_time.
Summary¶
| Claim | Outcome |
|---|---|
| dataset-sessions-link | reproduced |
| fig4c-sample | partially reproduced (exact under the gist's rate) |
| fig4d-synchrony-lower-awake | partially reproduced (exact under the gist's rate) |
| fig4d-entropy-higher-awake | partially reproduced (exact under the gist's rate) |
| fig4-rate-higher-awake | reproduced |
| figs6-rate-regressed | reproduced (under all three regression readings) |
| model claims (four) | see network_model.ipynb |
| figs4-intrinsic-properties | blocked: methods_underspecified (the NEURON model is public; the Figure S4 measure and comparison are in the unread legend) |
| 24 patch-clamp claims | blocked: data_missing |
A failure to reproduce here may be a failure of this attempt, not of the paper: see the reasoning and the differences from the paper's method.
How the analysis differs from the paper's. The claims file judges each claim under the Methods' evoked rate (spike count over trials times 10 ms). The paper's numbers come out exactly under the rate its own code computes, which sums the spikes' latencies where a count is expected; under that rate the exclusion drops units above about 45 Hz of spike-count rate. The three partial outcomes are this difference: the effects are there, at the paper's significance, with the excluded count (144 against 203) and the means a little off under the Methods' rate.
What was found about the dataset. The 17 recordings the paper used are in the pinned version with every field needed, and their labels pass the checks above; the clocks pass in 33 of 34 file and condition pairs, the exception being sub-569069 awake, whose evoked count is only 1.07 times the shifted-window count (p = 0.591). The version also holds sub-599017 (units, SSp stimulation), which the paper does not use and does not mention, and six EEG-only files. The patch-clamp recordings of Figures 1 to 3 are not in the dandiset.