Reproducing Wei et al. (2023) from dandiset 000021¶
Paper. Wei, Nandi, Jia, Siegle, Denman, Lee, Buchin, Van Geit, Mosher, Olsen & Anastassiou
(2023), "Associations between in vitro, in vivo and in silico cell classes in mouse primary
visual cortex", Nature Communications 14, 2344, doi:10.1038/s41467-023-37844-8. The claims
file claims/wei-2023.yaml was written from the version of record (PubMed Central text), its
Supplementary Information and its Source Data workbook.
Dataset. DANDI:000021, "Allen Institute - Visual Coding - Neuropixels (Brain Observatory 1.1 Stimulus Set)", version 0.251116.2246 (doi:10.48324/dandi.000021/0.251116.2246). The paper names the dandiset without a version; 0.251116.2246 is its only published version, so it is pinned. The dandiset holds 32 sessions of the Brain Observatory 1.1 set; 13 of the paper's 25 wild-type sessions are among them (the other 12 are not, see source-data-units-link), and 5 Pvalb and 6 Sst opto-tagging sessions (the paper used 8 and 12 mice).
Inputs from outside the dataset. The paper's Source Data workbook (from the journal's site), the code's unit tables and model features (github.com/yinawei/Mouse_V1_EAP_Analysis at commit 1e35126f1e521b4c98e9ba5fd6a4a8abce70530a), and the in vitro features of the Allen Cell Types Database API.
| Claim | Tested here |
|---|---|
| source-data-units-link | tested (link, with labels) |
| fig1d-unit-count | tested |
| fig2-one-channel-two-clusters | tested |
| fig2-fs-rs-counts | tested |
| figs3b-fs-faster | tested |
| fig2-rs-more-asymmetric | tested |
| fig2d-three-subclusters-each | tested |
| figs4-rs1-faster-above, figs4-rs-spread, figs4-fs-spread-absent | tested |
| figs5-depth-distribution | tested |
| fig6a-fs1-symmetric | tested |
| fig4g-experiment-classifier-fs-rs, fig5d-experiment-classifier-rs | tested |
| fig3a-isi-fs-rs, fig3a-rs1-excitability, fig3a-rs23-visual-responses, fig3a-fs-visual-absent | tested |
| fig3c-fs-more-phase-locked, fig3c-rs-prefers-theta, figs7-spontaneous-less-locked | tested |
| fig3c-fs-stronger-earlier, fig3d-rs2-gamma-locking, fig3e-fs-cluster-locking | tested |
| figs6c-fs-stronger-across-depth, figs6d-rs3-supragranular-beta, figs6c-granular-phase | tested |
| fig7-opto-unit-counts, fig7d-pvalb-fs-sst-diffuse, fig7e-pvalb-sst-one-channel | tested |
| fig7g-pvalb-more-symmetric, fig7h-pvalb-higher-cv, fig7h-pvalb-theta-sst-later | tested |
| fig4d-ap-sp-models-tpw-rep, fig4f-model-classifier, fig4g-models-map-to-fs-rs, fig4h-cre-lines-map | tested (model features, an input) |
| fig5a-sp-models-three-clusters, fig5c-sp-rs-two-way-mapping, fig6b-pvalb-sst-models-symmetry | tested (model features, an input) |
| fig4e-in-vitro-ap-sp, fig5j-sp1-rate-tau, fig6g-pvalb-sst-in-vitro | tested (Allen Cell Types API and Source Data) |
| fig5e-ca-lva, fig6cf-kv31, fig5g-bifurcation-velocity-sp, fig6d-sst-asymmetric-morphology, fig6e-bifurcation-velocity-inhibitory | tested on the Source Data values |
| figs8-rotation-symmetry | blocked (simulations, models not public) |
Each section prints the results under every reading the criterion names. Where a claim depends on the cluster labels, it is run on the clusters found here under isolation readings (c), (a) and (b), and on the Source Data labels of the 566 held units, with this dataset's measures. Reading (c), reading (a) with at least 100 spikes in the first 5-min gray screen, is an assumption (see fig1d-unit-count): it keeps 603 of the 603 units of the code's unit tables that pass reading (a) and adds 27, where reading (a) adds 297. The outcomes of the claims after fig1d-unit-count are judged on it. Depth relative to layer 4 is taken from the layer 4 centre computed here from the flash CSD, the method the criterion of figs5-depth-distribution names, with the layer 4 centre of the code's unit tables (one value per probe) as a variant (see figs5-depth-distribution).
Setup and loading¶
Every session is streamed from the archive and reduced as it loads
(wei2023.process_session): every VISp unit of the units table (quality "good" or "noise"), their mean waveforms and features,
spike-train measures, drifting-grating metrics, opto-tagging responses, the CSD layer 4
centre and the spike phases in five LFP bands. Four sessions are processed at a time; each
worker holds about 2 GB at its peak (measured on one session while preparing).
import os, zlib, time, resource
os.environ.setdefault("OMP_NUM_THREADS", "1")
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot as plt
import wei2023 as W
pd.set_option("display.width", 160)
pd.set_option("display.max_columns", 30)
def seed_of(claim):
"""The seed of a claim's generator (docs/protocol.md)."""
return zlib.crc32(f"wei-2023/{claim}".encode())
SEED_PHASE = seed_of("fig3c-fs-more-phase-locked")
SOURCE_DATA = ("https://static-content.springer.com/esm/art%3A10.1038%2Fs41467-023-37844-8/"
"MediaObjects/41467_2023_37844_MOESM3_ESM.xlsx")
CODE = ("https://raw.githubusercontent.com/yinawei/Mouse_V1_EAP_Analysis/"
"1e35126f1e521b4c98e9ba5fd6a4a8abce70530a/Examples/data/")
t0 = time.time()
S = W.sessions_to_use()
ALL_SESSIONS = S["wt"] + S["Pvalb"] + S["Sst"]
R = W.process_all(ALL_SESSIONS, SEED_PHASE, workers=4)
units = W.assemble(R, S)
print(f"processed {len(R)} sessions in {time.time() - t0:.0f} s")
processed 24 sessions in 766 s
import io, urllib.request
def fetch(url):
with urllib.request.urlopen(url) as r:
return io.BytesIO(r.read())
sd_book = pd.ExcelFile(fetch(SOURCE_DATA))
sd = {name: pd.read_excel(sd_book, sheet_name=name, header=None) for name in sd_book.sheet_names}
def sd_table(name, header_row=0):
d = sd[name]
t = d.iloc[header_row + 1:].copy()
t.columns = [str(c) for c in d.iloc[header_row]]
return t.reset_index(drop=True)
sd_fig2d = sd_table("Fig2d").set_index("unit_id")
sd_fig2d.columns = ["idx", "cluster", "code_label", "TPW", "REP", "inv_below", "inv_above"]
sd_fig2d["onech"] = np.where(sd_fig2d.cluster.str.startswith("FS"), "FS", "RS")
d1 = sd["Fig 1d"]
start = d1.index[d1[1] == "animal_id"][0]
sd_sessions = d1.iloc[start + 1:start + 26, 1:3].astype(int)
sd_sessions.columns = ["session", "units"]
unitinfo = pd.concat([pd.read_csv(fetch(f"{CODE}wt_EAP_data_info/{s}unitinfo.csv"), index_col=0)
.assign(session=s) for s in S["wt"]]).set_index("units")
model = pd.read_csv(fetch(CODE + "model_features.csv"), index_col=0)
print("Source Data sheets:", len(sd), "; Fig2d units:", len(sd_fig2d),
"; code unit tables:", len(unitinfo), "rows; models:", len(model))
Source Data sheets: 25 ; Fig2d units: 1204 ; code unit tables: 618 rows; models: 33
Data check¶
info = pd.DataFrame([R[s]["info"] for s in ALL_SESSIONS]).set_index("session")
info["group"] = [g for s in ALL_SESSIONS for g in S if s in S[g]]
info["visp_units"] = units.groupby("session").size()
info["visp_good"] = units[units.quality == "good"].groupby("session").size()
print("Sessions held, by group:", {g: len(v) for g, v in S.items()})
print("Paper's wild-type sessions not in this dandiset:",
[s for s in W.PAPER_WT_SESSIONS if s not in S["wt"]])
print(info[["group", "genotype", "sex", "visp_units", "visp_good", "visp_noise_units", "n_dg", "dg_time", "dg_block_time",
"spont_time", "n_flashes", "n_opto_pulses", "t_first", "t_last"]].to_string())
print("\nSex by group:", info.groupby(["group", "sex"]).size().to_dict())
print("\nUnits (VISp, any quality), all sessions:", len(units), "; of quality good:", int((units.quality == "good").sum()))
print("Electrodes tables: CCF x, y, z NaN in", int((info.electrodes_xyz_nan > 0).sum()), "of", len(info), "sessions;",
"sessions with coordinates:", info.index[info.electrodes_xyz_nan == 0].tolist(),
"; channels with y equal to z there:", info.loc[info.electrodes_xyz_nan == 0, "electrodes_y_eq_z"].tolist(),
"of", info.loc[info.electrodes_xyz_nan == 0, "electrodes_n"].tolist())
nan_ses = info[info.electrodes_xyz_nan > 0]
print("Sessions with NaN coordinates: channels", nan_ses.electrodes_n.to_dict(), "; NaN values over x, y and z",
nan_ses.electrodes_xyz_nan.to_dict(), "; x, y and z NaN on every channel:",
bool((nan_ses.electrodes_xyz_nan == 3 * nan_ses.electrodes_n).all()))
for c, unit in [("A", "uV (one-channel EAP amplitude, file says volts)"), ("TPW", "ms"), ("REP", "ms"),
("PL_below", "ms/mm"), ("PL_above", "ms/mm"), ("rate_session", "Hz"),
("rate_spont5", "Hz"), ("rate_dg", "Hz"), ("depth_csd", "um")]:
v = units[c].astype(float)
print(f"{c:13s} {unit:50s} range {np.nanmin(v):9.3f} to {np.nanmax(v):9.3f}, median {np.nanmedian(v):8.3f}, NaN {v.isna().sum()}")
print("\nWindow of 40 channels does not fit on the probe:", int((units.fits == False).sum()), "units")
print("Opto pulse counts (10 ms square):", info.loc[S["Pvalb"] + S["Sst"], "n_opto_pulses"].to_dict())
Sessions held, by group: {'wt': 13, 'Pvalb': 5, 'Sst': 6}
Paper's wild-type sessions not in this dandiset: [766640955, 767871931, 768515987, 771160300, 771990200, 774875821, 778240327, 778998620, 779839471, 781842082, 793224716, 847657808]
group genotype sex visp_units visp_good visp_noise_units n_dg dg_time dg_block_time spont_time n_flashes n_opto_pulses t_first t_last
session
732592105 wt wt/wt M 259 244 15 628 1257.117640 1882.622734 1234.347701 150 0 21.579074 9143.415844
739448407 wt wt/wt M 67 50 17 630 1261.059657 1888.594130 1234.481193 150 0 28.617890 9156.676490
744228101 wt wt/wt M 126 97 29 630 1261.054720 1888.578052 1234.297770 150 45 24.567300 9152.193170
750332458 wt wt/wt M 192 150 42 630 1261.053690 1888.577694 1234.297647 150 45 24.343718 9152.001828
750749662 wt wt/wt M 177 143 34 630 1261.053190 1888.577899 1234.297708 150 45 24.266019 9151.908429
754312389 wt wt/wt M 233 202 31 630 1261.053830 1888.577682 1234.297783 150 45 24.556641 9152.415139
754829445 wt wt/wt M 243 195 48 630 1261.053990 1888.577631 1234.297738 150 45 24.547600 9152.206060
757216464 wt wt/wt M 261 205 56 630 1261.054390 1888.578271 1234.297951 150 45 24.809045 9152.436465
757970808 wt wt/wt M 238 193 45 630 1261.053110 1888.578025 1234.298060 150 45 24.523631 9152.150001
759883607 wt wt/wt M 237 182 55 630 1261.070600 1888.594588 1234.297744 150 45 24.737569 9152.463399
761418226 wt wt/wt M 113 80 33 630 1261.053050 1888.578051 1264.322999 150 45 31.478835 9729.131700
763673393 wt wt/wt M 175 145 30 630 1261.053510 1888.577999 1264.323236 150 45 28.056915 9725.660740
799864342 wt wt/wt M 185 155 30 630 1261.055070 1888.612067 1264.340313 150 75 29.005689 9726.645245
721123822 Pvalb Pvalb-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt M 133 110 23 628 1257.050040 1882.572108 1234.297280 150 45 26.219072 9147.869242
746083955 Pvalb Pvalb-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt F 72 50 22 630 1261.053530 1888.577499 1234.297775 150 45 34.786554 9162.410584
760345702 Pvalb Pvalb-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt M 200 155 45 630 1261.054400 1888.578074 1234.297967 150 45 24.752216 9152.378596
773418906 Pvalb Pvalb-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt F 178 135 43 630 1261.053960 1888.611769 1234.298046 150 45 29.468890 9157.163520
797828357 Pvalb Pvalb-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt M 239 190 49 630 1261.070810 1888.595425 1264.323316 150 75 29.229048 9726.918315
715093703 Sst Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt M 160 135 25 628 1257.034490 1882.572634 1234.297860 150 45 13.470683 9135.140323
719161530 Sst Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt M 134 112 22 628 1257.050620 1882.572147 1234.297281 150 45 29.830107 9151.497467
756029989 Sst Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt M 167 140 27 630 1261.054260 1888.578739 1234.315163 150 45 24.429348 9152.076028
758798717 Sst Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt M 184 147 37 630 1261.053980 1888.578236 1234.298086 150 45 24.569509 9152.213369
760693773 Sst Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt F 217 181 36 630 1261.054130 1888.577845 1234.297812 150 45 18.769564 9146.395044
762602078 Sst Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt M 219 164 55 630 1261.053620 1888.577915 1264.323045 150 45 30.327369 9727.980945
Sex by group: {('Pvalb', 'F'): 2, ('Pvalb', 'M'): 3, ('Sst', 'F'): 1, ('Sst', 'M'): 5, ('wt', 'M'): 13}
Units (VISp, any quality), all sessions: 4409 ; of quality good: 3560
Electrodes tables: CCF x, y, z NaN in 6 of 24 sessions; sessions with coordinates: [744228101, 750749662, 754312389, 754829445, 757216464, 757970808, 759883607, 761418226, 763673393, 799864342, 721123822, 760345702, 773418906, 797828357, 719161530, 756029989, 758798717, 762602078] ; channels with y equal to z there: [2304, 2304, 2304, 1920, 2304, 1920, 1536, 2304, 2304, 2304, 2304, 1920, 2304, 2304, 2304, 2304, 1536, 2304] of [2304, 2304, 2304, 1920, 2304, 1920, 1536, 2304, 2304, 2304, 2304, 1920, 2304, 2304, 2304, 2304, 1536, 2304]
Sessions with NaN coordinates: channels {732592105: 1920, 739448407: 2304, 750332458: 2304, 746083955: 2304, 715093703: 2304, 760693773: 2304} ; NaN values over x, y and z {732592105: 5760, 739448407: 6912, 750332458: 5760, 746083955: 5760, 715093703: 1152, 760693773: 6912} ; x, y and z NaN on every channel: False
A uV (one-channel EAP amplitude, file says volts) range 1.226 to 588.660, median 55.596, NaN 0
TPW ms range 0.118 to 1.837, median 0.568, NaN 0
REP ms range 0.000 to 0.920, median 0.298, NaN 0
PL_below ms/mm range -53.823 to 44.649, median 0.231, NaN 1
PL_above ms/mm range -56.017 to 103.852, median 1.684, NaN 56
rate_session Hz range 0.000 to 79.838, median 2.513, NaN 0
rate_spont5 Hz range 0.000 to 65.535, median 0.588, NaN 0
rate_dg Hz range 0.000 to 59.679, median 1.822, NaN 0
depth_csd um range -1000.000 to 660.000, median -100.000, NaN 0
Window of 40 channels does not fit on the probe: 0 units
Opto pulse counts (10 ms square): {721123822: 45, 746083955: 45, 760345702: 45, 773418906: 45, 797828357: 75, 715093703: 45, 719161530: 45, 756029989: 45, 758798717: 45, 760693773: 45, 762602078: 45}
# Checks of the description against the data.
# (1) Waveform scale: amplitudes are tens to hundreds, so the waveforms are in microvolts.
# (2) The code's per-unit firing rate column fr (unit tables of the code) against the units
# table's firing_rate, and fr_5min against the rate in the first 5-min gray screen.
j = units.join(unitinfo[["fr", "fr_5min", "depth", "good"]], how="inner")
print("code unit-table rows matched to VISp good units here:", len(j), "of", len(unitinfo))
print("max |firing_rate - code fr|:", float(np.max(np.abs(j.firing_rate - j.fr))))
for c in ["rate_spont5", "rate_spont", "rate_first5min", "rate_session"]:
print(f"median |{c} - code fr_5min| = {np.median(np.abs(j[c] - j.fr_5min)):.4f} Hz")
# (3) Stimulus clock: spikes of VISp units respond to the flashes and gratings at their onsets
# (rate 30-80 ms after onset against 30 ms before, pooled over units), and the contrast
# vanishes when the onsets are shifted by half a trial.
def onset_contrast(session, table, shift=0.0):
f = W.open_nwb(W.session_paths()[session])
tab = W._table(f["intervals"], table)
on = tab.start_time.values + shift
u = units[units.session == session]
sp = W.read_spikes(f, u.row.values)
post = sum(W.count_within(np.sort(x), on + 0.03, on + 0.08) for x in sp.values())
pre = sum(W.count_within(np.sort(x), on - 0.03, on) for x in sp.values())
f.close()
return (post / 0.05) / max(pre / 0.03, 1e-9)
for s in [S["wt"][0], S["Pvalb"][0], S["Sst"][0]]:
print(s, "flash onset ratio post/pre: true %.2f, shifted 0.125 s %.2f" % (
onset_contrast(s, "flashes_presentations"), onset_contrast(s, "flashes_presentations", 0.125)))
code unit-table rows matched to VISp good units here: 618 of 618 max |firing_rate - code fr|: 0.0 median |rate_spont5 - code fr_5min| = 0.0000 Hz median |rate_spont - code fr_5min| = 1.1045 Hz median |rate_first5min - code fr_5min| = 1.2155 Hz median |rate_session - code fr_5min| = 1.8765 Hz
732592105 flash onset ratio post/pre: true 1.50, shifted 0.125 s 0.61
721123822 flash onset ratio post/pre: true 1.49, shifted 0.125 s 1.18
715093703 flash onset ratio post/pre: true 1.60, shifted 0.125 s 0.85
source-data-units-link¶
The 1204 unit ids of the paper's Source Data, with their one- and multi-channel cluster labels, are units of the dataset's wild-type V1 recordings.
Each unit id of Source Data sheet Fig2d is looked up among the units of the sessions held. Unit ids are unique across the Allen sessions, so a unit found in a session's table belongs to that session. Ids not among the VISp units of quality "good" are looked up in the full units tables of the held sessions, to say where they are.
held = set(S["wt"])
sd_counts = sd_sessions.set_index("session").units
print("Source Data units in the 13 held sessions (sheet Fig 1d):", int(sd_counts.loc[S["wt"]].sum()),
"; in the 12 missing sessions:", int(sd_counts.drop(S["wt"]).sum()))
wt_units = units[units.group == "wt"]
found = sd_fig2d.index.intersection(wt_units.index)
per = wt_units.loc[found].groupby("session").size().reindex(S["wt"]).fillna(0).astype(int)
cmp = pd.DataFrame({"source_data": sd_counts.loc[S["wt"]], "found_visp_good": per})
print(cmp.to_string())
print("found:", len(found), "of", int(sd_counts.loc[S["wt"]].sum()))
# ids not found among VISp good units: where are they?
rest = sd_fig2d.index.difference(found)
# every session file of the dandiset, not only the 13 wild-type sessions held
all_paths = W.session_paths()
missing = [s for s in W.PAPER_WT_SESSIONS if s not in S["wt"]]
print("session files in the dandiset:", len(all_paths), "; of the 12 missing session ids among them:",
[s for s in missing if s in all_paths])
elsewhere = {}
for s, path in sorted(all_paths.items()):
f = W.open_nwb(path)
ids = f["units/id"][:]
hit = np.isin(rest, ids)
if hit.any():
elsewhere[s] = int(hit.sum())
f.close()
print("Source Data ids found outside the VISp good units of the 13 sessions, in any of the", len(all_paths),
"session files:", elsewhere)
print("Source Data ids in no session file of the dandiset:", len(rest) - sum(elsewhere.values()),
"(sheet Fig 1d puts", int(sd_counts.drop(S["wt"]).sum()), "units in the missing sessions)")
# do the matched units agree on what both describe? features of the Source Data and here
m = wt_units.loc[found]
for a, b in [("TPW", "TPW"), ("REP", "REP"), ("PL_below", "inv_below"), ("PL_above", "inv_above")]:
d = np.abs(m[a].astype(float) - sd_fig2d.loc[found, b].astype(float))
print(f"{a:9s} |here - Source Data|: equal (<1e-6) for {np.mean(d < 1e-6):.1%}, within 5% of the "
f"Source Data range for {np.mean(d < 0.05 * np.ptp(sd_fig2d[b].astype(float))):.1%}, median {np.nanmedian(d):.2e}")
# where the features differ: per session and feature, the share of matched units equal to the Source Data
eq = pd.DataFrame({a: np.abs(m[a].astype(float) - sd_fig2d.loc[found, b].astype(float)) < 1e-6
for a, b in [("TPW", "TPW"), ("REP", "REP"), ("PL_below", "inv_below"), ("PL_above", "inv_above")]})
eq["session"] = m.session.values
print("share of matched units whose feature equals the Source Data, by session (%):")
print((100 * eq.groupby("session").mean()).round(1).assign(units=eq.groupby("session").size()).to_string())
both = eq.TPW & eq.REP
print("units with TPW and REP equal:", int(both.sum()), "; with TPW or REP different:", int((~both).sum()),
"; of those, 1/V below also different:", int((~both & ~eq.PL_below).sum()))
dtp = (m.TPW.astype(float) - sd_fig2d.loc[found, "TPW"].astype(float))[~both.values]
print("TPW here minus Source Data where they differ: median %.3f ms, IQR %.3f to %.3f ms" % (
dtp.median(), dtp.quantile(0.25), dtp.quantile(0.75)))
print("matched units passing isolation reading (a):", int(m.iso_a.sum()), "of", len(m))
print("code unit tables (good flag) against reading (a), units of the held sessions:")
print(pd.crosstab(units.loc[unitinfo.index, "iso_a"], unitinfo.good, rownames=["reading (a)"], colnames=["code good"]))
# which reading (a) units are not in the code's tables? spikes in the first 5-min gray screen
a_ = wt_units[wt_units.iso_a].assign(in_code=lambda d: d.index.isin(unitinfo.index))
print("reading (a) units in the code's tables against at least 100 spikes in the first 5-min gray screen:")
print(pd.crosstab(a_.in_code, a_.n_spont5 >= 100, rownames=["in code tables"], colnames=[">= 100 spikes"]))
print("medians by membership:", a_.groupby("in_code")[["n_spont5", "rate_spont5", "firing_rate", "snr", "isi_violations"]]
.median().round(3).to_dict("index"))
print("code tables: fr_5min minimum %.3f Hz; first 5-min gray screen lasts %.0f to %.0f s" % (
unitinfo.fr_5min.min(), min(R[s]["info"]["spont5"][1] - R[s]["info"]["spont5"][0] for s in S["wt"]),
max(R[s]["info"]["spont5"][1] - R[s]["info"]["spont5"][0] for s in S["wt"])))
print("Source Data units with fewer than 100 spikes there:", int((m.n_spont5 < 100).sum()), "of", len(m),
"; reading (b) units of quality noise among the wild-type units:", int((wt_units.quality != "good").sum()))
Source Data units in the 13 held sessions (sheet Fig 1d): 566 ; in the 12 missing sessions: 638
source_data found_visp_good
session
732592105 69 69
739448407 16 16
744228101 26 26
750332458 38 38
750749662 34 34
754312389 71 71
754829445 48 48
757216464 53 53
757970808 42 42
759883607 34 34
761418226 28 28
763673393 58 58
799864342 49 49
found: 566 of 566
session files in the dandiset: 32 ; of the 12 missing session ids among them: []
Source Data ids found outside the VISp good units of the 13 sessions, in any of the 32 session files: {}
Source Data ids in no session file of the dandiset: 638 (sheet Fig 1d puts 638 units in the missing sessions)
TPW |here - Source Data|: equal (<1e-6) for 85.0%, within 5% of the Source Data range for 96.8%, median 2.78e-16
REP |here - Source Data|: equal (<1e-6) for 85.0%, within 5% of the Source Data range for 90.6%, median 2.78e-16
PL_below |here - Source Data|: equal (<1e-6) for 71.7%, within 5% of the Source Data range for 87.6%, median 8.88e-16
PL_above |here - Source Data|: equal (<1e-6) for 68.0%, within 5% of the Source Data range for 81.4%, median 3.11e-15
share of matched units whose feature equals the Source Data, by session (%):
TPW REP PL_below PL_above units
session
732592105 95.7 95.7 81.2 78.3 69
739448407 87.5 87.5 75.0 81.2 16
744228101 88.5 88.5 65.4 80.8 26
750332458 86.8 86.8 71.1 63.2 38
750749662 73.5 73.5 47.1 64.7 34
754312389 84.5 84.5 78.9 74.6 71
754829445 81.2 81.2 72.9 64.6 48
757216464 84.9 84.9 79.2 67.9 53
757970808 83.3 83.3 64.3 61.9 42
759883607 70.6 70.6 58.8 55.9 34
761418226 92.9 92.9 89.3 60.7 28
763673393 86.2 86.2 70.7 70.7 58
799864342 83.7 83.7 65.3 57.1 49
units with TPW and REP equal: 481 ; with TPW or REP different: 85 ; of those, 1/V below also different: 85
TPW here minus Source Data where they differ: median 0.004 ms, IQR -0.017 to 0.024 ms
matched units passing isolation reading (a): 566 of 566
code unit tables (good flag) against reading (a), units of the held sessions:
code good 1.0
reading (a)
False 15
True 603
reading (a) units in the code's tables against at least 100 spikes in the first 5-min gray screen:
>= 100 spikes False True
in code tables
False 270 27
True 0 603
medians by membership: {False: {'n_spont5': 31.0, 'rate_spont5': 0.107, 'firing_rate': 1.158, 'snr': 2.908, 'isi_violations': 0.066}, True: {'n_spont5': 834.0, 'rate_spont5': 2.886, 'firing_rate': 5.13, 'snr': 2.586, 'isi_violations': 0.038}}
code tables: fr_5min minimum 0.353 Hz; first 5-min gray screen lasts 289 to 289 s
Source Data units with fewer than 100 spikes there: 0 of 566 ; reading (b) units of quality noise among the wild-type units: 465
Result: partially reproduced. The dandiset holds 13 of the 25 sessions; all 566 Source Data units of those sessions are VISp units of quality good there, with the per-session counts of sheet Fig 1d, and none of the 638 units of the other 12 sessions is in any of the dandiset's 32 session files, which do not include those sessions. On the matched units TPW and REP are equal to the Source Data values for 85.0% of units and 1/V below and above for 71.7% and 68.0%. The 85 units whose TPW or REP differ also differ in 1/V below, and the per-session table shows where they lie; where they differ, TPW differs by a median of 0.004 ms (IQR -0.017 to 0.024 ms), so the waveforms are close but not identical. Every one of the 566 units has at least 100 spikes in the first 5-min gray screen, and 270 of the 297 reading (a) units outside the code's tables have fewer. The other claims are judged on the 13 sessions.
fig1d-unit-count¶
The analysis rests on 1204 well-isolated V1 units from 25 wild-type mice, an average of 48 units per mouse.
The dandiset holds 13 of the 25 sessions, so the total of 1204 cannot be reached; following the link claim, the counts are judged on the held subset, where the Source Data put 566 units (43.5 per mouse), and the mean per mouse is compared with 48. Readings (a) the AllenSDK default filter on units of quality "good" and (b) every VISp unit the units table lists (quality "good" or "noise"), each followed by the code's exclusions. A third reading, (c), is not one the criterion names: reading (a) with at least 100 spikes in the first 5-min gray screen. It is taken from the Results ("well-isolated ... during spontaneous activity", paragraph 1 of "EAP recordings from in vivo experiments") and the Methods' 100-spike rule ("Single unit firing properties"), and from the data check above: every unit of the code's tables has at least 100 spikes there, while 270 of the 297 reading (a) units outside them have fewer. A variant starts from the code's own unit tables (their good flag), which the paper's code prepared from the NWB files.
sel = {r: W.select_wt(units, r) for r in "abc"}
rows = []
for r in "abc":
w = sel[r]
n_iso = int((units.group.eq("wt") & units[f"iso_{r}"]).sum())
per = w.groupby("session").size().reindex(S["wt"]).fillna(0)
rows.append({"reading": r, "isolated": n_iso, "after exclusions": len(w), "sessions": len(S["wt"]),
"mean per mouse": per.mean(), "min": per.min(), "max": per.max()})
# variant: the code's unit tables
v = units[(units.group == "wt") & units.index.isin(unitinfo.index[unitinfo.good == 1]) & ~units.bad_list]
v = v[W.code_exclusions(v).values]
per_v = v.groupby("session").size().reindex(S["wt"]).fillna(0)
rows.append({"reading": "code tables", "isolated": int((unitinfo.good == 1).sum()), "after exclusions": len(v),
"sessions": len(S["wt"]), "mean per mouse": per_v.mean(), "min": per_v.min(), "max": per_v.max()})
lit = {r: W.select_wt(units, r, nan_aware=False) for r in "abc"}
for r in "abc":
rows.append({"reading": f"{r}, code's exclusion literally", "isolated": np.nan, "after exclusions": len(lit[r]),
"sessions": 13, "mean per mouse": len(lit[r]) / 13, "min": np.nan, "max": np.nan})
print(pd.DataFrame(rows).to_string(index=False))
print("NaN in the features of reading (a) before exclusions:",
units[(units.group == "wt") & units.iso_a][["PL_above", "W_above", "PL_below", "W_below"]].isna().sum().to_dict())
print("Source Data, same 13 sessions: 566 units, mean per mouse", round(566 / 13, 1),
"; expected 48 +- 4.8 per mouse")
print("\nper session:")
print(pd.DataFrame({"a": sel["a"].groupby("session").size(), "b": sel["b"].groupby("session").size(),
"c": sel["c"].groupby("session").size(),
"code tables": per_v, "Source Data": sd_counts.loc[S["wt"]]}).to_string())
for r in "abc":
print(f"reading ({r}): {len(sel[r].index.intersection(sd_fig2d.index))} of the 566 Source Data units kept, "
f"{len(sel[r].index.difference(sd_fig2d.index))} units the Source Data do not hold")
print("\noverlap of the code-table variant with the Source Data units:",
len(v.index.intersection(sd_fig2d.index)), "of", len(v), "here and", 566, "there")
reading isolated after exclusions sessions mean per mouse min max
a 900.0 741 13 57.000000 16.0 94.0
b 2484.0 1820 13 140.000000 48.0 198.0
c 630.0 516 13 39.692308 14.0 66.0
code tables 618.0 494 13 38.000000 14.0 66.0
a, code's exclusion literally NaN 752 13 57.846154 NaN NaN
b, code's exclusion literally NaN 1845 13 141.923077 NaN NaN
c, code's exclusion literally NaN 524 13 40.307692 NaN NaN
NaN in the features of reading (a) before exclusions: {'PL_above': 14, 'W_above': 8, 'PL_below': 0, 'W_below': 0}
Source Data, same 13 sessions: 566 units, mean per mouse 43.5 ; expected 48 +- 4.8 per mouse
per session:
a b c code tables Source Data
session
732592105 94 198 66 66 69
739448407 16 48 14 14 16
744228101 33 88 26 26 26
750332458 52 147 32 32 38
750749662 45 116 26 26 34
754312389 92 190 61 60 71
754829445 70 169 56 39 48
757216464 67 191 49 48 53
757970808 69 180 34 34 42
759883607 44 151 26 24 34
761418226 30 80 25 25 28
763673393 65 128 55 55 58
799864342 64 134 46 45 49
reading (a): 493 of the 566 Source Data units kept, 248 units the Source Data do not hold
reading (b): 497 of the 566 Source Data units kept, 1323 units the Source Data do not hold
reading (c): 487 of the 566 Source Data units kept, 29 units the Source Data do not hold
overlap of the code-table variant with the Source Data units: 487 of 494 here and 566 there
Result: not reproduced. On the 13 held sessions, reading (a) gives 741 units after the code's exclusions, 57.0 per mouse, and reading (b) 1820, 140.0 per mouse, against 48 +- 4.8; the Source Data put 566 units (43.5 per mouse) in the same sessions. Reading (c), not a reading of the criterion, gives 516 units, 39.7 per mouse, and keeps 487 of the 566 Source Data units with 29 others, where reading (a) keeps 493 with 248 others. Starting from the code's own unit tables gives 494 units, 38.0 per mouse. The total of 1204 cannot be reached with 13 of 25 sessions.
fig2-one-channel-two-clusters¶
K-means clustering of the one-channel features TPW and REP gives two clusters as the optimum by both the elbow method and the density function, a narrow-waveform cluster with short REP and a wide-waveform cluster with long REP.
The code's procedure (NP_EAP_FeatureAnalysis.ipynb cells 11 to 13): median imputation, z-score, K-means with k-means++ and 1000 initialisations for K = 1 to 9, the elbow by ecp_func.findElbow and the minimum of f(K). The random state of K-means is the claim's seed (the code uses 10 and 11400); the four other seeds are shown. Run on both isolation readings.
SEED_C1 = seed_of("fig2-one-channel-two-clusters")
one = {}
for r in "cab":
w = sel[r]
one[r] = W.cluster_one_channel(w, SEED_C1)
res = one[r]
fsm = res["fsrs"] == "FS"
print(f"reading ({r}), {len(w)} units: elbow K = {res['elbow_k']}, f(K) minimum at K = {res['fk_k']}")
print(" WCSS/S1:", np.round(res["wcss"] / res["wcss"][0], 3))
print(" f(K): ", np.round(res["fk"], 3))
print(f" FS (lower TPW) median TPW {w.TPW[fsm].median():.3f} ms, REP {w.REP[fsm].median():.3f} ms; "
f"RS median TPW {w.TPW[~fsm].median():.3f} ms, REP {w.REP[~fsm].median():.3f} ms")
seeds5 = [SEED_C1 + k * 1000 for k in range(5)]
for r in "cab":
ks = []
for s_ in seeds5[1:]:
if r == "c":
Xs = W.pre_process(sel[r][["TPW", "REP"]].values)
wc, fk = W.selection_k(Xs, 9, seed=s_)
ks.append((W.find_elbow(wc), int(fk.argmin() + 1)))
if ks:
print(f"reading ({r}), (elbow K, f(K) K) under seeds +1000..+4000:", ks)
reading (c), 516 units: elbow K = 2, f(K) minimum at K = 2 WCSS/S1: [1. 0.45 0.29 0.228 0.167 0.141 0.123 0.108 0.099] f(K): [1. 0.72 0.938 1.061 0.938 1.025 1.029 1.011 1.016] FS (lower TPW) median TPW 0.258 ms, REP 0.250 ms; RS median TPW 0.585 ms, REP 0.303 ms
reading (a), 741 units: elbow K = 2, f(K) minimum at K = 2 WCSS/S1: [1. 0.477 0.297 0.229 0.176 0.149 0.127 0.113 0.103] f(K): [1. 0.763 0.906 1.041 0.985 1.029 1.008 1.013 1.024] FS (lower TPW) median TPW 0.261 ms, REP 0.251 ms; RS median TPW 0.594 ms, REP 0.302 ms
reading (b), 1820 units: elbow K = 2, f(K) minimum at K = 2 WCSS/S1: [1. 0.482 0.312 0.254 0.199 0.17 0.148 0.13 0.118] f(K): [1. 0.771 0.943 1.101 0.999 1.044 1.022 1.009 1.017] FS (lower TPW) median TPW 0.265 ms, REP 0.236 ms; RS median TPW 0.589 ms, REP 0.311 ms
reading (c), (elbow K, f(K) K) under seeds +1000..+4000: [(2, 2), (2, 2), (2, 2), (2, 2)]
Result: reproduced. Under all three readings the elbow and the minimum of f(K) select K = 2 (also under the four other seeds, reading c), and the cluster of lower median TPW (0.258 ms, reading c) also has the lower median REP (0.250 against 0.303 ms). The Source Data features of the 1204 units give K = 2 by both methods as well.
fig2-fs-rs-counts¶
Of the 1204 units, 281 (23.3%) fall in the narrow-waveform (FS) cluster and 923 (76.7%) in the wide-waveform (RS) cluster.
The unit set differs from the paper's (13 of 25 sessions), so the fraction is the measure (criterion). Agreement with the Source Data labels on the shared units is shown.
from sklearn.cluster import KMeans
for r in "cab":
w = sel[r]
lab = pd.Series(one[r]["fsrs"], index=w.index)
n_fs, n_rs = int((lab == "FS").sum()), int((lab == "RS").sum())
shared = lab.index.intersection(sd_fig2d.index)
agree = np.mean(lab.loc[shared].values == sd_fig2d.loc[shared, "onech"].values)
print(f"reading ({r}): FS {n_fs}, RS {n_rs}, FS fraction {100 * n_fs / len(w):.1f}% "
f"(expected 23.3 +- 2.33); shared with Source Data {len(shared)}, labels agree {agree:.1%}")
print(" per session FS fraction:", (lab.eq("FS").groupby(w.session).mean() * 100).round(1).to_dict())
X = W.pre_process(w[["TPW", "REP"]].values)
fr = []
for s_ in seeds5:
l = KMeans(2, init="k-means++", n_init=1000, random_state=s_).fit(X).labels_
fsl = 0 if np.median(w.TPW.values[l == 0]) < np.median(w.TPW.values[l == 1]) else 1
fr.append(round(100 * np.mean(l == fsl), 2))
print(" FS fraction under the five seeds:", fr)
sdl = sd_fig2d.loc[sd_fig2d.index.intersection(units.index)]
print("Source Data labels on the 566 held units: FS", int((sdl.onech == "FS").sum()),
f"({100 * (sdl.onech == 'FS').mean():.1f}%)")
reading (c): FS 131, RS 385, FS fraction 25.4% (expected 23.3 +- 2.33); shared with Source Data 487, labels agree 99.4%
per session FS fraction: {732592105: 18.2, 739448407: 28.6, 744228101: 46.2, 750332458: 28.1, 750749662: 30.8, 754312389: 14.8, 754829445: 26.8, 757216464: 38.8, 757970808: 20.6, 759883607: 30.8, 761418226: 28.0, 763673393: 23.6, 799864342: 17.4}
FS fraction under the five seeds: [np.float64(25.39), np.float64(25.39), np.float64(25.39), np.float64(25.39), np.float64(25.39)]
reading (a): FS 154, RS 587, FS fraction 20.8% (expected 23.3 +- 2.33); shared with Source Data 493, labels agree 98.4%
per session FS fraction: {732592105: 13.8, 739448407: 31.2, 744228101: 39.4, 750332458: 21.2, 750749662: 28.9, 754312389: 9.8, 754829445: 22.9, 757216464: 28.4, 757970808: 18.8, 759883607: 22.7, 761418226: 23.3, 763673393: 21.5, 799864342: 17.2}
FS fraction under the five seeds: [np.float64(20.78), np.float64(20.78), np.float64(20.78), np.float64(20.78), np.float64(20.78)]
reading (b): FS 373, RS 1447, FS fraction 20.5% (expected 23.3 +- 2.33); shared with Source Data 497, labels agree 98.6%
per session FS fraction: {732592105: 15.2, 739448407: 25.0, 744228101: 33.0, 750332458: 23.1, 750749662: 25.0, 754312389: 13.7, 754829445: 20.7, 757216464: 26.7, 757970808: 19.4, 759883607: 17.2, 761418226: 20.0, 763673393: 21.9, 799864342: 16.4}
FS fraction under the five seeds: [np.float64(20.49), np.float64(20.49), np.float64(20.49), np.float64(20.49), np.float64(20.49)] Source Data labels on the 566 held units: FS 136 (24.0%)
Result: reproduced, resting on an assumption. Under reading (c) the FS fraction is 25.4% (131 of 516), within 23.3 +- 2.33%, under all five seeds; the FS/RS labels agree with the Source Data on 99.4% of shared units. Readings (a) and (b) give 20.8% (154 of 741) and 20.5% (373 of 1820), below the tolerance, and the Source Data labels of the 566 held units give 24.0%. The fraction depends on the unit set: the low-firing units of reading (a) that the code's tables leave out lower it.
figs3b-fs-faster¶
FS units fire faster than RS units, at a median of 4.85 Hz (IQR 1.93 to 10.79 Hz) against 2.05 Hz (IQR 0.84 to 5.00 Hz).
Rate as N / T. Readings of the period (criterion): (a) the spontaneous (gray screen) block, shown as (a1) the first 5-min gray-screen block, which reproduces the code's column fr_5min exactly (data check above), and (a2) all gray-screen intervals of 30 s or more; (b) the first 5 minutes of the recording (from the first stimulus presentation); (c) the whole session.
def q(v):
return f"{np.median(v):.2f} (IQR {np.percentile(v, 25):.2f} to {np.percentile(v, 75):.2f})"
for r in "cab":
w = sel[r]
lab = one[r]["fsrs"]
for col, name in [("rate_spont5", "a1 first 5-min gray screen"), ("rate_spont", "a2 all gray screen"),
("rate_first5min", "b first 5 min"), ("rate_session", "c whole session")]:
fs_, rs_ = w[col][lab == "FS"], w[col][lab == "RS"]
p = stats.mannwhitneyu(fs_, rs_, alternative="two-sided").pvalue
print(f"({r}) {name:28s} FS {q(fs_)} Hz, RS {q(rs_)} Hz, Mann-Whitney p = {p:.2e}")
sdl = sd_fig2d.loc[sd_fig2d.index.intersection(units.index)]
uu = units.loc[sdl.index]
fs_, rs_ = uu.rate_spont5[sdl.onech == "FS"], uu.rate_spont5[sdl.onech == "RS"]
print(f"variant, Source Data units and labels (566), a1: FS {q(fs_)}, RS {q(rs_)}, "
f"p = {stats.mannwhitneyu(fs_, rs_, alternative='two-sided').pvalue:.2e}")
(c) a1 first 5-min gray screen FS 4.26 (IQR 1.42 to 10.28) Hz, RS 2.29 (IQR 0.85 to 5.81) Hz, Mann-Whitney p = 1.31e-05 (c) a2 all gray screen FS 6.45 (IQR 3.29 to 12.90) Hz, RS 3.11 (IQR 1.29 to 6.77) Hz, Mann-Whitney p = 6.17e-11 (c) b first 5 min FS 4.50 (IQR 1.82 to 9.41) Hz, RS 2.38 (IQR 0.77 to 6.40) Hz, Mann-Whitney p = 4.05e-06 (c) c whole session FS 9.95 (IQR 6.34 to 16.13) Hz, RS 3.66 (IQR 2.05 to 7.66) Hz, Mann-Whitney p = 2.37e-24 (a) a1 first 5-min gray screen FS 3.60 (IQR 0.84 to 8.70) Hz, RS 0.81 (IQR 0.18 to 3.58) Hz, Mann-Whitney p = 7.75e-13 (a) a2 all gray screen FS 5.04 (IQR 2.70 to 10.56) Hz, RS 1.40 (IQR 0.46 to 4.95) Hz, Mann-Whitney p = 5.48e-22 (a) b first 5 min FS 3.84 (IQR 1.16 to 7.50) Hz, RS 0.99 (IQR 0.21 to 3.94) Hz, Mann-Whitney p = 4.31e-12 (a) c whole session FS 9.11 (IQR 5.37 to 14.70) Hz, RS 2.35 (IQR 1.09 to 5.47) Hz, Mann-Whitney p = 5.55e-38 (b) a1 first 5-min gray screen FS 1.71 (IQR 0.43 to 4.88) Hz, RS 0.55 (IQR 0.09 to 2.23) Hz, Mann-Whitney p = 1.70e-17 (b) a2 all gray screen FS 3.67 (IQR 1.87 to 6.85) Hz, RS 1.07 (IQR 0.31 to 2.99) Hz, Mann-Whitney p = 3.30e-45 (b) b first 5 min FS 1.75 (IQR 0.49 to 4.97) Hz, RS 0.71 (IQR 0.11 to 2.73) Hz, Mann-Whitney p = 3.68e-13 (b) c whole session FS 5.36 (IQR 3.47 to 9.49) Hz, RS 2.07 (IQR 0.89 to 3.85) Hz, Mann-Whitney p = 2.28e-64 variant, Source Data units and labels (566), a1: FS 4.55 (IQR 1.42 to 12.55), RS 2.50 (IQR 0.89 to 6.10), p = 5.11e-06
Result: not reproduced (the criterion defines only a reproduced outcome and no reading meets it; changed from partially reproduced after round 3 of verification, which agreed). FS units fire faster than RS units under every period and isolation reading (Mann-Whitney p from 1.3e-05 to 2.3e-64), but no reading puts both medians within tolerance. Under reading (c) the first 5-min gray screen (the period of the code's fr_5min column) gives FS 4.26 and RS 2.29 Hz, the first 5 minutes FS 4.50 (within tolerance) and RS 2.38 Hz, against 4.85 and 2.05 Hz. On the Source Data units and labels the gray-screen block gives 4.55 and 2.50 Hz.
fig2-rs-more-asymmetric¶
RS units have more asymmetric EAP propagation below against above the soma than FS units.
Symmetry index (Methods eq. 1) per unit; the paper's two-sample procedure (ecp_func.two_sample_test).
for r in "cab":
w = sel[r]
lab = one[r]["fsrs"]
si = W.symmetry_index(w.PL_below, w.PL_above)
test, p = W.two_sample_test(si[lab == "RS"], si[lab == "FS"])
print(f"({r}) symmetry index median RS {np.nanmedian(si[lab == 'RS']):.3f}, FS {np.nanmedian(si[lab == 'FS']):.3f}; "
f"{test} p = {p:.2e}; NaN {int(np.isnan(si).sum())} units")
(c) symmetry index median RS 1.599, FS 0.784; Mann-Whitney U p = 2.26e-21; NaN 11 units (a) symmetry index median RS 1.645, FS 0.845; Mann-Whitney U p = 3.57e-26; NaN 14 units (b) symmetry index median RS 1.725, FS 0.842; Mann-Whitney U p = 2.63e-53; NaN 23 units
Result: reproduced. The median symmetry index is 1.599 for RS and 0.784 for FS (reading c; Mann-Whitney p = 2.3e-21), and RS is higher under readings (a) and (b) as well (p = 3.6e-26 and 2.6e-53).
fig2d-three-subclusters-each¶
Clustering FS and RS separately on the multi-channel features 1/V below and 1/V above gives three clusters in each, FS1 to FS3 (130, 82 and 69 units) and RS1 to RS3 (479, 235 and 209 units).
As the code (cells 17 to 21): 1/V below and above median-imputed and z-scored over all units, K-means within FS and within RS with K = argmin f(K) + 1; the elbow is also reported. Clusters are named by their greatest overlap with the Source Data labels on shared units. As the unit set differs, the counts are also given as fractions of FS and RS (the paper's 46.3, 29.2 and 24.6% of FS; 51.9, 25.5 and 22.6% of RS).
SEED_C6 = seed_of("fig2d-three-subclusters-each")
multi, six = {}, {}
for r in "cab":
w = sel[r]
multi[r] = W.cluster_multi_channel(w, one[r]["fsrs"], SEED_C6)
lab6 = pd.Series("", index=w.index)
for grp in ("FS", "RS"):
m = multi[r][grp]
names, tab = W.name_by_overlap(m["index"], m["labels"], sd_fig2d.cluster, [f"{grp}{i}" for i in (1, 2, 3, 4, 5, 6, 7, 8, 9)])
lab6.loc[m["index"]] = names
print(f"({r}) {grp}: f(K) minimum at K = {m['fk_k']}, elbow K = {m['elbow_k']}; f(K) = {np.round(m['fk'], 3)}")
print(" overlap with Source Data labels (rows: clusters here):")
print(" " + tab.to_string().replace("\n", "\n "))
six[r] = lab6
cnt = lab6.value_counts().sort_index()
print(f"({r}) counts:", cnt.to_dict())
print(f"({r}) fractions within FS and RS (%):",
{k: round(100 * v / (lab6.str[:2] == k[:2]).sum(), 1) for k, v in cnt.items()})
shared = lab6.index.intersection(sd_fig2d.index)
print(f"({r}) six-cluster labels agree with the Source Data on {np.mean(lab6.loc[shared] == sd_fig2d.loc[shared, 'cluster']):.1%} of {len(shared)} shared units")
# seeds: K-means at the chosen K under the five seeds, reading (c)
w = sel["c"]
X = W.pre_process(w[["PL_below", "PL_above"]].values)
for grp in ("FS", "RS"):
m = one["c"]["fsrs"] == grp
sizes = []
for s_ in [SEED_C6 + k * 1000 for k in range(5)]:
l = KMeans(multi["c"][grp]["k"], init="k-means++", n_init=1000, random_state=s_).fit(X[m]).labels_
sizes.append(sorted(np.bincount(l).tolist(), reverse=True))
print(f"(c) {grp} cluster sizes under the five seeds:", sizes)
# the code's exclusion run literally (NaN turns off the 3 SD exclusion of 1/V above)
for r in "ca":
wl = lit[r]
ol = W.cluster_one_channel(wl, SEED_C1)
ml = W.cluster_multi_channel(wl, ol["fsrs"], SEED_C6)
print(f"({r}) literal exclusions, {len(wl)} units: FS K = {ml['FS']['k']} sizes {sorted(np.bincount(ml['FS']['labels']).tolist(), reverse=True)}, "
f"RS K = {ml['RS']['k']} sizes {sorted(np.bincount(ml['RS']['labels']).tolist(), reverse=True)}")
# with K forced to 3 when f(K) picks another K
for r in "cab":
for grp in ("FS", "RS"):
if multi[r][grp]["k"] != 3:
m3 = W.cluster_multi_channel(sel[r], one[r]["fsrs"], SEED_C6, k_override=3)[grp]
names, _ = W.name_by_overlap(m3["index"], m3["labels"], sd_fig2d.cluster, [f"{grp}{i}" for i in (1, 2, 3)])
print(f"({r}) {grp} with K forced to 3 (variant):", pd.Series(names).value_counts().sort_index().to_dict())
(c) FS: f(K) minimum at K = 2, elbow K = 2; f(K) = [1. 0.891 0.991 1.065 1.055 1.014 0.963 0.985 0.991]
overlap with Source Data labels (rows: clusters here):
col_0 FS1 FS2 FS3
row_0
0 55 0 18
1 5 36 6
(c) RS: f(K) minimum at K = 3, elbow K = 3; f(K) = [1. 1.067 0.951 1.118 1.067 1.009 0.992 0.991 0.992]
overlap with Source Data labels (rows: clusters here):
col_0 RS1 RS2 RS3
row_0
0 10 71 2
1 25 13 69
2 162 8 4
(c) counts: {'FS1': 82, 'FS2': 49, 'RS1': 180, 'RS2': 95, 'RS3': 110}
(c) fractions within FS and RS (%): {'FS1': np.float64(62.6), 'FS2': np.float64(37.4), 'RS1': np.float64(46.8), 'RS2': np.float64(24.7), 'RS3': np.float64(28.6)}
(c) six-cluster labels agree with the Source Data on 80.7% of 487 shared units
(a) FS: f(K) minimum at K = 2, elbow K = 2; f(K) = [1. 0.903 1.019 1.043 1.039 1.043 0.992 0.972 0.973]
overlap with Source Data labels (rows: clusters here):
col_0 FS1 FS2 FS3
row_0
0 57 1 18
1 3 36 6
(a) RS: f(K) minimum at K = 3, elbow K = 3; f(K) = [1. 1.082 0.945 1.121 1.067 1.042 1.031 1.03 1.004]
overlap with Source Data labels (rows: clusters here):
col_0 RS1 RS2 RS3
row_0
0 22 12 66
1 9 72 2
2 166 9 6
(a) counts: {'FS1': 98, 'FS2': 56, 'RS1': 270, 'RS2': 160, 'RS3': 157}
(a) fractions within FS and RS (%): {'FS1': np.float64(63.6), 'FS2': np.float64(36.4), 'RS1': np.float64(46.0), 'RS2': np.float64(27.3), 'RS3': np.float64(26.7)}
(a) six-cluster labels agree with the Source Data on 80.5% of 493 shared units
(b) FS: f(K) minimum at K = 9, elbow K = 4; f(K) = [1. 1.054 1.022 1.036 1.094 1.044 1.005 0.991 0.963]
overlap with Source Data labels (rows: clusters here):
col_0 FS1 FS2 FS3
row_0
0 1 0 2
1 6 0 0
2 32 0 3
4 0 13 0
5 6 0 1
6 15 1 10
7 0 0 6
8 1 23 2
(b) RS: f(K) minimum at K = 1, elbow K = 3; f(K) = [1. 1.17 1.035 1.15 1.072 1.059 1.035 1.011 1.001]
overlap with Source Data labels (rows: clusters here):
col_0 RS1 RS2 RS3
row_0
0 199 93 76
(b) counts: {'FS1': 111, 'FS2': 57, 'FS3': 64, 'FS4': 22, 'FS5': 23, 'FS6': 1, 'FS7': 22, 'FS8': 56, 'FS9': 17, 'RS1': 1447}
(b) fractions within FS and RS (%): {'FS1': np.float64(29.8), 'FS2': np.float64(15.3), 'FS3': np.float64(17.2), 'FS4': np.float64(5.9), 'FS5': np.float64(6.2), 'FS6': np.float64(0.3), 'FS7': np.float64(5.9), 'FS8': np.float64(15.0), 'FS9': np.float64(4.6), 'RS1': np.float64(100.0)}
(b) six-cluster labels agree with the Source Data on 53.1% of 497 shared units
(c) FS cluster sizes under the five seeds: [[82, 49], [82, 49], [82, 49], [82, 49], [82, 49]]
(c) RS cluster sizes under the five seeds: [[180, 110, 95], [180, 110, 95], [180, 110, 95], [180, 110, 95], [180, 110, 95]]
(c) literal exclusions, 524 units: FS K = 2 sizes [85, 47], RS K = 3 sizes [240, 151, 1]
(a) literal exclusions, 752 units: FS K = 2 sizes [98, 56], RS K = 3 sizes [384, 213, 1]
(c) FS with K forced to 3 (variant): {'FS1': 59, 'FS2': 41, 'FS3': 31}
(a) FS with K forced to 3 (variant): {'FS1': 67, 'FS2': 50, 'FS3': 37}
(b) FS with K forced to 3 (variant): {'FS1': 167, 'FS2': 82, 'FS3': 124}
(b) RS with K forced to 3 (variant): {'RS1': 637, 'RS2': 414, 'RS3': 396}
# The paper's own features: the 1204 units of Source Data sheet Fig2d, clustered by the same
# procedure (a check of the clustering apart from the feature differences of this dataset).
X2 = W.pre_process(sd_fig2d[["TPW", "REP"]].astype(float).values)
wc, fk = W.selection_k(X2, 9, seed=SEED_C1)
print(f"Source Data features, one-channel, 1204 units: elbow K = {W.find_elbow(wc)}, f(K) minimum at K = {int(fk.argmin() + 1)}")
X6 = W.pre_process(sd_fig2d[["inv_below", "inv_above"]].astype(float).values)
for grp in ("FS", "RS"):
m = (sd_fig2d.onech == grp).values
wc, fk = W.selection_k(X6[m], 9, seed=SEED_C6)
l3 = W.kmeans_labels(X6[m], 3, SEED_C6)
names, tab = W.name_by_overlap(sd_fig2d.index[m], l3, sd_fig2d.cluster, [f"{grp}{i}" for i in (1, 2, 3)])
print(f"Source Data features, {grp} ({m.sum()} units): f(K) minimum at K = {int(fk.argmin() + 1)}, elbow K = {W.find_elbow(wc)}; "
f"f(K) = {np.round(fk, 3)}")
print(f" K = 3 counts {pd.Series(names).value_counts().sort_index().to_dict()}, agreement with the paper's labels "
f"{np.mean(names == sd_fig2d.cluster.values[m]):.1%}")
Source Data features, one-channel, 1204 units: elbow K = 2, f(K) minimum at K = 2
Source Data features, FS (281 units): f(K) minimum at K = 3, elbow K = 3; f(K) = [1. 1.003 0.916 1.096 1.063 1.018 1.001 0.986 0.993]
K = 3 counts {'FS1': 130, 'FS2': 82, 'FS3': 69}, agreement with the paper's labels 100.0%
Source Data features, RS (923 units): f(K) minimum at K = 3, elbow K = 3; f(K) = [1. 1.106 0.953 1.083 1.08 1.038 1.016 1.014 1. ]
K = 3 counts {'RS1': 479, 'RS2': 235, 'RS3': 209}, agreement with the paper's labels 100.0%
The clusters used by the claims that depend on this one. RS takes the K that f(K) selects (3 under readings c and a; under reading b f(K) selects 1, and K is forced to 3). For FS, f(K) selects 2 (readings c and a) or 9 (reading b), so no FS3 exists; FS is clustered with K forced to 3 so that the FS1 to FS3 claims can be tested (a deviation), and each such claim is also run on the Source Data labels of the 566 held units.
labels = {}
for r in "cab":
w = sel[r]
lab6 = pd.Series("", index=w.index)
for grp in ("FS", "RS"):
m = multi[r][grp] if multi[r][grp]["k"] == 3 else \
W.cluster_multi_channel(w, one[r]["fsrs"], SEED_C6, k_override=3)[grp]
names, _ = W.name_by_overlap(m["index"], m["labels"], sd_fig2d.cluster, [f"{grp}{i}" for i in (1, 2, 3)])
lab6.loc[m["index"]] = names
labels[r] = pd.DataFrame({"onech": one[r]["fsrs"], "six": lab6.values}, index=w.index)
print(f"({r}) clusters used downstream:", labels[r].six.value_counts().sort_index().to_dict())
held_sd = sd_fig2d.loc[sd_fig2d.index.intersection(units.index)]
labels["sd"] = pd.DataFrame({"onech": held_sd.onech, "six": held_sd.cluster})
print("(sd) Source Data labels of the held units:", labels["sd"].six.value_counts().sort_index().to_dict())
READINGS = {"c": "reading (c)", "a": "reading (a)", "b": "reading (b)", "sd": "Source Data labels"}
(c) clusters used downstream: {'FS1': 59, 'FS2': 41, 'FS3': 31, 'RS1': 180, 'RS2': 95, 'RS3': 110}
(a) clusters used downstream: {'FS1': 67, 'FS2': 50, 'FS3': 37, 'RS1': 270, 'RS2': 160, 'RS3': 157}
(b) clusters used downstream: {'FS1': 167, 'FS2': 82, 'FS3': 124, 'RS1': 637, 'RS2': 414, 'RS3': 396}
(sd) Source Data labels of the held units: {'FS1': 66, 'FS2': 42, 'FS3': 28, 'RS1': 235, 'RS2': 104, 'RS3': 91}
Result: not reproduced. RS gives K = 3 by both methods under readings (c) and (a) (180, 95 and 110 units, reading c; 46.8, 24.7 and 28.6% of RS against the paper's 51.9, 25.5 and 22.6%), but FS gives K = 2 by both methods under readings (c) and (a), and under reading (b) f(K) selects 9 for FS and 1 for RS. The six-cluster labels agree with the Source Data on 80.7% of shared units (reading c). With K forced to 3, FS gives 59, 41 and 31 units (reading c). The same procedure on the paper's own features (Source Data sheet Fig2d) selects K = 3 for FS and RS by both methods and returns the paper's labels for all 1204 units, so the difference comes from the features recomputed here (see source-data-units-link), not from the clustering. With the code's exclusions run literally, a single outlier unit forms one of the three RS clusters (readings c and a).
figs4-rs1-faster-above¶
RS1 and RS2 both propagate asymmetrically and differ mainly in supragranular propagation velocity, faster in RS1 than in RS2.
Kruskal-Wallis with Holm-corrected Mann-Whitney tests on 1/V above (Fig S4 legend). In the Source Data variant the features are this dataset's.
def three(df, col, groups):
return W.kruskal_holm({g: df.loc[df.six == g, col].astype(float).values for g in groups})
def table_for(r):
lab = labels[r]
return units.loc[lab.index].assign(onech=lab.onech, six=lab.six,
spread=lambda d: d.spread_below + d.spread_above,
si=lambda d: W.symmetry_index(d.PL_below, d.PL_above))
T = {r: table_for(r) for r in READINGS}
for r in READINGS:
for col in ["PL_above", "PL_below"]:
k = three(T[r], col, ["RS1", "RS2", "RS3"])
print(f"{READINGS[r]:18s} {col}: medians {dict((g, round(v, 3)) for g, v in k['medians'].items())}, "
f"KW p = {k['p']:.2e}, Holm RS1-RS2 p = {k['post']['RS1-RS2']:.2e}, n {k['n']}")
reading (c) PL_above: medians {'RS1': 1.468, 'RS2': 3.259, 'RS3': 1.792}, KW p = 8.96e-47, Holm RS1-RS2 p = 2.78e-41, n {'RS1': 176, 'RS2': 95, 'RS3': 106}
reading (c) PL_below: medians {'RS1': 0.801, 'RS2': 0.456, 'RS3': -0.618}, KW p = 2.96e-49, Holm RS1-RS2 p = 4.42e-08, n {'RS1': 180, 'RS2': 95, 'RS3': 110}
reading (a) PL_above: medians {'RS1': 1.538, 'RS2': 3.406, 'RS3': 1.904}, KW p = 1.11e-75, Holm RS1-RS2 p = 4.98e-66, n {'RS1': 265, 'RS2': 160, 'RS3': 152}
reading (a) PL_below: medians {'RS1': 0.74, 'RS2': 0.31, 'RS3': -0.731}, KW p = 2.72e-74, Holm RS1-RS2 p = 2.98e-12, n {'RS1': 270, 'RS2': 160, 'RS3': 157}
reading (b) PL_above: medians {'RS1': 1.559, 'RS2': 3.314, 'RS3': 1.566}, KW p = 1.64e-183, Holm RS1-RS2 p = 1.74e-158, n {'RS1': 631, 'RS2': 414, 'RS3': 385}
reading (b) PL_below: medians {'RS1': 0.921, 'RS2': 0.269, 'RS3': -0.79}, KW p = 9.53e-190, Holm RS1-RS2 p = 1.20e-51, n {'RS1': 637, 'RS2': 414, 'RS3': 396}
Source Data labels PL_above: medians {'RS1': 1.549, 'RS2': 3.184, 'RS3': 1.603}, KW p = 1.40e-38, Holm RS1-RS2 p = 2.84e-36, n {'RS1': 232, 'RS2': 102, 'RS3': 90}
Source Data labels PL_below: medians {'RS1': 0.69, 'RS2': 0.267, 'RS3': -0.924}, KW p = 3.85e-40, Holm RS1-RS2 p = 6.84e-06, n {'RS1': 235, 'RS2': 104, 'RS3': 91}
Result: reproduced. The median 1/V above is 1.468 ms/mm in RS1 and 3.259 in RS2 (reading c; Kruskal-Wallis p = 9.0e-47, Holm RS1 against RS2 p = 2.8e-41), so RS1 propagates faster above the soma; readings (a), (b) and the Source Data labels give the same.
figs4-rs-spread¶
RS1 to RS3 differ in spatial spread, RS3 being the most spatially confined.
for r in READINGS:
k = three(T[r], "spread", ["RS1", "RS2", "RS3"])
print(f"{READINGS[r]:18s} spread medians {dict((g, round(v, 1)) for g, v in k['medians'].items())} um, "
f"KW H = {k['H']:.1f}, p = {k['p']:.2e}; Holm {dict((g, float('%.2e' % v)) for g, v in k['post'].items())}")
reading (c) spread medians {'RS1': 171.3, 'RS2': 150.8, 'RS3': 144.8} um, KW H = 23.8, p = 6.79e-06; Holm {'RS1-RS2': 0.00445, 'RS1-RS3': 1.11e-05, 'RS2-RS3': 0.18}
reading (a) spread medians {'RS1': 154.4, 'RS2': 149.3, 'RS3': 131.8} um, KW H = 28.5, p = 6.39e-07; Holm {'RS1-RS2': 0.0743, 'RS1-RS3': 3.26e-07, 'RS2-RS3': 0.00245}
reading (b) spread medians {'RS1': 172.8, 'RS2': 152.0, 'RS3': 145.1} um, KW H = 81.6, p = 1.94e-18; Holm {'RS1-RS2': 1.52e-09, 'RS1-RS3': 9.9e-17, 'RS2-RS3': 0.0157}
Source Data labels spread medians {'RS1': 169.1, 'RS2': 154.0, 'RS3': 139.5} um, KW H = 20.2, p = 4.10e-05; Holm {'RS1-RS2': 0.04, 'RS1-RS3': 5e-05, 'RS2-RS3': 0.0421}
Result: reproduced. The spreads differ (Kruskal-Wallis H = 23.8, p = 6.8e-06, reading c) and RS3 is the most confined (median 144.8 um against 171.3 and 150.8); readings (a), (b) and the Source Data labels give the same order with p = 6.4e-07, 1.9e-18 and 4.1e-05. RS3's 1/V below has the most negative median (-0.618, reading c), reported, not judged.
figs4-fs-spread-absent¶
FS1 to FS3 show no significant difference in spatial spread.
for r in READINGS:
k = three(T[r], "spread", ["FS1", "FS2", "FS3"])
print(f"{READINGS[r]:18s} spread medians {dict((g, round(v, 1)) for g, v in k['medians'].items())} um, "
f"KW H = {k['H']:.2f}, p = {k['p']:.3f}, n {k['n']}")
reading (c) spread medians {'FS1': 155.5, 'FS2': 168.4, 'FS3': 166.2} um, KW H = 1.84, p = 0.399, n {'FS1': 59, 'FS2': 41, 'FS3': 31}
reading (a) spread medians {'FS1': 159.2, 'FS2': 162.4, 'FS3': 162.6} um, KW H = 0.04, p = 0.978, n {'FS1': 67, 'FS2': 50, 'FS3': 37}
reading (b) spread medians {'FS1': 170.2, 'FS2': 173.1, 'FS3': 221.5} um, KW H = 21.14, p = 0.000, n {'FS1': 167, 'FS2': 82, 'FS3': 124}
Source Data labels spread medians {'FS1': 155.3, 'FS2': 170.9, 'FS3': 183.3} um, KW H = 2.64, p = 0.267, n {'FS1': 66, 'FS2': 42, 'FS3': 28}
Result: reproduced, resting on an assumption. On the FS clusters of reading (c) (K forced to 3) the Kruskal-Wallis test gives p = 0.399 (medians 155.5, 168.4 and 166.2 um), reading (a) p = 0.978 and the Source Data labels p = 0.267; under reading (b) p is below 0.001.
figs5-depth-distribution¶
The six multi-channel clusters are distributed differently along the V1 depth axis.
Depth relative to the layer 4 centre. The criterion names the method: the CSD of the flash-averaged LFP, with the earliest sink in V1 as the centre. The centre computed here that way (the first VISp channel whose CSD reaches half the minimum within 0 to 150 ms) gives depth_csd, which decides the outcome. The code's unit tables give each unit's depth as its probe position minus one value per probe; that value gives the depth of every unit on the probe (depth_code), shown as a variant. The code does not say how it was placed, and the table below shows how often the same value recurs across probes. Neither centre is validated here; the CSD of every probe is plotted.
csd = pd.DataFrame([dict(c, session=s) for s in S["wt"] for c in R[s]["csd"]])
print("CSD centres per probe:", csd[["session", "probe", "centre", "t_first_ms", "n_v1_lfp"]].to_string(index=False))
jj = units.join(unitinfo[["depth"]], how="inner")
dd = jj.depth_csd - jj.depth
print(f"depth here minus the code's depth, {len(jj)} units: median {dd.median():.0f} um, "
f"within 40 um for {np.mean(np.abs(dd) <= 40):.1%}, within 100 um for {np.mean(np.abs(dd) <= 100):.1%}")
print("per session median difference:", dd.groupby(jj.session).median().to_dict())
# The code's depth is the probe position minus one value per probe (its layer 4 centre); that
# centre gives a depth for every unit of the probe (depth_code), shown as a variant.
jj["offset"] = jj.vpos - jj.depth
off = jj.groupby(["session", "probe_id"]).offset.agg(["median", "min", "max", "size"])
print("code's depth = probe position - one value per probe:", bool((off["min"] == off["max"]).all()))
cmpc = off["median"].rename("code centre").reset_index().merge(
csd.rename(columns={"probe": "probe_id", "centre": "CSD centre here"})[["session", "probe_id", "CSD centre here", "centre_min", "t_first_ms"]],
on=["session", "probe_id"])
cmpc["here - code"] = cmpc["CSD centre here"] - cmpc["code centre"]
print(cmpc.to_string(index=False))
print("probes per value of the code's centre:", cmpc["code centre"].value_counts().to_dict(), "of", len(cmpc), "probes")
cen = off["median"].droplevel(0)
units["depth_code"] = units.vpos - units.probe_id.map(cen)
for r in READINGS:
T[r]["depth_code"] = units.loc[T[r].index, "depth_code"]
print("units without a code centre (a probe the code's tables do not cover), reading (c):", int(T["c"].depth_code.isna().sum()), "of", len(T["c"]))
print("depth_code range (wild-type units of reading c): %.0f to %.0f um" % (T["c"].depth_code.min(), T["c"].depth_code.max()),
"; depth_csd range: %.0f to %.0f um" % (T["c"].depth_csd.min(), T["c"].depth_csd.max()))
fig, axs = plt.subplots(2, 7, figsize=(17, 6), sharey=False)
for ax, (_, row) in zip(axs.flat, csd.iterrows()):
zc = row["z"]
ax.imshow(row["csd"].T, aspect="auto", origin="lower", cmap="RdBu", extent=[row["t_ms"][0], row["t_ms"][-1], zc[0], zc[-1]],
vmin=-np.abs(row["csd"]).max(), vmax=np.abs(row["csd"]).max())
ax.axhline(row["centre"], color="k", lw=1)
ax.axhline(cen.get(row["probe"], np.nan), color="g", lw=1, ls="--")
ax.set_title(f"{row['session']}", fontsize=8)
ax.set_xlabel("ms after flash", fontsize=7)
axs.flat[0].set_ylabel("probe position (um)")
axs.flat[-1].axis("off")
fig.suptitle("Flash CSD of the VISp LFP channels (sinks blue); black: centre here, green dashed: the code's centre")
plt.tight_layout()
plt.show()
print("CSD panels: 0 to 150 ms after flash onset, the VISp channels of each probe; colour scale per panel symmetric about 0")
six_names = ["FS1", "FS2", "FS3", "RS1", "RS2", "RS3"]
for r in READINGS:
g = {c: T[r].loc[T[r].six == c, "depth_csd"].astype(float).values for c in six_names}
H, p = stats.kruskal(*g.values())
print(f"{READINGS[r]:18s} depth medians {dict((c, float(np.median(v))) for c, v in g.items())}, KW H = {H:.1f}, p = {p:.2e}")
gg = {c: T[r].loc[T[r].six == c, "depth_code"].dropna().astype(float).values for c in six_names}
print(f" with the code's centre (depth_code, n {sum(len(v) for v in gg.values())}): medians {dict((c, float(np.median(v))) for c, v in gg.items())}, "
"KW p = %.2e" % stats.kruskal(*gg.values()).pvalue)
if r == "sd":
gg = {c: jj.loc[jj.index.intersection(T[r].index[T[r].six == c]), "depth"].values for c in six_names}
print(" with the code's depth on the units of its tables:", "KW p = %.2e" % stats.kruskal(*gg.values()).pvalue)
CSD centres per probe: session probe centre t_first_ms n_v1_lfp
732592105 733744649 2720.0 43.200012 20
739448407 757968493 2320.0 53.600014 13
744228101 757904513 2880.0 40.000011 26
750332458 757904550 2680.0 38.400005 23
750749662 769322806 3080.0 55.200011 27
754312389 756781557 2240.0 83.200007 23
754829445 760640039 2880.0 51.200005 22
754829445 760640049 2840.0 43.199942 21
757216464 769322749 2760.0 68.800027 24
757970808 769322856 2520.0 41.600010 24
759883607 769322793 2600.0 48.000002 27
761418226 768908585 2160.0 62.400011 23
763673393 773463017 2800.0 61.600012 24
799864342 805579703 2680.0 49.600010 22
depth here minus the code's depth, 618 units: median -20 um, within 40 um for 22.2%, within 100 um for 29.0%
per session median difference: {732592105: 20.0, 739448407: 420.0, 744228101: -140.0, 750332458: 60.0, 750749662: -340.0, 754312389: 140.0, 754829445: -140.0, 757216464: -20.0, 757970808: 220.0, 759883607: -140.0, 761418226: 300.0, 763673393: -340.0, 799864342: -220.0}
code's depth = probe position - one value per probe: True
session probe_id code centre CSD centre here centre_min t_first_ms here - code
732592105 733744649 2740.0 2720.0 3080.0 43.200012 -20.0
739448407 757968493 2740.0 2320.0 2280.0 53.600014 -420.0
744228101 757904513 2740.0 2880.0 2920.0 40.000011 140.0
750332458 757904550 2740.0 2680.0 2400.0 38.400005 -60.0
750749662 769322806 2740.0 3080.0 3080.0 55.200011 340.0
754312389 756781557 2380.0 2240.0 2240.0 83.200007 -140.0
754829445 760640039 2740.0 2880.0 3320.0 51.200005 140.0
757216464 769322749 2740.0 2760.0 3080.0 68.800027 20.0
757970808 769322856 2740.0 2520.0 2280.0 41.600010 -220.0
759883607 769322793 2460.0 2600.0 2640.0 48.000002 140.0
761418226 768908585 2460.0 2160.0 2440.0 62.400011 -300.0
763673393 773463017 2460.0 2800.0 2640.0 61.600012 340.0
799864342 805579703 2460.0 2680.0 2680.0 49.600010 220.0
probes per value of the code's centre: {2740.0: 8, 2460.0: 4, 2380.0: 1} of 13 probes
units without a code centre (a probe the code's tables do not cover), reading (c): 17 of 516
depth_code range (wild-type units of reading c): -660 to 460 um ; depth_csd range: -780 to 440 um
CSD panels: 0 to 150 ms after flash onset, the VISp channels of each probe; colour scale per panel symmetric about 0
reading (c) depth medians {'FS1': -140.0, 'FS2': -40.0, 'FS3': -140.0, 'RS1': -140.0, 'RS2': -180.0, 'RS3': -120.0}, KW H = 11.4, p = 4.36e-02
with the code's centre (depth_code, n 499): medians {'FS1': -140.0, 'FS2': 0.0, 'FS3': -100.0, 'RS1': -120.0, 'RS2': -160.0, 'RS3': -120.0}, KW p = 2.54e-01
reading (a) depth medians {'FS1': -120.0, 'FS2': -90.0, 'FS3': -160.0, 'RS1': -110.0, 'RS2': -180.0, 'RS3': -100.0}, KW H = 14.9, p = 1.09e-02
with the code's centre (depth_code, n 721): medians {'FS1': -110.0, 'FS2': 0.0, 'FS3': -100.0, 'RS1': -60.0, 'RS2': -160.0, 'RS3': -90.0}, KW p = 2.87e-01
reading (b) depth medians {'FS1': -220.0, 'FS2': -60.0, 'FS3': -20.0, 'RS1': -60.0, 'RS2': -120.0, 'RS3': -60.0}, KW H = 44.4, p = 1.95e-08
with the code's centre (depth_code, n 1770): medians {'FS1': -160.0, 'FS2': 0.0, 'FS3': -50.0, 'RS1': -40.0, 'RS2': -110.0, 'RS3': -80.0}, KW p = 2.84e-05
Source Data labels depth medians {'FS1': -150.0, 'FS2': -70.0, 'FS3': -100.0, 'RS1': -140.0, 'RS2': -160.0, 'RS3': -160.0}, KW H = 5.5, p = 3.63e-01
with the code's centre (depth_code, n 566): medians {'FS1': -80.0, 'FS2': -50.0, 'FS3': -130.0, 'RS1': -120.0, 'RS2': -160.0, 'RS3': -160.0}, KW p = 3.37e-01
with the code's depth on the units of its tables: KW p = 3.37e-01
Result: not reproduced, resting on an assumption (the verified outcome; a change to partially reproduced was proposed, and round 3 of verification did not agree with it and would give reproduced, resting on an assumption). With the CSD layer 4 centre computed here, the method the criterion names, the six clusters differ in depth (Kruskal-Wallis p = 0.044, reading c; 0.011, reading a; 2.0e-08, reading b), which meets the criterion, but on the Source Data labels the same depth gives p = 0.36. With the layer 4 centre of the code's unit tables the test gives p = 0.25 (reading c), 0.29 (reading a), 2.8e-05 (reading b) and 0.34 on the Source Data labels. That centre is 2740 um on 8 of the 13 probes, so it may be a fixed offset and not a placement from each probe's CSD; the recorded outcome took it as the paper's CSD placement, which these outputs do not support. The two centres differ by -420 to +340 um per probe, and neither is validated here. On the criterion's method the difference is present for the clusters found here and absent for the paper's own labels, so the effect holds in part. The round-3 verifier reads the criterion as met on the clusters found here, the rule the attempt uses for every downstream claim, as the criterion has no partial clause; on the paper's own labels it would be not reproduced. The test on the CSD minimum centre (depth_csd_min) is not run here.
fig6a-fs1-symmetric¶
The spike propagation symmetry index separates FS1 (symmetric propagation) from FS2 and FS3 (asymmetric propagation).
for r in READINGS:
k = three(T[r], "si", ["FS1", "FS2", "FS3"])
ratio = T[r].PL_below / T[r].PL_above
kr = W.kruskal_holm({g: ratio[T[r].six == g].values for g in ["FS1", "FS2", "FS3"]})
print(f"{READINGS[r]:18s} SI medians {dict((g, round(v, 3)) for g, v in k['medians'].items())}, KW H = {k['H']:.1f}, "
f"p = {k['p']:.2e}; Holm FS1-FS2 {k['post']['FS1-FS2']:.2e}, FS1-FS3 {k['post']['FS1-FS3']:.2e}; "
f"ratio variant KW p = {kr['p']:.2e}")
reading (c) SI medians {'FS1': 0.391, 'FS2': 1.019, 'FS3': 1.084}, KW H = 41.0, p = 1.27e-09; Holm FS1-FS2 2.88e-06, FS1-FS3 2.68e-08; ratio variant KW p = 1.28e-02
reading (a) SI medians {'FS1': 0.379, 'FS2': 1.052, 'FS3': 1.32}, KW H = 65.0, p = 7.83e-15; Holm FS1-FS2 7.28e-10, FS1-FS3 4.58e-12; ratio variant KW p = 1.37e-02
reading (b) SI medians {'FS1': 0.358, 'FS2': 1.075, 'FS3': 1.41}, KW H = 174.5, p = 1.30e-38; Holm FS1-FS2 5.38e-16, FS1-FS3 1.04e-35; ratio variant KW p = 9.24e-07
Source Data labels SI medians {'FS1': 0.452, 'FS2': 1.108, 'FS3': 1.021}, KW H = 34.0, p = 4.11e-08; Holm FS1-FS2 3.46e-08, FS1-FS3 2.64e-03; ratio variant KW p = 8.80e-01
Result: reproduced, resting on an assumption. FS1 has the lowest symmetry index (median 0.391 against 1.019 and 1.084, reading c, K forced to 3), Kruskal-Wallis p = 1.3e-09, Holm FS1 against FS2 p = 2.9e-06 and FS1 against FS3 p = 2.7e-08. Readings (a) and (b) give the same at p below 1e-09. On the Source Data labels FS1 against FS3 gives p = 0.0026, below 0.05 but not 0.001. The ratio variant separates the clusters less (p = 0.013, reading c).
fig4g-experiment-classifier-fs-rs¶
A linear SVM trained on TPW and REP of in vivo units discriminates FS from RS with a validation accuracy above 99%.
As Exp_Model_Classifier.ipynb cells 7 and 12: for each of 100 resamplings, FS units drawn with replacement up to the RS count are added, TPW and REP are z-scored over the upsampled set, and a linear SVC (C = 1, balanced weights) is fitted on 100 stratified 75/25 splits. The resampling and the split seeds come from the claim's generator. The five seeds are run with 20 resamplings each, to keep the time down (a standard choice; the mean accuracy over 100 resamplings varies little).
from sklearn import svm
from sklearn.model_selection import train_test_split
SEED_SVM = seed_of("fig4g-experiment-classifier-fs-rs")
def exp_classifier(df, lab, seed, n_rep=100, n_split=100, newX_raw=None, cols=("TPW", "REP"), model_name="svm"):
"""The code's procedure: upsample, z-score, then split (Exp_Model_Classifier.ipynb)."""
rng = np.random.default_rng(seed)
accs, votes = [], None
for _ in range(n_rep):
idx = W.upsample_index(lab, rng)
Xu = df[list(cols)].values[idx]
mu, sd_ = Xu.mean(0), Xu.std(0)
acc, v, cls = W.classifier((Xu - mu) / sd_, lab[idx],
None if newX_raw is None else (newX_raw - newX_raw.mean(0)) / newX_raw.std(0),
model_name, n_split, int(rng.integers(2 ** 31)))
accs.append(acc)
if v is not None:
votes = v if votes is None else votes + v
return float(np.mean(accs)), votes, cls
def split_first(X, lab, seed, n_split=100, model_name="svm"):
"""Variant without leakage: split the units first, upsample and z-score the training part
only, test on held-out units; returns the mean accuracy and the mean balanced accuracy."""
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import balanced_accuracy_score
rng = np.random.default_rng(seed)
acc, bacc = [], []
for _ in range(n_split):
tr, te = train_test_split(np.arange(len(lab)), test_size=0.25, stratify=lab, random_state=int(rng.integers(1, 2 ** 31 - 1)))
ui = tr[W.upsample_index(lab[tr], rng)]
mu, sd_ = X[ui].mean(0), X[ui].std(0)
m = (svm.SVC(kernel="linear", C=1, class_weight="balanced") if model_name == "svm" else
RandomForestClassifier(n_estimators=20, criterion="gini", max_features="sqrt", bootstrap=True, random_state=0, n_jobs=1))
m.fit((X[ui] - mu) / sd_, lab[ui])
pr = m.predict((X[te] - mu) / sd_)
acc.append(np.mean(pr == lab[te]))
bacc.append(balanced_accuracy_score(lab[te], pr))
return float(np.mean(acc)), float(np.mean(bacc))
t_ = time.time()
acc_svm = {}
for r in READINGS:
lab = labels[r].onech.values
df = units.loc[labels[r].index]
n_rep = 100 if r in ("c", "sd") else 20
acc_svm[r], _, _ = exp_classifier(df, lab, SEED_SVM, n_rep=n_rep)
print(f"{READINGS[r]:18s} mean validation accuracy FS against RS: {100 * acc_svm[r]:.2f}% ({n_rep} resamplings x 100 splits)")
print(f"({time.time() - t_:.0f} s)")
lab = labels["c"].onech.values
df = units.loc[labels["c"].index]
print("reading (c), five seeds (20 resamplings x 100 splits):",
[round(100 * exp_classifier(df, lab, SEED_SVM + k * 1000, n_rep=20)[0], 2) for k in range(5)])
g_ = np.random.default_rng(SEED_SVM + 1)
perm = g_.permutation(lab)
print("chance baseline, reading (c), labels permuted (the code's procedure, 20 x 100): %.2f%%; majority class %.2f%%"
% (100 * exp_classifier(df, perm, SEED_SVM + 2, n_rep=20)[0], 100 * max(np.mean(lab == "FS"), np.mean(lab == "RS"))))
for r in ("c", "sd"):
lab_r = labels[r].onech.values
X_r = units.loc[labels[r].index, ["TPW", "REP"]].values.astype(float)
a1, b1 = split_first(X_r, lab_r, SEED_SVM + 3)
a0, b0 = split_first(X_r, g_.permutation(lab_r), SEED_SVM + 4)
print(f"{READINGS[r]:18s} split before upsampling (100 splits): accuracy {100 * a1:.2f}%, balanced {100 * b1:.2f}%; "
f"labels permuted: accuracy {100 * a0:.2f}%, balanced {100 * b0:.2f}%")
reading (c) mean validation accuracy FS against RS: 99.34% (100 resamplings x 100 splits)
reading (a) mean validation accuracy FS against RS: 99.91% (20 resamplings x 100 splits)
reading (b) mean validation accuracy FS against RS: 99.59% (20 resamplings x 100 splits)
Source Data labels mean validation accuracy FS against RS: 98.69% (100 resamplings x 100 splits) (86 s)
reading (c), five seeds (20 resamplings x 100 splits): [99.37, 99.35, 99.37, 99.34, 99.35]
chance baseline, reading (c), labels permuted (the code's procedure, 20 x 100): 53.18%; majority class 74.61%
reading (c) split before upsampling (100 splits): accuracy 99.19%, balanced 99.44%; labels permuted: accuracy 45.85%, balanced 52.93%
Source Data labels split before upsampling (100 splits): accuracy 98.10%, balanced 98.75%; labels permuted: accuracy 60.25%, balanced 51.53%
Result: reproduced. The mean validation accuracy is 99.34% (reading c; 99.34 to 99.37% under the five seeds) and 98.69% on the Source Data labels. The code's procedure upsamples before it splits, so copies of a unit can be in training and test; for this linear SVM that does not inflate the score: with permuted labels it gives 53.18%, and splitting before upsampling gives 99.19% (balanced 99.44%) on reading (c), against a balanced 52.93% with permuted labels. The FS and RS labels come from K-means on the same two features, so a high accuracy is expected.
fig5d-experiment-classifier-rs¶
A classifier trained on the multi-channel in vivo features discriminates RS1 to RS3 with accuracy above 99%.
Random forest (20 trees, gini) on z-scored 1/V below and above of RS units, classes upsampled to the largest, 100 stratified 75/25 splits for each of 100 resamplings (criterion). Units whose 1/V above is NaN are left out (counted).
SEED_RF = seed_of("fig5d-experiment-classifier-rs")
def rs_classifier(r, seed, n_rep=100, n_split=100, permute=False):
rng = np.random.default_rng(seed)
t = T[r][T[r].onech == "RS"].dropna(subset=["PL_below", "PL_above"])
lab = t.six.values
if permute:
lab = rng.permutation(lab)
accs = []
for _ in range(n_rep):
idx = W.upsample_index(lab, rng)
X = W.zscore(t[["PL_below", "PL_above"]].values[idx])
accs.append(W.classifier(X, lab[idx], None, "rf", n_split, int(rng.integers(2 ** 31)))[0])
return float(np.mean(accs)), len(T[r][T[r].onech == "RS"]) - len(t)
t_ = time.time()
for r in READINGS:
n_rep = 20 if r in ("c", "sd") else 5
acc, dropped = rs_classifier(r, SEED_RF, n_rep=n_rep)
print(f"{READINGS[r]:18s} RS1-3 random forest accuracy {100 * acc:.2f}% ({n_rep} resamplings x 100 splits), NaN units left out {dropped}")
print(f"({time.time() - t_:.0f} s)")
print("reading (c), five seeds (5 resamplings x 100 splits):",
[round(100 * rs_classifier("c", SEED_RF + k * 1000, n_rep=5)[0], 2) for k in range(5)])
print("chance baseline, reading (c), labels permuted (the code's procedure, 5 x 100): %.2f%%"
% (100 * rs_classifier("c", SEED_RF + 1, n_rep=5, permute=True)[0]))
for r in ("c", "sd"):
t = T[r][T[r].onech == "RS"].dropna(subset=["PL_below", "PL_above"])
a1, b1 = split_first(t[["PL_below", "PL_above"]].values.astype(float), t.six.values, SEED_RF + 2, model_name="rf")
a0, b0 = split_first(t[["PL_below", "PL_above"]].values.astype(float), np.random.default_rng(SEED_RF + 3).permutation(t.six.values),
SEED_RF + 4, model_name="rf")
print(f"{READINGS[r]:18s} split before upsampling (100 splits): accuracy {100 * a1:.2f}%, balanced {100 * b1:.2f}%; "
f"labels permuted: accuracy {100 * a0:.2f}%, balanced {100 * b0:.2f}%")
reading (c) RS1-3 random forest accuracy 98.55% (20 resamplings x 100 splits), NaN units left out 8
reading (a) RS1-3 random forest accuracy 98.26% (5 resamplings x 100 splits), NaN units left out 10
reading (b) RS1-3 random forest accuracy 98.94% (5 resamplings x 100 splits), NaN units left out 17
Source Data labels RS1-3 random forest accuracy 93.27% (20 resamplings x 100 splits), NaN units left out 6 (136 s)
reading (c), five seeds (5 resamplings x 100 splits): [98.65, 98.68, 98.56, 98.55, 98.73]
chance baseline, reading (c), labels permuted (the code's procedure, 5 x 100): 61.67%
reading (c) split before upsampling (100 splits): accuracy 97.53%, balanced 97.34%; labels permuted: accuracy 34.20%, balanced 31.58%
Source Data labels split before upsampling (100 splits): accuracy 84.55%, balanced 82.46%; labels permuted: accuracy 44.53%, balanced 37.09%
Result: partially reproduced. The random forest reaches 98.55% on RS1 to RS3 of reading (c) (98.55 to 98.73% under the five seeds), above 95% but not 99%, and 93.27% on the Source Data labels. For the random forest the code's order (upsample, then split) inflates the score: permuted labels give 61.67% where chance is about 33%. Splitting before upsampling gives 97.53% (balanced 97.34%) on reading (c) and 84.55% on the Source Data labels, against 34.20% and 44.53% with permuted labels (balanced 31.58% and 37.09%).
fig3a-isi-fs-rs¶
During drifting gratings the ISI median of FS units is 19.63 ms (95% CI 19.60 to 19.67) and that of RS units 53.37 ms (95% CI 53.30 to 53.43), a significant difference.
Units with EAP amplitude above 50 uV and at least 100 spikes (Methods) during drifting gratings. ISIs pooled over the units of a cluster, under (a) ISIs within each presentation and (b) ISIs within each drifting-grating block. The 95% CI is a bootstrap of the median over ISIs (200 resamples under the claim's seed).
SEED_ISI = seed_of("fig3a-isi-fs-rs")
def active(df, nspk_col):
return df[(df.A > 50) & (df[nspk_col] >= 100)]
def pooled(r, tag, grp):
t = T[r]
t = active(t, "n_dg" if tag == "a" else "n_dg_blocks")
ids = t.index[t.onech == grp]
key = "isi_a" if tag == "a" else "isi_b"
sess = units.loc[ids, "session"]
return np.concatenate([R[s][key][i] for i, s in zip(ids, sess)]).astype(np.float64) * 1000, len(ids)
rng = np.random.default_rng(SEED_ISI)
for r in READINGS:
for tag in "ab":
fs_isi, nfs = pooled(r, tag, "FS")
rs_isi, nrs = pooled(r, tag, "RS")
ci = {}
for name, x in (("FS", fs_isi), ("RS", rs_isi)):
bs = [np.median(x[rng.integers(0, len(x), len(x))]) for _ in range(200)]
ci[name] = np.percentile(bs, [2.5, 97.5])
p = stats.mannwhitneyu(fs_isi, rs_isi, alternative="two-sided").pvalue
print(f"{READINGS[r]:18s} ({tag}) FS {nfs} units {len(fs_isi)} ISIs median {np.median(fs_isi):.2f} ms "
f"[{ci['FS'][0]:.2f}, {ci['FS'][1]:.2f}]; RS {nrs} units {len(rs_isi)} ISIs median {np.median(rs_isi):.2f} ms "
f"[{ci['RS'][0]:.2f}, {ci['RS'][1]:.2f}]; MW p = {p:.1e}")
fs_isi, _ = pooled("c", "a", "FS")
rs_isi, _ = pooled("c", "a", "RS")
meds = []
for k in range(5):
g = np.random.default_rng(SEED_ISI + 1000 * k)
meds.append([round(float(np.percentile([np.median(x[g.integers(0, len(x), len(x))]) for _ in range(50)], q)), 2)
for x in (fs_isi, rs_isi) for q in (2.5, 97.5)])
print("reading (c), (a): bootstrap CI bounds (FS low, FS high, RS low, RS high) under five seeds, 50 resamples:", meds)
reading (c) (a) FS 98 units 1329333 ISIs median 21.00 ms [20.93, 21.07]; RS 327 units 1914483 ISIs median 55.33 ms [55.23, 55.47]; MW p = 0.0e+00
reading (c) (b) FS 98 units 2020093 ISIs median 21.70 ms [21.63, 21.73]; RS 328 units 3013284 ISIs median 64.83 ms [64.73, 64.93]; MW p = 0.0e+00
reading (a) (a) FS 115 units 1459205 ISIs median 22.67 ms [22.60, 22.73]; RS 485 units 2176565 ISIs median 52.93 ms [52.80, 53.03]; MW p = 0.0e+00
reading (a) (b) FS 115 units 2177831 ISIs median 23.23 ms [23.20, 23.30]; RS 497 units 3412080 ISIs median 63.50 ms [63.37, 63.60]; MW p = 0.0e+00
reading (b) (a) FS 215 units 2032996 ISIs median 25.93 ms [25.87, 25.97]; RS 914 units 3347933 ISIs median 54.03 ms [53.93, 54.10]; MW p = 0.0e+00
reading (b) (b) FS 215 units 3099597 ISIs median 27.47 ms [27.40, 27.50]; RS 951 units 5302981 ISIs median 66.60 ms [66.50, 66.70]; MW p = 0.0e+00
Source Data labels (a) FS 99 units 1442713 ISIs median 20.50 ms [20.43, 20.57]; RS 343 units 2070083 ISIs median 54.67 ms [54.57, 54.77]; MW p = 0.0e+00
Source Data labels (b) FS 99 units 2193271 ISIs median 21.00 ms [20.97, 21.03]; RS 344 units 3270425 ISIs median 63.40 ms [63.30, 63.50]; MW p = 0.0e+00
reading (c), (a): bootstrap CI bounds (FS low, FS high, RS low, RS high) under five seeds, 50 resamples: [[20.94, 21.07, 55.23, 55.47], [20.97, 21.06, 55.27, 55.43], [20.93, 21.07, 55.27, 55.47], [20.97, 21.07, 55.24, 55.46], [20.97, 21.03, 55.27, 55.43]]
Result: partially reproduced, resting on an assumption. Under reading (c), ISIs within presentations, the pooled median is 21.00 ms for FS and 55.33 ms for RS (Mann-Whitney p below the smallest number printed), against 19.63 and 53.37 ms: both within 10% (7.0% and 3.7%), neither in the paper's confidence interval. The block reading gives 21.70 and 64.83 ms. On the Source Data labels the medians are 20.50 and 54.67 ms; under reading (a) 22.67 and 52.93 ms (FS 15% off). The spike counts (1.33 and 1.91 million, reading c) are about half the paper's, as are the sessions. The bootstrap intervals are stable under the five seeds.
fig3a-rs1-excitability¶
RS1 units fire faster and with less variable spiking (lower CV and LV) than RS2 and RS3 units during drifting gratings.
Units with EAP amplitude above 50 uV and at least 100 spikes during drifting gratings; rate, CV and LV over the drifting-grating spikes under the two period readings; Kruskal-Wallis with Holm-corrected Mann-Whitney tests. The Source Data per-unit values (sheet Fig3a_rate_cv_lv) are compared with the values here on shared units.
def rs_tests(r, tag, cols):
t = active(T[r], "n_dg" if tag == "a" else "n_dg_blocks")
out = {}
for c in cols:
k = three(t, c, ["RS1", "RS2", "RS3"])
out[c] = k
return out, t
for r in READINGS:
for tag in "ab":
cols = {"rate": "rate_dg" if tag == "a" else "rate_dg_blocks", "cv": f"cv_dg_{tag}", "lv": f"lv_dg_{tag}"}
res, t = rs_tests(r, tag, cols.values())
n = t.six.value_counts().reindex(["RS1", "RS2", "RS3"]).to_dict()
for name, c in cols.items():
k = res[c]
print(f"{READINGS[r]:18s} ({tag}) {name:4s} medians {dict((g, round(v, 3)) for g, v in k['medians'].items())}, "
f"KW p = {k['p']:.1e}, Holm RS1-RS2 {k['post']['RS1-RS2']:.1e}, RS1-RS3 {k['post']['RS1-RS3']:.1e}")
print(f" units {n}")
m3 = sd_table("Fig3a_rate_cv_lv").set_index("unit_id")
sh = m3.index.intersection(units.index)
for a, b in [("rate_dg", "Rate"), ("rate_dg_blocks", "Rate"), ("cv_dg_a", "CV"), ("cv_dg_b", "CV"), ("lv_dg_a", "LV"), ("lv_dg_b", "LV")]:
d = np.abs(units.loc[sh, a].astype(float) - m3.loc[sh, b].astype(float))
print(f"{a:15s} against Source Data {b}: {len(sh)} units, median |diff| {d.median():.3f}, "
f"Spearman r {stats.spearmanr(units.loc[sh, a], m3.loc[sh, b].astype(float)).statistic:.3f}")
print("Source Data units of Fig3a_rate_cv_lv in the held sessions:", len(sh), "of", len(m3),
"; by cluster here (Source Data labels):", labels["sd"].loc[sh].six.value_counts().to_dict())
reading (c) (a) rate medians {'RS1': 3.916, 'RS2': 2.558, 'RS3': 2.257}, KW p = 1.1e-02, Holm RS1-RS2 3.2e-02, RS1-RS3 3.7e-02
reading (c) (a) cv medians {'RS1': 1.179, 'RS2': 1.271, 'RS3': 1.267}, KW p = 1.2e-02, Holm RS1-RS2 1.6e-02, RS1-RS3 1.3e-01
reading (c) (a) lv medians {'RS1': 0.765, 'RS2': 0.808, 'RS3': 0.822}, KW p = 1.2e-01, Holm RS1-RS2 3.6e-01, RS1-RS3 1.7e-01
units {'RS1': 165, 'RS2': 75, 'RS3': 87}
reading (c) (b) rate medians {'RS1': 3.982, 'RS2': 2.96, 'RS3': 2.756}, KW p = 1.7e-02, Holm RS1-RS2 5.1e-02, RS1-RS3 5.1e-02
reading (c) (b) cv medians {'RS1': 1.543, 'RS2': 1.762, 'RS3': 1.675}, KW p = 1.8e-05, Holm RS1-RS2 4.5e-05, RS1-RS3 3.5e-03
reading (c) (b) lv medians {'RS1': 0.871, 'RS2': 1.054, 'RS3': 0.96}, KW p = 1.8e-02, Holm RS1-RS2 4.8e-02, RS1-RS3 5.4e-02
units {'RS1': 166, 'RS2': 75, 'RS3': 87}
reading (a) (a) rate medians {'RS1': 2.609, 'RS2': 1.32, 'RS3': 1.162}, KW p = 8.4e-04, Holm RS1-RS2 7.3e-03, RS1-RS3 3.7e-03
reading (a) (a) cv medians {'RS1': 1.213, 'RS2': 1.271, 'RS3': 1.298}, KW p = 1.9e-02, Holm RS1-RS2 1.2e-01, RS1-RS3 2.6e-02
reading (a) (a) lv medians {'RS1': 0.838, 'RS2': 0.904, 'RS3': 0.986}, KW p = 1.0e-02, Holm RS1-RS2 2.0e-01, RS1-RS3 9.2e-03
units {'RS1': 235, 'RS2': 122, 'RS3': 128}
reading (a) (b) rate medians {'RS1': 2.666, 'RS2': 1.341, 'RS3': 1.312}, KW p = 2.6e-03, Holm RS1-RS2 1.9e-02, RS1-RS3 7.9e-03
reading (a) (b) cv medians {'RS1': 1.612, 'RS2': 1.854, 'RS3': 1.741}, KW p = 1.7e-05, Holm RS1-RS2 2.2e-05, RS1-RS3 1.1e-02
reading (a) (b) lv medians {'RS1': 0.998, 'RS2': 1.155, 'RS3': 1.232}, KW p = 7.2e-04, Holm RS1-RS2 1.5e-02, RS1-RS3 1.8e-03
units {'RS1': 242, 'RS2': 124, 'RS3': 131}
reading (b) (a) rate medians {'RS1': 1.777, 'RS2': 1.287, 'RS3': 1.172}, KW p = 5.2e-04, Holm RS1-RS2 1.3e-02, RS1-RS3 9.9e-04
reading (b) (a) cv medians {'RS1': 1.221, 'RS2': 1.279, 'RS3': 1.266}, KW p = 1.6e-03, Holm RS1-RS2 1.9e-03, RS1-RS3 5.0e-02
reading (b) (a) lv medians {'RS1': 0.967, 'RS2': 1.031, 'RS3': 1.05}, KW p = 8.0e-02, Holm RS1-RS2 5.2e-01, RS1-RS3 7.8e-02
units {'RS1': 391, 'RS2': 269, 'RS3': 254}
reading (b) (b) rate medians {'RS1': 1.757, 'RS2': 1.144, 'RS3': 1.182}, KW p = 8.7e-04, Holm RS1-RS2 8.6e-03, RS1-RS3 2.4e-03
reading (b) (b) cv medians {'RS1': 1.619, 'RS2': 1.825, 'RS3': 1.779}, KW p = 8.3e-10, Holm RS1-RS2 2.9e-09, RS1-RS3 1.9e-05
reading (b) (b) lv medians {'RS1': 1.164, 'RS2': 1.262, 'RS3': 1.254}, KW p = 8.5e-03, Holm RS1-RS2 2.5e-02, RS1-RS3 2.5e-02
units {'RS1': 405, 'RS2': 281, 'RS3': 265}
Source Data labels (a) rate medians {'RS1': 3.791, 'RS2': 2.265, 'RS3': 3.118}, KW p = 1.3e-02, Holm RS1-RS2 9.7e-03, RS1-RS3 6.2e-01
Source Data labels (a) cv medians {'RS1': 1.191, 'RS2': 1.232, 'RS3': 1.268}, KW p = 2.0e-01, Holm RS1-RS2 2.6e-01, RS1-RS3 6.5e-01
Source Data labels (a) lv medians {'RS1': 0.765, 'RS2': 0.856, 'RS3': 0.801}, KW p = 2.0e-01, Holm RS1-RS2 2.0e-01, RS1-RS3 8.8e-01
units {'RS1': 203, 'RS2': 76, 'RS3': 64}
Source Data labels (b) rate medians {'RS1': 3.849, 'RS2': 2.32, 'RS3': 3.43}, KW p = 1.6e-02, Holm RS1-RS2 1.2e-02, RS1-RS3 5.2e-01
Source Data labels (b) cv medians {'RS1': 1.545, 'RS2': 1.74, 'RS3': 1.658}, KW p = 6.5e-04, Holm RS1-RS2 1.2e-03, RS1-RS3 4.3e-02
Source Data labels (b) lv medians {'RS1': 0.871, 'RS2': 1.023, 'RS3': 0.864}, KW p = 3.6e-02, Holm RS1-RS2 2.9e-02, RS1-RS3 4.4e-01
units {'RS1': 204, 'RS2': 76, 'RS3': 64}
rate_dg against Source Data Rate: 354 units, median |diff| 0.926, Spearman r 0.900
rate_dg_blocks against Source Data Rate: 354 units, median |diff| 0.834, Spearman r 0.936
cv_dg_a against Source Data CV: 354 units, median |diff| 0.629, Spearman r 0.502
cv_dg_b against Source Data CV: 354 units, median |diff| 0.220, Spearman r 0.848
lv_dg_a against Source Data LV: 354 units, median |diff| 0.099, Spearman r 0.830
lv_dg_b against Source Data LV: 354 units, median |diff| 0.084, Spearman r 0.923
Source Data units of Fig3a_rate_cv_lv in the held sessions: 354 of 745 ; by cluster here (Source Data labels): {'RS1': 211, 'RS2': 76, 'RS3': 67}
Result: partially reproduced, resting on an assumption. Under reading (c) one of the three measures holds under each period reading. Over the drifting-grating blocks (the period whose CV matches the Source Data best, Spearman 0.848 against 0.502), RS1 has the lower CV (1.54 against 1.76 and 1.68; omnibus p = 1.8e-05, Holm 4.5e-05 and 0.0035), but the rate (Holm p = 0.051 and 0.051) and LV (0.048 and 0.054) miss in one comparison each. Within presentations only the rate holds (3.92 against 2.56 and 2.26 Hz, Holm p = 0.032 and 0.037). Reading (a) gives all three under the block reading (each Holm p below 0.02); on the Source Data labels RS1 differs from RS3 only in CV. The unit counts (166, 75, 87) come from 13 of 25 sessions.
fig3a-rs23-visual-responses¶
RS2 and RS3 have higher f1/f0, modulation index and lifetime sparseness to drifting gratings than RS1.
The three metrics as AllenSDK defines them (helper dg_metrics, which reproduces the Source
Data values on shared units, below). Units as fig3a-rs1-excitability.
ms = sd_table("Fig3a_stimulus_metrics").set_index("unit_id")
sh = ms.index.intersection(units.index)
for c in ["f1_f0_dg", "mod_idx_dg", "lifetime_sparseness_dg"]:
d = np.abs(units.loc[sh, c].astype(float) - ms.loc[sh, c].astype(float))
print(f"{c}: {len(sh)} shared units, equal (<1e-6) for {np.mean(d < 1e-6):.1%}, max |diff| {d.max():.2e}")
VIS = ["f1_f0_dg", "mod_idx_dg", "lifetime_sparseness_dg"]
for r in READINGS:
t = active(T[r], "n_dg")
for c in VIS:
k = three(t, c, ["RS1", "RS2", "RS3"])
print(f"{READINGS[r]:18s} {c:23s} medians {dict((g, round(v, 3)) for g, v in k['medians'].items())}, KW p = {k['p']:.1e}, "
f"Holm RS1-RS2 {k['post']['RS1-RS2']:.1e}, RS1-RS3 {k['post']['RS1-RS3']:.1e}")
print(" units", t.six.value_counts().reindex(["RS1", "RS2", "RS3"]).to_dict())
f1_f0_dg: 354 shared units, equal (<1e-6) for 98.9%, max |diff| 2.82e-01
mod_idx_dg: 354 shared units, equal (<1e-6) for 98.9%, max |diff| 1.41e+00
lifetime_sparseness_dg: 354 shared units, equal (<1e-6) for 100.0%, max |diff| 6.80e-16
reading (c) f1_f0_dg medians {'RS1': 0.477, 'RS2': 0.623, 'RS3': 0.627}, KW p = 1.6e-02, Holm RS1-RS2 4.0e-02, RS1-RS3 5.6e-02
reading (c) mod_idx_dg medians {'RS1': 0.903, 'RS2': 1.053, 'RS3': 1.111}, KW p = 2.1e-01, Holm RS1-RS2 2.3e-01, RS1-RS3 8.1e-01
reading (c) lifetime_sparseness_dg medians {'RS1': 0.206, 'RS2': 0.335, 'RS3': 0.244}, KW p = 2.2e-03, Holm RS1-RS2 2.7e-03, RS1-RS3 6.5e-02
units {'RS1': 165, 'RS2': 75, 'RS3': 87}
reading (a) f1_f0_dg medians {'RS1': 0.631, 'RS2': 0.838, 'RS3': 0.787}, KW p = 2.9e-03, Holm RS1-RS2 1.4e-02, RS1-RS3 1.1e-02
reading (a) mod_idx_dg medians {'RS1': 0.997, 'RS2': 1.144, 'RS3': 1.517}, KW p = 5.2e-02, Holm RS1-RS2 1.5e-01, RS1-RS3 8.9e-02
reading (a) lifetime_sparseness_dg medians {'RS1': 0.259, 'RS2': 0.405, 'RS3': 0.385}, KW p = 6.6e-04, Holm RS1-RS2 3.3e-03, RS1-RS3 5.2e-03
units {'RS1': 235, 'RS2': 122, 'RS3': 128}
reading (b) f1_f0_dg medians {'RS1': 0.753, 'RS2': 0.83, 'RS3': 0.89}, KW p = 1.0e-02, Holm RS1-RS2 1.1e-01, RS1-RS3 1.0e-02
reading (b) mod_idx_dg medians {'RS1': 1.053, 'RS2': 1.25, 'RS3': 1.421}, KW p = 1.4e-02, Holm RS1-RS2 2.4e-02, RS1-RS3 5.9e-02
reading (b) lifetime_sparseness_dg medians {'RS1': 0.287, 'RS2': 0.398, 'RS3': 0.372}, KW p = 2.6e-05, Holm RS1-RS2 3.9e-05, RS1-RS3 3.1e-03
units {'RS1': 391, 'RS2': 269, 'RS3': 254}
Source Data labels f1_f0_dg medians {'RS1': 0.479, 'RS2': 0.661, 'RS3': 0.566}, KW p = 1.8e-02, Holm RS1-RS2 1.6e-02, RS1-RS3 8.5e-01
Source Data labels mod_idx_dg medians {'RS1': 0.997, 'RS2': 1.055, 'RS3': 1.101}, KW p = 2.9e-01, Holm RS1-RS2 3.4e-01, RS1-RS3 1.0e+00
Source Data labels lifetime_sparseness_dg medians {'RS1': 0.206, 'RS2': 0.312, 'RS3': 0.237}, KW p = 1.3e-02, Holm RS1-RS2 1.0e-02, RS1-RS3 3.6e-01
units {'RS1': 203, 'RS2': 76, 'RS3': 64}
Result: not reproduced, resting on an assumption. With the AllenSDK metrics (which reproduce the Source Data values exactly for 98.9 to 100% of shared units), RS1 has the lowest f1/f0 and lifetime sparseness under reading (c), but in each the RS1 against RS3 test fails (Holm p = 0.056 and 0.065), and the modulation index does not differ (omnibus p = 0.21). On the Source Data labels also only the RS1 against RS2 comparisons hold. Under reading (a), f1/f0 and lifetime sparseness hold in full (Holm p below 0.015), which would make the claim partially reproduced.
fig3a-fs-visual-absent¶
FS1 to FS3 do not differ significantly in their visual responses to drifting gratings.
for r in READINGS:
t = active(T[r], "n_dg")
for c in VIS:
k = three(t, c, ["FS1", "FS2", "FS3"])
print(f"{READINGS[r]:18s} {c:23s} medians {dict((g, round(v, 3)) for g, v in k['medians'].items())}, KW H = {k['H']:.2f}, p = {k['p']:.3f}")
print(" units", t.six.value_counts().reindex(["FS1", "FS2", "FS3"]).to_dict())
reading (c) f1_f0_dg medians {'FS1': 0.499, 'FS2': 0.495, 'FS3': 0.487}, KW H = 0.37, p = 0.833
reading (c) mod_idx_dg medians {'FS1': 1.15, 'FS2': 1.166, 'FS3': 1.293}, KW H = 0.24, p = 0.887
reading (c) lifetime_sparseness_dg medians {'FS1': 0.158, 'FS2': 0.159, 'FS3': 0.154}, KW H = 0.06, p = 0.969
units {'FS1': 48, 'FS2': 28, 'FS3': 22}
reading (a) f1_f0_dg medians {'FS1': 0.495, 'FS2': 0.495, 'FS3': 0.498}, KW H = 0.22, p = 0.898
reading (a) mod_idx_dg medians {'FS1': 1.14, 'FS2': 1.179, 'FS3': 1.01}, KW H = 0.05, p = 0.976
reading (a) lifetime_sparseness_dg medians {'FS1': 0.166, 'FS2': 0.156, 'FS3': 0.16}, KW H = 0.03, p = 0.986
units {'FS1': 52, 'FS2': 36, 'FS3': 27}
reading (b) f1_f0_dg medians {'FS1': 0.596, 'FS2': 0.536, 'FS3': 0.662}, KW H = 3.97, p = 0.137
reading (b) mod_idx_dg medians {'FS1': 0.945, 'FS2': 1.145, 'FS3': 1.107}, KW H = 1.54, p = 0.464
reading (b) lifetime_sparseness_dg medians {'FS1': 0.141, 'FS2': 0.142, 'FS3': 0.152}, KW H = 0.34, p = 0.843
units {'FS1': 109, 'FS2': 50, 'FS3': 56}
Source Data labels f1_f0_dg medians {'FS1': 0.555, 'FS2': 0.486, 'FS3': 0.432}, KW H = 2.42, p = 0.298
Source Data labels mod_idx_dg medians {'FS1': 1.383, 'FS2': 1.599, 'FS3': 0.776}, KW H = 2.57, p = 0.277
Source Data labels lifetime_sparseness_dg medians {'FS1': 0.177, 'FS2': 0.141, 'FS3': 0.139}, KW H = 3.59, p = 0.166
units {'FS1': 51, 'FS2': 29, 'FS3': 19}
Result: reproduced. No metric differs across FS1 to FS3 (Kruskal-Wallis p = 0.833, 0.887 and 0.969, reading c; all p above 0.13 under readings a and b and the Source Data labels).
fig3c-fs-more-phase-locked¶
During drifting gratings a larger share of FS than RS units is phase-locked to the LFP in every band (theta 96.6% against 86.7%, alpha 86.7% against 63.9%, beta 88.2% against 67.7%, low gamma 83.3% against 58.1%, high gamma 91.1% against 68.5%).
Units with EAP amplitude above 50 uV and at least 100 spikes during drifting gratings, at most 10,000 spikes; Hilbert phase of the band-passed LFP (5th-order Butterworth, zero phase); phase-locked when the Rayleigh p < 0.001 (Methods). Spikes are those inside the presentations; the LFP is filtered over each whole block (a standard choice, to keep filter edges away from the spikes). The readings of the criterion: LFP channel (a) the nearest other than the peak channel, (b) the nearest on the other side; a third channel, (c) the nearest at least 100 um from the peak channel, checks that the unit's own spikes do not carry the locking (not a reading of the criterion); the cap (first) the first 10,000 spikes, (random) a random 10,000; band edges of the Results or of the Methods (alpha and beta). Two-sample z tests for proportions, Holm-corrected over the five bands.
PH = pd.concat([R[s]["phase"].assign(session=s) for s in ALL_SESSIONS], ignore_index=True)
BANDS = ["theta", "alpha", "beta", "low_gamma", "high_gamma"]
EXP = {"theta": (96.6, 86.7), "alpha": (86.7, 63.9), "beta": (88.2, 67.7), "low_gamma": (83.3, 58.1),
"high_gamma": (91.1, 68.5)}
def phase_table(period, lfp, cap, bandset):
"""One row per unit and band, for the chosen readings; the Methods band set replaces only
alpha and beta."""
p = PH[(PH.period == period) & (PH.lfp == lfp) & (PH.cap == cap)]
res = p[p.bands == "results"]
if bandset == "methods":
res = pd.concat([res[~res.band.isin(["alpha", "beta"])], p[p.bands == "methods"]])
return res
def eligible(t, r, nspk="n_dg"):
tt = T[r]
ok = tt.index[(tt.A > 50) & (tt[nspk] >= 100)]
return t[t.unit_id.isin(ok)].merge(tt[["onech", "six", "depth_csd", "session"]], left_on="unit_id",
right_index=True, suffixes=("", "_u"))
def percent_locked(t):
out = {}
for b in BANDS:
x = t[t.band == b]
k = {g: (int((x[x.onech == g].p < 0.001).sum()), int((x.onech == g).sum())) for g in ("FS", "RS")}
out[b] = k
return out
combos = [(lfp, cap, bs) for lfp in "abc" for cap in ("first", "random0") for bs in ("results", "methods")]
pl_summary = []
for r in READINGS:
for lfp, cap, bs in combos:
t = eligible(phase_table("dg", lfp, cap, bs), r)
pc = percent_locked(t)
zp = [W.two_prop_z(*pc[b]["FS"], *pc[b]["RS"]) for b in BANDS]
adj = W.holm([z[1] for z in zp])
row = {"labels": r, "lfp": lfp, "cap": cap, "bands": bs,
"n_FS": pc["theta"]["FS"][1], "n_RS": pc["theta"]["RS"][1]}
for b, a_ in zip(BANDS, adj):
fs_, rs_ = (100 * pc[b][g][0] / pc[b][g][1] for g in ("FS", "RS"))
row[f"{b}_FS"], row[f"{b}_RS"], row[f"{b}_pHolm"] = round(fs_, 1), round(rs_, 1), float("%.1e" % a_)
row["bands FS>RS p<0.05"] = sum(row[f"{b}_FS"] > row[f"{b}_RS"] and row[f"{b}_pHolm"] < 0.05 for b in BANDS)
row["FS>RS all, p<0.05"] = all(row[f"{b}_FS"] > row[f"{b}_RS"] and row[f"{b}_pHolm"] < 0.05 for b in BANDS)
row["all within tol"] = all(abs(row[f"{b}_FS"] - EXP[b][0]) <= 0.1 * EXP[b][0] and
abs(row[f"{b}_RS"] - EXP[b][1]) <= 0.1 * EXP[b][1] for b in BANDS)
pl_summary.append(row)
pl_summary = pd.DataFrame(pl_summary)
print(pl_summary.to_string(index=False))
print("LFP (c), the nearest LFP channel at least 100 um from the peak channel, against LFP (a), reading (c), first spikes, Results bands:")
print(pl_summary[(pl_summary.labels == "c") & (pl_summary.cap == "first") & (pl_summary.bands == "results")][["lfp"] + [f"{b}_{g}" for b in BANDS for g in ("FS", "RS")]].to_string(index=False))
# seed: the random cap under the five seeds, reading (c), LFP (a), Results bands
for k in range(5):
t = eligible(phase_table("dg", "a", f"random{k}", "results"), "c")
pc = percent_locked(t)
print(f"seed +{1000 * k}:", {b: (round(100 * pc[b]['FS'][0] / pc[b]['FS'][1], 1), round(100 * pc[b]['RS'][0] / pc[b]['RS'][1], 1)) for b in BANDS})
print("units per session (reading c, FS/RS):", eligible(phase_table("dg", "a", "first", "results"), "c")
.query("band == 'theta'").groupby(["session", "onech"]).size().unstack().to_dict())
labels lfp cap bands n_FS n_RS theta_FS theta_RS theta_pHolm alpha_FS alpha_RS alpha_pHolm beta_FS beta_RS beta_pHolm low_gamma_FS low_gamma_RS low_gamma_pHolm high_gamma_FS high_gamma_RS high_gamma_pHolm bands FS>RS p<0.05 FS>RS all, p<0.05 all within tol
c a first results 98 327 98.0 96.3 0.850 85.7 82.3 0.850 94.9 84.7 0.034000 91.8 77.4 0.007300 93.9 85.6 9.000000e-02 2 False False
c a first methods 98 327 98.0 96.3 0.640 85.7 81.3 0.640 94.9 84.7 0.034000 91.8 77.4 0.007300 93.9 85.6 9.000000e-02 2 False False
c a random0 results 98 327 98.0 96.6 0.500 86.7 81.7 0.480 94.9 84.7 0.034000 90.8 77.1 0.014000 93.9 85.9 1.100000e-01 2 False False
c a random0 methods 98 327 98.0 96.6 0.500 86.7 80.7 0.350 94.9 84.7 0.034000 90.8 77.1 0.014000 93.9 85.9 1.100000e-01 2 False False
c b first results 98 327 96.9 96.0 0.680 83.7 78.0 0.450 94.9 82.0 0.006700 89.8 73.1 0.002900 92.9 85.9 2.100000e-01 2 False False
c b first methods 98 327 96.9 96.0 0.680 83.7 77.1 0.320 94.9 81.7 0.005600 89.8 73.1 0.002900 92.9 85.9 2.100000e-01 2 False False
c b random0 results 98 327 98.0 96.3 0.430 84.7 78.0 0.320 94.9 82.0 0.006700 89.8 73.1 0.002900 91.8 85.6 3.200000e-01 2 False False
c b random0 methods 98 327 98.0 96.3 0.430 84.7 77.1 0.310 95.9 82.6 0.003800 89.8 73.1 0.002900 91.8 85.6 3.100000e-01 2 False False
c c first results 98 327 99.0 97.2 0.640 88.8 85.6 0.640 95.9 89.6 0.160000 91.8 80.4 0.033000 88.8 66.1 6.500000e-05 2 False False
c c first methods 98 327 99.0 97.2 0.640 86.7 84.7 0.640 95.9 89.0 0.120000 91.8 80.4 0.033000 88.8 66.1 6.500000e-05 2 False False
c c random0 results 98 327 99.0 97.2 0.580 89.8 85.6 0.580 95.9 89.3 0.140000 91.8 80.4 0.033000 87.8 66.4 2.000000e-04 2 False False
c c random0 methods 98 327 99.0 97.2 0.410 89.8 84.7 0.410 95.9 89.0 0.120000 91.8 80.4 0.033000 87.8 66.4 2.000000e-04 2 False False
a a first results 115 485 98.3 94.4 0.130 86.1 78.4 0.130 96.5 81.6 0.000220 92.2 73.2 0.000058 95.7 76.9 2.500000e-05 3 False False
a a first methods 115 485 98.3 94.4 0.085 87.0 77.9 0.061 96.5 81.9 0.000260 92.2 73.2 0.000058 95.7 76.9 2.500000e-05 3 False False
a a random0 results 115 485 98.3 94.6 0.098 87.8 77.9 0.035 96.5 81.6 0.000220 93.0 73.0 0.000023 95.7 77.1 2.400000e-05 4 False False
a a random0 methods 115 485 98.3 94.6 0.098 88.7 77.5 0.015 96.5 81.9 0.000260 93.0 73.0 0.000023 95.7 77.1 2.400000e-05 4 False False
a b first results 115 485 97.4 94.6 0.220 85.2 75.5 0.049 96.5 78.4 0.000028 89.6 69.3 0.000041 94.8 77.7 8.400000e-05 4 False False
a b first methods 115 485 97.4 94.6 0.220 84.3 74.6 0.055 96.5 77.9 0.000020 89.6 69.3 0.000041 94.8 77.7 8.400000e-05 3 False False
a b random0 results 115 485 97.4 94.8 0.240 86.1 75.5 0.028 96.5 78.4 0.000022 90.4 69.3 0.000020 93.9 77.5 1.900000e-04 4 False False
a b random0 methods 115 485 97.4 94.8 0.240 86.1 74.6 0.018 97.4 78.6 0.000010 90.4 69.3 0.000016 93.9 77.5 1.900000e-04 4 False False
a c first results 115 485 100.0 95.7 0.035 91.3 82.3 0.035 97.4 86.8 0.003600 93.9 75.9 0.000070 91.3 59.4 4.800000e-10 5 True False
a c first methods 115 485 100.0 95.7 0.046 88.7 81.6 0.071 97.4 86.8 0.003600 93.9 75.9 0.000070 91.3 59.4 4.800000e-10 4 False False
a c random0 results 115 485 100.0 95.7 0.023 92.2 82.3 0.018 97.4 86.6 0.003100 93.9 75.9 0.000070 90.4 59.6 2.000000e-09 5 True False
a c random0 methods 115 485 100.0 95.7 0.024 91.3 81.6 0.024 97.4 86.8 0.003600 93.9 75.9 0.000070 90.4 59.6 2.000000e-09 5 True False
b a first results 215 914 94.0 95.6 0.720 80.5 80.1 0.900 87.4 84.2 0.720000 83.7 76.0 0.076000 84.2 77.9 1.700000e-01 0 False False
b a first methods 215 914 94.0 95.6 0.890 80.9 79.4 0.890 87.4 84.8 0.890000 83.7 76.0 0.076000 84.2 77.9 1.700000e-01 0 False False
b a random0 results 215 914 94.4 95.8 0.720 80.9 79.9 0.730 87.4 84.2 0.720000 83.7 75.8 0.064000 84.2 78.0 1.800000e-01 0 False False
b a random0 methods 215 914 94.4 95.8 0.970 81.9 79.3 0.970 87.4 84.8 0.970000 83.7 75.8 0.064000 84.2 78.0 1.800000e-01 0 False False
b b first results 215 914 94.0 95.6 0.600 80.5 77.2 0.600 87.4 80.9 0.093000 81.9 72.2 0.018000 82.8 77.9 3.400000e-01 1 False False
b b first methods 215 914 94.0 95.6 0.460 80.0 76.1 0.460 87.9 80.5 0.045000 81.9 72.2 0.018000 82.8 77.9 3.400000e-01 2 False False
b b random0 results 215 914 94.4 95.8 0.460 80.9 77.1 0.460 87.4 80.9 0.093000 81.9 72.0 0.015000 82.3 77.8 4.300000e-01 1 False False
b b random0 methods 215 914 94.4 95.8 0.380 80.9 76.0 0.380 88.4 80.9 0.037000 81.9 72.0 0.015000 82.3 77.8 3.800000e-01 2 False False
b c first results 215 914 95.8 96.1 1.000 82.3 83.7 1.000 87.4 88.6 1.000000 83.3 77.7 0.290000 81.4 60.0 1.900000e-08 1 False False
b c first methods 215 914 95.8 96.1 1.000 80.5 83.2 1.000 87.4 88.8 1.000000 83.3 77.7 0.290000 81.4 60.0 1.900000e-08 1 False False
b c random0 results 215 914 95.8 96.2 1.000 81.9 83.7 1.000 87.4 88.5 1.000000 83.3 77.7 0.290000 80.9 60.2 5.700000e-08 1 False False
b c random0 methods 215 914 95.8 96.2 1.000 81.9 83.2 1.000 87.4 88.8 1.000000 83.3 77.7 0.290000 80.9 60.2 5.700000e-08 1 False False
sd a first results 99 343 99.0 96.8 0.240 88.9 82.2 0.230 97.0 85.4 0.007300 92.9 77.8 0.003500 94.9 86.0 4.700000e-02 3 False False
sd a first methods 99 343 99.0 96.8 0.240 88.9 81.3 0.160 97.0 85.4 0.007300 92.9 77.8 0.003500 94.9 86.0 4.700000e-02 3 False False
sd a random0 results 99 343 99.0 97.4 0.340 88.9 81.6 0.180 97.0 85.4 0.007300 93.9 77.8 0.001400 96.0 86.0 2.000000e-02 3 False False
sd a random0 methods 99 343 99.0 97.4 0.340 88.9 81.0 0.140 97.0 85.4 0.007300 93.9 77.8 0.001400 96.0 86.0 2.000000e-02 3 False False
sd b first results 99 343 98.0 96.2 0.390 87.9 78.7 0.087 96.0 83.1 0.004600 90.9 73.8 0.001600 93.9 85.7 8.700000e-02 2 False False
sd b first methods 99 343 98.0 96.2 0.390 86.9 77.8 0.097 96.0 82.8 0.003900 90.9 73.8 0.001600 93.9 85.7 8.700000e-02 2 False False
sd b random0 results 99 343 99.0 96.8 0.240 87.9 78.7 0.120 97.0 83.1 0.001700 91.9 74.1 0.000770 92.9 85.4 1.200000e-01 2 False False
sd b random0 methods 99 343 99.0 96.8 0.240 88.9 77.8 0.045 97.0 83.4 0.002000 91.9 74.1 0.000770 92.9 85.4 9.900000e-02 3 False False
sd c first results 99 343 100.0 97.7 0.150 92.9 86.3 0.150 98.0 90.1 0.034000 94.9 81.9 0.005800 89.9 65.9 1.700000e-05 3 False False
sd c first methods 99 343 100.0 97.7 0.250 89.9 85.4 0.250 98.0 89.8 0.029000 94.9 81.9 0.005800 89.9 65.9 1.700000e-05 3 False False
sd c random0 results 99 343 100.0 97.7 0.150 92.9 86.3 0.150 98.0 90.1 0.034000 94.9 81.6 0.004900 88.9 65.9 4.400000e-05 3 False False
sd c random0 methods 99 343 100.0 97.7 0.130 92.9 85.4 0.099 98.0 89.8 0.029000 94.9 81.6 0.004900 88.9 65.9 4.400000e-05 3 False False
LFP (c), the nearest LFP channel at least 100 um from the peak channel, against LFP (a), reading (c), first spikes, Results bands:
lfp theta_FS theta_RS alpha_FS alpha_RS beta_FS beta_RS low_gamma_FS low_gamma_RS high_gamma_FS high_gamma_RS
a 98.0 96.3 85.7 82.3 94.9 84.7 91.8 77.4 93.9 85.6
b 96.9 96.0 83.7 78.0 94.9 82.0 89.8 73.1 92.9 85.9
c 99.0 97.2 88.8 85.6 95.9 89.6 91.8 80.4 88.8 66.1
seed +0: {'theta': (98.0, 96.6), 'alpha': (86.7, 81.7), 'beta': (94.9, 84.7), 'low_gamma': (90.8, 77.1), 'high_gamma': (93.9, 85.9)}
seed +1000: {'theta': (98.0, 96.6), 'alpha': (85.7, 81.3), 'beta': (94.9, 84.7), 'low_gamma': (91.8, 77.7), 'high_gamma': (93.9, 85.6)}
seed +2000: {'theta': (98.0, 97.2), 'alpha': (85.7, 81.0), 'beta': (94.9, 84.7), 'low_gamma': (91.8, 77.1), 'high_gamma': (94.9, 85.3)}
seed +3000: {'theta': (98.0, 97.2), 'alpha': (83.7, 81.7), 'beta': (95.9, 84.7), 'low_gamma': (91.8, 77.7), 'high_gamma': (94.9, 85.6)}
seed +4000: {'theta': (98.0, 97.2), 'alpha': (85.7, 81.3), 'beta': (93.9, 84.7), 'low_gamma': (91.8, 77.4), 'high_gamma': (93.9, 85.9)}
units per session (reading c, FS/RS): {'FS': {732592105: 12, 739448407: 1, 744228101: 6, 750332458: 8, 750749662: 5, 754312389: 7, 754829445: 10, 757216464: 17, 757970808: 5, 759883607: 6, 761418226: 7, 763673393: 10, 799864342: 4}, 'RS': {732592105: 53, 739448407: 8, 744228101: 9, 750332458: 23, 750749662: 15, 754312389: 38, 754829445: 34, 757216464: 29, 757970808: 25, 759883607: 16, 761418226: 16, 763673393: 35, 799864342: 26}}
Result: not reproduced, resting on an assumption. Under reading (c), in every combination of the LFP, cap and band readings, a larger share of FS than RS units is phase-locked in all five bands (LFP a, first spikes: theta 98.0 against 96.3%, alpha 85.7 against 82.3%, beta 94.9 against 84.7%, low gamma 91.8 against 77.4%, high gamma 93.9 against 85.6%), but the Holm-corrected z test gives p < 0.05 in only two bands (beta and low gamma), with 98 FS and 327 RS units. Several RS percentages are above the paper's tolerance (alpha 82.3 against 63.9 +- 6.39). Reading (a) (115 FS, 485 RS) gives 3 or 4 significant bands under LFP readings (a) and (b), which would make it partially reproduced (5 only with LFP c, which is not a reading of the criterion); the Source Data labels give 2 or 3.
fig3c-rs-prefers-theta¶
RS phase-locking is most common for theta and less common at higher frequencies (beta, low and high gamma), while the share of phase-locked FS units stays high across bands.
for _, row in pl_summary.iterrows():
rs_ = [row[f"{b}_RS"] for b in BANDS]
fs_ = [row[f"{b}_FS"] for b in BANDS]
ok = (rs_[0] == max(rs_) and all(rs_[0] > rs_[i] for i in (2, 3, 4)) and np.ptp(fs_) < np.ptp(rs_))
print(f"{row['labels']:2s} lfp {row['lfp']} {row['cap']:7s} {row['bands']:7s} RS {rs_} FS {fs_}: "
f"FS range {np.ptp(fs_):.1f}, RS range {np.ptp(rs_):.1f}, holds {ok}")
c lfp a first results RS [96.3, 82.3, 84.7, 77.4, 85.6] FS [98.0, 85.7, 94.9, 91.8, 93.9]: FS range 12.3, RS range 18.9, holds True c lfp a first methods RS [96.3, 81.3, 84.7, 77.4, 85.6] FS [98.0, 85.7, 94.9, 91.8, 93.9]: FS range 12.3, RS range 18.9, holds True c lfp a random0 results RS [96.6, 81.7, 84.7, 77.1, 85.9] FS [98.0, 86.7, 94.9, 90.8, 93.9]: FS range 11.3, RS range 19.5, holds True c lfp a random0 methods RS [96.6, 80.7, 84.7, 77.1, 85.9] FS [98.0, 86.7, 94.9, 90.8, 93.9]: FS range 11.3, RS range 19.5, holds True c lfp b first results RS [96.0, 78.0, 82.0, 73.1, 85.9] FS [96.9, 83.7, 94.9, 89.8, 92.9]: FS range 13.2, RS range 22.9, holds True c lfp b first methods RS [96.0, 77.1, 81.7, 73.1, 85.9] FS [96.9, 83.7, 94.9, 89.8, 92.9]: FS range 13.2, RS range 22.9, holds True c lfp b random0 results RS [96.3, 78.0, 82.0, 73.1, 85.6] FS [98.0, 84.7, 94.9, 89.8, 91.8]: FS range 13.3, RS range 23.2, holds True c lfp b random0 methods RS [96.3, 77.1, 82.6, 73.1, 85.6] FS [98.0, 84.7, 95.9, 89.8, 91.8]: FS range 13.3, RS range 23.2, holds True c lfp c first results RS [97.2, 85.6, 89.6, 80.4, 66.1] FS [99.0, 88.8, 95.9, 91.8, 88.8]: FS range 10.2, RS range 31.1, holds True c lfp c first methods RS [97.2, 84.7, 89.0, 80.4, 66.1] FS [99.0, 86.7, 95.9, 91.8, 88.8]: FS range 12.3, RS range 31.1, holds True c lfp c random0 results RS [97.2, 85.6, 89.3, 80.4, 66.4] FS [99.0, 89.8, 95.9, 91.8, 87.8]: FS range 11.2, RS range 30.8, holds True c lfp c random0 methods RS [97.2, 84.7, 89.0, 80.4, 66.4] FS [99.0, 89.8, 95.9, 91.8, 87.8]: FS range 11.2, RS range 30.8, holds True a lfp a first results RS [94.4, 78.4, 81.6, 73.2, 76.9] FS [98.3, 86.1, 96.5, 92.2, 95.7]: FS range 12.2, RS range 21.2, holds True a lfp a first methods RS [94.4, 77.9, 81.9, 73.2, 76.9] FS [98.3, 87.0, 96.5, 92.2, 95.7]: FS range 11.3, RS range 21.2, holds True a lfp a random0 results RS [94.6, 77.9, 81.6, 73.0, 77.1] FS [98.3, 87.8, 96.5, 93.0, 95.7]: FS range 10.5, RS range 21.6, holds True a lfp a random0 methods RS [94.6, 77.5, 81.9, 73.0, 77.1] FS [98.3, 88.7, 96.5, 93.0, 95.7]: FS range 9.6, RS range 21.6, holds True a lfp b first results RS [94.6, 75.5, 78.4, 69.3, 77.7] FS [97.4, 85.2, 96.5, 89.6, 94.8]: FS range 12.2, RS range 25.3, holds True a lfp b first methods RS [94.6, 74.6, 77.9, 69.3, 77.7] FS [97.4, 84.3, 96.5, 89.6, 94.8]: FS range 13.1, RS range 25.3, holds True a lfp b random0 results RS [94.8, 75.5, 78.4, 69.3, 77.5] FS [97.4, 86.1, 96.5, 90.4, 93.9]: FS range 11.3, RS range 25.5, holds True a lfp b random0 methods RS [94.8, 74.6, 78.6, 69.3, 77.5] FS [97.4, 86.1, 97.4, 90.4, 93.9]: FS range 11.3, RS range 25.5, holds True a lfp c first results RS [95.7, 82.3, 86.8, 75.9, 59.4] FS [100.0, 91.3, 97.4, 93.9, 91.3]: FS range 8.7, RS range 36.3, holds True a lfp c first methods RS [95.7, 81.6, 86.8, 75.9, 59.4] FS [100.0, 88.7, 97.4, 93.9, 91.3]: FS range 11.3, RS range 36.3, holds True a lfp c random0 results RS [95.7, 82.3, 86.6, 75.9, 59.6] FS [100.0, 92.2, 97.4, 93.9, 90.4]: FS range 9.6, RS range 36.1, holds True a lfp c random0 methods RS [95.7, 81.6, 86.8, 75.9, 59.6] FS [100.0, 91.3, 97.4, 93.9, 90.4]: FS range 9.6, RS range 36.1, holds True b lfp a first results RS [95.6, 80.1, 84.2, 76.0, 77.9] FS [94.0, 80.5, 87.4, 83.7, 84.2]: FS range 13.5, RS range 19.6, holds True b lfp a first methods RS [95.6, 79.4, 84.8, 76.0, 77.9] FS [94.0, 80.9, 87.4, 83.7, 84.2]: FS range 13.1, RS range 19.6, holds True b lfp a random0 results RS [95.8, 79.9, 84.2, 75.8, 78.0] FS [94.4, 80.9, 87.4, 83.7, 84.2]: FS range 13.5, RS range 20.0, holds True b lfp a random0 methods RS [95.8, 79.3, 84.8, 75.8, 78.0] FS [94.4, 81.9, 87.4, 83.7, 84.2]: FS range 12.5, RS range 20.0, holds True b lfp b first results RS [95.6, 77.2, 80.9, 72.2, 77.9] FS [94.0, 80.5, 87.4, 81.9, 82.8]: FS range 13.5, RS range 23.4, holds True b lfp b first methods RS [95.6, 76.1, 80.5, 72.2, 77.9] FS [94.0, 80.0, 87.9, 81.9, 82.8]: FS range 14.0, RS range 23.4, holds True b lfp b random0 results RS [95.8, 77.1, 80.9, 72.0, 77.8] FS [94.4, 80.9, 87.4, 81.9, 82.3]: FS range 13.5, RS range 23.8, holds True b lfp b random0 methods RS [95.8, 76.0, 80.9, 72.0, 77.8] FS [94.4, 80.9, 88.4, 81.9, 82.3]: FS range 13.5, RS range 23.8, holds True b lfp c first results RS [96.1, 83.7, 88.6, 77.7, 60.0] FS [95.8, 82.3, 87.4, 83.3, 81.4]: FS range 14.4, RS range 36.1, holds True b lfp c first methods RS [96.1, 83.2, 88.8, 77.7, 60.0] FS [95.8, 80.5, 87.4, 83.3, 81.4]: FS range 15.3, RS range 36.1, holds True b lfp c random0 results RS [96.2, 83.7, 88.5, 77.7, 60.2] FS [95.8, 81.9, 87.4, 83.3, 80.9]: FS range 14.9, RS range 36.0, holds True b lfp c random0 methods RS [96.2, 83.2, 88.8, 77.7, 60.2] FS [95.8, 81.9, 87.4, 83.3, 80.9]: FS range 14.9, RS range 36.0, holds True sd lfp a first results RS [96.8, 82.2, 85.4, 77.8, 86.0] FS [99.0, 88.9, 97.0, 92.9, 94.9]: FS range 10.1, RS range 19.0, holds True sd lfp a first methods RS [96.8, 81.3, 85.4, 77.8, 86.0] FS [99.0, 88.9, 97.0, 92.9, 94.9]: FS range 10.1, RS range 19.0, holds True sd lfp a random0 results RS [97.4, 81.6, 85.4, 77.8, 86.0] FS [99.0, 88.9, 97.0, 93.9, 96.0]: FS range 10.1, RS range 19.6, holds True sd lfp a random0 methods RS [97.4, 81.0, 85.4, 77.8, 86.0] FS [99.0, 88.9, 97.0, 93.9, 96.0]: FS range 10.1, RS range 19.6, holds True sd lfp b first results RS [96.2, 78.7, 83.1, 73.8, 85.7] FS [98.0, 87.9, 96.0, 90.9, 93.9]: FS range 10.1, RS range 22.4, holds True sd lfp b first methods RS [96.2, 77.8, 82.8, 73.8, 85.7] FS [98.0, 86.9, 96.0, 90.9, 93.9]: FS range 11.1, RS range 22.4, holds True sd lfp b random0 results RS [96.8, 78.7, 83.1, 74.1, 85.4] FS [99.0, 87.9, 97.0, 91.9, 92.9]: FS range 11.1, RS range 22.7, holds True sd lfp b random0 methods RS [96.8, 77.8, 83.4, 74.1, 85.4] FS [99.0, 88.9, 97.0, 91.9, 92.9]: FS range 10.1, RS range 22.7, holds True sd lfp c first results RS [97.7, 86.3, 90.1, 81.9, 65.9] FS [100.0, 92.9, 98.0, 94.9, 89.9]: FS range 10.1, RS range 31.8, holds True sd lfp c first methods RS [97.7, 85.4, 89.8, 81.9, 65.9] FS [100.0, 89.9, 98.0, 94.9, 89.9]: FS range 10.1, RS range 31.8, holds True sd lfp c random0 results RS [97.7, 86.3, 90.1, 81.6, 65.9] FS [100.0, 92.9, 98.0, 94.9, 88.9]: FS range 11.1, RS range 31.8, holds True sd lfp c random0 methods RS [97.7, 85.4, 89.8, 81.6, 65.9] FS [100.0, 92.9, 98.0, 94.9, 88.9]: FS range 11.1, RS range 31.8, holds True
Result: reproduced. In every combination of readings the RS theta percentage is the highest (96.3% against 77.4 to 85.6% for beta and the gammas, reading c, LFP a), and the FS percentages vary over a smaller range than the RS ones (12.3 against 18.9 points). LFP (c), 100 um or more from the peak channel, gives the same (10.2 against 31.1 points).
figs7-spontaneous-less-locked¶
Far fewer FS and RS units are phase-locked during spontaneous activity than during drifting gratings, in every band.
The same method on spikes and LFP of the gray-screen intervals of 30 s or more, for units with at least 100 spikes in both periods (and EAP amplitude above 50 uV).
for r in READINGS:
for lfp, cap, bs in combos[:4] + combos[8:10]:
tt = T[r]
ok = tt.index[(tt.A > 50) & (tt.n_dg >= 100) & (tt.n_spont >= 100)]
out = {}
for period in ("dg", "spont"):
t = eligible(phase_table(period, lfp, cap, bs), r)
out[period] = percent_locked(t[t.unit_id.isin(ok)])
line = {b: tuple(round(100 * out[p][b][g][0] / max(out[p][b][g][1], 1), 1) for p in ("spont", "dg") for g in ("FS", "RS")) for b in BANDS}
lower = all(out["spont"][b][g][0] / out["spont"][b][g][1] < out["dg"][b][g][0] / out["dg"][b][g][1]
for b in BANDS for g in ("FS", "RS"))
print(f"{r:2s} lfp {lfp} {cap:7s} {bs:7s} n FS {out['spont']['theta']['FS'][1]} RS {out['spont']['theta']['RS'][1]}; "
f"(spont FS, spont RS, dg FS, dg RS) % {line}; spontaneous lower everywhere: {lower}")
c lfp a first results n FS 98 RS 327; (spont FS, spont RS, dg FS, dg RS) % {'theta': (90.8, 77.7, 98.0, 96.3), 'alpha': (67.3, 56.9, 85.7, 82.3), 'beta': (68.4, 58.4, 94.9, 84.7), 'low_gamma': (77.6, 57.8, 91.8, 77.4), 'high_gamma': (91.8, 80.1, 93.9, 85.6)}; spontaneous lower everywhere: True
c lfp a first methods n FS 98 RS 327; (spont FS, spont RS, dg FS, dg RS) % {'theta': (90.8, 77.7, 98.0, 96.3), 'alpha': (69.4, 56.3, 85.7, 81.3), 'beta': (69.4, 58.1, 94.9, 84.7), 'low_gamma': (77.6, 57.8, 91.8, 77.4), 'high_gamma': (91.8, 80.1, 93.9, 85.6)}; spontaneous lower everywhere: True
c lfp a random0 results n FS 98 RS 327; (spont FS, spont RS, dg FS, dg RS) % {'theta': (90.8, 77.7, 98.0, 96.6), 'alpha': (68.4, 56.6, 86.7, 81.7), 'beta': (68.4, 57.5, 94.9, 84.7), 'low_gamma': (77.6, 59.0, 90.8, 77.1), 'high_gamma': (91.8, 80.4, 93.9, 85.9)}; spontaneous lower everywhere: True
c lfp a random0 methods n FS 98 RS 327; (spont FS, spont RS, dg FS, dg RS) % {'theta': (90.8, 77.7, 98.0, 96.6), 'alpha': (70.4, 55.7, 86.7, 80.7), 'beta': (70.4, 57.2, 94.9, 84.7), 'low_gamma': (77.6, 59.0, 90.8, 77.1), 'high_gamma': (91.8, 80.4, 93.9, 85.9)}; spontaneous lower everywhere: True
c lfp c first results n FS 98 RS 327; (spont FS, spont RS, dg FS, dg RS) % {'theta': (92.9, 81.0, 99.0, 97.2), 'alpha': (74.5, 59.6, 88.8, 85.6), 'beta': (74.5, 57.8, 95.9, 89.6), 'low_gamma': (74.5, 47.7, 91.8, 80.4), 'high_gamma': (79.6, 46.8, 88.8, 66.1)}; spontaneous lower everywhere: True
c lfp c first methods n FS 98 RS 327; (spont FS, spont RS, dg FS, dg RS) % {'theta': (92.9, 81.0, 99.0, 97.2), 'alpha': (72.4, 58.4, 86.7, 84.7), 'beta': (74.5, 59.6, 95.9, 89.0), 'low_gamma': (74.5, 47.7, 91.8, 80.4), 'high_gamma': (79.6, 46.8, 88.8, 66.1)}; spontaneous lower everywhere: True
a lfp a first results n FS 115 RS 474; (spont FS, spont RS, dg FS, dg RS) % {'theta': (88.7, 75.3, 98.3, 94.5), 'alpha': (67.0, 50.6, 86.1, 78.5), 'beta': (70.4, 51.3, 96.5, 81.4), 'low_gamma': (76.5, 48.1, 92.2, 72.8), 'high_gamma': (91.3, 66.0, 95.7, 77.0)}; spontaneous lower everywhere: True
a lfp a first methods n FS 115 RS 474; (spont FS, spont RS, dg FS, dg RS) % {'theta': (88.7, 75.3, 98.3, 94.5), 'alpha': (67.8, 49.4, 87.0, 78.1), 'beta': (71.3, 51.3, 96.5, 81.6), 'low_gamma': (76.5, 48.1, 92.2, 72.8), 'high_gamma': (91.3, 66.0, 95.7, 77.0)}; spontaneous lower everywhere: True
a lfp a random0 results n FS 115 RS 474; (spont FS, spont RS, dg FS, dg RS) % {'theta': (89.6, 75.1, 98.3, 94.7), 'alpha': (67.8, 50.4, 87.8, 78.1), 'beta': (70.4, 50.6, 96.5, 81.4), 'low_gamma': (76.5, 48.9, 93.0, 72.6), 'high_gamma': (91.3, 66.2, 95.7, 77.2)}; spontaneous lower everywhere: True
a lfp a random0 methods n FS 115 RS 474; (spont FS, spont RS, dg FS, dg RS) % {'theta': (89.6, 75.1, 98.3, 94.7), 'alpha': (68.7, 49.2, 88.7, 77.6), 'beta': (72.2, 50.6, 96.5, 81.6), 'low_gamma': (76.5, 48.9, 93.0, 72.6), 'high_gamma': (91.3, 66.2, 95.7, 77.2)}; spontaneous lower everywhere: True
a lfp c first results n FS 115 RS 474; (spont FS, spont RS, dg FS, dg RS) % {'theta': (91.3, 76.6, 100.0, 96.0), 'alpha': (72.2, 52.1, 91.3, 82.1), 'beta': (73.9, 50.4, 97.4, 86.7), 'low_gamma': (74.8, 38.2, 93.9, 75.7), 'high_gamma': (79.1, 38.2, 91.3, 59.7)}; spontaneous lower everywhere: True
a lfp c first methods n FS 115 RS 474; (spont FS, spont RS, dg FS, dg RS) % {'theta': (91.3, 76.6, 100.0, 96.0), 'alpha': (70.4, 50.6, 88.7, 81.4), 'beta': (74.8, 51.7, 97.4, 86.7), 'low_gamma': (74.8, 38.2, 93.9, 75.7), 'high_gamma': (79.1, 38.2, 91.3, 59.7)}; spontaneous lower everywhere: True
b lfp a first results n FS 214 RS 861; (spont FS, spont RS, dg FS, dg RS) % {'theta': (85.0, 78.4, 93.9, 95.9), 'alpha': (63.1, 54.7, 80.4, 80.7), 'beta': (66.4, 55.7, 87.4, 84.7), 'low_gamma': (67.3, 49.9, 83.6, 77.4), 'high_gamma': (81.8, 64.3, 84.1, 79.6)}; spontaneous lower everywhere: True
b lfp a first methods n FS 214 RS 861; (spont FS, spont RS, dg FS, dg RS) % {'theta': (85.0, 78.4, 93.9, 95.9), 'alpha': (62.6, 52.7, 80.8, 80.3), 'beta': (67.3, 56.3, 87.4, 85.2), 'low_gamma': (67.3, 49.9, 83.6, 77.4), 'high_gamma': (81.8, 64.3, 84.1, 79.6)}; spontaneous lower everywhere: True
b lfp a random0 results n FS 214 RS 861; (spont FS, spont RS, dg FS, dg RS) % {'theta': (85.0, 78.3, 94.4, 96.2), 'alpha': (63.6, 54.4, 80.8, 80.5), 'beta': (65.9, 55.3, 87.4, 84.7), 'low_gamma': (67.3, 50.4, 83.6, 77.1), 'high_gamma': (81.3, 64.5, 84.1, 79.7)}; spontaneous lower everywhere: True
b lfp a random0 methods n FS 214 RS 861; (spont FS, spont RS, dg FS, dg RS) % {'theta': (85.0, 78.3, 94.4, 96.2), 'alpha': (63.1, 52.4, 81.8, 80.1), 'beta': (67.3, 55.9, 87.4, 85.2), 'low_gamma': (67.3, 50.4, 83.6, 77.1), 'high_gamma': (81.3, 64.5, 84.1, 79.7)}; spontaneous lower everywhere: True
b lfp c first results n FS 214 RS 861; (spont FS, spont RS, dg FS, dg RS) % {'theta': (85.5, 79.6, 95.8, 96.6), 'alpha': (66.4, 55.6, 82.2, 84.1), 'beta': (69.6, 53.7, 87.4, 89.2), 'low_gamma': (66.8, 40.8, 83.2, 79.0), 'high_gamma': (71.0, 41.5, 81.3, 61.7)}; spontaneous lower everywhere: True
b lfp c first methods n FS 214 RS 861; (spont FS, spont RS, dg FS, dg RS) % {'theta': (85.5, 79.6, 95.8, 96.6), 'alpha': (65.4, 54.4, 80.4, 83.5), 'beta': (69.2, 55.2, 87.4, 89.3), 'low_gamma': (66.8, 40.8, 83.2, 79.0), 'high_gamma': (71.0, 41.5, 81.3, 61.7)}; spontaneous lower everywhere: True
sd lfp a first results n FS 99 RS 343; (spont FS, spont RS, dg FS, dg RS) % {'theta': (91.9, 79.3, 99.0, 96.8), 'alpha': (69.7, 59.2, 88.9, 82.2), 'beta': (71.7, 60.9, 97.0, 85.4), 'low_gamma': (79.8, 59.2, 92.9, 77.8), 'high_gamma': (92.9, 79.9, 94.9, 86.0)}; spontaneous lower everywhere: True
sd lfp a first methods n FS 99 RS 343; (spont FS, spont RS, dg FS, dg RS) % {'theta': (91.9, 79.3, 99.0, 96.8), 'alpha': (70.7, 58.0, 88.9, 81.3), 'beta': (72.7, 60.3, 97.0, 85.4), 'low_gamma': (79.8, 59.2, 92.9, 77.8), 'high_gamma': (92.9, 79.9, 94.9, 86.0)}; spontaneous lower everywhere: True
sd lfp a random0 results n FS 99 RS 343; (spont FS, spont RS, dg FS, dg RS) % {'theta': (91.9, 79.3, 99.0, 97.4), 'alpha': (69.7, 58.9, 88.9, 81.6), 'beta': (70.7, 60.1, 97.0, 85.4), 'low_gamma': (79.8, 60.1, 93.9, 77.8), 'high_gamma': (92.9, 80.2, 96.0, 86.0)}; spontaneous lower everywhere: True
sd lfp a random0 methods n FS 99 RS 343; (spont FS, spont RS, dg FS, dg RS) % {'theta': (91.9, 79.3, 99.0, 97.4), 'alpha': (70.7, 57.4, 88.9, 81.0), 'beta': (72.7, 59.5, 97.0, 85.4), 'low_gamma': (79.8, 60.1, 93.9, 77.8), 'high_gamma': (92.9, 80.2, 96.0, 86.0)}; spontaneous lower everywhere: True
sd lfp c first results n FS 99 RS 343; (spont FS, spont RS, dg FS, dg RS) % {'theta': (93.9, 81.6, 100.0, 97.7), 'alpha': (75.8, 61.8, 92.9, 86.3), 'beta': (75.8, 60.3, 98.0, 90.1), 'low_gamma': (76.8, 48.7, 94.9, 81.9), 'high_gamma': (81.8, 46.6, 89.9, 65.9)}; spontaneous lower everywhere: True
sd lfp c first methods n FS 99 RS 343; (spont FS, spont RS, dg FS, dg RS) % {'theta': (93.9, 81.6, 100.0, 97.7), 'alpha': (73.7, 60.6, 89.9, 85.4), 'beta': (75.8, 61.8, 98.0, 89.8), 'low_gamma': (76.8, 48.7, 94.9, 81.9), 'high_gamma': (81.8, 46.6, 89.9, 65.9)}; spontaneous lower everywhere: True
Result: partially reproduced. For units active in both periods, fewer units are phase-locked during the gray screen than during gratings in every band, for FS and RS (reading c), but far more than the paper reports: theta 90.8% of FS and 77.7% of RS against 19.5 and 4.7%. The LFP channel 100 um or more from the peak channel gives as many (theta 92.9 and 81.0%), so the unit's own spike waveform on the nearest channel does not explain the high spontaneous locking; it does raise the RS high-gamma share (80.1% with LFP a, 46.8% with LFP c).
fig3c-fs-stronger-earlier¶
FS units phase-lock more strongly (higher kappa) than RS units across bands and spike earlier in the cycle than RS units in beta and low gamma.
Kappa and preferred phase of each phase-locked unit and band. Readings of kappa: (kappa) the pycircstat von Mises estimate, (R) the mean resultant length. "Earlier in the cycle" is read as a lower preferred phase (degrees from 0 to 360, 180 at the trough). Two-sided Mann-Whitney tests, Holm-corrected over the five bands. Shown for LFP (a) and (b), first 10,000 spikes and Results band edges; the other cap and band readings change the percentages above by at most a few units.
def locked(period, lfp, r, cap="first", bs="results"):
t = eligible(phase_table(period, lfp, cap, bs), r)
return t[t.p < 0.001]
def compare(t, col, a="FS", b="RS", grp="onech", bands=BANDS):
raw, med = [], {}
for band in bands:
x = t[t.band == band]
va, vb = x.loc[x[grp] == a, col].values, x.loc[x[grp] == b, col].values
raw.append(stats.mannwhitneyu(va, vb, alternative="two-sided").pvalue if len(va) and len(vb) else np.nan)
med[band] = (round(float(np.median(va)), 3) if len(va) else np.nan, round(float(np.median(vb)), 3) if len(vb) else np.nan)
return med, W.holm(raw), raw
for r in READINGS:
for lfp in "ab":
t = locked("dg", lfp, r)
for col in ("kappa", "R", "phase"):
med, adj, _ = compare(t, col)
print(f"{READINGS[r]:18s} LFP {lfp} {col:5s} (FS, RS) medians {med}; Holm p {[float('%.1e' % x) for x in adj]}")
reading (c) LFP a kappa (FS, RS) medians {'theta': (0.558, 0.489), 'alpha': (0.34, 0.266), 'beta': (0.445, 0.36), 'low_gamma': (0.353, 0.254), 'high_gamma': (0.292, 0.205)}; Holm p [0.072, 0.12, 0.072, 0.034, 2.4e-06]
reading (c) LFP a R (FS, RS) medians {'theta': (0.269, 0.237), 'alpha': (0.168, 0.132), 'beta': (0.217, 0.177), 'low_gamma': (0.174, 0.126), 'high_gamma': (0.144, 0.102)}; Holm p [0.072, 0.12, 0.072, 0.034, 2.4e-06]
reading (c) LFP a phase (FS, RS) medians {'theta': (188.706, 183.746), 'alpha': (190.356, 187.828), 'beta': (176.08, 174.347), 'low_gamma': (178.069, 184.81), 'high_gamma': (205.698, 195.264)}; Holm p [1.0, 1.0, 1.0, 1.0, 1.0]
reading (c) LFP b kappa (FS, RS) medians {'theta': (0.552, 0.464), 'alpha': (0.311, 0.25), 'beta': (0.38, 0.326), 'low_gamma': (0.312, 0.246), 'high_gamma': (0.273, 0.22)}; Holm p [0.082, 0.21, 0.21, 0.091, 0.0011]
reading (c) LFP b R (FS, RS) medians {'theta': (0.266, 0.226), 'alpha': (0.154, 0.124), 'beta': (0.187, 0.161), 'low_gamma': (0.154, 0.122), 'high_gamma': (0.135, 0.109)}; Holm p [0.082, 0.21, 0.21, 0.091, 0.0011]
reading (c) LFP b phase (FS, RS) medians {'theta': (178.642, 177.524), 'alpha': (186.433, 188.172), 'beta': (170.454, 168.671), 'low_gamma': (168.402, 183.337), 'high_gamma': (213.424, 209.052)}; Holm p [1.0, 1.0, 1.0, 1.0, 1.0]
reading (a) LFP a kappa (FS, RS) medians {'theta': (0.534, 0.537), 'alpha': (0.313, 0.319), 'beta': (0.448, 0.392), 'low_gamma': (0.38, 0.295), 'high_gamma': (0.297, 0.233)}; Holm p [1.0, 1.0, 0.28, 0.12, 8.1e-05]
reading (a) LFP a R (FS, RS) medians {'theta': (0.258, 0.259), 'alpha': (0.155, 0.157), 'beta': (0.219, 0.192), 'low_gamma': (0.187, 0.146), 'high_gamma': (0.147, 0.116)}; Holm p [1.0, 1.0, 0.28, 0.12, 8.1e-05]
reading (a) LFP a phase (FS, RS) medians {'theta': (188.354, 187.081), 'alpha': (189.677, 192.042), 'beta': (177.464, 174.305), 'low_gamma': (178.069, 176.544), 'high_gamma': (205.887, 185.628)}; Holm p [0.37, 0.5, 0.22, 0.37, 0.22]
reading (a) LFP b kappa (FS, RS) medians {'theta': (0.521, 0.519), 'alpha': (0.297, 0.297), 'beta': (0.4, 0.36), 'low_gamma': (0.339, 0.278), 'high_gamma': (0.289, 0.241)}; Holm p [1.0, 1.0, 0.96, 0.4, 0.0096]
reading (a) LFP b R (FS, RS) medians {'theta': (0.252, 0.251), 'alpha': (0.147, 0.147), 'beta': (0.196, 0.177), 'low_gamma': (0.167, 0.138), 'high_gamma': (0.143, 0.12)}; Holm p [1.0, 1.0, 0.96, 0.4, 0.0096]
reading (a) LFP b phase (FS, RS) medians {'theta': (178.468, 181.55), 'alpha': (186.433, 191.821), 'beta': (171.16, 168.565), 'low_gamma': (172.489, 177.701), 'high_gamma': (218.602, 200.055)}; Holm p [0.17, 0.49, 0.49, 0.49, 0.26]
reading (b) LFP a kappa (FS, RS) medians {'theta': (0.587, 0.604), 'alpha': (0.425, 0.363), 'beta': (0.509, 0.456), 'low_gamma': (0.451, 0.342), 'high_gamma': (0.344, 0.253)}; Holm p [0.65, 0.74, 0.22, 0.025, 2.6e-09]
reading (b) LFP a R (FS, RS) medians {'theta': (0.281, 0.289), 'alpha': (0.208, 0.179), 'beta': (0.247, 0.222), 'low_gamma': (0.22, 0.169), 'high_gamma': (0.17, 0.126)}; Holm p [0.65, 0.74, 0.22, 0.025, 2.6e-09]
reading (b) LFP a phase (FS, RS) medians {'theta': (185.015, 190.449), 'alpha': (184.109, 192.265), 'beta': (171.781, 174.874), 'low_gamma': (161.764, 172.759), 'high_gamma': (166.909, 176.468)}; Holm p [0.0005, 0.0018, 1.0, 1.0, 1.0]
reading (b) LFP b kappa (FS, RS) medians {'theta': (0.599, 0.59), 'alpha': (0.371, 0.336), 'beta': (0.462, 0.41), 'low_gamma': (0.397, 0.34), 'high_gamma': (0.33, 0.257)}; Holm p [0.79, 0.79, 0.63, 0.25, 1.4e-06]
reading (b) LFP b R (FS, RS) medians {'theta': (0.287, 0.283), 'alpha': (0.182, 0.166), 'beta': (0.225, 0.201), 'low_gamma': (0.195, 0.167), 'high_gamma': (0.163, 0.127)}; Holm p [0.79, 0.79, 0.63, 0.25, 1.4e-06]
reading (b) LFP b phase (FS, RS) medians {'theta': (178.468, 186.545), 'alpha': (181.697, 193.661), 'beta': (170.027, 172.113), 'low_gamma': (162.028, 174.092), 'high_gamma': (173.949, 187.292)}; Holm p [4.3e-05, 5.2e-05, 1.0, 1.0, 1.0]
Source Data labels LFP a kappa (FS, RS) medians {'theta': (0.567, 0.49), 'alpha': (0.326, 0.276), 'beta': (0.432, 0.369), 'low_gamma': (0.353, 0.262), 'high_gamma': (0.29, 0.206)}; Holm p [0.064, 0.27, 0.1, 0.023, 5.1e-06]
Source Data labels LFP a R (FS, RS) medians {'theta': (0.273, 0.238), 'alpha': (0.161, 0.136), 'beta': (0.211, 0.182), 'low_gamma': (0.174, 0.13), 'high_gamma': (0.144, 0.102)}; Holm p [0.064, 0.27, 0.1, 0.023, 5.1e-06]
Source Data labels LFP a phase (FS, RS) medians {'theta': (189.131, 182.245), 'alpha': (191.057, 188.724), 'beta': (171.894, 174.572), 'low_gamma': (175.558, 186.493), 'high_gamma': (207.112, 200.418)}; Holm p [1.0, 1.0, 1.0, 1.0, 1.0]
Source Data labels LFP b kappa (FS, RS) medians {'theta': (0.556, 0.472), 'alpha': (0.303, 0.251), 'beta': (0.38, 0.338), 'low_gamma': (0.312, 0.248), 'high_gamma': (0.283, 0.222)}; Holm p [0.096, 0.46, 0.3, 0.096, 0.0013]
Source Data labels LFP b R (FS, RS) medians {'theta': (0.268, 0.23), 'alpha': (0.15, 0.124), 'beta': (0.187, 0.166), 'low_gamma': (0.154, 0.123), 'high_gamma': (0.14, 0.11)}; Holm p [0.096, 0.46, 0.3, 0.096, 0.0013]
Source Data labels LFP b phase (FS, RS) medians {'theta': (178.642, 175.094), 'alpha': (190.178, 188.078), 'beta': (168.301, 170.105), 'low_gamma': (165.538, 183.792), 'high_gamma': (218.602, 210.762)}; Holm p [1.0, 1.0, 1.0, 1.0, 1.0]
Result: not reproduced. Among phase-locked units FS kappa is higher than RS in all five bands (reading c, LFP a), but only low and high gamma differ after Holm correction (p = 0.034 and 2.4e-06; theta, alpha and beta p = 0.072, 0.12, 0.072). The FS preferred phase is not earlier in beta (176.1 against 174.3 degrees) and is earlier in low gamma without significance (178.1 against 184.8, Holm p = 1.0). The resultant length gives the same tests. Under LFP (b) only high gamma kappa differs after Holm correction (p = 0.0011; low gamma p = 0.091).
fig3d-rs2-gamma-locking¶
Among RS clusters, RS2 phase-locks more strongly to low and high gamma than RS1, while the preferred phase of RS1 to RS3 stays at about 180 to 200 degrees.
def circ_mean_deg(x):
return float(np.degrees(np.angle(np.mean(np.exp(1j * np.radians(x))))) % 360)
for r in READINGS:
for lfp in "ab":
t = locked("dg", lfp, r)
for col in ("kappa", "R"):
out = []
for band in ("low_gamma", "high_gamma"):
x = t[t.band == band]
k = three(x, col, ["RS1", "RS2", "RS3"])
out.append(f"{band}: medians {dict((g, round(v, 3)) for g, v in k['medians'].items())}, KW p {k['p']:.1e}, Holm RS1-RS2 {k['post']['RS1-RS2']:.1e}")
print(f"{READINGS[r]:18s} LFP {lfp} {col}: " + "; ".join(out))
ph = {band: {g: round(circ_mean_deg(t[(t.band == band) & (t.six == g)].phase), 1) for g in ("RS1", "RS2", "RS3")} for band in BANDS}
allv = [v for d in ph.values() for v in d.values()]
print(f" mean phases {ph}; range {min(allv):.1f} to {max(allv):.1f}; within 162 to 220: {all(162 <= v <= 220 for v in allv)}")
print(" units per cluster (theta):", t[t.band == "theta"].six.value_counts().reindex(["RS1", "RS2", "RS3"]).to_dict())
reading (c) LFP a kappa: low_gamma: medians {'RS1': 0.251, 'RS2': 0.243, 'RS3': 0.286}, KW p 3.5e-01, Holm RS1-RS2 6.5e-01; high_gamma: medians {'RS1': 0.208, 'RS2': 0.212, 'RS3': 0.188}, KW p 7.8e-01, Holm RS1-RS2 1.0e+00
reading (c) LFP a R: low_gamma: medians {'RS1': 0.124, 'RS2': 0.121, 'RS3': 0.142}, KW p 3.5e-01, Holm RS1-RS2 6.5e-01; high_gamma: medians {'RS1': 0.103, 'RS2': 0.106, 'RS3': 0.094}, KW p 7.8e-01, Holm RS1-RS2 1.0e+00
mean phases {'theta': {'RS1': 181.4, 'RS2': 179.1, 'RS3': 185.1}, 'alpha': {'RS1': 188.4, 'RS2': 190.7, 'RS3': 192.3}, 'beta': {'RS1': 170.9, 'RS2': 165.4, 'RS3': 172.9}, 'low_gamma': {'RS1': 184.1, 'RS2': 167.3, 'RS3': 185.0}, 'high_gamma': {'RS1': 200.2, 'RS2': 179.9, 'RS3': 190.2}}; range 165.4 to 200.2; within 162 to 220: True
units per cluster (theta): {'RS1': 160, 'RS2': 71, 'RS3': 84}
reading (c) LFP b kappa: low_gamma: medians {'RS1': 0.247, 'RS2': 0.224, 'RS3': 0.263}, KW p 1.3e-01, Holm RS1-RS2 4.1e-01; high_gamma: medians {'RS1': 0.222, 'RS2': 0.219, 'RS3': 0.21}, KW p 9.3e-01, Holm RS1-RS2 1.0e+00
reading (c) LFP b R: low_gamma: medians {'RS1': 0.122, 'RS2': 0.111, 'RS3': 0.13}, KW p 1.3e-01, Holm RS1-RS2 4.1e-01; high_gamma: medians {'RS1': 0.11, 'RS2': 0.109, 'RS3': 0.104}, KW p 9.3e-01, Holm RS1-RS2 1.0e+00
mean phases {'theta': {'RS1': 174.8, 'RS2': 172.9, 'RS3': 178.7}, 'alpha': {'RS1': 187.8, 'RS2': 197.0, 'RS3': 194.7}, 'beta': {'RS1': 164.9, 'RS2': 162.2, 'RS3': 171.7}, 'low_gamma': {'RS1': 184.6, 'RS2': 171.1, 'RS3': 182.6}, 'high_gamma': {'RS1': 206.0, 'RS2': 195.1, 'RS3': 197.7}}; range 162.2 to 206.0; within 162 to 220: True
units per cluster (theta): {'RS1': 162, 'RS2': 67, 'RS3': 85}
reading (a) LFP a kappa: low_gamma: medians {'RS1': 0.287, 'RS2': 0.27, 'RS3': 0.336}, KW p 1.0e-01, Holm RS1-RS2 6.3e-01; high_gamma: medians {'RS1': 0.228, 'RS2': 0.232, 'RS3': 0.251}, KW p 2.6e-01, Holm RS1-RS2 6.9e-01
reading (a) LFP a R: low_gamma: medians {'RS1': 0.142, 'RS2': 0.134, 'RS3': 0.166}, KW p 1.0e-01, Holm RS1-RS2 6.3e-01; high_gamma: medians {'RS1': 0.113, 'RS2': 0.115, 'RS3': 0.124}, KW p 2.6e-01, Holm RS1-RS2 6.9e-01
mean phases {'theta': {'RS1': 184.1, 'RS2': 178.5, 'RS3': 190.2}, 'alpha': {'RS1': 190.2, 'RS2': 195.7, 'RS3': 194.6}, 'beta': {'RS1': 170.6, 'RS2': 169.8, 'RS3': 170.1}, 'low_gamma': {'RS1': 178.0, 'RS2': 168.6, 'RS3': 176.3}, 'high_gamma': {'RS1': 192.9, 'RS2': 184.0, 'RS3': 177.9}}; range 168.6 to 195.7; within 162 to 220: True
units per cluster (theta): {'RS1': 225, 'RS2': 112, 'RS3': 121}
reading (a) LFP b kappa: low_gamma: medians {'RS1': 0.271, 'RS2': 0.241, 'RS3': 0.35}, KW p 5.6e-02, Holm RS1-RS2 3.0e-01; high_gamma: medians {'RS1': 0.238, 'RS2': 0.237, 'RS3': 0.267}, KW p 5.4e-01, Holm RS1-RS2 9.2e-01
reading (a) LFP b R: low_gamma: medians {'RS1': 0.134, 'RS2': 0.12, 'RS3': 0.173}, KW p 5.6e-02, Holm RS1-RS2 3.0e-01; high_gamma: medians {'RS1': 0.118, 'RS2': 0.118, 'RS3': 0.132}, KW p 5.4e-01, Holm RS1-RS2 9.2e-01
mean phases {'theta': {'RS1': 178.0, 'RS2': 171.1, 'RS3': 184.9}, 'alpha': {'RS1': 190.4, 'RS2': 204.1, 'RS3': 197.0}, 'beta': {'RS1': 165.0, 'RS2': 165.9, 'RS3': 169.3}, 'low_gamma': {'RS1': 178.5, 'RS2': 173.6, 'RS3': 174.8}, 'high_gamma': {'RS1': 201.0, 'RS2': 200.3, 'RS3': 185.1}}; range 165.0 to 204.1; within 162 to 220: True
units per cluster (theta): {'RS1': 228, 'RS2': 109, 'RS3': 122}
reading (b) LFP a kappa: low_gamma: medians {'RS1': 0.354, 'RS2': 0.294, 'RS3': 0.366}, KW p 4.0e-02, Holm RS1-RS2 2.2e-01; high_gamma: medians {'RS1': 0.253, 'RS2': 0.235, 'RS3': 0.274}, KW p 7.8e-02, Holm RS1-RS2 1.9e-01
reading (b) LFP a R: low_gamma: medians {'RS1': 0.174, 'RS2': 0.146, 'RS3': 0.18}, KW p 4.0e-02, Holm RS1-RS2 2.2e-01; high_gamma: medians {'RS1': 0.125, 'RS2': 0.117, 'RS3': 0.136}, KW p 7.8e-02, Holm RS1-RS2 1.9e-01
mean phases {'theta': {'RS1': 187.8, 'RS2': 181.6, 'RS3': 186.7}, 'alpha': {'RS1': 191.0, 'RS2': 197.2, 'RS3': 195.0}, 'beta': {'RS1': 173.3, 'RS2': 170.8, 'RS3': 172.8}, 'low_gamma': {'RS1': 175.1, 'RS2': 165.5, 'RS3': 171.2}, 'high_gamma': {'RS1': 183.8, 'RS2': 178.0, 'RS3': 176.7}}; range 165.5 to 197.2; within 162 to 220: True
units per cluster (theta): {'RS1': 379, 'RS2': 252, 'RS3': 243}
reading (b) LFP b kappa: low_gamma: medians {'RS1': 0.343, 'RS2': 0.29, 'RS3': 0.358}, KW p 2.8e-02, Holm RS1-RS2 1.0e-01; high_gamma: medians {'RS1': 0.257, 'RS2': 0.248, 'RS3': 0.283}, KW p 2.3e-01, Holm RS1-RS2 4.4e-01
reading (b) LFP b R: low_gamma: medians {'RS1': 0.169, 'RS2': 0.144, 'RS3': 0.176}, KW p 2.8e-02, Holm RS1-RS2 1.0e-01; high_gamma: medians {'RS1': 0.127, 'RS2': 0.123, 'RS3': 0.14}, KW p 2.3e-01, Holm RS1-RS2 4.4e-01
mean phases {'theta': {'RS1': 182.6, 'RS2': 173.6, 'RS3': 183.3}, 'alpha': {'RS1': 192.3, 'RS2': 203.1, 'RS3': 199.0}, 'beta': {'RS1': 169.2, 'RS2': 166.7, 'RS3': 170.8}, 'low_gamma': {'RS1': 175.5, 'RS2': 166.7, 'RS3': 171.7}, 'high_gamma': {'RS1': 191.0, 'RS2': 191.4, 'RS3': 186.4}}; range 166.7 to 203.1; within 162 to 220: True
units per cluster (theta): {'RS1': 382, 'RS2': 250, 'RS3': 242}
Source Data labels LFP a kappa: low_gamma: medians {'RS1': 0.258, 'RS2': 0.277, 'RS3': 0.261}, KW p 6.4e-01, Holm RS1-RS2 9.6e-01; high_gamma: medians {'RS1': 0.203, 'RS2': 0.23, 'RS3': 0.192}, KW p 2.7e-01, Holm RS1-RS2 3.0e-01
Source Data labels LFP a R: low_gamma: medians {'RS1': 0.128, 'RS2': 0.137, 'RS3': 0.129}, KW p 6.4e-01, Holm RS1-RS2 9.6e-01; high_gamma: medians {'RS1': 0.101, 'RS2': 0.114, 'RS3': 0.096}, KW p 2.7e-01, Holm RS1-RS2 3.0e-01
mean phases {'theta': {'RS1': 182.0, 'RS2': 179.2, 'RS3': 180.4}, 'alpha': {'RS1': 188.2, 'RS2': 194.6, 'RS3': 195.4}, 'beta': {'RS1': 169.8, 'RS2': 171.1, 'RS3': 179.9}, 'low_gamma': {'RS1': 184.5, 'RS2': 165.4, 'RS3': 194.2}, 'high_gamma': {'RS1': 198.8, 'RS2': 183.8, 'RS3': 198.9}}; range 165.4 to 198.9; within 162 to 220: True
units per cluster (theta): {'RS1': 198, 'RS2': 72, 'RS3': 62}
Source Data labels LFP b kappa: low_gamma: medians {'RS1': 0.25, 'RS2': 0.259, 'RS3': 0.241}, KW p 8.4e-01, Holm RS1-RS2 1.0e+00; high_gamma: medians {'RS1': 0.222, 'RS2': 0.241, 'RS3': 0.208}, KW p 8.1e-01, Holm RS1-RS2 1.0e+00
Source Data labels LFP b R: low_gamma: medians {'RS1': 0.124, 'RS2': 0.129, 'RS3': 0.12}, KW p 8.4e-01, Holm RS1-RS2 1.0e+00; high_gamma: medians {'RS1': 0.11, 'RS2': 0.12, 'RS3': 0.103}, KW p 8.1e-01, Holm RS1-RS2 1.0e+00
mean phases {'theta': {'RS1': 175.3, 'RS2': 171.5, 'RS3': 174.1}, 'alpha': {'RS1': 187.7, 'RS2': 196.1, 'RS3': 198.0}, 'beta': {'RS1': 163.8, 'RS2': 166.5, 'RS3': 178.4}, 'low_gamma': {'RS1': 184.4, 'RS2': 166.0, 'RS3': 191.1}, 'high_gamma': {'RS1': 204.4, 'RS2': 197.3, 'RS3': 206.5}}; range 163.8 to 206.5; within 162 to 220: True
units per cluster (theta): {'RS1': 199, 'RS2': 69, 'RS3': 62}
Result: not reproduced. RS1 to RS3 do not differ in low or high gamma kappa (Kruskal-Wallis p = 0.35 and 0.78, reading c, LFP a), and RS2 is not above RS1. The cluster mean phases lie between 162 and 220 degrees under every reading.
fig3e-fs-cluster-locking¶
FS3 phase-locks more strongly to high gamma than FS2, and FS1 to FS3 have distinct preferred phases in alpha, beta and low gamma.
for r in READINGS:
for lfp in "ab":
t = locked("dg", lfp, r)
x = t[t.band == "high_gamma"]
out = []
for col in ("kappa", "R"):
k = three(x, col, ["FS1", "FS2", "FS3"])
out.append(f"high gamma {col} medians {dict((g, round(v, 3)) for g, v in k['medians'].items())}, Holm FS2-FS3 {k['post']['FS2-FS3']:.1e}")
ph = []
for band in ("alpha", "beta", "low_gamma"):
k = three(t[t.band == band], "phase", ["FS1", "FS2", "FS3"])
ph.append(f"{band} KW p {k['p']:.1e} medians {dict((g, round(v, 1)) for g, v in k['medians'].items())}")
print(f"{READINGS[r]:18s} LFP {lfp}: " + "; ".join(out))
print(" phase: " + "; ".join(ph))
print(" units (theta):", t[t.band == "theta"].six.value_counts().reindex(["FS1", "FS2", "FS3"]).to_dict(),
"; expected 100, 54, 49 of the 25 sessions")
reading (c) LFP a: high gamma kappa medians {'FS1': 0.3, 'FS2': 0.304, 'FS3': 0.265}, Holm FS2-FS3 1.0e+00; high gamma R medians {'FS1': 0.148, 'FS2': 0.15, 'FS3': 0.132}, Holm FS2-FS3 1.0e+00
phase: alpha KW p 4.6e-02 medians {'FS1': 187.1, 'FS2': 195.0, 'FS3': 188.4}; beta KW p 2.4e-01 medians {'FS1': 175.0, 'FS2': 180.5, 'FS3': 170.3}; low_gamma KW p 9.6e-01 medians {'FS1': 172.3, 'FS2': 181.6, 'FS3': 172.3}
units (theta): {'FS1': 46, 'FS2': 28, 'FS3': 22} ; expected 100, 54, 49 of the 25 sessions
reading (c) LFP b: high gamma kappa medians {'FS1': 0.294, 'FS2': 0.296, 'FS3': 0.229}, Holm FS2-FS3 1.0e+00; high gamma R medians {'FS1': 0.145, 'FS2': 0.146, 'FS3': 0.114}, Holm FS2-FS3 1.0e+00
phase: alpha KW p 1.5e-01 medians {'FS1': 182.4, 'FS2': 191.2, 'FS3': 194.2}; beta KW p 2.4e-01 medians {'FS1': 166.1, 'FS2': 178.3, 'FS3': 166.2}; low_gamma KW p 8.9e-01 medians {'FS1': 169.6, 'FS2': 167.3, 'FS3': 163.2}
units (theta): {'FS1': 46, 'FS2': 27, 'FS3': 22} ; expected 100, 54, 49 of the 25 sessions
reading (a) LFP a: high gamma kappa medians {'FS1': 0.341, 'FS2': 0.253, 'FS3': 0.294}, Holm FS2-FS3 1.0e+00; high gamma R medians {'FS1': 0.168, 'FS2': 0.126, 'FS3': 0.145}, Holm FS2-FS3 1.0e+00
phase: alpha KW p 4.7e-03 medians {'FS1': 187.1, 'FS2': 198.7, 'FS3': 183.6}; beta KW p 2.0e-01 medians {'FS1': 178.8, 'FS2': 178.1, 'FS3': 167.0}; low_gamma KW p 8.5e-01 medians {'FS1': 181.2, 'FS2': 180.4, 'FS3': 171.0}
units (theta): {'FS1': 50, 'FS2': 36, 'FS3': 27} ; expected 100, 54, 49 of the 25 sessions
reading (a) LFP b: high gamma kappa medians {'FS1': 0.315, 'FS2': 0.234, 'FS3': 0.273}, Holm FS2-FS3 1.0e+00; high gamma R medians {'FS1': 0.156, 'FS2': 0.116, 'FS3': 0.135}, Holm FS2-FS3 1.0e+00
phase: alpha KW p 4.5e-02 medians {'FS1': 183.0, 'FS2': 194.5, 'FS3': 179.5}; beta KW p 4.2e-01 medians {'FS1': 169.5, 'FS2': 175.8, 'FS3': 168.3}; low_gamma KW p 7.7e-01 medians {'FS1': 185.0, 'FS2': 171.4, 'FS3': 164.3}
units (theta): {'FS1': 50, 'FS2': 35, 'FS3': 27} ; expected 100, 54, 49 of the 25 sessions
reading (b) LFP a: high gamma kappa medians {'FS1': 0.391, 'FS2': 0.253, 'FS3': 0.415}, Holm FS2-FS3 9.4e-04; high gamma R medians {'FS1': 0.192, 'FS2': 0.126, 'FS3': 0.203}, Holm FS2-FS3 9.4e-04
phase: alpha KW p 1.4e-04 medians {'FS1': 182.3, 'FS2': 196.5, 'FS3': 174.9}; beta KW p 1.3e-02 medians {'FS1': 173.5, 'FS2': 178.1, 'FS3': 163.9}; low_gamma KW p 5.6e-03 medians {'FS1': 162.2, 'FS2': 180.6, 'FS3': 151.3}
units (theta): {'FS1': 99, 'FS2': 50, 'FS3': 53} ; expected 100, 54, 49 of the 25 sessions
reading (b) LFP b: high gamma kappa medians {'FS1': 0.362, 'FS2': 0.234, 'FS3': 0.383}, Holm FS2-FS3 1.0e-02; high gamma R medians {'FS1': 0.178, 'FS2': 0.116, 'FS3': 0.188}, Holm FS2-FS3 1.0e-02
phase: alpha KW p 1.9e-03 medians {'FS1': 178.0, 'FS2': 194.5, 'FS3': 174.5}; beta KW p 6.1e-02 medians {'FS1': 170.2, 'FS2': 175.8, 'FS3': 163.6}; low_gamma KW p 7.8e-03 medians {'FS1': 169.6, 'FS2': 171.4, 'FS3': 147.1}
units (theta): {'FS1': 99, 'FS2': 49, 'FS3': 54} ; expected 100, 54, 49 of the 25 sessions
Source Data labels LFP a: high gamma kappa medians {'FS1': 0.343, 'FS2': 0.242, 'FS3': 0.292}, Holm FS2-FS3 7.4e-01; high gamma R medians {'FS1': 0.169, 'FS2': 0.12, 'FS3': 0.145}, Holm FS2-FS3 7.4e-01
phase: alpha KW p 3.4e-02 medians {'FS1': 187.3, 'FS2': 194.9, 'FS3': 189.6}; beta KW p 8.1e-02 medians {'FS1': 167.8, 'FS2': 184.0, 'FS3': 171.6}; low_gamma KW p 3.6e-01 medians {'FS1': 161.1, 'FS2': 186.0, 'FS3': 180.3}
units (theta): {'FS1': 50, 'FS2': 29, 'FS3': 19} ; expected 100, 54, 49 of the 25 sessions
Source Data labels LFP b: high gamma kappa medians {'FS1': 0.322, 'FS2': 0.231, 'FS3': 0.283}, Holm FS2-FS3 9.6e-01; high gamma R medians {'FS1': 0.159, 'FS2': 0.115, 'FS3': 0.14}, Holm FS2-FS3 9.6e-01
phase: alpha KW p 6.0e-01 medians {'FS1': 183.7, 'FS2': 191.2, 'FS3': 193.8}; beta KW p 5.4e-02 medians {'FS1': 162.8, 'FS2': 176.5, 'FS3': 164.2}; low_gamma KW p 7.0e-01 medians {'FS1': 161.4, 'FS2': 175.3, 'FS3': 181.3}
units (theta): {'FS1': 50, 'FS2': 28, 'FS3': 19} ; expected 100, 54, 49 of the 25 sessions
Result: partially reproduced, resting on an assumption. On FS clusters with K forced to 3 (reading c), FS3 does not lock more strongly than FS2 in high gamma (Holm p = 1.0), and the preferred phases differ in alpha (Kruskal-Wallis p = 0.046) but not in beta or low gamma (p = 0.24 and 0.96). The Source Data labels give the same kappa result.
figs6c-fs-stronger-across-depth¶
FS units phase-lock more strongly than RS units in the supragranular, granular and infragranular regions in all LFP bands.
Regions: reading (a) of the criterion, the CCF layer of the peak channel, cannot be run, as the electrodes tables give the structure (VISp) but no layer. Reading (b), depth relative to the CSD layer 4 centre, granular within 100 um of it, supragranular above, infragranular below. The centre is the CSD centre computed here (depth_csd, see figs5-depth-distribution), the method the criterion names; the layer 4 centre of the code's unit tables is shown as a variant. Coupling read as (i) kappa, Mann-Whitney, (ii) percentage phase-locked, z test Holm-corrected over the 15 region and band cells. LFP (a), first 10,000 spikes, Results bands.
def region(depth):
return np.where(depth > 100, "supra", np.where(depth < -100, "infra", "granular"))
REG = ["supra", "granular", "infra"]
def depth_cells(r, depth_source="csd", lfp="a"):
t = eligible(phase_table("dg", lfp, "first", "results"), r)
d = t.depth_csd if depth_source == "csd" else t.unit_id.map(units.depth_code)
t = t.assign(region=region(d.astype(float)))[d.notna().values]
return t
for r in READINGS:
for src in ("code", "csd"):
t = depth_cells(r, src)
n = t[t.band == "theta"].groupby(["region", "onech"]).size().unstack().reindex(REG)
lk = t[t.p < 0.001]
cells_k, cells_p, raw_z = [], [], []
for reg in REG:
for band in BANDS:
x = lk[(lk.region == reg) & (lk.band == band)]
fs_, rs_ = x[x.onech == "FS"].kappa, x[x.onech == "RS"].kappa
pk = stats.mannwhitneyu(fs_, rs_, alternative="two-sided").pvalue if len(fs_) and len(rs_) else np.nan
cells_k.append((reg, band, fs_.median() > rs_.median(), pk))
y = t[(t.region == reg) & (t.band == band)]
k1, n1 = int((y[y.onech == "FS"].p < 0.001).sum()), int((y.onech == "FS").sum())
k2, n2 = int((y[y.onech == "RS"].p < 0.001).sum()), int((y.onech == "RS").sum())
raw_z.append(W.two_prop_z(k1, n1, k2, n2)[1] if n1 and n2 else np.nan)
cells_p.append((reg, band, (k1 / n1 if n1 else np.nan) > (k2 / n2 if n2 else np.nan)))
adj = W.holm(np.nan_to_num(raw_z, nan=1.0))
nk = sum(c[2] for c in cells_k)
nks = sum(c[2] and c[3] < 0.05 for c in cells_k)
npc = sum(c[2] for c in cells_p)
nps = sum(c[2] and a_ < 0.05 for c, a_ in zip(cells_p, adj))
print(f"{READINGS[r]:18s} depth {src}: units {n.to_dict()}")
print(f" (i) kappa FS > RS in {nk} of 15 cells, with p < 0.05 in {nks}; (ii) % locked FS > RS in {npc} of 15, Holm p < 0.05 in {nps}")
print(" kappa cells:", [(c[0], c[1], bool(c[2]), float("%.1e" % c[3])) for c in cells_k])
print("legend counts: supragranular 37 FS and 107 RS, granular 54 FS and 185 RS, infragranular 112 FS and 453 RS")
reading (c) depth code: units {'FS': {'supra': 16, 'granular': 34, 'infra': 42}, 'RS': {'supra': 60, 'granular': 101, 'infra': 155}}
(i) kappa FS > RS in 12 of 15 cells, with p < 0.05 in 8; (ii) % locked FS > RS in 13 of 15, Holm p < 0.05 in 0
kappa cells: [('supra', 'theta', True, 0.11), ('supra', 'alpha', True, 0.042), ('supra', 'beta', True, 8.6e-05), ('supra', 'low_gamma', True, 0.0013), ('supra', 'high_gamma', True, 7e-05), ('granular', 'theta', True, 0.018), ('granular', 'alpha', True, 0.072), ('granular', 'beta', True, 0.0073), ('granular', 'low_gamma', True, 0.0029), ('granular', 'high_gamma', True, 0.00018), ('infra', 'theta', True, 0.76), ('infra', 'alpha', False, 0.22), ('infra', 'beta', False, 0.33), ('infra', 'low_gamma', False, 0.47), ('infra', 'high_gamma', True, 0.11)]
reading (c) depth csd: units {'FS': {'supra': 19, 'granular': 32, 'infra': 47}, 'RS': {'supra': 48, 'granular': 106, 'infra': 173}}
(i) kappa FS > RS in 12 of 15 cells, with p < 0.05 in 5; (ii) % locked FS > RS in 14 of 15, Holm p < 0.05 in 0
kappa cells: [('supra', 'theta', True, 0.43), ('supra', 'alpha', True, 0.24), ('supra', 'beta', True, 0.031), ('supra', 'low_gamma', True, 0.23), ('supra', 'high_gamma', True, 0.006), ('granular', 'theta', True, 0.071), ('granular', 'alpha', True, 0.22), ('granular', 'beta', True, 0.005), ('granular', 'low_gamma', True, 5e-05), ('granular', 'high_gamma', True, 6.4e-05), ('infra', 'theta', True, 0.52), ('infra', 'alpha', False, 0.25), ('infra', 'beta', False, 0.49), ('infra', 'low_gamma', False, 0.22), ('infra', 'high_gamma', True, 0.16)]
reading (a) depth code: units {'FS': {'supra': 20, 'granular': 40, 'infra': 49}, 'RS': {'supra': 93, 'granular': 161, 'infra': 218}}
(i) kappa FS > RS in 12 of 15 cells, with p < 0.05 in 6; (ii) % locked FS > RS in 14 of 15, Holm p < 0.05 in 4
kappa cells: [('supra', 'theta', True, 0.62), ('supra', 'alpha', True, 0.89), ('supra', 'beta', True, 0.0026), ('supra', 'low_gamma', True, 0.029), ('supra', 'high_gamma', True, 0.0016), ('granular', 'theta', True, 0.22), ('granular', 'alpha', True, 0.32), ('granular', 'beta', True, 0.014), ('granular', 'low_gamma', True, 0.0025), ('granular', 'high_gamma', True, 0.00028), ('infra', 'theta', True, 0.64), ('infra', 'alpha', False, 0.14), ('infra', 'beta', False, 0.31), ('infra', 'low_gamma', False, 0.65), ('infra', 'high_gamma', True, 0.13)]
reading (a) depth csd: units {'FS': {'supra': 22, 'granular': 36, 'infra': 57}, 'RS': {'supra': 91, 'granular': 152, 'infra': 242}}
(i) kappa FS > RS in 11 of 15 cells, with p < 0.05 in 3; (ii) % locked FS > RS in 15 of 15, Holm p < 0.05 in 3
kappa cells: [('supra', 'theta', False, 0.085), ('supra', 'alpha', False, 0.37), ('supra', 'beta', True, 0.27), ('supra', 'low_gamma', True, 0.39), ('supra', 'high_gamma', True, 0.054), ('granular', 'theta', True, 0.33), ('granular', 'alpha', True, 0.55), ('granular', 'beta', True, 0.016), ('granular', 'low_gamma', True, 0.00064), ('granular', 'high_gamma', True, 0.00033), ('infra', 'theta', False, 0.82), ('infra', 'alpha', False, 0.32), ('infra', 'beta', True, 1.0), ('infra', 'low_gamma', True, 0.83), ('infra', 'high_gamma', True, 0.088)]
reading (b) depth code: units {'FS': {'supra': 42, 'granular': 64, 'infra': 100}, 'RS': {'supra': 222, 'granular': 291, 'infra': 371}}
(i) kappa FS > RS in 11 of 15 cells, with p < 0.05 in 7; (ii) % locked FS > RS in 12 of 15, Holm p < 0.05 in 2
kappa cells: [('supra', 'theta', False, 0.41), ('supra', 'alpha', True, 0.56), ('supra', 'beta', True, 6.2e-05), ('supra', 'low_gamma', True, 2.6e-06), ('supra', 'high_gamma', True, 5.9e-11), ('granular', 'theta', True, 0.17), ('granular', 'alpha', True, 0.091), ('granular', 'beta', True, 0.0035), ('granular', 'low_gamma', True, 0.0018), ('granular', 'high_gamma', True, 3.9e-05), ('infra', 'theta', False, 0.18), ('infra', 'alpha', True, 0.31), ('infra', 'beta', False, 0.091), ('infra', 'low_gamma', False, 0.36), ('infra', 'high_gamma', True, 0.015)]
reading (b) depth csd: units {'FS': {'supra': 47, 'granular': 66, 'infra': 102}, 'RS': {'supra': 217, 'granular': 295, 'infra': 402}}
(i) kappa FS > RS in 10 of 15 cells, with p < 0.05 in 5; (ii) % locked FS > RS in 12 of 15, Holm p < 0.05 in 1
kappa cells: [('supra', 'theta', False, 0.016), ('supra', 'alpha', False, 0.38), ('supra', 'beta', True, 0.066), ('supra', 'low_gamma', True, 0.0013), ('supra', 'high_gamma', True, 9e-07), ('granular', 'theta', True, 0.6), ('granular', 'alpha', True, 0.16), ('granular', 'beta', True, 0.013), ('granular', 'low_gamma', True, 0.003), ('granular', 'high_gamma', True, 5.2e-06), ('infra', 'theta', False, 0.4), ('infra', 'alpha', False, 0.27), ('infra', 'beta', False, 0.33), ('infra', 'low_gamma', True, 0.53), ('infra', 'high_gamma', True, 0.059)]
Source Data labels depth code: units {'FS': {'supra': 18, 'granular': 37, 'infra': 44}, 'RS': {'supra': 64, 'granular': 107, 'infra': 172}}
(i) kappa FS > RS in 12 of 15 cells, with p < 0.05 in 8; (ii) % locked FS > RS in 14 of 15, Holm p < 0.05 in 0
kappa cells: [('supra', 'theta', True, 0.14), ('supra', 'alpha', True, 0.042), ('supra', 'beta', True, 0.00014), ('supra', 'low_gamma', True, 0.00091), ('supra', 'high_gamma', True, 0.0001), ('granular', 'theta', True, 0.025), ('granular', 'alpha', True, 0.081), ('granular', 'beta', True, 0.012), ('granular', 'low_gamma', True, 0.0046), ('granular', 'high_gamma', True, 0.00032), ('infra', 'theta', True, 0.98), ('infra', 'alpha', False, 0.04), ('infra', 'beta', False, 0.12), ('infra', 'low_gamma', False, 0.46), ('infra', 'high_gamma', True, 0.089)]
Source Data labels depth csd: units {'FS': {'supra': 20, 'granular': 30, 'infra': 49}, 'RS': {'supra': 51, 'granular': 110, 'infra': 182}}
(i) kappa FS > RS in 12 of 15 cells, with p < 0.05 in 6; (ii) % locked FS > RS in 15 of 15, Holm p < 0.05 in 0
kappa cells: [('supra', 'theta', True, 0.33), ('supra', 'alpha', True, 0.13), ('supra', 'beta', True, 0.011), ('supra', 'low_gamma', True, 0.092), ('supra', 'high_gamma', True, 0.0021), ('granular', 'theta', True, 0.036), ('granular', 'alpha', True, 0.15), ('granular', 'beta', True, 0.0064), ('granular', 'low_gamma', True, 0.00016), ('granular', 'high_gamma', True, 0.00038), ('infra', 'theta', True, 0.64), ('infra', 'alpha', False, 0.047), ('infra', 'beta', False, 0.22), ('infra', 'low_gamma', False, 0.29), ('infra', 'high_gamma', True, 0.11)]
legend counts: supragranular 37 FS and 107 RS, granular 54 FS and 185 RS, infragranular 112 FS and 453 RS
Result: not reproduced, resting on an assumption. With regions from the CSD layer 4 centre computed here (reading b of the criterion; the CCF layer cannot be read, see the data check) and the units of reading (c), the percentage of phase-locked FS units exceeds that of RS units in 14 of 15 region and band cells (none with Holm p below 0.05), and kappa is higher for FS in 12 of 15 (5 with p below 0.05). With the code's layer 4 centre the percentage is higher in 13 of 15 and kappa in 12 of 15 (8 with p below 0.05). Reading (a) with the CSD centre gives the percentage higher in all 15 cells (3 with Holm p below 0.05), which would make it partially reproduced. Region counts (reading c, CSD centre) are 19, 32, 47 FS and 48, 106, 173 RS (code's centre 16, 34, 42 and 60, 101, 155), against the legend's 37, 54, 112 and 107, 185, 453 for 25 sessions.
figs6d-rs3-supragranular-beta¶
RS1 to RS3 differ most in coupling strength (kappa) in supragranular beta and low gamma, and in supragranular beta the kappa of RS3 is almost double that of RS1.
for r in READINGS:
for src in ("code", "csd"):
lk = depth_cells(r, src)
lk = lk[(lk.p < 0.001) & (lk.region == "supra")]
out = []
for band in ("beta", "low_gamma"):
x = lk[lk.band == band]
a3, a1, a2 = (x[x.six == g].kappa for g in ("RS3", "RS1", "RS2"))
p = stats.mannwhitneyu(a3, a1, alternative="two-sided").pvalue if len(a3) and len(a1) else np.nan
out.append(f"{band}: mean kappa RS1 {a1.mean():.3f}, RS2 {a2.mean():.3f}, RS3 {a3.mean():.3f}, "
f"ratio RS3/RS1 {a3.mean() / a1.mean():.2f}, MW RS3-RS1 p {p:.2e}, n {len(a1)}/{len(a2)}/{len(a3)}")
print(f"{READINGS[r]:18s} depth {src}: " + "; ".join(out))
reading (c) depth code: beta: mean kappa RS1 0.482, RS2 0.489, RS3 0.634, ratio RS3/RS1 1.31, MW RS3-RS1 p 9.00e-02, n 30/11/16; low_gamma: mean kappa RS1 0.408, RS2 0.378, RS3 0.497, ratio RS3/RS1 1.22, MW RS3-RS1 p 1.80e-01, n 29/10/16
reading (c) depth csd: beta: mean kappa RS1 0.538, RS2 0.635, RS3 0.614, ratio RS3/RS1 1.14, MW RS3-RS1 p 4.81e-01, n 23/6/14; low_gamma: mean kappa RS1 0.494, RS2 0.521, RS3 0.502, ratio RS3/RS1 1.02, MW RS3-RS1 p 9.06e-01, n 21/6/14 reading (a) depth code: beta: mean kappa RS1 0.572, RS2 0.612, RS3 0.723, ratio RS3/RS1 1.26, MW RS3-RS1 p 4.49e-02, n 43/21/23; low_gamma: mean kappa RS1 0.461, RS2 0.492, RS3 0.635, ratio RS3/RS1 1.38, MW RS3-RS1 p 1.44e-02, n 44/19/21
reading (a) depth csd: beta: mean kappa RS1 0.626, RS2 0.753, RS3 0.718, ratio RS3/RS1 1.15, MW RS3-RS1 p 2.24e-01, n 38/17/25; low_gamma: mean kappa RS1 0.500, RS2 0.570, RS3 0.594, ratio RS3/RS1 1.19, MW RS3-RS1 p 1.68e-01, n 40/17/23
reading (b) depth code: beta: mean kappa RS1 0.689, RS2 0.675, RS3 0.659, ratio RS3/RS1 0.96, MW RS3-RS1 p 5.58e-01, n 99/54/57; low_gamma: mean kappa RS1 0.534, RS2 0.509, RS3 0.572, ratio RS3/RS1 1.07, MW RS3-RS1 p 3.71e-01, n 94/52/55 reading (b) depth csd: beta: mean kappa RS1 0.730, RS2 0.708, RS3 0.671, ratio RS3/RS1 0.92, MW RS3-RS1 p 3.19e-01, n 97/53/50; low_gamma: mean kappa RS1 0.549, RS2 0.510, RS3 0.561, ratio RS3/RS1 1.02, MW RS3-RS1 p 8.10e-01, n 91/54/49
Source Data labels depth code: beta: mean kappa RS1 0.463, RS2 0.603, RS3 0.609, ratio RS3/RS1 1.32, MW RS3-RS1 p 9.13e-02, n 34/15/12; low_gamma: mean kappa RS1 0.369, RS2 0.454, RS3 0.513, ratio RS3/RS1 1.39, MW RS3-RS1 p 8.55e-02, n 31/16/12
Source Data labels depth csd: beta: mean kappa RS1 0.491, RS2 0.674, RS3 0.600, ratio RS3/RS1 1.22, MW RS3-RS1 p 2.21e-01, n 24/9/13; low_gamma: mean kappa RS1 0.422, RS2 0.564, RS3 0.519, ratio RS3/RS1 1.23, MW RS3-RS1 p 2.26e-01, n 22/9/13
Result: not reproduced, resting on an assumption. In the supragranular region, with the CSD centre computed here and reading (c), the ratio of RS3 to RS1 mean kappa in beta is 1.14 (Mann-Whitney p = 0.48) and in low gamma 1.02 (p = 0.91), against 2 +- 0.2. With the code's layer 4 centre the ratios are 1.31 (p = 0.090) and 1.22 (p = 0.18). Reading (a) with the code's centre gives a beta ratio of 1.26 with p = 0.045 and low gamma p = 0.014, which meets the criterion's partial clause (RS3 above RS1 significantly in beta, ratio outside the tolerance); with the CSD centre reading (a) gives a beta ratio of 1.15 (p = 0.22).
figs6c-granular-phase¶
FS and RS spike at broadly the same LFP phase across depth, except in the granular region, where FS spikes earlier than RS in beta and gamma.
for r in READINGS:
for src in ("code", "csd"):
lk = depth_cells(r, src)
lk = lk[lk.p < 0.001]
for reg in REG:
med, _, raw = compare(lk[lk.region == reg], "phase", bands=["beta", "low_gamma", "high_gamma"])
print(f"{READINGS[r]:18s} depth {src} {reg:8s} phase (FS, RS) medians {med}; MW p {[float('%.1e' % x) for x in raw]}")
reading (c) depth code supra phase (FS, RS) medians {'beta': (174.432, 174.264), 'low_gamma': (162.655, 173.241), 'high_gamma': (149.888, 175.366)}; MW p [0.79, 0.62, 0.17]
reading (c) depth code granular phase (FS, RS) medians {'beta': (171.894, 177.801), 'low_gamma': (163.233, 185.944), 'high_gamma': (165.545, 206.88)}; MW p [0.95, 0.31, 0.098]
reading (c) depth code infra phase (FS, RS) medians {'beta': (180.287, 170.266), 'low_gamma': (206.166, 189.839), 'high_gamma': (231.66, 202.059)}; MW p [0.23, 0.052, 0.0012]
reading (c) depth csd supra phase (FS, RS) medians {'beta': (177.287, 173.106), 'low_gamma': (164.653, 169.811), 'high_gamma': (155.342, 166.53)}; MW p [0.29, 0.84, 0.39]
reading (c) depth csd granular phase (FS, RS) medians {'beta': (176.56, 174.671), 'low_gamma': (165.286, 184.508), 'high_gamma': (188.153, 200.418)}; MW p [0.72, 0.35, 0.53]
reading (c) depth csd infra phase (FS, RS) medians {'beta': (173.799, 173.749), 'low_gamma': (199.114, 193.669), 'high_gamma': (230.752, 201.07)}; MW p [0.32, 0.071, 0.027]
reading (a) depth code supra phase (FS, RS) medians {'beta': (177.793, 179.964), 'low_gamma': (164.357, 174.532), 'high_gamma': (153.117, 164.255)}; MW p [0.98, 0.76, 0.48]
reading (a) depth code granular phase (FS, RS) medians {'beta': (171.781, 176.562), 'low_gamma': (163.233, 177.623), 'high_gamma': (166.636, 187.448)}; MW p [0.88, 0.69, 0.4]
reading (a) depth code infra phase (FS, RS) medians {'beta': (184.621, 166.059), 'low_gamma': (203.823, 172.791), 'high_gamma': (231.049, 199.667)}; MW p [0.011, 0.0063, 7.3e-05]
reading (a) depth csd supra phase (FS, RS) medians {'beta': (177.94, 178.547), 'low_gamma': (165.058, 176.539), 'high_gamma': (159.494, 164.255)}; MW p [0.62, 0.25, 0.37]
reading (a) depth csd granular phase (FS, RS) medians {'beta': (176.56, 168.876), 'low_gamma': (165.286, 172.776), 'high_gamma': (192.845, 180.345)}; MW p [0.2, 0.88, 0.59]
reading (a) depth csd infra phase (FS, RS) medians {'beta': (178.3, 172.888), 'low_gamma': (198.032, 183.371), 'high_gamma': (231.049, 196.812)}; MW p [0.037, 0.012, 0.0032]
reading (b) depth code supra phase (FS, RS) medians {'beta': (170.677, 181.582), 'low_gamma': (146.005, 173.449), 'high_gamma': (143.334, 163.319)}; MW p [0.011, 0.0033, 0.00032]
reading (b) depth code granular phase (FS, RS) medians {'beta': (169.138, 174.615), 'low_gamma': (155.578, 169.324), 'high_gamma': (163.925, 176.741)}; MW p [0.74, 0.46, 0.21]
reading (b) depth code infra phase (FS, RS) medians {'beta': (177.464, 166.279), 'low_gamma': (185.808, 172.776), 'high_gamma': (210.583, 196.099)}; MW p [0.075, 0.07, 0.14]
reading (b) depth csd supra phase (FS, RS) medians {'beta': (170.981, 179.768), 'low_gamma': (151.391, 173.345), 'high_gamma': (143.647, 160.935)}; MW p [0.011, 0.0013, 0.0024]
reading (b) depth csd granular phase (FS, RS) medians {'beta': (167.302, 169.345), 'low_gamma': (154.411, 166.792), 'high_gamma': (163.678, 170.364)}; MW p [0.71, 0.16, 0.47]
reading (b) depth csd infra phase (FS, RS) medians {'beta': (182.79, 174.358), 'low_gamma': (198.032, 179.528), 'high_gamma': (224.265, 196.22)}; MW p [0.023, 0.0049, 0.048]
Source Data labels depth code supra phase (FS, RS) medians {'beta': (174.432, 174.688), 'low_gamma': (162.655, 178.699), 'high_gamma': (149.888, 175.366)}; MW p [0.93, 0.43, 0.13]
Source Data labels depth code granular phase (FS, RS) medians {'beta': (171.79, 176.562), 'low_gamma': (162.178, 185.944), 'high_gamma': (165.924, 205.094)}; MW p [0.9, 0.27, 0.092]
Source Data labels depth code infra phase (FS, RS) medians {'beta': (175.807, 172.888), 'low_gamma': (203.823, 192.18), 'high_gamma': (231.346, 205.448)}; MW p [0.94, 0.15, 0.001]
Source Data labels depth csd supra phase (FS, RS) medians {'beta': (176.151, 174.651), 'low_gamma': (162.95, 172.012), 'high_gamma': (153.908, 172.576)}; MW p [0.67, 0.54, 0.18]
Source Data labels depth csd granular phase (FS, RS) medians {'beta': (175.574, 174.098), 'low_gamma': (161.05, 184.508), 'high_gamma': (188.153, 203.644)}; MW p [0.76, 0.3, 0.48]
Source Data labels depth csd infra phase (FS, RS) medians {'beta': (169.751, 176.131), 'low_gamma': (196.098, 193.976), 'high_gamma': (230.197, 205.448)}; MW p [0.72, 0.34, 0.026]
Result: not reproduced, resting on an assumption. In the granular region, with the CSD centre computed here and reading (c), FS and RS phases do not differ in beta, low or high gamma (p = 0.72, 0.35 and 0.53), while the infragranular region shows a high-gamma difference (p = 0.027). With the code's layer 4 centre the granular tests give p = 0.95, 0.31 and 0.098 (infragranular high gamma p = 0.0012). No isolation reading or label set gives a granular phase difference with p < 0.05 under either centre.
fig7-opto-unit-counts¶
Opto-tagging found 25 well-isolated Pvalb units in 8 Pvalb-Cre mice and 18 Sst units in 12 Sst-Cre mice.
10 ms square pulses; spikes 2 to 8 ms after onset; tagged when the trial-averaged rate there is above 25 Hz and 2.5 times the rate before onset, with the baseline (a) -6 to 0 ms or (b) -10 to 0 ms; isolation readings (a) and (b) of fig1d-unit-count, and (c) as above. The dandiset holds 5 of the 8 Pvalb mice and 6 of the 12 Sst mice, so the counts per mouse are compared (25/8 = 3.1 or 24/8 = 3.0 Pvalb units, 18/12 = 1.5 Sst units per mouse).
def tagged(df, base):
return (df.opto_resp > 25) & (df.opto_resp > 2.5 * df[base])
def unit_ok(df):
"""The code's per-unit exclusions of the wild-type units (cell 8): peak channel at the
centre, trough time within 0.1 ms, amplitude 15 to 300 uV (the 3 SD outlier step is a
property of the pooled wild-type units and is not applied)."""
return ~df.peak_off_centre.astype(bool) & (np.abs(df.neg_time) <= 0.1) & (df.A >= 15) & (df.A <= 300)
rows = []
for iso in "cab":
for base in ("opto_base6", "opto_base10"):
for g in ("Pvalb", "Sst"):
d = units[(units.group == g) & units[f"iso_{iso}"]]
tg = tagged(d, base)
per = tg.groupby(d.session).sum().reindex(S[g]).astype(int)
rows.append({"isolation": iso, "baseline": base[-2:].strip("e") + " ms", "line": g, "units": int(tg.sum()),
"mice": len(S[g]), "per mouse": round(tg.sum() / len(S[g]), 2), "per session": per.tolist(),
"after exclusions": int((tg & unit_ok(d)).sum())})
print(pd.DataFrame(rows).to_string(index=False))
d = units[units.group == "wt"]
for iso in "ca":
print(f"wild-type sessions, units passing the same rule (false-positive check), reading ({iso}), 6 ms:",
int(tagged(d[d[f"iso_{iso}"]], "opto_base6").sum()), "of", int(d[f"iso_{iso}"].sum()))
OPTO_ISO, OPTO_BASE, OPTO_EXCL = "c", "opto_base6", True
OPTO = units[units.group.isin(["Pvalb", "Sst"]) & units[f"iso_{OPTO_ISO}"] & tagged(units, OPTO_BASE)].copy()
OPTO["si"] = W.symmetry_index(OPTO.PL_below, OPTO.PL_above)
print("tagged units, isolation c, baseline 6 ms:", OPTO.group.value_counts().to_dict(),
"; failing the per-unit exclusions:", OPTO[~unit_ok(OPTO)].groupby("group").size().to_dict(),
"(peak channel off centre:", int(OPTO.peak_off_centre.sum()), "); NaN 1/V above:", int(OPTO.PL_above.isna().sum()))
if OPTO_EXCL:
OPTO = OPTO[unit_ok(OPTO)].copy()
print("tagged units used below (isolation c, baseline 6 ms, per-unit exclusions):", OPTO.group.value_counts().to_dict())
isolation baseline line units mice per mouse per session after exclusions
c 6 ms Pvalb 12 5 2.40 [2, 0, 1, 0, 9] 10
c 6 ms Sst 7 6 1.17 [0, 1, 0, 1, 2, 3] 5
c 10 ms Pvalb 12 5 2.40 [2, 0, 1, 0, 9] 10
c 10 ms Sst 6 6 1.00 [0, 1, 0, 1, 2, 2] 4
a 6 ms Pvalb 13 5 2.60 [3, 0, 1, 0, 9] 10
a 6 ms Sst 8 6 1.33 [1, 1, 0, 1, 2, 3] 5
a 10 ms Pvalb 13 5 2.60 [3, 0, 1, 0, 9] 10
a 10 ms Sst 7 6 1.17 [1, 1, 0, 1, 2, 2] 4
b 6 ms Pvalb 24 5 4.80 [9, 0, 1, 0, 14] 15
b 6 ms Sst 14 6 2.33 [3, 2, 0, 1, 3, 5] 11
b 10 ms Pvalb 25 5 5.00 [9, 0, 2, 0, 14] 16
b 10 ms Sst 12 6 2.00 [3, 1, 0, 1, 3, 4] 9
wild-type sessions, units passing the same rule (false-positive check), reading (c), 6 ms: 6 of 630
wild-type sessions, units passing the same rule (false-positive check), reading (a), 6 ms: 6 of 900
tagged units, isolation c, baseline 6 ms: {'Pvalb': 12, 'Sst': 7} ; failing the per-unit exclusions: {'Pvalb': 2, 'Sst': 2} (peak channel off centre: 4 ); NaN 1/V above: 0
tagged units used below (isolation c, baseline 6 ms, per-unit exclusions): {'Pvalb': 10, 'Sst': 5}
Result: not reproduced. In the 5 Pvalb and 6 Sst sessions held, isolation (a) with the 6 ms baseline tags 13 Pvalb and 8 Sst units, 2.60 and 1.33 per mouse, against 3.0 to 3.1 and 1.5; isolation (b) gives 4.80 and 2.33 per mouse (6 ms) or 5.00 and 2.00 (10 ms), and reading (c) 2.40 and 1.17. Two Pvalb sessions have no tagged unit. The same rule tags 6 of 900 wild-type units (reading a). Of the 12 Pvalb and 7 Sst units of reading (c), 2 and 2 fail the code's per-unit exclusions (4 have the peak channel off centre).
fig7d-pvalb-fs-sst-diffuse¶
In one-channel feature space opto-tagged Pvalb units overlap the wild-type FS cluster, while Sst units are more diffuse and span FS and RS.
Readings (criterion): (a) the experiment-based classifier of fig4g (trained on the wild-type units of reading c; tagged units z-scored with the wild-type upsampled set's mean and SD), (b) the nearer of the two wild-type K-means centroids in the same z-scored space.
wt = units.loc[labels["c"].index]
lab_wt = labels["c"].onech.values
rng = np.random.default_rng(seed_of("fig7d-pvalb-fs-sst-diffuse"))
votes = np.zeros((len(OPTO), 2), int)
for _ in range(20):
idx = W.upsample_index(lab_wt, rng)
Xu = wt[["TPW", "REP"]].values[idx]
mu, sdv = Xu.mean(0), Xu.std(0)
acc, v, cls = W.classifier((Xu - mu) / sdv, lab_wt[idx], (OPTO[["TPW", "REP"]].values - mu) / sdv, "svm", 20,
int(rng.integers(2 ** 31)))
votes += v
OPTO["fsrs_svm"] = np.array(cls)[votes.argmax(1)]
Xw = W.pre_process(wt[["TPW", "REP"]].values)
mu, sdv = wt[["TPW", "REP"]].values.mean(0), wt[["TPW", "REP"]].values.std(0)
cent = {g: Xw[lab_wt == g].mean(0) for g in ("FS", "RS")}
Xo = (OPTO[["TPW", "REP"]].values - mu) / sdv
OPTO["fsrs_centroid"] = np.where(np.linalg.norm(Xo - cent["FS"], axis=1) < np.linalg.norm(Xo - cent["RS"], axis=1), "FS", "RS")
for c in ("fsrs_svm", "fsrs_centroid"):
tab = pd.crosstab(OPTO.group, OPTO[c])
print(c, tab.to_dict(), "; share in RS:", (tab["RS"] / tab.sum(1)).round(3).to_dict() if "RS" in tab else 0)
print("(20 resamplings x 20 splits)")
print(OPTO.groupby("group")[["TPW", "REP"]].median().round(3).to_dict())
fsrs_svm {'FS': {'Pvalb': 10, 'Sst': 2}, 'RS': {'Pvalb': 0, 'Sst': 3}} ; share in RS: {'Pvalb': 0.0, 'Sst': 0.6}
fsrs_centroid {'FS': {'Pvalb': 10, 'Sst': 2}, 'RS': {'Pvalb': 0, 'Sst': 3}} ; share in RS: {'Pvalb': 0.0, 'Sst': 0.6}
(20 resamplings x 20 splits)
{'TPW': {'Pvalb': 0.212, 'Sst': 0.448}, 'REP': {'Pvalb': 0.209, 'Sst': 0.302}}
/tmp/ipykernel_2394/1195285833.py:20: Pandas4Warning: Starting with pandas version 4.0 all arguments of sum will be keyword-only. print(c, tab.to_dict(), "; share in RS:", (tab["RS"] / tab.sum(1)).round(3).to_dict() if "RS" in tab else 0) /tmp/ipykernel_2394/1195285833.py:20: Pandas4Warning: Starting with pandas version 4.0 all arguments of sum will be keyword-only. print(c, tab.to_dict(), "; share in RS:", (tab["RS"] / tab.sum(1)).round(3).to_dict() if "RS" in tab else 0)
Result: reproduced. All 10 Pvalb units fall in FS by both readings, while the Sst units fall in both clusters (2 FS, 3 RS); 60% of Sst units are in RS against 0% of Pvalb units.
fig7e-pvalb-sst-one-channel¶
Opto-tagged Pvalb and Sst units differ in TPW, REP and spike rate, Pvalb units having narrower waveforms, shorter REP and higher rates.
Two-sided Mann-Whitney tests; rate under the four period readings.
The tagged set used for the opto-tagged claims is isolation (c), the 6 ms baseline, and the code's per-unit exclusions of the wild-type units (peak channel at the centre, trough time within 0.1 ms, amplitude 15 to 300 uV), so that the opto-tagged and wild-type units pass the same steps (an assumption); every other tagged set is shown in the readings table below.
pv, ss = OPTO[OPTO.group == "Pvalb"], OPTO[OPTO.group == "Sst"]
for c in ["TPW", "REP", "rate_spont5", "rate_spont", "rate_first5min", "rate_session", "rate_dg"]:
p = stats.mannwhitneyu(pv[c], ss[c], alternative="two-sided").pvalue
print(f"{c:15s} median Pvalb {pv[c].median():.3f}, Sst {ss[c].median():.3f}, MW p = {p:.2e} (n {len(pv)}, {len(ss)})")
print("per session (Pvalb, Sst units):", OPTO.groupby(["group", "session"]).size().to_dict())
TPW median Pvalb 0.212, Sst 0.448, MW p = 1.27e-02 (n 10, 5)
REP median Pvalb 0.209, Sst 0.302, MW p = 2.66e-03 (n 10, 5)
rate_spont5 median Pvalb 11.115, Sst 7.080, MW p = 3.71e-01 (n 10, 5)
rate_spont median Pvalb 14.987, Sst 11.564, MW p = 4.40e-01 (n 10, 5)
rate_first5min median Pvalb 7.415, Sst 8.377, MW p = 8.59e-01 (n 10, 5)
rate_session median Pvalb 13.967, Sst 13.438, MW p = 4.40e-01 (n 10, 5)
rate_dg median Pvalb 9.826, Sst 13.754, MW p = 5.94e-01 (n 10, 5)
per session (Pvalb, Sst units): {('Pvalb', 721123822): 1, ('Pvalb', 797828357): 9, ('Sst', 760693773): 2, ('Sst', 762602078): 3}
fig7g-pvalb-more-symmetric¶
Opto-tagged Pvalb units have more symmetric EAP propagation (a lower symmetry index) than Sst units, as the models predict.
a_, b_ = pv.si.dropna(), ss.si.dropna()
print(f"symmetry index mean Pvalb {a_.mean():.3f} (n {len(a_)}), Sst {b_.mean():.3f} (n {len(b_)}); "
f"t-test p = {stats.ttest_ind(a_, b_).pvalue:.3f}; Mann-Whitney p = {stats.mannwhitneyu(a_, b_, alternative='two-sided').pvalue:.3f}")
sd7 = sd_table("Fig7deg")
print("Source Data Fig7deg: mean SI Pvalb", round(sd7[sd7.cell_type == "Pvalb"]["symmetry index"].astype(float).mean(), 3),
"Sst", round(sd7[sd7.cell_type == "Sst"]["symmetry index"].astype(float).mean(), 3))
symmetry index mean Pvalb 0.963 (n 10), Sst 1.565 (n 5); t-test p = 0.003; Mann-Whitney p = 0.008 Source Data Fig7deg: mean SI Pvalb 0.924 Sst 1.448
fig7h-pvalb-higher-cv¶
During drifting gratings opto-tagged Pvalb units have higher spike time variability (CV) than Sst units.
for c in ("cv_dg_a", "cv_dg_b"):
p = stats.mannwhitneyu(pv[c].dropna(), ss[c].dropna(), alternative="two-sided").pvalue
print(f"{c}: median Pvalb {pv[c].median():.3f}, Sst {ss[c].median():.3f}, Pvalb higher: {pv[c].median() > ss[c].median()}, MW p = {p:.3f}")
sd7h = sd_table("Fig7h")
print("Source Data Fig7h CV medians: Pvalb", round(sd7h[sd7h.cell_type == "Pvalb"].CV.astype(float).median(), 3),
"Sst", round(sd7h[sd7h.cell_type == "Sst"].CV.astype(float).median(), 3))
cv_dg_a: median Pvalb 1.714, Sst 1.025, Pvalb higher: True, MW p = 0.001 cv_dg_b: median Pvalb 1.819, Sst 1.814, Pvalb higher: True, MW p = 0.310 Source Data Fig7h CV medians: Pvalb 1.915 Sst 1.624
fig7h-pvalb-theta-sst-later¶
Opto-tagged Pvalb units phase-lock more strongly than Sst units to theta, and Sst units spike about 40 to 50 degrees later than Pvalb units in beta, low gamma and high gamma.
for lfp in "ab":
p_ = PH[(PH.period == "dg") & (PH.lfp == lfp) & (PH.cap == "first") & (PH.bands == "results")]
p_ = p_[p_.unit_id.isin(OPTO.index)].merge(OPTO[["group"]], left_on="unit_id", right_index=True)
lk = p_[p_.p < 0.001]
th = lk[lk.band == "theta"]
for col in ("kappa", "R"):
a1, b1 = th[th.group == "Pvalb"][col], th[th.group == "Sst"][col]
print(f"LFP {lfp} theta {col}: median Pvalb {a1.median():.3f} (n {len(a1)}), Sst {b1.median():.3f} (n {len(b1)}), "
f"MW p = {stats.mannwhitneyu(a1, b1, alternative='two-sided').pvalue:.3f}")
for band in ("beta", "low_gamma", "high_gamma"):
x = lk[lk.band == band]
a1, b1 = x[x.group == "Pvalb"].phase, x[x.group == "Sst"].phase
dm = (circ_mean_deg(b1) - circ_mean_deg(a1) + 180) % 360 - 180
print(f"LFP {lfp} {band}: mean phase Pvalb {circ_mean_deg(a1):.1f}, Sst {circ_mean_deg(b1):.1f}, Sst - Pvalb {dm:.1f} deg, "
f"MW p = {stats.mannwhitneyu(a1, b1, alternative='two-sided').pvalue:.3f} (n {len(a1)}, {len(b1)})")
LFP a theta kappa: median Pvalb 1.289 (n 10), Sst 0.134 (n 5), MW p = 0.003 LFP a theta R: median Pvalb 0.540 (n 10), Sst 0.067 (n 5), MW p = 0.003 LFP a beta: mean phase Pvalb 163.4, Sst 182.5, Sst - Pvalb 19.0 deg, MW p = 0.304 (n 10, 4) LFP a low_gamma: mean phase Pvalb 145.0, Sst 202.1, Sst - Pvalb 57.1 deg, MW p = 0.001 (n 10, 5) LFP a high_gamma: mean phase Pvalb 151.0, Sst 218.7, Sst - Pvalb 67.7 deg, MW p = 0.005 (n 10, 5)
LFP b theta kappa: median Pvalb 1.260 (n 10), Sst 0.114 (n 5), MW p = 0.001 LFP b theta R: median Pvalb 0.531 (n 10), Sst 0.057 (n 5), MW p = 0.001 LFP b beta: mean phase Pvalb 160.2, Sst 171.1, Sst - Pvalb 10.9 deg, MW p = 0.454 (n 10, 4) LFP b low_gamma: mean phase Pvalb 140.3, Sst 204.7, Sst - Pvalb 64.3 deg, MW p = 0.040 (n 10, 5) LFP b high_gamma: mean phase Pvalb 157.7, Sst 229.7, Sst - Pvalb 72.0 deg, MW p = 0.008 (n 10, 5)
The opto-tagged claims under every reading of the tagged set (isolation c, a or b, baseline 6 or 10 ms, with or without the per-unit exclusions): two-sided tests as above, LFP (a), first 10,000 spikes, Results bands.
p_all = PH[(PH.period == "dg") & (PH.lfp == "a") & (PH.cap == "first") & (PH.bands == "results")]
rows = []
for iso in "cab":
for base in ("opto_base6", "opto_base10"):
for excl in (True, False):
o = units[units.group.isin(["Pvalb", "Sst"]) & units[f"iso_{iso}"] & tagged(units, base)].copy()
if excl:
o = o[unit_ok(o)]
o["si"] = W.symmetry_index(o.PL_below, o.PL_above)
a1, b1 = o[o.group == "Pvalb"], o[o.group == "Sst"]
row = {"iso": iso, "base": base[-2:], "excl": excl, "n Pvalb": len(a1), "n Sst": len(b1)}
for c in ("TPW", "REP", "rate_spont5", "rate_dg"):
row[f"{c} p"] = float("%.1e" % stats.mannwhitneyu(a1[c], b1[c], alternative="two-sided").pvalue)
row["SI mean Pv"], row["SI mean Sst"] = round(a1.si.mean(), 2), round(b1.si.mean(), 2)
row["SI t p"] = float("%.1e" % stats.ttest_ind(a1.si.dropna(), b1.si.dropna()).pvalue)
for c in ("cv_dg_a", "cv_dg_b"):
row[f"{c} Pv>Sst"] = bool(a1[c].median() > b1[c].median())
row[f"{c} p"] = float("%.1e" % stats.mannwhitneyu(a1[c].dropna(), b1[c].dropna(), alternative="two-sided").pvalue)
pp = p_all[p_all.unit_id.isin(o.index)].merge(o[["group"]], left_on="unit_id", right_index=True)
lk = pp[pp.p < 0.001]
th = lk[lk.band == "theta"]
row["theta kappa p"] = float("%.1e" % stats.mannwhitneyu(th[th.group == "Pvalb"].kappa, th[th.group == "Sst"].kappa,
alternative="two-sided").pvalue)
for band in ("beta", "low_gamma", "high_gamma"):
x = lk[lk.band == band]
row[f"{band} dphase"] = round((circ_mean_deg(x[x.group == "Sst"].phase) - circ_mean_deg(x[x.group == "Pvalb"].phase) + 180) % 360 - 180, 1)
rows.append(row)
pd.set_option("display.max_columns", 40)
print(pd.DataFrame(rows).to_string(index=False))
iso base excl n Pvalb n Sst TPW p REP p rate_spont5 p rate_dg p SI mean Pv SI mean Sst SI t p cv_dg_a Pv>Sst cv_dg_a p cv_dg_b Pv>Sst cv_dg_b p theta kappa p beta dphase low_gamma dphase high_gamma dphase c e6 True 10 5 0.013000 0.00270 0.37 0.590 0.96 1.56 0.00340 True 0.00130 True 0.31 0.002700 19.0 57.1 67.7 c e6 False 12 7 0.001200 0.00016 0.77 0.540 0.96 1.43 0.02500 True 0.00720 False 0.65 0.000480 20.7 56.2 63.0 c 10 True 10 4 0.002000 0.00200 0.37 0.730 0.96 1.56 0.00810 True 0.00200 True 0.30 0.004000 19.0 47.6 67.6 c 10 False 12 6 0.000110 0.00011 0.96 0.150 0.96 1.62 0.00049 True 0.00011 True 0.21 0.000220 17.4 50.8 61.8 a e6 True 10 5 0.013000 0.00270 0.37 0.590 0.96 1.56 0.00340 True 0.00130 True 0.31 0.002700 19.0 57.1 67.7 a e6 False 13 8 0.000440 0.00770 0.70 0.460 0.95 2.47 0.07900 True 0.05300 True 0.86 0.000310 22.0 54.5 63.0 a 10 True 10 4 0.002000 0.00200 0.37 0.730 0.96 1.56 0.00810 True 0.00200 True 0.30 0.004000 19.0 47.6 67.6 a 10 False 13 7 0.000026 0.00850 0.82 0.160 0.95 2.78 0.04300 True 0.00630 True 0.44 0.000150 18.7 49.1 61.8 b e6 True 15 11 0.001300 0.00019 0.64 0.530 1.23 1.35 0.79000 True 0.00150 False 0.76 0.000230 18.2 52.6 61.7 b e6 False 24 14 0.000530 0.00170 0.24 0.063 1.23 1.91 0.25000 True 0.01800 False 0.96 0.000043 19.4 51.5 67.5 b 10 True 16 9 0.000400 0.00026 0.38 0.980 1.28 1.30 0.97000 True 0.00140 False 0.98 0.000610 20.8 50.6 65.4 b 10 False 25 12 0.000140 0.00240 0.39 0.058 1.26 2.07 0.19000 True 0.00270 False 0.83 0.000051 19.4 50.6 69.2
# The main tagged set by session, and the tests with the Pvalb units of the one session that holds most of them.
print(OPTO.assign(si=OPTO.si.round(3))[["group", "session", "TPW", "REP", "si", "cv_dg_a", "cv_dg_b"]]
.sort_values(["group", "session"]).round(3).to_string())
top = OPTO[OPTO.group == "Pvalb"].session.value_counts().idxmax()
pv1, ss1 = OPTO[(OPTO.group == "Pvalb") & (OPTO.session == top)], OPTO[OPTO.group == "Sst"]
print(f"Pvalb units of session {top} only: {len(pv1)}; Sst units: {len(ss1)}, by session {ss1.session.value_counts().to_dict()}")
for c in ("TPW", "REP", "cv_dg_a", "cv_dg_b"):
p = stats.mannwhitneyu(pv1[c].dropna(), ss1[c].dropna(), alternative="two-sided").pvalue
print(f"{c:8s} median Pvalb {pv1[c].median():.3f}, Sst {ss1[c].median():.3f}, MW p = {p:.2e}")
print(f"symmetry index mean Pvalb {pv1.si.mean():.3f}, Sst {ss1.si.mean():.3f}, "
f"t-test p = {stats.ttest_ind(pv1.si.dropna(), ss1.si.dropna()).pvalue:.2e}")
pp = p_all[p_all.unit_id.isin(pv1.index.union(ss1.index))].merge(OPTO[["group"]], left_on="unit_id", right_index=True)
th = pp[(pp.p < 0.001) & (pp.band == "theta")]
print(f"theta kappa median Pvalb {th[th.group == 'Pvalb'].kappa.median():.3f}, Sst {th[th.group == 'Sst'].kappa.median():.3f}, "
f"MW p = {stats.mannwhitneyu(th[th.group == 'Pvalb'].kappa, th[th.group == 'Sst'].kappa, alternative='two-sided').pvalue:.2e}")
group session TPW REP si cv_dg_a cv_dg_b
unit_id
950908424 Pvalb 721123822 0.200 0.198 1.014 1.406 1.735
951091685 Pvalb 797828357 0.201 0.221 0.649 1.779 1.754
951092078 Pvalb 797828357 0.203 0.184 1.283 1.858 2.050
951092169 Pvalb 797828357 0.270 0.246 0.337 1.477 1.613
951092262 Pvalb 797828357 0.200 0.197 0.989 2.567 3.007
951092354 Pvalb 797828357 0.245 0.267 0.819 1.737 2.005
951092425 Pvalb 797828357 0.221 0.178 1.143 1.691 1.820
951092652 Pvalb 797828357 0.233 0.222 1.066 2.126 2.791
951092943 Pvalb 797828357 0.296 0.264 0.701 1.313 1.675
951093075 Pvalb 797828357 0.195 0.184 1.629 1.516 1.818
951789528 Sst 760693773 0.571 0.325 1.398 0.938 0.963
951789472 Sst 760693773 0.548 0.328 1.735 0.890 1.061
951844456 Sst 762602078 0.214 0.255 1.571 1.383 1.814
951846428 Sst 762602078 0.318 0.274 1.550 1.025 1.921
951844981 Sst 762602078 0.448 0.302 1.571 1.271 1.895
Pvalb units of session 797828357 only: 9; Sst units: 5, by session {762602078: 3, 760693773: 2}
TPW median Pvalb 0.221, Sst 0.448, MW p = 1.90e-02
REP median Pvalb 0.221, Sst 0.302, MW p = 4.00e-03
cv_dg_a median Pvalb 1.737, Sst 1.025, MW p = 2.00e-03
cv_dg_b median Pvalb 1.820, Sst 1.814, MW p = 2.40e-01
symmetry index mean Pvalb 0.957, Sst 1.565, t-test p = 5.20e-03
theta kappa median Pvalb 1.413, Sst 0.134, MW p = 9.99e-04
Result: partially reproduced. Pvalb units lock more strongly to theta (median kappa 1.289 against 0.134, p = 0.003). Sst units spike later by 57.1 degrees in low gamma (p = 0.001) and 67.7 in high gamma (p = 0.005), both above 36 to 55 degrees, and by 19.0 degrees in beta (p = 0.30). In the other tagged sets the low-gamma difference falls in 47.6 to 57.1 degrees and the beta difference stays below 23 degrees. On the 9 Pvalb units of session 797828357 alone the theta kappa test gives p = 0.0010.
Result: reproduced, resting on an assumption. Pvalb CV is higher within presentations (median 1.714 against 1.025, Mann-Whitney p = 0.0013, 10 and 5 units). Over whole blocks the medians are nearly equal (1.819 against 1.814, p = 0.31). In the readings table, CV within presentations is higher for Pvalb in every tagged set, with p from 0.00011 to 0.053 (only isolation a without exclusions and with the 6 ms baseline is above 0.05; with the 10 ms baseline that set gives 0.0063); over whole blocks no set gives p below 0.05, and Sst is higher under isolation (b) and under isolation (c) with the 6 ms baseline and no exclusions. The outcome rests on the within-presentation reading: over whole blocks, the period whose CV matches the Source Data best for the wild-type units (fig3a-rs1-excitability), the medians are equal, and the Sst median within presentations (1.025) is far from that of Source Data sheet Fig7h (1.624; Pvalb 1.915). 9 of the 10 Pvalb units come from session 797828357; on those 9 alone CV within presentations gives p = 0.0020 and over whole blocks p = 0.24.
Result: reproduced, resting on an assumption. The Pvalb mean symmetry index is lower (0.963 against 1.565), t-test p = 0.0034 (Mann-Whitney p = 0.008), close to the Source Data means (0.924 and 1.448). Without the per-unit exclusions the Sst mean rises to 1.43 (isolation c) or 2.47 (isolation a), and the t-test gives 0.025 and 0.079; isolation (b) gives p = 0.79 with the exclusions and 0.25 without. 9 of the 10 Pvalb units come from session 797828357; on those 9 alone the mean is 0.957 against 1.565, t-test p = 0.0052, so the result rests mainly on one Pvalb mouse.
Result: not reproduced, resting on an assumption. Pvalb units have lower REP (median 0.209 against 0.302 ms, p = 0.0027) and lower TPW (0.212 against 0.448 ms, p = 0.013, above 0.01), and their rate is not higher under any period reading (p 0.37 to 0.86), so one of the three holds. Without the per-unit exclusions TPW gives p = 0.0012 and REP 0.00016 (isolation c), and with the exclusions and the 10 ms baseline both give p = 0.0020; either would make it partially reproduced. Only the main set, and its isolation (a) twin with the same units, leaves TPW above 0.01. The 6 ms baseline is the window corresponding to the 2 to 8 ms response window (Methods, Detection of opto-tagged neurons: "a corresponding time window immediately preceding stimulus onset"). No tagged set gives a rate difference. On the 9 Pvalb units of session 797828357 alone TPW gives p = 0.019 and REP 0.0040.
Claims on the models (outside the dataset)¶
The simulated EAP features of the 33 models are read from model_features.csv of the paper's
code at commit 1e35126 (an input). cell_type is 0 for aspiny (AP) and 1 for spiny (SP)
models (Exp_Model_Classifier.ipynb cell 3); str_label names the SP clusters RS1 to RS3,
which Source Data sheets Fig5a and Fig5e call SP1 to SP3 for the same cells.
fig4d-ap-sp-models-tpw-rep¶
Simulated EAPs of aspiny (AP) models have significantly lower TPW and REP than those of spiny (SP) models, as in vivo FS against RS.
AP, SP = model[model.cell_type == 0], model[model.cell_type == 1]
print("models: AP", len(AP), "SP", len(SP), "; Cre lines", model.cre_lines.value_counts().to_dict())
print(f"TPW mean AP {AP.TPW.mean():.3f}, SP {SP.TPW.mean():.3f} ms, t-test p = {stats.ttest_ind(AP.TPW, SP.TPW).pvalue:.2e}")
print(f"REP median AP {AP.REP.median():.3f}, SP {SP.REP.median():.3f} ms, Mann-Whitney p = "
f"{stats.mannwhitneyu(AP.REP, SP.REP, alternative='two-sided').pvalue:.2e}")
models: AP 18 SP 15 ; Cre lines {'Pvalb': 9, 'Sst': 9, 'Rorb': 6, 'Nr5a1': 5, 'Scnn1a': 4}
TPW mean AP 0.662, SP 0.831 ms, t-test p = 2.50e-04
REP median AP 0.461, SP 0.598 ms, Mann-Whitney p = 4.85e-04
Result: reproduced. AP models have lower TPW (0.662 against 0.831 ms, t-test p = 2.5e-04) and REP (median 0.461 against 0.598 ms, Mann-Whitney p = 4.9e-04).
fig4f-model-classifier¶
A linear SVM trained on TPW and REP of the models separates AP from SP with 82.5% validation accuracy, and applied to in vivo units labels most FS units AP and most RS units SP.
As Exp_Model_Classifier.ipynb cell 7: SP models upsampled to the AP count and z-scored; the in vivo units (reading c, FS upsampled) z-scored on their own; 100 resamplings of 100 splits.
SEED_MC = seed_of("fig4f-model-classifier")
def model_exp_runs(seed, n_rep, direction):
rng = np.random.default_rng(seed)
mlab = model.cell_type.values
acc, votes = [], None
for _ in range(n_rep):
mi = W.upsample_index(mlab, rng)
Xm = W.zscore(model[["TPW", "REP"]].values[mi])
ei = W.upsample_index(lab_wt, rng)
Xe = W.zscore(wt[["TPW", "REP"]].values[ei])
if direction == "model":
a, v, cls = W.classifier(Xm, mlab[mi], Xe, "svm", 100, int(rng.integers(2 ** 31)))
v = pd.DataFrame(v, columns=cls).groupby(ei).sum().reindex(range(len(wt))).fillna(0).values
else:
a, v, cls = W.classifier(Xe, lab_wt[ei], Xm, "svm", 100, int(rng.integers(2 ** 31)))
v = pd.DataFrame(v, columns=cls).groupby(mi).sum().reindex(range(len(model))).values
acc.append(a)
votes = v if votes is None else votes + v
return float(np.mean(acc)), votes, cls
acc_m, votes_m, cls_m = model_exp_runs(SEED_MC, 100, "model")
pred = np.where(votes_m.sum(1) == 0, "none", np.array(["AP", "SP"])[votes_m.argmax(1)])
tab = pd.crosstab(lab_wt, pred)
print(f"model-based classifier, validation accuracy {100 * acc_m:.2f}% (expected 82.5 +- 8.25)")
print("in vivo units (reading c) by majority label:", tab.to_dict())
print("share of FS labelled AP:", round(tab.loc["FS", "AP"] / tab.loc["FS"].sum(), 3),
"; share of RS labelled SP:", round(tab.loc["RS", "SP"] / tab.loc["RS"].sum(), 3))
print("five seeds (10 resamplings):", [round(100 * model_exp_runs(SEED_MC + 1000 * k, 10, "model")[0], 2) for k in range(5)])
Xmod = model[["TPW", "REP"]].values.astype(float)
a1, b1 = split_first(Xmod, model.cell_type.values, SEED_MC + 1)
a0, b0 = split_first(Xmod, np.random.default_rng(SEED_MC + 2).permutation(model.cell_type.values), SEED_MC + 3)
print(f"models, split before upsampling (100 splits): accuracy {100 * a1:.2f}%, balanced {100 * b1:.2f}%; "
f"labels permuted: accuracy {100 * a0:.2f}%, balanced {100 * b0:.2f}%")
model-based classifier, validation accuracy 83.13% (expected 82.5 +- 8.25)
in vivo units (reading c) by majority label: {'AP': {'FS': 124, 'RS': 73}, 'SP': {'FS': 7, 'RS': 312}}
share of FS labelled AP: 0.947 ; share of RS labelled SP: 0.81
five seeds (10 resamplings): [83.31, 83.68, 83.27, 81.86, 83.2]
models, split before upsampling (100 splits): accuracy 83.22%, balanced 81.60%; labels permuted: accuracy 49.33%, balanced 48.58%
Result: reproduced. The model-based classifier reaches 83.13% validation accuracy (81.86 to 83.68% under the five seeds); applied to the in vivo units of reading (c) it labels 94.7% of FS units AP and 81.0% of RS units SP. Splitting before upsampling gives 83.22% (balanced 81.60%) against 49.33% with permuted labels.
fig4g-models-map-to-fs-rs¶
The experiment-based classifier labels most AP models FS and most SP models RS.
SEED_EM = seed_of("fig4g-models-map-to-fs-rs")
acc_e, votes_e, cls_e = model_exp_runs(SEED_EM, 100, "exp")
model["exp_label"] = np.array(cls_e)[votes_e.argmax(1)]
tab = pd.crosstab(np.where(model.cell_type == 0, "AP", "SP"), model.exp_label)
print(f"experiment-based classifier accuracy {100 * acc_e:.2f}%; models by majority label: {tab.to_dict()}")
for k in range(5):
_, v, c = model_exp_runs(SEED_EM + 1000 * k, 10, "exp")
lab_k = np.array(c)[v.argmax(1)]
print(f"seed +{1000 * k} (10 resamplings): AP labelled FS {np.sum((model.cell_type == 0) & (lab_k == 'FS'))} of 18, "
f"SP labelled RS {np.sum((model.cell_type == 1) & (lab_k == 'RS'))} of 15")
experiment-based classifier accuracy 99.35%; models by majority label: {'FS': {'AP': 17, 'SP': 4}, 'RS': {'AP': 1, 'SP': 11}}
seed +0 (10 resamplings): AP labelled FS 17 of 18, SP labelled RS 11 of 15
seed +1000 (10 resamplings): AP labelled FS 17 of 18, SP labelled RS 11 of 15
seed +2000 (10 resamplings): AP labelled FS 17 of 18, SP labelled RS 11 of 15
seed +3000 (10 resamplings): AP labelled FS 17 of 18, SP labelled RS 11 of 15
seed +4000 (10 resamplings): AP labelled FS 16 of 18, SP labelled RS 11 of 15
Result: reproduced. The experiment-based classifier labels 17 of 18 AP models FS and 11 of 15 SP models RS (16 of 18 under one of the five seeds).
fig4h-cre-lines-map¶
Models of excitatory Cre lines (Scnn1a, Rorb, Nr5a1) are mainly classified RS and models of inhibitory lines (Pvalb, Sst) mainly FS.
print(pd.crosstab(model.cre_lines, model.exp_label).to_string())
exp_label FS RS cre_lines Nr5a1 1 4 Pvalb 9 0 Rorb 1 5 Scnn1a 2 2 Sst 8 1
Result: partially reproduced. Nr5a1 (4 of 5) and Rorb (5 of 6) models are mostly RS and Pvalb (9 of 9) and Sst (8 of 9) mostly FS, but Scnn1a models split 2 and 2; pooled, 11 of 15 excitatory models are RS and 17 of 18 inhibitory models FS.
fig5a-sp-models-three-clusters¶
K-means on the simulated multi-channel features of the 15 SP models gives three clusters (SP1 to SP3, with 5, 7 and 3 models), as many as the RS clusters in vivo.
SEED_SP = seed_of("fig5a-sp-models-three-clusters")
Xsp = W.pre_process(SP[["PL_below", "PL_above"]].values)
wc, fk = W.selection_k(Xsp, 9, seed=SEED_SP)
print(f"SP models: elbow K = {W.find_elbow(wc)}, f(K) minimum K = {int(fk.argmin() + 1)}; f(K) {np.round(fk, 3)}")
lab_sp = W.kmeans_labels(Xsp, 3, SEED_SP)
ref = SP.set_index("cell_list").str_label.str.replace("RS", "SP")
names_sp, tab = W.name_by_overlap(SP.cell_list.values, lab_sp, ref, ["SP1", "SP2", "SP3"])
print("K = 3 clusters:", pd.Series(names_sp).value_counts().sort_index().to_dict(), "; against the paper's labels:", tab.to_dict())
print("paper's labels in model_features.csv:", ref.value_counts().sort_index().to_dict())
for k in range(1, 5):
l = W.kmeans_labels(Xsp, 3, SEED_SP + 1000 * k)
print(f"seed +{1000 * k}: sizes {sorted(np.bincount(l).tolist(), reverse=True)}")
SP models: elbow K = 3, f(K) minimum K = 3; f(K) [1. 0.914 0.699 0.938 0.867 0.861 0.751 0.887 0.854]
K = 3 clusters: {'SP1': 5, 'SP2': 7, 'SP3': 3} ; against the paper's labels: {'SP1': {0: 0, 1: 5, 2: 0}, 'SP2': {0: 7, 1: 0, 2: 0}, 'SP3': {0: 0, 1: 0, 2: 3}}
paper's labels in model_features.csv: {'SP1': 5, 'SP2': 7, 'SP3': 3}
seed +1000: sizes [7, 5, 3]
seed +2000: sizes [7, 5, 3]
seed +3000: sizes [7, 5, 3]
seed +4000: sizes [7, 5, 3]
Result: reproduced. Both methods select K = 3 for the 15 SP models, and the clusters have 5, 7 and 3 models, matching the paper's labels one to one, under all five seeds.
fig5c-sp-rs-two-way-mapping¶
A random forest trained on the SP models' multi-channel features identifies SP1 to SP3 with more than 94% accuracy and maps RS1 to SP1, RS2 to SP2 and RS3 to SP3; the experiment-based classifier maps SP1 to SP3 back to RS1 to RS3.
The SP clusters of fig5a (named by the paper's labels) and the RS clusters of reading (c); each side z-scored on its own, classes upsampled; 20 resamplings of 100 splits.
SEED_RF2 = seed_of("fig5c-sp-rs-two-way-mapping")
rs_t = T["c"][T["c"].onech == "RS"].dropna(subset=["PL_below", "PL_above"])
rs_lab = rs_t.six.values
sp_lab = np.array(names_sp)
def two_way(seed, n_rep):
rng = np.random.default_rng(seed)
acc_m2, acc_e2 = [], []
v_rs = np.zeros((len(rs_t), 3), int)
v_sp = np.zeros((len(SP), 3), int)
for _ in range(n_rep):
mi = W.upsample_index(sp_lab, rng)
Xm = W.zscore(SP[["PL_below", "PL_above"]].values[mi])
ei = W.upsample_index(rs_lab, rng)
Xe = W.zscore(rs_t[["PL_below", "PL_above"]].values[ei])
a, v, c = W.classifier(Xm, sp_lab[mi], Xe, "rf", 100, int(rng.integers(2 ** 31)))
acc_m2.append(a)
v_rs += pd.DataFrame(v, columns=c).groupby(ei).sum().reindex(range(len(rs_t))).fillna(0).values.astype(int)
a, v, c2 = W.classifier(Xe, rs_lab[ei], Xm, "rf", 100, int(rng.integers(2 ** 31)))
acc_e2.append(a)
v_sp += pd.DataFrame(v, columns=c2).groupby(mi).sum().reindex(range(len(SP))).values.astype(int)
return np.mean(acc_m2), np.mean(acc_e2), v_rs, c, v_sp, c2
am, ae, v_rs, c_sp, v_sp, c_rs = two_way(SEED_RF2, 20)
rs_pred = np.array(c_sp)[v_rs.argmax(1)]
sp_pred = np.array(c_rs)[v_sp.argmax(1)]
print(f"model-based RF accuracy {100 * am:.2f}% ; experiment-based RF accuracy {100 * ae:.2f}%")
print("RS clusters to SP labels:", pd.crosstab(rs_lab, rs_pred).to_dict())
print("SP clusters to RS labels:", pd.crosstab(sp_lab, sp_pred).to_dict())
a1, b1 = split_first(SP[["PL_below", "PL_above"]].values.astype(float), sp_lab, SEED_RF2 + 1, model_name="rf")
a0, b0 = split_first(SP[["PL_below", "PL_above"]].values.astype(float), np.random.default_rng(SEED_RF2 + 2).permutation(sp_lab),
SEED_RF2 + 3, model_name="rf")
print(f"SP models, split before upsampling (100 splits): accuracy {100 * a1:.2f}%, balanced {100 * b1:.2f}%; "
f"labels permuted: accuracy {100 * a0:.2f}%, balanced {100 * b0:.2f}%")
print("five seeds (3 resamplings), model-based accuracy:", [round(100 * two_way(SEED_RF2 + 1000 * k, 3)[0], 2) for k in range(5)])
model-based RF accuracy 93.48% ; experiment-based RF accuracy 98.63%
RS clusters to SP labels: {'SP1': {'RS1': 152, 'RS2': 17, 'RS3': 0}, 'SP2': {'RS1': 1, 'RS2': 78, 'RS3': 17}, 'SP3': {'RS1': 23, 'RS2': 0, 'RS3': 89}}
SP clusters to RS labels: {'RS1': {'SP1': 4, 'SP2': 0, 'SP3': 0}, 'RS2': {'SP1': 1, 'SP2': 7, 'SP3': 0}, 'RS3': {'SP1': 0, 'SP2': 0, 'SP3': 3}}
SP models, split before upsampling (100 splits): accuracy 85.25%, balanced 86.33%; labels permuted: accuracy 24.50%, balanced 23.00%
five seeds (3 resamplings), model-based accuracy: [np.float64(93.44), np.float64(93.89), np.float64(93.78), np.float64(93.67), np.float64(94.17)]
Result: partially reproduced. The model-based random forest reaches 93.48%, just below 94% (93.44 to 94.17% under the five seeds, one above 94%), while both mappings hold: the most frequent SP label of RS1, RS2 and RS3 is SP1, SP2 and SP3, and SP1, SP2 and SP3 map back to RS1 (4 of 5), RS2 (7 of 7) and RS3 (3 of 3). Splitting before upsampling gives 85.25% (balanced 86.33%) against 24.50% with permuted labels, so the code's procedure inflates the accuracy.
fig6b-pvalb-sst-models-symmetry¶
The symmetry index separates Pvalb from Sst models, Pvalb models being more symmetric.
msi = W.symmetry_index(model.PL_below, model.PL_above)
a_, b_ = msi[model.cre_lines == "Pvalb"], msi[model.cre_lines == "Sst"]
print(f"model symmetry index mean Pvalb {a_.mean():.3f} (n {len(a_)}), Sst {b_.mean():.3f} (n {len(b_)}), "
f"t-test p = {stats.ttest_ind(a_, b_).pvalue:.2e}")
s6b = sd_table("Fig6b")
print("Source Data Fig6b (z-scored) means: Pvalb", round(s6b[s6b.cre_lines == "Pvalb"]["Symmetry index"].astype(float).mean(), 3),
"Sst", round(s6b[s6b.cre_lines == "Sst"]["Symmetry index"].astype(float).mean(), 3),
"; t-test p =", "%.2e" % stats.ttest_ind(s6b[s6b.cre_lines == "Pvalb"]["Symmetry index"].astype(float),
s6b[s6b.cre_lines == "Sst"]["Symmetry index"].astype(float)).pvalue)
model symmetry index mean Pvalb 2.692 (n 9), Sst 7.739 (n 9), t-test p = 9.98e-04 Source Data Fig6b (z-scored) means: Pvalb -0.708 Sst 0.708 ; t-test p = 9.98e-04
Result: reproduced. The model symmetry index is lower for Pvalb than Sst (mean 2.692 against 7.739, t-test p = 9.98e-04), as the Source Data gives.
Claims on the in vitro cells and the models' parameters (data elsewhere)¶
These claims use the in vitro recordings and reconstructions of the Allen Cell Types Database and the models' fitted conductances. The models' parameters are not in the paper's model repository (it holds one example model), so the conductance and morphology claims are tested on the per-cell values the paper published in its Source Data, which repeats the paper's statistics on its own numbers. The in vitro features are also read from the Allen Cell Types Database API (EphysFeature, by specimen id) to check the Source Data values: adaptation, f-I slope, tau, rheobase (threshold_i_long_square), resting potential (vrest) and rate (1000 / avg_isi, which equals the Source Data firing_rate). Spike width is not an API feature, so it is taken from the Source Data only.
Cohen's d uses the pooled SD (a standard choice).
import json as _json
def api_features(ids):
url = ("https://api.brain-map.org/api/v2/data/query.json?criteria=model::EphysFeature,"
"rma::criteria,%5Bspecimen_id$in" + ",".join(str(i) for i in ids) + "%5D&num_rows=200")
with urllib.request.urlopen(url) as r:
return pd.DataFrame(_json.load(r)["msg"]).set_index("specimen_id")
def cohen_d(a, b):
a, b = np.asarray(a, float), np.asarray(b, float)
sp_ = np.sqrt(((len(a) - 1) * a.var(ddof=1) + (len(b) - 1) * b.var(ddof=1)) / (len(a) + len(b) - 2))
return (a.mean() - b.mean()) / sp_
s4e = sd_table("Fig4e").set_index("specimen__id")
api = api_features(s4e.index.astype(int))
api["rate"] = 1000 / api.avg_isi
print("Allen API cells found:", len(api), "of", len(s4e))
for a_, b_ in [("adaptation", "adaptation"), ("f_i_curve_slope", "f_i_curve_slope"), ("tau", "tau"),
("threshold_i_long_square", "rheobase"), ("vrest", "resting_potential"), ("rate", "firing_rate")]:
d = np.abs(api.loc[s4e.index.astype(int), a_].values - s4e[b_].astype(float).values)
print(f" {b_:18s} max |API - Source Data| = {np.nanmax(d):.2e}")
for col, src in [("APwidth", "sd"), ("adaptation", "api"), ("firing_rate", "api"), ("f_i_curve_slope", "api")]:
if src == "api":
v = api.loc[s4e.index.astype(int), {"firing_rate": "rate"}.get(col, col)].values
else:
v = s4e[col].astype(float).values
ap_, sp_ = v[s4e.label.values == "AP"], v[s4e.label.values == "SP"]
n_nan = int(np.isnan(ap_).sum() + np.isnan(sp_).sum())
ap_, sp_ = ap_[~np.isnan(ap_)], sp_[~np.isnan(sp_)]
print(f"{col:16s} (cells without a value left out: {n_nan})", end=" ")
print(f" ({src}) median AP {np.median(ap_):.3f}, SP {np.median(sp_):.3f}; MW p = "
f"{stats.mannwhitneyu(ap_, sp_, alternative='two-sided').pvalue:.2e}; t-test p = {stats.ttest_ind(ap_, sp_).pvalue:.2e} (n {len(ap_)}, {len(sp_)})")
Allen API cells found: 33 of 33 adaptation max |API - Source Data| = 7.98e-17 f_i_curve_slope max |API - Source Data| = 0.00e+00 tau max |API - Source Data| = 0.00e+00 rheobase max |API - Source Data| = 0.00e+00 resting_potential max |API - Source Data| = 0.00e+00 firing_rate max |API - Source Data| = 3.84e-13 APwidth (cells without a value left out: 6) (sd) median AP 0.540, SP 0.762; MW p = 1.12e-05; t-test p = 2.81e-07 (n 13, 14) adaptation (cells without a value left out: 5) (api) median AP 0.009, SP 0.049; MW p = 1.26e-03; t-test p = 1.98e-03 (n 15, 13) firing_rate (cells without a value left out: 3) (api) median AP 49.692, SP 12.504; MW p = 2.94e-05; t-test p = 1.19e-04 (n 16, 14) f_i_curve_slope (cells without a value left out: 0) (api) median AP 0.671, SP 0.149; MW p = 1.16e-06; t-test p = 1.16e-06 (n 18, 15)
Result: partially reproduced. The Allen API features equal the Source Data values. Spike width (Source Data), spike rate and f-I slope differ with p below 0.001 (1.1e-05, t-test 1.2e-04, 1.2e-06), and adaptation with p = 0.0013, below 0.05 but not 0.001. Not every cell has every feature: spike width is missing for 6 cells, adaptation for 5, rate for 3, and these are left out.
fig5j-sp1-rate-tau¶
In vitro, SP1 neurons reach a higher maximum spike rate than SP2 neurons and are more electrotonically compact (differing cellular time constant).
s5j = sd_table("Fig5j")
s5a = sd_table("Fig5a")
ids5 = s5a.cell_list.astype(int).values
api5 = api.loc[ids5]
lab5 = s5j.str_cell_type.values
for col, v in [("rate (API)", api5.rate.values), ("tau (API)", api5.tau.values),
("rate (Source Data)", s5j.firing_rate.astype(float).values), ("tau (Source Data)", s5j.tau.astype(float).values)]:
a1, a2 = v[lab5 == "SP1"], v[lab5 == "SP2"]
a1, a2 = a1[~np.isnan(a1)], a2[~np.isnan(a2)]
print(f"{col}: mean SP1 {a1.mean():.2f}, SP2 {a2.mean():.2f}, Cohen's d SP1-SP2 {cohen_d(a1, a2):.2f} (n {len(a1)}, {len(a2)})")
d5 = np.abs(s5j.firing_rate.astype(float).values - api5.rate.values)
print("Source Data Fig5j rates against API 1000/avg_isi: equal for", int(np.sum(d5 < 1e-6)), "of", len(d5),
"; API avg_isi missing for", int(np.isnan(api5.rate.values).sum()))
rate (API): mean SP1 14.58, SP2 11.23, Cohen's d SP1-SP2 0.89 (n 5, 6) tau (API): mean SP1 21.28, SP2 15.75, Cohen's d SP1-SP2 1.13 (n 5, 7) rate (Source Data): mean SP1 14.58, SP2 11.23, Cohen's d SP1-SP2 0.89 (n 5, 6) tau (Source Data): mean SP1 21.28, SP2 15.75, Cohen's d SP1-SP2 1.13 (n 5, 7) Source Data Fig5j rates against API 1000/avg_isi: equal for 14 of 15 ; API avg_isi missing for 1
Result: reproduced. SP1 against SP2 gives Cohen's d = 0.89 for spike rate (SP1 higher, 14.58 against 11.23 Hz; one SP2 cell has no API rate) and 1.13 for tau.
fig6g-pvalb-sst-in-vitro¶
In vitro, Pvalb and Sst neurons differ in maximum spike rate, rheobase and resting potential among other properties.
s6g = sd_table("Fig6g").set_index("specimen__id")
api6 = api_features(s6g.index.astype(int))
api6["rate"] = 1000 / api6.avg_isi
cre6 = s6g.cre_lines.values
print("API avg_isi missing for", int(api6.rate.isna().sum()), "of", len(api6), "cells; Source Data firing_rate shown as well")
for col in ("rate", "threshold_i_long_square", "vrest", "sd firing_rate"):
v = (s6g.firing_rate.astype(float).values if col == "sd firing_rate"
else api6.loc[s6g.index.astype(int), col].values)
a1, a2 = v[cre6 == "Pvalb"], v[cre6 == "Sst"]
a1, a2 = a1[~np.isnan(a1)], a2[~np.isnan(a2)]
print(f"{col:24s} median Pvalb {np.median(a1):.2f}, Sst {np.median(a2):.2f}, MW p = {stats.mannwhitneyu(a1, a2, alternative='two-sided').pvalue:.4f}, "
f"t-test p = {stats.ttest_ind(a1, a2).pvalue:.4f} (n {len(a1)}, {len(a2)})")
API avg_isi missing for 2 of 18 cells; Source Data firing_rate shown as well rate median Pvalb 75.65, Sst 23.32, MW p = 0.0011, t-test p = 0.0002 (n 8, 8) threshold_i_long_square median Pvalb 230.00, Sst 50.00, MW p = 0.0008, t-test p = 0.0000 (n 9, 9) vrest median Pvalb -73.89, Sst -69.60, MW p = 0.0081, t-test p = 0.0068 (n 9, 9) sd firing_rate median Pvalb 75.65, Sst 23.32, MW p = 0.0011, t-test p = 0.0002 (n 8, 8)
Result: reproduced. From the Allen API features, maximum spike rate (Mann-Whitney p = 0.0011), rheobase (0.0008) and resting potential (0.0081) differ between Pvalb and Sst cells. The paper gives p = 0.0067 for the rate; here the rate gives 0.0011 by either source, and 0.0068 is the t-test p of the resting potential, so the paper's rate p may belong to another feature or test.
fig5e-ca-lva¶
Axonal low-voltage-activated Ca conductance is higher in SP1 and SP3 models than in SP2 models, with a large effect size.
s5e = sd_table("Fig5e")
g = s5e.gbar_Ca_LVA.astype(float).values
l5 = s5e.str_cell_type.values
for a in ("SP1", "SP3"):
print(f"{a} against SP2: mean {g[l5 == a].mean():.5f} against {g[l5 == 'SP2'].mean():.5f}, Cohen's d {cohen_d(g[l5 == a], g[l5 == 'SP2']):.2f}")
SP1 against SP2: mean 0.00783 against 0.00293, Cohen's d 2.07 SP3 against SP2: mean 0.00746 against 0.00293, Cohen's d 2.12
Result: reproduced on the Source Data values. Axonal Ca LVA is higher in SP1 and SP3 than SP2 (Cohen's d 2.07 and 2.12).
fig6cf-kv31¶
Pvalb and Sst models differ significantly in three conductances, the largest effect being dendritic Kv3.1.
Source Data sheet Fig6cf lists five conductances, not all of the models' parameters.
s6c = sd_table("Fig6cf")
for col in s6c.columns[4:]:
v = s6c[col].astype(float).values
a1, a2 = v[s6c.cre_lines.values == "Pvalb"], v[s6c.cre_lines.values == "Sst"]
print(f"{col:18s} MW p = {stats.mannwhitneyu(a1, a2, alternative='two-sided').pvalue:.4f}, |d| = {abs(cohen_d(a1, a2)):.2f}")
dend_gbar_Kv3_1 MW p = 0.0217, |d| = 1.29 dend_gbar_NaV MW p = 0.0423, |d| = 1.03 axon_e_pas MW p = 0.0341, |d| = 1.19 axon_gbar_Ca_LVA MW p = 0.0521, |d| = 1.02 soma_gbar_Kv3_1 MW p = 0.0774, |d| = 1.05
Result: partially reproduced on the Source Data values. Of the five conductances the sheet lists, three differ (dendritic Kv3.1 p = 0.0217, dendritic NaV 0.0423, axonal e_pas 0.0341), and dendritic Kv3.1 has the largest effect (|d| = 1.29). The criterion tests every conductance of the models, and only these five are public, so "exactly three" cannot be checked.
fig5g-bifurcation-velocity-sp and fig6e-bifurcation-velocity-inhibitory¶
Across SP models the morphological bifurcation distance is linearly related to the inverse spike propagation velocity (slope 2.7, r = 0.8).
Across Pvalb and Sst models the bifurcation distance above and below the soma is linearly related to the inverse EAP propagation velocity (slope 2.67, r = 0.8).
Regression of 1/V on bifurcation distance, above and below pooled (each model gives two points), on the Source Data values; the direction (1/V on distance, or the reverse) is not stated, so both are shown.
def bif_reg(name):
t = sd_table(name)
x = np.r_[t["Bifurcation distance above soma"].astype(float), t["Bifurcation distance below soma"].astype(float)]
y = np.r_[t["1/V_above"].astype(float), t["1/V_below"].astype(float)]
a = stats.linregress(x, y)
b = stats.linregress(y, x)
print(f"{name}: n {len(x)} points; 1/V on distance slope {a.slope:.2f}, r {a.rvalue:.2f}, p {a.pvalue:.1e}; "
f"distance on 1/V slope {b.slope:.3f}")
bif_reg("Fig5g")
Fig5g: n 30 points; 1/V on distance slope 2.71, r 0.80, p 1.0e-07; distance on 1/V slope 0.238
Result: reproduced on the Source Data values: 1/V on bifurcation distance gives slope 2.71, r = 0.80, p = 1.0e-07.
bif_reg("Fig6d")
Fig6d: n 36 points; 1/V on distance slope 2.68, r 0.80, p 5.1e-09; distance on 1/V slope 0.239
Result: reproduced on the Source Data values: slope 2.68, r = 0.80, p = 5.1e-09.
fig6d-sst-asymmetric-morphology¶
Sst morphologies are asymmetric, with bifurcation distance above the soma longer than below (above against below, p = 0.03), while Pvalb morphologies are symmetric (above against below, p = 0.45).
t6 = sd_table("Fig6d")
for g_ in ("Pvalb", "Sst"):
x = t6[t6.label == g_]
up, dn = x["Bifurcation distance above soma"].astype(float).abs(), x["Bifurcation distance below soma"].astype(float).abs()
print(f"{g_}: mean |above| {up.mean():.2f}, |below| {dn.mean():.2f}, t-test p = {stats.ttest_ind(up, dn).pvalue:.3f}")
Pvalb: mean |above| 2.61, |below| 1.88, t-test p = 0.455 Sst: mean |above| 4.04, |below| 1.70, t-test p = 0.030
Result: reproduced on the Source Data values: Sst |above| is larger than |below| (4.04 against 1.70, p = 0.030), Pvalb shows no difference (p = 0.455).
figs8-rotation-symmetry (blocked)¶
The angle between the probe and the morphology changes multi-channel EAP metrics, including the symmetry index, of Pvalb and Sst models, with some angles enlarging and some hiding the Pvalb against Sst difference.
Not run: it needs simulations of the 18 inhibitory models at several angles, and neither the simulations nor the models' parameters are public. The paper's model repository holds the set-up of one spiny model only (cell 395830185), and the dandiset holds no simulations.
Summary¶
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.
| Claim | Outcome |
|---|---|
| source-data-units-link | partially reproduced (13 of 25 sessions; all 566 of their Source Data units found in VISp) |
| fig1d-unit-count | not reproduced (57.0 or 140.0 units per mouse against 48) |
| fig2-one-channel-two-clusters | reproduced |
| fig2-fs-rs-counts | reproduced (assumed; FS 25.4% under reading c) |
| figs3b-fs-faster | not reproduced (FS faster, but no reading puts both medians within tolerance) |
| fig2-rs-more-asymmetric | reproduced |
| fig2d-three-subclusters-each | not reproduced (FS gives K = 2; the paper's features give 3) |
| figs4-rs1-faster-above | reproduced |
| figs4-rs-spread | reproduced |
| figs4-fs-spread-absent | reproduced (assumed) |
| figs5-depth-distribution | not reproduced (assumed; p = 0.044 with the CSD centre here, 0.36 on the Source Data labels; partially reproduced proposed, the round-3 verifier would give reproduced) |
| fig6a-fs1-symmetric | reproduced (assumed) |
| fig4g-experiment-classifier-fs-rs | reproduced |
| fig5d-experiment-classifier-rs | partially reproduced (98.6%) |
| fig3a-isi-fs-rs | partially reproduced (assumed; both medians within 10%) |
| fig3a-rs1-excitability | partially reproduced (assumed; one measure of three) |
| fig3a-rs23-visual-responses | not reproduced (assumed) |
| fig3a-fs-visual-absent | reproduced (assumed) |
| fig3c-fs-more-phase-locked | not reproduced (assumed; 2 bands significant) |
| fig3c-rs-prefers-theta | reproduced |
| figs7-spontaneous-less-locked | partially reproduced (direction only) |
| fig3c-fs-stronger-earlier | not reproduced |
| fig3d-rs2-gamma-locking | not reproduced |
| fig3e-fs-cluster-locking | partially reproduced (assumed) |
| figs6c-fs-stronger-across-depth | not reproduced (assumed) |
| figs6d-rs3-supragranular-beta | not reproduced (assumed) |
| figs6c-granular-phase | not reproduced (assumed) |
| fig7-opto-unit-counts | not reproduced |
| fig7d-pvalb-fs-sst-diffuse | reproduced |
| fig7e-pvalb-sst-one-channel | not reproduced (assumed; REP only at p < 0.01) |
| fig7g-pvalb-more-symmetric | reproduced (assumed) |
| fig7h-pvalb-higher-cv | reproduced (assumed) |
| fig7h-pvalb-theta-sst-later | partially reproduced |
| fig4d, fig4f, fig4g-models, fig5a, fig6b | reproduced (model features) |
| fig4h-cre-lines-map, fig5c-sp-rs-two-way-mapping | partially reproduced (model features) |
| fig4e-in-vitro-ap-sp | partially reproduced (adaptation p = 0.0013) |
| fig5j, fig6g, fig5e, fig5g, fig6d, fig6e | reproduced (Source Data and Allen API values) |
| fig6cf-kv31 | partially reproduced (5 of the models' conductances are public) |
| figs8-rotation-symmetry | blocked (not runnable: the models and simulations are not public) |
How the analysis differs from the paper's. Half of the paper's wild-type sessions and about half of its opto-tagging mice are not in the dandiset. The isolation step behind the code's "good" flag is not stated. Neither reading of the criterion gives the paper's units; the claims after fig1d-unit-count use reading (c), the AllenSDK filter with at least 100 spikes in the first 5-min gray screen, which keeps every reading (a) unit of the code's tables and few others (an assumption). The code's 3 SD exclusions are taken over the values present, as NaN in 1/V above would otherwise switch them off. FS is clustered with K forced to 3 for the claims on FS1 to FS3. Depth is taken from the layer 4 centre computed here from the flash CSD, the method the criterion of figs5-depth-distribution names; the code's tables give one centre per probe (2740 um on 8 of the 13 probes), which differs from it by -420 to +340 um and is shown as a variant. Neither centre is validated. 9 of the 10 Pvalb units of the main tagged set come from one session. The opto-tagged units pass the code's per-unit exclusions. With about half the paper's units, several weaker effects are not significant here; the outcomes under every reading are printed in each section.
What was found about the dataset. The 13 held sessions contain every one of their 566 Source Data units, in VISp, with the Source Data's waveform features recomputed exactly for most units; the drifting-grating metrics and the code's firing rates are reproduced exactly from the files. Mean waveforms are labelled volts but hold microvolts. The electrodes tables' CCF coordinates hold NaN in 6 of the 24 sessions (every value in 3 of them), and in the other 18 y equals z on every channel. The paper's other 12 wild-type sessions are not among the dandiset's 32 session files.