Reproducing Tingley and Buzsaki (2018) on DANDI:000213¶

Paper. Tingley D, Buzsaki G (2018). Transformation of a Spatial Map across the Hippocampal-Lateral Septal Circuit. Neuron 98, 1229-1242. doi:10.1016/j.neuron.2018.04.028

Dataset. DANDI:000213, version 0.261109.2219 (doi:10.48324/dandi.000213/0.261109.2219), streamed from the archive. The paper cites no version. 0.261109.2219 is the most recent published version (2026-11-09). Its 67 files have the same paths as 0.250624.0438, but each is smaller (1,182 GB in all against 1,527 GB); the cell below prints this. The file descriptions say the LFP was taken from the earlier version and stored as the lab's int16 values instead of float32. The claims file's description (units with region labels, trials with linearized positions, LFP) matches it, so it is pinned.

Claims. claims/tingley-2018.yaml, written from the NIH author manuscript (PMC6605060) with its supplement, and checked by a second reader. This attempt is blind: no earlier attempt on the dataset was seen.

Method in brief. Each session's spikes within its trials are mapped to the lab's linearized position and to the CA1 theta phase (6 to 9 Hz, Hilbert). Per unit and included condition (>= 10 trials, >= 1.5 spikes per trial), the single-cell maximum correlation decoder runs on 20-bin smoothed rate and phase maps over 10 random 60/40 splits. Readings of the decoder: split by whole trials (a) or by trial-by-bin samples (b); 201 template bins (a) or 1.5 cm bins (b). Where no spike falls within a bin's smoothing window the phase is undefined; the paper does not say how such bins are treated. They are set to phase 0, as a zero-initialised phase map would give (adopted assumption). Leaving them out is shown as a variant: it lets the phase decoder read where the cell fires, so that phases shuffled within trials still beat chance and rate (the decoder calibration below). Reading codes: aa1, ba1, ab1, bb1 (split, bins; undefined phase set to 0) and aa0, ba0 (left out). Ties between equally near template bins are broken at random (assumption); sending them to the lowest bin is a variant.

Readings and outcomes. Each criterion is applied as written. Where it says a claim holds under one reading, every reading it names is run (split, bin count, rate map, and the claim's own readings), with undefined phase set to 0 and ties broken at random. The left-out variant and the lowest-bin variant are shown but do not decide an outcome. A rule that a criterion is met under any one reading for every claim was proposed after the second verification round, to change fig1i-hpc-rate-phase-equivalent to reproduced; the third round did not agree, as that criterion has no such clause, so fig1i is judged on the adopted reading aa1 and the proposal stands in the attempt record.

claim tested
ls-neuron-count yes
hpc-unit-count yes
ls-active-neurons yes
fig2-ls-phase-vs-shuffle yes
fig2-ls-phase-beats-rate yes
fig2e-ls-phase-lower-mse yes
fig2fg-mse-difference yes
fig1i-hpc-rate-phase-equivalent yes
ls-lower-peak-info yes
ls-few-place-fields yes
hpc-place-field-properties yes
ls-place-fields-unstable yes
fig1e-phase-info-smaller-scale yes
fig1g-phase-more-info-fine-scale yes
fig3-ls-phase-reliable yes
fig4d-depth-gradient yes
fig4e-onset-depth yes
fig4e-onset-mediolateral yes
speed-independent yes
fig5-assemblies yes, on a random sample of pairs
fig5g-assembly-neurons-stronger-phase yes, on the same sample
figs5-assembly-independent-of-locking yes, on the same sample
fig6-session-counts yes
fig6c-ca3-coherence-increases yes
fig6d-cfc-stronger-ca3 yes
fig6e-assembly-position yes, on the same sample
figs7-ensemble-ls-phase-best yes
figs2-rate-phase-independent yes
figs3-ls-major-target no (Allen data, not analysed)
figs6-reference-frame no (no rotation sessions marked in the files)
figs1f-trial-counts yes
fig7-dynamic-weighting-model no (model not run)
In [1]:
import os
os.environ.setdefault("OMP_NUM_THREADS", "1")
os.environ.setdefault("OPENBLAS_NUM_THREADS", "1")
import time, warnings, resource
from collections import Counter
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
import multiprocessing as mp
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import tingley as tg
warnings.filterwarnings("ignore", category=RuntimeWarning)
pd.set_option("display.width", 200)
pd.set_option("display.max_columns", 30)
T0 = time.time()
print("DANDI:%s version %s" % (tg.DANDISET, tg.VERSION))
DANDI:000213 version 0.261109.2219
In [2]:
# Assets of the pinned version, and how they differ from the previous published version
assets = tg.list_assets()
prev = tg.list_assets("0.250624.0438")
pp = {a["path"]: a["size"] for a in prev}
same_paths = sum(a["path"] in pp for a in assets)
print(f"{len(assets)} assets in {tg.VERSION}, {len(prev)} in 0.250624.0438, {same_paths} paths in both")
print(f"total size {sum(a['size'] for a in assets)/1e9:.0f} GB against {sum(pp.values())/1e9:.0f} GB")
smaller = [a["path"] for a in assets if a["path"] in pp and a["size"] < pp[a["path"]]]
print(f"{len(smaller)} files are smaller in {tg.VERSION} than in 0.250624.0438")
67 assets in 0.261109.2219, 67 in 0.250624.0438, 67 paths in both
total size 1182 GB against 1527 GB
67 files are smaller in 0.261109.2219 than in 0.250624.0438
In [3]:
# Stream and reduce every session (4 at a time); then analyse in 4 processes
SUBSET = None
todo = assets if SUBSET is None else [a for a in assets if any(s in a["path"] for s in SUBSET)]
t = time.time()
with ThreadPoolExecutor(4) as ex:
    sessions = list(ex.map(lambda a: tg.load_session(a, lfp_measures=tg.fig6_lfp_measures), todo))
print(f"loaded {len(sessions)} sessions in {time.time()-t:.0f} s; peak memory {resource.getrusage(resource.RUSAGE_SELF).ru_maxrss/1e6:.1f} GB")
seeds = {S["session"]: 1000 + i for i, S in enumerate(sessions)}
ctx = mp.get_context("fork")
t = time.time()
with ProcessPoolExecutor(4, mp_context=ctx) as ex:
    parts = list(ex.map(tg.analyse_session, sessions, [seeds[S["session"]] for S in sessions]))
D = pd.DataFrame([r for p in parts for r in p])
print(f"decoders, place fields and information for {len(D)} unit-conditions in {time.time()-t:.0f} s")
loaded 67 sessions in 649 s; peak memory 4.1 GB
decoders, place fields and information for 10476 unit-conditions in 465 s
In [4]:
# What was loaded: subjects, sessions, units by region, trials by task, and checks of the description
U_rows = []
for S in sessions:
    T = S["trials"]
    nt = len(T["start"])
    for ui, U in enumerate(S["units"] or []):
        U_rows.append({"session": S["session"], "subject": S["subject"], "unit": ui, "region": U["region"],
                       "n_in_trials": len(U["t"]), "ntrials": nt, "site": U["site"],
                       "n_incl": len(tg.included_conditions(S, U))})
UN = pd.DataFrame(U_rows)
print("sessions per subject:", dict(Counter(S["subject"] for S in sessions)))
print("sessions without a units table:", [S["session"] for S in sessions if S["units"] is None])
print("units by subject and region:")
print(pd.crosstab(UN.subject, UN.region, margins=True))
def task_of(S):
    T = S["trials"]
    tt = T["trial_type"]
    if (tt == "").all():
        task = S["description"].split("Task: ")[1].split(" (")[0]
        return np.array([task] * len(tt))
    return tt
tasks = Counter(x for S in sessions for x in task_of(S))
print("trials by task:", dict(tasks))
print("sessions whose description mentions a rotation:", [S["session"] for S in sessions if "rotat" in S["description"].lower()])
print("condition types:", dict(Counter(x for S in sessions for x in S["template_type"].values())))
print("trial counts per session: min %d, median %d, max %d" % tuple(np.percentile([len(S["trials"]["start"]) for S in sessions], [0, 50, 100])))
print("position units:", dict(Counter(S["pos_unit"] for S in sessions)), "sampling rates (Hz):", sorted(set(round(S["pos_rate"]) for S in sessions)))
scales = Counter(tg.length_scale(S) for S in sessions)
print("metres per stored unit, from template lengths:", dict(scales))
for S in sessions:
    L = np.median(list(S["template_len"].values()))
    if S["pos_unit"] == "meters" and tg.length_scale(S) == 1e-3:
        pass
mm = [S["session"] for S in sessions if tg.length_scale(S) == 1e-3]
print(f"{len(mm)} sessions labelled 'meters' whose template paths are {min(np.median(list(S['template_len'].values())) for S in sessions if S['session'] in mm):.0f} to {max(np.median(list(S['template_len'].values())) for S in sessions if S['session'] in mm):.0f} units long (mm):", sorted(set(S['subject'] for S in sessions if S['session'] in mm)))
print("template path lengths in m (metric sessions): %.2f to %.2f" % (
    min(min(S["template_len"].values()) * tg.length_scale(S) for S in sessions if np.isfinite(tg.length_scale(S))),
    max(max(S["template_len"].values()) * tg.length_scale(S) for S in sessions if np.isfinite(tg.length_scale(S)))))
print("template points per condition:", sorted(set(S["template_points"] for S in sessions)))
print("phase reference other than a CA1 channel:", {S["session"]: S["phase_ref"] for S in sessions if S["phase_ref"] not in ("ca1", None)})
print("LFP channels flagged (sessions with ca1, ca3, ls):",
      sum(bool(S["chan"]["ca1"]) for S in sessions), sum(bool(S["chan"]["ca3"]) for S in sessions), sum(bool(S["chan"]["ls"]) for S in sessions))
# clocks: linearized samples inside their trial; spikes against LFP; spikes against position
inside = np.mean([np.mean((S["trials"]["lints"][j] >= S["trials"]["start"][j] - 1e-6) & (S["trials"]["lints"][j] <= S["trials"]["stop"][j] + 1e-6))
                  for S in sessions for j in range(len(S["trials"]["start"])) if len(S["trials"]["lints"][j])])
print(f"fraction of linearized-position samples inside their trial interval: {inside:.4f}")
rl = []
for S in sessions:
    R0, R1 = [], []
    for U in S["units"] or []:
        if U["region"] in tg.HPC_LABELS and len(U["t"]) > 200 and "phase" in U:
            R0.append(np.abs(np.mean(np.exp(1j * U["phase"]))))
            R1.append(np.abs(np.mean(np.exp(1j * U["phase_shift"]))))
    if R0:
        rl.append((S["session"], np.median(R0), np.median(R1)))
rl = pd.DataFrame(rl, columns=["session", "R_true", "R_shift1s"])
print(f"hippocampal theta locking (median resultant length per session): true spike times {rl.R_true.median():.3f}, "
      f"spikes shifted 1 s {rl.R_shift1s.median():.3f}; sessions where true > shifted: {(rl.R_true > rl.R_shift1s).sum()}/{len(rl)}")
print("sessions where it is not:", rl[rl.R_true <= rl.R_shift1s].session.tolist())
cr = []
rng_clock = np.random.default_rng(7)
rng_clock_low = np.random.default_rng(8)
for S in sessions:
    m0, m1, l0, l1 = [], [], [], []
    for U in S["units"] or []:
        if U["region"] not in tg.HPC_LABELS:
            continue
        for c in tg.included_conditions(S, U)[:2]:
            M = tg.maps(S, U, c, "a")
            Us = dict(U, bin=U["bin_shift"])
            Ms = tg.maps(S, Us, c, "a")
            m0.append(np.nanmean(tg.decode(tg.box_fast(M["rate"], 20), rng_clock, "a", n_splits=3)))
            m1.append(np.nanmean(tg.decode(tg.box_fast(Ms["rate"], 20), rng_clock, "a", n_splits=3)))
            l0.append(np.nanmean(tg.decode(tg.box_fast(M["rate"], 20), rng_clock_low, "a", n_splits=3, ties="low")))
            l1.append(np.nanmean(tg.decode(tg.box_fast(Ms["rate"], 20), rng_clock_low, "a", n_splits=3, ties="low")))
    if m0:
        cr.append((S["session"], np.median(m0), np.median(m1), np.median(l0), np.median(l1)))
cr = pd.DataFrame(cr, columns=["session", "mse_true", "mse_shift1s", "low_true", "low_shift1s"])
print(f"hippocampal rate decoding (median MSE per session, bins^2): spike positions as recorded {cr.mse_true.median():.0f}, "
      f"taken 1 s later {cr.mse_shift1s.median():.0f}; sessions where recorded < shifted: {(cr.mse_true < cr.mse_shift1s).sum()}/{len(cr)}")
print("sessions where it is not:", cr[cr.mse_true >= cr.mse_shift1s].session.tolist())
print(f"   the same with ties sent to the lowest bin (variant): recorded {cr.low_true.median():.0f}, 1 s later {cr.low_shift1s.median():.0f}; "
      f"sessions where recorded < shifted: {(cr.low_true < cr.low_shift1s).sum()}/{len(cr)}; not: {cr[cr.low_true >= cr.low_shift1s].session.tolist()}")
print("unit-conditions analysed by region:", D.region.value_counts().to_dict())
print("undefined smoothed phase (fraction of trial-by-bin samples), median: LS %.2f, hippocampal %.2f" % (
    D[D.region == "ls"]["aa1_phase_defined"].rsub(1).median(), D[D.region.isin(tg.HPC_LABELS)]["aa1_phase_defined"].rsub(1).median()))
# hippocampal channels against hippocampal units, by subject
hc = pd.DataFrame([{"subject": S["subject"], "hpc_channels": int(np.isin(S["elec_region"], tg.HPC_LABELS).sum()) > 0,
                    "ca1_flagged": bool(S["chan"]["ca1"]), "hpc_units": sum(U["region"] in tg.HPC_LABELS for U in (S["units"] or []))}
                   for S in sessions])
print("sessions with hippocampal channels / a flagged CA1 channel / hippocampal units, by subject:")
print(hc.groupby("subject").agg(sessions=("subject", "size"), with_hpc_channels=("hpc_channels", "sum"),
                                with_ca1_channel=("ca1_flagged", "sum"), hpc_units=("hpc_units", "sum")))
# decoder chance levels and tie handling, main reading (aa1), 201 bins
uni = 2 * (201 ** 2 - 1) / 12
for reg, m in (("LS", D.region == "ls"), ("hippocampal", D.region.isin(tg.HPC_LABELS))):
    X = D[m & (D.cm_per_bin_a > 0)]
    med = lambda k: X[k].apply(np.nanmean).median()
    print(f"{reg}, median MSE over conditions (bins^2), ties at random: rate {med('aa1_rate'):.0f}, rate chance {med('aa1_chance_rate'):.0f}, "
          f"phase {med('aa1_phase_cos'):.0f}, phase chance {med('aa1_chance_phase'):.0f}; ties to the lowest bin: rate {med('aa1_rate_low'):.0f}, "
          f"phase {med('aa1_phase_cos_low'):.0f}, phase chance {med('aa1_chance_phase_low'):.0f}; uniform guessing over 201 bins {uni:.0f}")
print("trials table description (first file):", sessions[0]["trials_description"][:400])
print("bins per condition, reading (b) 1.5 cm: %d to %d (reading (a): 201)" % (np.nanmin(D.nbins_b), np.nanmax(D.nbins_b)))
sessions per subject: {'DT2': 11, 'DT5': 16, 'DT7': 9, 'DT8': 17, 'DT9': 14}
sessions without a units table: ['20170324-576um-144um-170324-123932']
units by subject and region:
region   acg  ca3  cc   hpc    ls  ms  ppc  sFi   All
subject                                              
DT2        0    0   0  1035   375   0   28    0  1438
DT5        0  279   0   329   480   0    0    0  1088
DT7       31    0   6   489    60  25    0   54   665
DT8        0    0   0     0   296   0   32    0   328
DT9        0  345   0   783   485   0    0    0  1613
All       31  624   6  2636  1696  25   60   54  5132
trials by task: {np.str_('wheel alternation'): 3987, np.str_('central alternation'): 5219, np.str_('linear'): 701}
sessions whose description mentions a rotation: []
condition types: {'wheel': 211, 'central': 254, 'linear': 20, '': 2, 'nan': 2}
trial counts per session: min 17, median 134, max 326
position units: {'pixels': 11, 'meters': 56} sampling rates (Hz): [30, 120]
metres per stored unit, from template lengths: {nan: 11, 1.0: 25, 0.001: 31}
31 sessions labelled 'meters' whose template paths are 1329 to 2934 units long (mm): ['DT7', 'DT8', 'DT9']
template path lengths in m (metric sessions): 0.97 to 3.13
template points per condition: [151, 201]
phase reference other than a CA1 channel: {'20170317-288um-0um-merge': 'hippocampal theta channel 53', '20170518-828um-864um-merge': 'hippocampal theta channel 69', '20170519-864um-900um-merge': 'hippocampal theta channel 69', '20170521-900um-936um-170521-125602': 'hippocampal theta channel 69', '20170522-900um-936um-170522-151132': 'hippocampal theta channel 79', '20170525-900um-936um-170525-150124': 'hippocampal theta channel 69'}
LFP channels flagged (sessions with ca1, ca3, ls): 61 19 66
fraction of linearized-position samples inside their trial interval: 0.9973
hippocampal theta locking (median resultant length per session): true spike times 0.179, spikes shifted 1 s 0.053; sessions where true > shifted: 47/47
sessions where it is not: []
hippocampal rate decoding (median MSE per session, bins^2): spike positions as recorded 6262, taken 1 s later 6537; sessions where recorded < shifted: 30/47
sessions where it is not: ['DT2-rPPC-rCCG-3396um-1180um-20160220-160220-141839', 'DT2-rPPC-rCCG-3396um-1180um-20160221-160221-135947', '20161011-972um-1224um-merge', '20161015-1368um-1476um-merge', '20161019-1624um-2340um-161019-095311', '20161021-1840um-2412um-merge', '20161023-1872um-2448um-161023-123504', '20161026-1944um-2232um-merge', '20170401-864um-936um-merge', '20170412-1440um-1170um-170412-103153', '20170502-288um-0um-merge', '20170504-396um-0um-merge', '20170507-468um-36um-merge', '20170518-828um-864um-merge', '20170521-900um-936um-170521-125602', '20170522-900um-936um-170522-151132', '20170525-900um-936um-170525-150124']
   the same with ties sent to the lowest bin (variant): recorded 7701, 1 s later 10684; sessions where recorded < shifted: 43/47; not: ['20161011-972um-1224um-merge', '20161021-1840um-2412um-merge', '20161023-1872um-2448um-161023-123504', '20170401-864um-936um-merge']
unit-conditions analysed by region: {np.str_('hpc'): 5095, np.str_('ls'): 4362, np.str_('ca3'): 628, np.str_('acg'): 173, np.str_('ppc'): 130, np.str_('ms'): 32, np.str_('cc'): 29, np.str_('sFi'): 27}
undefined smoothed phase (fraction of trial-by-bin samples), median: LS 0.67, hippocampal 0.74
sessions with hippocampal channels / a flagged CA1 channel / hippocampal units, by subject:
         sessions  with_hpc_channels  with_ca1_channel  hpc_units
subject                                                          
DT2            11                 11                11       1035
DT5            16                 16                16        608
DT7             9                  9                 8        489
DT8            17                 17                17          0
DT9            14                 14                 9       1128
LS, median MSE over conditions (bins^2), ties at random: rate 6793, rate chance 6701, phase 6980, phase chance 6705; ties to the lowest bin: rate 7318, phase 7442, phase chance 7427; uniform guessing over 201 bins 6733
hippocampal, median MSE over conditions (bins^2), ties at random: rate 6329, rate chance 6729, phase 6580, phase chance 6706; ties to the lowest bin: rate 7537, phase 7703, phase chance 8107; uniform guessing over 201 bins 6733
trials table description (first file): Trials of the session's task ('wheel alternation'): only ballistic runs, without stopping or leaving the trained path, were kept by the lab (about 90-95% of the attempted trials). Start and stop times are the lab's behavior.events.trialIntervals; the rows are sorted by start time, each with its own labels (the earlier conversion sorted the rows but not the labels).
bins per condition, reading (b) 1.5 cm: 88 to 209 (reading (a): 201)

ls-neuron-count¶

A total of 1,647 LS neurons were recorded from five animals, in 62 sessions.

In [5]:
ls_units = UN[UN.region == "ls"]
print("LS units:", len(ls_units), "| sessions with LS units:", ls_units.session.nunique(), "| animals:", ls_units.subject.nunique())
print(ls_units.groupby("subject").agg(units=("unit", "size"), sessions=("session", "nunique")))
LS units: 1696 | sessions with LS units: 62 | animals: 5
         units  sessions
subject                 
DT2        375        11
DT5        480        16
DT7         60         4
DT8        296        17
DT9        485        14

Result: reproduced. 1,696 units are labelled LS (1,647 +/- 164.7), in 62 sessions (62 +/- 6.2), from all five animals.

hpc-unit-count¶

The hippocampal recordings hold 2,297 isolated CA1 units and 654 CA3 units (2,951 in all), with 1,587 CA1 and 224 CA3 place fields.

In [6]:
ca3_sessions = {S["session"] for S in sessions if S["chan"]["ca3"]}
hp = UN[UN.region.isin(tg.HPC_LABELS)].copy()
hp["sub_session"] = np.where(hp.session.isin(ca3_sessions), "CA3", "CA1")
hp["sub_label"] = np.where(hp.region == "ca3", "CA3", "CA1")
print("hippocampal units:", len(hp), "| labels:", hp.region.value_counts().to_dict())
print("session reading (CA3 when the session has a CA3 site):", hp.sub_session.value_counts().to_dict())
print("unit label reading:", hp.sub_label.value_counts().to_dict())
Dh = D[D.region.isin(tg.HPC_LABELS)].copy()
Dh["sub_session"] = np.where(Dh.session.isin(ca3_sessions), "CA3", "CA1")
Dh["sub_label"] = np.where(Dh.region == "ca3", "CA3", "CA1")
for pr in "ab":
    print(f"place fields (conditions with a field, rate map reading {pr}):",
          Dh[Dh[f"pf{pr}_n"] > 0].groupby("sub_session").size().to_dict(), "(session reading);",
          Dh[Dh[f"pf{pr}_n"] > 0].groupby("sub_label").size().to_dict(), "(unit labels)")
hippocampal units: 3260 | labels: {np.str_('hpc'): 2636, np.str_('ca3'): 624}
session reading (CA3 when the session has a CA3 site): {'CA1': 2261, 'CA3': 999}
unit label reading: {'CA1': 2636, 'CA3': 624}
place fields (conditions with a field, rate map reading a): {'CA1': 1444, 'CA3': 196} (session reading); {'CA1': 1531, 'CA3': 109} (unit labels)
place fields (conditions with a field, rate map reading b): {'CA1': 1642, 'CA3': 282} (session reading); {'CA1': 1772, 'CA3': 152} (unit labels)

Result: not reproduced. The files hold 3,260 hippocampal units (2,951 in the paper). By session (CA3 where the session has a CA3 site) they split into 2,261 CA1 and 999 CA3; by unit label into 2,636 'hpc' and 624 'ca3'. Under the session reading the CA1 count is within 229.7 of 2,297 and the CA3 count is not; under unit labels the CA3 count is within 65.4 of 654 and the CA1 count is not. No reading puts both within tolerance. The place-field counts are reported above, not judged.

ls-active-neurons¶

Of the 1,647 LS neurons, 840 fired at least 1.5 action potentials per trial on average.

In [7]:
act_a = ls_units[ls_units.n_incl > 0]
act_b = ls_units[ls_units.n_in_trials >= 1.5 * ls_units.ntrials]
print(f"(a) LS units with at least one included condition: {len(act_a)} of {len(ls_units)}")
print(f"(b) LS units with spikes over all trials >= 1.5 x trials: {len(act_b)} of {len(ls_units)}")
print(act_a.groupby("subject").size().to_dict())
ACTIVE = set(zip(act_a.session, act_a.unit))
(a) LS units with at least one included condition: 829 of 1696
(b) LS units with spikes over all trials >= 1.5 x trials: 708 of 1696
{'DT2': 182, 'DT5': 317, 'DT7': 16, 'DT8': 131, 'DT9': 183}

Result: reproduced under reading (a). 829 LS units have at least one included condition (840 +/- 84); under reading (b), spikes over all of the session's trials, 708 pass.

In [8]:
# Per-condition tests over the 10 splits, for every reading
def p_less(a, b):
    a, b = np.asarray(a), np.asarray(b)
    a, b = a[~np.isnan(a)], b[~np.isnan(b)]
    if len(a) < 2 or len(b) < 2:
        return np.nan
    return stats.ttest_ind(a, b).pvalue
RD = [r for r in tg.READINGS if f"{r}_rate" in D]
# conditions whose 1.5 cm map has the same bin count as the 201-point map (the pixel sessions of DT2,
# which keep reading (a); tg.n_bins) take the reading (a) result under the 1.5 cm readings
for rb, ra in (("ab1", "aa1"), ("bb1", "ba1")):
    miss = D[f"{rb}_rate"].isna() & D[f"{ra}_rate"].notna()
    for k in ("rate", "phase_cos", "chance_phase", "phase_defined"):
        D[f"{rb}_{k}"] = [a if m_ else b for m_, a, b in zip(miss, D[f"{ra}_{k}"], D[f"{rb}_{k}"])]
    print(f"{rb}: {int(miss.sum())} unit-conditions keep 201 bins and take the {ra} result")
    if f"null_{rb}_rate" in D:
        nmiss = D[f"null_{rb}_rate"].isna() & D[f"null_{ra}_rate"].notna()
        for k in ("rate", "phase_cos", "chance_phase"):
            D[f"null_{rb}_{k}"] = [a if m_ else b for m_, a, b in zip(nmiss, D[f"null_{ra}_{k}"], D[f"null_{rb}_{k}"])]
for rd in RD:
    has = D[f"{rd}_rate"].notna()
    D.loc[has, f"{rd}_mrate"] = D.loc[has, f"{rd}_rate"].apply(np.nanmean)
    D.loc[has, f"{rd}_mphase"] = D.loc[has, f"{rd}_phase_cos"].apply(np.nanmean)
    D.loc[has, f"{rd}_mchance"] = D.loc[has, f"{rd}_chance_phase"].apply(np.nanmean)
    D.loc[has, f"{rd}_d"] = D.loc[has, f"{rd}_mphase"] - D.loc[has, f"{rd}_mrate"]
    D.loc[has, f"{rd}_p_vs_chance"] = [p_less(a, b) for a, b in zip(D.loc[has, f"{rd}_phase_cos"], D.loc[has, f"{rd}_chance_phase"])]
    D.loc[has, f"{rd}_p_vs_rate"] = [p_less(a, b) for a, b in zip(D.loc[has, f"{rd}_phase_cos"], D.loc[has, f"{rd}_rate"])]
    D[f"{rd}_sig_chance"] = (D[f"{rd}_p_vs_chance"] < 0.01) & (D[f"{rd}_mphase"] < D[f"{rd}_mchance"])
    D[f"{rd}_sig_rate"] = (D[f"{rd}_p_vs_rate"] < 0.01) & (D[f"{rd}_mphase"] < D[f"{rd}_mrate"])
# variant of the main reading with ties sent to the lowest bin
D["aa1low_mrate"] = D["aa1_rate_low"].apply(np.nanmean); D["aa1low_mphase"] = D["aa1_phase_cos_low"].apply(np.nanmean)
D["aa1low_d"] = D["aa1low_mphase"] - D["aa1low_mrate"]
NAMES = {"aa1": "split trials, 201 bins, undefined phase = 0 (adopted)", "ba1": "split samples, 201 bins, = 0",
         "ab1": "split trials, 1.5 cm bins, = 0", "bb1": "split samples, 1.5 cm bins, = 0",
         "aa0": "split trials, 201 bins, undefined phase left out (variant)", "ba0": "split samples, 201 bins, left out (variant)"}
DL = D[D.region == "ls"].copy()
DL["key"] = list(zip(DL.session, DL.unit))
print("LS included conditions:", len(DL), "| neurons:", DL.key.nunique())
print("readings:", NAMES)
print("LS conditions under the 1.5 cm readings with 201 bins (pixel sessions, DT2):", int((DL.nbins_b.isna() | (DL.nbins_b == 201)).sum()))
ab1: 3848 unit-conditions keep 201 bins and take the aa1 result
bb1: 3848 unit-conditions keep 201 bins and take the ba1 result
LS included conditions: 4362 | neurons: 829
readings: {'aa1': 'split trials, 201 bins, undefined phase = 0 (adopted)', 'ba1': 'split samples, 201 bins, = 0', 'ab1': 'split trials, 1.5 cm bins, = 0', 'bb1': 'split samples, 1.5 cm bins, = 0', 'aa0': 'split trials, 201 bins, undefined phase left out (variant)', 'ba0': 'split samples, 201 bins, left out (variant)'}
LS conditions under the 1.5 cm readings with 201 bins (pixel sessions, DT2): 1026

Decoder calibration¶

Shared by the decoding claims. Two checks of how often the decoder finds phase coding where there is none. (1) Synthetic place cells (Poisson spikes in a 40-bin field of 10 Hz, 30 trials) whose spike phases are uniformly random. (2) Real data: in every LS unit-condition and a random quarter of the hippocampal ones, under all six decoder readings, each trial's spike phases are circularly shifted among its spikes, so that the cell fires where it fired but its phases no longer depend on position. A valid test should pass about 1% of such cells at p < 0.01.

In [9]:
rng_cal = np.random.default_rng(11)
def synth_cell(rng, ntr=30, nb=201, peak=10.0, lo=80, hi=120, dt=0.02):
    lam = np.zeros(nb); lam[lo:hi] = peak * np.sin(np.linspace(0, np.pi, hi - lo))
    occ = np.full((ntr, nb), dt)
    cnt = rng.poisson(lam * dt, (ntr, nb)).astype(float)
    ph = np.where(cnt > 0, rng.uniform(-np.pi, np.pi, (ntr, nb)), np.nan)
    return {"rate": cnt / occ, "phase": ph, "count": cnt, "occ": occ, "nb": nb}
res = []
for k in range(200):
    M = synth_cell(rng_cal)
    for rd in ("aa1", "ba1", "aa0", "ba0"):
        r = tg.decode_unit(M, rng_cal, rd[0], fill=(None if rd[2] == "0" else 0.0))
        res.append({"reading": rd, "vs_chance": (p_less(r["phase_cos"], r["chance_phase"]) < 0.01) and np.nanmean(r["phase_cos"]) < np.nanmean(r["chance_phase"]),
                    "vs_rate": (p_less(r["phase_cos"], r["rate"]) < 0.01) and np.nanmean(r["phase_cos"]) < np.nanmean(r["rate"]),
                    "phase": np.nanmean(r["phase_cos"]), "rate": np.nanmean(r["rate"])})
res = pd.DataFrame(res)
print("(1) synthetic place cells with random phases, 200 cells; fraction passing at p < 0.01:")
print(res.groupby("reading").agg(phase_beats_chance=("vs_chance", "mean"), phase_beats_rate=("vs_rate", "mean"),
                                  phase_mse=("phase", "mean"), rate_mse=("rate", "mean")).round(3).to_string())
for rd in tg.NULL_READINGS:
    m = D.null.astype(bool)
    D[f"null_{rd}_sig_chance"] = False; D[f"null_{rd}_sig_rate"] = False
    D.loc[m, f"null_{rd}_sig_chance"] = [(p_less(a, b) < 0.01) and np.nanmean(a) < np.nanmean(b) for a, b in zip(D.loc[m, f"null_{rd}_phase_cos"], D.loc[m, f"null_{rd}_chance_phase"])]
    D.loc[m, f"null_{rd}_sig_rate"] = [(p_less(a, b) < 0.01) and np.nanmean(a) < np.nanmean(b) for a, b in zip(D.loc[m, f"null_{rd}_phase_cos"], D.loc[m, f"null_{rd}_rate"])]
NL = D[D.null.astype(bool)]
print("null computed for all", int((NL.region == "ls").sum()), "LS unit-conditions and", int(NL.region.isin(tg.HPC_LABELS).sum()), "hippocampal ones (a random quarter)")
out = []
for rd in tg.NULL_READINGS:
    for reg, m in (("LS", NL.region == "ls"), ("hippocampal", NL.region.isin(tg.HPC_LABELS))):
        X = NL[m]
        ph = X[f"null_{rd}_phase_cos"]; ch = X[f"null_{rd}_chance_phase"]; ra = X[f"null_{rd}_rate"]
        vc = X[f"null_{rd}_sig_chance"].mean(); vr = X[f"null_{rd}_sig_rate"].mean()
        out.append({"reading": rd, "region": reg, "conditions": len(X), "null_beats_chance": round(vc, 3),
                    "real_beats_chance": round(X[f"{rd}_sig_chance"].mean(), 3), "null_beats_rate": round(vr, 3),
                    "real_beats_rate": round(X[f"{rd}_sig_rate"].mean(), 3),
                    "null_phase_mse": round(np.mean([np.nanmean(a) for a in ph]), 0), "real_phase_mse": round(X[f"{rd}_mphase"].mean(), 0)})
CAL = pd.DataFrame(out)
print("(2) real data, phases circularly shifted within trials, per condition; fraction passing at p < 0.01, null against real:")
print(CAL.to_string(index=False))
(1) synthetic place cells with random phases, 200 cells; fraction passing at p < 0.01:
         phase_beats_chance  phase_beats_rate  phase_mse  rate_mse
reading                                                           
aa0                   0.105             1.000    608.343  7057.886
aa1                   0.035             0.005   7122.900  7065.926
ba0                   0.215             1.000    585.302  7051.159
ba1                   0.010             0.000   7115.306  7059.370
null computed for all 4362 LS unit-conditions and 1410 hippocampal ones (a random quarter)
(2) real data, phases circularly shifted within trials, per condition; fraction passing at p < 0.01, null against real:
reading      region  conditions  null_beats_chance  real_beats_chance  null_beats_rate  real_beats_rate  null_phase_mse  real_phase_mse
    aa1          LS        4362              0.119              0.132            0.037            0.044          7105.0          7067.0
    aa1 hippocampal        1410              0.233              0.255            0.028            0.048          6641.0          6573.0
    ba1          LS        4362              0.160              0.172            0.059            0.076          6935.0          6905.0
    ba1 hippocampal        1410              0.271              0.309            0.055            0.071          6538.0          6495.0
    aa0          LS        4362              0.173              0.236            0.207            0.241          6595.0          6391.0
    aa0 hippocampal        1410              0.242              0.334            0.357            0.391          5613.0          5385.0
    ba0          LS        4362              0.560              0.610            0.466            0.489          5238.0          5054.0
    ba0 hippocampal        1410              0.604              0.660            0.535            0.570          4472.0          4284.0
    ab1          LS        4362              0.108              0.124            0.038            0.052          4967.0          4951.0
    ab1 hippocampal        1410              0.223              0.246            0.026            0.050          5450.0          5391.0
    bb1          LS        4362              0.150              0.169            0.060            0.082          4844.0          4823.0
    bb1 hippocampal        1410              0.276              0.292            0.059            0.079          5353.0          5318.0

Calibration, as printed above. With undefined phase left out, synthetic cells with random phases beat rate in all 200 cases (aa0, ba0), and real cells with shifted phases beat rate in 0.207 to 0.535 of conditions, close to the real fractions: under that treatment the phase decoder reads where the cell fires. With undefined phase set to 0, synthetic cells beat rate in 0.005 or none, and shifted real phases in 0.026 to 0.060 of conditions (all four readings, LS and hippocampal), against 0.044 to 0.082 for the real phases. That is about 3 to 6 times the nominal 1%, so even with phase 0 the phase-against-rate test passes shifted phases more often than it should, though less often than real phases. The phase-against-chance test passes shifted phases in 0.108 to 0.604 of conditions under every treatment, close to the real fractions, because the chance permutes positions and so removes where the cell fires as well as its phases. The decoder is also weak as a decoder: the median hippocampal rate MSE is 6,329 bins squared under aa1 against 6,733 for uniform guessing, and rate decoding with the recorded positions beats positions taken 1 s later in only 30 of 47 sessions (data check). Every decoding outcome below shows what this decoder does on these files; it does not bound what the paper's decoder found.

fig2-ls-phase-vs-shuffle¶

The majority of LS neurons (751 of 840, 89%) showed position encoding in their spike theta phase, compared with shuffled data, in at least one condition.

In [10]:
out = []
for rd in RD:
    sub = DL[DL[f"{rd}_rate"].notna() | (rd[1] == "a")]
    g = sub.groupby("key")[f"{rd}_sig_chance"].any()
    g = g.reindex(sorted(ACTIVE) if rd[1] == "a" else [k for k in sorted(ACTIVE) if k in set(sub.key)], fill_value=False)
    out.append({"reading": rd, "what": NAMES[rd], "neurons": len(g), "significant": int(g.sum()), "fraction": g.mean(),
                "conditions_sig": f"{int(sub[f'{rd}_sig_chance'].sum())}/{len(sub)}"})
fig2a = pd.DataFrame(out)
print(fig2a.to_string(index=False))
DLn = D[(D.region == "ls")].copy(); DLn["key"] = list(zip(DLn.session, DLn.unit))
for rd in tg.NULL_READINGS:
    g = DLn.groupby("key")[f"null_{rd}_sig_chance"].any().reindex(sorted(ACTIVE), fill_value=False)
    print(f"null (phases shifted within trials), {rd}: {int(g.sum())}/{len(g)} = {g.mean():.3f} of neurons pass in at least one condition; "
          f"conditions {DLn[f'null_{rd}_sig_chance'].mean():.3f}")
print("per animal, main reading:", DL.groupby(["subject", "key"])[f"{tg.MAIN}_sig_chance"].any().groupby("subject").mean().round(3).to_dict())
reading                                                       what  neurons  significant  fraction conditions_sig
    aa1      split trials, 201 bins, undefined phase = 0 (adopted)      829          336  0.405308       574/4362
    ba1                               split samples, 201 bins, = 0      829          414  0.499397       751/4362
    ab1                             split trials, 1.5 cm bins, = 0      829          327  0.394451       539/4362
    bb1                            split samples, 1.5 cm bins, = 0      829          402  0.484922       736/4362
    aa0 split trials, 201 bins, undefined phase left out (variant)      829          492  0.593486      1030/4362
    ba0                split samples, 201 bins, left out (variant)      829          731  0.881785      2659/4362
null (phases shifted within trials), aa1: 315/829 = 0.380 of neurons pass in at least one condition; conditions 0.119
null (phases shifted within trials), ba1: 391/829 = 0.472 of neurons pass in at least one condition; conditions 0.160
null (phases shifted within trials), aa0: 444/829 = 0.536 of neurons pass in at least one condition; conditions 0.173
null (phases shifted within trials), ba0: 702/829 = 0.847 of neurons pass in at least one condition; conditions 0.560
null (phases shifted within trials), ab1: 292/829 = 0.352 of neurons pass in at least one condition; conditions 0.108
null (phases shifted within trials), bb1: 376/829 = 0.454 of neurons pass in at least one condition; conditions 0.150
per animal, main reading: {'DT2': 0.341, 'DT5': 0.385, 'DT7': 0.875, 'DT8': 0.412, 'DT9': 0.459}

Result: not reproduced, resting on the assumption that undefined phase is set to 0. Under the four readings of split and bin count with that assumption, 0.394 to 0.499 of the 829 active LS neurons have phase MSE below chance at p < 0.01 in at least one condition (aa1: 336, 0.405), against 0.89 +/- 0.089. Phases shifted within trials pass in 0.352 to 0.472 of neurons (aa1 0.380, ba1 0.472, ab1 0.352, bb1 0.454), close to the real fractions. With undefined phase left out (variant) the samples split gives 0.882, within tolerance, but shifted phases then pass in 0.847 of neurons, so under that variant the test does not measure phase coding.

fig2-ls-phase-beats-rate¶

Spike-phase decoding outperformed rate decoding of the rat's position for 786 of 840 LS neurons, 3,046 of 4,393 conditions, and 62 of 62 sessions.

In [11]:
out = []
for rd in RD:
    sub = DL[DL[f"{rd}_rate"].notna()]
    g = sub.groupby("key")[f"{rd}_sig_rate"].any()
    g = g.reindex(sorted(ACTIVE) if rd[1] == "a" else [k for k in sorted(ACTIVE) if k in set(sub.key)], fill_value=False)
    ca = sub[f"{rd}_sig_rate"].mean()
    cb = (sub[f"{rd}_mphase"] < sub[f"{rd}_mrate"]).mean()
    ss = sub.groupby("session")[[f"{rd}_mphase", f"{rd}_mrate"]].mean()
    out.append({"reading": rd, "neurons": f"{int(g.sum())}/{len(g)}", "neuron_frac": round(g.mean(), 3),
                "cond_frac_test": round(ca, 3), "cond_frac_lower": round(cb, 3), "conditions": len(sub),
                "sessions": f"{int((ss.iloc[:,0] < ss.iloc[:,1]).sum())}/{len(ss)}",
                "session_frac": round((ss.iloc[:, 0] < ss.iloc[:, 1]).mean(), 3)})
fig2b = pd.DataFrame(out)
print(fig2b.to_string(index=False))
print("expected: neurons 0.936 +/- 0.064, conditions 0.693 +/- 0.069, sessions 1.0 +/- 0.1")
DLn = D[(D.region == "ls")].copy(); DLn["key"] = list(zip(DLn.session, DLn.unit))
for rd in tg.NULL_READINGS:
    g = DLn.groupby("key")[f"null_{rd}_sig_rate"].any().reindex(sorted(ACTIVE), fill_value=False)
    lower = np.array([np.nanmean(a) < np.nanmean(b) for a, b in zip(DLn[f"null_{rd}_phase_cos"], DLn[f"null_{rd}_rate"])])
    DLn["_pn"] = [np.nanmean(a) for a in DLn[f"null_{rd}_phase_cos"]]; DLn["_rn"] = [np.nanmean(a) for a in DLn[f"null_{rd}_rate"]]
    ss = DLn.groupby("session")[["_pn", "_rn"]].mean()
    print(f"null (phases shifted within trials), {rd}: neurons {g.mean():.3f}, conditions by test {DLn[f'null_{rd}_sig_rate'].mean():.3f}, "
          f"by lower mean {lower.mean():.3f}, sessions {(ss._pn < ss._rn).mean():.3f}")
reading neurons  neuron_frac  cond_frac_test  cond_frac_lower  conditions sessions  session_frac
    aa1 143/829        0.172           0.044            0.433        4362    13/60         0.217
    ba1 229/829        0.276           0.076            0.401        4362     5/60         0.083
    ab1 165/829        0.199           0.052            0.429        4362    13/60         0.217
    bb1 252/829        0.304           0.082            0.394        4362     7/60         0.117
    aa0 509/829        0.614           0.241            0.560        4362    53/60         0.883
    ba0 659/829        0.795           0.489            0.677        4362    60/60         1.000
expected: neurons 0.936 +/- 0.064, conditions 0.693 +/- 0.069, sessions 1.0 +/- 0.1
null (phases shifted within trials), aa1: neurons 0.171, conditions by test 0.037, by lower mean 0.413, sessions 0.183
null (phases shifted within trials), ba1: neurons 0.233, conditions by test 0.059, by lower mean 0.385, sessions 0.133
null (phases shifted within trials), aa0: neurons 0.559, conditions by test 0.207, by lower mean 0.520, sessions 0.683
null (phases shifted within trials), ba0: neurons 0.777, conditions by test 0.466, by lower mean 0.655, sessions 0.967
null (phases shifted within trials), ab1: neurons 0.166, conditions by test 0.038, by lower mean 0.419, sessions 0.200
null (phases shifted within trials), bb1: neurons 0.230, conditions by test 0.060, by lower mean 0.391, sessions 0.117

Result: not reproduced, resting on the same assumption. Under the four readings with undefined phase set to 0, phase beats rate in 0.172 to 0.304 of neurons, 0.044 to 0.082 of conditions by the t test or 0.394 to 0.433 by lower mean, and 0.083 to 0.217 of sessions; none is more than half. Shifted phases give 0.166 to 0.233 of neurons and 0.117 to 0.200 of sessions under the same four readings (aa1 0.171 and 0.183). With undefined phase left out (variant), ba0 gives 0.795, 0.677 and 60 of 60 sessions, but shifted phases give 0.777, 0.655 and 0.967 under the same reading.

fig2e-ls-phase-lower-mse¶

Across LS neurons the spike-phase code is stronger than the rate code (two-sample t tests; N = 4,393 conditions, p < 1e-100; N = 62 sessions, p < 1e-10).

In [12]:
out = []
for rd in RD:
    sub = DL[DL[f"{rd}_rate"].notna()]
    tc = stats.ttest_ind(sub[f"{rd}_mphase"], sub[f"{rd}_mrate"])
    ss = sub.groupby("session")[[f"{rd}_mphase", f"{rd}_mrate"]].mean()
    ts_ = stats.ttest_ind(ss.iloc[:, 0], ss.iloc[:, 1])
    out.append({"reading": rd, "n_cond": len(sub), "phase_mean": round(sub[f"{rd}_mphase"].mean(), 1),
                "rate_mean": round(sub[f"{rd}_mrate"].mean(), 1), "p_cond": tc.pvalue, "n_sess": len(ss),
                "phase_sess": round(ss.iloc[:, 0].mean(), 1), "rate_sess": round(ss.iloc[:, 1].mean(), 1), "p_sess": ts_.pvalue})
fig2e = pd.DataFrame(out)
print(fig2e.to_string(index=False))
for rd in tg.NULL_READINGS:
    X = DL[DL.null.astype(bool)]
    pn = np.array([np.nanmean(a) for a in X[f"null_{rd}_phase_cos"]]); rn = np.array([np.nanmean(a) for a in X[f"null_{rd}_rate"]])
    print(f"null (phases shifted within trials), {rd}: phase {pn.mean():.1f} against rate {rn.mean():.1f}, t test p = {stats.ttest_ind(pn, rn).pvalue:.1e} over {len(X)} conditions")
fig, ax = plt.subplots(1, 2, figsize=(9, 3.5))
ax[0].hist(DL["aa1_mrate"], 50, alpha=.6, label="rate"); ax[0].hist(DL["aa1_mphase"], 50, alpha=.6, label="phase")
ax[0].set_xlabel("MSE (bins^2), reading aa1"); ax[0].legend()
ax[1].hist(DL["aa1_d"], 60); ax[1].set_xlabel("phase - rate MSE, LS conditions")
plt.tight_layout(); plt.show()
print("plotted ranges: rate %.0f to %.0f, phase %.0f to %.0f, difference %.0f to %.0f" % (
    DL.aa1_mrate.min(), DL.aa1_mrate.max(), DL.aa1_mphase.min(), DL.aa1_mphase.max(), DL.aa1_d.min(), DL.aa1_d.max()))
reading  n_cond  phase_mean  rate_mean       p_cond  n_sess  phase_sess  rate_sess       p_sess
    aa1    4362      7066.7     6827.1 7.196179e-15      60      7094.4     6899.4 6.744130e-03
    ba1    4362      6905.2     6653.0 2.274980e-19      60      6933.4     6709.6 1.643295e-03
    ab1    4362      4951.3     4788.4 6.960545e-05      60      4614.3     4481.1 6.456912e-01
    bb1    4362      4823.1     4658.4 2.198171e-05      60      4491.8     4351.8 6.179524e-01
    aa0    4362      6391.2     6825.4 2.115589e-44      60      6341.8     6891.2 1.051761e-10
    ba0    4362      5053.9     6651.9 0.000000e+00      60      4913.0     6717.3 1.814321e-21
null (phases shifted within trials), aa1: phase 7105.2 against rate 6825.0, t test p = 6.2e-20 over 4362 conditions
null (phases shifted within trials), ba1: phase 6934.6 against rate 6652.4, t test p = 2.0e-24 over 4362 conditions
null (phases shifted within trials), aa0: phase 6595.0 against rate 6818.9, t test p = 2.8e-13 over 4362 conditions
null (phases shifted within trials), ba0: phase 5238.3 against rate 6650.9, t test p = 1.6e-266 over 4362 conditions
null (phases shifted within trials), ab1: phase 4966.8 against rate 4791.8, t test p = 1.7e-05 over 4362 conditions
null (phases shifted within trials), bb1: phase 4844.4 against rate 4661.8, t test p = 2.3e-06 over 4362 conditions
plotted ranges: rate 1752 to 11971, phase 3319 to 11621, difference -4389 to 6182

Result: not reproduced, resting on the same assumption. Under every reading with undefined phase set to 0 the mean phase MSE is higher than the rate MSE: aa1 7,067 against 6,827 over 4,362 LS conditions (p = 7.2e-15) and 7,094 against 6,899 over 60 sessions (p = 0.0067). With undefined phase left out (variant) phase is lower (aa0 p = 2.1e-44 and 1.1e-10), but shifted phases are also lower than rate under that variant (aa0 6,595 against 6,819, p = 2.8e-13).

fig2fg-mse-difference¶

The mean phase minus rate MSE is about -1,000 for LS conditions and -33 for hippocampal place fields, and -1,024 and -25 for LS and hippocampal sessions.

In [13]:
out = []
for rd in RD:
    for pr in "ab":
        ls_ = DL[DL[f"{rd}_rate"].notna()]
        hpf = D[D.region.isin(tg.HPC_LABELS) & (D[f"pf{pr}_n"] > 0) & D[f"{rd}_rate"].notna()]
        out.append({"reading": rd, "fields": pr, "LS_cond": round(ls_[f"{rd}_d"].mean(), 1), "n_LS": len(ls_),
                    "HPC_fields": round(hpf[f"{rd}_d"].mean(), 1), "n_fields": len(hpf),
                    "LS_sess": round(ls_.groupby("session")[f"{rd}_d"].mean().mean(), 1), "n_LS_sess": ls_.session.nunique(),
                    "HPC_sess": round(hpf.groupby("session")[f"{rd}_d"].mean().mean(), 1), "n_HPC_sess": hpf.session.nunique()})
fig2fg = pd.DataFrame(out)
print(fig2fg.to_string(index=False))
print("expected: -1000 +/- 100, -33 +/- 3.3, -1024 +/- 102.4, -25 +/- 2.5")
for rd in tg.NULL_READINGS:
    for nm, X in (("LS conditions", DL[DL.null.astype(bool)]), ("hippocampal fields (a), null quarter", D[D.region.isin(tg.HPC_LABELS) & (D.pfa_n > 0) & D.null.astype(bool)])):
        dn = np.array([np.nanmean(a) - np.nanmean(b) for a, b in zip(X[f"null_{rd}_phase_cos"], X[f"null_{rd}_rate"])])
        print(f"null, {rd}, {nm}: mean phase - rate {dn.mean():.1f} (n = {len(dn)})")
print("LS by animal, main reading:", DL.groupby("subject")[f"{tg.MAIN}_d"].mean().round(0).to_dict())
reading fields  LS_cond  n_LS  HPC_fields  n_fields  LS_sess  n_LS_sess  HPC_sess  n_HPC_sess
    aa1      a    239.6  4362       271.4      1640    195.0         60     255.8          44
    aa1      b    239.6  4362       197.3      1924    195.0         60     228.7          45
    ba1      a    252.2  4362       283.1      1640    223.8         60     302.2          44
    ba1      b    252.2  4362       212.0      1924    223.8         60     264.4          45
    ab1      a    163.0  4362       246.8      1640    133.2         60     200.0          44
    ab1      b    163.0  4362       175.1      1924    133.2         60     173.9          45
    bb1      a    164.7  4362       261.4      1640    140.0         60     227.2          44
    bb1      b    164.7  4362       193.3      1924    140.0         60     194.6          45
    aa0      a   -434.2  4362     -1524.4      1640   -549.4         60    -859.2          44
    aa0      b   -434.2  4362     -1573.7      1924   -549.4         60    -922.5          45
    ba0      a  -1597.9  4362     -2130.3      1640  -1804.3         60   -1447.6          44
    ba0      b  -1597.9  4362     -2305.0      1924  -1804.3         60   -1602.7          45
expected: -1000 +/- 100, -33 +/- 3.3, -1024 +/- 102.4, -25 +/- 2.5
null, aa1, LS conditions: mean phase - rate 280.1 (n = 4362)
null, aa1, hippocampal fields (a), null quarter: mean phase - rate 303.9 (n = 383)
null, ba1, LS conditions: mean phase - rate 282.2 (n = 4362)
null, ba1, hippocampal fields (a), null quarter: mean phase - rate 286.0 (n = 383)
null, aa0, LS conditions: mean phase - rate -223.9 (n = 4362)
null, aa0, hippocampal fields (a), null quarter: mean phase - rate -1233.9 (n = 383)
null, ba0, LS conditions: mean phase - rate -1412.6 (n = 4362)
null, ba0, hippocampal fields (a), null quarter: mean phase - rate -1976.9 (n = 383)
null, ab1, LS conditions: mean phase - rate 175.0 (n = 4362)
null, ab1, hippocampal fields (a), null quarter: mean phase - rate 266.7 (n = 383)
null, bb1, LS conditions: mean phase - rate 182.6 (n = 4362)
null, bb1, hippocampal fields (a), null quarter: mean phase - rate 274.0 (n = 383)
LS by animal, main reading: {'DT2': 206.0, 'DT5': 364.0, 'DT7': 155.0, 'DT8': 35.0, 'DT9': 191.0}

Result: not reproduced, resting on the same assumption. Under aa1 the mean phase minus rate MSE is +240 for 4,362 LS conditions, +271 for 1,640 hippocampal place fields, +195 for 60 LS sessions and +256 for 44 hippocampal sessions, against -1,000, -33, -1,024 and -25. All four values are positive under every reading with undefined phase set to 0. With undefined phase left out (variant) the LS values are negative. At the condition level the hippocampal values (-1,524 to -2,305) are larger in magnitude than the LS ones (-434 and -1,598), which the partial rule excludes; at the session level this holds for aa0 (LS -549 against hippocampal -859 and -923) but not for ba0 (LS -1,804 against -1,448 and -1,603).

fig1i-hpc-rate-phase-equivalent¶

For hippocampal place fields the distributions of rate and phase decoding errors are statistically equivalent (two-sample KS test; 1,820 place fields, p = 0.19; 45 sessions, p = 0.61).

In [14]:
out = []
for rd in RD:
    for pr in "ab":
        hpf = D[D.region.isin(tg.HPC_LABELS) & (D[f"pf{pr}_n"] > 0) & D[f"{rd}_rate"].notna()]
        k1 = stats.ks_2samp(hpf[f"{rd}_mrate"], hpf[f"{rd}_mphase"])
        ss = hpf.groupby("session")[[f"{rd}_mrate", f"{rd}_mphase"]].mean()
        k2 = stats.ks_2samp(ss.iloc[:, 0], ss.iloc[:, 1])
        out.append({"reading": rd, "fields": pr, "n_fields": len(hpf), "p_fields": k1.pvalue, "D_fields": round(k1.statistic, 3),
                    "mean_diff": round(hpf[f"{rd}_d"].mean(), 1), "n_sess": len(ss), "p_sess": k2.pvalue})
for pr in "ab":
    hpf = D[D.region.isin(tg.HPC_LABELS) & (D[f"pf{pr}_n"] > 0)]
    k1 = stats.ks_2samp(hpf["aa1low_mrate"], hpf["aa1low_mphase"])
    ss = hpf.groupby("session")[["aa1low_mrate", "aa1low_mphase"]].mean()
    k2 = stats.ks_2samp(ss.iloc[:, 0], ss.iloc[:, 1])
    out.append({"reading": "aa1, ties to lowest bin", "fields": pr, "n_fields": len(hpf), "p_fields": k1.pvalue, "D_fields": round(k1.statistic, 3),
                "mean_diff": round(hpf["aa1low_d"].mean(), 1), "n_sess": len(ss), "p_sess": k2.pvalue})
fig1i = pd.DataFrame(out)
print(fig1i.to_string(index=False))
ok = fig1i[(fig1i.p_fields >= 0.05) & (fig1i.p_sess >= 0.05)]
print("readings with neither KS test at p < 0.05 (ties at random, undefined phase = 0 unless stated):",
      [f"{r} fields {f}" for r, f in zip(ok.reading, ok.fields)], f"of {len(fig1i)} rows")
                reading fields  n_fields      p_fields  D_fields  mean_diff  n_sess       p_sess
                    aa1      a      1640  4.823165e-05     0.080      271.4      44 4.240933e-02
                    aa1      b      1924  6.483732e-03     0.055      197.3      45 6.376909e-03
                    ba1      a      1640  5.342553e-06     0.088      283.1      44 1.113559e-03
                    ba1      b      1924  1.120285e-03     0.062      212.0      45 6.376909e-03
                    ab1      a      1640  6.437301e-03     0.059      246.8      44 9.430162e-01
                    ab1      b      1924  6.606654e-02     0.042      175.1      45 8.245286e-01
                    bb1      a      1640  8.278969e-04     0.069      261.4      44 8.140200e-01
                    bb1      b      1924  1.225461e-02     0.051      193.3      45 8.245286e-01
                    aa0      a      1640 1.521106e-107     0.383    -1524.4      44 7.584654e-06
                    aa0      b      1924 2.174858e-134     0.395    -1573.7      45 3.273428e-06
                    ba0      a      1640 1.071813e-178     0.490    -2130.3      44 4.900833e-10
                    ba0      b      1924 1.549688e-238     0.521    -2305.0      45 3.165610e-11
aa1, ties to lowest bin      a      1640  5.715050e-03     0.060      256.7      44 6.393820e-01
aa1, ties to lowest bin      b      1924  1.807229e-01     0.035      186.4      45 8.245286e-01
readings with neither KS test at p < 0.05 (ties at random, undefined phase = 0 unless stated): ['ab1 fields b', 'aa1, ties to lowest bin fields b'] of 14 rows

Result: not reproduced, resting on the assumption that undefined phase is set to 0, on the adopted reading aa1. The 1.5 cm reading ab1 with fields (b) is the only reading with ties at random where neither test gives p < 0.05, as the line under the table prints. Reproduced was proposed on that reading; the third verification round did not agree, since the criterion has no "under one reading" clause, a claim of absence passes more easily the more readings are tried, and ab1 keeps 201 bins for 2,822 of its 5,723 hippocampal conditions. The proposal stands in the attempt record. Under aa1 the KS test finds rate and phase MSE different over the place fields (p = 4.8e-05, D = 0.080, 1,640 fields of rate map a; p = 0.0065, D = 0.055, 1,924 fields of rate map b) and over sessions (p = 0.042 and 0.0064); phase MSE is higher by 271 and 197 bins squared. The 1.5 cm reading ab1 with fields (b) gives p = 0.066 and 0.82, and sending ties to the lowest bin gives p = 0.18 and 0.82 for fields (b); with fields (a) both still give p < 0.01. With undefined phase left out (variant) p < 1e-100. Under 7 of the 8 readings with phase 0 the KS test finds a difference, so the equivalence is fragile.

Place fields¶

Shared by ls-few-place-fields, hpc-place-field-properties, ls-place-fields-unstable and fig6e.

ls-few-place-fields¶

Only 5.3% (232 of 4,393) of LS rate maps showed place fields by the criteria applied to hippocampal units, where 31.7% (1,820 of 5,735) did.

In [15]:
DH = D[D.region.isin(tg.HPC_LABELS)]
for pr in "ab":
    print(f"rate map reading {pr}: LS {int((DL[f'pf{pr}_n']>0).sum())}/{len(DL)} = {(DL[f'pf{pr}_n']>0).mean():.3f}; "
          f"hippocampal {int((DH[f'pf{pr}_n']>0).sum())}/{len(DH)} = {(DH[f'pf{pr}_n']>0).mean():.3f}")
    print("   by animal, LS:", DL.groupby("subject")[f"pf{pr}_n"].apply(lambda x: round((x > 0).mean(), 3)).to_dict(),
          "hippocampal:", DH.groupby("subject")[f"pf{pr}_n"].apply(lambda x: round((x > 0).mean(), 3)).to_dict())
rate map reading a: LS 277/4362 = 0.064; hippocampal 1640/5723 = 0.287
   by animal, LS: {'DT2': 0.039, 'DT5': 0.055, 'DT7': 0.163, 'DT8': 0.035, 'DT9': 0.124} hippocampal: {'DT2': 0.289, 'DT5': 0.192, 'DT7': 0.327, 'DT9': 0.34}
rate map reading b: LS 435/4362 = 0.100; hippocampal 1924/5723 = 0.336
   by animal, LS: {'DT2': 0.046, 'DT5': 0.093, 'DT7': 0.256, 'DT8': 0.084, 'DT9': 0.173} hippocampal: {'DT2': 0.307, 'DT5': 0.282, 'DT7': 0.401, 'DT9': 0.41}

Result: partially reproduced. With the Gaussian rate maps (a), 277 of 4,362 LS maps (0.064) and 1,640 of 5,723 hippocampal maps (0.287) have a field; with box maps (b), 0.100 and 0.336. The hippocampal fraction and both map counts are within tolerance; the LS fraction is lower than the hippocampal one but above 0.053 +/- 0.0053 under both readings.

hpc-place-field-properties¶

711 of 1,425 hippocampal neurons had at least one place field (1.27 fields per neuron on average); the median peak in-field rate was 8.5 Hz and the median field width 38 bins (about 57 cm).

In [16]:
hpu = UN[UN.region.isin(tg.HPC_LABELS)]
for pr in "ab":
    nf = DH.groupby(["session", "unit"])[f"pf{pr}_n"].sum()
    peaks = np.concatenate([x for x in DH[f"pf{pr}_peaks_all"] if isinstance(x, list)])
    widths = np.concatenate([x for x in DH[f"pf{pr}_widths_all"] if isinstance(x, list)])
    for den, n in (("a: units with an included condition", len(nf)), ("b: all hippocampal units", len(hpu))):
        print(f"reading {pr}, denominator {den}: {int((nf > 0).sum())}/{n} = {(nf > 0).sum()/n:.3f} with a field; "
              f"fields per neuron {nf.sum()/n:.2f}")
    print(f"   all fields: {len(peaks)}, median peak {np.median(peaks):.2f} Hz, median width {np.median(widths):.1f} bins")
reading a, denominator a: units with an included condition: 677/1420 = 0.477 with a field; fields per neuron 1.27
reading a, denominator b: all hippocampal units: 677/3260 = 0.208 with a field; fields per neuron 0.56
   all fields: 1810, median peak 7.30 Hz, median width 43.0 bins
reading b, denominator a: units with an included condition: 755/1420 = 0.532 with a field; fields per neuron 2.70
reading b, denominator b: all hippocampal units: 755/3260 = 0.232 with a field; fields per neuron 1.18
   all fields: 3837, median peak 6.00 Hz, median width 49.0 bins

Result: partially reproduced. With the Gaussian maps and the units that have an included condition (1,420, against the paper's 1,425), 677 have a field (0.477; 0.499 +/- 0.0499) and there are 1.27 fields per neuron (1.27 +/- 0.127); the median peak rate is 7.30 Hz (8.5 +/- 0.85) and the median width 43 bins (38 +/- 3.8). Two of the four values are within tolerance; the box maps give 0.532, 2.70, 6.00 Hz and 49 bins (one of four).

ls-place-fields-unstable¶

The few LS rate maps with a place field were less stable across trials than CA1/CA3 place fields (median coefficient of variance 41.5 against 10; two-sample t test, p < 1e-20).

In [17]:
for pr in "ab":
    L_ = DL[DL[f"pf{pr}_n"] > 0]; H_ = DH[DH[f"pf{pr}_n"] > 0]
    for q, name in (("sd", "SD at the peak, Hz"), ("cv", "SD / mean at the peak, %")):
        t_ = stats.ttest_ind(L_[f"pf{pr}_{q}"], H_[f"pf{pr}_{q}"])
        print(f"rate maps {pr}, {name}: LS median {L_[f'pf{pr}_{q}'].median():.2f} (n={len(L_)}), "
              f"hippocampal {H_[f'pf{pr}_{q}'].median():.2f} (n={len(H_)}); t = {t_.statistic:.2f}, p = {t_.pvalue:.2e}")
rate maps a, SD at the peak, Hz: LS median 3.16 (n=277), hippocampal 5.15 (n=1640); t = -3.61, p = 3.09e-04
rate maps a, SD / mean at the peak, %: LS median 81.74 (n=277), hippocampal 71.73 (n=1640); t = 7.19, p = 9.57e-13
rate maps b, SD at the peak, Hz: LS median 2.83 (n=435), hippocampal 4.30 (n=1924); t = -12.64, p = 1.70e-35
rate maps b, SD / mean at the peak, %: LS median 85.05 (n=435), hippocampal 71.69 (n=1924); t = 10.24, p = 4.00e-24

Result: partially reproduced. As SD over trials divided by the mean at the peak (reading b), LS fields are more variable than hippocampal fields: medians 81.7 against 71.7% (Gaussian maps, p = 9.6e-13) and 85.1 against 71.7% (box maps, p = 4.0e-24). The medians are far from 41.5 and 10. As the SD in Hz (reading a), LS fields vary less than hippocampal ones (3.16 against 5.15 Hz).

fig1e-phase-info-smaller-scale¶

Hippocampal place fields reach their peak information at smaller smoothing scales for phase than for rate (medians 15 and 29 bins; two-sample t test, p < 1e-40).

In [18]:
# best smoothing: argmax of the 5-point smoothed curve (MATLAB smooth, shrinking at the ends; tg.best_scale)
print("check of tg.best_scale on a rising curve 1..50:", tg.best_scale(np.arange(1, 51)), "(a zero-padded convolution gives 48)")
out = []
for pr in "ab":
    H_ = DH[(DH[f"pf{pr}_n"] > 0) & DH["info_rate_a"].notna()]
    for mode in "ab":
        br = np.array([tg.best_scale(c) for c in H_[f"info_rate_{mode}"]])
        for ph, nm in (("info_phase", "undefined = 0 (adopted)"), ("info_phase0", "undefined left out")):
            bp = np.array([tg.best_scale(c) for c in H_[f"{ph}_{mode}"]])
            keep = (br < 49) & (bp < 49)
            t_ = stats.ttest_ind(bp[keep], br[keep])
            hn = H_[H_.null.astype(bool)]
            bn = np.array([tg.best_scale(c) for c in hn[f"null_{ph}_{mode}"]])
            out.append({"fields": pr, "levels": mode, "phase": nm, "fields_n": len(H_), "kept": int(keep.sum()),
                        "phase_median": np.median(bp[keep]), "rate_median": np.median(br[keep]), "t": round(t_.statistic, 2), "p": t_.pvalue,
                        "null_phase_median": np.median(bn[bn < 49]) if (bn < 49).any() else np.nan, "null_n": len(bn)})
print(pd.DataFrame(out).to_string(index=False))
print("null: phases circularly shifted within trials (decoder calibration), same fields")
check of tg.best_scale on a rising curve 1..50: 50 (a zero-padded convolution gives 48)
fields levels                   phase  fields_n  kept  phase_median  rate_median      t             p  null_phase_median  null_n
     a      a undefined = 0 (adopted)      1640  1522          14.0         20.0 -13.86  2.086772e-42               12.5     383
     a      a      undefined left out      1640  1347           2.0         20.0 -31.11 9.041540e-182                2.0     383
     a      b undefined = 0 (adopted)      1640  1426          22.0         26.0 -10.56  1.402352e-25               21.0     383
     a      b      undefined left out      1640  1335          19.0         26.0 -14.15  7.243856e-44               17.0     383
     b      a undefined = 0 (adopted)      1924  1783          15.0         21.0 -16.37  3.946746e-58               13.0     459
     b      a      undefined left out      1924  1579           2.0         21.0 -36.51 8.913286e-244                2.0     459
     b      b undefined = 0 (adopted)      1924  1632          22.0         27.0 -12.93  2.357542e-37               21.0     459
     b      b      undefined left out      1924  1545          19.0         28.0 -17.03  3.187741e-62               18.0     459
null: phases circularly shifted within trials (decoder calibration), same fields

Result: partially reproduced, resting on the assumption that undefined phase is set to 0. Phase information peaks at a smaller smoothing than rate information under every reading (p = 1.4e-25 to 3.9e-58 with the assumption). With box-map fields and equal-width levels the phase median is 15 bins (15 +/- 1.5) but the rate median 21 (29 +/- 2.9); with equal-count levels the rate median is 27 (within) and the phase median 22. No reading puts both medians within tolerance. Phases shifted within trials give phase medians of 12.5 to 21, close to the real ones, so the smaller phase scale does not depend on the phases. With undefined phase left out (variant) the phase median falls to 2 bins (equal widths).

fig1g-phase-more-info-fine-scale¶

At smoothing below 6 cm (about one theta cycle) phase carries more spatial information than rate in hippocampal place fields, and above 10 cm rate carries more.

In [19]:
for pr in "ab":
    H_ = DH[(DH[f"pf{pr}_n"] > 0) & DH["info_rate_a"].notna()]
    for mode in "ab":
        for phk, nm in (("info_phase", "undefined = 0 (adopted)"), ("info_phase0", "undefined left out")):
            R = np.stack(H_[f"info_rate_{mode}"]); P = np.stack(H_[f"{phk}_{mode}"])
            res = {}
            for w in range(2, 51):
                t_ = stats.ttest_ind(P[:, w - 1], R[:, w - 1]); k_ = stats.ks_2samp(P[:, w - 1], R[:, w - 1])
                res[w] = (np.mean(P[:, w - 1] - R[:, w - 1]), t_.pvalue, k_.pvalue)
            fine = [res[w] for w in (2, 3)]
            coarse = [res[w] for w in range(7, 51)]
            for name, i_, thr in (("t test p<1e-5", 1, 1e-5), ("KS p<0.01", 2, 0.01)):
                f_ok = all(r[0] > 0 and r[i_] < thr for r in fine)
                c_n = int(np.sum([r[0] < 0 and r[i_] < thr for r in coarse]))
                print(f"fields {pr}, levels {mode}, phase {nm}, {name}: phase-rate at 2 and 3 bins {fine[0][0]:.3f} (p {fine[0][i_]:.1e}), "
                      f"{fine[1][0]:.3f} (p {fine[1][i_]:.1e}); phase > rate at both: {f_ok}; rate > phase significant at {c_n}/{len(coarse)} = {c_n/len(coarse):.3f} of smoothings 7-50")
            d_all = np.array([res[w][0] for w in range(2, 51)])
            hn = H_[H_.null.astype(bool)]
            Pn = np.stack(hn[f"null_{phk}_{mode}"]); Rn = np.stack(hn[f"info_rate_{mode}"])
            print(f"   phase-rate over smoothings 2-50: {d_all.min():.3f} to {d_all.max():.3f}; first smoothing with rate > phase: "
                  f"{next((w for w in range(2, 51) if res[w][0] < 0), None)}; null phases ({len(hn)} fields): phase-rate at 2 bins "
                  f"{np.mean(Pn[:, 1] - Rn[:, 1]):.3f}, at 20 bins {np.mean(Pn[:, 19] - Rn[:, 19]):.3f}; real at 20 bins {res[20][0]:.3f}")
print("fine-scale phase information against the shifted-phase null (undefined phase = 0), fields that have the null:")
for pr in "ab":
    H_ = DH[(DH[f"pf{pr}_n"] > 0) & DH["info_rate_a"].notna() & DH.null.astype(bool)]
    for mode in "ab":
        P = np.stack(H_[f"info_phase_{mode}"]); Pn = np.stack(H_[f"null_info_phase_{mode}"]); R = np.stack(H_[f"info_rate_{mode}"])
        for w in (2, 3):
            tp = stats.ttest_rel(P[:, w - 1], Pn[:, w - 1])
            print(f"fields {pr}, levels {mode}, {w} bins ({len(H_)} fields): real phase {P[:, w - 1].mean():.3f}, shifted phase {Pn[:, w - 1].mean():.3f}, "
                  f"rate {R[:, w - 1].mean():.3f} bits; real minus shifted {np.mean(P[:, w - 1] - Pn[:, w - 1]):+.3f} (paired t p = {tp.pvalue:.2g})")
fields a, levels a, phase undefined = 0 (adopted), t test p<1e-5: phase-rate at 2 and 3 bins -0.114 (p 5.1e-05), -0.164 (p 2.2e-08); phase > rate at both: False; rate > phase significant at 44/44 = 1.000 of smoothings 7-50
fields a, levels a, phase undefined = 0 (adopted), KS p<0.01: phase-rate at 2 and 3 bins -0.114 (p 1.4e-02), -0.164 (p 4.7e-04); phase > rate at both: False; rate > phase significant at 44/44 = 1.000 of smoothings 7-50
   phase-rate over smoothings 2-50: -0.387 to -0.114; first smoothing with rate > phase: 2; null phases (383 fields): phase-rate at 2 bins -0.141, at 20 bins -0.480; real at 20 bins -0.267
fields a, levels a, phase undefined left out, t test p<1e-5: phase-rate at 2 and 3 bins 2.338 (p 0.0e+00), 2.064 (p 0.0e+00); phase > rate at both: True; rate > phase significant at 0/44 = 0.000 of smoothings 7-50
fields a, levels a, phase undefined left out, KS p<0.01: phase-rate at 2 and 3 bins 2.338 (p 0.0e+00), 2.064 (p 0.0e+00); phase > rate at both: True; rate > phase significant at 0/44 = 0.000 of smoothings 7-50
   phase-rate over smoothings 2-50: 1.075 to 2.338; first smoothing with rate > phase: None; null phases (383 fields): phase-rate at 2 bins 2.318, at 20 bins 1.031; real at 20 bins 1.184
fields a, levels b, phase undefined = 0 (adopted), t test p<1e-5: phase-rate at 2 and 3 bins 0.684 (p 0.0e+00), 0.708 (p 1.6e-253); phase > rate at both: True; rate > phase significant at 35/44 = 0.795 of smoothings 7-50
fields a, levels b, phase undefined = 0 (adopted), KS p<0.01: phase-rate at 2 and 3 bins 0.684 (p 0.0e+00), 0.708 (p 0.0e+00); phase > rate at both: True; rate > phase significant at 37/44 = 0.841 of smoothings 7-50
   phase-rate over smoothings 2-50: -0.402 to 0.708; first smoothing with rate > phase: 14; null phases (383 fields): phase-rate at 2 bins 0.695, at 20 bins -0.490; real at 20 bins -0.266
fields a, levels b, phase undefined left out, t test p<1e-5: phase-rate at 2 and 3 bins 2.722 (p 0.0e+00), 2.634 (p 0.0e+00); phase > rate at both: True; rate > phase significant at 0/44 = 0.000 of smoothings 7-50
fields a, levels b, phase undefined left out, KS p<0.01: phase-rate at 2 and 3 bins 2.722 (p 0.0e+00), 2.634 (p 0.0e+00); phase > rate at both: True; rate > phase significant at 0/44 = 0.000 of smoothings 7-50
   phase-rate over smoothings 2-50: 0.931 to 2.722; first smoothing with rate > phase: None; null phases (383 fields): phase-rate at 2 bins 2.771, at 20 bins 1.189; real at 20 bins 1.171
fields b, levels a, phase undefined = 0 (adopted), t test p<1e-5: phase-rate at 2 and 3 bins -0.018 (p 4.2e-01), -0.080 (p 7.6e-04); phase > rate at both: False; rate > phase significant at 44/44 = 1.000 of smoothings 7-50
fields b, levels a, phase undefined = 0 (adopted), KS p<0.01: phase-rate at 2 and 3 bins -0.018 (p 5.8e-03), -0.080 (p 5.1e-02); phase > rate at both: False; rate > phase significant at 44/44 = 1.000 of smoothings 7-50
   phase-rate over smoothings 2-50: -0.370 to -0.018; first smoothing with rate > phase: 2; null phases (459 fields): phase-rate at 2 bins -0.060, at 20 bins -0.422; real at 20 bins -0.249
fields b, levels a, phase undefined left out, t test p<1e-5: phase-rate at 2 and 3 bins 2.555 (p 0.0e+00), 2.288 (p 0.0e+00); phase > rate at both: True; rate > phase significant at 0/44 = 0.000 of smoothings 7-50
fields b, levels a, phase undefined left out, KS p<0.01: phase-rate at 2 and 3 bins 2.555 (p 0.0e+00), 2.288 (p 0.0e+00); phase > rate at both: True; rate > phase significant at 0/44 = 0.000 of smoothings 7-50
   phase-rate over smoothings 2-50: 1.216 to 2.555; first smoothing with rate > phase: None; null phases (459 fields): phase-rate at 2 bins 2.525, at 20 bins 1.234; real at 20 bins 1.355
fields b, levels b, phase undefined = 0 (adopted), t test p<1e-5: phase-rate at 2 and 3 bins 0.692 (p 0.0e+00), 0.720 (p 0.0e+00); phase > rate at both: True; rate > phase significant at 33/44 = 0.750 of smoothings 7-50
fields b, levels b, phase undefined = 0 (adopted), KS p<0.01: phase-rate at 2 and 3 bins 0.692 (p 0.0e+00), 0.720 (p 0.0e+00); phase > rate at both: True; rate > phase significant at 35/44 = 0.795 of smoothings 7-50
   phase-rate over smoothings 2-50: -0.369 to 0.720; first smoothing with rate > phase: 16; null phases (459 fields): phase-rate at 2 bins 0.685, at 20 bins -0.393; real at 20 bins -0.204
fields b, levels b, phase undefined left out, t test p<1e-5: phase-rate at 2 and 3 bins 2.803 (p 0.0e+00), 2.734 (p 0.0e+00); phase > rate at both: True; rate > phase significant at 0/44 = 0.000 of smoothings 7-50
fields b, levels b, phase undefined left out, KS p<0.01: phase-rate at 2 and 3 bins 2.803 (p 0.0e+00), 2.734 (p 0.0e+00); phase > rate at both: True; rate > phase significant at 0/44 = 0.000 of smoothings 7-50
   phase-rate over smoothings 2-50: 1.073 to 2.803; first smoothing with rate > phase: None; null phases (459 fields): phase-rate at 2 bins 2.831, at 20 bins 1.383; real at 20 bins 1.375
fine-scale phase information against the shifted-phase null (undefined phase = 0), fields that have the null:
fields a, levels a, 2 bins (383 fields): real phase 1.325, shifted phase 1.285, rate 1.426 bits; real minus shifted +0.040 (paired t p = 0.0096)
fields a, levels a, 3 bins (383 fields): real phase 1.473, shifted phase 1.416, rate 1.614 bits; real minus shifted +0.058 (paired t p = 7.7e-05)
fields a, levels b, 2 bins (383 fields): real phase 0.836, shifted phase 0.791, rate 0.096 bits; real minus shifted +0.045 (paired t p = 0.0087)
fields a, levels b, 3 bins (383 fields): real phase 0.925, shifted phase 0.874, rate 0.159 bits; real minus shifted +0.051 (paired t p = 0.0041)
fields b, levels a, 2 bins (459 fields): real phase 1.247, shifted phase 1.216, rate 1.276 bits; real minus shifted +0.032 (paired t p = 0.013)
fields b, levels a, 3 bins (459 fields): real phase 1.388, shifted phase 1.338, rate 1.473 bits; real minus shifted +0.050 (paired t p = 8.2e-05)
fields b, levels b, 2 bins (459 fields): real phase 0.779, shifted phase 0.734, rate 0.050 bits; real minus shifted +0.045 (paired t p = 0.0025)
fields b, levels b, 3 bins (459 fields): real phase 0.861, shifted phase 0.811, rate 0.105 bits; real minus shifted +0.051 (paired t p = 0.00097)

Result: reproduced under one reading, resting on the assumption that undefined phase is set to 0. With Gaussian-map fields, equal-count levels and the KS test, phase exceeds rate at 2 and 3 bins (by 0.684 and 0.708 bits, p below 1e-250) and rate exceeds phase significantly at 37 of the 44 smoothings from 7 to 50 bins (0.841). The t test reading gives 35 of 44 (0.795), and box-map fields 33 and 35 of 44; with equal-width levels rate exceeds phase at every smoothing, including 2 and 3 bins. Phases shifted within trials give the same fine-scale excess (0.695 bits at 2 bins against 0.684 real), so the match does not show that phase carries more information there. The excess comes from the phase-0 fill: at 2 and 3 bins most bins of a trial have no spike within the window, so their phase is 0 and their cosine 1, and the information measures whether a spike is near, not its phase. On the fields that have the null, real phases carry 0.032 to 0.058 bits more than shifted phases at 2 and 3 bins under every field and level reading (paired t p = 0.013 to 7.7e-05), a small part of the 0.684 to 0.720 bit excess over rate under equal-count levels. With undefined phase left out (variant) phase exceeds rate at every smoothing.

ls-lower-peak-info¶

LS rate maps had lower peak information rates than hippocampal place field maps (average 0.4 against 1.7 bits/cm; two-sample t test, p < 1e-100).

In [20]:
L_ = DL[DL["info_rate_a"].notna()]
for pr in "ab":
    H_ = DH[(DH[f"pf{pr}_n"] > 0) & DH["info_rate_a"].notna()]
    for mode in "ab":
        for sm in ("a: peak over 1-50", "b: 20 bins"):
            def val(df):
                C = np.stack(df[f"info_rate_{mode}"])
                return C.max(1) if sm[0] == "a" else C[:, 19]
            vl, vh = val(L_), val(H_)
            for unit in ("a: /1.5 cm", "b: /bin width", "variant: /trials /1.5 cm (makeFig1.m)"):
                dl = 1.5 if unit[0] == "a" else (L_.cm_per_bin_a.values if unit[0] == "b" else 1.5 * L_.ntrials.values)
                dh = 1.5 if unit[0] == "a" else (H_.cm_per_bin_a.values if unit[0] == "b" else 1.5 * H_.ntrials.values)
                a_, b_ = vl / dl, vh / dh
                t_ = stats.ttest_ind(a_, b_)
                print(f"fields {pr}, levels {mode}, smoothing {sm}, unit {unit}: LS {a_.mean():.3f} (n={len(a_)}), "
                      f"hippocampal {b_.mean():.3f} (n={len(b_)}) bits/cm; t = {t_.statistic:.1f}, p = {t_.pvalue:.1e}")
fields a, levels a, smoothing a: peak over 1-50, unit a: /1.5 cm: LS 0.965 (n=4362), hippocampal 1.659 (n=1640) bits/cm; t = -44.7, p = 0.0e+00
fields a, levels a, smoothing a: peak over 1-50, unit b: /bin width: LS 1.165 (n=4362), hippocampal 1.822 (n=1640) bits/cm; t = -40.5, p = 0.0e+00
fields a, levels a, smoothing a: peak over 1-50, unit variant: /trials /1.5 cm (makeFig1.m): LS 0.055 (n=4362), hippocampal 0.099 (n=1640) bits/cm; t = -29.9, p = 2.8e-183
fields a, levels a, smoothing b: 20 bins, unit a: /1.5 cm: LS 0.676 (n=4362), hippocampal 1.373 (n=1640) bits/cm; t = -60.8, p = 0.0e+00
fields a, levels a, smoothing b: 20 bins, unit b: /bin width: LS 0.818 (n=4362), hippocampal 1.515 (n=1640) bits/cm; t = -55.6, p = 0.0e+00
fields a, levels a, smoothing b: 20 bins, unit variant: /trials /1.5 cm (makeFig1.m): LS 0.038 (n=4362), hippocampal 0.080 (n=1640) bits/cm; t = -39.6, p = 5.5e-305
fields a, levels b, smoothing a: peak over 1-50, unit a: /1.5 cm: LS 0.828 (n=4362), hippocampal 1.378 (n=1640) bits/cm; t = -37.6, p = 2.3e-278
fields a, levels b, smoothing a: peak over 1-50, unit b: /bin width: LS 1.014 (n=4362), hippocampal 1.523 (n=1640) bits/cm; t = -29.8, p = 8.3e-182
fields a, levels b, smoothing a: peak over 1-50, unit variant: /trials /1.5 cm (makeFig1.m): LS 0.046 (n=4362), hippocampal 0.080 (n=1640) bits/cm; t = -27.5, p = 1.6e-156
fields a, levels b, smoothing b: 20 bins, unit a: /1.5 cm: LS 0.416 (n=4362), hippocampal 1.045 (n=1640) bits/cm; t = -56.5, p = 0.0e+00
fields a, levels b, smoothing b: 20 bins, unit b: /bin width: LS 0.515 (n=4362), hippocampal 1.153 (n=1640) bits/cm; t = -48.4, p = 0.0e+00
fields a, levels b, smoothing b: 20 bins, unit variant: /trials /1.5 cm (makeFig1.m): LS 0.023 (n=4362), hippocampal 0.060 (n=1640) bits/cm; t = -45.5, p = 0.0e+00
fields b, levels a, smoothing a: peak over 1-50, unit a: /1.5 cm: LS 0.965 (n=4362), hippocampal 1.546 (n=1924) bits/cm; t = -41.0, p = 0.0e+00
fields b, levels a, smoothing a: peak over 1-50, unit b: /bin width: LS 1.165 (n=4362), hippocampal 1.719 (n=1924) bits/cm; t = -37.1, p = 3.7e-272
fields b, levels a, smoothing a: peak over 1-50, unit variant: /trials /1.5 cm (makeFig1.m): LS 0.055 (n=4362), hippocampal 0.090 (n=1924) bits/cm; t = -26.5, p = 2.5e-146
fields b, levels a, smoothing b: 20 bins, unit a: /1.5 cm: LS 0.676 (n=4362), hippocampal 1.297 (n=1924) bits/cm; t = -56.6, p = 0.0e+00
fields b, levels a, smoothing b: 20 bins, unit b: /bin width: LS 0.818 (n=4362), hippocampal 1.446 (n=1924) bits/cm; t = -52.3, p = 0.0e+00
fields b, levels a, smoothing b: 20 bins, unit variant: /trials /1.5 cm (makeFig1.m): LS 0.038 (n=4362), hippocampal 0.075 (n=1924) bits/cm; t = -36.3, p = 3.9e-262
fields b, levels b, smoothing a: peak over 1-50, unit a: /1.5 cm: LS 0.828 (n=4362), hippocampal 1.293 (n=1924) bits/cm; t = -33.8, p = 4.1e-230
fields b, levels b, smoothing a: peak over 1-50, unit b: /bin width: LS 1.014 (n=4362), hippocampal 1.445 (n=1924) bits/cm; t = -26.8, p = 8.7e-150
fields b, levels b, smoothing a: peak over 1-50, unit variant: /trials /1.5 cm (makeFig1.m): LS 0.046 (n=4362), hippocampal 0.074 (n=1924) bits/cm; t = -24.1, p = 1.8e-122
fields b, levels b, smoothing b: 20 bins, unit a: /1.5 cm: LS 0.416 (n=4362), hippocampal 0.937 (n=1924) bits/cm; t = -48.1, p = 0.0e+00
fields b, levels b, smoothing b: 20 bins, unit b: /bin width: LS 0.515 (n=4362), hippocampal 1.044 (n=1924) bits/cm; t = -41.3, p = 0.0e+00
fields b, levels b, smoothing b: 20 bins, unit variant: /trials /1.5 cm (makeFig1.m): LS 0.023 (n=4362), hippocampal 0.053 (n=1924) bits/cm; t = -39.2, p = 1.0e-300

Result: partially reproduced. LS rate maps have lower peak information than hippocampal place fields under all 16 readings (p from 8.7e-150 to below 1e-300). No reading puts both averages within tolerance. Peak over smoothings at 1.5 cm per bin gives hippocampal 1.659 bits/cm (1.7 +/- 0.17) with LS 0.965; 20-bin smoothing with equal-count levels gives LS 0.416 (0.4 +/- 0.04) with hippocampal 1.045. Dividing by the trial count as makeFig1.m does (variant) gives 0.023 to 0.055 (LS) and 0.053 to 0.099 bits/cm (hippocampal).

fig3-ls-phase-reliable¶

Without preselection of place fields, the LS phase code for position is more reliable across the population than either the rate or the phase code of the hippocampus.

In [21]:
def corr_rate(M):
    return np.corrcoef(M.T)
def corr_circ(P):
    P = np.where(np.isnan(P), np.nan, P)
    mu = np.arctan2(np.nanmean(np.sin(P), 0), np.nanmean(np.cos(P), 0))
    Sx = np.nan_to_num(np.sin(P - mu))
    num = Sx.T @ Sx
    d = np.sqrt(np.diag(num))
    return num / np.outer(d, d)
def measures(C):
    n = C.shape[0]; i = np.arange(n)
    anti = C[n - 1 - i, i]
    a = np.nanmean(anti[np.abs(i - (n - 1) / 2) > 20])
    off = np.abs(i[:, None] - i[None, :]) > 20
    return a, np.nanmean(C[off])
def to201(m, circular=False):
    # maps of conditions with 151 template points are interpolated onto 201 (S)
    m = np.asarray(m, float)
    if len(m) == 201:
        return m
    x0, x1 = np.linspace(0, 1, len(m)), np.linspace(0, 1, 201)
    if circular:
        return np.arctan2(np.interp(x1, x0, np.sin(m)), np.interp(x1, x0, np.cos(m)))
    return np.interp(x1, x0, m)
n151 = int(sum(len(m) != 201 for m in D.mean_rate_map))
print(f"conditions with maps of other than 201 points, interpolated: {n151}")
RM = {nm: np.stack([to201(m) for m in df.mean_rate_map]) for nm, df in (("HPC", DH), ("LS", DL))}
PM = {nm: np.stack([to201(m, True) for m in df.mean_phase_map]) for nm, df in (("HPC", DH), ("LS", DL))}
res = {}
for name, df in (("HPC", DH), ("LS", DL)):
    R = RM[name]; P = PM[name]
    res[(name, "rate")] = measures(corr_rate(R)); res[(name, "phase")] = measures(corr_circ(P))
    print(f"{name}: {len(df)} conditions; rate: anti-diagonal {res[(name,'rate')][0]:.3f}, off-diagonal {res[(name,'rate')][1]:.3f}; "
          f"phase: anti-diagonal {res[(name,'phase')][0]:.3f}, off-diagonal {res[(name,'phase')][1]:.3f}")
for k, nm in ((0, "(a) anti-diagonal"), (1, "(b) off-diagonal")):
    v = res[("LS", "phase")][k]
    print(f"{nm}: LS phase {v:.3f} lower than HPC rate {res[('HPC','rate')][k]:.3f}: {v < res[('HPC','rate')][k]}; "
          f"lower than HPC phase {res[('HPC','phase')][k]:.3f}: {v < res[('HPC','phase')][k]}")
fig, ax = plt.subplots(1, 4, figsize=(14, 3.2))
for a_, (nm, C) in zip(ax, [("HPC rate", corr_rate(RM["HPC"])), ("HPC phase", corr_circ(PM["HPC"])),
                            ("LS rate", corr_rate(RM["LS"])), ("LS phase", corr_circ(PM["LS"]))]):
    im = a_.imshow(C, vmin=-1, vmax=1, cmap="RdBu_r"); a_.set_title(nm)
plt.tight_layout(); plt.show()
print("colour axis -1 to 1; correlations lie in [-1, 1], none outside")
conditions with maps of other than 201 points, interpolated: 8
HPC: 5723 conditions; rate: anti-diagonal 0.868, off-diagonal 0.891; phase: anti-diagonal 0.227, off-diagonal 0.231
LS: 4362 conditions; rate: anti-diagonal 0.792, off-diagonal 0.873; phase: anti-diagonal 0.036, off-diagonal 0.070
(a) anti-diagonal: LS phase 0.036 lower than HPC rate 0.868: True; lower than HPC phase 0.227: True
(b) off-diagonal: LS phase 0.070 lower than HPC rate 0.891: True; lower than HPC phase 0.231: True
colour axis -1 to 1; correlations lie in [-1, 1], none outside

Result: reproduced under both readings. Across 4,362 LS conditions the LS phase correlation is 0.036 on the anti-diagonal away from the centre and 0.070 off the diagonal. That is lower than hippocampal rate (0.868 and 0.891) and hippocampal phase (0.227 and 0.231) across 5,723 conditions.

fig4d-depth-gradient¶

The strength of phase coding relative to rate coding increases with recording depth within the LS, within sessions and across animals.

In [22]:
sess_by = {S["session"]: S for S in sessions}
# which depth is the LS probe's, and which way sites run, are not stored (session descriptions); both are run
dep = pd.DataFrame([{"subject": S["subject"], "session": S["session"], "d1": S["depth"], "d2": S["depth2"]} for S in sessions if S["units"]])
print("session-name depths by animal (um): first", dep.groupby("subject").d1.agg(["min", "max"]).to_dict("index"))
print("                                     second", dep.groupby("subject").d2.agg(["min", "max"]).to_dict("index"))
first_ls = {s_: next(U for U in sess_by[s_]["units"] if U["region"] == "ls")["site"] for s_ in DL.session.unique()}
def across(DD):
    out = {}
    for sub, g in DD.groupby("subject"):
        if len(g) >= 4:
            out[sub] = stats.pearsonr(g.depth, g.d)
    c = DD.copy()
    c["dc"] = c.groupby("subject").depth.transform(lambda x: x - x.mean()); c["vc"] = c.groupby("subject").d.transform(lambda x: x - x.mean())
    return out, stats.pearsonr(c.dc, c.vc)
rows4 = []
for rd in RD:
    sub_ = DL[DL[f"{rd}_d"].notna()]
    for dname, dkey in (("first", "depth"), ("second (variant)", "depth2")):
        for sdir in (1, -1):
            DD = pd.DataFrame([{"session": s_, "subject": sess_by[s_]["subject"], "depth": sess_by[s_][dkey] + sdir * 10 * first_ls[s_],
                                "d": g[f"{rd}_d"].mean()} for s_, g in sub_.groupby("session")])
            for lab, dd in (("all", DD), ("no last DT9", DD.drop(DD[DD.subject == "DT9"].sort_values("session").index[-1:]))):
                per, pooled = across(dd)
                rows4.append({"reading": rd, "depth": dname, "site_dir": "+" if sdir > 0 else "-", "sessions": lab,
                              "per_animal_r": " ".join(f"{k}:{v[0]:.2f}" for k, v in per.items()),
                              "a_all_neg": all(v[0] < 0 for v in per.values()), "pooled_r": round(pooled[0], 3), "pooled_p": pooled[1],
                              "b_pooled_neg": bool(pooled[0] < 0 and pooled[1] < 0.05)})
F4 = pd.DataFrame(rows4)
print(F4.to_string(index=False))
wr = []
for rd in RD:
    sub_ = DL[DL[f"{rd}_d"].notna()]
    rr = []
    for s_, g in sub_.groupby("session"):
        gu = g.groupby("unit").agg(site=("site", "first"), d=(f"{rd}_d", "mean"))
        if gu.site.nunique() >= 5:
            rr.append(stats.pearsonr(gu.site, gu.d)[0])
    rr = np.array(rr)
    wr.append({"reading": rd, "sessions": len(rr), "r<0 (sites deeper with index)": int((rr < 0).sum()),
               "r>0 (sites shallower with index)": int((rr > 0).sum()), "median_r": round(np.median(rr), 3)})
print("within sessions with units on >= 5 sites, site index against phase - rate MSE:")
print(pd.DataFrame(wr).to_string(index=False))
# the same analysis with phases shifted within trials (decoder calibration), first depth, both site directions
rows4n = []
for rd in tg.NULL_READINGS:
    X = DL[DL.null.astype(bool)].copy()
    X["dn"] = [np.nanmean(a) - np.nanmean(b) for a, b in zip(X[f"null_{rd}_phase_cos"], X[f"null_{rd}_rate"])]
    X = X[np.isfinite(X.dn)]
    for sdir in (1, -1):
        DD = pd.DataFrame([{"session": s_, "subject": sess_by[s_]["subject"], "depth": sess_by[s_]["depth"] + sdir * 10 * first_ls[s_],
                            "d": g.dn.mean()} for s_, g in X.groupby("session")])
        per, pooled = across(DD)
        rr = []
        for s_, g in X.groupby("session"):
            gu = g.groupby("unit").agg(site=("site", "first"), d=("dn", "mean"))
            if gu.site.nunique() >= 5:
                rr.append(stats.pearsonr(gu.site, gu.d)[0])
        rr = np.array(rr)
        rows4n.append({"null reading": rd, "site_dir": "+" if sdir > 0 else "-", "per_animal_r": " ".join(f"{k}:{v[0]:.2f}" for k, v in per.items()),
                       "a_all_neg": all(v[0] < 0 for v in per.values()), "pooled_r": round(pooled[0], 3), "pooled_p": round(pooled[1], 4),
                       "within: sessions": len(rr), "r<0 with depth": int(((rr * sdir) < 0).sum())})
print("shifted-phase null, first depth (within: r < 0 against depth, so against the site index when sites deepen, against its reverse otherwise):")
print(pd.DataFrame(rows4n).to_string(index=False))
session-name depths by animal (um): first {'DT2': {'min': 3324, 'max': 3612}, 'DT5': {'min': 972, 'max': 2124}, 'DT7': {'min': 216, 'max': 1440}, 'DT8': {'min': 0, 'max': 612}, 'DT9': {'min': 0, 'max': 900}}
                                     second {'DT2': {'min': 1000, 'max': 1360}, 'DT5': {'min': 1224, 'max': 2448}, 'DT7': {'min': 0, 'max': 1170}, 'DT8': {'min': 0, 'max': 2088}, 'DT9': {'min': 0, 'max': 936}}
reading            depth site_dir    sessions                            per_animal_r  a_all_neg  pooled_r  pooled_p  b_pooled_neg
    aa1            first        +         all  DT2:-0.20 DT5:-0.44 DT8:-0.52 DT9:0.62      False    -0.092  0.486252         False
    aa1            first        + no last DT9  DT2:-0.20 DT5:-0.44 DT8:-0.52 DT9:0.70      False    -0.084  0.528991         False
    aa1            first        -         all  DT2:-0.19 DT5:-0.46 DT8:-0.47 DT9:0.57      False    -0.129  0.326949         False
    aa1            first        - no last DT9  DT2:-0.19 DT5:-0.46 DT8:-0.47 DT9:0.65      False    -0.122  0.358735         False
    aa1 second (variant)        +         all   DT2:0.14 DT5:-0.13 DT8:-0.35 DT9:0.65      False    -0.029  0.825083         False
    aa1 second (variant)        + no last DT9   DT2:0.14 DT5:-0.13 DT8:-0.35 DT9:0.74      False    -0.022  0.870354         False
    aa1 second (variant)        -         all   DT2:0.09 DT5:-0.16 DT8:-0.33 DT9:0.63      False    -0.058  0.660678         False
    aa1 second (variant)        - no last DT9   DT2:0.09 DT5:-0.16 DT8:-0.33 DT9:0.73      False    -0.050  0.704658         False
    ba1            first        +         all  DT2:-0.41 DT5:-0.32 DT8:-0.15 DT9:0.64      False     0.007  0.958457         False
    ba1            first        + no last DT9  DT2:-0.41 DT5:-0.32 DT8:-0.15 DT9:0.59      False    -0.029  0.826964         False
    ba1            first        -         all  DT2:-0.39 DT5:-0.34 DT8:-0.11 DT9:0.64      False     0.000  0.998653         False
    ba1            first        - no last DT9  DT2:-0.39 DT5:-0.34 DT8:-0.11 DT9:0.59      False    -0.035  0.793394         False
    ba1 second (variant)        +         all  DT2:-0.12 DT5:-0.07 DT8:-0.43 DT9:0.65      False    -0.073  0.580519         False
    ba1 second (variant)        + no last DT9  DT2:-0.12 DT5:-0.07 DT8:-0.43 DT9:0.59      False    -0.103  0.435943         False
    ba1 second (variant)        -         all  DT2:-0.13 DT5:-0.10 DT8:-0.43 DT9:0.66      False    -0.074  0.573139         False
    ba1 second (variant)        - no last DT9  DT2:-0.13 DT5:-0.10 DT8:-0.43 DT9:0.60      False    -0.107  0.420976         False
    ab1            first        +         all  DT2:-0.20 DT5:-0.35 DT8:-0.44 DT9:0.22      False    -0.126  0.338019         False
    ab1            first        + no last DT9  DT2:-0.20 DT5:-0.35 DT8:-0.44 DT9:0.17      False    -0.145  0.274596         False
    ab1            first        -         all  DT2:-0.19 DT5:-0.38 DT8:-0.44 DT9:0.19      False    -0.105  0.423311         False
    ab1            first        - no last DT9  DT2:-0.19 DT5:-0.38 DT8:-0.44 DT9:0.13      False    -0.123  0.353586         False
    ab1 second (variant)        +         all   DT2:0.14 DT5:-0.05 DT8:-0.28 DT9:0.14      False    -0.070  0.593515         False
    ab1 second (variant)        + no last DT9   DT2:0.14 DT5:-0.05 DT8:-0.28 DT9:0.07      False    -0.084  0.527689         False
    ab1 second (variant)        -         all   DT2:0.09 DT5:-0.08 DT8:-0.27 DT9:0.12      False    -0.067  0.608400         False
    ab1 second (variant)        - no last DT9   DT2:0.09 DT5:-0.08 DT8:-0.27 DT9:0.04      False    -0.082  0.537390         False
    bb1            first        +         all DT2:-0.41 DT5:-0.20 DT8:-0.25 DT9:-0.14       True    -0.209  0.109488         False
    bb1            first        + no last DT9 DT2:-0.41 DT5:-0.20 DT8:-0.25 DT9:-0.15       True    -0.213  0.104689         False
    bb1            first        -         all DT2:-0.39 DT5:-0.24 DT8:-0.22 DT9:-0.22       True    -0.292  0.023693          True
    bb1            first        - no last DT9 DT2:-0.39 DT5:-0.24 DT8:-0.22 DT9:-0.24       True    -0.298  0.022035          True
    bb1 second (variant)        +         all  DT2:-0.12 DT5:0.07 DT8:-0.24 DT9:-0.12      False    -0.112  0.396107         False
    bb1 second (variant)        + no last DT9  DT2:-0.12 DT5:0.07 DT8:-0.24 DT9:-0.14      False    -0.113  0.392718         False
    bb1 second (variant)        -         all  DT2:-0.13 DT5:0.03 DT8:-0.23 DT9:-0.19      False    -0.175  0.181247         False
    bb1 second (variant)        - no last DT9  DT2:-0.13 DT5:0.03 DT8:-0.23 DT9:-0.21      False    -0.178  0.177898         False
    aa0            first        +         all   DT2:-0.54 DT5:-0.13 DT8:0.03 DT9:0.45      False     0.139  0.290602         False
    aa0            first        + no last DT9   DT2:-0.54 DT5:-0.13 DT8:0.03 DT9:0.41      False     0.113  0.392552         False
    aa0            first        -         all  DT2:-0.32 DT5:-0.17 DT8:-0.01 DT9:0.43      False     0.136  0.301367         False
    aa0            first        - no last DT9  DT2:-0.32 DT5:-0.17 DT8:-0.01 DT9:0.38      False     0.111  0.402547         False
    aa0 second (variant)        +         all    DT2:-0.41 DT5:0.22 DT8:0.23 DT9:0.37      False     0.217  0.095100         False
    aa0 second (variant)        + no last DT9    DT2:-0.41 DT5:0.22 DT8:0.23 DT9:0.31      False     0.199  0.130298         False
    aa0 second (variant)        -         all    DT2:-0.20 DT5:0.18 DT8:0.23 DT9:0.36      False     0.222  0.087940         False
    aa0 second (variant)        - no last DT9    DT2:-0.20 DT5:0.18 DT8:0.23 DT9:0.31      False     0.203  0.123117         False
    ba0            first        +         all    DT2:-0.10 DT5:0.25 DT8:0.37 DT9:0.54      False     0.346  0.006780         False
    ba0            first        + no last DT9    DT2:-0.10 DT5:0.25 DT8:0.37 DT9:0.55      False     0.345  0.007477         False
    ba0            first        -         all    DT2:-0.35 DT5:0.19 DT8:0.40 DT9:0.50      False     0.324  0.011690         False
    ba0            first        - no last DT9    DT2:-0.35 DT5:0.19 DT8:0.40 DT9:0.50      False     0.322  0.012933         False
    ba0 second (variant)        +         all    DT2:-0.03 DT5:0.53 DT8:0.44 DT9:0.38      False     0.413  0.001041         False
    ba0 second (variant)        + no last DT9    DT2:-0.03 DT5:0.53 DT8:0.44 DT9:0.38      False     0.412  0.001189         False
    ba0 second (variant)        -         all    DT2:-0.27 DT5:0.50 DT8:0.44 DT9:0.36      False     0.419  0.000851         False
    ba0 second (variant)        - no last DT9    DT2:-0.27 DT5:0.50 DT8:0.44 DT9:0.36      False     0.419  0.000965         False
within sessions with units on >= 5 sites, site index against phase - rate MSE:
reading  sessions  r<0 (sites deeper with index)  r>0 (sites shallower with index)  median_r
    aa1        47                             21                                26     0.051
    ba1        47                             22                                25     0.032
    ab1        47                             24                                23    -0.007
    bb1        47                             26                                21    -0.025
    aa0        47                             22                                25     0.023
    ba0        47                             25                                22    -0.041
shifted-phase null, first depth (within: r < 0 against depth, so against the site index when sites deepen, against its reverse otherwise):
null reading site_dir                           per_animal_r  a_all_neg  pooled_r  pooled_p  within: sessions  r<0 with depth
         aa1        + DT2:-0.33 DT5:-0.16 DT8:-0.16 DT9:0.57      False     0.079    0.5510                47              29
         aa1        - DT2:-0.49 DT5:-0.21 DT8:-0.15 DT9:0.55      False    -0.031    0.8139                47              18
         ba1        +  DT2:-0.23 DT5:-0.20 DT8:0.02 DT9:0.32      False     0.071    0.5882                47              24
         ba1        -  DT2:-0.31 DT5:-0.20 DT8:0.06 DT9:0.32      False     0.039    0.7698                47              23
         aa0        + DT2:-0.26 DT5:-0.25 DT8:-0.03 DT9:0.07      False    -0.020    0.8791                47              18
         aa0        - DT2:-0.15 DT5:-0.27 DT8:-0.05 DT9:0.02      False    -0.002    0.9869                47              29
         ba0        +   DT2:-0.03 DT5:0.17 DT8:0.36 DT9:0.38      False     0.273    0.0348                47              23
         ba0        -   DT2:-0.24 DT5:0.13 DT8:0.38 DT9:0.33      False     0.251    0.0532                47              24
         ab1        + DT2:-0.33 DT5:-0.11 DT8:-0.31 DT9:0.34      False    -0.111    0.3984                47              24
         ab1        - DT2:-0.49 DT5:-0.15 DT8:-0.37 DT9:0.30      False    -0.208    0.1113                47              23
         bb1        +  DT2:-0.23 DT5:-0.26 DT8:0.14 DT9:0.21      False    -0.094    0.4752                47              28
         bb1        -  DT2:-0.31 DT5:-0.26 DT8:0.15 DT9:0.14      False    -0.189    0.1488                47              19

Result: reproduced under one reading, resting on the assumptions that undefined phase is set to 0 and that the site index increases with depth. With samples split and 1.5 cm bins (bb1), the across-session correlation of depth with phase minus rate MSE is negative in all four animals with at least four LS sessions (DT2 -0.41, DT5 -0.20, DT8 -0.25, DT9 -0.14; reading a), though the pooled r = -0.209 is not significant (p = 0.11), and within sessions r < 0 in 26 of 47. Under the other five readings the across-animal part fails (DT9 r +0.62 under aa1, pooled r -0.092, p = 0.49) and within sessions r < 0 in 21 to 25 of 47. With the site index taken to decrease with depth, bb1 holds across animals (pooled r = -0.292, p = 0.024), but within sessions the relation with depth is negative in only 21 of 47. With the second session-name depth, no reading holds across animals. The match is a bare majority under one reading. With phases shifted within trials, bb1 does not give the across-animal pattern (DT8 +0.14, DT9 +0.21; pooled r = -0.094, p = 0.48), but the within-session majority is reached by shifted phases as well (28 of 47 negative with sites deepening), so the within-session part is no stronger than chance. This is the outcome verified in round 2. In round 3, which reviewed only proposed changes, the verifier noted that this criterion also has no "under one reading" clause for the decoder readings and that judged on aa1 alone the claim would likely be not reproduced; no change was proposed for it.

fig4e-onset-depth¶

The theta phase at the onset of LS phase fields varies with recording depth (DT5 r = 0.38, DT9 r = 0.25, DT2 r = 0.27; circular-linear correlation, p < 0.001).

In [23]:
out = []
SIG = {}
for rd in RD:
    sig = DL[DL[f"{rd}_sig_chance"] & DL.key.isin(ACTIVE)].copy()
    sig["depth_a"] = [sess_by[s]["depth"] for s in sig.session]
    sig["depth_b"] = sig.depth_a + 10 * sig.site
    SIG[rd] = sig
    best = sig.loc[sig.groupby("key")[f"{rd}_mphase"].idxmin()]
    for r1, df in (("a each", sig), ("b best", best)):
        for r3 in ("onset_spikes", "onset_map"):
            for r4 in ("depth_a", "depth_b"):
                row = {"reading": rd, "conds": r1, "phase": r3, "depth": r4}
                n001 = 0
                for sub in ("DT5", "DT9", "DT2"):
                    g = df[(df.subject == sub) & df[r3].notna()]
                    r, p = tg.circ_corrcl(g[r3].values, g[r4].values) if len(g) > 3 else (np.nan, np.nan)
                    row[sub] = f"r={r:.3f} p={p:.1e} n={len(g)}"
                    n001 += bool(p < 0.001)
                row["animals_p<0.001"] = n001
                out.append(row)
pd.set_option("display.max_colwidth", 40)
print(pd.DataFrame(out).to_string(index=False))
print("expected r: DT5 0.38 +/- 0.038, DT9 0.25 +/- 0.025, DT2 0.27 +/- 0.027, each p < 0.001")
reading  conds        phase   depth                     DT5                     DT9                     DT2  animals_p<0.001
    aa1 a each onset_spikes depth_a r=0.174 p=5.2e-02 n=194 r=0.172 p=8.3e-02 n=167  r=0.241 p=1.1e-01 n=76                0
    aa1 a each onset_spikes depth_b r=0.168 p=6.5e-02 n=194 r=0.182 p=6.3e-02 n=167  r=0.244 p=1.0e-01 n=76                0
    aa1 a each    onset_map depth_a r=0.164 p=7.1e-02 n=196 r=0.190 p=4.7e-02 n=170  r=0.276 p=4.3e-02 n=83                0
    aa1 a each    onset_map depth_b r=0.156 p=9.1e-02 n=196 r=0.193 p=4.2e-02 n=170  r=0.268 p=5.1e-02 n=83                0
    aa1 b best onset_spikes depth_a r=0.206 p=8.1e-02 n=119  r=0.163 p=3.4e-01 n=82  r=0.312 p=6.2e-02 n=57                0
    aa1 b best onset_spikes depth_b r=0.199 p=9.5e-02 n=119  r=0.173 p=2.9e-01 n=82  r=0.319 p=5.5e-02 n=57                0
    aa1 b best    onset_map depth_a r=0.204 p=8.1e-02 n=121  r=0.199 p=1.9e-01 n=83  r=0.343 p=2.9e-02 n=60                0
    aa1 b best    onset_map depth_b r=0.192 p=1.1e-01 n=121  r=0.204 p=1.8e-01 n=83  r=0.332 p=3.7e-02 n=60                0
    ba1 a each onset_spikes depth_a r=0.138 p=1.1e-01 n=232 r=0.176 p=4.4e-02 n=203 r=0.132 p=3.1e-01 n=134                0
    ba1 a each onset_spikes depth_b r=0.138 p=1.1e-01 n=232 r=0.186 p=3.0e-02 n=203 r=0.127 p=3.4e-01 n=134                0
    ba1 a each    onset_map depth_a r=0.118 p=1.9e-01 n=235 r=0.152 p=9.1e-02 n=207 r=0.140 p=2.4e-01 n=144                0
    ba1 a each    onset_map depth_b r=0.119 p=1.9e-01 n=235 r=0.156 p=8.2e-02 n=207 r=0.126 p=3.2e-01 n=144                0
    ba1 b best onset_spikes depth_a r=0.160 p=1.6e-01 n=141  r=0.254 p=5.9e-02 n=88  r=0.166 p=3.2e-01 n=83                0
    ba1 b best onset_spikes depth_b r=0.158 p=1.7e-01 n=141  r=0.259 p=5.2e-02 n=88  r=0.153 p=3.8e-01 n=83                0
    ba1 b best    onset_map depth_a r=0.177 p=1.1e-01 n=143  r=0.263 p=4.4e-02 n=90  r=0.184 p=2.2e-01 n=89                0
    ba1 b best    onset_map depth_b r=0.174 p=1.1e-01 n=143  r=0.260 p=4.8e-02 n=90  r=0.179 p=2.4e-01 n=89                0
    ab1 a each onset_spikes depth_a r=0.184 p=4.5e-02 n=183 r=0.229 p=1.9e-02 n=152  r=0.241 p=1.1e-01 n=76                0
    ab1 a each onset_spikes depth_b r=0.178 p=5.5e-02 n=183 r=0.230 p=1.8e-02 n=152  r=0.244 p=1.0e-01 n=76                0
    ab1 a each    onset_map depth_a r=0.152 p=1.2e-01 n=185 r=0.247 p=8.4e-03 n=156  r=0.276 p=4.3e-02 n=83                0
    ab1 a each    onset_map depth_b r=0.146 p=1.4e-01 n=185 r=0.245 p=9.2e-03 n=156  r=0.268 p=5.1e-02 n=83                0
    ab1 b best onset_spikes depth_a r=0.211 p=7.9e-02 n=114  r=0.144 p=4.3e-01 n=80  r=0.312 p=6.2e-02 n=57                0
    ab1 b best onset_spikes depth_b r=0.200 p=1.0e-01 n=114  r=0.142 p=4.5e-01 n=80  r=0.319 p=5.5e-02 n=57                0
    ab1 b best    onset_map depth_a r=0.192 p=1.2e-01 n=115  r=0.199 p=2.0e-01 n=81  r=0.343 p=2.9e-02 n=60                0
    ab1 b best    onset_map depth_b r=0.185 p=1.4e-01 n=115  r=0.190 p=2.3e-01 n=81  r=0.332 p=3.7e-02 n=60                0
    bb1 a each onset_spikes depth_a r=0.061 p=6.6e-01 n=225 r=0.244 p=3.0e-03 n=195 r=0.132 p=3.1e-01 n=134                0
    bb1 a each onset_spikes depth_b r=0.054 p=7.2e-01 n=225 r=0.249 p=2.4e-03 n=195 r=0.127 p=3.4e-01 n=134                0
    bb1 a each    onset_map depth_a r=0.033 p=8.8e-01 n=231 r=0.263 p=1.1e-03 n=198 r=0.140 p=2.4e-01 n=144                0
    bb1 a each    onset_map depth_b r=0.025 p=9.3e-01 n=231 r=0.263 p=1.1e-03 n=198 r=0.126 p=3.2e-01 n=144                0
    bb1 b best onset_spikes depth_a r=0.059 p=7.9e-01 n=137  r=0.276 p=3.8e-02 n=86  r=0.166 p=3.2e-01 n=83                0
    bb1 b best onset_spikes depth_b r=0.050 p=8.4e-01 n=137  r=0.279 p=3.5e-02 n=86  r=0.153 p=3.8e-01 n=83                0
    bb1 b best    onset_map depth_a r=0.075 p=6.7e-01 n=139  r=0.317 p=1.3e-02 n=87  r=0.184 p=2.2e-01 n=89                0
    bb1 b best    onset_map depth_b r=0.069 p=7.2e-01 n=139  r=0.316 p=1.3e-02 n=87  r=0.179 p=2.4e-01 n=89                0
    aa0 a each onset_spikes depth_a r=0.109 p=1.1e-01 n=371 r=0.176 p=1.9e-02 n=253 r=0.105 p=3.9e-01 n=170                0
    aa0 a each onset_spikes depth_b r=0.115 p=8.5e-02 n=371 r=0.178 p=1.8e-02 n=253 r=0.160 p=1.1e-01 n=170                0
    aa0 a each    onset_map depth_a r=0.083 p=2.7e-01 n=384 r=0.176 p=1.5e-02 n=268 r=0.123 p=2.4e-01 n=189                0
    aa0 a each    onset_map depth_b r=0.087 p=2.3e-01 n=384 r=0.181 p=1.2e-02 n=268 r=0.173 p=5.8e-02 n=189                0
    aa0 b best onset_spikes depth_a r=0.028 p=9.4e-01 n=170  r=0.205 p=1.3e-01 n=96  r=0.183 p=2.1e-01 n=93                0
    aa0 b best onset_spikes depth_b r=0.025 p=9.5e-01 n=170  r=0.204 p=1.4e-01 n=96  r=0.201 p=1.5e-01 n=93                0
    aa0 b best    onset_map depth_a r=0.082 p=5.6e-01 n=177 r=0.209 p=1.1e-01 n=103 r=0.263 p=2.6e-02 n=106                0
    aa0 b best    onset_map depth_b r=0.072 p=6.3e-01 n=177 r=0.213 p=9.7e-02 n=103 r=0.271 p=2.1e-02 n=106                0
    ba0 a each onset_spikes depth_a r=0.094 p=3.1e-02 n=785 r=0.157 p=3.2e-03 n=465 r=0.076 p=1.7e-01 n=619                0
    ba0 a each onset_spikes depth_b r=0.094 p=3.2e-02 n=785 r=0.157 p=3.3e-03 n=465 r=0.071 p=2.1e-01 n=619                0
    ba0 a each    onset_map depth_a r=0.071 p=1.3e-01 n=822 r=0.132 p=1.3e-02 n=496 r=0.042 p=5.5e-01 n=684                0
    ba0 a each    onset_map depth_b r=0.073 p=1.1e-01 n=822 r=0.136 p=1.0e-02 n=496 r=0.045 p=5.0e-01 n=684                0
    ba0 b best onset_spikes depth_a r=0.127 p=1.5e-01 n=232 r=0.186 p=9.3e-02 n=138 r=0.049 p=8.5e-01 n=133                0
    ba0 b best onset_spikes depth_b r=0.122 p=1.8e-01 n=232 r=0.187 p=9.0e-02 n=138 r=0.047 p=8.6e-01 n=133                0
    ba0 b best    onset_map depth_a r=0.117 p=1.9e-01 n=240 r=0.107 p=4.3e-01 n=148 r=0.048 p=8.3e-01 n=157                0
    ba0 b best    onset_map depth_b r=0.118 p=1.9e-01 n=240 r=0.115 p=3.8e-01 n=148 r=0.069 p=6.9e-01 n=157                0
expected r: DT5 0.38 +/- 0.038, DT9 0.25 +/- 0.025, DT2 0.27 +/- 0.027, each p < 0.001

Result: not reproduced. No animal reaches p < 0.001 under any of the 48 readings (six decoder readings for the neuron set, two condition, two onset and two depth readings). The closest is DT9 under bb1, r = 0.263 (p = 0.0011, onset from the phase map). Under aa1, each condition, spike phases and session depth: DT5 r = 0.174 (p = 0.052), DT9 0.172 (p = 0.083), DT2 0.241 (p = 0.11).

fig4e-onset-mediolateral¶

The starting phase of LS phase fields varies systematically along the medial-lateral axis across animals.

In [24]:
# Medial-lateral LS coordinates (mm) as Figure S1A's labels give them (supplement, page 6):
# DT2 ".6 ML" and "1.5 ML"; DT5 ".5ML"; DT7 ".5 ML"; DT8 ".5 ML"; DT9 "1.5 ML".
ML_FIRST = {"DT2": 0.6, "DT5": 0.5, "DT7": 0.5, "DT8": 0.5, "DT9": 1.5}
ML_MEAN = {"DT2": (0.6 + 1.5) / 2, "DT5": 0.5, "DT7": 0.5, "DT8": 0.5, "DT9": 1.5}
out = []
for rd in RD:
    for r3 in ("onset_spikes", "onset_map"):
        g = SIG[rd][SIG[rd][r3].notna()]
        groups = [x[r3].values for _, x in g.groupby("subject") if len(x) > 1]
        if len(groups) < 2:
            continue
        means = g.groupby("subject")[r3].apply(tg.circ_mean)
        kw = stats.kruskal(*groups)
        ww = tg.circ_wwtest(groups)
        ra, pa = tg.circ_corrcl(means.values, np.array([ML_FIRST[s] for s in means.index]))
        rb, pb = tg.circ_corrcl(means.values, np.array([ML_MEAN[s] for s in means.index]))
        out.append({"reading": rd, "onset": r3, "means": " ".join(f"{k}:{v:.2f}" for k, v in means.items()), "n": len(g),
                    "KW_p": kw.pvalue, "WW_p": ww[0], "WW_rw": round(ww[2], 3), "r_first": round(ra, 3), "r_mean": round(rb, 3),
                    "rule": bool(max(abs(ra), abs(rb)) >= 0.8 and min(kw.pvalue, ww[0]) < 0.05)})
pd.set_option("display.max_colwidth", 60)
print(pd.DataFrame(out).to_string(index=False))
print("Watson-Williams assumes concentrated samples (pooled resultant length rw > 0.45)")
reading        onset                                           means    n     KW_p          WW_p  WW_rw  r_first  r_mean  rule
    aa1 onset_spikes DT2:2.17 DT5:-1.46 DT7:0.21 DT8:-0.27 DT9:-0.01  545 0.237153  5.597348e-14  0.182    0.382   0.435 False
    aa1    onset_map DT2:2.50 DT5:-1.36 DT7:0.43 DT8:-0.42 DT9:-0.03  563 0.166532  3.757482e-18  0.220    0.376   0.366 False
    ba1 onset_spikes  DT2:2.79 DT5:-1.10 DT7:0.22 DT8:0.75 DT9:-0.18  712 0.618907  3.920653e-24  0.160    0.317   0.160 False
    ba1    onset_map  DT2:2.91 DT5:-1.30 DT7:0.34 DT8:0.68 DT9:-0.20  737 0.127945  9.818188e-29  0.166    0.360   0.135 False
    ab1 onset_spikes   DT2:2.17 DT5:2.64 DT7:0.07 DT8:0.66 DT9:-0.27  513 0.297592  1.300014e-12  0.141    0.739   0.466 False
    ab1    onset_map  DT2:2.50 DT5:-2.36 DT7:0.18 DT8:0.30 DT9:-0.24  532 0.686045  2.619581e-18  0.171    0.445   0.075 False
    bb1 onset_spikes  DT2:2.79 DT5:-1.43 DT7:0.06 DT8:0.73 DT9:-0.18  696 0.304655  2.036552e-28  0.179    0.342   0.094 False
    bb1    onset_map  DT2:2.91 DT5:-1.50 DT7:0.23 DT8:0.29 DT9:-0.23  722 0.040112  1.825446e-31  0.193    0.318   0.130 False
    aa0 onset_spikes   DT2:2.45 DT5:-0.26 DT7:0.25 DT8:1.03 DT9:0.84  916 0.669936  2.327162e-26  0.138    0.486   0.519 False
    aa0    onset_map   DT2:2.59 DT5:-0.40 DT7:0.19 DT8:1.04 DT9:0.79  976 0.066959  3.965540e-35  0.151    0.469   0.493 False
    ba0 onset_spikes  DT2:2.74 DT5:-1.11 DT7:0.08 DT8:-0.61 DT9:0.69 2346 0.039829 1.134801e-118  0.112    0.748   0.827  True
    ba0    onset_map  DT2:2.94 DT5:-1.15 DT7:0.06 DT8:-0.40 DT9:0.62 2519 0.003225 1.664751e-136  0.124    0.737   0.820  True
Watson-Williams assumes concentrated samples (pooled resultant length rw > 0.45)

Result: partially reproduced, resting on the assumption that undefined phase is set to 0. The Kruskal-Wallis test finds the animals' onsets different only under bb1 with the onset from the phase map (p = 0.040); under the other readings p = 0.13 to 0.68. The Watson-Williams test gives p < 1e-5 under every reading, but its assumption of concentrated samples fails (pooled resultant length 0.14 to 0.22, below 0.45), so it is not relied on. The circular-linear correlation of the animal means with the medial-lateral coordinate is 0.074 to 0.740, below 0.8 under every reading (aa1: 0.38 and 0.44). With undefined phase left out and samples split (ba0, variant) the rule holds (Kruskal-Wallis p = 0.040 and 0.0032, r up to 0.827), but that variant fails the decoder calibration.

speed-independent¶

Only 2.8% (125 of 4,393) of LS conditions showed a significant correlation between running speed and the rate of phase precession, and 10.7% of LS rate maps were modulated by running speed, so LS phase coding seems independent of running speed.

In [25]:
t = time.time()
with ProcessPoolExecutor(4, mp_context=ctx) as ex:
    sp_parts = list(ex.map(tg.speed_session, sessions, [seeds[S["session"]] + 1 for S in sessions]))
SP = [r for p in sp_parts for r in p]
print(f"{len(SP)} LS conditions in {time.time()-t:.0f} s")
for k, nm in (("a", "regression slope"), ("b", "circular-linear r")):
    v = [r["prec"][k] for r in SP if r["prec"] is not None and np.isfinite(r["prec"][k][1])]
    print(f"precession as {nm}: {sum(p < 0.01 for _, p in v)}/{len(v)} = {np.mean([p < 0.01 for _, p in v]):.3f} significant; "
          f"{len(SP) - len(v)} conditions not tested (fewer than 5 trials with at least 5 spikes on the track, or no variance)")
    vn = [r["prec"][k + "_null"] for r in SP if r["prec"] is not None and np.isfinite(r["prec"][k + "_null"][1])]
    print(f"   calibration, speed permuted over trials first: {np.mean([p < 0.01 for _, p in vn]):.4f} significant at p < 0.01 ({len(vn)} conditions)")
for k, nm in (("a", "per spike"), ("b", "100 ms bins")):
    v = [r["ratespeed"][k] for r in SP if r["ratespeed"] is not None and k in r["ratespeed"]]
    print(f"rate and speed {nm}: {sum(p < 0.01 for _, p in v)}/{len(v)} = {np.mean([p < 0.01 for _, p in v]):.3f} significant; median r {np.median([r for r, _ in v]):.3f}")
4362 LS conditions in 51 s
precession as regression slope: 12/2879 = 0.004 significant; 1483 conditions not tested (fewer than 5 trials with at least 5 spikes on the track, or no variance)
   calibration, speed permuted over trials first: 0.0024 significant at p < 0.01 (2879 conditions)
precession as circular-linear r: 26/2877 = 0.009 significant; 1485 conditions not tested (fewer than 5 trials with at least 5 spikes on the track, or no variance)
   calibration, speed permuted over trials first: 0.0049 significant at p < 0.01 (2877 conditions)
rate and speed per spike: 251/4362 = 0.058 significant; median r -0.060
rate and speed 100 ms bins: 329/4362 = 0.075 significant; median r 0.008

Result: partially reproduced. Both fractions are small, but both are below tolerance. Speed correlates with the rate of precession in 12 of 2,879 LS conditions (0.004, slope) or 26 of 2,877 (0.009, circular-linear r), against 0.028 +/- 0.0028; 1,483 conditions were not tested (fewer than 5 trials with at least 5 spikes on the track). With speed permuted first, the same test passes 0.0024 and 0.0049 of conditions, so it is conservative. Rate is modulated by speed in 0.058 (per spike) or 0.075 (100 ms bins) of 4,362 conditions, against 0.107 +/- 0.0107. Both are below 20%.

fig5-assemblies¶

Spike trains of hippocampal neurons predicted LS firing in 18.5% (2,087 of 11,264) of hippocampal-LS pairs, with a median optimal timescale of 25 ms.

In [26]:
# Population of pairs: an LS unit and a hippocampal unit of the same session, both included in the condition
rng_pp = np.random.default_rng(5)
cand, all_cond_pairs = [], 0
for S in sessions:
    if not S["units"] or "trial_phase_ms" not in S:
        continue
    inc = {ui: set(tg.included_conditions(S, U)) for ui, U in enumerate(S["units"]) if "phase" in U}
    hp_ = [ui for ui in inc if S["units"][ui]["region"] in tg.HPC_LABELS]
    T = S["trials"]
    nh = sum(U["region"] in tg.HPC_LABELS for U in S["units"]); nl = sum(U["region"] == "ls" for U in S["units"])
    all_cond_pairs += nh * nl * sum((T["condition"] == c).sum() >= tg.MIN_TRIALS for c in np.unique(T["condition"]))
    for ul in inc:
        if S["units"][ul]["region"] != "ls":
            continue
        for c in inc[ul]:
            cand.append((S["session"], ul, c, sum(c in inc[uh] for uh in hp_)))
total_pairs = sum(x[3] for x in cand)
PP_TARGET = 6000
frac = min(1.0, PP_TARGET / total_pairs)
pick = [x for x in cand if rng_pp.random() < frac]
print(f"pairs by condition, all units (conditions with >= 10 trials): {all_cond_pairs}")
print(f"pairs by condition with both units included: {total_pairs}, over {len(cand)} LS unit-conditions; "
      f"sampled {len(pick)} LS unit-conditions ({frac:.3f}) with all their included hippocampal partners: {sum(x[3] for x in pick)} pairs")
picks = {}
for s_, ul, c, _ in pick:
    picks.setdefault(s_, []).append((ul, c))
t = time.time()
with ProcessPoolExecutor(4, mp_context=ctx) as ex:
    pp_parts = list(ex.map(tg.peer_session, sessions, [picks.get(S["session"], []) for S in sessions], [seeds[S["session"]] + 4 for S in sessions]))
PP = pd.DataFrame([r for p in pp_parts for r in p])
print(f"{len(PP)} pairs fitted in {time.time()-t:.0f} s (150 windows x 11 fits each); strength not finite: {int(PP.strength.isna().sum())}")
PP["rule_b"] = (PP.best_idx > 7) & (PP.best_idx < 150) & (PP.mean_dev > 40) & (PP.ntrials > 10) & (PP.spikes_h + PP.spikes_l > 100)
PP["asm_a"] = PP.strength >= 4
PP["asm_b"] = PP.asm_a & PP.rule_b
for rd, col in (("a: Methods rule (strength >= 4)", "asm_a"), ("b: with makeFig5.m rules", "asm_b")):
    A = PP[PP[col]]
    print(f"reading {rd}: {len(A)}/{len(PP)} = {PP[col].mean():.3f} assemblies; median timescale w {A.best_w.median():.1f} ms, "
          f"full box 2w+1 {np.median(2 * A.best_w + 1):.1f} ms")
print("pairs passing the makeFig5.m rules (any strength):", int(PP.rule_b.sum()), "| estimated in the whole population:", round(PP.rule_b.mean() * total_pairs))
print("by animal, reading a:", PP.groupby("subject").asm_a.mean().round(3).to_dict(), "| pairs:", PP.subject.value_counts().to_dict())
print("strength quantiles (10, 50, 90%):", np.nanpercentile(PP.strength, [10, 50, 90]).round(2), "| best window at 1 ms:", int((PP.best_w == 1).sum()),
      "| at 150 ms:", int((PP.best_w == 150).sum()))
print("expected: fraction 0.185 +/- 0.0185, median timescale 25 +/- 2.5 ms, pairs examined 11,264 +/- 1,126.4")
pairs by condition, all units (conditions with >= 10 trials): 619934
pairs by condition with both units included: 81393, over 4362 LS unit-conditions; sampled 348 LS unit-conditions (0.074) with all their included hippocampal partners: 7098 pairs
7098 pairs fitted in 1039 s (150 windows x 11 fits each); strength not finite: 0
reading a: Methods rule (strength >= 4): 1890/7098 = 0.266 assemblies; median timescale w 4.0 ms, full box 2w+1 9.0 ms
reading b: with makeFig5.m rules: 534/7098 = 0.075 assemblies; median timescale w 20.0 ms, full box 2w+1 41.0 ms
pairs passing the makeFig5.m rules (any strength): 3124 | estimated in the whole population: 35823
by animal, reading a: {'DT2': 0.259, 'DT5': 0.288, 'DT7': 0.2, 'DT9': 0.265} | pairs: {'DT2': 4314, 'DT5': 1680, 'DT9': 1014, 'DT7': 90}
strength quantiles (10, 50, 90%): [0.56 2.3  7.25] | best window at 1 ms: 874 | at 150 ms: 269
expected: fraction 0.185 +/- 0.0185, median timescale 25 +/- 2.5 ms, pairs examined 11,264 +/- 1,126.4

Result: not reproduced, on a random sample and resting on assumptions about the fit. 348 of the 4,362 LS unit-conditions were drawn, with all 7,098 of their pairs with included hippocampal units. Under the Methods rule (a) 0.266 of pairs are assemblies, with a median best window of 4 ms (9 ms as the full box); with the makeFig5.m rules (b) 0.075, with 20 ms (41 ms). Neither fraction is within 0.185 +/- 0.0185 and no timescale reading is within 25 +/- 2.5 ms. The population holds 81,393 pairs with both units included (35,823 estimated to pass the makeFig5.m rules), against the paper's 11,264 pairs. 874 pairs had their best window at 1 ms and 269 at 150 ms, the ends of the range. The zero-lag strength rule of makeFig5.m is not applied. These assemblies match neither the paper's fraction nor its timescale, so the claims tested on them (fig5g, figs5, fig6e) are tested on a different assembly set from the paper's.

fig5g-assembly-neurons-stronger-phase¶

LS neurons that take part in at least one predictive assembly carry a stronger spatial phase code than those that do not (p < 1e-20).

In [27]:
Dk = D.set_index(["session", "unit", "cond"])
PP["ls_d"] = [min(Dk.at[(s_, u, c), "aa1_mphase"], np.nanmean(Dk.at[(s_, u, c), "aa1_phase_raw"])) - Dk.at[(s_, u, c), "aa1_mrate"]
              for s_, u, c in zip(PP.session, PP.ls, PP.cond)]
for col in ("asm_a", "asm_b"):
    nc = PP.groupby(["session", "ls", "cond"]).agg(asm=(col, "any"), d=("ls_d", "first"))
    per_pair = PP[PP[col]].ls_d.values
    non = nc[~nc.asm].d.values
    for rd, a_ in (("(a) one value per assembly pair", per_pair), ("(b) per neuron and condition", nc[nc.asm].d.values)):
        t_ = stats.ttest_ind(a_, non); k_ = stats.ks_2samp(a_, non)
        print(f"{col}, {rd}: assembly {np.mean(a_):.0f} (n={len(a_)}) against non-assembly {np.mean(non):.0f} (n={len(non)}) "
              f"phase - rate MSE; t p = {t_.pvalue:.1e}, KS p = {k_.pvalue:.1e}")
print("phase MSE is the lower of the cosine and raw phase MSE (makeFig5.m), reading aa1")
print("variant, other decoder readings with the cosine phase only (the raw phase MSE is stored for aa1 alone):")
for rd in [r for r in RD if r[2] == "1"]:
    PP["_d"] = [Dk.at[(s_, u, c), f"{rd}_d"] for s_, u, c in zip(PP.session, PP.ls, PP.cond)]
    for col in ("asm_a", "asm_b"):
        nc = PP.groupby(["session", "ls", "cond"]).agg(asm=(col, "any"), d=("_d", "first"))
        a_, non = PP[PP[col]]._d.dropna().values, nc[~nc.asm].d.dropna().values
        b_ = nc[nc.asm].d.dropna().values
        print(f"   {rd}, {col}: per pair {np.mean(a_):.0f} (n={len(a_)}), per neuron {np.mean(b_):.0f} (n={len(b_)}), against {np.mean(non):.0f} (n={len(non)}); "
              f"t p = {stats.ttest_ind(a_, non).pvalue:.2g} and {stats.ttest_ind(b_, non).pvalue:.2g}, KS p = {stats.ks_2samp(a_, non).pvalue:.2g} and {stats.ks_2samp(b_, non).pvalue:.2g}")
asm_a, (a) one value per assembly pair: assembly -275 (n=1890) against non-assembly -437 (n=13) phase - rate MSE; t p = 5.2e-01, KS p = 4.8e-01
asm_a, (b) per neuron and condition: assembly -293 (n=272) against non-assembly -437 (n=13) phase - rate MSE; t p = 5.8e-01, KS p = 4.1e-01
asm_b, (a) one value per assembly pair: assembly -291 (n=534) against non-assembly -337 (n=89) phase - rate MSE; t p = 6.8e-01, KS p = 2.3e-01
asm_b, (b) per neuron and condition: assembly -282 (n=196) against non-assembly -337 (n=89) phase - rate MSE; t p = 6.4e-01, KS p = 4.3e-01
phase MSE is the lower of the cosine and raw phase MSE (makeFig5.m), reading aa1
variant, other decoder readings with the cosine phase only (the raw phase MSE is stored for aa1 alone):
   aa1, asm_a: per pair 379 (n=1890), per neuron 464 (n=272), against -9 (n=13); t p = 0.2 and 0.15, KS p = 0.44 and 0.24
   aa1, asm_b: per pair 442 (n=534), per neuron 513 (n=196), against 288 (n=89); t p = 0.24 and 0.13, KS p = 0.13 and 0.097
   ba1, asm_a: per pair 290 (n=1890), per neuron 396 (n=272), against -146 (n=13); t p = 0.086 and 0.056, KS p = 0.21 and 0.12
   ba1, asm_b: per pair 417 (n=534), per neuron 475 (n=196), against 141 (n=89); t p = 0.017 and 0.0086, KS p = 1.4e-05 and 0.00015
   ab1, asm_a: per pair 297 (n=1890), per neuron 292 (n=272), against -35 (n=13); t p = 0.2 and 0.18, KS p = 0.71 and 0.65
   ab1, asm_b: per pair 356 (n=534), per neuron 348 (n=196), against 120 (n=89); t p = 0.027 and 0.039, KS p = 0.003 and 0.012
   bb1, asm_a: per pair 234 (n=1890), per neuron 286 (n=272), against -74 (n=13); t p = 0.16 and 0.079, KS p = 0.085 and 0.074
   bb1, asm_b: per pair 338 (n=534), per neuron 347 (n=196), against 98 (n=89); t p = 0.009 and 0.0066, KS p = 6.3e-06 and 0.00077

Result: not reproduced, on the same sample. Under the Methods rule nearly every sampled LS neuron-condition is in an assembly (272 against 13), and the assembly values are less negative (-275 per pair, -293 per neuron, against -437; t test p = 0.52 and 0.58). With the makeFig5.m rules, -291 and -282 against -337 (p = 0.68 and 0.64). Assembly neurons do not have the more negative phase minus rate MSE. With the cosine phase only, under the other readings with phase 0, assembly neurons are less negative still (makeFig5.m rules: ba1 p = 0.017, bb1 p = 0.009, in the opposite direction). Only 13 sampled neuron-conditions are outside an assembly under the Methods rule, so that reading is a weak test.

figs5-assembly-independent-of-locking¶

Theta phase locking of hippocampal neurons does not significantly correlate with the strength or timescale of hippocampal-LS assemblies.

In [28]:
lock = []
for s_, uh, c in zip(PP.session, PP.hpc, PP.cond):
    S = sess_by[s_]; U = S["units"][uh]
    m = np.isin(U["trial"], np.where(S["trials"]["condition"] == c)[0])
    R = float(np.abs(np.mean(np.exp(1j * U["phase"][m]))))
    lock.append((R, tg.circ_kappa(R)))
PP["lock_R"], PP["lock_kappa"] = zip(*lock)
for col in ("asm_a", "asm_b"):
    A = PP[PP[col] & np.isfinite(PP.strength)]
    out = []
    for lk in ("lock_kappa", "lock_R"):
        for y in ("strength", "best_w"):
            pr_, sp_ = stats.pearsonr(A[lk], A[y]), stats.spearmanr(A[lk], A[y])
            out.append(f"{lk} vs {y}: Pearson r = {pr_[0]:.3f} (p = {pr_[1]:.2g}), Spearman {sp_[0]:.3f} (p = {sp_[1]:.2g})")
    print(f"{col}, {len(A)} assembly pairs:"); print("   " + "\n   ".join(out))
asm_a, 1890 assembly pairs:
   lock_kappa vs strength: Pearson r = 0.026 (p = 0.26), Spearman 0.031 (p = 0.17)
   lock_kappa vs best_w: Pearson r = 0.023 (p = 0.32), Spearman -0.016 (p = 0.5)
   lock_R vs strength: Pearson r = 0.028 (p = 0.23), Spearman 0.031 (p = 0.17)
   lock_R vs best_w: Pearson r = 0.015 (p = 0.52), Spearman -0.016 (p = 0.5)
asm_b, 534 assembly pairs:
   lock_kappa vs strength: Pearson r = 0.076 (p = 0.081), Spearman 0.102 (p = 0.019)
   lock_kappa vs best_w: Pearson r = -0.022 (p = 0.62), Spearman -0.091 (p = 0.036)
   lock_R vs strength: Pearson r = 0.083 (p = 0.056), Spearman 0.102 (p = 0.019)
   lock_R vs best_w: Pearson r = -0.026 (p = 0.55), Spearman -0.091 (p = 0.036)

Result: reproduced, on the same sample. A claim of absence, judged on Pearson correlation at p < 0.05. Over 1,890 assembly pairs (Methods rule) none of the four correlations of locking (kappa, resultant length) with strength or timescale is significant (r = 0.015 to 0.028, p = 0.23 to 0.52); over 534 pairs with the makeFig5.m rules none is either (r = -0.026 to 0.083, p = 0.056 to 0.62). The Spearman variant is significant for the 534 pairs (p = 0.019 and 0.036), and two Pearson p values are close to 0.05 (0.056 and 0.081), so the absence is fragile. The assembly set does not reproduce fig5-assemblies (0.266 or 0.075 against 0.185), so the absence is shown for a different set of assemblies from the paper's.

fig6-session-counts¶

LS neurons were recorded with CA1 neurons in 63 sessions and with CA3 neurons in 19 sessions, and 14 sessions had LFP from CA1, CA3 and LS together.

In [29]:
g = UN.groupby("session").region.apply(set)
has_ls = g.apply(lambda s: "ls" in s)
hpc_s = g.apply(lambda s: bool(s & set(tg.HPC_LABELS)))
ca1_lab = g.apply(lambda s: bool(s & {"hpc", "ca1"})); ca3_lab = g.apply(lambda s: "ca3" in s)
ca3_site = g.index.isin(list(ca3_sessions))
print(f"LS with hippocampal units: {int((has_ls & hpc_s).sum())}")
print(f"session reading: LS with CA1 {int((has_ls & hpc_s & ~ca3_site).sum())}, LS with CA3 {int((has_ls & hpc_s & ca3_site).sum())}")
print(f"unit labels: LS with CA1 ('hpc'/'ca1') {int((has_ls & ca1_lab).sum())}, LS with CA3 ('ca3') {int((has_ls & ca3_lab).sum())}")
ls_ca1lfp = [S["session"] for S in sessions if S["units"] and any(U["region"] == "ls" for U in S["units"]) and S["chan"]["ca1"]]
ls_ca3lfp = [S["session"] for S in sessions if S["units"] and any(U["region"] == "ls" for U in S["units"]) and S["chan"]["ca3"]]
print(f"variant, by LFP channel: sessions with LS units and a CA1 channel {len(ls_ca1lfp)}, with a CA3 channel {len(ls_ca3lfp)}")
lfp3 = [S["session"] for S in sessions if S["chan"]["ca1"] and S["chan"]["ca3"] and S["chan"]["ls"]]
print(f"sessions with CA1, CA3 and LS LFP channels flagged: {len(lfp3)}; by animal {dict(Counter(sess_by[s]['subject'] for s in lfp3))}")
c1 = {"session reading": int((has_ls & hpc_s & ~ca3_site).sum()), "unit labels": int((has_ls & ca1_lab).sum())}
c3s = {"session reading": int((has_ls & hpc_s & ca3_site).sum()), "unit labels": int((has_ls & ca3_lab).sum())}
for k, v in c1.items():
    c3 = c3s[k]
    print(f"criterion, {k}: LS with CA1 {v} (63 +/- 6.3: {abs(v - 63) <= 6.3}), LS with CA3 {c3} (19 +/- 1.9: {abs(c3 - 19) <= 1.9}), "
          f"LFP {len(lfp3)} (14 +/- 1.4: {abs(len(lfp3) - 14) <= 1.4}); all three within: {abs(v - 63) <= 6.3 and abs(c3 - 19) <= 1.9 and abs(len(lfp3) - 14) <= 1.4}")
dt8 = [S["session"] for S in sessions if S["subject"] == "DT8" and S["units"] and any(U["region"] == "ls" for U in S["units"])]
print(f"DT8 sessions with LS units (no hippocampal units in the files): {len(dt8)}; LS with CA1 counted with all of them: "
      f"{c1['session reading'] + len(dt8)} or {c1['unit labels'] + len(dt8)}")
LS with hippocampal units: 44
session reading: LS with CA1 25, LS with CA3 19
unit labels: LS with CA1 ('hpc'/'ca1') 33, LS with CA3 ('ca3') 11
variant, by LFP channel: sessions with LS units and a CA1 channel 57, with a CA3 channel 19
sessions with CA1, CA3 and LS LFP channels flagged: 14; by animal {'DT5': 12, 'DT7': 2}
criterion, session reading: LS with CA1 25 (63 +/- 6.3: False), LS with CA3 19 (19 +/- 1.9: True), LFP 14 (14 +/- 1.4: True); all three within: False
criterion, unit labels: LS with CA1 33 (63 +/- 6.3: False), LS with CA3 11 (19 +/- 1.9: False), LFP 14 (14 +/- 1.4: True); all three within: False
DT8 sessions with LS units (no hippocampal units in the files): 17; LS with CA1 counted with all of them: 42 or 50

Result: not reproduced (agreed in the third verification round). The criterion has no partial rule: it is reproduced only when all three counts are within tolerance, which the line printed above shows they are not. LS units were recorded with CA3 in 19 sessions under the session reading (19 +/- 1.9), and 14 sessions have CA1, CA3 and LS channels flagged (14 +/- 1.4). LS and CA1 units are together in only 25 sessions (session reading) or 33 (unit labels), against 63. Counting a session's CA1 by its flagged CA1 channel gives 57, within tolerance, but that is a variant: the claim is about CA1 neurons. DT8 has hippocampal channels and a flagged CA1 channel in all 17 sessions but no hippocampal units (data check), which accounts for part of the shortfall: with all 17 DT8 LS sessions counted, LS with CA1 would be 42 or 50, still short of 63.

fig6c-ca3-coherence-increases¶

Theta phase coherence between LS and the CA3 pyramidal layer increases from the beginning to the end of the run, while coherence between LS and CA1 stays relatively flat.

In [30]:
xs = np.linspace(0, 1, 1000)
def lfp_table(key):
    rows = []
    for S in sessions:
        L = S.get("lfp") or {}
        for reg in ("ca1", "ca3"):
            for r in L.get(reg, []):
                z = r[f"{key}_z"]
                if z is None:
                    continue
                rows.append({"session": S["session"], "subject": S["subject"], "reg": reg, "slope": np.polyfit(xs, z, 1)[0],
                             "raw": r[f"{key}_mean"], "z": z})
    return pd.DataFrame(rows)
def judge(T_, label):
    for lvl in ("trial", "session"):
        X = T_ if lvl == "trial" else T_.groupby(["session", "reg"]).agg(slope=("slope", "mean"), raw=("raw", "mean")).reset_index()
        a1, a3 = X[X.reg == "ca1"], X[X.reg == "ca3"]
        o1, o3 = stats.ttest_1samp(a1.slope, 0), stats.ttest_1samp(a3.slope, 0)
        d = stats.ttest_ind(a3.slope, a1.slope)
        r_ = stats.ttest_ind(a3.raw, a1.raw)
        print(f"{label}, per {lvl}: CA1 slope {a1.slope.mean():.3f} (n={len(a1)}, p={o1.pvalue:.1e}); CA3 slope {a3.slope.mean():.3f} "
              f"(n={len(a3)}, p={o3.pvalue:.1e}); CA3 - CA1 slope p={d.pvalue:.1e}; raw mean CA1 {a1.raw.mean():.4f}, CA3 {a3.raw.mean():.4f}, p={r_.pvalue:.1e}")
    for reg in ("ca1", "ca3"):
        Z = np.stack(T_[T_.reg == reg].z)
        m = Z.mean(0)
        print(f"   {reg} mean z curve: last tenth - first tenth = {m[-100:].mean() - m[:100].mean():.3f}; range {m.min():.2f} to {m.max():.2f}")
COH = lfp_table("coh")
print("sessions with a CA1 channel:", COH[COH.reg == "ca1"].session.nunique(), "| with a CA3 channel:", COH[COH.reg == "ca3"].session.nunique())
judge(COH, "theta phase coherence")
print("CA3 slope by animal:", COH[COH.reg == "ca3"].groupby("subject").slope.mean().round(3).to_dict(), "| CA1:", COH[COH.reg == "ca1"].groupby("subject").slope.mean().round(3).to_dict())
sessions with a CA1 channel: 60 | with a CA3 channel: 19
theta phase coherence, per trial: CA1 slope 0.044 (n=9054, p=2.2e-09); CA3 slope 0.366 (n=2699, p=3.6e-111); CA3 - CA1 slope p=4.6e-88; raw mean CA1 0.5683, CA3 0.6290, p=7.2e-124
theta phase coherence, per session: CA1 slope 0.038 (n=60, p=2.2e-01); CA3 slope 0.259 (n=19, p=6.2e-03); CA3 - CA1 slope p=3.0e-03; raw mean CA1 0.5564, CA3 0.6241, p=1.4e-02
   ca1 mean z curve: last tenth - first tenth = 0.030; range -0.03 to 0.04
   ca3 mean z curve: last tenth - first tenth = 0.321; range -0.27 to 0.20
CA3 slope by animal: {'DT5': 0.494, 'DT7': -0.171, 'DT9': 0.128} | CA1: {'DT2': -0.065, 'DT5': 0.153, 'DT7': -0.098, 'DT8': 0.061, 'DT9': 0.056}

Result: reproduced. Per trial, the slope of z-scored CA3-LS theta phase coherence over the run is 0.366 (2,699 trials, p = 3.6e-111) and exceeds the CA1-LS slope of 0.044 (p = 4.6e-88). Over sessions the CA3 slope is 0.259 (19 sessions, p = 0.0062), above CA1 (p = 0.0030). The CA1 mean curve changes by 0.030 from first to last tenth against 0.321 for CA3. One of the three CA3 animals (DT7, mean slope -0.171) runs the other way.

fig6d-cfc-stronger-ca3¶

Coupling between hippocampal theta phase and LS gamma amplitude increases along the run for both CA1 and CA3, and is stronger for CA3-LS than for CA1-LS.

In [31]:
CFC = lfp_table("cfc"); judge(CFC, "theta-gamma coupling, 40-200 Hz, 50 ms RMS")
CFC2 = lfp_table("cfc2"); judge(CFC2, "variant 50-500 Hz, 60-sample RMS")
same = CFC[CFC.session.isin(CFC[CFC.reg == "ca3"].session)]
judge(same, "40-200 Hz, only sessions with both channels")
theta-gamma coupling, 40-200 Hz, 50 ms RMS, per trial: CA1 slope 0.084 (n=9054, p=1.5e-19); CA3 slope 0.284 (n=2699, p=1.1e-49); CA3 - CA1 slope p=6.6e-24; raw mean CA1 0.3451, CA3 0.3757, p=5.3e-187
theta-gamma coupling, 40-200 Hz, 50 ms RMS, per session: CA1 slope 0.079 (n=60, p=4.8e-05); CA3 slope 0.263 (n=19, p=2.5e-06); CA3 - CA1 slope p=8.5e-06; raw mean CA1 0.3459, CA3 0.3761, p=7.0e-08
   ca1 mean z curve: last tenth - first tenth = 0.113; range -0.12 to 1.21
   ca3 mean z curve: last tenth - first tenth = 0.225; range -0.21 to 1.15
variant 50-500 Hz, 60-sample RMS, per trial: CA1 slope 0.110 (n=9054, p=1.4e-31); CA3 slope 0.157 (n=2699, p=2.3e-16); CA3 - CA1 slope p=2.0e-02; raw mean CA1 0.3495, CA3 0.3931, p=0.0e+00
variant 50-500 Hz, 60-sample RMS, per session: CA1 slope 0.097 (n=60, p=6.6e-05); CA3 slope 0.139 (n=19, p=9.4e-04); CA3 - CA1 slope p=3.5e-01; raw mean CA1 0.3486, CA3 0.3892, p=3.0e-13
   ca1 mean z curve: last tenth - first tenth = 0.104; range -0.10 to 1.20
   ca3 mean z curve: last tenth - first tenth = 0.107; range -0.16 to 1.06
40-200 Hz, only sessions with both channels, per trial: CA1 slope 0.104 (n=2044, p=2.7e-07); CA3 slope 0.284 (n=2699, p=1.1e-49); CA3 - CA1 slope p=1.3e-10; raw mean CA1 0.3233, CA3 0.3757, p=2.0e-265
40-200 Hz, only sessions with both channels, per session: CA1 slope 0.104 (n=14, p=4.3e-02); CA3 slope 0.263 (n=19, p=2.5e-06); CA3 - CA1 slope p=1.3e-02; raw mean CA1 0.3301, CA3 0.3761, p=5.1e-09
   ca1 mean z curve: last tenth - first tenth = 0.167; range -0.16 to 1.34
   ca3 mean z curve: last tenth - first tenth = 0.225; range -0.21 to 1.15

Result: reproduced. Theta-gamma coupling rises over the run for CA1 (slope 0.084, p = 1.5e-19) and CA3 (0.284, p = 1.1e-49), and raw coupling is higher for CA3 (0.376 against 0.345, p = 5.3e-187); per session the same holds (p = 4.8e-05, 2.5e-06 and 7.0e-08). The 50 to 500 Hz variant gives the same signs.

fig6e-assembly-position¶

CA3 place fields form progressively stronger gamma assemblies with LS along the track (r = 0.34, p = 0.006) while CA1 coupling decreases somewhat (r = -0.11, p = 0.079), and the two are anti-correlated over position (r = -0.88).

In [32]:
out = []
for pr in "ab":
    PP[f"com_{pr}"] = [Dk.at[(s_, u, c), f"pf{pr}_com"] if (s_, u, c) in Dk.index and Dk.at[(s_, u, c), f"pf{pr}_n"] > 0 else np.nan
                       for s_, u, c in zip(PP.session, PP.hpc, PP.cond)]
PP["sub_session"] = np.where(PP.session.isin(ca3_sessions), "CA3", "CA1")
PP["sub_label"] = np.where(PP.region == "ca3", "CA3", "CA1")
for pr in "ab":
    for which, sel in (("(a) assembly pairs", PP.asm_a), ("(b) all pairs with a field", PP.strength.notna())):
        for regk in ("sub_session", "sub_label"):
            X = PP[sel & PP[f"com_{pr}"].notna() & np.isfinite(PP.strength)]
            row = {"fields": pr, "pairs": which, "region": regk}
            curves = {}
            for reg in ("CA1", "CA3"):
                g = X[X[regk] == reg]
                r, p = stats.pearsonr(g[f"com_{pr}"], g.strength) if len(g) > 2 else (np.nan, np.nan)
                row[reg] = f"r={r:.3f} p={p:.2g} n={len(g)}"
                cv = np.full(201, np.nan)
                b = np.clip(np.round(g[f"com_{pr}"]).astype(int), 0, 200)
                for k, v in g.groupby(b).strength.mean().items():
                    cv[k] = v
                curves[reg] = cv
            for sm in ("none", "box20"):
                c1, c3 = curves["CA1"], curves["CA3"]
                if sm == "box20":
                    c1, c3 = tg.box_fast(c1[None], 20)[0], tg.box_fast(c3[None], 20)[0]
                ok = np.isfinite(c1) & np.isfinite(c3)
                row[f"curves_r_{sm}"] = f"{stats.pearsonr(c1[ok], c3[ok])[0]:.3f} (bins {ok.sum()})" if ok.sum() > 2 else "n/a"
            out.append(row)
pd.set_option("display.max_colwidth", 40)
print(pd.DataFrame(out).to_string(index=False))
print("expected: CA1 r -0.11 +/- 0.011 (not significant), CA3 r 0.34 +/- 0.034 (p < 0.05), curves r -0.88 +/- 0.088")
fields                      pairs      region                      CA1                   CA3    curves_r_none    curves_r_box20
     a         (a) assembly pairs sub_session   r=-0.106 p=0.024 n=452   r=0.178 p=0.14 n=71 -0.106 (bins 42) -0.310 (bins 189)
     a         (a) assembly pairs   sub_label   r=-0.097 p=0.034 n=476   r=0.172 p=0.25 n=47 -0.199 (bins 30)  0.098 (bins 189)
     a (b) all pairs with a field sub_session r=-0.066 p=0.0056 n=1767  r=0.034 p=0.58 n=262 -0.081 (bins 86) -0.352 (bins 198)
     a (b) all pairs with a field   sub_label r=-0.066 p=0.0043 n=1872  r=0.095 p=0.24 n=157 -0.172 (bins 63) -0.498 (bins 198)
     b         (a) assembly pairs sub_session   r=-0.111 p=0.012 n=511  r=0.078 p=0.42 n=110  0.012 (bins 61)  0.186 (bins 200)
     b         (a) assembly pairs   sub_label   r=-0.099 p=0.021 n=549   r=0.097 p=0.42 n=72 -0.182 (bins 46) -0.147 (bins 200)
     b (b) all pairs with a field sub_session r=-0.058 p=0.0089 n=2009 r=-0.005 p=0.91 n=391 0.101 (bins 123)  0.400 (bins 201)
     b (b) all pairs with a field   sub_label r=-0.060 p=0.0054 n=2161  r=0.059 p=0.36 n=239 -0.104 (bins 87) -0.114 (bins 200)
expected: CA1 r -0.11 +/- 0.011 (not significant), CA3 r 0.34 +/- 0.034 (p < 0.05), curves r -0.88 +/- 0.088

Result: partially reproduced, on the same sample. With Gaussian-map fields, assembly pairs and regions by session, the CA1 r is -0.106 (within -0.11 +/- 0.011, but significant, p = 0.024, 452 pairs), the CA3 r is +0.178 (p = 0.14, 71 pairs; 0.34 +/- 0.034) and the CA1 and CA3 strength curves correlate at -0.106 (unsmoothed, 42 bins with both) or -0.310 (20-bin box). The signs hold; the CA3 increase is not significant, the CA1 decrease is, and the curve correlation is far from -0.88. Other readings give CA3 r from -0.005 to 0.178, none significant; with fields (b) and the session reading the curve correlation turns positive. The assemblies are those of fig5-assemblies, which do not reproduce the paper's fraction or timescale.

figs7-ensemble-ls-phase-best¶

The firing phases of ensembles of simultaneously recorded LS neurons read out position better than the firing phases or rates of an equal number of hippocampal neurons (p < 0.001 at 15 to 25 neurons).

In [33]:
ENS_DRAWS = 10   # reading (a): 10 random ensembles per size and condition
t = time.time()
with ProcessPoolExecutor(4, mp_context=ctx) as ex:
    ens = [r for p in ex.map(tg.ensemble_session, sessions, [seeds[S["session"]] + 2 for S in sessions], [ENS_DRAWS] * len(sessions)) for r in p]
E = pd.DataFrame(ens)
print(f"{len(E)} ensemble decodes in {time.time()-t:.0f} s; conditions with >= 15 included units: "
      f"LS {E[E.region=='LS'].groupby(['session','cond']).ngroups}, HPC {E[E.region=='HPC'].groupby(['session','cond']).ngroups}")
for reading in ("a", "b"):
    rows = []
    for size in range(15, 26):
        e = E[(E['size'] == size) & (E.reading == reading)]
        lp = e[(e.region == "LS") & (e.feature == "phase")].mse; hp_ = e[(e.region == "HPC") & (e.feature == "phase")].mse; hr = e[(e.region == "HPC") & (e.feature == "rate")].mse
        p1 = stats.ttest_ind(lp, hp_).pvalue if len(lp) > 1 and len(hp_) > 1 else np.nan
        p2 = stats.ttest_ind(lp, hr).pvalue if len(lp) > 1 and len(hr) > 1 else np.nan
        rows.append({"size": size, "n_LS": len(lp), "LS_phase": round(lp.mean(), 0), "n_HPC": len(hp_), "HPC_phase": round(hp_.mean(), 0),
                     "HPC_rate": round(hr.mean(), 0), "p_vs_HPC_phase": p1, "p_vs_HPC_rate": p2,
                     "LS_best_p001": bool(lp.mean() < hp_.mean() and lp.mean() < hr.mean() and p1 < 0.001 and p2 < 0.001)})
    print(f"reading ({reading}):"); print(pd.DataFrame(rows).to_string(index=False))
30228 ensemble decodes in 177 s; conditions with >= 15 included units: LS 129, HPC 141
reading (a):
 size  n_LS  LS_phase  n_HPC  HPC_phase  HPC_rate  p_vs_HPC_phase  p_vs_HPC_rate  LS_best_p001
   15  1290    6041.0   1410     5766.0    2005.0    1.940587e-26   0.000000e+00         False
   16  1160    6028.0   1250     5718.0    1906.0    1.687797e-31   0.000000e+00         False
   17  1040    6014.0   1030     5661.0    1775.0    1.156125e-34   0.000000e+00         False
   18   880    5980.0    950     5637.0    1741.0    4.060711e-29   0.000000e+00         False
   19   630    5911.0    910     5614.0    1655.0    1.050536e-18   0.000000e+00         False
   20   440    5974.0    860     5594.0    1566.0    6.060054e-26   0.000000e+00         False
   21   350    6096.0    860     5535.0    1486.0    8.332829e-47   0.000000e+00         False
   22   330    6083.0    820     5551.0    1473.0    1.879446e-42   0.000000e+00         False
   23   250    6159.0    790     5514.0    1436.0    9.342876e-50   0.000000e+00         False
   24   210    6090.0    750     5540.0    1442.0    4.209834e-36   0.000000e+00         False
   25   200    6055.0    720     5484.0    1404.0    3.779710e-35  7.035210e-306         False
reading (b):
 size  n_LS  LS_phase  n_HPC  HPC_phase  HPC_rate  p_vs_HPC_phase  p_vs_HPC_rate  LS_best_p001
   15   129    6070.0    141     5793.0    1965.0        0.000829  5.239881e-110         False
   16   116    6015.0    125     5738.0    1976.0        0.000666   1.941239e-89         False
   17   104    6024.0    103     5619.0    1796.0        0.000024   2.296383e-85         False
   18    88    6007.0     95     5674.0    1869.0        0.000617   3.712311e-66         False
   19    63    5916.0     91     5643.0    1614.0        0.010081   4.909262e-57         False
   20    44    5954.0     86     5613.0    1630.0        0.003556   1.260239e-48         False
   21    35    6089.0     86     5539.0    1531.0        0.000006   3.385607e-48         False
   22    33    6088.0     82     5541.0    1454.0        0.000010   1.874406e-46         False
   23    25    6172.0     79     5531.0    1527.0        0.000002   5.530152e-34         False
   24    21    6116.0     75     5583.0    1464.0        0.000125   3.756940e-34         False
   25    20    6010.0     72     5484.0    1369.0        0.000287   1.209877e-30         False

Result: not reproduced. At every size from 15 to 25, LS phase ensembles decode position worse than hippocampal phase ensembles (6,041 against 5,766 bins squared at 15 units, reading a, 10 draws) and much worse than hippocampal rate ensembles (2,005). The differences are significant in the wrong direction (p = 1.9e-26 and below 1e-300 at 15 units). Reading (b) gives the same.

figs2-rate-phase-independent¶

Instantaneous firing rate and firing phase are independent at the single-trial level; fewer than 2% of hippocampal conditions had a rate-phase correlation higher than a circular-shift null.

In [34]:
t = time.time()
with ProcessPoolExecutor(4, mp_context=ctx) as ex:
    IF = pd.DataFrame([r for p in ex.map(tg.ifr_session, sessions, [seeds[S["session"]] + 3 for S in sessions]) for r in p])
print(f"{len(IF)} conditions in {time.time()-t:.0f} s")
for reg, m in (("hippocampal", IF.region.isin(tg.HPC_LABELS)), ("LS", IF.region == "ls")):
    X = IF[m]
    a_ = ((X.t_p < 0.05) & (X.t_stat > 0)).mean(); b_ = (X.mean_act > X.pct95).mean()
    print(f"{reg}: {len(X)} conditions; mean actual r {X.mean_act.mean():.3f}, mean shuffled {X.mean_sh.mean():.3f}; "
          f"(a) t test higher at p<0.05: {a_:.4f}; (b) above the 95th percentile: {b_:.4f}")
9559 conditions in 20 s
hippocampal: 5453 conditions; mean actual r 0.435, mean shuffled 0.444; (a) t test higher at p<0.05: 0.1434; (b) above the 95th percentile: 0.2072
LS: 4106 conditions; mean actual r 0.505, mean shuffled 0.505; (a) t test higher at p<0.05: 0.0321; (b) above the 95th percentile: 0.1120

Result: not reproduced. Over 5,453 hippocampal conditions the mean actual rate-phase correlation (0.435) is no higher than the circularly shifted one (0.444). But 0.143 of conditions are significantly higher by the t test (a) and 0.207 lie above the 95th percentile (b), against the paper's fewer than 2%. For LS the fractions are 0.032 and 0.112.

figs1f-trial-counts¶

The behaviour comprises 2,889 circle-alternation, 6,608 central-alternation and 625 linear-track trials; ballistic trials made up about 90 to 95% of trials in each recording.

In [35]:
print("trials by task, all sessions:", dict(tasks))
tasks_ls = Counter(x for S in sessions if S["units"] and any(U["region"] == "ls" for U in S["units"]) for x in task_of(S))
print("trials by task, sessions with LS units:", dict(tasks_ls))
desc = Counter("only ballistic runs" in S["trials_description"] for S in sessions)
print("trials tables whose description says only ballistic runs were kept:", desc.get(True, 0), "of", len(sessions))
print("example:", sessions[0]["trials_description"].split(". Start")[0])
trials by task, all sessions: {np.str_('wheel alternation'): 3987, np.str_('central alternation'): 5219, np.str_('linear'): 701}
trials by task, sessions with LS units: {np.str_('wheel alternation'): 3039, np.str_('central alternation'): 5219, np.str_('linear'): 625}
trials tables whose description says only ballistic runs were kept: 67 of 67
example: Trials of the session's task ('wheel alternation'): only ballistic runs, without stopping or leaving the trained path, were kept by the lab (about 90-95% of the attempted trials)

Result: not reproduced. In the 62 sessions with LS units there are 3,039 circle (wheel) alternation trials (2,889 +/- 288.9) and 625 linear-track trials (625 +/- 62.5), but 5,219 central-alternation trials against 6,608 +/- 660.8. Over all 67 sessions the counts are 3,987, 5,219 and 701, all outside tolerance. The ballistic fraction cannot be tested: all 67 trials tables say that only ballistic runs were kept. The criterion has no partial rule, so two of three counts within tolerance is not a reproduction.

In [36]:
print(f"notebook ran in {(time.time() - T0)/60:.1f} min; peak memory {resource.getrusage(resource.RUSAGE_SELF).ru_maxrss/1e6:.1f} GB")
notebook ran in 42.4 min; peak memory 4.2 GB

Summary¶

claim outcome
ls-neuron-count reproduced
hpc-unit-count not reproduced
ls-active-neurons reproduced
fig2-ls-phase-vs-shuffle not reproduced (assumed)
fig2-ls-phase-beats-rate not reproduced (assumed)
fig2e-ls-phase-lower-mse not reproduced (assumed)
fig2fg-mse-difference not reproduced (assumed)
fig1i-hpc-rate-phase-equivalent not reproduced (assumed; reproduced proposed, not agreed)
ls-lower-peak-info partially reproduced
ls-few-place-fields partially reproduced
hpc-place-field-properties partially reproduced
ls-place-fields-unstable partially reproduced
fig1e-phase-info-smaller-scale partially reproduced (assumed)
fig1g-phase-more-info-fine-scale reproduced (assumed)
fig3-ls-phase-reliable reproduced
fig4d-depth-gradient reproduced (assumed)
fig4e-onset-depth not reproduced (assumed)
fig4e-onset-mediolateral partially reproduced (assumed)
speed-independent partially reproduced
fig5-assemblies not reproduced (assumed; sample of pairs)
fig5g-assembly-neurons-stronger-phase not reproduced (assumed; sample of pairs)
figs5-assembly-independent-of-locking reproduced (assumed; sample of pairs)
fig6-session-counts not reproduced
fig6c-ca3-coherence-increases reproduced
fig6d-cfc-stronger-ca3 reproduced
fig6e-assembly-position partially reproduced (assumed; sample of pairs)
figs7-ensemble-ls-phase-best not reproduced (assumed)
figs2-rate-phase-independent not reproduced
figs3-ls-major-target blocked, other (Allen data not analysed in this run)
figs6-reference-frame blocked, metadata_insufficient
figs1f-trial-counts not reproduced
fig7-dynamic-weighting-model blocked, other (model not run in this run)

"proposed, not agreed" marks a change of outcome found in the final revision that the third verification round did not agree with; the outcome shown is the verified one.

"(assumed)" marks an outcome that rests on an assumption about a method the paper leaves open: above all, that position bins with no spike in their smoothing window take phase 0 in phase decoding and phase information, and that ties between equally near template bins are broken at random.

A failure to reproduce here may be a failure of this attempt, not of the paper: see the reasoning and the differences from the paper's method.

How the analysis differs from the paper's.

  • The paper does not say how bins without spikes enter phase decoding. They are set to phase 0 here. Leaving them out (the variant) lets the phase decoder read where the cell fires: synthetic place cells with random phases beat rate in all 200 cases under that variant, and real cells whose phases are shifted within trials beat rate about as often as the real data (decoder calibration). With phase 0, synthetic cells pass phase-against-rate in 0.005 or none, and shifted real phases in 0.026 to 0.060 of conditions, 3 to 6 times the nominal 1% but below the real 0.044 to 0.082; the LS phase claims fail and the hippocampal phase decoding is slightly worse than rate. At fine smoothing the phase-0 fill makes phase information measure whether a spike is near, which produces the fig1g match. The phase-against-chance test detects firing location under both treatments: shifted phases pass it nearly as often as real ones.
  • Each criterion is applied as written (see the header). fig4d-depth-gradient keeps its round-2 outcome, reproduced on bb1 alone, although its criterion has no "under one reading" clause for the decoder readings; under aa1 it would likely be not reproduced.
  • Ties between template bins (many bins of a rate template are exactly 0 Hz) are broken at random; sending them to the lowest bin, as a first-index rule does, is shown for the main reading.
  • The split of samples (readings b) puts neighbouring, smoothed samples of one trial into both training and test sets; it is a reading of the claims file and is run, but the outcomes that rest on it alone (fig4d-depth-gradient) are fragile.
  • Place fields follow the Methods' rules, applied the way buzcode's bz_getPlaceFields1D applies them. The Gaussian width (5 bins) and the choice of the highest peak as the "first" field are assumptions.
  • Olypher information uses normalized probabilities; makeFig1.m's division by the trial count is shown as a variant. The best smoothing uses MATLAB's smooth over 5 points.
  • Bins of 1.5 cm cannot be formed for DT2, whose positions are in pixels; those sessions keep 201 bins under that reading.
  • Spike phase is referenced to the CA1 channel the files flag; six sessions without one use the hippocampal probe's theta channel (five DT9 sessions with only a CA3 probe, one DT7 session).
  • Speed is computed from x and y position smoothed over 0.25 s; precession slope by maximizing the mean resultant length.
  • Peer prediction (Figure 5) is run on a random 7% of the LS unit-conditions, with all their included hippocampal partners (7,098 pairs), by least squares, one fit per trial, cutting trials to the shorter in the shuffles.
  • Which session-name depth is the LS probe's, and which way the sites run along a shank, are not stored; the first depth and sites deepening with their index are used, and the alternatives are shown.
  • The Allen connectivity analysis (Figure S3) and the spiking model (Figure 7) were not run in this attempt's time.

What was found about the dataset.

  • 31 sessions of DT7, DT8 and DT9 store head position labelled "meters" whose values are millimetres: their template paths are 1,329 to 2,934 units long, against 0.97 to 3.13 m elsewhere.
  • One DT7 session (20170324) has no units table.
  • No CA1 channel is flagged in five DT9 sessions (CA3 probe only) and one DT7 session. The paper refers all spike phases to CA1 theta.
  • DT8 has hippocampal channels, with a flagged CA1 channel, in all 17 sessions but no hippocampal units.
  • Hippocampal units number 3,260 (2,636 'hpc', 624 'ca3'), against the paper's 2,951. The 'hpc' label is the probe, not the subfield, so CA1 against CA3 is a reading.
  • No session is marked as holding maze rotations, so Figure S6 cannot be tested.
  • Some files lack trials.trial_type, trial_conditions.condition_type or units.max_waveform_channel.
  • Clocks: 99.7% of linearized samples lie inside their trial, and hippocampal spikes lock to theta in 47 of 47 sessions (median resultant length 0.179 against 0.053 with spikes shifted by 1 s). Rate decoding with recorded positions beats positions 1 s later in 30 of 47 sessions with ties broken at random; the decoder is weak (median hippocampal rate MSE 6,329 against 6,733 for uniform guessing), so this check is consistent with aligned clocks but does not show it for every session. The sessions and the lowest-bin variant are listed in the data check.