Reproducing Jacobsen et al. (2022) from dandiset 000230¶
Paper. Jacobsen RI, Nair RR, Obenhaus HA, Donato F, Slettmoen T, Moser MB, Moser EI (2022).
All-viral tracing of monosynaptic inputs to single birthdate-defined neurons in the intact brain.
Cell Reports Methods 2, 100221.
doi:10.1016/j.crmeth.2022.100221. The claims file
(claims/jacobsen-2022.yaml) was written from the version of record and its supplement.
Dandiset. DANDI:000230, version 0.220506.1516 (doi:10.48324/dandi.000230/0.220506.1516). The paper's Data and code availability section cites this version, and it is also the most recent published one, so it is pinned. The earlier versions are listed in the data check: 0.220422.0713 holds the 9 sessions under hashed subject ids, 0.220426.0814 holds 18 assets (the 9 sessions under the real subject ids and again under the hashed ones), and 0.220426.1130 and the draft hold the same 9 paths as the pinned version.
What the dandiset holds. Nine NWB files of the optrode recordings in the MEC: three sessions of mouse 58313 (days 17, 18 and 19 after the rabies injection) and six of mouse 70375 (days 14 to 16, two per day). Each holds an open field part (position and head direction), laser trials, and only the curated units the figures show (12 units in all; the files say "Only a curated subset of tasks and/or units are exported"). The histology of the single-cell tracing (Figures 2 to 4, S1, S2, Tables S1 and S2) and the two-photon imaging (Figures 6 and 7) are not in it, and the paper names no other deposit for them.
Outside inputs. None as data. Methods details for the cell classes come from Rowland et al.
(2018), which the STAR Methods cite for the analysis, and from the analysis code that paper links
(see the docstring of mec_units.py).
| Claim | Status |
|---|---|
| fig5c-functional-cell-types | tested |
| fig5c-responsive-grid-cell | tested |
| fig5c-example-cells | tested |
| figs3-stable-input-cell | tested |
| figs4-nonresponsive-cells | tested |
| responsive-cells-at-19-days | tested |
| mec-inputs-from-two-weeks | tested |
| fig2a-four-or-fewer-starters, fig2a-starter-count-distribution, fig2a-single-starter-rate, no-starter-cells-in-mec, fig2b-rabies-cells-increase-with-time, fig2b-conclusive-more-than-control, figs2a-spread-increases-with-time, figs2a-conclusive-spread-more-than-control, figs2b-mec-inputs-increase-with-time, controls-no-mec-spread, figs1a-no-expression-without-tva, figs1b-sparse-cre, fig3-inputs-reflect-starter-identity, fig4a-distant-granule-input, fig4b-granule-inputs-dominate, fig4-subgranular-inputs, fig4c-dg-starter-local-and-mec-inputs, cytotoxicity-after-30-days, population-targeting-mec-labelling | blocked, data missing (histology not deposited) |
| fig6b-imaged-input-cells, fig7b-dual-labelled-input-cell | blocked, data missing (imaging not deposited) |
import hashlib
import time
import warnings
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import mec_units as mu
warnings.filterwarnings("ignore", category=RuntimeWarning)
pd.set_option("display.width", 250)
pd.set_option("display.max_columns", 40)
pd.set_option("display.max_colwidth", 60)
started = time.time()
sessions = mu.load_all()
print(f"loaded {len(sessions)} files from dandiset {mu.DANDISET_ID} version {mu.DANDISET_VERSION} "
f"in {time.time() - started:.0f} s")
units = []
for s in sessions:
of = mu.open_field(s)
s["of"] = of
for u in s["units"]:
units.append({"subject": s["subject"], "day": s["day"], "session": s["session_no"],
"label": f"T{u['tetrode']} C{u['cluster']}", "unit": u, "s": s})
print(len(units), "units")
loaded 9 files from dandiset 000230 version 0.220506.1516 in 8 s 12 units
Data check¶
Each check of the metadata against the values is stated under its output.
rows = []
for s in sessions:
dur = s["ttl_off"] - s["ttl_on"]
on = mu.pulses(s, "onset")
isi = np.diff(on)
rows.append({
"file": s["path"].split("/")[1][:28], "subject": s["subject"], "sex": s["sex"],
"start": s["session_start"][:16], "day": s["day"], "session": s["session_no"],
"units": ",".join(str(u["unit_id"]) for u in s["units"]),
"spikes": ",".join(str(len(u["spikes"])) for u in s["units"]),
"quality": ",".join(sorted({u["quality"] for u in s["units"]})),
"epochs": ";".join(f"{r.task}/{r.arena} {r.start:.0f}-{r.stop:.0f}s" for r in s["epochs"].itertuples()),
"epoch_task_desc": ",".join(s["epochs"].task_desc),
"ttl_events": len(s["ttl_on"]), "events_over_5ms": int((dur >= mu.MAX_PULSE_S).sum()),
"pulses": len(on), "pulse_ms_median": round(1000 * np.median(dur[dur < mu.MAX_PULSE_S]), 3),
"pulse_ms_range": f"{1000 * dur[dur < mu.MAX_PULSE_S].min():.3f}-{1000 * dur[dur < mu.MAX_PULSE_S].max():.3f}",
"isi_s_values": ",".join(f"{v:.3f}" for v in np.unique(np.round(isi, 2))),
"location": s["electrode_location"],
})
info = pd.DataFrame(rows)
# TTL events longer than MAX_PULSE_S: their durations and their onsets relative to the epoch starts.
long_ms, long_off = [], []
for s in sessions:
dur = s["ttl_off"] - s["ttl_on"]
for t, d in zip(s["ttl_on"][dur >= mu.MAX_PULSE_S], dur[dur >= mu.MAX_PULSE_S]):
long_ms.append(1000 * d)
long_off.append(float(np.min(np.abs(s["epochs"].start.values - t))))
print(f"TTL events over 5 ms: {len(long_ms)} in {len(sessions)} files, durations {min(long_ms):.1f} to {max(long_ms):.1f} ms "
f"({', '.join(f'{v:.1f}' for v in long_ms)}); largest distance of their onsets from an epoch start {max(long_off):.4f} s")
print("Files per subject:", info.subject.value_counts().to_dict())
print("Units per subject:", pd.Series([u["subject"] for u in units]).value_counts().to_dict())
print(info.drop(columns=["file"]).to_string(index=False))
print("\nSubject descriptions:")
for subj in sorted({s["subject"] for s in sessions}):
print(" ", subj, "|", [s for s in sessions if s["subject"] == subj][0]["subject_description"].replace("\n", " "))
# Days against dates: the day difference between sessions of one mouse must equal the date difference.
for subj in sorted({s["subject"] for s in sessions}):
ss = sorted([s for s in sessions if s["subject"] == subj], key=lambda s: s["session_start"])
d0 = pd.Timestamp(ss[0]["session_start"][:10])
print(f"{subj}: day - date offset per session:",
[s["day"] - (pd.Timestamp(s["session_start"][:10]) - d0).days for s in ss])
TTL events over 5 ms: 10 in 9 files, durations 44.8 to 1872.9 ms (809.6, 1523.6, 1527.3, 1872.9, 631.4, 1689.4, 44.8, 888.0, 1414.2, 1053.1); largest distance of their onsets from an epoch start 0.0000 s
Files per subject: {'70375': 6, '58313': 3}
Units per subject: {'58313': 6, '70375': 6}
subject sex start day session units spikes quality epochs epoch_task_desc ttl_events events_over_5ms pulses pulse_ms_median pulse_ms_range isi_s_values location
58313 F 2017-03-20T11:34 17 1 1052,1057,4016 774,28068,2337 Good PhotoStim/holding_box 2245-2365s;PhotoStim/holding_box 2384-2505s N/A,N/A 552 2 550 1.062 1.000-1.125 0.100,2.100,22.210 MEC - Layer 2
58313 F 2017-03-21T17:33 18 2 4050 3130 Good PhotoStim/holding_box 2054-2175s Mouse58313_20170321_02_10Hz20mW 276 1 275 1.062 1.000-1.063 0.100,2.100 MEC - Layer 2
58313 F 2017-03-22T11:19 19 1 1050,1089 1426,2304 Good PhotoStim/holding_box 2050-2171s Mouse58313_20170322_01_10Hz20mW 276 1 275 1.062 1.000-1.125 0.100,2.100 MEC - Layer 2
70375 M 2017-03-16T09:55 14 1 3043 2063 Good PhotoStim/holding_box 2108-2228s Mouse70375_20170316_01_10Hz20mW 276 1 275 1.062 1.000-1.063 0.100,2.100 MEC - Layer 2
70375 M 2017-03-16T18:30 14 2 3020 3347 Good PhotoStim/holding_box 3328-3509s Mouse70375_20170316_02_10Hz20mW 414 1 413 1.062 1.000-1.125 0.100,2.100 MEC - Layer 2
70375 M 2017-03-17T09:44 15 1 3017 899 Good PhotoStim/holding_box 1936-2056s Mouse70375_20170317_01_10Hz20mW 279 1 278 1.062 1.000-1.125 0.100,2.100 MEC - Layer 2
70375 M 2017-03-17T14:45 15 2 3024 3289 Good PhotoStim/holding_box 2082-2203s Mouse70375_20170317_02_10Hz20mW 276 1 275 1.062 1.000-1.125 0.100,2.100 MEC - Layer 2
70375 M 2017-03-18T13:58 16 1 3009 2182 Good PhotoStim/holding_box 2238-2358s Mouse70375_20170318_01_10Hz20mW 276 1 275 1.062 1.000-1.063 0.100,2.100 MEC - Layer 2
70375 M 2017-03-18T18:59 16 2 3031 4298 Good PhotoStim/holding_box 2160-2280s Mouse70375_20170318_02_10Hz20mW 276 1 275 1.062 1.000-1.125 0.100,2.100 MEC - Layer 2
Subject descriptions:
58313 | animal_name: 58313; animal_management_id: 8931a088caf410cf-0; color: Unknown; strain: C57J x C57J; animal_notes: AAV-CKII-Cre injected at E12 Optrode
70375 | animal_name: 70375; animal_management_id: 13f5788208822c35-0; color: Unknown; strain: C57J x C57J; animal_notes: Optrode
58313: day - date offset per session: [17, 17, 17]
70375: day - date offset per session: [14, 14, 14, 14, 14, 14]
The session descriptions give the day after the rabies injection and the session of the day, and
the day numbers agree with the session dates (the offset between day and date is constant within
each mouse). Mouse 58313 has sessions on days 17, 18 and 19, and 70375 two on each of days 14, 15
and 16, as Figures 5C, S3 and S4 state. All 12 units are labelled Good; unit ids read as tetrode
times 1000 plus cluster id (1089 is T1 C89), which matches the cells the figures name (T1 C89, T1 C57,
T1 C52, T4 C16, T4 C50, T1 C50). The units of 70375 carry a different cluster id in each session.
The open field is not an epoch: the epochs table holds only PhotoStim epochs in the holding box.
The dandiset description says sessions are labelled with the laser set point (20 mW set is 7.5 mW
actual, 40 mW is 15.1 mW). The eight single-epoch files carry it in task_desc (all "10Hz20mW", so
7.5 mW, as the legends of Figures S3 and S4 state); the two laser epochs of the day-17 file of 58313
carry "N/A", so their power is not known. The Methods describe "1 ms light pulses at 10 Hz continuously";
the TTL events show 1.0 to 1.1 ms pulses in trains of 6 at 10 Hz, a train every 2.6 s (intervals
of 0.1 and 2.1 s). The first TTL event of every epoch begins exactly at the epoch start and lasts
45 ms to 1.9 s (ten such events in nine files, printed above, every other event 1.0 to 1.1 ms); it is left out, so that 275 pulses remain in a 120 s epoch (276 events less one).
rows = []
for s in sessions:
of = s["of"]
pos = s["pos"]
spk = np.concatenate([u["spikes"] for u in s["units"]])
calc_speed = of["speed"]
raw_speed = np.hstack([0, np.hypot(*np.diff(pos, axis=0).T) * s["pos_rate"]])
rows.append({
"subject": s["subject"], "day": s["day"], "session": s["session_no"],
"pos_samples": len(pos), "pos_rate_hz": s["pos_rate"], "open_field_s": of["duration"],
"x_cm": f"{pos[:, 0].min():.1f} to {pos[:, 0].max():.1f}", "y_cm": f"{pos[:, 1].min():.1f} to {pos[:, 1].max():.1f}",
"extent_cm": f"{np.ptp(pos[:, 0]):.0f} x {np.ptp(pos[:, 1]):.0f}",
"nan_pos": int(np.isnan(pos).sum()),
"hd_rad": f"{s['hd'].min():.3f} to {s['hd'].max():.3f}",
"stored_speed_median": round(float(np.median(s["stored_speed"])), 2),
"raw_speed_median": round(float(np.median(raw_speed)), 2),
"smoothed_speed_median": round(float(np.median(calc_speed)), 2),
"frac_time_over_5cm_s": round(float(np.mean(calc_speed > mu.SPEED_CUTOFF_CM_S)), 2),
"spikes_s": f"{spk.min():.1f} to {spk.max():.1f}",
"spikes_between_of_and_laser": int(((spk >= of["t_end"]) & (spk < s["epochs"].start.min())).sum()),
"first_laser_epoch_s": s["epochs"].start.min(),
"lfp_samples": s["lfp"]["n"], "lfp_t_last": s["lfp"]["t_last"], "lfp_backward_steps": s["lfp"]["n_backward_steps"],
})
chk = pd.DataFrame(rows)
print(chk.to_string(index=False))
print("\nStated units: position 'meters' with conversion 0.01 (values in cm), head direction radians, speed m/s with conversion 0.01 (cm/s).")
# Recordings deposited more than once: compare spike trains and position series between files.
hashes = {}
for s in sessions:
for name, arr in [("position", s["pos"])] + [(f"unit {u['unit_id']}", u["spikes"]) for u in s["units"]]:
h = hashlib.sha1(np.ascontiguousarray(arr).tobytes()).hexdigest()
hashes.setdefault(h, []).append(f"{s['subject']} day {s['day']} s{s['session_no']} {name}")
dups = [v for v in hashes.values() if len(v) > 1]
print("Identical arrays across files:", dups if dups else "none")
lens = pd.Series({f"{s['subject']} d{s['day']} s{s['session_no']}": len(s["pos"]) for s in sessions})
print("Position lengths shared by several files:", lens[lens.duplicated(keep=False)].to_dict())
subject day session pos_samples pos_rate_hz open_field_s x_cm y_cm extent_cm nan_pos hd_rad stored_speed_median raw_speed_median smoothed_speed_median frac_time_over_5cm_s spikes_s spikes_between_of_and_laser first_laser_epoch_s lfp_samples lfp_t_last lfp_backward_steps
58313 17 1 90000 50.0 1800.0 -1.4 to 74.3 48.0 to 122.5 76 x 75 0 0.000 to 6.283 6.55 6.04 4.38 0.45 0.4 to 2503.4 2756 2245.0 570500 120.996 4
58313 18 2 90050 50.0 1801.0 -2.5 to 91.7 57.1 to 154.5 94 x 97 0 0.000 to 6.283 10.72 9.99 8.12 0.68 1.7 to 2299.6 32 2054.0 540500 119.996 3
58313 19 1 90000 50.0 1800.0 -2.0 to 91.9 59.4 to 154.3 94 x 95 0 0.000 to 6.283 11.08 10.38 8.36 0.71 3.5 to 2307.1 55 2050.0 540500 119.996 3
70375 14 1 90050 50.0 1801.0 -1.3 to 92.4 60.3 to 155.2 94 x 95 0 0.000 to 6.283 13.68 13.50 11.34 0.80 1.0 to 2748.4 88 2108.0 600500 179.996 4
70375 14 2 136100 50.0 2722.0 -4.5 to 94.6 62.9 to 157.7 99 x 95 0 0.000 to 6.283 12.80 12.69 10.52 0.75 1.3 to 3715.7 484 3328.0 815750 179.996 4
70375 15 1 90050 50.0 1801.0 -1.3 to 93.1 59.3 to 153.1 94 x 94 0 0.000 to 6.283 13.55 13.62 11.28 0.79 0.2 to 2250.4 0 1936.0 510250 119.996 2
70375 15 2 90000 50.0 1800.0 -0.7 to 92.7 59.7 to 153.6 93 x 94 0 0.000 to 6.283 13.90 13.75 11.57 0.79 3.2 to 2200.5 192 2082.0 510250 120.996 2
70375 16 1 90050 50.0 1801.0 -2.5 to 91.7 58.3 to 153.5 94 x 95 0 0.000 to 6.283 14.41 14.15 12.33 0.79 1.6 to 2357.0 239 2238.0 540250 119.996 3
70375 16 2 90050 50.0 1801.0 -0.0 to 94.1 59.4 to 153.8 94 x 94 0 0.000 to 6.283 15.67 15.62 13.54 0.80 0.4 to 2419.2 260 2160.0 570500 119.996 4
Stated units: position 'meters' with conversion 0.01 (values in cm), head direction radians, speed m/s with conversion 0.01 (cm/s).
Identical arrays across files: none
Position lengths shared by several files: {'58313 d17 s1': 90000, '58313 d18 s2': 90050, '58313 d19 s1': 90000, '70375 d14 s1': 90050, '70375 d15 s1': 90050, '70375 d15 s2': 90000, '70375 d16 s1': 90050, '70375 d16 s2': 90050}
Positions are in cm (values within about -5 to 158 cm) and span about 94 x 97 cm in eight files, consistent with the 1 x 1 m open field of the Methods. In the day-17 file of 58313 they span only about 76 x 75 cm; the file does not say why (a smaller box, or an animal that did not reach the far side). Head direction lies in 0 to 2 pi radians. The position series are sampled at 50 Hz, as the Methods state, and last 1800 to 1801 s (30 min, "approximately 30 min" in the Methods) except day 14 session 2 of 70375 (2722 s). In eight of nine files there are spikes after the position series ends and before the first laser epoch, so the recording continued between the two parts.
The files mark no open-field epoch, so where it starts and ends is a choice. It is taken as the whole position series, an assumption: that is the open-field recording the files hold, and the Methods give its length only as "approximately 30 min", ending when the animal "was satisfied and stopped eating". The other reading, the first 1800 s of each position series, is run for every session in the fig5c-functional-cell-types section; it differs from the whole series only in day 14 session 2 of 70375. The stored speed series is in cm/s and its median is close to that of the speed computed from the positions. No array is repeated between files, so no recording was deposited twice.
The LFP timestamps run backwards 2 to 4 times within each file and end at 120 to 180 s although each LFP series has 510,250 to 815,750 samples 4 ms apart (over 2000 s); the LFP is not used here.
# Clock check: spikes and laser TTLs. If the TTL times share the spike clock, spikes of a directly
# activated cell cluster at a fixed delay after the true pulses and not after pulse times shifted
# into the gap between pulses (50 ms later). Spikes and position: shown in the claim sections, where
# spatial scores are compared with time-shifted spike trains.
rows = []
for x in units:
s, u = x["s"], x["unit"]
p = mu.pulses(s, "onset")
lf = mu.latency_fidelity(u["spikes"], p)
lf_shift = mu.latency_fidelity(u["spikes"], p + 0.050)
rows.append({"subject": x["subject"], "day": x["day"], "session": x["session"], "unit": x["label"],
"fidelity_true_pct": round(lf["fidelity_pct"], 2), "fidelity_shifted_50ms_pct": round(lf_shift["fidelity_pct"], 2),
"latency_true_ms": round(lf["latency_ms"], 2), "latency_shifted_ms": round(lf_shift["latency_ms"], 2)})
clock = pd.DataFrame(rows)
print(clock.to_string(index=False))
subject day session unit fidelity_true_pct fidelity_shifted_50ms_pct latency_true_ms latency_shifted_ms 58313 17 1 T1 C52 12.55 0.36 2.36 5.26 58313 17 1 T1 C57 32.55 6.91 4.24 4.76 58313 17 1 T4 C16 1.09 1.45 4.68 5.31 58313 18 2 T4 C50 0.00 0.36 NaN 5.58 58313 19 1 T1 C50 0.36 0.00 1.00 NaN 58313 19 1 T1 C89 40.73 0.00 2.75 NaN 70375 14 1 T3 C43 27.64 0.00 2.83 NaN 70375 14 2 T3 C20 46.49 0.24 3.05 5.58 70375 15 1 T3 C17 68.71 0.36 2.77 0.35 70375 15 2 T3 C24 64.36 0.00 2.77 NaN 70375 16 1 T3 C9 76.73 0.00 2.58 NaN 70375 16 2 T3 C31 81.82 0.73 2.50 2.22
For the units that respond, fidelity after the true pulses (12.55 to 81.82%) far exceeds fidelity after the same times shifted 50 ms (0.00 to 6.91%), and their latencies after the true pulses are 2.36 to 4.24 ms. This is consistent with the TTL events sharing the spike clock. It does not by itself show the open-field tracking shares that clock; the spatial scores below, which exceed those of time-shifted spike trains for the grid, head direction and border cells, are consistent with it.
# Versions of the dandiset: number of assets and subject folders in each.
from dandi.dandiapi import DandiAPIClient
with DandiAPIClient() as client:
for v in client.get_dandiset(mu.DANDISET_ID).get_versions():
paths = sorted(a.path for a in client.get_dandiset(mu.DANDISET_ID, v.identifier).get_assets())
print(f"{v.identifier:14s} created {str(v.created)[:10]}: {len(paths)} assets, subject folders "
f"{sorted({p.split('/')[0] for p in paths})}")
draft created 2022-04-04: 9 assets, subject folders ['sub-58313', 'sub-70375'] 0.220422.0713 created 2022-04-22: 9 assets, subject folders ['sub-13f5788208822c35-0', 'sub-8931a088caf410cf-0']
0.220426.0814 created 2022-04-26: 18 assets, subject folders ['sub-13f5788208822c35-0', 'sub-58313', 'sub-70375', 'sub-8931a088caf410cf-0']
0.220426.1130 created 2022-04-26: 9 assets, subject folders ['sub-58313', 'sub-70375'] 0.220506.1516 created 2022-05-06: 9 assets, subject folders ['sub-58313', 'sub-70375']
Version 0.220426.0814 holds 18 assets: the nine sessions under the subject ids 58313 and 70375 and the same nine under the hashed ids of version 0.220422.0713. The pinned version, 0.220426.1130 and the draft hold the nine sessions once.
fig5c-functional-cell-types¶
In mice with widespread RABV-ChR2-YFP expression, MEC recordings include grid, head direction and border cells, so the network as a whole is not disrupted by the rabies expression.
Criterion: grid, head direction and border cells classified with the scores and thresholds of
Rowland et al. (2018); reproduced when at least one unit of each type is found. Scores and
parameters are those of mec_units.py (docstring). The shuffle interval is run under both readings
of Rowland et al.'s "random interval between +/- 20 s" (literal, within 20 s; standard, at
least 20 s). Each unit has its own seeded generator. The passage of Rowland et al. (2018), Materials
and methods, "Classification of cells into functional classes", reads: "For each permutation, the
entire sequence of spikes fired by the cell was time-shifted along the animal's path by a random
interval between ± 20 s, with the end of the session wrapped to the beginning. Time shifts varied
randomly between permutations and between cells. From the shuffled distribution, we calculated the
95th percentile and used this value as a threshold". The analysis code it links (archdata, commit
9452263) has no spatial shuffle, so it does not settle the interval. A shift of under 20 s leaves the
spike train close to the observed one, so its 95th percentile sits near the observed score (for the
head direction cell T4 C16, 0.762 against an observed 0.912, printed below); the standard shuffle,
shifts of at least 20 s, is adopted as an assumption, and both are shown.
t0 = time.time()
cls_rows = []
for k, x in enumerate(units):
c = mu.classify(x["unit"]["spikes"], x["s"]["of"], rng_seed=1000 + 10 * k)
cls_rows.append({"subject": x["subject"], "day": x["day"], "session": x["session"], "unit": x["label"],
"of_spikes": len(mu.spike_samples(x["unit"]["spikes"], x["s"]["of"])), **c})
cls = pd.DataFrame(cls_rows)
print(f"classified {len(cls)} units in {time.time() - t0:.0f} s, {mu.N_SHUFFLES} shuffles per unit and reading")
classified 12 units in 81 s, 200 shuffles per unit and reading
cols = ["subject", "day", "session", "unit", "of_spikes", "gridness", "thr_grid_literal", "thr_grid_standard",
"mvl", "hd_stability", "thr_mvl_literal", "thr_mvl_standard", "border", "thr_border_literal", "thr_border_standard"]
print(cls[cols].round(3).to_string(index=False))
print()
print(cls[["subject", "day", "session", "unit", "grid_literal", "hd_literal", "border_literal",
"grid_standard", "hd_standard", "border_standard"]].to_string(index=False))
for reading in ("literal", "standard"):
n = {t: int(cls[f"{t}_{reading}"].sum()) for t in ("grid", "hd", "border")}
print(f"\n{reading} shuffle: grid {n['grid']}, head direction {n['hd']}, border {n['border']} of {len(cls)} units;",
"by subject:", cls.groupby("subject")[[f"grid_{reading}", f"hd_{reading}", f"border_{reading}"]].sum().to_dict("index"))
named = {"T1 C89": "grid (Fig 5C, day 19)", "T1 C50": "grid (Fig S4, day 19)", "T4 C16": "head direction (Fig S4, day 17)",
"T4 C50": "border (Fig S4, day 18)"}
print("\nUnits the figures name:")
for lab, what in named.items():
r = cls[(cls.subject == "58313") & (cls.unit == lab)].iloc[0]
print(f" {lab} {what}: gridness {r.gridness:.3f}, MVL {r.mvl:.3f} (stability {r.hd_stability:.2f}), border {r.border:.3f};"
f" classes literal {[t for t in ('grid', 'hd', 'border') if r[f'{t}_literal']]}, standard {[t for t in ('grid', 'hd', 'border') if r[f'{t}_standard']]}")
subject day session unit of_spikes gridness thr_grid_literal thr_grid_standard mvl hd_stability thr_mvl_literal thr_mvl_standard border thr_border_literal thr_border_standard
58313 17 1 T1 C52 546 -0.105 0.652 0.584 0.075 0.173 0.115 0.118 0.460 0.490 0.524
58313 17 1 T1 C57 22806 -0.168 0.460 0.555 0.063 0.022 0.093 0.086 0.466 0.493 0.503
58313 17 1 T4 C16 1885 0.282 0.905 0.570 0.912 0.972 0.762 0.225 0.429 0.527 0.577
58313 18 2 T4 C50 3047 -0.434 -0.004 0.601 0.343 0.418 0.452 0.212 0.656 0.663 0.555
58313 19 1 T1 C50 1397 0.996 0.821 0.724 0.073 0.225 0.084 0.107 -0.129 0.495 0.519
58313 19 1 T1 C89 1977 0.854 0.766 0.563 0.040 0.077 0.127 0.159 -1.000 0.526 0.561
70375 14 1 T3 C43 1594 -0.257 0.634 0.570 0.079 0.211 0.122 0.076 0.304 0.524 0.516
70375 14 2 T3 C20 2448 0.094 0.571 0.556 0.047 -0.070 0.078 0.060 0.474 0.501 0.502
70375 15 1 T3 C17 502 -0.012 0.503 0.664 0.112 -0.399 0.147 0.154 0.386 0.610 0.541
70375 15 2 T3 C24 2903 -0.232 0.474 0.549 0.123 0.675 0.140 0.082 0.476 0.507 0.508
70375 16 1 T3 C9 1711 -0.163 0.796 0.622 0.154 0.558 0.132 0.081 0.459 0.505 0.503
70375 16 2 T3 C31 3316 -0.124 0.355 0.589 0.064 0.322 0.124 0.079 0.434 0.536 0.522
subject day session unit grid_literal hd_literal border_literal grid_standard hd_standard border_standard
58313 17 1 T1 C52 False False False False False False
58313 17 1 T1 C57 False False False False False False
58313 17 1 T4 C16 False True False False True False
58313 18 2 T4 C50 False False False False False True
58313 19 1 T1 C50 True False False True False False
58313 19 1 T1 C89 True False False True False False
70375 14 1 T3 C43 False False False False False False
70375 14 2 T3 C20 False False False False False False
70375 15 1 T3 C17 False False False False False False
70375 15 2 T3 C24 False False False False True False
70375 16 1 T3 C9 False False False False False False
70375 16 2 T3 C31 False False False False False False
literal shuffle: grid 2, head direction 1, border 0 of 12 units; by subject: {'58313': {'grid_literal': 2, 'hd_literal': 1, 'border_literal': 0}, '70375': {'grid_literal': 0, 'hd_literal': 0, 'border_literal': 0}}
standard shuffle: grid 2, head direction 2, border 1 of 12 units; by subject: {'58313': {'grid_standard': 2, 'hd_standard': 1, 'border_standard': 1}, '70375': {'grid_standard': 0, 'hd_standard': 1, 'border_standard': 0}}
Units the figures name:
T1 C89 grid (Fig 5C, day 19): gridness 0.854, MVL 0.040 (stability 0.08), border -1.000; classes literal ['grid'], standard ['grid']
T1 C50 grid (Fig S4, day 19): gridness 0.996, MVL 0.073 (stability 0.22), border -0.129; classes literal ['grid'], standard ['grid']
T4 C16 head direction (Fig S4, day 17): gridness 0.282, MVL 0.912 (stability 0.97), border 0.429; classes literal ['hd'], standard ['hd']
T4 C50 border (Fig S4, day 18): gridness -0.434, MVL 0.343 (stability 0.42), border 0.656; classes literal [], standard ['border']
# The other reading of the open-field span: the first 1800 s of each position series ("approximately
# 30 min", STAR Methods). Rates and classes of every unit under it, beside the whole series. Same seeds.
t0 = time.time()
rows30 = []
for k, x in enumerate(units):
of30 = mu.open_field(x["s"], max_s=1800)
x["of30"] = of30
c = mu.classify(x["unit"]["spikes"], of30, rng_seed=1000 + 10 * k)
rows30.append({"subject": x["subject"], "day": x["day"], "session": x["session"], "unit": x["label"],
"of_s_whole": x["s"]["of"]["duration"], "of_s_1800": of30["duration"],
"rate_whole": round(mu.open_field_rate(x["unit"]["spikes"], x["s"]["of"]), 3),
"rate_1800": round(mu.open_field_rate(x["unit"]["spikes"], of30), 3), **c})
cls30 = pd.DataFrame(rows30)
print(f"classified {len(cls30)} units on the first 1800 s in {time.time() - t0:.0f} s")
print(cls30[["subject", "day", "session", "unit", "of_s_whole", "of_s_1800", "rate_whole", "rate_1800",
"gridness", "mvl", "hd_stability", "border", "thr_border_literal", "thr_border_standard"]].round(3).to_string(index=False))
cmp = cls[["subject", "day", "session", "unit"]].copy()
for reading in ("literal", "standard"):
for t in ("grid", "hd", "border"):
cmp[f"{t}_{reading}_whole"] = cls[f"{t}_{reading}"]
cmp[f"{t}_{reading}_1800"] = cls30[f"{t}_{reading}"]
changed = [(r.subject, r.day, r.session, r.unit, c) for r in cmp.itertuples() for c in ("grid", "hd", "border")
for reading in ("literal", "standard") if getattr(r, f"{c}_{reading}_whole") != getattr(r, f"{c}_{reading}_1800")]
print("Classes that differ between the whole series and the first 1800 s:", changed if changed else "none")
for reading in ("literal", "standard"):
print(f"first 1800 s, {reading} shuffle: grid {int(cls30[f'grid_{reading}'].sum())}, head direction "
f"{int(cls30[f'hd_{reading}'].sum())}, border {int(cls30[f'border_{reading}'].sum())}")
# Shuffle distribution of the mean vector length for T4 C16 (whole series), with the seeds classify used.
k16 = [k for k, x in enumerate(units) if x["subject"] == "58313" and x["label"] == "T4 C16"][0]
for j, reading in enumerate(("literal", "standard")):
sh = mu.shuffled_scores(units[k16]["unit"]["spikes"], units[k16]["s"]["of"], reading, np.random.default_rng(1000 + 10 * k16 + j))
q = sh.mvl.quantile([0.05, 0.5, 0.95, 0.99])
print(f"T4 C16 shuffled MVL, {reading}: 5th {q.iloc[0]:.3f}, median {q.iloc[1]:.3f}, 95th {q.iloc[2]:.3f}, "
f"99th {q.iloc[3]:.3f}, max {sh.mvl.max():.3f} (observed {cls.mvl.iloc[k16]:.3f})")
classified 12 units on the first 1800 s in 81 s subject day session unit of_s_whole of_s_1800 rate_whole rate_1800 gridness mvl hd_stability border thr_border_literal thr_border_standard 58313 17 1 T1 C52 1800.0 1800.0 0.303 0.303 -0.105 0.075 0.173 0.460 0.490 0.524 58313 17 1 T1 C57 1800.0 1800.0 12.670 12.670 -0.168 0.063 0.022 0.466 0.493 0.503 58313 17 1 T4 C16 1800.0 1800.0 1.047 1.047 0.282 0.912 0.972 0.429 0.527 0.577 58313 18 2 T4 C50 1801.0 1800.0 1.692 1.693 -0.434 0.343 0.418 0.656 0.663 0.536 58313 19 1 T1 C50 1800.0 1800.0 0.776 0.776 0.996 0.073 0.225 -0.129 0.495 0.519 58313 19 1 T1 C89 1800.0 1800.0 1.098 1.098 0.854 0.040 0.077 -1.000 0.526 0.561 70375 14 1 T3 C43 1801.0 1800.0 0.885 0.886 -0.257 0.078 0.205 0.304 0.523 0.518 70375 14 2 T3 C20 2722.0 1800.0 0.899 1.064 0.200 0.052 0.177 0.487 0.513 0.509 70375 15 1 T3 C17 1801.0 1800.0 0.279 0.279 -0.012 0.113 -0.399 0.386 0.610 0.538 70375 15 2 T3 C24 1800.0 1800.0 1.613 1.613 -0.232 0.123 0.675 0.476 0.507 0.508 70375 16 1 T3 C9 1801.0 1800.0 0.950 0.951 -0.163 0.154 0.559 0.459 0.505 0.502 70375 16 2 T3 C31 1801.0 1800.0 1.841 1.842 -0.125 0.064 0.326 0.434 0.537 0.521 Classes that differ between the whole series and the first 1800 s: none first 1800 s, literal shuffle: grid 2, head direction 1, border 0 first 1800 s, standard shuffle: grid 2, head direction 2, border 1
T4 C16 shuffled MVL, literal: 5th 0.043, median 0.144, 95th 0.762, 99th 0.886, max 0.912 (observed 0.912)
T4 C16 shuffled MVL, standard: 5th 0.024, median 0.098, 95th 0.225, 99th 0.270, max 0.272 (observed 0.912)
# Rate maps and head-direction tuning of the four named units (ranges printed below the figure).
fig, axes = plt.subplots(1, 5, figsize=(17, 3.2))
ranges = []
for ax, lab in zip(axes[:3], ["T1 C89", "T1 C50", "T4 C50"]):
x = [x for x in units if x["subject"] == "58313" and x["label"] == lab][0]
rm = mu.rate_map(mu.spike_samples(x["unit"]["spikes"], x["s"]["of"]), x["s"]["of"])
ax.imshow(rm.T, origin="lower", cmap="jet")
ax.set_title(f"{lab}, day {x['day']}, rate map")
ax.axis("off")
ranges.append(f"{lab} rate map 0 to {np.nanmax(rm):.2f} Hz")
x = [x for x in units if x["subject"] == "58313" and x["label"] == "T4 C16"][0]
c, tc = mu.hd_tuning(mu.spike_samples(x["unit"]["spikes"], x["s"]["of"]), x["s"]["of"])
axes[3].remove()
axp = fig.add_subplot(1, 5, 4, projection="polar")
axp.plot(np.append(c, c[0]), np.append(tc, tc[0]))
axp.set_title("T4 C16, day 17, HD tuning")
ranges.append(f"T4 C16 tuning {tc.min():.2f} to {tc.max():.2f} Hz")
ac = mu.autocorrelogram(mu.rate_map(mu.spike_samples(units[5]["unit"]["spikes"], units[5]["s"]["of"]), units[5]["s"]["of"]))
axes[4].imshow(ac.T, origin="lower", cmap="jet", vmin=-1, vmax=1)
axes[4].set_title(f"{units[5]['label']} autocorrelogram")
axes[4].axis("off")
plt.tight_layout()
plt.show()
print("; ".join(ranges), f"; autocorrelogram {np.nanmin(ac):.2f} to {np.nanmax(ac):.2f} (axis -1 to 1)")
T1 C89 rate map 0 to 9.75 Hz; T1 C50 rate map 0 to 4.24 Hz; T4 C50 rate map 0 to 11.15 Hz; T4 C16 tuning 0.00 to 10.62 Hz ; autocorrelogram -0.99 to 1.00 (axis -1 to 1)
Result: reproduced, resting on an assumption. Under the standard shuffle (shifts of at least 20 s) the 12 units include 2 grid cells (T1 C89 and T1 C50, gridness 0.854 and 0.996), 2 head direction cells (T4 C16, mean vector length 0.912 and stability 0.97; and the 70375 unit of day 15 session 2, a weak one at 0.123 against a threshold of 0.082, stability 0.675) and 1 border cell (T4 C50, border score 0.656 against a threshold of 0.555). Under the literal reading of the shuffle (shifts within 20 s) T4 C50 falls just short (0.656 against 0.663), giving 2 grid, 1 head direction and 0 border cells, so the outcome rests on adopting the standard shuffle. Rowland et al. (2018) write "a random interval between ± 20 s" and their code has no spatial shuffle; shifts within 20 s leave the spike train near its place, so that for T4 C16 the literal shuffle's 95th percentile is 0.762 and its largest value 0.912, the observed score, against 0.225 and 0.272 under the standard shuffle. The standard shuffle is lenient for the mean vector length of a weakly tuned cell (the day 15 session 2 unit above). Under it, each of the four units the figures name is classed as the paper names it. Taking the open field as its first 1800 s changes no class (2 grid, 2 head direction, 1 border under the standard shuffle). All classified cells are from 58313 except the weak head direction cell. The dandiset holds only the 12 curated units shown in the figures, so finding one of each type partly reflects what was deposited, and the part of the statement about the network as a whole cannot be tested beyond these examples.
fig5c-responsive-grid-cell¶
Among the cells that responded to laser stimulation with a 2 to 4 ms latency, a sign of direct ChR2 activation and so of a monosynaptic projection to the hippocampus, were grid cells.
Criterion: latency and fidelity as defined in the claims file (STAR Methods), under both pulse-time readings (a, TTL onset; b, TTL offset); responsive (R-a) when the latency lies in the widened range 1.8 to 4.4 ms and the fidelity is at least 11.64%. Reproduced when, under one reading, a unit classed as a grid cell in fig5c-functional-cell-types is responsive. For the day-17 file, with two laser epochs of unknown power, each epoch and both together are shown. The pre-pulse fidelity (a spike in the 10 ms before the pulse) is a variant that does not decide.
def laser_table(units_sel, lat_range):
rows = []
for x in units_sel:
s, u = x["s"], x["unit"]
epochs = [None] if len(s["epochs"]) == 1 else [None, 0, 1]
for reading in ("onset", "offset"):
for ep in epochs:
lf = mu.latency_fidelity(u["spikes"], mu.pulses(s, reading, ep))
rows.append({"subject": x["subject"], "day": x["day"], "session": x["session"], "unit": x["label"],
"pulse_time": reading, "epoch": "all" if ep is None else ep + 1,
"pulses": lf["n_pulses"], "with_spike": lf["n_hit"],
"latency_ms": round(lf["latency_ms"], 2), "fidelity_pct": round(lf["fidelity_pct"], 2),
"pre_pulse_pct": round(lf["pre_fidelity_pct"], 2),
"responsive": mu.responsive(lf, lat_range)})
return pd.DataFrame(rows)
lt = laser_table(units, (1.8, 4.4))
lt = lt.merge(cls[["subject", "day", "session", "unit", "grid_literal", "grid_standard", "hd_literal", "hd_standard",
"border_literal", "border_standard"]], on=["subject", "day", "session", "unit"])
print(lt.to_string(index=False))
for reading in ("onset", "offset"):
r = lt[lt.pulse_time == reading]
resp_units = r[r.responsive].drop_duplicates(["subject", "day", "session", "unit"])
print(f"\nreading {reading}: {len(resp_units)} unit-sessions responsive (1.8-4.4 ms, fidelity >= 11.64%) in some epoch;",
"of them grid (literal shuffle):", resp_units[resp_units.grid_literal].unit.tolist(),
"grid (standard shuffle):", resp_units[resp_units.grid_standard].unit.tolist())
subject day session unit pulse_time epoch pulses with_spike latency_ms fidelity_pct pre_pulse_pct responsive grid_literal grid_standard hd_literal hd_standard border_literal border_standard 58313 17 1 T1 C52 onset all 550 69 2.36 12.55 0.00 True False False False False False False 58313 17 1 T1 C52 onset 1 275 32 2.65 11.64 0.00 False False False False False False False 58313 17 1 T1 C52 onset 2 275 37 2.11 13.45 0.00 True False False False False False False 58313 17 1 T1 C52 offset all 550 67 1.36 12.18 0.36 False False False False False False False 58313 17 1 T1 C52 offset 1 275 31 1.67 11.27 0.36 False False False False False False False 58313 17 1 T1 C52 offset 2 275 36 1.10 13.09 0.36 False False False False False False False 58313 17 1 T1 C57 onset all 550 179 4.24 32.55 9.45 True False False False False False False 58313 17 1 T1 C57 onset 1 275 81 4.65 29.45 12.73 False False False False False False False 58313 17 1 T1 C57 onset 2 275 98 3.90 35.64 6.18 True False False False False False False 58313 17 1 T1 C57 offset all 550 174 3.35 31.64 9.64 True False False False False False False 58313 17 1 T1 C57 offset 1 275 77 3.79 28.00 12.36 True False False False False False False 58313 17 1 T1 C57 offset 2 275 97 3.00 35.27 6.91 True False False False False False False 58313 17 1 T4 C16 onset all 550 6 4.68 1.09 0.18 False False False True True False False 58313 17 1 T4 C16 onset 1 275 5 5.16 1.82 0.36 False False False True True False False 58313 17 1 T4 C16 onset 2 275 1 2.27 0.36 0.00 False False False True True False False 58313 17 1 T4 C16 offset all 550 5 4.55 0.91 0.36 False False False True True False False 58313 17 1 T4 C16 offset 1 275 4 5.39 1.45 0.73 False False False True True False False 58313 17 1 T4 C16 offset 2 275 1 1.21 0.36 0.00 False False False True True False False 58313 18 2 T4 C50 onset all 275 0 NaN 0.00 0.00 False False False False False False True 58313 18 2 T4 C50 offset all 275 0 NaN 0.00 0.00 False False False False False False True 58313 19 1 T1 C50 onset all 275 1 1.00 0.36 0.00 False True True False False False False 58313 19 1 T1 C50 offset all 275 0 NaN 0.00 0.36 False True True False False False False 58313 19 1 T1 C89 onset all 275 112 2.75 40.73 0.00 True True True False False False False 58313 19 1 T1 C89 offset all 275 112 1.70 40.73 0.00 False True True False False False False 70375 14 1 T3 C43 onset all 275 76 2.83 27.64 0.73 True False False False False False False 70375 14 1 T3 C43 offset all 275 75 1.81 27.27 0.73 True False False False False False False 70375 14 2 T3 C20 onset all 413 192 3.05 46.49 0.00 True False False False False False False 70375 14 2 T3 C20 offset all 413 192 1.99 46.49 0.00 True False False False False False False 70375 15 1 T3 C17 onset all 278 191 2.77 68.71 0.00 True False False False False False False 70375 15 1 T3 C17 offset all 278 191 1.71 68.71 0.00 False False False False False False False 70375 15 2 T3 C24 onset all 275 177 2.77 64.36 0.00 True False False False True False False 70375 15 2 T3 C24 offset all 275 178 1.76 64.73 0.00 False False False False True False False 70375 16 1 T3 C9 onset all 275 211 2.58 76.73 0.36 True False False False False False False 70375 16 1 T3 C9 offset all 275 211 1.52 76.73 0.00 False False False False False False False 70375 16 2 T3 C31 onset all 275 225 2.50 81.82 0.36 True False False False False False False 70375 16 2 T3 C31 offset all 275 225 1.44 81.82 0.36 False False False False False False False reading onset: 9 unit-sessions responsive (1.8-4.4 ms, fidelity >= 11.64%) in some epoch; of them grid (literal shuffle): ['T1 C89'] grid (standard shuffle): ['T1 C89'] reading offset: 3 unit-sessions responsive (1.8-4.4 ms, fidelity >= 11.64%) in some epoch; of them grid (literal shuffle): [] grid (standard shuffle): []
Result: reproduced. Under reading (a), TTL onset, 9 unit-sessions are responsive, among them T1 C89 (day 19), a grid cell under both shuffles, with latency 2.75 ms, fidelity 40.73% and no spike in the 10 ms before any pulse (pre-pulse 0.00%). Under reading (b), TTL offset, latencies are about 1.06 ms shorter (the pulse width) and T1 C89, at 1.70 ms, is not responsive; 3 unit-sessions are, none of them a grid cell.
fig5c-example-cells¶
Three example responsive cells of mouse 58313 had these open-field rates, latencies and fidelities; a grid cell (T1 C89, 19 days) 1.10 Hz, 2.75 ms, 40.73%; a high-rate cell (T1 C57, 17 days) 12.67 Hz, 3.90 ms, 35.64%; a low-rate cell (T1 C52, 17 days) 0.30 Hz, 2.65 ms, 11.64%.
The files keep the tetrode and cluster labels, so the units are found by label; each day of 58313 has one session in the dandiset. Both pulse-time readings, and for day 17 each laser epoch and both.
expected = {"T1 C89": (19, 1.10, 2.75, 40.73), "T1 C57": (17, 12.67, 3.90, 35.64), "T1 C52": (17, 0.30, 2.65, 11.64)}
rows = []
for lab, (day, e_rate, e_lat, e_fid) in expected.items():
x = [x for x in units if x["subject"] == "58313" and x["label"] == lab and x["day"] == day][0]
rate = mu.open_field_rate(x["unit"]["spikes"], x["s"]["of"])
epochs = [None] if len(x["s"]["epochs"]) == 1 else [None, 0, 1]
for reading in ("onset", "offset"):
for ep in epochs:
lf = mu.latency_fidelity(x["unit"]["spikes"], mu.pulses(x["s"], reading, ep))
rows.append({"unit": lab, "day": day, "session": x["session"], "pulse_time": reading,
"epoch": "all" if ep is None else ep + 1, "pulses": lf["n_pulses"],
"rate_hz": round(rate, 3), "exp_rate": e_rate, "rate_ok": abs(rate - e_rate) <= 0.1 * e_rate + 1e-9,
"latency_ms": round(lf["latency_ms"], 3), "exp_lat": e_lat, "lat_ok": abs(lf["latency_ms"] - e_lat) <= 0.1 * e_lat + 1e-9,
"fidelity_pct": round(lf["fidelity_pct"], 3), "exp_fid": e_fid,
"fid_ok": abs(lf["fidelity_pct"] - e_fid) <= 0.1 * e_fid + 1e-9})
ex = pd.DataFrame(rows)
ex["all_ok"] = ex.rate_ok & ex.lat_ok & ex.fid_ok
print(ex.to_string(index=False))
best = ex[(ex.pulse_time == "onset")]
print("\nReading (a), onset: rows within tolerance on all three values:",
best[best.all_ok][["unit", "epoch"]].values.tolist())
print("Reading (b), offset: rows within tolerance on all three values:",
ex[(ex.pulse_time == "offset") & ex.all_ok][["unit", "epoch"]].values.tolist())
unit day session pulse_time epoch pulses rate_hz exp_rate rate_ok latency_ms exp_lat lat_ok fidelity_pct exp_fid fid_ok all_ok T1 C89 19 1 onset all 275 1.098 1.10 True 2.752 2.75 True 40.727 40.73 True True T1 C89 19 1 offset all 275 1.098 1.10 True 1.695 2.75 False 40.727 40.73 True False T1 C57 17 1 onset all 550 12.670 12.67 True 4.237 3.90 True 32.545 35.64 True True T1 C57 17 1 onset 1 275 12.670 12.67 True 4.651 3.90 False 29.455 35.64 False False T1 C57 17 1 onset 2 275 12.670 12.67 True 3.895 3.90 True 35.636 35.64 True True T1 C57 17 1 offset all 550 12.670 12.67 True 3.349 3.90 False 31.636 35.64 False False T1 C57 17 1 offset 1 275 12.670 12.67 True 3.790 3.90 True 28.000 35.64 False False T1 C57 17 1 offset 2 275 12.670 12.67 True 3.000 3.90 False 35.273 35.64 True False T1 C52 17 1 onset all 550 0.303 0.30 True 2.358 2.65 False 12.545 11.64 True False T1 C52 17 1 onset 1 275 0.303 0.30 True 2.646 2.65 True 11.636 11.64 True True T1 C52 17 1 onset 2 275 0.303 0.30 True 2.109 2.65 False 13.455 11.64 False False T1 C52 17 1 offset all 550 0.303 0.30 True 1.364 2.65 False 12.182 11.64 True False T1 C52 17 1 offset 1 275 0.303 0.30 True 1.666 2.65 False 11.273 11.64 True False T1 C52 17 1 offset 2 275 0.303 0.30 True 1.104 2.65 False 13.091 11.64 False False Reading (a), onset: rows within tolerance on all three values: [['T1 C89', 'all'], ['T1 C57', 'all'], ['T1 C57', 2], ['T1 C52', 1]] Reading (b), offset: rows within tolerance on all three values: []
# The two laser epochs of the day-17 file: what the file says about each, the TTL pulses, and the
# spikes of each unit in each epoch. The dandiset description names set points of 20 and 40 mW.
s17 = [s for s in sessions if s["subject"] == "58313" and s["day"] == 17][0]
print(s17["epochs"].to_string())
for k, e in s17["epochs"].iterrows():
m = (s17["ttl_on"] >= e.start) & (s17["ttl_on"] <= e.stop)
d = 1000 * (s17["ttl_off"] - s17["ttl_on"])[m]
on = s17["ttl_on"][m]
print(f"epoch {k + 1}: {e.stop - e.start:.0f} s, {m.sum()} TTL events, first event {d[0]:.1f} ms long, "
f"pulse width median {np.median(d[1:]):.4f} ms (range {d[1:].min():.4f} to {d[1:].max():.4f}), "
f"intervals {np.unique(np.round(np.diff(on[1:]), 3)).tolist()} s")
for u in s17["units"]:
n = int(((u["spikes"] >= e.start) & (u["spikes"] <= e.stop)).sum())
lf = mu.latency_fidelity(u["spikes"], mu.pulses(s17, "onset", k))
print(f" T{u['tetrode']} C{u['cluster']}: {n} spikes ({n / (e.stop - e.start):.2f} Hz), "
f"latency {lf['latency_ms']:.3f} ms, fidelity {lf['fidelity_pct']:.3f}%")
print("Pulse width median in the other eight files (ms):",
sorted({round(float(np.median(1000 * (s["ttl_off"] - s["ttl_on"])[(s["ttl_off"] - s["ttl_on"]) < mu.MAX_PULSE_S])), 4)
for s in sessions if s is not s17}))
start stop task task_desc arena 0 2245.0 2365.0 PhotoStim N/A holding_box 1 2384.0 2505.0 PhotoStim N/A holding_box epoch 1: 120 s, 276 TTL events, first event 809.6 ms long, pulse width median 1.0625 ms (range 1.0000 to 1.1250), intervals [0.1, 2.102] s T1 C52: 78 spikes (0.65 Hz), latency 2.646 ms, fidelity 11.636% T1 C57: 1527 spikes (12.72 Hz), latency 4.651 ms, fidelity 29.455% T4 C16: 278 spikes (2.32 Hz), latency 5.163 ms, fidelity 1.818% epoch 2: 121 s, 276 TTL events, first event 1523.6 ms long, pulse width median 1.0625 ms (range 1.0000 to 1.0625), intervals [0.1, 2.102] s T1 C52: 56 spikes (0.46 Hz), latency 2.109 ms, fidelity 13.455% T1 C57: 1202 spikes (9.93 Hz), latency 3.895 ms, fidelity 35.636% T4 C16: 45 spikes (0.37 Hz), latency 2.271 ms, fidelity 0.364% Pulse width median in the other eight files (ms): [1.0625]
Result: reproduced, resting on an assumption. Under reading (a) all nine values are within tolerance when T1 C57 is taken from the second laser epoch of day 17 (12.670 Hz, 3.895 ms, 35.636%) and T1 C52 from the first (0.303 Hz, 2.646 ms, 11.636%); T1 C89, whose session has one epoch, gives 1.098 Hz, 2.752 ms and 40.727%. With the two day-17 epochs pooled, T1 C57 still matches (4.237 ms, 32.545%) but T1 C52's latency (2.358 ms) falls 0.03 ms below its tolerance. No single epoch fits both day-17 cells: in epoch 1 T1 C57 gives 4.651 ms and 29.455%, and in epoch 2 T1 C52 gives 2.109 ms and 13.455%. The file does not tell the epochs apart: both carry "N/A" for the power, last 120 and 121 s, and have the same pulses (median width 1.0625 ms, as in the other eight files, intervals of 0.1 and 2.102 s). The units fire at different rates in the two epochs (T1 C57 12.72 against 9.93 Hz, T4 C16 2.32 against 0.37 Hz, T1 C52 0.65 against 0.46 Hz), which shows the epochs differ in some way but does not establish the laser power of either. The criterion allows trying each of a day's sessions; taking a laser epoch per cell within one session goes beyond it and is an assumption, resting on the four-digit matches. Under reading (b) no row has all three values within tolerance.
figs3-stable-input-cell¶
The firing properties of one input cell stayed stable across six sessions on three days (14, 15 and 16 days after the rabies injection); it responded to every laser session with a latency of 2.50 to 2.95 ms.
Criterion: mouse 70375; the unit sorted under the same cluster label in all six sessions when the dandiset keeps one, otherwise the unit whose waveform best matches across sessions (an assumption). Reproduced when the unit is found in all six sessions, every latency lies within 1.8 to 4.4 ms and all 18 values are within tolerance; partially reproduced when the unit is found and responsive (R-a) in every session but some values miss. Each file of 70375 holds a single unit, all on tetrode 3 but with six different cluster ids, so there is no shared label; the waveforms are compared below.
s70 = sorted([x for x in units if x["subject"] == "70375"], key=lambda x: (x["day"], x["session"]))
print("Units of 70375 per session:", [(x["day"], x["session"], x["label"], x["unit"]["electrodes"]) for x in s70])
W = np.array([x["unit"]["waveform"] for x in s70])
print("waveform_mean shape per unit:", W.shape[1:], "(one channel per unit: the file stores the mean on one electrode)")
corr70 = np.corrcoef(W)
print("Waveform correlations between the six sessions:\n", pd.DataFrame(corr70, index=[f"d{x['day']}s{x['session']}" for x in s70],
columns=[f"d{x['day']}s{x['session']}" for x in s70]).round(3).to_string())
others = [x for x in units if x["subject"] == "58313"]
cross = np.corrcoef(np.vstack([W, [x["unit"]["waveform"] for x in others]]))[:6, 6:]
print(f"\n70375 within-cell correlations: {corr70[np.triu_indices(6, 1)].min():.3f} to {corr70[np.triu_indices(6, 1)].max():.3f};"
f" against the 6 units of 58313 (reference): {cross.min():.3f} to {cross.max():.3f}")
print("Peak-to-trough of waveform_mean per session, in the stored values (the file states volts):", [round(float(np.ptp(w)), 2) for w in W])
print("Peak-to-trough of waveform_mean for the units of 58313:", [(x["day"], x["label"], round(float(np.ptp(x["unit"]["waveform"])), 2)) for x in others])
Units of 70375 per session: [(14, 1, 'T3 C43', [8]), (14, 2, 'T3 C20', [8]), (15, 1, 'T3 C17', [8]), (15, 2, 'T3 C24', [8]), (16, 1, 'T3 C9', [8]), (16, 2, 'T3 C31', [8])]
waveform_mean shape per unit: (50,) (one channel per unit: the file stores the mean on one electrode)
Waveform correlations between the six sessions:
d14s1 d14s2 d15s1 d15s2 d16s1 d16s2
d14s1 1.000 0.979 0.960 0.918 0.929 0.953
d14s2 0.979 1.000 0.992 0.976 0.978 0.991
d15s1 0.960 0.992 1.000 0.990 0.993 0.991
d15s2 0.918 0.976 0.990 1.000 0.998 0.990
d16s1 0.929 0.978 0.993 0.998 1.000 0.990
d16s2 0.953 0.991 0.991 0.990 0.990 1.000
70375 within-cell correlations: 0.918 to 0.998; against the 6 units of 58313 (reference): -0.413 to 0.965
Peak-to-trough of waveform_mean per session, in the stored values (the file states volts): [35.48, 38.47, 33.91, 30.63, 39.7, 41.04]
Peak-to-trough of waveform_mean for the units of 58313: [(17, 'T1 C52', 74.96), (17, 'T1 C57', 121.99), (17, 'T4 C16', 33.73), (18, 'T4 C50', 209.61), (19, 'T1 C50', 89.19), (19, 'T1 C89', 243.27)]
exp_rate = [0.89, 1.06, 0.28, 1.61, 0.95, 1.84]
exp_lat = [2.83, 2.95, 2.77, 2.77, 2.58, 2.50]
exp_fid = [27.64, 48.00, 68.71, 64.36, 76.73, 81.82]
rows = []
for k, x in enumerate(s70):
rate = mu.open_field_rate(x["unit"]["spikes"], x["s"]["of"])
for reading in ("onset", "offset"):
lf = mu.latency_fidelity(x["unit"]["spikes"], mu.pulses(x["s"], reading))
rows.append({"day": x["day"], "session": x["session"], "unit": x["label"], "pulse_time": reading, "pulses": lf["n_pulses"],
"rate_hz": round(rate, 3), "exp_rate": exp_rate[k], "rate_ok": abs(rate - exp_rate[k]) <= 0.1 * exp_rate[k] + 1e-9,
"latency_ms": round(lf["latency_ms"], 3), "exp_lat": exp_lat[k], "lat_ok": abs(lf["latency_ms"] - exp_lat[k]) <= 0.1 * exp_lat[k] + 1e-9,
"fidelity_pct": round(lf["fidelity_pct"], 2), "exp_fid": exp_fid[k], "fid_ok": abs(lf["fidelity_pct"] - exp_fid[k]) <= 0.1 * exp_fid[k] + 1e-9,
"pre_pulse_pct": round(lf["pre_fidelity_pct"], 2), "responsive_2_4": mu.responsive(lf, (2.0, 4.0))})
s3 = pd.DataFrame(rows)
print(s3.to_string(index=False))
for reading in ("onset", "offset"):
r = s3[s3.pulse_time == reading]
n_ok = int(r.rate_ok.sum() + r.lat_ok.sum() + r.fid_ok.sum())
print(f"reading {reading}: {n_ok} of 18 values within tolerance; latencies {r.latency_ms.min():.2f} to {r.latency_ms.max():.2f} ms;"
f" responsive (R-a, 2-4 ms) in {int(r.responsive_2_4.sum())} of 6 sessions; missing: "
f"{[(d, s_, q) for d, s_, ok_r, ok_l, ok_f in zip(r.day, r.session, r.rate_ok, r.lat_ok, r.fid_ok) for q, ok in (('rate', ok_r), ('latency', ok_l), ('fidelity', ok_f)) if not ok]}")
# The other reading of the open-field span (first 1800 s, run for every unit in the
# fig5c-functional-cell-types section) and the first 275 pulses of each session (the pulse count of a
# 120 s epoch, which every file but day 14 session 2 has).
rows = []
for k, x in enumerate(s70):
r30 = cls30[(cls30.subject == "70375") & (cls30.day == x["day"]) & (cls30.session == x["session"])].iloc[0]
p = mu.pulses(x["s"], "onset")
lf275 = mu.latency_fidelity(x["unit"]["spikes"], p[:275])
rows.append({"day": x["day"], "session": x["session"], "pulses": len(p), "rate_1800": r30.rate_1800, "exp_rate": exp_rate[k],
"rate_ok": abs(r30.rate_1800 - exp_rate[k]) <= 0.1 * exp_rate[k] + 1e-9,
"latency_275_ms": round(lf275["latency_ms"], 3), "lat_ok": abs(lf275["latency_ms"] - exp_lat[k]) <= 0.1 * exp_lat[k] + 1e-9,
"fidelity_275_pct": round(lf275["fidelity_pct"], 2), "fid_ok": abs(lf275["fidelity_pct"] - exp_fid[k]) <= 0.1 * exp_fid[k] + 1e-9,
"responsive_2_4": mu.responsive(lf275, (2.0, 4.0))})
v = pd.DataFrame(rows)
print("\nFirst 1800 s of open field and first 275 pulses, reading (a):")
print(v.to_string(index=False))
print(f"{int(v.rate_ok.sum() + v.lat_ok.sum() + v.fid_ok.sum())} of 18 values within tolerance; responsive in {int(v.responsive_2_4.sum())} of 6 sessions")
x = s70[1]
spk, of = x["unit"]["spikes"], x["s"]["of"]
print(f"Day 14 session 2: open field {of['duration']:.0f} s; rate over the last 1800 s "
f"{np.sum((spk >= of['duration'] - 1800) & (spk < of['duration'])) / 1800:.3f} Hz")
print("Classes of the 70375 unit per session, whole series (literal / standard shuffle):",
cls[cls.subject == "70375"][["day", "session", "grid_literal", "hd_literal", "border_literal", "grid_standard", "hd_standard", "border_standard"]].values.tolist())
day session unit pulse_time pulses rate_hz exp_rate rate_ok latency_ms exp_lat lat_ok fidelity_pct exp_fid fid_ok pre_pulse_pct responsive_2_4 14 1 T3 C43 onset 275 0.885 0.89 True 2.834 2.83 True 27.64 27.64 True 0.73 True 14 1 T3 C43 offset 275 0.885 0.89 True 1.811 2.83 False 27.27 27.64 True 0.73 False 14 2 T3 C20 onset 413 0.899 1.06 False 3.050 2.95 True 46.49 48.00 True 0.00 True 14 2 T3 C20 offset 413 0.899 1.06 False 1.994 2.95 False 46.49 48.00 True 0.00 False 15 1 T3 C17 onset 278 0.279 0.28 True 2.769 2.77 True 68.71 68.71 True 0.00 True 15 1 T3 C17 offset 278 0.279 0.28 True 1.714 2.77 False 68.71 68.71 True 0.00 False 15 2 T3 C24 onset 275 1.613 1.61 True 2.771 2.77 True 64.36 64.36 True 0.00 True 15 2 T3 C24 offset 275 1.613 1.61 True 1.761 2.77 False 64.73 64.36 True 0.00 False 16 1 T3 C9 onset 275 0.950 0.95 True 2.578 2.58 True 76.73 76.73 True 0.36 True 16 1 T3 C9 offset 275 0.950 0.95 True 1.525 2.58 False 76.73 76.73 True 0.00 False 16 2 T3 C31 onset 275 1.841 1.84 True 2.497 2.50 True 81.82 81.82 True 0.36 True 16 2 T3 C31 offset 275 1.841 1.84 True 1.443 2.50 False 81.82 81.82 True 0.36 False reading onset: 17 of 18 values within tolerance; latencies 2.50 to 3.05 ms; responsive (R-a, 2-4 ms) in 6 of 6 sessions; missing: [(14, 2, 'rate')] reading offset: 11 of 18 values within tolerance; latencies 1.44 to 1.99 ms; responsive (R-a, 2-4 ms) in 0 of 6 sessions; missing: [(14, 1, 'latency'), (14, 2, 'rate'), (14, 2, 'latency'), (15, 1, 'latency'), (15, 2, 'latency'), (16, 1, 'latency'), (16, 2, 'latency')] First 1800 s of open field and first 275 pulses, reading (a): day session pulses rate_1800 exp_rate rate_ok latency_275_ms lat_ok fidelity_275_pct fid_ok responsive_2_4 14 1 275 0.886 0.89 True 2.834 True 27.64 True True 14 2 413 1.064 1.06 True 2.951 True 48.00 True True 15 1 278 0.279 0.28 True 2.766 True 69.09 True True 15 2 275 1.613 1.61 True 2.771 True 64.36 True True 16 1 275 0.951 0.95 True 2.578 True 76.73 True True 16 2 275 1.842 1.84 True 2.497 True 81.82 True True 18 of 18 values within tolerance; responsive in 6 of 6 sessions Day 14 session 2: open field 2722 s; rate over the last 1800 s 0.780 Hz Classes of the 70375 unit per session, whole series (literal / standard shuffle): [[14, 1, False, False, False, False, False, False], [14, 2, False, False, False, False, False, False], [15, 1, False, False, False, False, False, False], [15, 2, False, False, False, False, True, False], [16, 1, False, False, False, False, False, False], [16, 2, False, False, False, False, False, False]]
Result: partially reproduced, resting on an assumption. Each 70375 file holds one unit on tetrode 3, with a different cluster id in each session. Their mean waveforms, stored on one channel, correlate 0.918 to 0.998, but correlations with the units of 58313 reach 0.965, so the waveform does not identify the cell; it is taken as the same cell because each file holds this single curated unit and the Methods say the tetrodes were not turned down between these sessions, an assumption. With the open field taken as the whole position series (the assumption of the data check), reading (a) gives a responsive unit in all six sessions with latencies 2.50 to 3.05 ms, and 17 of 18 values within tolerance: the open-field rate of day 14 session 2 is 0.899 Hz against 1.06 +/- 0.106 Hz. That file holds 2722 s of open field and 413 pulses. With the open field taken as its first 1800 s, the other reading, and the first 275 pulses of each session, all 18 values are within tolerance (day 14 session 2: 1.064 Hz, 2.951 ms, 48.00%); the last 1800 s give 0.780 Hz. The first 275 pulses are not a rule the paper applied to every session: day 15 session 1 has 278 pulses, and its printed fidelity of 68.71% is what all 278 give, where the first 275 give 69.09%. The selection that gives the printed values for day 14 session 2 is specific to that session and is not documented. The paper does not say part of a session was left out, and the 1800 s reading is supported by the paper only through "approximately 30 min", so the outcome follows the whole series and the match under the other reading is recorded. Under reading (b) the latencies are 1.44 to 1.99 ms and 11 of 18 values are within tolerance.
figs4-nonresponsive-cells¶
Some MEC cells recorded in the same area did not respond to laser stimulation, among them a head direction cell (T4 C16, 17 days, head direction score 0.81, mean vector length 0.90, peak rate 9.02 Hz, open-field rate 1.05 Hz), a border cell (T4 C50, 18 days, 1.69 Hz) and a grid cell (T1 C50, 19 days, 0.78 Hz).
Criterion: mouse 58313; the head direction score and mean vector length as in Rowland et al. (2018); reproduced when the three units are not responsive (R-a) and the values are within tolerance. Rowland et al. (2018) define one quantity, "Mean vector length (head-direction score)", from the head-direction tuning map; the paper reports two different values. The helper computes it as the archdata code does (2 degree bins, Gaussian sigma of 2 bins, no speed filter). Neither paper states the bin width or smoothing, so the mean vector length and peak rate are also shown over bin widths of 2 to 10 degrees, smoothing sigmas of 0 to 20 degrees, with and without the 5 cm/s speed filter, and the vector length of the head directions at spikes is shown too.
rows = []
for lab, day, e_rate in [("T4 C16", 17, 1.05), ("T4 C50", 18, 1.69), ("T1 C50", 19, 0.78)]:
x = [x for x in units if x["subject"] == "58313" and x["label"] == lab and x["day"] == day][0]
rate = mu.open_field_rate(x["unit"]["spikes"], x["s"]["of"])
epochs = [None] if len(x["s"]["epochs"]) == 1 else [None, 0, 1]
for reading in ("onset", "offset"):
for ep in epochs:
lf = mu.latency_fidelity(x["unit"]["spikes"], mu.pulses(x["s"], reading, ep))
rows.append({"unit": lab, "day": day, "pulse_time": reading, "epoch": "all" if ep is None else ep + 1,
"pulses": lf["n_pulses"], "with_spike": lf["n_hit"], "latency_ms": round(lf["latency_ms"], 2),
"fidelity_pct": round(lf["fidelity_pct"], 2), "pre_pulse_pct": round(lf["pre_fidelity_pct"], 2),
"responsive_2_4": mu.responsive(lf, (2.0, 4.0)), "responsive_1.8_4.4": mu.responsive(lf, (1.8, 4.4)),
"rate_hz": round(rate, 3), "exp_rate": e_rate, "rate_ok": abs(rate - e_rate) <= 0.1 * e_rate + 1e-9})
s4 = pd.DataFrame(rows)
print(s4.to_string(index=False))
print("Any of the three responsive under any reading or epoch:", bool(s4["responsive_1.8_4.4"].any()))
x = [x for x in units if x["subject"] == "58313" and x["label"] == "T4 C16"][0]
of = x["s"]["of"]
smp = mu.spike_samples(x["unit"]["spikes"], of)
fast = of["speed"] > mu.SPEED_CUTOFF_CM_S
hd_rows = []
for bin_deg in (2, 3, 6, 10):
for sigma_deg in (0, 4, 6, 10, 14, 20):
for speed, sel in (("all", None), ("> 5 cm/s", fast)):
c, tc = mu.hd_tuning(smp, of, sel=sel, n_bins=360 // bin_deg, sigma=sigma_deg / bin_deg)
hd_rows.append({"bin_deg": bin_deg, "sigma_deg": sigma_deg, "samples": speed,
"mvl": round(mu.mean_vector_length(c, tc), 3), "peak_hz": round(float(tc.max()), 2)})
hd = pd.DataFrame(hd_rows)
print("\nT4 C16 tuning-map mean vector length and peak rate by bin width, smoothing sigma (degrees) and speed filter.")
print("The helper's reading (archdata hd_tuning_curve) is 2 degree bins, sigma 4 degrees (2 bins), all samples.")
print("Peak rate (Hz), expected 9.02 +/- 0.90:")
print(hd.pivot_table(index=["bin_deg", "samples"], columns="sigma_deg", values="peak_hz").to_string())
print("Mean vector length, expected 0.90 +/- 0.09 (head direction score 0.81 +/- 0.081):")
print(hd.pivot_table(index=["bin_deg", "samples"], columns="sigma_deg", values="mvl").to_string())
pk = hd[(hd.peak_hz - 9.02).abs() <= 0.902]
print(f"Settings with the peak within tolerance: {len(pk)} of {len(hd)}, sigma {sorted(pk.sigma_deg.unique().tolist())} degrees; "
f"their MVL {pk.mvl.min():.3f} to {pk.mvl.max():.3f}")
print(f"MVL over all settings {hd.mvl.min():.3f} to {hd.mvl.max():.3f}; within 0.81 +/- 0.081 in {int(((hd.mvl - 0.81).abs() <= 0.081).sum())} settings")
spk_all = float(np.abs(np.mean(np.exp(1j * of["hd"][smp]))))
spk_fast = float(np.abs(np.mean(np.exp(1j * of["hd"][smp[fast[smp]]]))))
print(f"Vector length of the head directions at spikes: all spikes {spk_all:.3f}; spikes at speed > 5 cm/s {spk_fast:.3f} "
"(the measure of a commented-out line in archdata spatial_maps.py)")
both = hd[((hd.peak_hz - 9.02).abs() <= 0.902) & ((hd.mvl - 0.81).abs() <= 0.081)]
print(f"Settings with both the peak (9.02 +/- 0.90 Hz) and the MVL within 0.81 +/- 0.081: {len(both)}")
arch = hd[(hd.bin_deg == 2) & (hd.sigma_deg == 4) & (hd.samples == "all")].iloc[0]
print(f"Helper's reading: MVL {arch.mvl:.3f}, peak {arch.peak_hz:.2f} Hz")
print(f"T4 C16 tuning stability (first against second half): {cls[(cls.subject == '58313') & (cls.unit == 'T4 C16')].hd_stability.iloc[0]:.3f}")
unit day pulse_time epoch pulses with_spike latency_ms fidelity_pct pre_pulse_pct responsive_2_4 responsive_1.8_4.4 rate_hz exp_rate rate_ok
T4 C16 17 onset all 550 6 4.68 1.09 0.18 False False 1.047 1.05 True
T4 C16 17 onset 1 275 5 5.16 1.82 0.36 False False 1.047 1.05 True
T4 C16 17 onset 2 275 1 2.27 0.36 0.00 False False 1.047 1.05 True
T4 C16 17 offset all 550 5 4.55 0.91 0.36 False False 1.047 1.05 True
T4 C16 17 offset 1 275 4 5.39 1.45 0.73 False False 1.047 1.05 True
T4 C16 17 offset 2 275 1 1.21 0.36 0.00 False False 1.047 1.05 True
T4 C50 18 onset all 275 0 NaN 0.00 0.00 False False 1.692 1.69 True
T4 C50 18 offset all 275 0 NaN 0.00 0.00 False False 1.692 1.69 True
T1 C50 19 onset all 275 1 1.00 0.36 0.00 False False 0.776 0.78 True
T1 C50 19 offset all 275 0 NaN 0.00 0.36 False False 0.776 0.78 True
Any of the three responsive under any reading or epoch: False
T4 C16 tuning-map mean vector length and peak rate by bin width, smoothing sigma (degrees) and speed filter.
The helper's reading (archdata hd_tuning_curve) is 2 degree bins, sigma 4 degrees (2 bins), all samples.
Peak rate (Hz), expected 9.02 +/- 0.90:
sigma_deg 0 4 6 10 14 20
bin_deg samples
2 > 5 cm/s 14.69 12.83 11.90 10.27 8.83 7.12
all 13.92 10.62 9.72 8.61 7.55 6.19
3 > 5 cm/s 15.40 12.84 11.89 10.23 8.79 7.11
all 13.10 10.57 9.71 8.60 7.54 6.20
6 > 5 cm/s 12.90 12.35 11.74 10.23 8.81 7.11
all 10.77 9.74 9.41 8.41 7.40 6.12
10 > 5 cm/s 12.08 11.83 11.01 9.64 8.50 6.98
all 10.21 9.91 8.94 8.29 7.40 6.13
Mean vector length, expected 0.90 +/- 0.09 (head direction score 0.81 +/- 0.081):
sigma_deg 0 4 6 10 14 20
bin_deg samples
2 > 5 cm/s 0.931 0.929 0.926 0.917 0.904 0.876
all 0.914 0.912 0.909 0.900 0.887 0.860
3 > 5 cm/s 0.930 0.927 0.925 0.916 0.902 0.875
all 0.915 0.913 0.910 0.901 0.888 0.861
6 > 5 cm/s 0.928 0.926 0.923 0.914 0.901 0.873
all 0.912 0.910 0.907 0.899 0.886 0.858
10 > 5 cm/s 0.926 0.925 0.922 0.912 0.899 0.872
all 0.911 0.909 0.906 0.897 0.884 0.857
Settings with the peak within tolerance: 15 of 48, sigma [4, 6, 10, 14] degrees; their MVL 0.897 to 0.912
MVL over all settings 0.857 to 0.931; within 0.81 +/- 0.081 in 12 settings
Vector length of the head directions at spikes: all spikes 0.880; spikes at speed > 5 cm/s 0.923 (the measure of a commented-out line in archdata spatial_maps.py)
Settings with both the peak (9.02 +/- 0.90 Hz) and the MVL within 0.81 +/- 0.081: 0
Helper's reading: MVL 0.912, peak 10.62 Hz
T4 C16 tuning stability (first against second half): 0.972
Result: partially reproduced, resting on an assumption. None of the three units is responsive under either reading or any epoch (fidelity 0.00 to 1.82%), and their open-field rates (1.047, 1.692 and 0.776 Hz) match. For T4 C16 the mean vector length of the tuning map, which Rowland et al. (2018) call the head-direction score, is 0.912 under the helper's (archdata) reading: within tolerance of the mean vector length of 0.90, outside that of the head direction score of 0.81. Its peak rate there is 10.62 Hz against 9.02 +/- 0.90 Hz. Over the 48 tuning settings shown, the mean vector length runs from 0.857 to 0.931; the peak is within tolerance in 15 settings, all with smoothing sigmas of 4 to 14 degrees (mean vector length 0.897 to 0.912), and no setting gives both the peak and a value within 0.81 +/- 0.081. The vector length of the head directions at spikes is 0.880 over all spikes and 0.923 over spikes above 5 cm/s; it lies within tolerance of both 0.81 and 0.90, so it does not identify the score. Under the method Rowland et al. (2018) and their code give, two of the six values miss (the head direction score and the peak rate); the peak can be matched with heavier smoothing than their code's, the score of 0.81 cannot be matched by a tuning-map measure that also gives the peak.
responsive-cells-at-19-days¶
Laser-responsive cells with clear spatial firing patterns could be identified for at least 19 days after the rabies injection.
Criterion: reproduced when a session 19 or more days after the rabies injection holds a unit that is responsive (R-a: latency 2 to 4 ms, fidelity at least 11.64%) and classed as a grid, head direction or border cell under Rowland et al. (2018). The widened 1.8 to 4.4 ms window is shown as well.
late = lt[lt.day >= 19].copy()
late["responsive_2_4"] = [mu.responsive({"latency_ms": a, "fidelity_pct": b}, (2.0, 4.0)) for a, b in zip(late.latency_ms, late.fidelity_pct)]
late["spatial_literal"] = late.grid_literal | late.hd_literal | late.border_literal
late["spatial_standard"] = late.grid_standard | late.hd_standard | late.border_standard
print(late[["subject", "day", "session", "unit", "pulse_time", "latency_ms", "fidelity_pct", "responsive_2_4", "responsive",
"spatial_literal", "spatial_standard"]].rename(columns={"responsive": "responsive_1.8_4.4"}).to_string(index=False))
print("Sessions at 19 days or more:", sorted({(s["subject"], s["day"], s["session_no"]) for s in sessions if s["day"] >= 19}))
for reading in ("onset", "offset"):
r = late[late.pulse_time == reading]
print(f"reading {reading}: responsive (2-4 ms) and spatial (literal shuffle): {r[r.responsive_2_4 & r.spatial_literal].unit.tolist()};"
f" (standard shuffle): {r[r.responsive_2_4 & r.spatial_standard].unit.tolist()}")
subject day session unit pulse_time latency_ms fidelity_pct responsive_2_4 responsive_1.8_4.4 spatial_literal spatial_standard
58313 19 1 T1 C50 onset 1.00 0.36 False False True True
58313 19 1 T1 C50 offset NaN 0.00 False False True True
58313 19 1 T1 C89 onset 2.75 40.73 True True True True
58313 19 1 T1 C89 offset 1.70 40.73 False False True True
Sessions at 19 days or more: [('58313', 19, 1)]
reading onset: responsive (2-4 ms) and spatial (literal shuffle): ['T1 C89']; (standard shuffle): ['T1 C89']
reading offset: responsive (2-4 ms) and spatial (literal shuffle): []; (standard shuffle): []
Result: reproduced. The one session at 19 days or more (58313, day 19) holds T1 C89, responsive under reading (a) (2.75 ms, 40.73%) and classed as a grid cell under both shuffles. Under reading (b) its latency is 1.70 ms and no unit of that session qualifies.
mec-inputs-from-two-weeks¶
In the optogenetic experiments, input cells could be detected in the MEC from about 2 weeks after the rabies injection.
Criterion: read as detection by recording; reproduced when the earliest session holding a responsive unit (R-a) is 12.6 to 15.4 days after the rabies injection.
lt["responsive_2_4"] = [mu.responsive({"latency_ms": a, "fidelity_pct": b}, (2.0, 4.0)) for a, b in zip(lt.latency_ms, lt.fidelity_pct)]
for reading in ("onset", "offset"):
r = lt[(lt.pulse_time == reading) & lt.responsive_2_4]
by_subj = r.groupby("subject").day.min().to_dict()
print(f"reading {reading}: earliest day with a responsive unit (2-4 ms, >= 11.64%): {r.day.min()} (per mouse {by_subj});"
f" units on that day: {r[r.day == r.day.min()][['subject', 'session', 'unit', 'latency_ms', 'fidelity_pct']].values.tolist()}")
print("Earliest session day in the dandiset, per mouse:", {subj: min(s["day"] for s in sessions if s["subject"] == subj) for subj in sorted({s["subject"] for s in sessions})})
reading onset: earliest day with a responsive unit (2-4 ms, >= 11.64%): 14 (per mouse {'58313': 17, '70375': 14}); units on that day: [['70375', 1, 'T3 C43', 2.83, 27.64], ['70375', 2, 'T3 C20', 3.05, 46.49]]
reading offset: earliest day with a responsive unit (2-4 ms, >= 11.64%): 17 (per mouse {'58313': 17}); units on that day: [['58313', 1, 'T1 C57', 3.35, 31.64], ['58313', 1, 'T1 C57', 3.79, 28.0], ['58313', 1, 'T1 C57', 3.0, 35.27]]
Earliest session day in the dandiset, per mouse: {'58313': 17, '70375': 14}
Result: reproduced. Under reading (a) the earliest session with a responsive unit is on day 14 (70375, both sessions: 2.83 ms and 27.64%; 3.05 ms and 46.49%), within 12.6 to 15.4 days. Under reading (b), with the 2 to 4 ms window, it is day 17. The dandiset holds no session before day 14 and only the curated units the figures show, so the test cannot fail on the early side and cannot show that responsive cells were absent earlier; the result is consistent with the statement.
Summary¶
| Claim | Outcome |
|---|---|
| fig5c-functional-cell-types | reproduced (assumed: standard shuffle) |
| fig5c-responsive-grid-cell | reproduced |
| fig5c-example-cells | reproduced (assumed: laser epoch per cell on day 17) |
| figs3-stable-input-cell | partially reproduced (assumed: same cell, open field as the whole position series); one rate of 18 values misses, all 18 match on the first 1800 s |
| figs4-nonresponsive-cells | partially reproduced (assumed: head direction score as the tuning-map mean vector length, archdata tuning parameters); HD score and peak rate miss |
| responsive-cells-at-19-days | reproduced |
| mec-inputs-from-two-weeks | reproduced |
| 19 histology claims (Figures 2 to 4, S1, S2, Tables S1, S2, cytotoxicity, population labelling) | blocked, data missing |
| fig6b-imaged-input-cells, fig7b-dual-labelled-input-cell | blocked, data missing |
A failure to reproduce here may be a failure of this attempt, not of the paper: see the reasoning and the differences from the paper's method.
How the analysis differs from the paper's. The paper's own analysis code is not published. Cell classes follow the Methods of Rowland et al. (2018), with the details the text leaves open taken from that paper's linked code (archdata, commit 9452263); the shuffle interval was run under two readings. The pulse time was run as TTL onset and offset; the onset reproduces 8 of the 9 printed latencies within 0.01 ms (day 17 taken per epoch). Pulses exclude the first TTL event of each epoch. The open field is taken as the whole position series, as the files have no open-field epoch; its first 1800 s, the other reading, moves no rate by more than 0.001 Hz except in day 14 session 2 of 70375, where it matches the printed value. For the day-17 file the laser epoch was taken per cell. The tuning-curve bin width and smoothing were varied for T4 C16.
What was found about the dataset. It holds only the optrode recordings, and of those only the 12
curated units the figures show; the histology and imaging behind 21 of the 28 claims are not in it
and the paper names no other deposit. The open field has no epoch. The two laser epochs of the day-17
file carry no power label. The first TTL event of every epoch is spurious (onset at the epoch start,
45 ms to 1.9 s long). The pulses come in trains of 6 at 10 Hz every 2.6 s, where the Methods say 10 Hz
continuously. The LFP timestamps run backwards within each file. waveform_mean is labelled volts
but holds values with peak-to-trough 31 to 41 for the 70375 unit and 34 to 243 for the units of 58313. For day 14 session 2 of 70375, the file holds more
open field and more pulses than the paper's printed values use. Version 0.220426.0814 holds every
session twice, under real and hashed subject ids; the pinned version holds each once.
print(f"notebook ran in {time.time() - started:.0f} s")
notebook ran in 178 s