Reproducing Armstrong & Vlasov (2026) from dandiset 001341¶
Paper. Armstrong AG, Vlasov Y (2026). Neural correlates of perceptual decision-making in the primary somatosensory cortex. PNAS 123(18), e2514107123. doi:10.1073/pnas.2514107123. The claims file was written from the accepted author manuscript in PubMed Central (NIHMS2207436, PMC13142948) and its SI Appendix.
Dandiset. DANDI:001341, version 0.260414.1316. The paper cites this version (reference 63, "Version 0.260414.1316", DOI 10.48324/dandi.001341/0.260414.1316), and it is the only published version; the draft has the same two assets. The files are streamed; nothing is downloaded.
What the dandiset holds. Two NWB files, animals 489 and 503 of the 19 in Table S1, each with the units table, the trials table and the ball tracking at 500 Hz. It holds no wall positions, whisker tracking, touch times, gait or psychometric sessions, and no synchronisation signal between the spike times and the trial clock, although the SI says LabVIEW TTL signals were used to synchronise the recordings with the behaviour (SI, Electrophysiological recordings).
Claims. From claims/001341/10.1073-pnas.2514107123.yaml. Six are tested; the others are blocked.
| Claim | Tested here | Reason if blocked |
|---|---|---|
| table-s1-recordings | yes | |
| fig1lm-staged-modulation | no | metadata_insufficient: spikes cannot be placed on the trial clock |
| fig1n-epoch-rates | yes, epoch 1 rate only | the timed values need the spike clock |
| fig1jk-all-units | no | metadata_insufficient (as above) |
| fig1n-ramp-slope | no | metadata_insufficient (as above) |
| fig1o-trial-end-ramp | no | metadata_insufficient (as above) |
| fig1-ramp-contralateral-only | no | metadata_insufficient (as above); 5 of 7 animals absent |
| figs1-running-speed | yes | |
| fig2a-success-rate | yes | |
| fig2b-lateral-spread | yes | |
| fig2c-psychometric | no | data_missing: psychometric animals and wall distances absent |
| fig2d-turn-angle | no | data_missing (as above) |
| fig2f-whisking-params | no | data_missing: no whisker tracking |
| fig2i-ft-rt | no | data_missing: no touch times; animals 573 and 480 absent |
| fig2jk-glm-mixed-tuning | no | data_missing: animal 579 and whisker and gait variables absent |
| fig2-epoch2-at-first-touch | no | data_missing: no touch times |
| fig2l-running-vs-sitting | no | data_missing: animal 480 absent |
| fig2m-dimensionality-collapse | no | metadata_insufficient: spike clock |
| figs12-tuning-lost-during-decision | no | data_missing: GLM variables absent |
| fig3-wall-kinematics | no | data_missing: no wall positions or touch times |
| fig3c-touch-statistics | no | data_missing: no touch times |
| fig3ijkl-whisking-across-epochs | no | data_missing: no whisker tracking |
| fig3-not-sensory-drive | no | data_missing: depends on touch statistics |
| fig4-ddm-fit | yes | |
| fig4b-ddm-matches-ramp | no | metadata_insufficient: the ramp onset needs the spike clock |
| fig5e-slope-across-animals | no | metadata_insufficient: spike clock; 5 of 7 animals absent |
| fig4f-varce-example-unit | no | metadata_insufficient: spike clock |
| fig4g-varce-population | no | metadata_insufficient: spike clock |
| fig4j-corce | no | metadata_insufficient: spike clock |
| fig4k-streak-index | no | metadata_insufficient: spike clock |
| fig5b-epochs-in-subpopulations | no | metadata_insufficient: spike clock |
| fig5cd-other-animals | no | metadata_insufficient: spike clock; 5 of 7 animals absent |
| fig5e-principal-vs-neighbor | no | metadata_insufficient: spike clock; 5 of 7 animals absent |
import time
import warnings
from multiprocessing import Pool
import matplotlib.pyplot as plt
import h5py
import numpy as np
import pandas as pd
from scipy import stats
import barrel_vr as bv
pd.set_option("display.width", 200)
pd.set_option("display.max_columns", 40)
pd.set_option("display.max_rows", 200)
warnings.filterwarnings("ignore")
started = time.time()
urls = bv.asset_urls()
S = {}
for s, u in urls.items():
f = bv.open_session(u)
tr = bv.load_trials(f)
beh = bv.load_behaviour(f)
seg = bv.trial_segments(beh)
S[s] = dict(file=f, trials=tr, beh=beh, seg=seg, units=bv.load_units(f), spikes=bv.all_spikes(f),
samples=bv.trial_table_from_samples(beh, seg))
print(f"dandiset {bv.DANDISET_ID} version {bv.DANDISET_VERSION}: sessions {list(S)}, "
f"loaded in {time.time() - started:.0f} s")
dandiset 001341 version 0.260414.1316: sessions ['489', '503'], loaded in 11 s
Data check¶
Each check of the metadata against the values is stated under its output. First the session metadata and the contents of each file.
for s, d in S.items():
f = d["file"]
g = f["general/subject"]
meta = {k: bv._str(g[k][()]) for k in ["subject_id", "age", "date_of_birth", "sex", "genotype", "weight"]}
start = bv._str(f["session_start_time"][()])
dob = pd.Timestamp(meta["date_of_birth"]).tz_localize(None).normalize()
ses = pd.Timestamp(start).tz_localize(None).normalize()
print(f"session {s}: start {start[:10]}, {meta}; days from birth to session: {(ses - dob).days}")
print(" acquisition:", {k: (f['acquisition'][k]['data'].shape[0], bv._str(f['acquisition'][k]['data'].attrs['unit']))
for k in f["acquisition"]})
print(" units table columns:", [k for k in f["units"].keys()])
print("Table S1: 489 female, P68, session 7/8/2022; 503 female, P89, session 9/2/2022.")
for s, d in S.items():
f = d["file"]
groups = {}
f.visititems(lambda n, o: groups.setdefault(n.split("/")[0], []).append(n) if isinstance(o, h5py.Dataset) else None)
print(f"session {s}: datasets per top-level group (recursive):", {k: len(v) for k, v in groups.items()})
print(" datasets outside acquisition, units, intervals/trials, general and specifications:",
[n for k, v in groups.items() if k not in ("acquisition", "units", "intervals", "general", "specifications") for n in v],
[n for n in groups.get("intervals", []) if not n.startswith("intervals/trials/")])
print(" groups with no datasets:", [k for k in ["processing", "analysis", "stimulus"] if k not in groups and k in f],
"; general:", [n for n in groups["general"] if not n.startswith("general/subject")])
session 489: start 2022-07-08, {'subject_id': '489', 'age': 'P63D', 'date_of_birth': '2022-05-01T00:00:00-05:00', 'sex': 'F', 'genotype': 'Scnn1a-TG3-Cre x Ai32', 'weight': '0.02 kg'}; days from birth to session: 68
acquisition: {'distance_for': (3108844, 'cm'), 'distance_lat': (3108844, 'cm'), 'speed_for_smooth': (3108844, 'cm/s'), 'speed_lat_smooth': (3108844, 'cm/s'), 'trial': (3108844, 'n'), 'ts_local': (3108844, 's')}
units table columns: ['PT_ratio', 'amplitude_cutoff', 'amplitude_waveform', 'cumulative_drift', 'd_prime', 'depth', 'duration', 'epoch_name_quality_metrics', 'epoch_name_waveform_metrics', 'firing_rate', 'id', 'isi_viol', 'isolation_distance', 'l_ratio', 'layer', 'max_drift', 'nn_hit_rate', 'nn_miss_rate', 'peak_channel', 'presence_ratio', 'recovery_slope', 'repolarization_slope', 'snr', 'spike_times', 'spike_times_index', 'spread', 'unit_type', 'velocity_above', 'velocity_below']
session 503: start 2022-09-02, {'subject_id': '503', 'age': 'P89D', 'date_of_birth': '2022-06-06T00:00:00-05:00', 'sex': 'F', 'genotype': 'Scnn1a-TG3-Cre x Ai32', 'weight': '0.02 kg'}; days from birth to session: 88
acquisition: {'distance_for': (3648261, 'cm'), 'distance_lat': (3648261, 'cm'), 'speed_for_smooth': (3648261, 'cm/s'), 'speed_lat_smooth': (3648261, 'cm/s'), 'trial': (3648261, 'n'), 'ts_local': (3648261, 's')}
units table columns: ['PT_ratio', 'amplitude_cutoff', 'amplitude_waveform', 'cumulative_drift', 'd_prime', 'depth', 'duration', 'epoch_name_quality_metrics', 'epoch_name_waveform_metrics', 'firing_rate', 'id', 'isi_viol', 'isolation_distance', 'l_ratio', 'layer', 'max_drift', 'nn_hit_rate', 'nn_miss_rate', 'peak_channel', 'presence_ratio', 'recovery_slope', 'repolarization_slope', 'snr', 'spike_times', 'spike_times_index', 'spread', 'unit_type', 'velocity_above', 'velocity_below']
Table S1: 489 female, P68, session 7/8/2022; 503 female, P89, session 9/2/2022.
session 489: datasets per top-level group (recursive): {'acquisition': 12, 'file_create_date': 1, 'general': 14, 'identifier': 1, 'intervals': 4, 'session_description': 1, 'session_start_time': 1, 'specifications': 20, 'timestamps_reference_time': 1, 'units': 29}
datasets outside acquisition, units, intervals/trials, general and specifications: ['file_create_date', 'identifier', 'session_description', 'session_start_time', 'timestamps_reference_time'] []
groups with no datasets: ['processing', 'analysis', 'stimulus'] ; general: ['general/experiment_description', 'general/experimenter', 'general/institution', 'general/keywords', 'general/lab', 'general/protocol']
session 503: datasets per top-level group (recursive): {'acquisition': 12, 'file_create_date': 1, 'general': 14, 'identifier': 1, 'intervals': 4, 'session_description': 1, 'session_start_time': 1, 'specifications': 20, 'timestamps_reference_time': 1, 'units': 29}
datasets outside acquisition, units, intervals/trials, general and specifications: ['file_create_date', 'identifier', 'session_description', 'session_start_time', 'timestamps_reference_time'] []
groups with no datasets: ['processing', 'analysis', 'stimulus'] ; general: ['general/experiment_description', 'general/experimenter', 'general/institution', 'general/keywords', 'general/lab', 'general/protocol']
The sessions are 489 (2022-07-08) and 503 (2022-09-02), as in Table S1. The file of 489 gives its age as P63D,
but its date of birth and session date are 68 days apart, which is the P68 of Table S1. For 503 the file says P89D
and Table S1 P89; the dates are 88 days apart. Both files give a weight of 0.02 kg. Every acquisition series has a
unit; trial (unit "n") is the trial number of each sample and ts_local the time since that trial started.
Next, the trials table against the sample series.
for s, d in S.items():
tr = d["trials"]
print(f"session {s}: {len(tr)} rows in the trials table; by label:", tr.label.value_counts().to_dict())
print(f" intact rows (before the first repeated start time): {tr.intact.sum()};",
"by label:", tr[tr.intact].label.value_counts().to_dict())
print(f" rows with stop before start: {tr.negative.sum()} (all OL: {tr[tr.negative].label.str.startswith('OL').all()}),"
f" rows {tr.index[tr.negative].min()} to {tr.index[tr.negative].max()}")
it = tr[tr.intact]
gap = it.start_time.values[1:] - it.start_time.values[:-1]
neg = np.flatnonzero(it.negative.values[:-1])
print(f" for those rows, next start minus start: {np.round(np.unique(np.round(gap[neg], 3)), 3)} s")
samp = d["samples"]
j = tr.index[tr.negative][0]
print(f" example row {j}: table start {tr.start_time[j]:.3f}, stop {tr.stop_time[j]:.3f}; its samples run "
f"{samp.t_first[j]:.3f} to {samp.t_last[j]:.3f} on the timestamps, {samp.t_local_end[j]:.3f} s on ts_local; "
f"the straight row before it starts at {tr.start_time[j - 1]:.3f}")
ok = it.index[~it.negative]
print(f" other intact rows: table start equals first sample time in {np.mean(np.isclose(samp.t_first[ok], it.start_time[ok], atol=0.003)):.3f}"
f" of rows; OL durations {it[it.label.str.startswith('OL') & ~it.negative].duration.describe()[['min', '50%', 'max']].round(3).to_dict()}")
session 489: 1611 rows in the trials table; by label: {'OL_L': 860, 'CL': 500, 'OL_R': 251}
intact rows (before the first repeated start time): 1000; by label: {'CL': 500, 'OL_R': 251, 'OL_L': 249}
rows with stop before start: 62 (all OL: True), rows 173 to 757
for those rows, next start minus start: [1.98 1.982 1.99 1.992 1.994 1.996 1.998 2. 2.002 2.004] s
example row 173: table start 704.582, stop 701.896; its samples run 699.896 to 701.896 on the timestamps, 2.000 s on ts_local; the straight row before it starts at 699.896
other intact rows: table start equals first sample time in 0.999 of rows; OL durations {'min': 1.998, '50%': 2.0, 'max': 2.002}
session 503: 1027 rows in the trials table; by label: {'CL': 514, 'OL_R': 283, 'OL_L': 230}
intact rows (before the first repeated start time): 1027; by label: {'CL': 514, 'OL_R': 283, 'OL_L': 230}
rows with stop before start: 63 (all OL: True), rows 251 to 777
for those rows, next start minus start: [1.98 1.982 1.986 1.988 1.99 1.992 1.994 1.996 1.998 2. 2.002 2.004] s
example row 251: table start 1995.146, stop 1987.142; its samples run 1985.144 to 1987.142 on the timestamps, 1.998 s on ts_local; the straight row before it starts at 1985.148
other intact rows: table start equals first sample time in 0.999 of rows; OL durations {'min': 1.998, '50%': 2.0, 'max': 2.002}
In both sessions, a run of OL rows (62 in 489, 63 in 503) has a stop time earlier than its start time. The samples
of these rows carry timestamps that restart at the preceding straight row's start, while ts_local runs from 0 to
2.0 s and the next row starts 2.0 s after the row's start. The start times are therefore taken as right, the
timestamps and stop times of those rows as wrong, and time within a trial is taken from ts_local. All other intact
rows start at their first sample's timestamp.
In 489, the trials table from row 1000 on (611 rows) repeats one start time, stop time and label (OL_L_1.dat).
The sample series below shows that these are real trials with their own times.
d = S["489"]
tr, samp, beh, seg = d["trials"], d["samples"], d["beh"], d["seg"]
bad = tr.index[~tr.intact]
print(f"489: rows {bad.min()} to {bad.max()} ({len(bad)}) have start {tr.start_time[bad].unique()}, stop {tr.stop_time[bad].unique()},"
f" label {list(tr.trial_type[bad].unique())}")
b = samp.loc[bad]
short = b.t_local_end < 2.2
print(f" from the trial series: times {b.t_first.min():.1f} to {b.t_last.max():.1f} s; {short.sum()} rows last 2.0 s "
f"(ts_local end {b.t_local_end[short].min():.3f} to {b.t_local_end[short].max():.3f}), {(~short).sum()} last "
f"{b.t_local_end[~short].min():.2f} to {b.t_local_end[~short].max():.2f} s; they alternate: "
f"{np.all(np.diff(short.values.astype(int)) != 0)}")
print(f" forward distance at the end of the long rows: median {b.d_for_end[~short].median():.1f} cm (straight runs of 100 cm)")
x1 = bv.lateral_at(beh, seg, list(b.index[short]), 1.0)
print(f" lateral displacement at 1 s in the 2-s rows: {np.sum(x1 > 0)} to the left, {np.sum(x1 < 0)} to the right,"
f" median {np.nanmedian(x1):.2f} cm")
it = tr[tr.intact & tr.label.str.startswith("OL")]
for lab in ["OL_L", "OL_R"]:
r = list(it.index[it.label == lab])
print(f" intact {lab} rows: lateral displacement at 1 s median {np.nanmedian(bv.lateral_at(beh, seg, r, 1.0)):.2f} cm")
489: rows 1000 to 1610 (611) have start [3681.414], stop [3683.414], label ['OL_L_1.dat'] from the trial series: times 3683.4 to 6217.7 s; 305 rows last 2.0 s (ts_local end 1.998 to 2.002), 306 last 3.37 to 18.42 s; they alternate: True forward distance at the end of the long rows: median 100.0 cm (straight runs of 100 cm) lateral displacement at 1 s in the 2-s rows: 49 to the left, 256 to the right, median -4.22 cm intact OL_L rows: lateral displacement at 1 s median 3.32 cm intact OL_R rows: lateral displacement at 1 s median -3.04 cm
The 611 repeated rows of 489 are 305 two-second turns alternating with 306 straight runs that end at 100 cm, over 3683 to 6218 s, while the table labels all of them OL_L at one time. Of the 305 turns, 256 go to the right and 49 to the left at 1 s, so the label is wrong for most of them and the turn type of each cannot be read from the file. These rows are left out of every analysis; the session's labelled trials are its first 1000 rows (500 straight, 249 OL_L, 251 OL_R). That these are the 1000 trials of Table S1 is an assumption; the table-s1 section also counts all 1611 rows.
Next, the ranges and units of the behavioural series.
for s, d in S.items():
tr, beh, seg, samp = d["trials"], d["beh"], d["seg"], d["samples"]
dt = np.diff(beh.ts.values)
print(f"session {s}: {len(beh)} samples; timestamp step {np.median(dt):.4f} s ({1 / np.median(dt):.0f} Hz, SI: 500 Hz);"
f" steps that go back in time: {(dt < 0).sum()}")
for c in ["d_for", "d_lat", "v_for", "v_lat"]:
v = beh[c].values
print(f" {c}: {np.nanmin(v):.2f} to {np.nanmax(v):.2f}, median {np.nanmedian(v):.2f}, NaN {np.isnan(v).mean():.4f}")
it = tr[tr.intact]
cl = it.index[it.label == "CL"]
print(f" straight rows: forward distance at the end median {samp.d_for_end[cl].median():.1f} cm "
f"(5th to 95th percentile {samp.d_for_end[cl].quantile(.05):.1f} to {samp.d_for_end[cl].quantile(.95):.1f});"
f" duration median {samp.t_local_end[cl].median():.2f} s")
# forward distance against the integral of forward speed, per straight row
ratio = []
for r in cl[samp.d_for_end[cl].values > 50]:
idx = seg[r]
t = beh.t_local.values[idx]
v = np.nan_to_num(beh.v_for.values[idx])
ratio.append(np.trapezoid(v, t) / max(beh.d_for.values[idx][-1], 1e-9))
print(f" {np.sum(samp.d_for_end[cl] <= 50)} straight rows end before 50 cm. Over the others, integral of v_for / forward distance: median {np.median(ratio):.3f}"
f" (5th to 95th percentile {np.percentile(ratio, 5):.3f} to {np.percentile(ratio, 95):.3f})")
session 489: 3108844 samples; timestamp step 0.0020 s (500 Hz, SI: 500 Hz); steps that go back in time: 891 d_for: -0.57 to 100.06, median 37.19, NaN 0.0000 d_lat: -121.19 to 14.17, median -2.41, NaN 0.0000 v_for: -8.36 to 41.83, median 18.44, NaN 0.0001 v_lat: -21.25 to 10.58, median -0.79, NaN 0.0001 straight rows: forward distance at the end median 99.9 cm (5th to 95th percentile 99.8 to 100.0); duration median 4.82 s
5 straight rows end before 50 cm. Over the others, integral of v_for / forward distance: median 1.001 (5th to 95th percentile 0.998 to 1.005) session 503: 3648261 samples; timestamp step 0.0020 s (500 Hz, SI: 500 Hz); steps that go back in time: 557 d_for: -11.84 to 100.05, median 21.65, NaN 0.0000
d_lat: -13.61 to 16.15, median 0.00, NaN 0.0000 v_for: -12.13 to 31.39, median 2.55, NaN 0.0001 v_lat: -10.48 to 13.32, median 0.00, NaN 0.0001 straight rows: forward distance at the end median 99.9 cm (5th to 95th percentile -0.0 to 100.0); duration median 10.00 s 169 straight rows end before 50 cm. Over the others, integral of v_for / forward distance: median 1.000 (5th to 95th percentile 0.996 to 1.005)
The ball tracking is sampled at 500 Hz, as the SI states. Forward distance restarts at each trial and the straight
rows end at 100 cm (the "100cm" of their labels), so distances are in cm. Over the straight rows that reach 50 cm,
the integral of speed_for_smooth over the row equals its forward distance (median ratio 1.00), so speeds are in
cm/s on the same clock. In 503, 169 straight rows end before 50 cm (5 in 489), and its straight rows last a median
10.00 s against 4.82 s in 489. Lateral distance also restarts at 0 at each trial.
Do the behavioural samples share the clock of the trials table? Below, the trial type (OL_L against OL_R) is decoded from lateral position at single times around the stored turn starts, and from all samples after the start with the true labels and with labels shifted by one OL trial.
rng = np.random.default_rng(1)
for s, d in S.items():
tr, beh, seg = d["trials"], d["beh"], d["seg"]
ol = tr[tr.intact & tr.label.str.startswith("OL")]
y = (ol.label == "OL_L").values.astype(int)
rows = list(ol.index)
grid = np.arange(-0.5, 1.0001, 0.1)
X = np.array([[bv._on_grid(beh, seg[r], "d_lat", np.array([t]))[0] if t >= 0 else
bv._on_grid(beh, seg[r - 1], "d_lat", np.array([t + beh.t_local.values[seg[r - 1]][-1]]))[0]
for t in grid] for r in rows])
X = np.nan_to_num(X)
acc = {f"{t:+.1f}": bv.decode_accuracy(X[:, [k]], y, rng) for k, t in enumerate(grid)}
shifted = bv.decode_accuracy(X[:, grid > 0], np.roll(y, 1), rng)
true = bv.decode_accuracy(X[:, grid > 0], y, rng)
print(f"session {s}: OL_L against OL_R from lateral position (cm) in single 0.1 s samples, accuracy by time from the turn start:")
print(" ", {k: round(v, 2) for k, v in acc.items()})
print(f" from all samples after the start: true labels {true:.3f}; labels shifted by one OL trial {shifted:.3f};"
f" chance {max(y.mean(), 1 - y.mean()):.3f}")
session 489: OL_L against OL_R from lateral position (cm) in single 0.1 s samples, accuracy by time from the turn start:
{'-0.5': np.float64(0.51), '-0.4': np.float64(0.52), '-0.3': np.float64(0.47), '-0.2': np.float64(0.51), '-0.1': np.float64(0.53), '-0.0': np.float64(0.53), '+0.1': np.float64(0.52), '+0.2': np.float64(0.42), '+0.3': np.float64(0.59), '+0.4': np.float64(0.81), '+0.5': np.float64(0.93), '+0.6': np.float64(0.96), '+0.7': np.float64(0.97), '+0.8': np.float64(0.97), '+0.9': np.float64(0.98), '+1.0': np.float64(0.98)}
from all samples after the start: true labels 0.954; labels shifted by one OL trial 0.474; chance 0.502
session 503: OL_L against OL_R from lateral position (cm) in single 0.1 s samples, accuracy by time from the turn start:
{'-0.5': np.float64(0.56), '-0.4': np.float64(0.52), '-0.3': np.float64(0.54), '-0.2': np.float64(0.5), '-0.1': np.float64(0.52), '-0.0': np.float64(0.49), '+0.1': np.float64(0.48), '+0.2': np.float64(0.44), '+0.3': np.float64(0.63), '+0.4': np.float64(0.77), '+0.5': np.float64(0.88), '+0.6': np.float64(0.91), '+0.7': np.float64(0.91), '+0.8': np.float64(0.92), '+0.9': np.float64(0.93), '+1.0': np.float64(0.93)}
from all samples after the start: true labels 0.920; labels shifted by one OL trial 0.517; chance 0.552
The trial type cannot be decoded before or at the stored start (accuracy 0.42 to 0.56 from -0.5 to 0.2 s) and becomes decodable from 0.3 to 0.4 s on (0.93 and 0.98 at 1 s); with the labels shifted by one trial accuracy falls to chance. Lateral position therefore shares the clock of the trials table, and OL_L trials turn to the positive (left) side, as the labels say.
Next, the units table.
for s, d in S.items():
u = d["units"]
fs = u.duration < bv.FS_DURATION_MS
print(f"session {s}: {len(u)} units; layers {u.layer.value_counts().reindex(['23', '4', '5A', '5B', '6', 'WM']).fillna(0).astype(int).to_dict()}")
print(f" unit_type {u.unit_type.value_counts().to_dict()}; FS by duration < 0.4 ms: {fs.sum()}, RS: {(~fs).sum()};"
f" unit_type Inhibitory and FS agree for {np.mean((u.unit_type == 'Inhibitory') == fs):.3f} of units")
print(f" duration range {u.duration.min():.2f} to {u.duration.max():.2f} ms; depth {u.depth.min()} to {u.depth.max()} um;"
f" firing rate {u.firing_rate.min():.2f} to {u.firing_rate.max():.2f} Hz (mean {u.firing_rate.mean():.2f})")
print(f" quality (SI thresholds): amplitude cutoff <= 0.1 for {np.mean(u.amplitude_cutoff <= 0.1):.2f}, "
f"ISI violations <= 0.5 for {np.mean(u.isi_viol <= 0.5):.2f}, presence ratio >= 0.9 for {np.mean(u.presence_ratio >= 0.9):.2f}")
sp = d["spikes"]
print(f" spikes {len(sp)}, {sp.min():.2f} to {sp.max():.2f} s; trials table {d['trials'].start_time.min():.2f} to "
f"{d['trials'].stop_time.max():.2f} s; behaviour samples to {np.nanmax(d['samples'].t_last):.2f} s")
u = S["489"]["units"]
print("\nUnit 101 of 489 (489101 in Fig. 4F and S10, 'RS, layer 5A'; Fig. S5E 'RS, layer 5B'):")
print(u[u.id == 101][["id", "layer", "unit_type", "duration", "depth", "firing_rate"]].to_string(index=False))
print("highest-rate unit of 489:", u.loc[u.firing_rate.idxmax(), ["id", "layer", "unit_type", "firing_rate"]].to_dict())
session 489: 61 units; layers {'23': 7, '4': 13, '5A': 13, '5B': 16, '6': 12, 'WM': 0}
unit_type {'Excitatory': 31, 'Inhibitory': 30}; FS by duration < 0.4 ms: 30, RS: 31; unit_type Inhibitory and FS agree for 1.000 of units
duration range 0.05 to 0.99 ms; depth 184 to 944 um; firing rate 0.10 to 37.57 Hz (mean 5.91)
quality (SI thresholds): amplitude cutoff <= 0.1 for 1.00, ISI violations <= 0.5 for 1.00, presence ratio >= 0.9 for 1.00
spikes 2704962, 0.01 to 6255.31 s; trials table 0.00 to 3683.41 s; behaviour samples to 6217.72 s
session 503: 43 units; layers {'23': 0, '4': 6, '5A': 11, '5B': 12, '6': 11, 'WM': 3}
unit_type {'Inhibitory': 23, 'Excitatory': 20}; FS by duration < 0.4 ms: 22, RS: 21; unit_type Inhibitory and FS agree for 0.977 of units
duration range 0.10 to 1.00 ms; depth -20 to 820 um; firing rate 0.20 to 30.79 Hz (mean 7.38)
quality (SI thresholds): amplitude cutoff <= 0.1 for 1.00, ISI violations <= 0.5 for 1.00, presence ratio >= 0.9 for 1.00
spikes 2788926, 0.01 to 7326.18 s; trials table 0.00 to 7296.52 s; behaviour samples to 7296.52 s
Unit 101 of 489 (489101 in Fig. 4F and S10, 'RS, layer 5A'; Fig. S5E 'RS, layer 5B'):
id layer unit_type duration depth firing_rate
101 5A Inhibitory 0.2 524 37.572793
highest-rate unit of 489: {'id': 101, 'layer': '5A', 'unit_type': 'Inhibitory', 'firing_rate': 37.57279312}
All units pass the SI's quality thresholds. unit_type (Excitatory, Inhibitory) is the 0.4 ms waveform duration
rule of the SI: Inhibitory equals duration below 0.4 ms for 61 of 61 units of 489 and 42 of 43 of 503. 489 has 61
units (Table S1: 65), with 7 in L2/3 and 12 in L6 where Fig. 5B gives 10 and 13, and 30 FS and 31 RS where Fig. 5B
gives 43 and 22. 503 has 43 units (Table S1: 48), three of them labelled WM, a layer the paper does not use. Unit 101
of 489, the paper's 489101, is labelled Inhibitory, L5A, waveform duration 0.2 ms (FS by the SI's rule), while the
paper calls it RS; it is the session's highest-rate unit (37.6 Hz), as the paper says of 489101. The spikes of 489
run to 6255 s, past the end of its trials table (3683 s) and its behaviour (6218 s); those of 503 run to 7326 s,
past the end of its behaviour (7297 s).
The spikes have to share the trial clock for any neural claim. The paper describes, for 489, a sharp peak at 0.026 s, a suppression to about a third of the baseline rate and a ramp in OL_L trials only, in all units. Below, the population rate around the stored onsets, and the decoding of trial type from per-unit spike counts.
edges = np.arange(-1.0, 2.0001, 0.005)
centres = edges[:-1] + 0.0025
psth = {}
fig, axes = plt.subplots(1, 2, figsize=(11, 3.2), sharey=True)
for ax, (s, d) in zip(axes, S.items()):
tr, sp, nu = d["trials"], d["spikes"], len(d["units"])
for lab, col in [("OL_L", "tab:red"), ("OL_R", "tab:blue")]:
on = tr.start_time.values[(tr.intact & (tr.label == lab)).values]
r = bv.population_psth(sp, nu, on, edges)
psth[(s, lab)] = r
ax.plot(centres, r, color=col, lw=0.7, label=f"{lab} ({len(on)})")
e1 = r[(centres > -1) & (centres < 0)]
print(f"{s} {lab} at the stored onsets: epoch 1 (-1 to 0 s) {e1.mean():.2f} Hz (SD over 5 ms bins {e1.std():.2f});"
f" max 0 to 0.065 s {r[(centres > 0) & (centres < 0.065)].max():.2f}; min 0.065 to 0.14 s "
f"{r[(centres > 0.065) & (centres < 0.14)].min():.2f}; max 0.12 to 0.3 s {r[(centres > 0.12) & (centres < 0.3)].max():.2f};"
f" range over -1 to 2 s {r.min():.2f} to {r.max():.2f}")
ax.axvline(0, color="k", lw=0.5)
ax.set_title(f"{s}: population rate at the stored OL onsets")
ax.set_xlabel("time from stored onset (s)")
ax.legend(fontsize=8)
axes[0].set_ylabel("Hz per unit (5 ms bins)")
plt.tight_layout()
plt.show()
489 OL_L at the stored onsets: epoch 1 (-1 to 0 s) 7.48 Hz (SD over 5 ms bins 0.43); max 0 to 0.065 s 8.15; min 0.065 to 0.14 s 6.43; max 0.12 to 0.3 s 8.01; range over -1 to 2 s 6.08 to 8.69 489 OL_R at the stored onsets: epoch 1 (-1 to 0 s) 7.15 Hz (SD over 5 ms bins 0.41); max 0 to 0.065 s 7.64; min 0.065 to 0.14 s 6.57; max 0.12 to 0.3 s 7.46; range over -1 to 2 s 5.83 to 8.32 503 OL_L at the stored onsets: epoch 1 (-1 to 0 s) 8.80 Hz (SD over 5 ms bins 0.50); max 0 to 0.065 s 9.63; min 0.065 to 0.14 s 8.49; max 0.12 to 0.3 s 9.52; range over -1 to 2 s 7.46 to 10.43 503 OL_R at the stored onsets: epoch 1 (-1 to 0 s) 8.95 Hz (SD over 5 ms bins 0.43); max 0 to 0.065 s 9.47; min 0.065 to 0.14 s 8.45; max 0.12 to 0.3 s 10.78; range over -1 to 2 s 7.72 to 10.78
rng = np.random.default_rng(2)
for s, d in S.items():
tr, sp, u = d["trials"], d["spikes"], d["units"]
f = d["file"]
idx = f["units/spike_times_index"][:]
st = f["units/spike_times"][:]
per_unit = np.split(st, idx[:-1])
ol = tr[tr.intact & tr.label.str.startswith("OL")]
y = (ol.label == "OL_L").values.astype(int)
res = {}
for name, (a, b) in {"-0.5 to 0 s": (-0.5, 0), "0 to 0.5 s": (0, 0.5), "0.5 to 1.8 s": (0.5, 1.8)}.items():
X = np.array([[np.searchsorted(x, t0 + b) - np.searchsorted(x, t0 + a) for x in per_unit] for t0 in ol.start_time.values], float)
acc = bv.decode_accuracy(X, y, rng)
null = [bv.decode_accuracy(X, rng.permutation(y), rng) for _ in range(20)]
res[name] = f"{acc:.3f} (shuffled labels {np.mean(null):.3f}, 95th percentile {np.percentile(null, 95):.3f})"
print(f"session {s}: OL_L against OL_R from per-unit spike counts at the stored onsets: {res}")
session 489: OL_L against OL_R from per-unit spike counts at the stored onsets: {'-0.5 to 0 s': '0.460 (shuffled labels 0.504, 95th percentile 0.535)', '0 to 0.5 s': '0.510 (shuffled labels 0.494, 95th percentile 0.542)', '0.5 to 1.8 s': '0.522 (shuffled labels 0.506, 95th percentile 0.535)'}
session 503: OL_L against OL_R from per-unit spike counts at the stored onsets: {'-0.5 to 0 s': '0.509 (shuffled labels 0.493, 95th percentile 0.521)', '0 to 0.5 s': '0.460 (shuffled labels 0.506, 95th percentile 0.542)', '0.5 to 1.8 s': '0.466 (shuffled labels 0.495, 95th percentile 0.540)'}
At the stored onsets there is no trial-locked response. The population rate stays within 5.8 to 10.8 Hz over -1 to 2 s, with a baseline SD of 0.41 to 0.50 Hz over 5 ms bins. The lowest bin of the suppression window (0.065 to 0.14 s) is 6.43 to 8.49 Hz, at least 86% of the baseline (489 OL_L: 6.43 against 7.48 Hz), where the paper has the rate of 489 fall from 2 to 0.7 Hz. In 489 the largest bin of the ramp window is below the largest bin elsewhere in -1 to 2 s (OL_L 8.01 against 8.69 Hz, OL_R 7.46 against 8.32 Hz). In 503 OL_R the ramp-window maximum (10.78 Hz) is the maximum of the whole range, 1.83 Hz above the baseline. Trial type cannot be decoded from the units' spike counts in any window (0.460 to 0.522, against shuffled-label 95th percentiles of 0.521 to 0.542), although the animal's lateral position decodes it at 0.920 to 0.954.
The spikes may be offset from the trial clock. The tables below search for the offset two ways: the lag of the largest onset-triggered deviation of the population rate, per window of about 40 onsets, with a null from onsets drawn at random, and the lag of the largest correlation between the population rate and running speed, per 400 s window. Neither uses the shape of the paper's response. In 503, a straight-line clock fitted to the speed lags is then used as a coarse check.
lags = np.arange(-20, 60, 0.005)
rows = []
for s, d in S.items():
tr, sp = d["trials"], d["spikes"]
on = tr.start_time.values[(tr.intact & tr.label.str.startswith("OL")).values]
for k, chunk in enumerate(np.array_split(on, len(on) // 40)):
c = bv.lag_scan(sp, chunk, lags)
lag, val, z = bv.best_lag(lags, c)
rows.append(dict(session=s, window=k, t_from=chunk[0], t_to=chunk[-1], n_onsets=len(chunk),
best_lag=lag, value_Hz=val, z=z))
lag_tab = pd.DataFrame(rows)
print("Lag (s) of the largest onset-triggered deviation of the summed population rate (50 ms smoothing), per window of about"
" 40 OL onsets, searched over -20 to 60 s:")
print(lag_tab.round(3).to_string(index=False))
rng = np.random.default_rng(3)
null_z = {}
for s, d in S.items():
tr, sp = d["trials"], d["spikes"]
on = tr.start_time.values[(tr.intact & tr.label.str.startswith("OL")).values]
null_z[s] = np.array([bv.best_lag(lags, bv.lag_scan(sp, np.sort(rng.uniform(on.min(), on.max(), 40)), lags))[2]
for _ in range(40)])
obs = lag_tab[lag_tab.session == s].z
print(f"session {s}: null of the best-lag z, 40 sets of 40 onsets drawn uniformly over the OL period: median "
f"{np.median(null_z[s]):.2f}, 95th percentile {np.percentile(null_z[s], 95):.2f}, max {null_z[s].max():.2f};"
f" observed windows above the 95th percentile: {np.sum(obs > np.percentile(null_z[s], 95))} of {len(obs)}"
f" (observed z {obs.min():.2f} to {obs.max():.2f})")
Lag (s) of the largest onset-triggered deviation of the summed population rate (50 ms smoothing), per window of about 40 OL onsets, searched over -20 to 60 s:
session window t_from t_to n_onsets best_lag value_Hz z
489 0 6.298 337.612 42 4.360 -189.070 4.556
489 1 344.196 680.090 42 6.805 189.263 3.955
489 2 688.690 1014.792 42 7.495 224.263 4.976
489 3 1021.084 1324.344 42 7.365 -192.879 3.590
489 4 1330.778 1615.036 42 9.565 212.359 4.310
489 5 1629.812 1910.162 42 10.925 213.073 4.118
489 6 1915.950 2193.444 42 12.225 163.311 3.101
489 7 2199.434 2557.018 42 17.040 146.644 3.693
489 8 2563.254 2842.486 41 15.040 195.042 4.169
489 9 2848.968 3122.550 41 10.560 213.090 4.803
489 10 3128.680 3414.790 41 43.305 185.529 3.905
489 11 3422.222 3681.414 41 26.020 188.700 4.484
503 0 10.004 669.684 43 5.580 -240.565 8.236
503 1 681.690 1333.610 43 11.785 -193.821 9.850
503 2 1345.608 2062.680 43 14.150 -130.333 5.294
503 3 2085.904 2848.722 43 12.070 -94.751 3.568
503 4 2860.714 3577.912 43 52.540 142.923 5.809
503 5 3590.816 4244.458 43 19.920 150.133 5.931
503 6 4255.972 4918.118 43 21.915 145.481 5.281
503 7 4936.392 5463.386 43 23.030 169.667 5.036
503 8 5473.450 5930.112 43 7.540 166.877 5.373
503 9 5944.088 6360.646 42 30.730 192.923 6.301
503 10 6378.102 6875.456 42 12.570 152.209 5.458
503 11 6888.492 7292.502 42 33.115 164.114 5.063
session 489: null of the best-lag z, 40 sets of 40 onsets drawn uniformly over the OL period: median 4.06, 95th percentile 4.78, max 5.75; observed windows above the 95th percentile: 2 of 12 (observed z 3.10 to 4.98)
session 503: null of the best-lag z, 40 sets of 40 onsets drawn uniformly over the OL period: median 3.84, 95th percentile 5.04, max 5.75; observed windows above the 95th percentile: 10 of 12 (observed z 3.57 to 9.85)
lags_v = np.arange(0, 40, 0.05)
rows = []
for s, d in S.items():
tr, beh, seg, sp = d["trials"], d["beh"], d["seg"], d["spikes"]
t_beh = bv.behaviour_time(beh, tr, seg)
speed = np.hypot(beh.v_for.values, beh.v_lat.values)
t_end = np.nanmax(t_beh)
for t0 in np.arange(0, t_end - 400, 400):
r = bv.speed_lag_scan(sp, t_beh, speed, t0, t0 + 400, lags_v)
k = np.argmax(np.abs(r))
rows.append(dict(session=s, window_from=t0, t_mid=t0 + 200, best_lag=lags_v[k], r=r[k], r_at_0=r[0], median_abs_r=np.median(np.abs(r))))
speed_tab = pd.DataFrame(rows)
print("Lag (s) of the largest correlation between population spike count and running speed, per 400 s window of the trial clock:")
print(speed_tab.round(3).to_string(index=False))
fig, ax = plt.subplots(figsize=(7, 3.2))
for s, mk in [("489", "o"), ("503", "s")]:
a = lag_tab[lag_tab.session == s]
b = speed_tab[speed_tab.session == s]
ax.plot((a.t_from + a.t_to) / 2, a.best_lag, mk + "-", label=f"{s}, OL onsets")
ax.plot(b.window_from + 200, b.best_lag, mk + "--", label=f"{s}, running speed")
ax.set_xlabel("time on the trial clock (s)")
ax.set_ylabel("best lag of spikes (s)")
ax.legend(fontsize=8)
plt.tight_layout()
plt.show()
print(f"plotted lags range {min(lag_tab.best_lag.min(), speed_tab.best_lag.min()):.2f} to "
f"{max(lag_tab.best_lag.max(), speed_tab.best_lag.max()):.2f} s; all points within the axes")
Lag (s) of the largest correlation between population spike count and running speed, per 400 s window of the trial clock:
session window_from t_mid best_lag r r_at_0 median_abs_r
489 0.0 200.0 5.50 0.109 0.034 0.041
489 400.0 600.0 5.85 0.174 0.125 0.028
489 800.0 1000.0 1.00 0.167 0.111 0.025
489 1200.0 1400.0 12.90 -0.085 -0.006 0.027
489 1600.0 1800.0 14.40 -0.074 -0.029 0.028
489 2000.0 2200.0 10.95 -0.066 -0.050 0.017
489 2400.0 2600.0 6.35 -0.112 -0.087 0.031
489 2800.0 3000.0 18.25 -0.103 -0.061 0.036
489 3200.0 3400.0 19.20 -0.111 -0.044 0.030
503 0.0 200.0 12.90 0.477 0.155 0.135
503 400.0 600.0 12.70 0.531 0.192 0.210
503 800.0 1000.0 13.70 0.545 0.216 0.301
503 1200.0 1400.0 13.75 0.596 0.460 0.473
503 1600.0 1800.0 13.95 0.617 0.286 0.269
503 2000.0 2200.0 14.45 0.432 0.070 0.082
503 2400.0 2600.0 15.15 0.592 0.148 0.178
503 2800.0 3000.0 15.30 0.457 0.269 0.232
503 3200.0 3400.0 15.80 0.383 0.046 0.119
503 3600.0 3800.0 16.95 0.329 0.039 0.072
503 4000.0 4200.0 17.45 0.292 0.019 0.091
503 4400.0 4600.0 18.55 0.481 0.111 0.098
503 4800.0 5000.0 19.75 0.475 0.084 0.151
503 5200.0 5400.0 9.55 0.107 0.012 0.029
503 5600.0 5800.0 1.90 -0.111 -0.065 0.045
503 6000.0 6200.0 25.90 0.121 -0.077 0.033
503 6400.0 6600.0 26.85 0.144 0.074 0.060
503 6800.0 7000.0 28.85 0.112 -0.027 0.041
plotted lags range 1.00 to 52.54 s; all points within the axes
fig, axes = plt.subplots(1, 2, figsize=(11, 3.2), sharey=True)
edges25 = np.arange(-1.0, 2.0001, 0.025)
c25 = edges25[:-1] + 0.0125
for ax, (s, d) in zip(axes, S.items()):
tr, sp, nu = d["trials"], d["spikes"], len(d["units"])
first = lag_tab[(lag_tab.session == s) & (lag_tab.window == 0)].iloc[0]
for lab, col in [("OL_L", "tab:red"), ("OL_R", "tab:blue")]:
on = tr.start_time.values[(tr.intact & (tr.label == lab)).values]
on = on[on <= first.t_to]
r = bv.population_psth(sp, nu, on + first.best_lag, edges25)
ax.plot(c25, r, color=col, label=f"{lab} ({len(on)})")
print(f"{s} {lab}, onsets of window 0 shifted by {first.best_lag:.3f} s: rate {r.min():.2f} to {r.max():.2f} Hz;"
f" -1 to 0 s mean {r[c25 < 0].mean():.2f}, 0 to 0.3 s mean {r[(c25 > 0) & (c25 < 0.3)].mean():.2f},"
f" 0.3 to 1.8 s mean {r[(c25 > 0.3) & (c25 < 1.8)].mean():.2f}")
ax.set_title(f"{s}: window 0 onsets + {first.best_lag:.2f} s")
ax.set_xlabel("time from shifted onset (s)")
ax.legend(fontsize=8)
axes[0].set_ylabel("Hz per unit (25 ms bins)")
plt.tight_layout()
plt.show()
489 OL_L, onsets of window 0 shifted by 4.360 s: rate 2.16 to 11.49 Hz; -1 to 0 s mean 7.97, 0 to 0.3 s mean 5.89, 0.3 to 1.8 s mean 5.25 489 OL_R, onsets of window 0 shifted by 4.360 s: rate 2.36 to 13.77 Hz; -1 to 0 s mean 3.77, 0 to 0.3 s mean 2.98, 0.3 to 1.8 s mean 6.24 503 OL_L, onsets of window 0 shifted by 5.580 s: rate 2.58 to 6.13 Hz; -1 to 0 s mean 4.18, 0 to 0.3 s mean 3.93, 0.3 to 1.8 s mean 4.30 503 OL_R, onsets of window 0 shifted by 5.580 s: rate 2.30 to 5.27 Hz; -1 to 0 s mean 3.43, 0 to 0.3 s mean 3.31, 0.3 to 1.8 s mean 3.55
# A clock fitted from running speed only (503), as a coarse check: does it give trial-locked structure?
rng = np.random.default_rng(4)
d = S["503"]
tr, sp, nu = d["trials"], d["spikes"], len(d["units"])
sp_tab = speed_tab[speed_tab.session == "503"]
slope, icpt, resid_sd, span = bv.speed_clock(sp_tab, 0.25)
print(f"503 speed clock from the {np.sum(sp_tab.r >= 0.25)} of {len(sp_tab)} windows with r >= 0.25 (trial clock {span[0]:.0f} to"
f" {span[1]:.0f} s): lag = {icpt:.2f} s + {slope * 1000:.2f} ms per s; residual SD {resid_sd:.2f} s")
ol = tr[tr.intact & tr.label.str.startswith("OL")]
ol = ol[(ol.start_time >= span[0]) & (ol.start_time <= span[1])]
y = (ol.label == "OL_L").values.astype(int)
on = ol.start_time.values + icpt + slope * ol.start_time.values
lt = lag_tab[(lag_tab.session == "503") & (lag_tab.t_to <= span[1])]
print("503 onset-triggered best lags in the span against the speed clock at the window centre (s):",
[(round(b, 2), round(icpt + slope * (a + c) / 2, 2)) for a, b, c in zip(lt.t_from, lt.best_lag, lt.t_to)])
print(f"OL trials within the span: {len(ol)} ({y.sum()} OL_L, {len(y) - y.sum()} OL_R)")
edges25 = np.arange(-1.0, 2.0001, 0.025)
c25 = edges25[:-1] + 0.0125
win = {"0 to 0.3 s": (0, 0.3), "0.3 to 1.8 s": (0.3, 1.8)}
def change(onsets):
r = bv.population_psth(sp, nu, onsets, edges25)
return r, {k: r[(c25 > a) & (c25 < b)].mean() - r[c25 < 0].mean() for k, (a, b) in win.items()}
null = pd.DataFrame([change(np.sort(rng.uniform(on.min(), on.max(), len(on))))[1] for _ in range(200)])
fig, ax = plt.subplots(figsize=(6, 3.2))
for lab, col in [("OL_L", "tab:red"), ("OL_R", "tab:blue"), ("both", "k")]:
m = np.ones(len(y), bool) if lab == "both" else (ol.label == lab).values
r, ch = change(on[m])
ax.plot(c25, r, color=col, label=f"{lab} ({m.sum()})")
print(f"{lab}: rate {r.min():.2f} to {r.max():.2f} Hz per unit; -1 to 0 s {r[c25 < 0].mean():.2f}; change from it "
+ ", ".join(f"{k} {v:+.2f}" for k, v in ch.items()))
print("null of the change (200 sets of uniformly drawn onsets, all trials), 2.5th to 97.5th percentile: "
+ ", ".join(f"{k} {null[k].quantile(0.025):+.2f} to {null[k].quantile(0.975):+.2f}" for k in win))
ax.set_xlabel("time from onset on the speed clock (s)")
ax.set_ylabel("Hz per unit (25 ms bins)")
ax.legend(fontsize=8)
plt.tight_layout()
plt.show()
idx = d["file"]["units/spike_times_index"][:]
per_unit = np.split(d["file"]["units/spike_times"][:], idx[:-1])
for name, (a, b) in {"-0.5 to 0 s": (-0.5, 0), "0 to 0.5 s": (0, 0.5), "0.5 to 1.8 s": (0.5, 1.8)}.items():
X = np.array([[np.searchsorted(x, t0 + b) - np.searchsorted(x, t0 + a) for x in per_unit] for t0 in on], float)
acc = bv.decode_accuracy(X, y, rng)
nl = [bv.decode_accuracy(X, rng.permutation(y), rng) for _ in range(20)]
print(f"decoding OL_L against OL_R from per-unit counts, {name} on the speed clock: {acc:.3f} (shuffled labels mean"
f" {np.mean(nl):.3f}, 95th percentile {np.percentile(nl, 95):.3f})")
503 speed clock from the 13 of 18 windows with r >= 0.25 (trial clock 0 to 5200 s): lag = 11.86 s + 1.37 ms per s; residual SD 0.56 s
503 onset-triggered best lags in the span against the speed clock at the window centre (s): [(5.58, np.float64(12.33)), (11.78, np.float64(13.24)), (14.15, np.float64(14.19)), (12.07, np.float64(15.23)), (52.54, np.float64(16.26)), (19.92, np.float64(17.22)), (21.91, np.float64(18.13))] OL trials within the span: 319 (138 OL_L, 181 OL_R)
OL_L: rate 7.02 to 10.02 Hz per unit; -1 to 0 s 8.09; change from it 0 to 0.3 s +1.38, 0.3 to 1.8 s +0.14 OL_R: rate 5.14 to 8.87 Hz per unit; -1 to 0 s 7.60; change from it 0 to 0.3 s -0.82, 0.3 to 1.8 s -1.89 both: rate 6.26 to 8.82 Hz per unit; -1 to 0 s 7.81; change from it 0 to 0.3 s +0.13, 0.3 to 1.8 s -1.01 null of the change (200 sets of uniformly drawn onsets, all trials), 2.5th to 97.5th percentile: 0 to 0.3 s -0.22 to +0.25, 0.3 to 1.8 s -0.25 to +0.26
decoding OL_L against OL_R from per-unit counts, -0.5 to 0 s on the speed clock: 0.655 (shuffled labels mean 0.497, 95th percentile 0.555)
decoding OL_L against OL_R from per-unit counts, 0 to 0.5 s on the speed clock: 0.865 (shuffled labels mean 0.501, 95th percentile 0.552) decoding OL_L against OL_R from per-unit counts, 0.5 to 1.8 s on the speed clock: 0.912 (shuffled labels mean 0.481, 95th percentile 0.535)
The spikes cannot be placed on the trial clock at the precision the claims need. In 489 only 2 of the 12 windows of
the onset-triggered search exceed the 95th percentile of the null (4.78). Their best lags are not random, though:
in windows 0 to 6 they rise almost steadily (4.36, 6.81, 7.50, 7.37, 9.57, 10.93, 12.23 s), and the first two speed
windows agree (5.50 and 5.85 s), which suggests a drifting offset like that of 503. Windows 7 to 11 depart from
that trend (17.04, 15.04, 10.56, 43.31, 26.02 s). The speed correlations of 489 are weak (|r| at most 0.17) and change
sign after 1200 s, so they do not give a clock, and no window's z separates its lag from chance; any clock drawn
from these lags would be no finer than that of 503. In 503 the lag is found. The onset-triggered search exceeds the null's 95th percentile
(5.04) in 10 of 12 windows, and the speed correlation gives a lag that grows smoothly from 12.9 to 19.75 s over
0 to 5200 s (r 0.29 to 0.62). A straight line through those 13 windows (11.86 s plus 1.37 ms per s) leaves a
residual SD of 0.56 s. The onset-triggered lags of the seven windows in its span agree with it only loosely:
windows 1 and 2 (11.78 and 14.15 s) lie within 1.5 s of it (13.24 and 14.19 s), window 3 (12.07 against 15.23 s) is
3.2 s off, about 6 residual SDs, and windows 0 and 4 to 6 (5.58, 52.54, 19.92, 21.91 s against 12.33, 16.26, 17.22,
18.13 s) are 2.7 to 36.3 s off. On this speed clock the 319 OL trials of 503 in its span show direction-specific responses beyond the
null of random onsets (-0.22 to +0.25 Hz in 0 to 0.3 s, -0.25 to +0.26 Hz in 0.3 to 1.8 s): OL_L rises by 1.38 Hz in
0 to 0.3 s, and OL_R falls by 0.82 and 1.89 Hz. Trial type decodes from per-unit counts at 0.865 (0 to 0.5 s) and
0.912 (0.5 to 1.8 s) against shuffled 95th percentiles of 0.552 and 0.535, but also at 0.655 before the onset, which
may come from the clock error mixing post-onset spikes into the baseline. The clock was fitted to running speed, and
running differs by trial type in 503 (1.7% of OL_L rows against 31.8% of OL_R rows run, in the figs1-running-speed
section), so these responses and the decoding, before and after the onset, may in part reflect running and not a
neural response to the turn. So the spike times of 503 are about 12 s later than
the trial times of the same events, and the gap grows by about 1.4 ms per s, but it is known only to about half a
second. The speed lag
also contains the unknown delay between spiking and running. The claims test windows and tolerances of 5 to 180 ms (the 0.026 s
peak, the 0.065 to 0.14 s suppression, the 0.12 s ramp onset), so none can be tested on it, and 489, the animal of
most claims, has no clock at all. The files hold no synchronisation signal and do not say how spike times relate to
the trial times. An alignment fitted to the neural response would set the very timings the claims test, so none is
adopted, and every claim that needs spikes at these timings is blocked as metadata_insufficient. The epoch 1 rate
of fig1n-epoch-rates is an average over a long window and is tested at every lag below. The behaviour is on the
trial clock and its claims are tested.
The behaviour claims use the intact rows: 489 rows 0 to 999 (249 OL_L, 251 OL_R) and all 1027 rows of 503 (230 OL_L, 283 OL_R).
table-s1-recordings¶
The recordings comprise 13 ephys sessions and 6 behaviour-only sessions, one per animal, with the numbers of accepted single units and of trials per animal listed in Table S1, and with the units and OL turn trials of the example sessions given in Fig. 1J-K and Fig. S4.
Criterion: unit counts and the OL_L plus OL_R counts must match exactly, and at least 17 of 19 total trial counts within 10%; partially reproduced when unit counts match for at least 10 of 13 ephys animals. The paper's numbers below are the claims file's.
# Table S1 and the legends of Fig. 1J-K and Fig. S4, as the claims file gives them
paper_units = {"453": 56, "454": 40, "456": 39, "480": 42, "482": 38, "488": 29, "489": 65, "503": 48, "516": 33,
"517": 42, "528": 89, "530": 113, "579": 34}
paper_trials = {"453": 2563, "454": 2581, "456": 2262, "474": 131, "475": 55, "480": 758, "482": 1518, "488": 939,
"489": 1000, "499": 1123, "503": 1027, "516": 1071, "517": 1287, "518": 1291, "528": 525, "530": 1654,
"573": 401, "579": 55, "589": 50}
paper_ol = {"489": (266, 265), "503": (305, 304), "528": (95, 95), "530": (402, 403), "482": (350, 350),
"480": (185, 190), "517": (270, 268)}
rows = []
for a in paper_trials:
d = S.get(a)
row = dict(animal=a, in_dataset=d is not None, units_paper=paper_units.get(a), trials_paper=paper_trials[a],
OL_L_paper=paper_ol.get(a, (None, None))[0], OL_R_paper=paper_ol.get(a, (None, None))[1])
if d is not None:
tr = d["trials"]
row.update(units=len(d["units"]), trials_rows=len(tr), trials_intact=int(tr.intact.sum()),
OL_L_rows=int((tr.label == "OL_L").sum()), OL_R_rows=int((tr.label == "OL_R").sum()),
OL_L_intact=int((tr.intact & (tr.label == "OL_L")).sum()), OL_R_intact=int((tr.intact & (tr.label == "OL_R")).sum()))
if a == "489":
samp = d["samples"]
bad = tr.index[~tr.intact]
row["OL_rows_block2_by_duration"] = int((samp.loc[bad].t_local_end < 2.2).sum())
rows.append(row)
t1 = pd.DataFrame(rows)
print(t1.to_string(index=False))
present = t1[t1.in_dataset]
print(f"\nanimals in the dataset: {len(present)} of {len(t1)} (ephys {len(present)} of {len(paper_units)})")
for _, r in present.iterrows():
print(f"{r.animal}: units {r.units} vs {r.units_paper} (match {r.units == r.units_paper}); trials {r.trials_rows} rows,"
f" {r.trials_intact} intact, vs {r.trials_paper} (within 10%: rows {abs(r.trials_rows - r.trials_paper) <= 0.1 * r.trials_paper},"
f" intact {abs(r.trials_intact - r.trials_paper) <= 0.1 * r.trials_paper}); OL_L + OL_R intact "
f"{r.OL_L_intact} + {r.OL_R_intact} = {r.OL_L_intact + r.OL_R_intact} vs {r.OL_L_paper} + {r.OL_R_paper} = "
f"{r.OL_L_paper + r.OL_R_paper}")
u = S["489"]["units"]
fs = u.duration < bv.FS_DURATION_MS
print("\n489 units per layer against Fig. 5B (L2/3 10, L4 13, L5A 13, L5B 16, L6 13; FS 43, RS 22):",
u.layer.value_counts().reindex(["23", "4", "5A", "5B", "6"]).to_dict(), f"FS {fs.sum()}, RS {(~fs).sum()};"
f" unit_type Inhibitory {np.sum(u.unit_type == 'Inhibitory')}, Excitatory {np.sum(u.unit_type == 'Excitatory')}")
d = S["489"]
tr, samp, beh, seg = d["trials"], d["samples"], d["beh"], d["seg"]
bad = tr.index[~tr.intact]
turns = list(bad[(samp.loc[bad].t_local_end < 2.2).values])
x1b = bv.lateral_at(beh, seg, turns, 1.0)
n_l = int((tr.intact & (tr.label == "OL_L")).sum()) + int(np.sum(x1b > 0))
n_r = int((tr.intact & (tr.label == "OL_R")).sum()) + int(np.sum(x1b < 0))
print(f"\n489 with all {len(tr)} rows (assumption checked: the 611 repeated rows counted as trials): {len(tr)} trials against 1000"
f" (within 10%: {abs(len(tr) - 1000) <= 100}); OL rows {int(tr.label.str.startswith('OL').sum())} by label; with the {len(turns)}"
f" repeated two-second rows given the direction of their displacement at 1 s, OL_L {n_l} and OL_R {n_r} against 266 and 265")
animal in_dataset units_paper trials_paper OL_L_paper OL_R_paper units trials_rows trials_intact OL_L_rows OL_R_rows OL_L_intact OL_R_intact OL_rows_block2_by_duration
453 False 56.0 2563 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
454 False 40.0 2581 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
456 False 39.0 2262 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
474 False NaN 131 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
475 False NaN 55 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
480 False 42.0 758 185.0 190.0 NaN NaN NaN NaN NaN NaN NaN NaN
482 False 38.0 1518 350.0 350.0 NaN NaN NaN NaN NaN NaN NaN NaN
488 False 29.0 939 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
489 True 65.0 1000 266.0 265.0 61.0 1611.0 1000.0 860.0 251.0 249.0 251.0 305.0
499 False NaN 1123 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
503 True 48.0 1027 305.0 304.0 43.0 1027.0 1027.0 230.0 283.0 230.0 283.0 NaN
516 False 33.0 1071 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
517 False 42.0 1287 270.0 268.0 NaN NaN NaN NaN NaN NaN NaN NaN
518 False NaN 1291 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
528 False 89.0 525 95.0 95.0 NaN NaN NaN NaN NaN NaN NaN NaN
530 False 113.0 1654 402.0 403.0 NaN NaN NaN NaN NaN NaN NaN NaN
573 False NaN 401 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
579 False 34.0 55 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
589 False NaN 50 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
animals in the dataset: 2 of 19 (ephys 2 of 13)
489: units 61.0 vs 65.0 (match False); trials 1611.0 rows, 1000.0 intact, vs 1000 (within 10%: rows False, intact True); OL_L + OL_R intact 249.0 + 251.0 = 500.0 vs 266.0 + 265.0 = 531.0
503: units 43.0 vs 48.0 (match False); trials 1027.0 rows, 1027.0 intact, vs 1027 (within 10%: rows True, intact True); OL_L + OL_R intact 230.0 + 283.0 = 513.0 vs 305.0 + 304.0 = 609.0
489 units per layer against Fig. 5B (L2/3 10, L4 13, L5A 13, L5B 16, L6 13; FS 43, RS 22): {'23': 7, '4': 13, '5A': 13, '5B': 16, '6': 12} FS 30, RS 31; unit_type Inhibitory 30, Excitatory 31
489 with all 1611 rows (assumption checked: the 611 repeated rows counted as trials): 1611 trials against 1000 (within 10%: False); OL rows 1111 by label; with the 305 repeated two-second rows given the direction of their displacement at 1 s, OL_L 298 and OL_R 507 against 266 and 265
Result: not reproduced. The dataset holds 2 of the 19 animals (2 of 13 ephys sessions), so 17 trial counts and 11 unit counts cannot be compared. Of the two present, neither unit count matches (489: 61 against 65; 503: 43 against 48), and neither OL count does (489: 249 + 251 = 500 intact against 266 + 265 = 531; 503: 230 + 283 = 513 against 305 + 304 = 609). The trial counts match: 503 has 1027 rows (1027) and 489 has 1000 intact rows (1000). That the intact rows of 489 are the trials of Table S1 is an assumption: counted with its 611 repeated rows, 489 has 1611 trials, outside 10% of 1000, and with the 305 repeated turns given the direction of their displacement, 298 OL_L and 507 OL_R. The 489 layer counts differ from Fig. 5B in L2/3 (7 against 10) and L6 (12 against 13), and its FS and RS counts (30 and 31) differ from Fig. 5B (43 and 22).
fig1n-epoch-rates¶
For animal 489, the population rate is about 2 Hz during straight running before the turn, peaks sharply at t = 0.026 s (epoch 2), drops to about 0.7 Hz (epoch 3) for both turn directions, and, for contralateral turns only, ramps to a maximum at about t = 0.25 s (epoch 4); for ipsilateral turns the suppression lasts to the end of the turn.
Criterion: animal 489, population-averaged rate in Hz (spikes in 5 ms bins, averaged over trials of one type and over units), OL_L and OL_R separately; epoch 1 rate 2.0 ± 0.1 Hz over (a) -0.5 to 0 s or (b) -1 to 0 s; epoch 2 peak time, epoch 3 minimum and epoch 4 maximum time as listed in the claims file. The spikes are not on the trial clock (data check), so the three timed values cannot be tested. The epoch 1 rate is an average over a whole window of straight running, and it can be computed at every alignment the data check found possible: the onsets are shifted by every lag searched in the data check, -20 to 60 s in 0.1 s steps. The mean rate over all CL rows is given as a check that does not depend on where the turn starts.
d = S["489"]
tr, sp, nu = d["trials"], d["spikes"], len(d["units"])
lag_grid = np.round(np.arange(-20, 60.0001, 0.1), 1)
ep1 = []
for lab in ["OL_L", "OL_R"]:
on = tr.start_time.values[(tr.intact & (tr.label == lab)).values]
for L in lag_grid:
r = bv.population_psth(sp, nu, on + L, np.array([-1.0, -0.5, 0.0]))
ep1.append(dict(turn=lab, lag=L, a_minus05_to_0=r[1], b_minus1_to_0=r.mean()))
ep1 = pd.DataFrame(ep1)
print(f"489, {nu} units: epoch 1 population rate (Hz per unit) with the OL onsets shifted by -20 to 60 s ({len(lag_grid)} lags)")
print(ep1.groupby("turn")[["a_minus05_to_0", "b_minus1_to_0"]].agg(["min", "median", "max"]).round(2).to_string())
lag0 = ep1[ep1.lag == 0].set_index("turn")
print(f"at the stored onsets: (a) OL_L {lag0.a_minus05_to_0['OL_L']:.2f}, OL_R {lag0.a_minus05_to_0['OL_R']:.2f};"
f" (b) OL_L {lag0.b_minus1_to_0['OL_L']:.2f}, OL_R {lag0.b_minus1_to_0['OL_R']:.2f} Hz")
print(f"lags at which any epoch 1 rate is within 2.0 +- 0.1 Hz: "
f"{int(((ep1[['a_minus05_to_0', 'b_minus1_to_0']] - 2.0).abs() <= 0.1).any(axis=1).sum())} of {len(ep1)} (lag, turn) pairs")
for s, d2 in S.items():
tr2, sp2, nu2 = d2["trials"], d2["spikes"], len(d2["units"])
cl = tr2[tr2.intact & (tr2.label == "CL") & (tr2.duration > 0)]
rate = {L: sum(np.searchsorted(sp2, b + L) - np.searchsorted(sp2, a + L) for a, b in zip(cl.start_time, cl.stop_time))
/ nu2 / cl.duration.sum() for L in [0, 5, 10, 15, 20, 25]}
print(f"session {s}: {len(cl)} CL rows; rate per unit over them with spikes shifted by 0 to 25 s: "
f"{min(rate.values()):.2f} to {max(rate.values()):.2f} Hz; over the whole recording "
f"{len(sp2) / nu2 / (sp2.max() - sp2.min()):.2f} Hz")
fr = d["units"].firing_rate
print(f"489 units table firing_rate: mean {fr.mean():.2f}, median {fr.median():.2f} Hz; units below 2 Hz: {np.sum(fr < 2)} of {len(fr)}")
489, 61 units: epoch 1 population rate (Hz per unit) with the OL onsets shifted by -20 to 60 s (801 lags)
a_minus05_to_0 b_minus1_to_0
min median max min median max
turn
OL_L 6.71 7.31 7.80 6.78 7.32 7.75
OL_R 6.65 7.20 7.75 6.74 7.20 7.68
at the stored onsets: (a) OL_L 7.32, OL_R 7.27; (b) OL_L 7.48, OL_R 7.15 Hz
lags at which any epoch 1 rate is within 2.0 +- 0.1 Hz: 0 of 1602 (lag, turn) pairs
session 489: 500 CL rows; rate per unit over them with spikes shifted by 0 to 25 s: 7.18 to 7.26 Hz; over the whole recording 7.09 Hz
session 503: 514 CL rows; rate per unit over them with spikes shifted by 0 to 25 s: 8.83 to 8.92 Hz; over the whole recording 8.85 Hz
489 units table firing_rate: mean 5.91, median 2.95 Hz; units below 2 Hz: 19 of 61
Result: not reproduced. The epoch 1 rate of 489 is far above 2.0 ± 0.1 Hz at every alignment: over the 801 lags from -20 to 60 s it is 6.65 to 7.80 Hz under reading (a) and 6.74 to 7.75 Hz under reading (b), for both turn types, and none of the 1602 (lag, turn) pairs is within tolerance. At the stored onsets it is 7.15 to 7.48 Hz. Over all CL rows the rate per unit is 7.18 to 7.26 Hz at lags of 0 to 25 s, and 7.09 Hz over the whole recording. The units table gives a mean firing rate of 5.91 Hz (median 2.95 Hz; 19 of 61 units below 2 Hz). The dataset has 61 of the paper's 65 units. The epoch 2 peak time, the epoch 3 minimum and the epoch 4 maximum time need the spikes on the trial clock and are not tested.
figs1-running-speed¶
Mice run at fast speeds, 21 ± 4 cm/s (mean ± SD).
Criterion: absolute speed from forward and lateral velocity; readings (a) 503, mean over samples; (b) 503, samples of running trials (mean trial speed above 10 cm/s); (c) the mean of the per-animal mean running speeds over 19 animals, with each animal compared with Table S1 within 10%; (d) habituation sessions if present. Reproduced when the mean is within 4 cm/s of 21 under a reading.
paper_speed = {"489": (92.6, 22.2), "503": (52.8, 16.1)} # Table S1: run %, mean running speed (cm/s)
rows = []
for s, d in S.items():
tr, beh, seg = d["trials"], d["beh"], d["seg"]
for scope, rws in [("all rows", list(seg)), ("intact rows", list(tr.index[tr.intact]))]:
samples, per_trial = bv.session_speed(beh, seg, rws)
run = per_trial[per_trial > bv.RUN_THRESHOLD]
run_samples, _ = bv.session_speed(beh, seg, list(run.index))
rows.append(dict(session=s, scope=scope, trials=len(per_trial),
a_mean_samples=np.nanmean(samples), a_sd_samples=np.nanstd(samples),
b_mean_samples_running=np.nanmean(run_samples), b_sd=np.nanstd(run_samples),
run_pct=100 * len(run) / len(per_trial), mean_running_trial_speed=run.mean(),
run_pct_paper=paper_speed[s][0], mean_speed_paper=paper_speed[s][1]))
sp_tab = pd.DataFrame(rows)
print(sp_tab.round(2).to_string(index=False))
main = sp_tab[sp_tab.scope == "all rows"].set_index("session")
print(f"\n(a) 503, mean absolute speed over samples: {main.a_mean_samples['503']:.2f} cm/s (SD {main.a_sd_samples['503']:.2f})")
print(f"(b) 503, samples of running trials (mean trial speed > 10 cm/s): {main.b_mean_samples_running['503']:.2f} cm/s (SD {main.b_sd['503']:.2f})")
c = main.mean_running_trial_speed
print(f"(c) mean of the per-animal mean running speeds, the 2 animals in the dataset: {c.mean():.2f} cm/s ({c.round(2).to_dict()});"
" the other 17 animals are not in the dataset")
for s in main.index:
print(f" {s}: mean running speed {c[s]:.2f} vs Table S1 {paper_speed[s][1]} (within 10%: {abs(c[s] - paper_speed[s][1]) <= 0.1 * paper_speed[s][1]});"
f" run % {main.run_pct[s]:.1f} vs {paper_speed[s][0]}")
print("(d) habituation sessions: the dataset holds one session per animal, the terminal one")
fig, ax = plt.subplots(figsize=(5, 3))
samples, _ = bv.session_speed(S["503"]["beh"], S["503"]["seg"])
ax.hist(samples, bins=np.arange(0, 60, 1), color="0.4")
ax.set_xlabel("absolute speed, 503 (cm/s)")
ax.set_ylabel("samples")
plt.tight_layout()
plt.show()
print(f"histogram range 0 to 60 cm/s; {np.sum(samples >= 60)} of {len(samples)} samples above it, max {np.nanmax(samples):.1f}")
print("\nRunning trials (mean speed above 10 cm/s) by row type, all rows:")
for s, d in S.items():
tr, beh, seg = d["trials"], d["beh"], d["seg"]
_, per_trial = bv.session_speed(beh, seg)
lab = tr.label.reindex(per_trial.index).where(tr.intact.reindex(per_trial.index), "repeated rows")
out = {k: f"{100 * np.mean(per_trial[lab == k] > bv.RUN_THRESHOLD):.1f}% of {np.sum(lab == k)}"
for k in ["CL", "OL_L", "OL_R", "repeated rows"] if np.sum(lab == k)}
print(f" {s}: {out}; Table S1 {paper_speed[s][0]}%")
session scope trials a_mean_samples a_sd_samples b_mean_samples_running b_sd run_pct mean_running_trial_speed run_pct_paper mean_speed_paper
489 all rows 1611 18.00 8.13 19.55 6.88 91.68 19.98 92.6 22.2
489 intact rows 1000 18.82 7.81 20.09 6.59 95.20 20.50 92.6 22.2
503 all rows 1027 5.93 6.17 12.95 5.42 27.65 13.14 52.8 16.1
503 intact rows 1027 5.93 6.17 12.95 5.42 27.65 13.14 52.8 16.1
(a) 503, mean absolute speed over samples: 5.93 cm/s (SD 6.17)
(b) 503, samples of running trials (mean trial speed > 10 cm/s): 12.95 cm/s (SD 5.42)
(c) mean of the per-animal mean running speeds, the 2 animals in the dataset: 16.56 cm/s ({'489': 19.98, '503': 13.14}); the other 17 animals are not in the dataset
489: mean running speed 19.98 vs Table S1 22.2 (within 10%: True); run % 91.7 vs 92.6
503: mean running speed 13.14 vs Table S1 16.1 (within 10%: False); run % 27.7 vs 52.8
(d) habituation sessions: the dataset holds one session per animal, the terminal one
histogram range 0 to 60 cm/s; 0 of 3648197 samples above it, max 31.4 Running trials (mean speed above 10 cm/s) by row type, all rows:
489: {'CL': '95.6% of 500', 'OL_L': '96.8% of 249', 'OL_R': '92.8% of 251', 'repeated rows': '85.9% of 611'}; Table S1 92.6%
503: {'CL': '37.0% of 514', 'OL_L': '1.7% of 230', 'OL_R': '31.8% of 283'}; Table S1 52.8%
Result: not reproduced. Animal 503 runs at a mean of 5.93 cm/s over all samples (reading a) and 12.95 cm/s over the samples of its running trials (reading b), both outside 17 to 25 cm/s. Reading (c) can use only 2 of the 19 animals; their mean running speed is 16.56 cm/s, also outside. 489 alone (19.98 cm/s) would be inside. The dataset holds no habituation sessions (reading d). Against Table S1, 489 matches (19.98 against 22.2 cm/s; 91.7% running trials against 92.6%), but 503 does not (13.14 against 16.1 cm/s; 27.7% against 52.8%). By row type, 503 runs in 37.0% of its CL rows, 1.7% of its OL_L rows and 31.8% of its OL_R rows, so no choice of rows gives Table S1's 52.8%. With its lower unit count (43 against 48) and OL counts (513 against 609), this suggests that the deposited session or curation of 503 differs from the one the paper analysed.
fig2a-success-rate¶
In the unrewarded task, with a correct trial defined as ±1 cm lateral clearance at t = 1 s, animal 503 succeeds in 95% of 414 randomized turn trials (14 failed trajectories).
Criterion: animal 503, OL trials, lateral position at t = 1 s; zero (e) at t = 0 or (f) at the start of the straight section; trials (a) all OL or (b) the first 414; clearance (c) at least 1 cm in the turn direction or (d) at least 1 cm either way. Reproduced when the success rate is within 10% of 0.95 under a reading. A variant, not in the criterion, uses only OL trials run above 10 cm/s (Table S1's running criterion), since the paper does not say which 414 trials it used.
d = S["503"]
tr, beh, seg = d["trials"], d["beh"], d["seg"]
ol = tr[tr.intact & tr.label.str.startswith("OL")]
rows_all = list(ol.index)
sign = np.where(ol.label == "OL_L", 1, -1)
x1 = bv.lateral_at(beh, seg, rows_all, 1.0) # lateral displacement at t = 1 s from t = 0 (reading e)
_, per_trial = bv.session_speed(beh, seg, rows_all)
st, cum = bv.lateral_traces(beh, seg, rows_all, np.array([1.0]))
x1_cum = cum[:, 0] # from the start of the straight section (reading f)
res = []
for zero, x in [("e: from t = 0", x1), ("f: from the CL start", x1_cum)]:
for clear, ok in [("c: >= 1 cm in turn direction", sign * x >= 1), ("d: |displacement| >= 1 cm", np.abs(x) >= 1)]:
for trials, m in [("a: all OL trials", np.ones(len(x), bool)), ("b: first 414 OL trials", np.arange(len(x)) < 414),
("variant: running OL trials", (per_trial.values > bv.RUN_THRESHOLD))]:
res.append(dict(zero=zero, clearance=clear, trials=trials, n=m.sum(), success=ok[m].mean(), failed=int((~ok[m]).sum())))
succ = pd.DataFrame(res)
print(f"503: {len(ol)} OL trials in the dataset ({(ol.label == 'OL_L').sum()} OL_L, {(ol.label == 'OL_R').sum()} OL_R); "
f"no displacement at 1 s for {np.isnan(x1).sum()}")
print(succ.round(3).to_string(index=False))
print(f"\nwithin 10% of 0.95 (0.855 to 1.045): {succ[succ.trials != 'variant: running OL trials'].success.between(0.855, 1.045).sum()}"
f" of {np.sum(succ.trials != 'variant: running OL trials')} criterion readings")
for lab in ["OL_L", "OL_R"]:
m = (ol.label == lab).values
print(f"{lab}: displacement at 1 s in the turn direction, median {np.nanmedian(sign[m] * x1[m]):.2f} cm, "
f"5th to 95th percentile {np.nanpercentile(sign[m] * x1[m], 5):.2f} to {np.nanpercentile(sign[m] * x1[m], 95):.2f}")
503: 513 OL trials in the dataset (230 OL_L, 283 OL_R); no displacement at 1 s for 0
zero clearance trials n success failed
e: from t = 0 c: >= 1 cm in turn direction a: all OL trials 513 0.680 164
e: from t = 0 c: >= 1 cm in turn direction b: first 414 OL trials 414 0.614 160
e: from t = 0 c: >= 1 cm in turn direction variant: running OL trials 94 1.000 0
e: from t = 0 d: |displacement| >= 1 cm a: all OL trials 513 0.680 164
e: from t = 0 d: |displacement| >= 1 cm b: first 414 OL trials 414 0.614 160
e: from t = 0 d: |displacement| >= 1 cm variant: running OL trials 94 1.000 0
f: from the CL start c: >= 1 cm in turn direction a: all OL trials 513 0.678 165
f: from the CL start c: >= 1 cm in turn direction b: first 414 OL trials 414 0.609 162
f: from the CL start c: >= 1 cm in turn direction variant: running OL trials 94 0.979 2
f: from the CL start d: |displacement| >= 1 cm a: all OL trials 513 0.694 157
f: from the CL start d: |displacement| >= 1 cm b: first 414 OL trials 414 0.628 154
f: from the CL start d: |displacement| >= 1 cm variant: running OL trials 94 0.979 2
within 10% of 0.95 (0.855 to 1.045): 0 of 8 criterion readings
OL_L: displacement at 1 s in the turn direction, median 2.32 cm, 5th to 95th percentile -0.00 to 5.29
OL_R: displacement at 1 s in the turn direction, median 2.32 cm, 5th to 95th percentile 0.00 to 4.65
Result: not reproduced. Under the eight readings of the criterion the success rate is 0.609 to 0.694 (154 to 165 failed trials), against 0.95 (0.855 to 1.045). The failures are trials with almost no lateral movement: the 5th percentile of displacement in the turn direction at 1 s is 0.00 cm for both turn types. Restricted to the 94 OL trials run above 10 cm/s, a variant outside the criterion, the success rate is 0.979 to 1.000 (0 to 2 failures), so the paper's 95% may come from a selection of running trials that the paper does not describe. These 94 trials are almost all OL_R: 503 runs in 1.7% of its 230 OL_L rows and 31.8% of its 283 OL_R rows (figs1-running-speed).
fig2b-lateral-spread¶
Lateral positions are tightly confined during the straight CL section (0.14 ± 0.55 cm, mean ± SD, at t = 0) and their distribution widens over time after the turn (t = 1 s and 3 s), about twice as wide at 3 s as at 2 s (SD 2.30 against 1.49).
Criterion: 503 (Fig. 2B) and 489 (Fig. S6B); lateral distance (a) as stored or (b) integrated from the start of the straight section; the 2 s and 3 s SDs read as (c) 503 at 3 s and 489 at 2 s, (d) both 503, (e) both 489. Reproduced when the t = 0 values and the widening hold and the 2 s and 3 s SDs match under one reading; partially when only the t = 0 values and the widening hold. Following the legends, 503 pools OL_L and OL_R (Fig. 2B, "414 trials randomized between OL_L and OL_R") and 489 uses OL_L (Fig. S6A-B); per-direction values for 503 are shown as well.
grid = np.array([0.0, 1.0, 2.0, 3.0])
rows = []
traces = {}
for s, labs in [("503", ["OL_L", "OL_R"]), ("489", ["OL_L"])]:
d = S[s]
tr, beh, seg = d["trials"], d["beh"], d["seg"]
for scope, ls in [("pooled as in the legend", labs), ("OL_L", ["OL_L"]), ("OL_R", ["OL_R"])]:
if s == "489" and scope != "pooled as in the legend":
continue
rws = list(tr.index[tr.intact & tr.label.isin(ls)])
st, cum = bv.lateral_traces(beh, seg, rws, grid)
traces[(s, scope)] = (st, cum)
for rd, a in [("a: stored", st), ("b: from the CL start", cum)]:
rows.append(dict(session=s, trials=scope, n=len(rws), reading=rd,
**{f"mean_t{t:g}": np.nanmean(a[:, k]) for k, t in enumerate(grid)},
**{f"sd_t{t:g}": np.nanstd(a[:, k]) for k, t in enumerate(grid)}))
spread = pd.DataFrame(rows)
print("Lateral distance (cm) at t = 0, 1, 2 and 3 s from the turn start. Fig. 2B: 503, OL_L and OL_R pooled;"
" Fig. S6B: 489, OL_L.")
print(spread.round(2).to_string(index=False))
print("\nPaper: t = 0 mean 0.14, SD 0.55 (tolerance: mean within 0.55, SD within 0.055); SD 2.30 at 3 s, 1.49 at 2 s.")
for rd in ["a: stored", "b: from the CL start"]:
p = spread[(spread.reading == rd) & (spread.trials == "pooled as in the legend")].set_index("session")
print(f"{rd}: 503 t = 0 mean {p.mean_t0['503']:.2f}, SD {p.sd_t0['503']:.2f}; widening 0 -> 1 -> 3 s (503): "
f"{p.sd_t0['503']:.2f} -> {p.sd_t1['503']:.2f} -> {p.sd_t3['503']:.2f};"
f" (c) 503 SD at 3 s {p.sd_t3['503']:.2f}, 489 SD at 2 s {p.sd_t2['489']:.2f};"
f" (d) 503 at 3 s {p.sd_t3['503']:.2f} and 2 s {p.sd_t2['503']:.2f}; (e) 489 at 3 s {p.sd_t3['489']:.2f} and 2 s {p.sd_t2['489']:.2f}")
print("\nTrials with a value (not NaN) at t = 0, 1, 2 and 3 s, of the trials in each row above:")
for (s, scope), (st, cum) in traces.items():
print(f" {s} {scope}: stored {(~np.isnan(st)).sum(0).tolist()}, from the CL start {(~np.isnan(cum)).sum(0).tolist()} of {len(st)}")
Lateral distance (cm) at t = 0, 1, 2 and 3 s from the turn start. Fig. 2B: 503, OL_L and OL_R pooled; Fig. S6B: 489, OL_L.
session trials n reading mean_t0 mean_t1 mean_t2 mean_t3 sd_t0 sd_t1 sd_t2 sd_t3
503 pooled as in the legend 513 a: stored 0.00 -0.09 0.53 0.58 0.00 2.78 6.75 0.76
503 pooled as in the legend 513 b: from the CL start 0.20 0.12 0.78 1.36 0.84 2.90 7.02 7.20
503 OL_L 230 a: stored -0.00 2.36 6.56 0.82 0.00 1.69 4.35 0.72
503 OL_L 230 b: from the CL start 0.22 2.57 7.29 8.12 0.84 2.18 4.37 4.58
503 OL_R 283 a: stored 0.00 -2.07 -4.37 0.39 0.00 1.71 3.69 0.74
503 OL_R 283 b: from the CL start 0.19 -1.88 -4.52 -4.13 0.83 1.57 3.35 3.10
489 pooled as in the legend 249 a: stored 0.00 3.29 5.66 -1.52 0.00 1.33 3.50 1.78
489 pooled as in the legend 249 b: from the CL start -1.92 1.37 4.57 3.05 1.67 2.34 4.06 5.40
Paper: t = 0 mean 0.14, SD 0.55 (tolerance: mean within 0.55, SD within 0.055); SD 2.30 at 3 s, 1.49 at 2 s.
a: stored: 503 t = 0 mean 0.00, SD 0.00; widening 0 -> 1 -> 3 s (503): 0.00 -> 2.78 -> 0.76; (c) 503 SD at 3 s 0.76, 489 SD at 2 s 3.50; (d) 503 at 3 s 0.76 and 2 s 6.75; (e) 489 at 3 s 1.78 and 2 s 3.50
b: from the CL start: 503 t = 0 mean 0.20, SD 0.84; widening 0 -> 1 -> 3 s (503): 0.84 -> 2.90 -> 7.20; (c) 503 SD at 3 s 7.20, 489 SD at 2 s 4.06; (d) 503 at 3 s 7.20 and 2 s 7.02; (e) 489 at 3 s 5.40 and 2 s 4.06
Trials with a value (not NaN) at t = 0, 1, 2 and 3 s, of the trials in each row above:
503 pooled as in the legend: stored [513, 513, 513, 513], from the CL start [513, 513, 513, 513] of 513
503 OL_L: stored [230, 230, 230, 230], from the CL start [230, 230, 230, 230] of 230
503 OL_R: stored [283, 283, 283, 283], from the CL start [283, 283, 283, 283] of 283
489 pooled as in the legend: stored [248, 249, 249, 249], from the CL start [248, 249, 249, 249] of 249
Result: not reproduced. The stored lateral distance restarts at 0 at every trial, so at t = 0 it is 0.00 ± 0.00 cm by construction (reading a). Integrated from the start of the straight section (reading b), 503 is at 0.20 ± 0.84 cm at t = 0: the mean is within 0.55 cm of 0.14, but the SD is outside 0.55 ± 0.055. Under (b) the distribution widens (SD 0.84, 2.90 and 7.20 cm at 0, 1 and 3 s for 503), but none of the 2 s and 3 s SDs matches 2.30 and 1.49 under (c), (d) or (e) (503: 7.02 and 7.20 cm; 489: 4.06 and 5.40 cm; under (a), 503 0.76 at 3 s and 489 3.50 at 2 s). Every trial has a value at 1, 2 and 3 s, and all but one of 489 at 0 s. Pooling both turn directions widens the 503 distributions; per direction its 3 s SDs are 4.58 (OL_L) and 3.10 (OL_R) cm under (b).
fig4-ddm-fit¶
A classical drift-diffusion model fitted to the reaction-time distribution of animal 489 gives a nondecision time of 0.12 s, drift 2.91, bound 0.59 and noise 0.25 (BIC -664); a generalized DDM with collapsing bounds and leak fits better (BIC -705), with normalized drift K/B of 11.12.
Criterion: animal 489, OL_L trials ((e) the 266 of Fig. 4B or (f) the 520 of Fig. S7C-D; the dataset's labelled OL_L trials are 249, and all are used); RT as in fig2i-ft-rt: the largest peak after t = 0 of (c) the run angle derivative or (d) the lateral acceleration, in the turn direction, searched over (e) 0 to 1 s or (f) 0 to 1.8 s; correct as in fig2a-success-rate; PyDDM; (a) sigma free or (b) sigma fixed at 0.25; GDDM with exponentially collapsing bounds and a leaky integrator. Reproduced when NDT is within 10% of 0.12 s and the GDDM BIC is below the DDM BIC under a reading; partially when only one holds. A maximum at the edge of the search window is not a peak, and those trials are dropped (a standard choice, counted below). The first table also gives RT for both ephys animals and both turn types, which fig2i-ft-rt asks for.
Some RTs fall in the first tens of milliseconds, before the leg push the SI says the peak marks ("Such peaks are
associated with characteristic push outwards with RH or LH legs", SI, Fitting of drift diffusion models). The
paper's histogram of the RTs of 489 (Fig. S7D) has no RT below about 0.2 s. A DDM gives no likelihood to an RT below
its NDT, so such RTs can hold the NDT down. The paper does not say how it handled them, so each fit is run three ways
(an assumption): (i) all RTs kept, (ii) with a uniform mixture of weight up to 0.1, PyDDM's means "to confer
robustness when fitting using likelihood" (OverlayUniformMixture), and (iii) with RTs below 0.1 s dropped. A
further cell shows how the NDT moves with a cutoff and with the mixture's limit, and the likelihood profile of NDT.
rt_rows = []
RT = {}
for s, d in S.items():
tr, beh, seg = d["trials"], d["beh"], d["seg"]
for lab, sg in [("OL_L", 1), ("OL_R", -1)]:
rws = list(tr.index[tr.intact & (tr.label == lab)])
x1 = bv.lateral_at(beh, seg, rws, 1.0)
for sig in ["angle", "acc"]:
for w in [(0.0, 1.0), (0.0, 1.8)]:
rt = np.array([bv.reaction_time(beh, seg[r], sg, sig, w) for r in rws])
edge = (rt <= w[0] + bv.RT_DT) | (rt >= w[1] - bv.RT_DT) | np.isnan(rt)
RT[(s, lab, sig, w)] = (rt, edge, x1, sg)
ok = rt[~edge]
rt_rows.append(dict(session=s, turn=lab, n=len(rws), signal=sig, window=f"{w[0]:g}-{w[1]:g} s",
at_window_edge=int(edge.sum()), below_0_1_s=int(np.sum(ok < 0.1)),
below_0_15_s=int(np.sum(ok < 0.15)), mean=ok.mean(), sd=ok.std(), median=np.median(ok), min=ok.min()))
rt_tab = pd.DataFrame(rt_rows)
print("Reaction time (s): time of the largest peak of the run angle derivative ('angle') or lateral acceleration ('acc')"
" in the turn direction; maxima at the window edges are not peaks and are dropped. Paper (Fig. 2I, animal 573 or 480,"
" not in the dataset): 0.38 +- 0.07 s.")
print(rt_tab.round(3).to_string(index=False))
Reaction time (s): time of the largest peak of the run angle derivative ('angle') or lateral acceleration ('acc') in the turn direction; maxima at the window edges are not peaks and are dropped. Paper (Fig. 2I, animal 573 or 480, not in the dataset): 0.38 +- 0.07 s.
session turn n signal window at_window_edge below_0_1_s below_0_15_s mean sd median min
489 OL_L 249 angle 0-1 s 2 8 10 0.306 0.090 0.302 0.007
489 OL_L 249 angle 0-1.8 s 4 8 10 0.322 0.162 0.304 0.007
489 OL_L 249 acc 0-1 s 3 13 17 0.297 0.132 0.290 0.007
489 OL_L 249 acc 0-1.8 s 5 12 16 0.352 0.294 0.290 0.007
489 OL_R 251 angle 0-1 s 13 19 27 0.435 0.253 0.366 0.006
489 OL_R 251 angle 0-1.8 s 8 14 21 0.649 0.439 0.555 0.006
489 OL_R 251 acc 0-1 s 19 21 31 0.358 0.236 0.288 0.006
489 OL_R 251 acc 0-1.8 s 7 15 24 0.576 0.475 0.351 0.006
503 OL_L 230 angle 0-1 s 4 29 40 0.296 0.169 0.298 0.009
503 OL_L 230 angle 0-1.8 s 2 27 38 0.398 0.372 0.304 0.009
503 OL_L 230 acc 0-1 s 15 8 12 0.463 0.261 0.364 0.012
503 OL_L 230 acc 0-1.8 s 3 4 6 0.879 0.536 0.902 0.012
503 OL_R 283 angle 0-1 s 24 26 30 0.396 0.219 0.368 0.006
503 OL_R 283 angle 0-1.8 s 15 22 26 0.527 0.413 0.381 0.006
503 OL_R 283 acc 0-1 s 41 17 28 0.410 0.272 0.313 0.006
503 OL_R 283 acc 0-1.8 s 21 16 23 0.638 0.502 0.377 0.006
handlings = {"none": None, "uniform mixture": "mixture", "RT < 0.1 s dropped": 0.1}
jobs = []
for sig in ["angle", "acc"]:
for w in [(0.0, 1.0), (0.0, 1.8)]:
rt, edge, x1, sg = RT[("489", "OL_L", sig, w)]
for clear, correct in [("c", sg * x1 >= 1), ("d", np.abs(x1) >= 1)]:
for hname, h in handlings.items():
keep = ~edge & ~np.isnan(x1)
if isinstance(h, float):
keep &= rt >= h
for sigma_free in [True, False]:
for model in ["DDM", "GDDM"]:
if model == "GDDM" and (sigma_free or w[1] > 1.0):
continue # GDDM fitted on the sigma 0.25 readings of the 0 to 1 s window only
key = (sig, f"{w[0]:g}-{w[1]:g}", clear, "a: sigma free" if sigma_free else "b: sigma 0.25", hname, model)
jobs.append((key, rt[keep], correct[keep], model, sigma_free, w[1], 0.1 if h == "mixture" else 0.0))
t_fit = time.time()
with Pool(4) as pool:
fits = dict(pool.map(bv.fit_ddm, jobs))
print(f"{len(jobs)} fits in {time.time() - t_fit:.0f} s; trials per fit:",
{h: sorted({len(j[1]) for j in jobs if j[0][4] == h}) for h in handlings},
f"of {len(RT[('489', 'OL_L', 'angle', (0.0, 1.0))][0])} OL_L (the rest have the maximum at a window edge, no displacement, or an early RT)")
ft = pd.DataFrame([dict(signal=k[0], window=k[1], clearance=k[2], sigma_reading=k[3], early_RT=k[4], model=k[5], **v)
for k, v in fits.items()])
ft["K_over_B"] = ft.K / ft.B
ft["correct_fraction"] = [j[2].mean() for j in jobs]
print(ft.round(3).to_string(index=False))
60 fits in 114 s; trials per fit: {'none': [244, 245, 246, 247], 'uniform mixture': [244, 245, 246, 247], 'RT < 0.1 s dropped': [232, 233, 237, 239]} of 249 OL_L (the rest have the maximum at a window edge, no displacement, or an early RT)
signal window clearance sigma_reading early_RT model K B sigma NDT mixture BIC leak tau K_over_B correct_fraction
angle 0-1 c a: sigma free none DDM 3.199 1.131 1.733 0.000 0.000 53.117 NaN NaN 2.828 0.935
angle 0-1 c b: sigma 0.25 none DDM 0.464 0.163 0.250 0.000 0.000 47.599 NaN NaN 2.843 0.935
angle 0-1 c b: sigma 0.25 none GDDM 0.511 0.182 0.250 0.005 0.000 -196.739 -9.928 2.014 2.813 0.935
angle 0-1 c a: sigma free uniform mixture DDM 10.078 2.797 0.935 0.039 0.100 -426.738 NaN NaN 3.603 0.935
angle 0-1 c b: sigma 0.25 uniform mixture DDM 2.821 0.866 0.250 0.006 0.100 -432.967 NaN NaN 3.255 0.935
angle 0-1 c b: sigma 0.25 uniform mixture GDDM 1.839 2.914 0.250 0.002 0.100 -424.976 7.538 1.027 0.631 0.935
angle 0-1 c a: sigma free RT < 0.1 s dropped DDM 2.402 0.612 0.794 0.090 0.000 -283.524 NaN NaN 3.924 0.941
angle 0-1 c b: sigma 0.25 RT < 0.1 s dropped DDM 0.758 0.194 0.250 0.091 0.000 -289.013 NaN NaN 3.915 0.941
angle 0-1 c b: sigma 0.25 RT < 0.1 s dropped GDDM 0.745 2.499 0.250 0.005 0.000 -438.173 9.989 1.882 0.298 0.941
angle 0-1 d a: sigma free none DDM 3.484 1.214 1.851 0.002 0.000 48.219 NaN NaN 2.871 0.939
angle 0-1 d b: sigma 0.25 none DDM 0.469 0.164 0.250 0.003 0.000 42.722 NaN NaN 2.856 0.939
angle 0-1 d b: sigma 0.25 none GDDM 0.560 0.190 0.250 0.001 0.000 -201.636 -9.997 2.127 2.948 0.939
angle 0-1 d a: sigma free uniform mixture DDM 7.976 2.334 0.723 0.025 0.100 -435.862 NaN NaN 3.417 0.939
angle 0-1 d b: sigma 0.25 uniform mixture DDM 2.841 0.888 0.250 0.001 0.100 -441.834 NaN NaN 3.201 0.939
angle 0-1 d b: sigma 0.25 uniform mixture GDDM 2.032 1.107 0.250 0.032 0.099 -432.893 2.504 1.211 1.835 0.939
angle 0-1 d a: sigma free RT < 0.1 s dropped DDM 5.913 1.500 1.900 0.093 0.000 -293.183 NaN NaN 3.942 0.946
angle 0-1 d b: sigma 0.25 RT < 0.1 s dropped DDM 0.800 0.206 0.250 0.089 0.000 -298.446 NaN NaN 3.889 0.946
angle 0-1 d b: sigma 0.25 RT < 0.1 s dropped GDDM 0.774 2.478 0.250 0.001 0.000 -441.475 9.877 1.727 0.312 0.946
angle 0-1.8 c a: sigma free none DDM 3.016 1.110 1.679 0.003 0.000 85.806 NaN NaN 2.717 0.939
angle 0-1.8 c b: sigma 0.25 none DDM 0.450 0.165 0.250 0.005 0.000 80.304 NaN NaN 2.720 0.939
angle 0-1.8 c a: sigma free uniform mixture DDM 8.601 2.678 0.787 0.003 0.100 -356.730 NaN NaN 3.211 0.939
angle 0-1.8 c b: sigma 0.25 uniform mixture DDM 2.732 0.851 0.250 0.003 0.100 -362.231 NaN NaN 3.211 0.939
angle 0-1.8 c a: sigma free RT < 0.1 s dropped DDM 3.607 0.997 1.266 0.087 0.000 -238.518 NaN NaN 3.618 0.945
angle 0-1.8 c b: sigma 0.25 RT < 0.1 s dropped DDM 0.711 0.197 0.250 0.086 0.000 -243.991 NaN NaN 3.608 0.945
angle 0-1.8 d a: sigma free none DDM 3.114 1.135 1.707 0.002 0.000 81.003 NaN NaN 2.744 0.943
angle 0-1.8 d b: sigma 0.25 none DDM 0.458 0.166 0.250 0.004 0.000 75.503 NaN NaN 2.751 0.943
angle 0-1.8 d a: sigma free uniform mixture DDM 8.774 2.735 0.802 0.002 0.100 -366.605 NaN NaN 3.209 0.943
angle 0-1.8 d b: sigma 0.25 uniform mixture DDM 2.716 0.833 0.250 0.008 0.100 -371.874 NaN NaN 3.260 0.943
angle 0-1.8 d a: sigma free RT < 0.1 s dropped DDM 4.648 1.282 1.604 0.090 0.000 -247.671 NaN NaN 3.626 0.949
angle 0-1.8 d b: sigma 0.25 RT < 0.1 s dropped DDM 0.728 0.201 0.250 0.086 0.000 -253.144 NaN NaN 3.628 0.949
acc 0-1 c a: sigma free none DDM 2.385 0.815 1.365 0.004 0.000 88.259 NaN NaN 2.927 0.935
acc 0-1 c b: sigma 0.25 none DDM 0.443 0.150 0.250 0.001 0.000 82.774 NaN NaN 2.950 0.935
acc 0-1 c b: sigma 0.25 none GDDM 0.552 0.147 0.250 0.004 0.000 -76.797 -9.987 1.121 3.748 0.935
acc 0-1 c a: sigma free uniform mixture DDM 9.073 2.625 0.894 0.005 0.100 -294.509 NaN NaN 3.456 0.935
acc 0-1 c b: sigma 0.25 uniform mixture DDM 2.539 0.734 0.250 0.002 0.100 -300.014 NaN NaN 3.456 0.935
acc 0-1 c b: sigma 0.25 uniform mixture GDDM 2.630 1.122 0.250 0.010 0.100 -298.480 2.739 0.139 2.345 0.935
acc 0-1 c a: sigma free RT < 0.1 s dropped DDM 5.078 1.263 1.798 0.094 0.000 -260.963 NaN NaN 4.020 0.944
acc 0-1 c b: sigma 0.25 RT < 0.1 s dropped DDM 0.708 0.174 0.250 0.091 0.000 -266.365 NaN NaN 4.060 0.944
acc 0-1 c b: sigma 0.25 RT < 0.1 s dropped GDDM 0.678 0.941 0.250 0.005 0.000 -343.775 6.043 2.319 0.721 0.944
acc 0-1 d a: sigma free none DDM 3.111 1.058 1.764 0.003 0.000 84.040 NaN NaN 2.940 0.939
acc 0-1 d b: sigma 0.25 none DDM 0.446 0.150 0.250 0.001 0.000 78.526 NaN NaN 2.971 0.939
acc 0-1 d b: sigma 0.25 none GDDM 0.563 0.148 0.250 0.002 0.000 -81.498 -9.981 1.106 3.797 0.939
acc 0-1 d a: sigma free uniform mixture DDM 9.867 2.859 0.978 0.000 0.100 -301.375 NaN NaN 3.451 0.939
acc 0-1 d b: sigma 0.25 uniform mixture DDM 2.522 0.731 0.250 0.003 0.100 -306.881 NaN NaN 3.451 0.939
acc 0-1 d b: sigma 0.25 uniform mixture GDDM 2.044 2.251 0.250 0.005 0.100 -303.248 8.168 0.067 0.908 0.939
acc 0-1 d a: sigma free RT < 0.1 s dropped DDM 5.529 1.368 1.948 0.093 0.000 -268.922 NaN NaN 4.041 0.948
acc 0-1 d b: sigma 0.25 RT < 0.1 s dropped DDM 0.717 0.177 0.250 0.090 0.000 -274.447 NaN NaN 4.047 0.948
acc 0-1 d b: sigma 0.25 RT < 0.1 s dropped GDDM 0.670 0.982 0.250 0.001 0.000 -348.190 6.095 2.306 0.682 0.948
acc 0-1.8 c a: sigma free none DDM 2.855 1.144 1.821 0.000 0.000 205.906 NaN NaN 2.496 0.939
acc 0-1.8 c b: sigma 0.25 none DDM 0.393 0.157 0.250 0.003 0.000 200.418 NaN NaN 2.501 0.939
acc 0-1.8 c a: sigma free uniform mixture DDM 10.100 2.897 1.016 0.003 0.100 -172.971 NaN NaN 3.487 0.939
acc 0-1.8 c b: sigma 0.25 uniform mixture DDM 2.486 0.713 0.250 0.003 0.100 -178.469 NaN NaN 3.487 0.939
acc 0-1.8 c a: sigma free RT < 0.1 s dropped DDM 3.489 1.121 1.536 0.081 0.000 -119.351 NaN NaN 3.114 0.948
acc 0-1.8 c b: sigma 0.25 RT < 0.1 s dropped DDM 0.569 0.183 0.250 0.080 0.000 -124.783 NaN NaN 3.107 0.948
acc 0-1.8 d a: sigma free none DDM 3.023 1.200 1.907 0.002 0.000 201.943 NaN NaN 2.518 0.943
acc 0-1.8 d b: sigma 0.25 none DDM 0.397 0.157 0.250 0.001 0.000 196.446 NaN NaN 2.520 0.943
acc 0-1.8 d a: sigma free uniform mixture DDM 6.953 1.998 0.704 0.005 0.100 -180.894 NaN NaN 3.480 0.943
acc 0-1.8 d b: sigma 0.25 uniform mixture DDM 2.471 0.710 0.250 0.000 0.100 -186.392 NaN NaN 3.481 0.943
acc 0-1.8 d a: sigma free RT < 0.1 s dropped DDM 4.070 1.297 1.768 0.082 0.000 -126.062 NaN NaN 3.137 0.953
acc 0-1.8 d b: sigma 0.25 RT < 0.1 s dropped DDM 0.577 0.183 0.250 0.080 0.000 -131.496 NaN NaN 3.153 0.953
piv = ft.pivot_table(index=["early_RT", "signal", "window", "clearance", "sigma_reading"], columns="model",
values=["NDT", "BIC", "K_over_B"])
piv.columns = [f"{a}_{b}" for a, b in piv.columns]
piv["NDT_DDM_within_10pct"] = (piv.NDT_DDM - 0.12).abs() <= 0.012
piv["GDDM_BIC_lower"] = piv.BIC_GDDM < piv.BIC_DDM
print(piv.round(3).to_string())
for h in handlings:
p = piv.loc[h]
dd = ft[(ft.model == "DDM") & (ft.early_RT == h)]
gd = ft[(ft.model == "GDDM") & (ft.early_RT == h)]
print(f"\nearly RTs: {h}. Readings with DDM NDT within 0.012 s of 0.12 s: {p.NDT_DDM_within_10pct.sum()} of {len(p)};"
f" with GDDM BIC below DDM BIC: {p.GDDM_BIC_lower.sum()} of {p.BIC_GDDM.notna().sum()}; both: {(p.NDT_DDM_within_10pct & p.GDDM_BIC_lower).sum()}")
print(f" DDM NDT {dd.NDT.min():.3f} to {dd.NDT.max():.3f} s; mixture weight {dd.mixture.min():.3f} to {dd.mixture.max():.3f}")
for col, ref, tol in [("K", 2.91, 0.291), ("B", 0.59, 0.059), ("sigma", 0.25, 0.025), ("BIC", -664, 66.4)]:
print(f" DDM {col}: {dd[col].min():.3f} to {dd[col].max():.3f}; within tolerance of {ref} in {np.sum((dd[col] - ref).abs() <= tol)} of {len(dd)} fits")
print(f" GDDM BIC {gd.BIC.min():.1f} to {gd.BIC.max():.1f} (paper -705, within 70.5 in {np.sum((gd.BIC + 705).abs() <= 70.5)} of {len(gd)});"
f" GDDM leak {gd.leak.min():.2f} to {gd.leak.max():.2f} (range -10 to 10); K/B (c, GDDM) {gd.K_over_B.min():.2f} to {gd.K_over_B.max():.2f},"
f" (d, DDM) {dd.K_over_B.min():.2f} to {dd.K_over_B.max():.2f}; paper 11.12 +- 1.11")
fig, ax = plt.subplots(figsize=(5, 3))
rt, edge, x1, sg = RT[("489", "OL_L", "angle", (0.0, 1.0))]
ax.hist(rt[~edge & (x1 >= 1)], bins=np.arange(0, 1.0001, 0.025), color="tab:red", alpha=0.7, label="correct")
ax.hist(rt[~edge & (x1 < 1)], bins=np.arange(0, 1.0001, 0.025), color="k", alpha=0.7, label="error")
ax.set_xlabel("RT, run angle derivative, 0 to 1 s (s)")
ax.set_ylabel("OL_L trials, 489")
ax.legend()
plt.tight_layout()
plt.show()
print("histogram covers 0 to 1 s, the whole search window")
BIC_DDM BIC_GDDM K_over_B_DDM K_over_B_GDDM NDT_DDM NDT_GDDM NDT_DDM_within_10pct GDDM_BIC_lower
early_RT signal window clearance sigma_reading
RT < 0.1 s dropped acc 0-1 c a: sigma free -260.963 NaN 4.020 NaN 0.094 NaN False False
b: sigma 0.25 -266.365 -343.775 4.060 0.721 0.091 0.005 False True
d a: sigma free -268.922 NaN 4.041 NaN 0.093 NaN False False
b: sigma 0.25 -274.447 -348.190 4.047 0.682 0.090 0.001 False True
0-1.8 c a: sigma free -119.351 NaN 3.114 NaN 0.081 NaN False False
b: sigma 0.25 -124.783 NaN 3.107 NaN 0.080 NaN False False
d a: sigma free -126.062 NaN 3.137 NaN 0.082 NaN False False
b: sigma 0.25 -131.496 NaN 3.153 NaN 0.080 NaN False False
angle 0-1 c a: sigma free -283.524 NaN 3.924 NaN 0.090 NaN False False
b: sigma 0.25 -289.013 -438.173 3.915 0.298 0.091 0.005 False True
d a: sigma free -293.183 NaN 3.942 NaN 0.093 NaN False False
b: sigma 0.25 -298.446 -441.475 3.889 0.312 0.089 0.001 False True
0-1.8 c a: sigma free -238.518 NaN 3.618 NaN 0.087 NaN False False
b: sigma 0.25 -243.991 NaN 3.608 NaN 0.086 NaN False False
d a: sigma free -247.671 NaN 3.626 NaN 0.090 NaN False False
b: sigma 0.25 -253.144 NaN 3.628 NaN 0.086 NaN False False
none acc 0-1 c a: sigma free 88.259 NaN 2.927 NaN 0.004 NaN False False
b: sigma 0.25 82.774 -76.797 2.950 3.748 0.001 0.004 False True
d a: sigma free 84.040 NaN 2.940 NaN 0.003 NaN False False
b: sigma 0.25 78.526 -81.498 2.971 3.797 0.001 0.002 False True
0-1.8 c a: sigma free 205.906 NaN 2.496 NaN 0.000 NaN False False
b: sigma 0.25 200.418 NaN 2.501 NaN 0.003 NaN False False
d a: sigma free 201.943 NaN 2.518 NaN 0.002 NaN False False
b: sigma 0.25 196.446 NaN 2.520 NaN 0.001 NaN False False
angle 0-1 c a: sigma free 53.117 NaN 2.828 NaN 0.000 NaN False False
b: sigma 0.25 47.599 -196.739 2.843 2.813 0.000 0.005 False True
d a: sigma free 48.219 NaN 2.871 NaN 0.002 NaN False False
b: sigma 0.25 42.722 -201.636 2.856 2.948 0.003 0.001 False True
0-1.8 c a: sigma free 85.806 NaN 2.717 NaN 0.003 NaN False False
b: sigma 0.25 80.304 NaN 2.720 NaN 0.005 NaN False False
d a: sigma free 81.003 NaN 2.744 NaN 0.002 NaN False False
b: sigma 0.25 75.503 NaN 2.751 NaN 0.004 NaN False False
uniform mixture acc 0-1 c a: sigma free -294.509 NaN 3.456 NaN 0.005 NaN False False
b: sigma 0.25 -300.014 -298.480 3.456 2.345 0.002 0.010 False False
d a: sigma free -301.375 NaN 3.451 NaN 0.000 NaN False False
b: sigma 0.25 -306.881 -303.248 3.451 0.908 0.003 0.005 False False
0-1.8 c a: sigma free -172.971 NaN 3.487 NaN 0.003 NaN False False
b: sigma 0.25 -178.469 NaN 3.487 NaN 0.003 NaN False False
d a: sigma free -180.894 NaN 3.480 NaN 0.005 NaN False False
b: sigma 0.25 -186.392 NaN 3.481 NaN 0.000 NaN False False
angle 0-1 c a: sigma free -426.738 NaN 3.603 NaN 0.039 NaN False False
b: sigma 0.25 -432.967 -424.976 3.255 0.631 0.006 0.002 False False
d a: sigma free -435.862 NaN 3.417 NaN 0.025 NaN False False
b: sigma 0.25 -441.834 -432.893 3.201 1.835 0.001 0.032 False False
0-1.8 c a: sigma free -356.730 NaN 3.211 NaN 0.003 NaN False False
b: sigma 0.25 -362.231 NaN 3.211 NaN 0.003 NaN False False
d a: sigma free -366.605 NaN 3.209 NaN 0.002 NaN False False
b: sigma 0.25 -371.874 NaN 3.260 NaN 0.008 NaN False False
early RTs: none. Readings with DDM NDT within 0.012 s of 0.12 s: 0 of 16; with GDDM BIC below DDM BIC: 4 of 4; both: 0
DDM NDT 0.000 to 0.005 s; mixture weight 0.000 to 0.000
DDM K: 0.393 to 3.484; within tolerance of 2.91 in 6 of 16 fits
DDM B: 0.150 to 1.214; within tolerance of 0.59 in 0 of 16 fits
DDM sigma: 0.250 to 1.907; within tolerance of 0.25 in 8 of 16 fits
DDM BIC: 42.722 to 205.906; within tolerance of -664 in 0 of 16 fits
GDDM BIC -201.6 to -76.8 (paper -705, within 70.5 in 0 of 4); GDDM leak -10.00 to -9.93 (range -10 to 10); K/B (c, GDDM) 2.81 to 3.80, (d, DDM) 2.50 to 2.97; paper 11.12 +- 1.11
early RTs: uniform mixture. Readings with DDM NDT within 0.012 s of 0.12 s: 0 of 16; with GDDM BIC below DDM BIC: 0 of 4; both: 0
DDM NDT 0.000 to 0.039 s; mixture weight 0.100 to 0.100
DDM K: 2.471 to 10.100; within tolerance of 2.91 in 4 of 16 fits
DDM B: 0.710 to 2.897; within tolerance of 0.59 in 0 of 16 fits
DDM sigma: 0.250 to 1.016; within tolerance of 0.25 in 8 of 16 fits
DDM BIC: -441.834 to -172.971; within tolerance of -664 in 0 of 16 fits
GDDM BIC -432.9 to -298.5 (paper -705, within 70.5 in 0 of 4); GDDM leak 2.50 to 8.17 (range -10 to 10); K/B (c, GDDM) 0.63 to 2.34, (d, DDM) 3.20 to 3.60; paper 11.12 +- 1.11
early RTs: RT < 0.1 s dropped. Readings with DDM NDT within 0.012 s of 0.12 s: 0 of 16; with GDDM BIC below DDM BIC: 4 of 4; both: 0
DDM NDT 0.080 to 0.094 s; mixture weight 0.000 to 0.000
DDM K: 0.569 to 5.913; within tolerance of 2.91 in 0 of 16 fits
DDM B: 0.174 to 1.500; within tolerance of 0.59 in 1 of 16 fits
DDM sigma: 0.250 to 1.948; within tolerance of 0.25 in 8 of 16 fits
DDM BIC: -298.446 to -119.351; within tolerance of -664 in 0 of 16 fits
GDDM BIC -441.5 to -343.8 (paper -705, within 70.5 in 0 of 4); GDDM leak 6.04 to 9.99 (range -10 to 10); K/B (c, GDDM) 0.30 to 0.72, (d, DDM) 3.11 to 4.06; paper 11.12 +- 1.11
histogram covers 0 to 1 s, the whole search window
# How the DDM nondecision time depends on the handling of early RTs (sigma 0.25, clearance c)
jobs2 = []
for sig in ["angle", "acc"]:
for w in [(0.0, 1.0), (0.0, 1.8)]:
rt, edge, x1, sg = RT[("489", "OL_L", sig, w)]
keep = ~edge & ~np.isnan(x1)
correct = sg * x1 >= 1
for cut in [0.05, 0.1, 0.15, 0.2]:
m = keep & (rt >= cut)
jobs2.append((("cutoff", sig, f"{w[0]:g}-{w[1]:g}", cut), rt[m], correct[m], "DDM", False, w[1], 0.0))
jobs2.append((("mixture up to 0.3", sig, f"{w[0]:g}-{w[1]:g}", None), rt[keep], correct[keep], "DDM", False, w[1], 0.3))
rt, edge, x1, sg = RT[("489", "OL_L", "angle", (0.0, 1.0))]
keep = ~edge & ~np.isnan(x1)
for ndt in [0.0, 0.03, 0.06, 0.09, 0.12, 0.15]:
jobs2.append((("profile", "angle", "0-1", ndt), rt[keep], (sg * x1 >= 1)[keep], "DDM", False, 1.0, 0.1, ndt))
with Pool(4) as pool:
fits2 = dict(pool.map(bv.fit_ddm, jobs2))
sens = pd.DataFrame([dict(test=k[0], signal=k[1], window=k[2], value=k[3], n=len(j[1]), min_RT=j[1].min(), **fits2[k])
for j in jobs2 for k in [j[0]]])
cutt = sens[sens.test == "cutoff"]
print("DDM fits with RTs below a cutoff dropped:")
print(cutt[["signal", "window", "value", "n", "min_RT", "NDT", "K", "B", "BIC"]].round(3).to_string(index=False))
gap = cutt.min_RT - cutt.NDT
print(f"NDT minus the smallest RT kept: {(-gap).min():.3f} to {(-gap).max():.3f} s; NDT within 0.108 to 0.132 s in "
f"{np.sum((cutt.NDT - 0.12).abs() <= 0.012)} of {len(cutt)} fits")
print("\nDDM fits with a uniform mixture of weight up to 0.3:")
print(sens[sens.test == "mixture up to 0.3"][["signal", "window", "n", "NDT", "mixture", "K", "B", "BIC"]].round(3).to_string(index=False))
prof = sens[sens.test == "profile"]
free = ft[(ft.model == "DDM") & (ft.early_RT == "uniform mixture") & (ft.signal == "angle") & (ft.window == "0-1")
& (ft.clearance == "c") & (ft.sigma_reading == "b: sigma 0.25")].iloc[0]
print(f"\nLikelihood profile, angle, 0 to 1 s, clearance c, sigma 0.25, mixture up to 0.1, NDT fixed (free fit: NDT {free.NDT:.3f}):")
print(prof[["value", "K", "B", "mixture", "BIC"]].rename(columns={"value": "NDT_fixed"}).round(3).to_string(index=False))
print(f"BIC at NDT 0.12 minus the lowest BIC of the profile: {prof.BIC[prof.value == 0.12].iloc[0] - prof.BIC.min():.1f}")
DDM fits with RTs below a cutoff dropped:
signal window value n min_RT NDT K B BIC
angle 0-1 0.05 242 0.060 0.036 0.694 0.217 -192.157
angle 0-1 0.10 239 0.110 0.091 0.758 0.194 -289.013
angle 0-1 0.15 237 0.170 0.154 0.841 0.154 -399.961
angle 0-1 0.20 231 0.216 0.203 0.884 0.120 -514.701
angle 0-1.8 0.05 240 0.060 0.035 0.633 0.215 -157.103
angle 0-1.8 0.10 237 0.110 0.086 0.711 0.197 -243.991
angle 0-1.8 0.15 235 0.170 0.148 0.757 0.158 -339.654
angle 0-1.8 0.20 229 0.216 0.199 0.794 0.126 -430.874
acc 0-1 0.05 236 0.062 0.042 0.678 0.202 -195.467
acc 0-1 0.10 233 0.110 0.091 0.708 0.174 -266.365
acc 0-1 0.15 229 0.151 0.135 0.748 0.155 -334.657
acc 0-1 0.20 215 0.200 0.189 0.806 0.124 -417.179
acc 0-1.8 0.05 235 0.062 0.039 0.552 0.203 -75.965
acc 0-1.8 0.10 232 0.110 0.080 0.569 0.183 -124.783
acc 0-1.8 0.15 228 0.151 0.129 0.574 0.159 -166.959
acc 0-1.8 0.20 214 0.200 0.176 0.586 0.139 -204.532
NDT minus the smallest RT kept: -0.030 to -0.011 s; NDT within 0.108 to 0.132 s in 1 of 16 fits
DDM fits with a uniform mixture of weight up to 0.3:
signal window n NDT mixture K B BIC
angle 0-1 247 0.028 0.161 2.839 0.817 -439.539
angle 0-1.8 245 0.013 0.158 2.815 0.850 -368.282
acc 0-1 246 0.003 0.237 2.906 0.843 -325.189
acc 0-1.8 244 0.003 0.243 2.839 0.815 -209.588
Likelihood profile, angle, 0 to 1 s, clearance c, sigma 0.25, mixture up to 0.1, NDT fixed (free fit: NDT 0.006):
NDT_fixed K B mixture BIC
0.00 2.841 0.887 0.1 -438.586
0.03 2.717 0.768 0.1 -437.885
0.06 2.579 0.652 0.1 -437.045
0.09 2.421 0.541 0.1 -435.917
0.12 2.241 0.434 0.1 -434.150
0.15 2.022 0.332 0.1 -430.823
BIC at NDT 0.12 minus the lowest BIC of the profile: 4.4
Result: partially reproduced. No reading gives a DDM nondecision time within 0.108 to 0.132 s: it is 0.000 to 0.005 s with all RTs kept, 0.000 to 0.039 s with the uniform mixture and 0.080 to 0.094 s with RTs below 0.1 s dropped (16 fits each). The GDDM BIC is below the DDM BIC in all 4 readings fitted with all RTs kept (-201.6 to -76.8 against 42.7 to 82.8) and with RTs below 0.1 s dropped (-441.5 to -343.8 against -298.4 to -266.4), but in none of the 4 with the mixture (-432.9 to -298.5 against -441.8 to -300.0). So only the GDDM condition holds, and only when the early RTs are not absorbed by the mixture.
The NDT is not well determined by these data. With all RTs kept it sits under the smallest RT (0.007 s). When RTs below a cutoff are dropped it follows the cutoff, 0.011 to 0.030 s under the smallest RT kept, so one of 16 cutoff fits (0.129 s, lateral acceleration, 0 to 1.8 s, cutoff 0.15 s) lands within tolerance because of the cutoff chosen, which is why these fits are shown as a check and not as readings. With the mixture, which lets the NDT move free of any cutoff, it stays at 0.000 to 0.039 s (0.003 to 0.028 s with a weight up to 0.3). The fitted mixture weight is at its limit of 0.1 in all 16 DDM fits (one GDDM fit is at 0.099); with a limit of 0.3 it is 0.158 to 0.243, below the limit but far above the 3 to 5% of OL_L RTs below 0.1 s (8 to 13 of 249). So the mixture absorbs more than the early RTs, which suggests the plain DDM misfits the shape of the RT distribution more broadly, and adds to the low confidence in this outcome. In the likelihood profile, NDT fixed at 0.12 s gives a BIC 4.4 above the best, at 0 s. The profile fits have the same number of parameters, so 4.4 is a deviance difference, and 0.12 s lies just outside a 95% profile-likelihood interval (p about 0.04): it is narrowly excluded.
The other values are also far from the paper's. DDM BIC is 42.7 to 205.9 with all RTs, -441.8 to -173.0 with the mixture and -298.4 to -119.4 with the cutoff (paper -664, none within tolerance); GDDM BIC is at best -441.5 (paper -705); bound B is within tolerance of 0.59 in 1 of 48 DDM fits; K/B is 0.30 to 4.06 (11.12). Drift K is within tolerance in 6, 4 and 0 of 16 fits under the three handlings; with sigma free, K, B and sigma trade off (only their ratios are identified). The GDDM leak is at the -10 edge of its range in all four fits with all RTs (-10.00 to -9.93), and at 2.50 to 9.99 under the other two handlings; with the cutoff it is 6.04 to 9.99, two of the four fits near the +10 edge. The GDDM was fitted only under sigma 0.25 and the 0 to 1 s window (4 of 16 readings per handling). Since the NDT condition fails in every reading, GDDM fits in the other readings could not change the outcome.
Blocked claims¶
Spike clock (metadata_insufficient). fig1lm-staged-modulation, fig1jk-all-units, fig1n-ramp-slope,
fig1o-trial-end-ramp, fig1-ramp-contralateral-only, fig2m-dimensionality-collapse, fig4b-ddm-matches-ramp,
fig5e-slope-across-animals, fig4f-varce-example-unit, fig4g-varce-population, fig4j-corce, fig4k-streak-index,
fig5b-epochs-in-subpopulations, fig5cd-other-animals and fig5e-principal-vs-neighbor all analyse spikes aligned to
the turn onset at a precision of 5 to 180 ms. The data check shows that the spikes are not on the clock of the trials
table, that the onset lags of 489 suggest a drifting offset but give no clock (no window's lag is separated from chance
and the speed correlations are weak), and that the alignment found for 503 from running speed is known only to
about 0.56 s. The claims that compare animals also lack 5 of their 7 animals (only 489 and 503 are in the
dataset). Parts of these claims that need no clock are counts: 489 has 61 units and 500 labelled OL trials, where
fig1jk-all-units gives 65 and 531, and its layer and FS/RS counts differ from those of fig5b-epochs-in-subpopulations
(table-s1-recordings section). These counts describe the recording, not the claims' findings, which stay untested.
Data not in the dataset (data_missing). fig2c-psychometric and fig2d-turn-angle need the psychometric animals
(474, 475, 499, 518) and the OL wall distance; fig2f-whisking-params, fig2i-ft-rt, fig2-epoch2-at-first-touch,
fig3-wall-kinematics, fig3c-touch-statistics, fig3ijkl-whisking-across-epochs and fig3-not-sensory-drive need
whisker tracking, touch times or wall positions, none of which are in the files, and animals 573 and 589;
fig2jk-glm-mixed-tuning and figs12-tuning-lost-during-decision need animal 579 and the whisker and gait regressors;
fig2l-running-vs-sitting is judged on animal 480. The paper names no other archive for these data. For fig2i-ft-rt
the RTs of 489 and 503 are in the fig4-ddm-fit section, but the claim's animals and first-touch times are not in the
dataset.
Summary¶
| Claim | Outcome |
|---|---|
| table-s1-recordings | not reproduced |
| fig1n-epoch-rates | not reproduced (epoch 1 rate; the timed values not tested) |
| figs1-running-speed | not reproduced |
| fig2a-success-rate | not reproduced |
| fig2b-lateral-spread | not reproduced |
| fig4-ddm-fit | partially reproduced |
| 15 claims on trial-aligned spikes | blocked: metadata_insufficient |
| 12 claims on whisker, touch, wall, gait or absent animals | 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. Only animals 489 and 503 are available. In 489 only the first 1000 trials carry usable labels and times (249 OL_L and 251 OL_R, where the paper uses 266 and 265, or 520 OL_L). The paper's trial selections (414 trials of 503, the 266 OL_L of 489) cannot be identified. Reaction-time maxima at the edge of the search window are dropped. The paper does not say how early RTs were handled in the DDM fits; three handlings are run (all kept, a uniform mixture, RTs below 0.1 s dropped). The GDDM was fitted only under the sigma 0.25 readings of the 0 to 1 s window. The epoch 1 rate is tested at every lag from -20 to 60 s, since the spike clock is unknown.
What was found about the dataset.
- The spike times are not on the clock of the trials table and the files hold no synchronisation signal, though the SI says TTL signals were used to synchronise them. In 489 the onset lags rise from 4.4 to 12.2 s over the first seven windows, but no window's lag is separated from chance and no clock can be fitted. In 503 the spike times are about 12 s later than the trial times and the gap grows by about 1.4 ms per s; on a clock fitted from running speed the trial type decodes from spike counts at 0.87 to 0.91, but that clock is known only to about 0.56 s, and since running differs by trial type in 503 the decoding may in part reflect running.
- The dataset holds 2 of the paper's 19 animals; no wall positions, whisker tracking, touch times or gait.
- In 489 the trials table rows 1000 to 1610 repeat one row; 256 of their 305 turns go right although all are labelled OL_L. In both sessions some 60 OL rows have stop times before their start times, and their sample timestamps restart at the previous trial's start.
- Unit counts (61 and 43) are below Table S1 (65 and 48), and 489's FS and RS counts (30 and 31) differ from Fig. 5B (43 and 22). Unit 489101 is FS by its waveform duration (0.2 ms) and labelled Inhibitory, where the paper calls it RS. 503 has three units labelled WM.
- The population rate of 489 is 6.65 to 7.80 Hz before the turn at any alignment, where the paper gives 2 Hz.
- The age of 489 is P63D in the file and 68 days from its date of birth; 503 runs at 13.1 cm/s in 27.7% of trials where Table S1 gives 16.1 cm/s and 52.8%, and in 1.7% of its OL_L trials.
print(f"notebook ran in {time.time() - started:.0f} s")
notebook ran in 332 s