Ito & Doya (2015) on dandiset 001642¶

Paper. Ito M, Doya K (2015). Distinct neural representation in the dorsolateral, dorsomedial, and ventral parts of the striatum during fixed- and free-choice tasks. J Neurosci 35(8):3499-3514. doi:10.1523/jneurosci.1962-14.2015.

Dataset. DANDI:001642, version 0.260205.0153 (doi:10.48324/dandi.001642/0.260205.0153), streamed from the archive. The paper cites no version of the dandiset (it predates it), and 0.260205.0153 is the only published version; the draft has the same 87 assets and size, so the published version is pinned.

Claims. claims/001642/10.1523-jneurosci.1962-14.2015.yaml, written from the version of record (PMC4339358): main text, Methods and figure legends; the display equations and the figure panels could not be read, and the paper links no code.

All 32 claims are analysed here. Where a criterion names readings of a method, the outcome follows the claims file's rule: reproduced when every reading holds, not reproduced when none does, blocked (methods_underspecified) when they disagree. The two unit sets, the dandiset's PANs flag and the set rebuilt from the Methods' rule, are both run as readings of the unit selection, since neither matches the paper's counts and the rule cannot be applied in full. The Panzeri-Treves bias correction of the mutual information is shown as a variant, not a reading, as the claims file lists only readings (a) and (b) of O1; a question to a reader asks whether it should be one. Twelve claims are blocked because their readings disagree, and thirteen more because the neuron counts cannot be decided without the waveforms and histology the dandiset lacks (data_missing), with the neural claims that depend on them; the summary at the end gives every outcome.

Claim Section Status
trial-counts, trials-per-block behaviour tested
fig2c-extinction-differs, fig2b-extinction-time-course extinction tests tested
fig2d-f-decision-trees decision trees tested
fig2g-fq-variable-best, actor-critic-near-chance choice models tested
neuron-counts units tested; blocked (data_missing)
fig4b-vs-phase1 EASH tested; blocked (data_missing)
fig4b-dms-phase5, fig4b-vs-phase7, fig4c-activation-duration EASH tested; blocked (methods_underspecified)
fig5e-action-info-rises-dls, fig5e-action-info-cue-offset-dls, fig5e-action-info-center-exit, fig5d-action-info-phase5-dms, fig5g-reward-info mutual information tested; blocked (data_missing)
fig5b-state-info-vs mutual information tested; blocked (methods_underspecified)
fig6-above-chance event coding tested; blocked (data_missing)
fig6-event-coding-proportions, fig6bc-similar-fixed-free event coding tested; blocked (methods_underspecified)
fig8f-state-value-vs, no-policy-coding regression tested; blocked (data_missing)
fig8a-d-action-reward-coding, fig8e-action-value-dms, fig8e-qr-dms regression tested; blocked (methods_underspecified)
fig9-temporal-order-all-blocks, fig10a-dls-fixed-above-free, fig10b-dms-fixed-above-free MI by block type tested; blocked (data_missing)
fig9-dms-never-above-dls, fig10c-vs-no-fixed-free-difference, fig10d-dls-stay-above-switch MI by block type tested; blocked (methods_underspecified)

Loading and the measures are in striatum.py, the choice models and the regression in models.py; their docstrings say where each parameter comes from. The whole notebook takes about 35 minutes, most of it the shuffles of the mutual information and the particle filters.

In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import stats
from statsmodels.stats.proportion import proportion_confint

import striatum as S

pd.set_option("display.width", 200)
pd.set_option("display.max_columns", 40)
SEED = 20150225
print("dandiset", S.DANDISET, "version", S.VERSION)

def rule_outcome(holds):
    """Outcome by the claims file's rule for readings of a method: reproduced when every
    reading holds, not reproduced when none does, blocked (methods_underspecified) when they
    disagree."""
    h = np.asarray(holds, bool)
    return "reproduced" if h.all() else ("not reproduced" if not h.any() else "blocked: the readings disagree")
dandiset 001642 version 0.260205.0153
In [2]:
D = S.load_all()
T = pd.concat([d["trials"] for d in D], ignore_index=True)
B = pd.concat([d["blocks"] for d in D], ignore_index=True)
U = pd.concat([d["units"] for d in D], ignore_index=True)
REC = sorted(U.session.unique())  # sessions that hold units
print(len(D), "files;", len(REC), "with units;", len(T), "trials;", len(U), "units")
87 files; 86 with units; 80233 trials; 859 units

Data check¶

What was loaded, and the checks of the descriptions against the values.

In [3]:
print("Files per subject:", T.groupby("subject").session.nunique().to_dict())
print("Sessions without units:", sorted(set(T.session) - set(REC)))
print("\nTrials by block type (from the block's reward rule) and result code:")
print(pd.crosstab(T.btype, T.result, margins=True))
print("\nTrials by block type and state code:")
print(pd.crosstab(T.btype, T.state))
print("\nBlocks by reward rule (L, R):")
print(B.groupby(["RewardRule_L", "RewardRule_R"]).size())
print("\nUnits by area and deposited PANs flag:")
print(pd.crosstab(U.Area, U.PANs, margins=True))
print("\nWhat the files hold (union over all files):")
for part in ["units", "electrodes", "acquisition", "processing", "analysis"]:
    print(f"  {part}:", sorted(set().union(*[d["layout"][part] for d in D])))
cols = [c for d in D for c in d["layout"]["units"] + d["layout"]["electrodes"]]
print("Any waveform, amplitude or depth column in units or electrodes:",
      any(w in c.lower() for c in cols for w in ("wave", "ampl", "depth")))
Files per subject: {'091': 10, '092': 13, '101': 11, '108': 13, '114': 13, '115': 14, '116': 13}
Sessions without units: ['LE115_14']

Trials by block type (from the block's reward rule) and result code:
result  0.0    1.0   2.0    3.0  4.0  5.0  6.0    All
btype                                                
DF       16   9958  1406  12738    1    0    0  24119
EXT       5      0   206   3518    0    0    0   3729
FREE      3  19343  1594  17153    0    5    0  38098
SF       25   5668   840   7749    4    0    1  14287
All      49  34969  4046  41158    5    5    1  80233

Trials by block type and state code:
state    1.0    2.0    3.0
btype                     
DF         0  12050  12051
EXT     1167   1268   1289
FREE   38093      0      0
SF         0   7520   6744

Blocks by reward rule (L, R):
RewardRule_L  RewardRule_R
0.0           0.0             707
              50.0            298
10.0          50.0            225
50.0          0.0             322
              10.0            225
              50.0            500
              90.0            221
90.0          50.0            222
dtype: int64

Units by area and deposited PANs flag:
PANs  0.0  1.0  All
Area               
CS     77   15   92
DLS    93  204  297
DMS   143  112  255
VS     77  138  215
All   390  469  859

What the files hold (union over all files):
  units: ['Area', 'Electrode_ID', 'Neuron_ID', 'PANs', 'Unit_Name', 'electrodes', 'electrodes_index', 'id', 'spike_times', 'spike_times_index']
  electrodes: ['group', 'group_name', 'id', 'location']
  acquisition: ['Sp_Sensor C', 'Sp_Sensor L', 'Sp_Sensor R', 'Sp_TestPhase', 'Sp_Tone A', 'Sp_Tone B', 'Sp_Tone Err', 'Sp_Tone Rwd', 'Vi_Dispenser', 'Vi_Lamp C', 'Vi_Lamp D', 'Vi_Lamp L', 'Vi_Lamp R', 'Vi_Sensor C', 'Vi_Sensor D', 'Vi_Sensor L', 'Vi_Sensor R', 'Vi_Tone 1', 'Vi_Tone 2', 'Vi_Tone 3', 'Vi_Tone A', 'Vi_Tone B', 'Vi_Tone C']
  processing: ['behavior/BlockDesign']
  analysis: []
Any waveform, amplitude or depth column in units or electrodes: False
In [4]:
# The trial table says state 1 = Tone A (left), 2 = Tone B (right), 3 = Tone C (choice).
# The reward contingencies say otherwise: which (state, action) pairs are ever rewarded, and
# in which blocks each state occurs.
ch = T[T.choice]
print(pd.crosstab([ch.state, ch.action], ch.reward))
print("\nState codes in single fixed-choice blocks with rule (50, 0) and (0, 50):")
sf = ch[ch.btype == "SF"]
print(pd.crosstab([sf.rule_L, sf.rule_R], sf.state))
print("\nFraction of left choices per state in SF, DF and FREE blocks:")
print(ch[ch.btype != "EXT"].groupby(["btype", "state"]).action.apply(lambda a: (a == 1).mean()).round(3))
reward         0.0   1.0
state action            
1.0   1.0     9075  9882
      2.0     9184  9461
2.0   1.0     9202  7918
      2.0     2669     0
3.0   1.0     2026     0
      2.0     9002  7707

State codes in single fixed-choice blocks with rule (50, 0) and (0, 50):
state           2.0   3.0
rule_L rule_R            
0.0    50.0       0  6274
50.0   0.0     7143     0

Fraction of left choices per state in SF, DF and FREE blocks:
btype  state
DF     2.0      0.878
       3.0      0.100
FREE   1.0      0.504
SF     2.0      0.851
       3.0      0.122
Name: action, dtype: float64
In [5]:
# Event times: order and phase durations against the paper's means (Methods, EASH).
ok = T[T.events_ok]
ev = ok[S.EVENT_COLS].to_numpy()
dur = np.diff(ev, axis=1)
print("Choice trials:", T.choice.sum(), "; with all six events in order:", len(ok),
      f"({T.choice.sum() - len(ok)} dropped)")
print(pd.DataFrame({"paper mean (s)": S.PHASE_DUR[1:6], "data mean": dur.mean(0).round(3),
                    "data median": np.median(dur, 0).round(3), "1st pct": np.percentile(dur, 1, 0).round(3),
                    "99th pct": np.percentile(dur, 99, 0).round(2), "min": dur.min(0).round(3),
                    "max": dur.max(0).round(2)}, index=[f"Phase {i}" for i in range(2, 7)]))
print("\nCue duration (E2 to E3) range, s:", dur[:, 1].min().round(3), dur[:, 1].max().round(3),
      "(paper 1 to 2 s)")
print("Reward times present on rewarded choice trials:",
      T[T.choice & (T.reward == 1)].reward_on_time.notna().mean().round(3),
      "; on unrewarded:", T[T.choice & (T.reward == 0)].reward_on_time.notna().mean().round(3))
print("Unit spike counts: min", U.n_spikes.min(), "median", int(U.n_spikes.median()), "max", U.n_spikes.max())
st_sorted = all(np.all(np.diff(s) >= 0) for s in U.spikes if len(s) > 1)
print("Spike times sorted in every unit:", st_sorted)
lo = min(s[0] for s in U.spikes if len(s)); hi = max(s[-1] for s in U.spikes if len(s))
print(f"Spike times range {lo:.2f} to {hi:.1f} s; trial starts {T.start_time.min():.2f} to {T.start_time.max():.1f} s")
Choice trials: 76126 ; with all six events in order: 75184 (942 dropped)
         paper mean (s)  data mean  data median  1st pct  99th pct    min    max
Phase 2            0.75      0.840        0.768    0.512      3.34  0.026  40.39
Phase 3            1.50      1.560        1.555    1.039      2.11  0.009   2.74
Phase 4            0.54      0.672        0.491    0.059      2.78  0.000  12.36
Phase 5            0.76      0.954        0.724    0.375      3.35  0.309  56.31
Phase 6            0.38      0.466        0.399    0.083      1.63  0.009   4.65

Cue duration (E2 to E3) range, s: 0.009 2.74 (paper 1 to 2 s)
Reward times present on rewarded choice trials: 0.957 ; on unrewarded: 0.0
Unit spike counts: min 697 median 21396 max 870047
Spike times sorted in every unit: True
Spike times range -13.81 to 23800.9 s; trial starts 0.12 to 23586.8 s

trial-counts¶

The analysis covers 78,107 trials in 86 recording sessions from seven rats, of which 12,185 are single fixed-choice, 22,234 double fixed-choice, 36,292 free-choice and 3505 extinction-test trials.

Readings (criterion): (a) all trials started, including wait-error and error trials; (b) trials with an L/R choice only. Counted over all 87 files and over the 86 sessions with units.

In [6]:
paper = {"total": 78107, "SF": 12185, "DF": 22234, "FREE": 36292, "EXT": 3505}
rows = []
for scope, tt in [("87 files", T), ("86 sessions with units", T[T.session.isin(REC)])]:
    for reading, sel in [("(a) all trials", tt), ("(b) choice trials", tt[tt.choice])]:
        c = sel.btype.value_counts()
        r = {"scope": scope, "reading": reading, "sessions": sel.session.nunique(),
             "rats": sel.subject.nunique(), "total": len(sel)}
        r.update({k: int(c.get(k, 0)) for k in ["SF", "DF", "FREE", "EXT"]})
        r["within 10%"] = all(abs(r[k] - v) <= 0.1 * v for k, v in paper.items()) and \
            abs(r["sessions"] - 86) <= 8.6 and r["rats"] == 7
        rows.append(r)
tc = pd.DataFrame(rows)
print(tc.to_string())
print("\nPaper:", paper, "; the paper's four categories sum to", sum(v for k, v in paper.items() if k != "total"))
print("Wait-error (result 2) and other non-choice trials:", int((~T.choice).sum()))
                    scope            reading  sessions  rats  total     SF     DF   FREE   EXT  within 10%
0                87 files     (a) all trials        87     7  80233  14287  24119  38098  3729       False
1                87 files  (b) choice trials        87     7  76126  13417  22695  36496  3518       False
2  86 sessions with units     (a) all trials        86     7  79431  13485  24119  38098  3729       False
3  86 sessions with units  (b) choice trials        86     7  75348  12639  22695  36496  3518        True

Paper: {'total': 78107, 'SF': 12185, 'DF': 22234, 'FREE': 36292, 'EXT': 3505} ; the paper's four categories sum to 74216
Wait-error (result 2) and other non-choice trials: 4107

Result: reproduced. Counting trials with an L/R choice in the 86 sessions that hold units (reading b), the dataset has 75,348 trials from 7 rats: 12,639 single fixed-choice, 22,695 double fixed-choice, 36,496 free-choice and 3518 extinction trials, all within 10% of the paper's numbers. Reading (a), all 79,431 trials started, puts the single fixed-choice count (13,485) outside 10%. The 87th file (LE115_14) holds behaviour without units and is left out of the 86 recording sessions.

trials-per-block¶

Completing a block took 22.56 ± 8.70 trials for single fixed-choice blocks, 47.11 ± 20.29 for double fixed-choice blocks and 41.10 ± 27.58 for free-choice blocks (mean ± SD).

Readings (criterion): (a) choice trials, completed blocks; (b) all trials, completed blocks; (c) as (a) with unfinished blocks; (d) as (b) with them. Completed is FinishedBlock = 1.

In [7]:
bt = T.groupby(["session", "block"]).agg(btype=("btype", "first"), n_all=("trial", "size"),
                                          n_choice=("choice", "sum")).reset_index()
bt = bt.merge(B[["session", "block", "FinishedBlock"]], on=["session", "block"])
pp = {"SF": (22.56, 8.70), "DF": (47.11, 20.29), "FREE": (41.10, 27.58)}
rows = []
for reading, col, fin in [("(a)", "n_choice", True), ("(b)", "n_all", True), ("(c)", "n_choice", False), ("(d)", "n_all", False)]:
    sel = bt[bt.FinishedBlock == 1] if fin else bt
    ok_all = True
    for k, (m, sd) in pp.items():
        x = sel.loc[sel.btype == k, col]
        okm = abs(x.mean() - m) <= sd
        oks = abs(x.std(ddof=1) - sd) <= 0.1 * sd
        ok_all &= okm and oks
        rows.append({"reading": reading, "block": k, "n blocks": len(x), "mean": round(x.mean(), 2),
                     "SD": round(x.std(ddof=1), 2), "paper": f"{m} ± {sd}", "mean ok": okm, "SD ok": oks})
    print(reading, "all six within tolerance:", ok_all)
print(pd.DataFrame(rows).to_string())
print("Unfinished blocks:", int((bt.FinishedBlock == 0).sum()), "of", len(bt))
(a) all six within tolerance: True
(b) all six within tolerance: True
(c) all six within tolerance: True
(d) all six within tolerance: False
   reading block  n blocks   mean     SD          paper  mean ok  SD ok
0      (a)    SF       551  22.50   8.62    22.56 ± 8.7     True   True
1      (a)    DF       469  47.15  20.34  47.11 ± 20.29     True   True
2      (a)  FREE       866  41.05  27.54   41.1 ± 27.58     True   True
3      (b)    SF       551  23.81   9.12    22.56 ± 8.7     True   True
4      (b)    DF       469  50.02  22.18  47.11 ± 20.29     True   True
5      (b)  FREE       866  42.83  29.01   41.1 ± 27.58     True   True
6      (c)    SF       620  21.64   8.85    22.56 ± 8.7     True   True
7      (c)    DF       500  45.39  21.13  47.11 ± 20.29     True   True
8      (c)  FREE       893  40.87  27.54   41.1 ± 27.58     True   True
9      (d)    SF       620  23.04   9.34    22.56 ± 8.7     True   True
10     (d)    DF       500  48.24  22.86  47.11 ± 20.29     True  False
11     (d)  FREE       893  42.66  29.01   41.1 ± 27.58     True   True
Unfinished blocks: 144 of 2720

Result: reproduced. Counting choice trials in completed blocks (reading a), blocks take 22.50 ± 8.62 (single fixed, 551 blocks), 47.15 ± 20.34 (double fixed, 469) and 41.05 ± 27.54 (free, 866) trials, against the paper's 22.56 ± 8.70, 47.11 ± 20.29 and 41.10 ± 27.58. Readings (b) and (c) also match; reading (d) misses the double fixed-choice SD (22.86).

Extinction tests (fig2c-extinction-differs, fig2b-extinction-time-course)¶

Extinction blocks are the blocks with reward rule (0, 0). Their trials are numbered by the order of choice trials within the block (wait-error trials, which have no choice, are left out). For a choice-tone extinction block the optimal action of the previous free-choice block (the side with the higher reward probability) is taken from that block's reward rule (Fig. 2B legend).

In [8]:
ext = T[(T.btype == "EXT") & T.choice].copy()
ext["k"] = ext.groupby(["session", "block"]).cumcount() + 1
Bi = B.set_index(["session", "block"])
def prev_optimal(ses, blk):
    b = blk - 1
    while b >= 1:
        l, r = Bi.loc[(ses, b), ["RewardRule_L", "RewardRule_R"]]
        if (l, r) not in [(0, 0), (50, 0), (0, 50), (50, 50)]:
            return "L" if l > r else "R"
        b -= 1
    return None
eb = ext.groupby(["session", "block"]).agg(cue=("cue", "first"), n=("k", "size")).reset_index()
eb["prev_opt"] = [prev_optimal(s, b) if c == "choice" else None for s, b, c in zip(eb.session, eb.block, eb.cue)]
ext = ext.merge(eb[["session", "block", "prev_opt"]], on=["session", "block"])
ext["group"] = np.where(ext.cue == "choice", "choice after " + ext.prev_opt.astype(str) + "-optimal", ext.cue + " tone")
print("Extinction blocks by cue:", eb.cue.value_counts().to_dict(), "; choice trials per block:", eb.n.value_counts().to_dict())
print("Choice-tone blocks by previous optimal action:", eb.prev_opt.value_counts().to_dict())
ext5 = ext[ext.k <= 5]
tab = ext5.groupby("group").action.agg(left=lambda a: (a == 1).sum(), right=lambda a: (a == 2).sum())
tab["P(left)"] = (tab.left / (tab.left + tab.right)).round(3)
print(tab)

def chi(t, yates):
    c, p, _, _ = stats.chi2_contingency(np.asarray(t), correction=yates)
    return c, p
rows = []
for yates in (False, True):
    # reading (a): left tone vs choice after left-optimal; right tone vs choice after right-optimal
    for fixed, choice in [("left tone", "choice after L-optimal"), ("right tone", "choice after R-optimal")]:
        t = tab.loc[[fixed, choice], ["left", "right"]]
        c, p = chi(t, yates)
        pf, pc = tab.loc[fixed, "P(left)"], tab.loc[choice, "P(left)"]
        rows.append({"reading": "(a) " + fixed, "Yates": yates, "chi2": round(c, 1), "p": p,
                     "fixed P(left)": pf, "choice P(left)": pc,
                     "fixed further from 0.5": abs(pf - .5) > abs(pc - .5)})
    # reading (b): previously optimal action, fixed tones pooled vs choice tone pooled
    e = ext5.copy()
    e["opt"] = np.where(e.cue == "left", 1, np.where(e.cue == "right", 2, np.where(e.prev_opt == "L", 1, 2)))
    e["chose_opt"] = e.action == e.opt
    e["fixed"] = e.cue != "choice"
    t = pd.crosstab(e.fixed, e.chose_opt)
    c, p = chi(t, yates)
    po = e.groupby("fixed").chose_opt.mean()
    rows.append({"reading": "(b) pooled", "Yates": yates, "chi2": round(c, 1), "p": p,
                 "fixed P(left)": f"P(opt) {po[True]:.3f}", "choice P(left)": f"P(opt) {po[False]:.3f}",
                 "fixed further from 0.5": abs(po[True] - .5) > abs(po[False] - .5)})
res2c = pd.DataFrame(rows)
print(res2c.to_string())
print("Every test p < 0.0001 with the fixed tone further from 0.5:",
      bool((res2c.p < 1e-4).all() and res2c["fixed further from 0.5"].all()))
print("By rat, reading (b) P(optimal):")
print(e.groupby(["subject", "fixed"]).chose_opt.mean().unstack().round(3))
Extinction blocks by cue: {'left': 243, 'right': 241, 'choice': 222} ; choice trials per block: {5: 701, 1: 2, 4: 2, 3: 1}
Choice-tone blocks by previous optimal action: {'L': 119, 'R': 103}
                        left  right  P(left)
group                                       
choice after L-optimal   382    209    0.646
choice after R-optimal   177    338    0.344
left tone                998    216    0.822
right tone               129   1069    0.108
          reading  Yates   chi2             p fixed P(left) choice P(left)  fixed further from 0.5
0   (a) left tone  False   68.2  1.495941e-16         0.822          0.646                    True
1  (a) right tone  False  136.7  1.380969e-31         0.108          0.344                    True
2      (b) pooled  False  195.4  2.078917e-44  P(opt) 0.857   P(opt) 0.651                    True
3   (a) left tone   True   67.2  2.449888e-16         0.822          0.646                    True
4  (a) right tone   True  135.1  3.097209e-31         0.108          0.344                    True
5      (b) pooled   True  194.2  3.894802e-44  P(opt) 0.857   P(opt) 0.651                    True
Every test p < 0.0001 with the fixed tone further from 0.5: True
By rat, reading (b) P(optimal):
fixed    False  True 
subject              
091      0.714  0.884
092      0.603  0.870
101      0.655  0.829
108      0.623  0.823
114      0.638  0.894
115      0.672  0.892
116      0.658  0.806

Result: reproduced. Over the five extinction trials the left tone gives P(left) 0.822 and the right tone 0.108, against 0.646 and 0.344 for the choice tone after left- and right-optimal blocks. Every chi-square test gives p below 1e-15 (largest 2.4e-16), with and without Yates' correction, and the fixed tones are further from 0.5 in every test. The pooled P(optimal) is higher for the fixed tones in all seven rats.

fig2b-extinction-time-course¶

In extinction tests the choice-tone choice probability shifts toward 50% after the first unrewarded trial, while the left- and right-tone choice probabilities stay biased after five unrewarded trials.

In [9]:
rows = []
for g, gg in ext5.groupby("group"):
    for k, kk in gg.groupby("k"):
        nl = int((kk.action == 1).sum()); n = len(kk)
        w = proportion_confint(nl, n, 0.05, "wilson"); cp = proportion_confint(nl, n, 0.05, "beta")
        rows.append({"group": g, "trial": k, "n": n, "P(left)": nl / n, "wilson lo": w[0], "wilson hi": w[1],
                     "CP lo": cp[0], "CP hi": cp[1]})
tb = pd.DataFrame(rows).round(3)
print(tb.to_string())
fig, ax = plt.subplots(figsize=(5, 3.2))
for g, gg in tb.groupby("group"):
    ax.plot(gg.trial, gg["P(left)"], marker="o", label=g)
    ax.fill_between(gg.trial, gg["wilson lo"], gg["wilson hi"], alpha=.2)
ax.set_xlabel("extinction trial"); ax.set_ylabel("P(left)"); ax.set_ylim(0, 1); ax.legend(fontsize=7)
plt.show()
tbi = tb.set_index(["group", "trial"])
for ci in ["wilson", "CP"]:
    c1 = all(abs(tbi.loc[(g, 2), "P(left)"] - .5) < abs(tbi.loc[(g, 1), "P(left)"] - .5)
             for g in ["choice after L-optimal", "choice after R-optimal"])
    lo = "wilson lo" if ci == "wilson" else "CP lo"; hi = lo.replace("lo", "hi")
    c2 = tbi.loc[("left tone", 5), lo] > .5 and tbi.loc[("right tone", 5), hi] < .5
    print(f"{ci}: (1) choice tone closer to 0.5 at trial 2 than 1: {c1}; (2) trial-5 intervals exclude 0.5 on the biased side: {c2}")
                     group  trial    n  P(left)  wilson lo  wilson hi  CP lo  CP hi
0   choice after L-optimal      1  119    0.815      0.736      0.875  0.734  0.880
1   choice after L-optimal      2  118    0.551      0.461      0.638  0.457  0.643
2   choice after L-optimal      3  118    0.644      0.554      0.725  0.551  0.730
3   choice after L-optimal      4  118    0.669      0.580      0.748  0.577  0.753
4   choice after L-optimal      5  118    0.551      0.461      0.638  0.457  0.643
5   choice after R-optimal      1  103    0.175      0.113      0.259  0.107  0.262
6   choice after R-optimal      2  103    0.379      0.291      0.475  0.285  0.480
7   choice after R-optimal      3  103    0.340      0.256      0.436  0.249  0.440
8   choice after R-optimal      4  103    0.447      0.354      0.543  0.349  0.548
9   choice after R-optimal      5  103    0.379      0.291      0.475  0.285  0.480
10               left tone      1  243    0.914      0.872      0.943  0.871  0.946
11               left tone      2  243    0.815      0.761      0.859  0.760  0.862
12               left tone      3  243    0.802      0.748      0.848  0.747  0.851
13               left tone      4  243    0.761      0.704      0.811  0.703  0.813
14               left tone      5  242    0.818      0.765      0.862  0.764  0.865
15              right tone      1  241    0.041      0.023      0.075  0.020  0.075
16              right tone      2  240    0.067      0.041      0.106  0.039  0.106
17              right tone      3  240    0.112      0.078      0.159  0.075  0.159
18              right tone      4  239    0.163      0.122      0.215  0.119  0.216
19              right tone      5  238    0.155      0.115      0.207  0.112  0.208
No description has been provided for this image
wilson: (1) choice tone closer to 0.5 at trial 2 than 1: True; (2) trial-5 intervals exclude 0.5 on the biased side: True
CP: (1) choice tone closer to 0.5 at trial 2 than 1: True; (2) trial-5 intervals exclude 0.5 on the biased side: True

Result: reproduced. For the choice tone P(left) moves from 0.815 to 0.551 (after left-optimal blocks) and from 0.175 to 0.379 (after right-optimal blocks) between the first and second extinction trials. At trial 5 the left tone is at 0.818 (Wilson interval 0.765 to 0.862) and the right tone at 0.155 (0.115 to 0.207); the Clopper-Pearson intervals give the same.

fig2d-f-decision-trees¶

Choice-tone choices depend on the previous one or two trials' actions and rewards (a decision tree that expands symmetrically), while left- and right-tone choices stay biased toward left and right whatever the previous experience.

Experiences e(t) = (action, reward) of the previous trials of the same tone within a session (Methods, Decision trees). Readings: sequences running across block borders or restarted at each block; for the choice tone, free-choice trials only, or with the choice-tone extinction trials in the sequence too (the Methods say "choice-tone trials" without saying whether extinction trials are among them). Left- and right-tone trees use single and double fixed-choice blocks. 95% intervals Wilson and Clopper-Pearson.

In [10]:
def tree(tt, across_blocks):
    """Counts of left and right choices after each experience sequence (d = 1, 2)."""
    rows = []
    for (ses,), g in tt.groupby(["session"]):
        keys = g.block.to_numpy() if not across_blocks else np.zeros(len(g))
        a = np.where(g.action.to_numpy() == 1, "L", "R"); r = g.reward.to_numpy().astype(int)
        e = np.array([f"{x}{y}" for x, y in zip(a, r)])
        for t in range(len(g)):
            rows.append({"d0": "", "a": a[t],
                         "d1": e[t - 1] if t >= 1 and keys[t - 1] == keys[t] else None,
                         "d2": e[t - 2] if t >= 2 and keys[t - 2] == keys[t] else None})
    df = pd.DataFrame(rows)
    out = []
    for name, keyc in [("d=1", ["d1"]), ("d=2", ["d1", "d2"])]:
        sub = df.dropna(subset=keyc)
        for k, gg in sub.groupby(keyc):
            k = k if isinstance(k, tuple) else (k,)
            nl = int((gg.a == "L").sum()); n = len(gg)
            w = proportion_confint(nl, n, 0.05, "wilson"); cp = proportion_confint(nl, n, 0.05, "beta")
            out.append({"d": name, "experience": " ".join(k), "n": n, "P(L)": nl / n,
                        "wil lo": w[0], "wil hi": w[1], "CP lo": cp[0], "CP hi": cp[1]})
    return pd.DataFrame(out)

ch = T[T.choice].sort_values(["session", "trial"])
choice_sets = {"free only": ch[(ch.cue == "choice") & (ch.btype == "FREE")],
               "free + extinction": ch[ch.cue == "choice"]}
fixed_sets = {c: ch[(ch.cue == c) & ch.btype.isin(["SF", "DF"])] for c in ["left", "right"]}
verdict = []
for across in (True, False):
    for cname, cs in choice_sets.items():
        tr = tree(cs, across).set_index(["d", "experience"])
        for ci in ("wil", "CP"):
            L1, R1 = tr.loc[("d=1", "L1")], tr.loc[("d=1", "R1")]
            c1 = (L1["P(L)"] > R1["P(L)"]) and (L1[f"{ci} lo"] > R1[f"{ci} hi"])
            verdict.append({"across blocks": across, "choice set": cname, "CI": ci, "part": "(1)",
                            "holds": c1, "detail": f"P(L|L1)={L1['P(L)']:.3f} [{L1[f'{ci} lo']:.3f},{L1[f'{ci} hi']:.3f}], P(L|R1)={R1['P(L)']:.3f} [{R1[f'{ci} lo']:.3f},{R1[f'{ci} hi']:.3f}]"})
        if across and cname == "free only":
            print("Choice-tone tree (free-choice trials, sequences across blocks):")
            print(tr.round(3).to_string())
    trees = {c: tree(fs, across) for c, fs in fixed_sets.items()}
    for floor in (0, 10):
        lt = trees["left"][trees["left"].n >= floor]; rt = trees["right"][trees["right"].n >= floor]
        c2 = bool((lt["P(L)"] > .5).all() and (rt["P(L)"] < .5).all())
        verdict.append({"across blocks": across, "choice set": "-", "CI": "-", "part": f"(2) floor {floor}",
                        "holds": c2, "detail": f"left tone min P(L) {lt['P(L)'].min():.3f} over {len(lt)} branches; right tone max P(L) {rt['P(L)'].max():.3f} over {len(rt)}"})
    if across:
        for c in ["left", "right"]:
            print(f"\n{c}-tone tree (SF and DF, across blocks):")
            print(trees[c].round(3).to_string())
vd = pd.DataFrame(verdict)
print(vd.to_string())
print("All readings hold:", bool(vd.holds.all()))
Choice-tone tree (free-choice trials, sequences across blocks):
                   n   P(L)  wil lo  wil hi  CP lo  CP hi
d   experience                                           
d=1 L0          8500  0.382   0.372   0.393  0.372  0.393
    L1          9851  0.804   0.796   0.812  0.796  0.812
    R0          8625  0.631   0.621   0.641  0.621  0.641
    R1          9434  0.185   0.177   0.193  0.177  0.193
d=2 L0 L0       1859  0.435   0.412   0.457  0.412  0.458
    L0 L1       2685  0.470   0.451   0.489  0.451  0.489
    L0 R0       3002  0.326   0.309   0.343  0.309  0.343
    L0 R1        927  0.207   0.182   0.234  0.181  0.235
    L1 L0       1380  0.786   0.764   0.807  0.764  0.808
    L1 L1       5205  0.852   0.842   0.862  0.842  0.862
    L1 R0       2437  0.779   0.762   0.795  0.762  0.795
    L1 R1        816  0.604   0.570   0.637  0.570  0.638
    R0 L0       3064  0.681   0.664   0.697  0.664  0.697
    R0 L1       1091  0.825   0.801   0.846  0.801  0.847
    R0 R0       1899  0.587   0.565   0.609  0.565  0.609
    R0 R1       2545  0.522   0.502   0.541  0.502  0.541
    R1 L0       2181  0.193   0.177   0.210  0.177  0.210
    R1 L1        838  0.385   0.353   0.419  0.352  0.419
    R1 R0       1275  0.209   0.188   0.233  0.187  0.233
    R1 R1       5120  0.142   0.133   0.152  0.133  0.152
left-tone tree (SF and DF, across blocks):
      d experience     n   P(L)  wil lo  wil hi  CP lo  CP hi
0   d=1         L0  8158  0.823   0.815   0.831  0.815  0.831
1   d=1         L1  7885  0.918   0.912   0.924  0.912  0.924
2   d=1         R0  2445  0.859   0.845   0.872  0.844  0.872
3   d=2      L0 L0  2553  0.832   0.817   0.846  0.817  0.846
4   d=2      L0 L1  4549  0.843   0.832   0.853  0.832  0.854
5   d=2      L0 R0  1013  0.715   0.686   0.742  0.686  0.742
6   d=2      L1 L0  4126  0.921   0.913   0.929  0.913  0.929
7   d=2      L1 L1  2655  0.928   0.918   0.938  0.918  0.938
8   d=2      L1 R0  1077  0.877   0.856   0.895  0.855  0.896
9   d=2      R0 L0  1439  0.860   0.841   0.877  0.841  0.878
10  d=2      R0 L1   645  0.890   0.863   0.912  0.863  0.913
11  d=2      R0 R0   344  0.794   0.748   0.833  0.747  0.835

right-tone tree (SF and DF, across blocks):
      d experience     n   P(L)  wil lo  wil hi  CP lo  CP hi
0   d=1         L0  1891  0.126   0.112   0.142  0.111  0.142
1   d=1         R0  7891  0.144   0.137   0.152  0.136  0.152
2   d=1         R1  7668  0.067   0.062   0.073  0.062  0.073
3   d=2      L0 L0   235  0.247   0.196   0.306  0.193  0.307
4   d=2      L0 R0  1135  0.106   0.089   0.125  0.088  0.125
5   d=2      L0 R1   513  0.111   0.087   0.141  0.085  0.142
6   d=2      R0 L0   735  0.214   0.186   0.245  0.184  0.245
7   d=2      R0 R0  2624  0.159   0.145   0.173  0.145  0.173
8   d=2      R0 R1  4500  0.124   0.114   0.133  0.114  0.134
9   d=2      R1 L0   910  0.095   0.077   0.115  0.076  0.115
10  d=2      R1 R0  4091  0.072   0.064   0.080  0.064  0.080
11  d=2      R1 R1  2620  0.048   0.041   0.057  0.041  0.057
    across blocks         choice set   CI          part  holds                                                                        detail
0            True          free only  wil           (1)   True                      P(L|L1)=0.804 [0.796,0.812], P(L|R1)=0.185 [0.177,0.193]
1            True          free only   CP           (1)   True                      P(L|L1)=0.804 [0.796,0.812], P(L|R1)=0.185 [0.177,0.193]
2            True  free + extinction  wil           (1)   True                      P(L|L1)=0.806 [0.798,0.814], P(L|R1)=0.182 [0.174,0.190]
3            True  free + extinction   CP           (1)   True                      P(L|L1)=0.806 [0.798,0.814], P(L|R1)=0.182 [0.174,0.190]
4            True                  -    -   (2) floor 0   True  left tone min P(L) 0.715 over 12 branches; right tone max P(L) 0.247 over 12
5            True                  -    -  (2) floor 10   True  left tone min P(L) 0.715 over 12 branches; right tone max P(L) 0.247 over 12
6           False          free only  wil           (1)   True                      P(L|L1)=0.807 [0.798,0.814], P(L|R1)=0.182 [0.174,0.190]
7           False          free only   CP           (1)   True                      P(L|L1)=0.807 [0.798,0.814], P(L|R1)=0.182 [0.174,0.190]
8           False  free + extinction  wil           (1)   True                      P(L|L1)=0.807 [0.798,0.814], P(L|R1)=0.182 [0.174,0.190]
9           False  free + extinction   CP           (1)   True                      P(L|L1)=0.807 [0.798,0.814], P(L|R1)=0.182 [0.174,0.190]
10          False                  -    -   (2) floor 0   True  left tone min P(L) 0.699 over 12 branches; right tone max P(L) 0.254 over 12
11          False                  -    -  (2) floor 10   True  left tone min P(L) 0.699 over 12 branches; right tone max P(L) 0.254 over 12
All readings hold: True

Result: reproduced. For the choice tone P(L) after L1 is 0.804 (0.796 to 0.812) and after R1 0.185 (0.177 to 0.193). Every left-tone branch has P(L) of 0.715 or more and every right-tone branch 0.247 or less (sequences across blocks; 0.699 and 0.254 within blocks). All 12 readings hold.

Choice models (fig2g-fq-variable-best, actor-critic-near-chance)¶

Choice-tone trials of free-choice blocks with an L/R choice, as one sequence per session (the values carry across the free-choice blocks of a session; extinction trials are left out). The dandiset has 86 sessions with free-choice trials, where the paper's comparison used 202 (101 training, 101 test); the others are not in the dandiset. Training and test halves: (alt) alternate sessions in name order, (rand) a seeded random half. Models and their forms: see the docstring of models.py. Normalized likelihood of test data per model, overall and per test session; paired Wilcoxon signed-rank tests of each model against FQ (variable) across test sessions (Fig. 2G legend).

In [11]:
import models as M
fc = T[(T.btype == "FREE") & T.choice].sort_values(["session", "trial"])
SESS = {s: ((g.action == 1).to_numpy(), (g.reward == 1).to_numpy()) for s, g in fc.groupby("session")}
names = sorted(SESS)
rng_split = np.random.default_rng(SEED + 2)
perm = rng_split.permutation(len(names))
SPLITS = {"alt": ([names[i] for i in range(0, len(names), 2)], [names[i] for i in range(1, len(names), 2)]),
          "rand": ([names[i] for i in sorted(perm[:len(names) // 2])], [names[i] for i in sorted(perm[len(names) // 2:])])}
print(len(names), "sessions with free-choice trials;", sum(len(v[0]) for v in SESS.values()), "trials")
GRID_A = [0.0, 0.01, 0.05]
GRID_K = [0.0, 0.05, 0.2]

def run_models(split, seed):
    rng = np.random.default_rng(seed)
    tr_names, te_names = SPLITS[split]
    train = [SESS[s] for s in tr_names]; test = [SESS[s] for s in te_names]
    ll = {}; fitted = {}
    for d in (1, 2, 3, 4):
        cnt = M.markov_fit(d, train)
        ll[f"Markov {d}"] = [M.markov_loglik(d, cnt, a, r) for a, r in test]
    for kind in ("Q", "FQ", "DFQ"):
        x, _ = M.fit_const(kind, train, rng)
        fitted[f"{kind} const"] = np.round(x, 3)
        ll[f"{kind} const"] = [M.q_loglik(x, kind, a, r) for a, r in test]
    for kind in ("Q", "FQ", "DFQ"):
        best = None
        for sa in GRID_A:
            for sk in GRID_K:
                L = sum(M.pf_session(kind, a, r, sa, sk, rng).sum() for a, r in train)
                if best is None or L > best[0]:
                    best = (L, sa, sk)
        fitted[f"{kind} variable"] = best[1:]
        ll[f"{kind} variable"] = [M.pf_session(kind, a, r, best[1], best[2], rng) for a, r in test]
    for shared in (True, False):
        nm = "actor-critic " + ("(a) shared rate" if shared else "(b) separate rates")
        x, _ = M.fit_const(None, train, rng, loglik=lambda p, a, r, s=shared: M.ac_loglik(p, s, a, r), bounds=M.AC_BOUNDS[shared])
        fitted[nm] = np.round(x, 3)
        ll[nm] = [M.ac_loglik(x, shared, a, r) for a, r in test]
    return ll, fitted

MODEL_RES = {sp: run_models(sp, SEED + 20 + i) for i, sp in enumerate(SPLITS)}
86 sessions with free-choice trials; 36496 trials
/home/runner/work/encore/encore/entries/001642-ito-2015/models.py:36: RuntimeWarning: overflow encountered in exp
  return 1.0 / (1.0 + np.exp(-x))
In [12]:
rows = []
for sp, (ll, fitted) in MODEL_RES.items():
    ref = np.array([M.norm_lik(x) for x in ll["FQ variable"]])
    for m, lls in ll.items():
        per = np.array([M.norm_lik(x) for x in lls])
        p = stats.wilcoxon(per, ref).pvalue if m != "FQ variable" else np.nan
        rows.append({"split": sp, "model": m, "normalized likelihood": M.norm_lik(np.concatenate(lls)),
                     "median per session": np.median(per), "Wilcoxon p vs FQ variable": p,
                     "fitted": fitted.get(m, "")})
r2g = pd.DataFrame(rows)
print(r2g.round(4).to_string())
for sp in SPLITS:
    d = r2g[(r2g.split == sp) & ~r2g.model.str.startswith("actor")]
    best = d.loc[d["normalized likelihood"].idxmax(), "model"]
    fqv = d.loc[d.model == "FQ variable", "normalized likelihood"].item()
    mk = d[d.model.str.startswith("Markov")]["normalized likelihood"].max()
    print(f"{sp}: best model {best}; FQ variable {fqv:.4f}; best Markov {mk:.4f}; FQ variable above every Markov: {fqv > mk}")
   split                            model  normalized likelihood  median per session  Wilcoxon p vs FQ variable                       fitted
0    alt                         Markov 1                 0.5637              0.5567                     0.0000                             
1    alt                         Markov 2                 0.5731              0.5683                     0.0616                             
2    alt                         Markov 3                 0.5770              0.5737                     0.1436                             
3    alt                         Markov 4                 0.5785              0.5756                     0.0257                             
4    alt                          Q const                 0.5710              0.5694                     0.2618                [0.57, 2.216]
5    alt                         FQ const                 0.5744              0.5721                     0.3406        [0.502, 2.147, 1.141]
6    alt                        DFQ const                 0.5757              0.5750                     0.3530  [0.556, 0.31, 1.996, 0.922]
7    alt                       Q variable                 0.5702              0.5674                     0.1048                  (0.01, 0.0)
8    alt                      FQ variable                 0.5758              0.5719                        NaN                 (0.01, 0.05)
9    alt                     DFQ variable                 0.5770              0.5750                     0.0104                 (0.01, 0.05)
10   alt     actor-critic (a) shared rate                 0.5000              0.5000                     0.0000                   [0.0, 0.0]
11   alt  actor-critic (b) separate rates                 0.5013              0.5033                     0.0000          [0.391, 0.01, 1.99]
12  rand                         Markov 1                 0.5657              0.5689                     0.0000                             
13  rand                         Markov 2                 0.5743              0.5751                     0.1964                             
14  rand                         Markov 3                 0.5782              0.5798                     0.0551                             
15  rand                         Markov 4                 0.5797              0.5797                     0.0044                             
16  rand                          Q const                 0.5717              0.5747                     0.0947                [0.54, 2.268]
17  rand                         FQ const                 0.5750              0.5788                     0.4838        [0.492, 2.196, 1.024]
18  rand                        DFQ const                 0.5764              0.5783                     0.2670  [0.544, 0.298, 2.06, 0.782]
19  rand                       Q variable                 0.5710              0.5691                     0.0155                 (0.01, 0.05)
20  rand                      FQ variable                 0.5762              0.5723                        NaN                 (0.01, 0.05)
21  rand                     DFQ variable                 0.5775              0.5752                     0.0342                 (0.01, 0.05)
22  rand     actor-critic (a) shared rate                 0.5026              0.5033                     0.0000               [0.243, 0.069]
23  rand  actor-critic (b) separate rates                 0.5000              0.5000                     0.0000              [1.0, 0.0, 0.0]
alt: best model Markov 4; FQ variable 0.5758; best Markov 0.5785; FQ variable above every Markov: False
rand: best model Markov 4; FQ variable 0.5762; best Markov 0.5797; FQ variable above every Markov: False
In [13]:
# Stability of the particle-filter results (verifier, round 1): the time-varying models
# rerun on the test sessions with three further seeds at the drift SDs chosen above, and a
# finer 5 x 5 grid of drift SDs for FQ variable on the alternate split.
rows = []
for sp, (ll, fitted) in MODEL_RES.items():
    tr_names, te_names = SPLITS[sp]
    for kind in ("FQ", "DFQ"):
        sa_, sk_ = fitted[f"{kind} variable"]
        for rep_ in range(3):
            rng = np.random.default_rng(SEED + 40 + 10 * rep_ + (sp == "rand"))
            lls = [M.pf_session(kind, a, r, sa_, sk_, rng) for a, r in (SESS[s] for s in te_names)]
            rows.append({"split": sp, "model": f"{kind} variable", "seed": rep_ + 1, "normalized likelihood": M.norm_lik(np.concatenate(lls))})
    mk4 = M.norm_lik(np.concatenate(ll["Markov 4"]))
    rows.append({"split": sp, "model": "Markov 4", "seed": 0, "normalized likelihood": mk4})
pfv = pd.DataFrame(rows)
print(pfv.pivot_table(index="model", columns="split", values="normalized likelihood", aggfunc=["min", "max"]).round(4).to_string())
FINE_A = [0.0, 0.005, 0.01, 0.02, 0.05]
FINE_K = [0.0, 0.02, 0.05, 0.1, 0.2]
rng = np.random.default_rng(SEED + 60)
tr_names, te_names = SPLITS["alt"]
rows = []
for kind in ("FQ",):
    best = None
    for sa_ in FINE_A:
        for sk_ in FINE_K:
            L = sum(M.pf_session(kind, *SESS[s], sa_, sk_, rng).sum() for s in tr_names)
            if best is None or L > best[0]:
                best = (L, sa_, sk_)
    lls = [M.pf_session(kind, *SESS[s], best[1], best[2], rng) for s in te_names]
    rows.append({"model": f"{kind} variable", "drift SDs (fine grid)": best[1:], "normalized likelihood, alt test": M.norm_lik(np.concatenate(lls))})
print(pd.DataFrame(rows).round(4).to_string())
print("Markov 4, alt test:", round(M.norm_lik(np.concatenate(MODEL_RES["alt"][0]["Markov 4"])), 4))
                 min             max        
split            alt    rand     alt    rand
model                                       
DFQ variable  0.5768  0.5775  0.5771  0.5775
FQ variable   0.5757  0.5764  0.5758  0.5764
Markov 4      0.5785  0.5797  0.5785  0.5797
         model drift SDs (fine grid)  normalized likelihood, alt test
0  FQ variable          (0.02, 0.05)                            0.576
Markov 4, alt test: 0.5785

Result: not reproduced. On held-out sessions FQ learning with time-varying parameters reaches a normalized likelihood of 0.5758 (alternate split) and 0.5762 (random split), below DFQ variable (0.5770, 0.5775) and below the Markov models of order 3 (0.5770, 0.5782) and 4 (0.5785, 0.5797), so it fails under both splits. Per test session Markov 4 is above it with Wilcoxon p = 0.026 and 0.0044. It is above Q and FQ with constant parameters and Markov 1. All models are close: from Markov 2 to Markov 4 the range is 0.5731 to 0.5797. Three further particle-filter seeds at the chosen drift SDs give FQ variable 0.5757 to 0.5758 (alternate) and 0.5764 (random) and DFQ variable 0.5768 to 0.5771 and 0.5775, and the finer 5 x 5 grid of drift SDs gives FQ variable 0.5760 on the alternate test half (SDs 0.02 and 0.05), all below Markov 4. The model equations are missing from the paper's text and are taken as the claims file reads them (O8), the priors of the particle filter are assumed, and the comparison uses 86 sessions where the paper used 202.

In [14]:
ac = r2g[r2g.model.str.startswith("actor")][["split", "model", "normalized likelihood", "fitted"]].copy()
ac["within 0.5080 ± 0.0508"] = (ac["normalized likelihood"] - 0.5080).abs() <= 0.0508
print(ac.round(4).to_string())
   split                            model  normalized likelihood               fitted  within 0.5080 ± 0.0508
10   alt     actor-critic (a) shared rate                 0.5000           [0.0, 0.0]                    True
11   alt  actor-critic (b) separate rates                 0.5013  [0.391, 0.01, 1.99]                    True
22  rand     actor-critic (a) shared rate                 0.5026       [0.243, 0.069]                    True
23  rand  actor-critic (b) separate rates                 0.5000      [1.0, 0.0, 0.0]                    True

Result: reproduced. The regular actor-critic with constant parameters gives a normalized likelihood of 0.5000 (shared rate) and 0.5013 (separate rates) on the alternate split, and 0.5026 and 0.5000 on the random split, all within 0.0508 of the paper's 0.5080. The fitted parameters sit at or near their bounds (shared rate: rate 0 and inverse temperature 0 on the alternate split; separate rates: critic rate 1, actor rate 0 and inverse temperature 0 on the random split), where the model predicts 0.5 on every trial. The tolerance band contains 0.5, so the test cannot tell this model from one that does not learn.

neuron-counts¶

Stable recordings were made from 260 DLS, 178 DMS and 179 VS neurons, of which 190, 105 and 119 were phasically active neurons.

The dandiset holds 859 units with an Area and a deposited PANs flag, so it is not only the curated units. The criterion applies the PAN rule of the Methods (proportion of time in ISIs longer than 1 s greater than 0.4, whole session). Of the five exclusion conditions of the Methods (Electrophysiological recording), (1), (2) and (5) need waveforms or histology, which are not in the files (CS units are left out as outside the three targets). Conditions (3) and (4) and the duplicate check are computed here from the spikes, as the Methods give them: (3) PETHs from -4 to 4 s in 100 ms bins around cue onset, centre-hole exit and L/R entry all below 1 Hz; (4) the EASH in 10 ms bins smoothed with a 10 ms Gaussian below 1 Hz "at any time bin", read as (i) in every bin, (ii) in some bin; duplicates: cross-correlogram in 1 ms bins between units on different wires of a bundle with the 0 ms bin 10 times the mean of -200 to 200 ms (the PETH-similarity part of that rule is not defined, so it is not applied).

In [15]:
allu = S.neurons(D, lambda u: True)
rows = []
peth_off = np.column_stack([np.arange(-4, 4, .1), np.arange(-4, 4, .1) + .1])
for n in allu:
    s = n["spikes"]; isi = np.diff(s)
    prop = isi[isi > 1].sum() / isi.sum()
    peth_max = max(S.rcounts(n, ev, peth_off).mean(0).max() / .1 for ev in (2, 4, 5))
    e10 = S.gauss_smooth(S.wcounts(n, S.bins(.01)).mean(0) / .01, 1)
    rows.append(dict(region=n["region"], session=n["session"], subject=n["subject"], unit=n["unit"],
                     prop=prop, peth_max=peth_max, eash_max=e10.max(), eash_min=e10.min()))
UN = pd.DataFrame(rows)
UN = UN.merge(U[["session", "Unit_Name", "PANs", "Electrode_ID"]].rename(columns={"Unit_Name": "unit"}), on=["session", "unit"])
UN["c3"] = UN.peth_max < 1.0
UN["c4i"] = UN.eash_max < 1.0
UN["c4ii"] = UN.eash_min < 1.0

# duplicate check within a bundle (wires 1-8, 9-16, 17-24, 25-32), different wires
UN["bundle"] = (UN.Electrode_ID - 1) // 8
spk = {(n["session"], n["unit"]): n["spikes"] for n in allu}
dup = set(); npairs = 0
for (ses, b), g in UN.groupby(["session", "bundle"]):
    g = g.sort_values("unit").to_dict("records")
    for i in range(len(g)):
        for j in range(i + 1, len(g)):
            if g[i]["Electrode_ID"] == g[j]["Electrode_ID"]:
                continue
            npairs += 1
            a, bb = spk[(ses, g[i]["unit"])], spk[(ses, g[j]["unit"])]
            zero = (np.searchsorted(bb, a + .0005) - np.searchsorted(bb, a - .0005)).sum()
            tot = (np.searchsorted(bb, a + .2005) - np.searchsorted(bb, a - .2005)).sum()
            if zero > 10 * max(tot - zero, 1) / 400:
                dup.add((ses, g[j]["unit"]))
UN["dup"] = [(s, u) in dup for s, u in zip(UN.session, UN.unit)]
UN["pan_rule"] = UN.prop > 0.4
print("Pairs checked:", npairs, "; units removed as duplicates:", len(dup))
paper = {"DLS": (260, 190), "DMS": (178, 105), "VS": (179, 119)}
rows = []
for name, keep in [("all units", np.ones(len(UN), bool)),
                   ("drop (3), (4i)", ~UN.c3 & ~UN.c4i),
                   ("drop (3), (4i), duplicates", ~UN.c3 & ~UN.c4i & ~UN.dup),
                   ("drop (3), (4ii)", ~UN.c3 & ~UN.c4ii),
                   ("drop (3), (4ii), duplicates", ~UN.c3 & ~UN.c4ii & ~UN.dup)]:
    for reg in S.REGIONS:
        m = keep & (UN.region == reg)
        st, pn = int(m.sum()), int((m & UN.pan_rule).sum())
        rows.append({"stable set": name, "region": reg, "stable": st, "paper stable": paper[reg][0],
                     "PANs (rule)": pn, "paper PANs": paper[reg][1],
                     "PANs (deposited flag)": int((m & (UN.PANs == 1)).sum()),
                     "stable ok": abs(st - paper[reg][0]) <= .1 * paper[reg][0],
                     "PAN ok": abs(pn - paper[reg][1]) <= .1 * paper[reg][1]})
nc = pd.DataFrame(rows)
print(nc.to_string())
# Sets without the duplicate check are upper limits of the paper's counts under each reading of
# condition (4): conditions (1), (2) and (5) and the full duplicate rule can only remove units.
# A count misses for certain only where such an upper limit is below the lower end of tolerance.
ub = nc[nc["stable set"].isin(["all units", "drop (3), (4i)", "drop (3), (4ii)"])].copy()
ub["stable below 90%"] = ub.stable < .9 * ub["paper stable"]
ub["PANs below 90%"] = ub["PANs (rule)"] < .9 * ub["paper PANs"]
print("\nUpper limits against the lower end of tolerance:")
print(ub[["stable set", "region", "stable", "paper stable", "stable below 90%", "PANs (rule)", "paper PANs", "PANs below 90%"]].to_string())
print("\nDeposited flag against the rule (all DLS/DMS/VS units):")
print(pd.crosstab(UN.PANs, UN.pan_rule))
print("Rule-PANs without the deposited flag: median whole-session rate",
      round(float((UN[UN.pan_rule & (UN.PANs == 0)].eash_max).median()), 2), "Hz peak EASH;",
      "with the flag:", round(float(UN[UN.PANs == 1].eash_max.median()), 2), "Hz")
print("Deposited PANs failing (3):", int((UN.c3 & (UN.PANs == 1)).sum()), "; failing (4i):", int((UN.c4i & (UN.PANs == 1)).sum()))
print("\nBy rat, deposited PANs per region:")
print(pd.crosstab(UN[UN.PANs == 1].subject, UN[UN.PANs == 1].region))
Pairs checked: 1261 ; units removed as duplicates: 90
                     stable set region  stable  paper stable  PANs (rule)  paper PANs  PANs (deposited flag)  stable ok  PAN ok
0                     all units    DLS     297           260          245         190                    204      False   False
1                     all units    DMS     255           178          194         105                    112      False   False
2                     all units     VS     215           179          189         119                    138      False   False
3                drop (3), (4i)    DLS     265           260          213         190                    187       True   False
4                drop (3), (4i)    DMS     224           178          163         105                    105      False   False
5                drop (3), (4i)     VS     169           179          143         119                    121       True   False
6    drop (3), (4i), duplicates    DLS     233           260          183         190                    160      False    True
7    drop (3), (4i), duplicates    DMS     204           178          147         105                     97      False   False
8    drop (3), (4i), duplicates     VS     142           179          119         119                     99      False    True
9               drop (3), (4ii)    DLS      49           260            2         190                      0      False   False
10              drop (3), (4ii)    DMS      62           178            7         105                      2      False   False
11              drop (3), (4ii)     VS      22           179            4         119                      2      False   False
12  drop (3), (4ii), duplicates    DLS      47           260            2         190                      0      False   False
13  drop (3), (4ii), duplicates    DMS      57           178            6         105                      2      False   False
14  drop (3), (4ii), duplicates     VS      21           179            4         119                      2      False   False

Upper limits against the lower end of tolerance:
         stable set region  stable  paper stable  stable below 90%  PANs (rule)  paper PANs  PANs below 90%
0         all units    DLS     297           260             False          245         190           False
1         all units    DMS     255           178             False          194         105           False
2         all units     VS     215           179             False          189         119           False
3    drop (3), (4i)    DLS     265           260             False          213         190           False
4    drop (3), (4i)    DMS     224           178             False          163         105           False
5    drop (3), (4i)     VS     169           179             False          143         119           False
9   drop (3), (4ii)    DLS      49           260              True            2         190            True
10  drop (3), (4ii)    DMS      62           178              True            7         105            True
11  drop (3), (4ii)     VS      22           179              True            4         119            True

Deposited flag against the rule (all DLS/DMS/VS units):
pan_rule  False  True 
PANs                  
0.0         139    174
1.0           0    454
Rule-PANs without the deposited flag: median whole-session rate 1.98 Hz peak EASH; with the flag: 4.3 Hz
Deposited PANs failing (3): 38 ; failing (4i): 20

By rat, deposited PANs per region:
region   DLS  DMS  VS
subject              
091       30    1  14
092       28   24  25
101       20   11   2
108       22   12   9
114       44   10   0
115       14    9  69
116       46   45  19

Result: blocked (data_missing). The files hold no waveforms, amplitudes or recording depths (data check: the units table has Area, Electrode_ID, Neuron_ID, PANs, Unit_Name, the electrode references and the spike times; the electrodes table has a group and a location), so exclusion conditions (1), (2) and (5) cannot be applied. Every count that can be computed misses the paper in at least one region. The dandiset holds 297 DLS, 255 DMS and 215 VS units (all outside 10% of 260, 178 and 179); after conditions (3), (4i) and the duplicate check, 233, 204 and 142 remain (all outside). The Methods' PAN rule on that set gives 183, 147 and 119 (DMS outside 10% of 105). The deposited PANs flag gives 204, 112 and 138 (VS outside 10% of 119), and the flagged units that pass the computable exclusions number 160, 97 and 99 (DLS and VS outside). The flag is a subset of the units that pass the ISI rule (454 of 628), and 38 flagged units fail condition (3), so the flag rests on a criterion that the dandiset does not describe. The duplicate check here omits the PETH-similarity part of the paper's rule, which is not defined.

Upper limits (verifier, round 2). Conditions (1), (2) and (5) and the PETH-similarity part of the duplicate rule can only remove units, so a count is shown to miss only where an upper limit of it is below the lower end of tolerance. Without the duplicate check, conditions (3) and (4i) leave 265, 224 and 169 units (lower ends 234, 160.2 and 161.1) and 213, 163 and 143 rule PANs (lower ends 171, 94.5 and 107.1): no upper limit is below its lower end, so under reading (4i) the missing conditions could bring every count into tolerance. Under reading (4ii) every upper limit is far below (49, 62 and 22 units; 2, 7 and 4 PANs), but (4ii) leaves far fewer units than the paper's stable counts, so it is unlikely to be the paper's reading unless the paper recorded many units that are not in the dandiset. So the counts cannot be decided from the dandiset: the claim is blocked (data_missing), the verifier's outcome of round 2, proposed after it and agreed in round 3. The counts computed above, which under every computable reading miss the paper in at least one region, are kept as the result as tested.

Unit sets for the neural claims¶

The neural claims are run on two unit sets, each a reading of the unit selection: the units the dandiset flags as PANs (PANs = 1) in DLS, DMS and VS (204, 112, 138), and the set rebuilt from the Methods' rule (rule PANs after conditions (3), (4i) and the duplicate check: 183, 147, 119). The claims file defines a PAN by the Methods' rule, but the rule cannot be applied in full here, as the waveform and histology conditions have no data (neuron-counts); the flag is the depositors' own classification. Neither set matches the paper's counts, so neither is preferred, and a claim whose result differs between them is blocked.

In [16]:
PAN = S.neurons(D, lambda u: u.PANs == 1)
_keep = set(zip(UN.session[~UN.c3 & ~UN.c4i & ~UN.dup & UN.pan_rule], UN.unit[~UN.c3 & ~UN.c4i & ~UN.dup & UN.pan_rule]))
PAN_RULE = [n for n in allu if (n["session"], n["unit"]) in _keep]
SETS = {"deposited PANs": PAN, "Methods-rule PANs": PAN_RULE}
for k, v in SETS.items():
    print(k, pd.Series([n["region"] for n in v]).value_counts().reindex(S.REGIONS).to_dict())
REG = {k: np.array([n["region"] for n in v]) for k, v in SETS.items()}

def trial_mask(n, ext):
    """Trials of a neuron's session used for EASHs and Fig. 5 (O3): with or without extinction."""
    return np.ones(len(n["tr"]), bool) if ext else (n["tr"].btype != "EXT").to_numpy()
deposited PANs {'DLS': 204, 'DMS': 112, 'VS': 138}
Methods-rule PANs {'DLS': 183, 'DMS': 147, 'VS': 119}

Fig. 4 claims (fig4b-vs-phase1, fig4b-dms-phase5, fig4b-vs-phase7, fig4c-activation-duration)¶

Per PAN, the EASH (10 ms bins) over all choice trials, with (O3 b) or without (O3 a) extinction trials, smoothed as O2 (10 ms SD, 30 ms SD, none), normalized to a maximum of 1. Activated in a phase: (a) some bin at or above 0.5 in that phase; (b) the first crossing of 0.5 falls in that phase. Activity ratio (Fig. 4C legend): the fraction of a phase's bins above 0.5, averaged over the seven phases. Chi-square tests are 2 x 2 (O4: without and with Yates' correction); Mann-Whitney U tests two-sided. Readings: unit set (2) x O3 (2) x O2 (3) x activation reading (2) x O4 (2), 48 for each Fig. 4B claim; unit set x O3 x O2, 12 for Fig. 4C.

In [17]:
E10 = S.bins(0.01)
PH_OF_BIN = np.searchsorted(S.EDGES, E10[:, 0], "right") - 1  # 0..6 for Phases 1..7
def eash_all(nset, ext):
    return np.array([S.wcounts(n, E10)[trial_mask(n, ext)].mean(0) / 0.01 for n in nset])
EASH = {(k, ext): eash_all(v, ext) for k, v in SETS.items() for ext in (False, True)}

def fig4_measures(E, sd):
    sm = np.array([S.gauss_smooth(e, sd) for e in E]) if sd else E
    nrm = sm / sm.max(axis=1, keepdims=True)
    above = nrm >= 0.5
    any_ph = np.column_stack([above[:, PH_OF_BIN == p].any(1) for p in range(7)])
    first = PH_OF_BIN[np.argmax(above, axis=1)]
    first_ph = np.column_stack([first == p for p in range(7)])
    ratio = np.column_stack([(nrm[:, PH_OF_BIN == p] > 0.5).mean(1) for p in range(7)]).mean(1)
    return any_ph, first_ph, ratio

F4 = {}
for (k, ext), E in EASH.items():
    for sd_name, sd in [("10 ms", 1), ("30 ms", 3), ("none", 0)]:
        F4[(k, ext, sd_name)] = fig4_measures(E, sd)

def chi2x2(a, na, b, nb, yates):
    t = np.array([[a, na - a], [b, nb - b]])
    return stats.chi2_contingency(t, correction=yates)[1]

def phase_test(phase, high, others):
    rows = []
    for (k, ext, sdn), (anyp, firstp, _) in F4.items():
        reg = REG[k]
        for rd, M in [("(a) any bin", anyp), ("(b) first crossing", firstp)]:
            prop = {r: M[reg == r, phase].mean() for r in S.REGIONS}
            cnt = {r: (M[reg == r, phase].sum(), (reg == r).sum()) for r in S.REGIONS}
            for yates in (False, True):
                row = {"set": k, "ext": ext, "smooth": sdn, "reading": rd, "Yates": yates}
                row.update({f"P {r}": round(prop[r], 3) for r in S.REGIONS})
                for o in others:
                    row[f"p vs {o}"] = chi2x2(*cnt[high], *cnt[o], yates)
                rows.append(row)
    return pd.DataFrame(rows)
In [18]:
r41 = phase_test(0, "VS", ["DLS", "DMS"])
r41["holds"] = (r41["P VS"] > .54) & (r41["P VS"] > r41["P DLS"]) & (r41["P VS"] > r41["P DMS"]) & (r41["p vs DLS"] < .05) & (r41["p vs DMS"] < .05)
print(r41.round(5).to_string())
print("By rat, proportion of deposited PANs activated in Phase 1 (no extinction trials, 30 ms, any bin):")
_any = F4[("deposited PANs", False, "30 ms")][0]
print(pd.crosstab([n["subject"] for n in PAN], REG["deposited PANs"], values=_any[:, 0], aggfunc="mean").round(2).to_string())
print(r41.groupby(["set", "reading"]).holds.agg(["sum", "size"]).to_string())
print("Holds in", int(r41.holds.sum()), "of", len(r41), "readings:", rule_outcome(r41.holds))
                  set    ext smooth             reading  Yates  P DLS  P DMS   P VS  p vs DLS  p vs DMS  holds
0      deposited PANs  False  10 ms         (a) any bin  False  0.451  0.330  0.681   0.00003   0.00000   True
1      deposited PANs  False  10 ms         (a) any bin   True  0.451  0.330  0.681   0.00004   0.00000   True
2      deposited PANs  False  10 ms  (b) first crossing  False  0.451  0.330  0.681   0.00003   0.00000   True
3      deposited PANs  False  10 ms  (b) first crossing   True  0.451  0.330  0.681   0.00004   0.00000   True
4      deposited PANs  False  30 ms         (a) any bin  False  0.461  0.339  0.652   0.00050   0.00000   True
5      deposited PANs  False  30 ms         (a) any bin   True  0.461  0.339  0.652   0.00075   0.00000   True
6      deposited PANs  False  30 ms  (b) first crossing  False  0.461  0.339  0.652   0.00050   0.00000   True
7      deposited PANs  False  30 ms  (b) first crossing   True  0.461  0.339  0.652   0.00075   0.00000   True
8      deposited PANs  False   none         (a) any bin  False  0.480  0.393  0.761   0.00000   0.00000   True
9      deposited PANs  False   none         (a) any bin   True  0.480  0.393  0.761   0.00000   0.00000   True
10     deposited PANs  False   none  (b) first crossing  False  0.480  0.393  0.761   0.00000   0.00000   True
11     deposited PANs  False   none  (b) first crossing   True  0.480  0.393  0.761   0.00000   0.00000   True
12     deposited PANs   True  10 ms         (a) any bin  False  0.451  0.357  0.681   0.00003   0.00000   True
13     deposited PANs   True  10 ms         (a) any bin   True  0.451  0.357  0.681   0.00004   0.00000   True
14     deposited PANs   True  10 ms  (b) first crossing  False  0.451  0.357  0.681   0.00003   0.00000   True
15     deposited PANs   True  10 ms  (b) first crossing   True  0.451  0.357  0.681   0.00004   0.00000   True
16     deposited PANs   True  30 ms         (a) any bin  False  0.466  0.339  0.638   0.00176   0.00000   True
17     deposited PANs   True  30 ms         (a) any bin   True  0.466  0.339  0.638   0.00254   0.00000   True
18     deposited PANs   True  30 ms  (b) first crossing  False  0.466  0.339  0.638   0.00176   0.00000   True
19     deposited PANs   True  30 ms  (b) first crossing   True  0.466  0.339  0.638   0.00254   0.00000   True
20     deposited PANs   True   none         (a) any bin  False  0.480  0.366  0.746   0.00000   0.00000   True
21     deposited PANs   True   none         (a) any bin   True  0.480  0.366  0.746   0.00000   0.00000   True
22     deposited PANs   True   none  (b) first crossing  False  0.480  0.366  0.746   0.00000   0.00000   True
23     deposited PANs   True   none  (b) first crossing   True  0.480  0.366  0.746   0.00000   0.00000   True
24  Methods-rule PANs  False  10 ms         (a) any bin  False  0.519  0.463  0.706   0.00125   0.00007   True
25  Methods-rule PANs  False  10 ms         (a) any bin   True  0.519  0.463  0.706   0.00188   0.00011   True
26  Methods-rule PANs  False  10 ms  (b) first crossing  False  0.519  0.463  0.706   0.00125   0.00007   True
27  Methods-rule PANs  False  10 ms  (b) first crossing   True  0.519  0.463  0.706   0.00188   0.00011   True
28  Methods-rule PANs  False  30 ms         (a) any bin  False  0.525  0.463  0.689   0.00452   0.00021   True
29  Methods-rule PANs  False  30 ms         (a) any bin   True  0.525  0.463  0.689   0.00654   0.00034   True
30  Methods-rule PANs  False  30 ms  (b) first crossing  False  0.525  0.463  0.689   0.00452   0.00021   True
31  Methods-rule PANs  False  30 ms  (b) first crossing   True  0.525  0.463  0.689   0.00654   0.00034   True
32  Methods-rule PANs  False   none         (a) any bin  False  0.552  0.497  0.765   0.00017   0.00001   True
33  Methods-rule PANs  False   none         (a) any bin   True  0.552  0.497  0.765   0.00028   0.00001   True
34  Methods-rule PANs  False   none  (b) first crossing  False  0.552  0.497  0.765   0.00017   0.00001   True
35  Methods-rule PANs  False   none  (b) first crossing   True  0.552  0.497  0.765   0.00028   0.00001   True
36  Methods-rule PANs   True  10 ms         (a) any bin  False  0.519  0.483  0.706   0.00125   0.00025   True
37  Methods-rule PANs   True  10 ms         (a) any bin   True  0.519  0.483  0.706   0.00188   0.00040   True
38  Methods-rule PANs   True  10 ms  (b) first crossing  False  0.519  0.483  0.706   0.00125   0.00025   True
39  Methods-rule PANs   True  10 ms  (b) first crossing   True  0.519  0.483  0.706   0.00188   0.00040   True
40  Methods-rule PANs   True  30 ms         (a) any bin  False  0.530  0.469  0.672   0.01421   0.00092   True
41  Methods-rule PANs   True  30 ms         (a) any bin   True  0.530  0.469  0.672   0.01968   0.00142   True
42  Methods-rule PANs   True  30 ms  (b) first crossing  False  0.530  0.469  0.672   0.01421   0.00092   True
43  Methods-rule PANs   True  30 ms  (b) first crossing   True  0.530  0.469  0.672   0.01968   0.00142   True
44  Methods-rule PANs   True   none         (a) any bin  False  0.552  0.483  0.756   0.00032   0.00001   True
45  Methods-rule PANs   True   none         (a) any bin   True  0.552  0.483  0.756   0.00051   0.00001   True
46  Methods-rule PANs   True   none  (b) first crossing  False  0.552  0.483  0.756   0.00032   0.00001   True
47  Methods-rule PANs   True   none  (b) first crossing   True  0.552  0.483  0.756   0.00051   0.00001   True
By rat, proportion of deposited PANs activated in Phase 1 (no extinction trials, 30 ms, any bin):
col_0   DLS   DMS    VS
row_0                  
091    0.60  0.00  0.57
092    0.57  0.46  0.80
101    0.10  0.27  0.50
108    0.59  0.67  0.44
114    0.36  0.20   NaN
115    0.36  0.67  0.65
116    0.52  0.18  0.63
                                      sum  size
set               reading                      
Methods-rule PANs (a) any bin          12    12
                  (b) first crossing   12    12
deposited PANs    (a) any bin          12    12
                  (b) first crossing   12    12
Holds in 48 of 48 readings: reproduced

Result: blocked (data_missing). It depends on neuron-counts, which is blocked (data_missing), so by Author step 1.5 it is blocked for the same reason (agreed by the verifier in round 3). As tested, the criterion gives reproduced: The claim holds in all 48 readings. The proportion of VS PANs activated in Phase 1 is 0.638 to 0.765, against 0.451 to 0.552 in DLS (chi-square p 0.020 or less) and 0.330 to 0.497 in DMS (p 0.0015 or less). The two activation readings give the same Phase 1 proportions, since a first crossing in Phase 1 is the same as some bin above 0.5 in Phase 1. By rat, the VS proportions on the deposited PANs (no extinction trials, 30 ms) are 0.44 to 0.80; one rat has no VS PANs.

In [19]:
r45 = phase_test(4, "DMS", ["DLS", "VS"])
r45["holds"] = (r45["P DMS"] > .54) & (r45["P DMS"] > r45["P DLS"]) & (r45["P DMS"] > r45["P VS"]) & (r45["p vs DLS"] < .05) & (r45["p vs VS"] < .05)
print(r45.round(5).to_string())
print(r45.groupby(["set", "reading"]).holds.agg(["sum", "size"]).to_string())
print("Holds in", int(r45.holds.sum()), "of", len(r45), "readings:", rule_outcome(r45.holds))
                  set    ext smooth             reading  Yates  P DLS  P DMS   P VS  p vs DLS  p vs VS  holds
0      deposited PANs  False  10 ms         (a) any bin  False  0.436  0.652  0.543   0.00025  0.08313  False
1      deposited PANs  False  10 ms         (a) any bin   True  0.436  0.652  0.543   0.00039  0.10885  False
2      deposited PANs  False  10 ms  (b) first crossing  False  0.123  0.223  0.080   0.01901  0.00131  False
3      deposited PANs  False  10 ms  (b) first crossing   True  0.123  0.223  0.080   0.02894  0.00242  False
4      deposited PANs  False  30 ms         (a) any bin  False  0.436  0.652  0.514   0.00025  0.02893   True
5      deposited PANs  False  30 ms         (a) any bin   True  0.436  0.652  0.514   0.00039  0.03981   True
6      deposited PANs  False  30 ms  (b) first crossing  False  0.118  0.214  0.065   0.02205  0.00053  False
7      deposited PANs  False  30 ms  (b) first crossing   True  0.118  0.214  0.065   0.03354  0.00106  False
8      deposited PANs  False   none         (a) any bin  False  0.436  0.679  0.594   0.00004  0.16896  False
9      deposited PANs  False   none         (a) any bin   True  0.436  0.679  0.594   0.00006  0.21361  False
10     deposited PANs  False   none  (b) first crossing  False  0.098  0.205  0.065   0.00778  0.00097  False
11     deposited PANs  False   none  (b) first crossing   True  0.098  0.205  0.065   0.01277  0.00188  False
12     deposited PANs   True  10 ms         (a) any bin  False  0.431  0.679  0.558   0.00003  0.05166  False
13     deposited PANs   True  10 ms         (a) any bin   True  0.431  0.679  0.558   0.00004  0.06945  False
14     deposited PANs   True  10 ms  (b) first crossing  False  0.123  0.223  0.080   0.01901  0.00131  False
15     deposited PANs   True  10 ms  (b) first crossing   True  0.123  0.223  0.080   0.02894  0.00242  False
16     deposited PANs   True  30 ms         (a) any bin  False  0.436  0.652  0.529   0.00025  0.05012  False
17     deposited PANs   True  30 ms         (a) any bin   True  0.436  0.652  0.529   0.00039  0.06726  False
18     deposited PANs   True  30 ms  (b) first crossing  False  0.118  0.214  0.080   0.02205  0.00229  False
19     deposited PANs   True  30 ms  (b) first crossing   True  0.118  0.214  0.080   0.03354  0.00415  False
20     deposited PANs   True   none         (a) any bin  False  0.426  0.670  0.587   0.00004  0.17952  False
21     deposited PANs   True   none         (a) any bin   True  0.426  0.670  0.587   0.00006  0.22592  False
22     deposited PANs   True   none  (b) first crossing  False  0.108  0.214  0.072   0.01028  0.00114  False
23     deposited PANs   True   none  (b) first crossing   True  0.108  0.214  0.072   0.01641  0.00216  False
24  Methods-rule PANs  False  10 ms         (a) any bin  False  0.481  0.673  0.580   0.00045  0.11545  False
25  Methods-rule PANs  False  10 ms         (a) any bin   True  0.481  0.673  0.580   0.00068  0.14808  False
26  Methods-rule PANs  False  10 ms  (b) first crossing  False  0.093  0.163  0.092   0.05409  0.08928  False
27  Methods-rule PANs  False  10 ms  (b) first crossing   True  0.093  0.163  0.092   0.07871  0.12932  False
28  Methods-rule PANs  False  30 ms         (a) any bin  False  0.475  0.673  0.563   0.00031  0.06444  False
29  Methods-rule PANs  False  30 ms         (a) any bin   True  0.475  0.673  0.563   0.00048  0.08510  False
30  Methods-rule PANs  False  30 ms  (b) first crossing  False  0.087  0.156  0.084   0.05353  0.07479  False
31  Methods-rule PANs  False  30 ms  (b) first crossing   True  0.087  0.156  0.084   0.07856  0.11077  False
32  Methods-rule PANs  False   none         (a) any bin  False  0.486  0.694  0.613   0.00015  0.16917  False
33  Methods-rule PANs  False   none         (a) any bin   True  0.486  0.694  0.613   0.00023  0.21316  False
34  Methods-rule PANs  False   none  (b) first crossing  False  0.087  0.156  0.084   0.05353  0.07479  False
35  Methods-rule PANs  False   none  (b) first crossing   True  0.087  0.156  0.084   0.07856  0.11077  False
36  Methods-rule PANs   True  10 ms         (a) any bin  False  0.470  0.694  0.588   0.00004  0.07310  False
37  Methods-rule PANs   True  10 ms         (a) any bin   True  0.470  0.694  0.588   0.00007  0.09627  False
38  Methods-rule PANs   True  10 ms  (b) first crossing  False  0.093  0.163  0.092   0.05409  0.08928  False
39  Methods-rule PANs   True  10 ms  (b) first crossing   True  0.093  0.163  0.092   0.07871  0.12932  False
40  Methods-rule PANs   True  30 ms         (a) any bin  False  0.475  0.673  0.580   0.00031  0.11545  False
41  Methods-rule PANs   True  30 ms         (a) any bin   True  0.475  0.673  0.580   0.00048  0.14808  False
42  Methods-rule PANs   True  30 ms  (b) first crossing  False  0.093  0.156  0.101   0.07866  0.18208  False
43  Methods-rule PANs   True  30 ms  (b) first crossing   True  0.093  0.156  0.101   0.11210  0.24933  False
44  Methods-rule PANs   True   none         (a) any bin  False  0.475  0.680  0.622   0.00019  0.31921  False
45  Methods-rule PANs   True   none         (a) any bin   True  0.475  0.680  0.622   0.00029  0.38625  False
46  Methods-rule PANs   True   none  (b) first crossing  False  0.087  0.163  0.092   0.03592  0.08928  False
47  Methods-rule PANs   True   none  (b) first crossing   True  0.087  0.163  0.092   0.05383  0.12932  False
                                      sum  size
set               reading                      
Methods-rule PANs (a) any bin           0    12
                  (b) first crossing    0    12
deposited PANs    (a) any bin           2    12
                  (b) first crossing    0    12
Holds in 2 of 48 readings: blocked: the readings disagree

Result: blocked (methods_underspecified). The claim holds in 2 of the 48 readings: deposited PANs, extinction trials excluded, 30 ms smoothing, any bin (DMS 0.652 against DLS 0.436, p = 0.00025, and VS 0.514, p = 0.029 without and 0.040 with Yates' correction). With 10 ms or no smoothing DMS against VS gives p 0.052 to 0.23 on the deposited PANs, and with extinction trials at 30 ms p = 0.050 and 0.067. On the Methods-rule set DMS against VS gives p 0.064 to 0.39 under the any-bin reading. Under the first-crossing reading the DMS proportion is 0.156 to 0.223, far below 0.54. The readings disagree. The first-crossing reading is asked of a reader (questions/001642.yaml).

In [20]:
r47 = phase_test(6, "VS", ["DLS"])
r47["holds"] = (r47["P VS"] > r47["P DLS"]) & (r47["p vs DLS"] < .05)
print(r47.round(5).to_string())
print(r47.groupby(["set", "reading"]).holds.agg(["sum", "size"]).to_string())
print("Holds in", int(r47.holds.sum()), "of", len(r47), "readings:", rule_outcome(r47.holds))
                  set    ext smooth             reading  Yates  P DLS  P DMS   P VS  p vs DLS  holds
0      deposited PANs  False  10 ms         (a) any bin  False  0.529  0.598  0.681   0.00511   True
1      deposited PANs  False  10 ms         (a) any bin   True  0.529  0.598  0.681   0.00719   True
2      deposited PANs  False  10 ms  (b) first crossing  False  0.113  0.107  0.101   0.74145  False
3      deposited PANs  False  10 ms  (b) first crossing   True  0.113  0.107  0.101   0.87878  False
4      deposited PANs  False  30 ms         (a) any bin  False  0.520  0.607  0.659   0.01026   True
5      deposited PANs  False  30 ms         (a) any bin   True  0.520  0.607  0.659   0.01408   True
6      deposited PANs  False  30 ms  (b) first crossing  False  0.113  0.107  0.123   0.76812  False
7      deposited PANs  False  30 ms  (b) first crossing   True  0.113  0.107  0.123   0.90183  False
8      deposited PANs  False   none         (a) any bin  False  0.549  0.598  0.688   0.00968   True
9      deposited PANs  False   none         (a) any bin   True  0.549  0.598  0.688   0.01334   True
10     deposited PANs  False   none  (b) first crossing  False  0.093  0.071  0.072   0.50075  False
11     deposited PANs  False   none  (b) first crossing   True  0.093  0.071  0.072   0.63445  False
12     deposited PANs   True  10 ms         (a) any bin  False  0.525  0.607  0.674   0.00594   True
13     deposited PANs   True  10 ms         (a) any bin   True  0.525  0.607  0.674   0.00831   True
14     deposited PANs   True  10 ms  (b) first crossing  False  0.103  0.098  0.101   0.96438  False
15     deposited PANs   True  10 ms  (b) first crossing   True  0.103  0.098  0.101   1.00000  False
16     deposited PANs   True  30 ms         (a) any bin  False  0.515  0.616  0.667   0.00527   True
17     deposited PANs   True  30 ms         (a) any bin   True  0.515  0.616  0.667   0.00740   True
18     deposited PANs   True  30 ms  (b) first crossing  False  0.108  0.107  0.138   0.40461  False
19     deposited PANs   True  30 ms  (b) first crossing   True  0.108  0.107  0.138   0.50685  False
20     deposited PANs   True   none         (a) any bin  False  0.549  0.607  0.696   0.00642   True
21     deposited PANs   True   none         (a) any bin   True  0.549  0.607  0.696   0.00899   True
22     deposited PANs   True   none  (b) first crossing  False  0.088  0.071  0.080   0.78128  False
23     deposited PANs   True   none  (b) first crossing   True  0.088  0.071  0.080   0.93638  False
24  Methods-rule PANs  False  10 ms         (a) any bin  False  0.530  0.653  0.731   0.00047   True
25  Methods-rule PANs  False  10 ms         (a) any bin   True  0.530  0.653  0.731   0.00073   True
26  Methods-rule PANs  False  10 ms  (b) first crossing  False  0.071  0.088  0.076   0.88073  False
27  Methods-rule PANs  False  10 ms  (b) first crossing   True  0.071  0.088  0.076   1.00000  False
28  Methods-rule PANs  False  30 ms         (a) any bin  False  0.519  0.660  0.714   0.00073   True
29  Methods-rule PANs  False  30 ms         (a) any bin   True  0.519  0.660  0.714   0.00112   True
30  Methods-rule PANs  False  30 ms  (b) first crossing  False  0.077  0.095  0.084   0.81309  False
31  Methods-rule PANs  False  30 ms  (b) first crossing   True  0.077  0.095  0.084   0.98505  False
32  Methods-rule PANs  False   none         (a) any bin  False  0.557  0.660  0.731   0.00230   True
33  Methods-rule PANs  False   none         (a) any bin   True  0.557  0.660  0.731   0.00343   True
34  Methods-rule PANs  False   none  (b) first crossing  False  0.055  0.068  0.050   0.87276  False
35  Methods-rule PANs  False   none  (b) first crossing   True  0.055  0.068  0.050   1.00000  False
36  Methods-rule PANs   True  10 ms         (a) any bin  False  0.525  0.660  0.731   0.00033   True
37  Methods-rule PANs   True  10 ms         (a) any bin   True  0.525  0.660  0.731   0.00052   True
38  Methods-rule PANs   True  10 ms  (b) first crossing  False  0.066  0.082  0.076   0.73708  False
39  Methods-rule PANs   True  10 ms  (b) first crossing   True  0.066  0.082  0.076   0.91698  False
40  Methods-rule PANs   True  30 ms         (a) any bin  False  0.514  0.660  0.723   0.00030   True
41  Methods-rule PANs   True  30 ms         (a) any bin   True  0.514  0.660  0.723   0.00047   True
42  Methods-rule PANs   True  30 ms  (b) first crossing  False  0.071  0.095  0.101   0.35840  False
43  Methods-rule PANs   True  30 ms  (b) first crossing   True  0.071  0.095  0.101   0.48098  False
44  Methods-rule PANs   True   none         (a) any bin  False  0.557  0.667  0.731   0.00230   True
45  Methods-rule PANs   True   none         (a) any bin   True  0.557  0.667  0.731   0.00343   True
46  Methods-rule PANs   True   none  (b) first crossing  False  0.055  0.068  0.059   0.87764  False
47  Methods-rule PANs   True   none  (b) first crossing   True  0.055  0.068  0.059   1.00000  False
                                      sum  size
set               reading                      
Methods-rule PANs (a) any bin          12    12
                  (b) first crossing    0    12
deposited PANs    (a) any bin          12    12
                  (b) first crossing    0    12
Holds in 24 of 48 readings: blocked: the readings disagree

Result: blocked (methods_underspecified). The any-bin reading holds in all 24 of its variants (VS 0.659 to 0.731 against DLS 0.514 to 0.557, chi-square p 0.0003 to 0.014), and the first-crossing reading fails in all 24 (proportions 0.050 to 0.138, p 0.36 to 1). The readings disagree. The Fig. 4B legend ("reached 0.5 during each trial phase") does not clearly support the first-crossing reading; this is asked of a reader (questions/001642.yaml), and the claim is tested on the claims file as it stands.

In [21]:
rows = []
for (k, ext, sdn), (_, _, ratio) in F4.items():
    reg = REG[k]
    m = {r: ratio[reg == r].mean() for r in S.REGIONS}
    p = {f"p {a}-{b}": stats.mannwhitneyu(ratio[reg == a], ratio[reg == b]).pvalue
         for a, b in [("VS", "DLS"), ("VS", "DMS"), ("DLS", "DMS")]}
    row = {"set": k, "ext": ext, "smooth": sdn}
    row.update({f"mean {r}": round(v, 4) for r, v in m.items()}); row.update(p)
    row["holds"] = m["VS"] > m["DMS"] > m["DLS"] and all(v < .05 for v in p.values())
    rows.append(row)
r4c = pd.DataFrame(rows)
print(r4c.round(5).to_string())
print("Holds in", int(r4c.holds.sum()), "of", len(r4c), "readings:", rule_outcome(r4c.holds))
k0 = ("deposited PANs", False, "30 ms")
fig, ax = plt.subplots(1, 3, figsize=(10, 3))
for i, r in enumerate(S.REGIONS):
    E = EASH[("deposited PANs", False)][REG["deposited PANs"] == r]
    sm = np.array([S.gauss_smooth(e, 3) for e in E]); nrm = sm / sm.max(1, keepdims=True)
    order = np.argsort(np.argmax(nrm >= .5, axis=1))
    ax[i].imshow(nrm[order], aspect="auto", extent=[0, S.EDGES[-1], len(E), 0], vmin=0, vmax=1)
    for e in S.EDGES: ax[i].axvline(e, color="w", lw=.5)
    ax[i].set_title(f"{r} (n={len(E)})"); ax[i].set_xlabel("EASH time from E0 (s)")
plt.tight_layout(); plt.show()
print("Normalized EASHs, values 0 to 1 by construction; 30 ms smoothing, extinction trials excluded.")
                  set    ext smooth  mean DLS  mean DMS  mean VS  p VS-DLS  p VS-DMS  p DLS-DMS  holds
0      deposited PANs  False  10 ms    0.0944    0.1056   0.1721       0.0   0.00000    0.08238  False
1      deposited PANs  False  30 ms    0.1168    0.1298   0.2160       0.0   0.00000    0.06529  False
2      deposited PANs  False   none    0.0670    0.0783   0.1101       0.0   0.00086    0.05399  False
3      deposited PANs   True  10 ms    0.0957    0.1077   0.1733       0.0   0.00000    0.05736  False
4      deposited PANs   True  30 ms    0.1190    0.1318   0.2186       0.0   0.00000    0.06436  False
5      deposited PANs   True   none    0.0691    0.0792   0.1126       0.0   0.00047    0.07621  False
6   Methods-rule PANs  False  10 ms    0.1281    0.1498   0.2108       0.0   0.00004    0.04964   True
7   Methods-rule PANs  False  30 ms    0.1575    0.1939   0.2660       0.0   0.00005    0.02123   True
8   Methods-rule PANs  False   none    0.0882    0.1010   0.1347       0.0   0.00184    0.10239  False
9   Methods-rule PANs   True  10 ms    0.1293    0.1548   0.2116       0.0   0.00009    0.03296   True
10  Methods-rule PANs   True  30 ms    0.1601    0.1972   0.2673       0.0   0.00008    0.01807   True
11  Methods-rule PANs   True   none    0.0910    0.1061   0.1361       0.0   0.00323    0.09198  False
Holds in 4 of 12 readings: blocked: the readings disagree
No description has been provided for this image
Normalized EASHs, values 0 to 1 by construction; 30 ms smoothing, extinction trials excluded.

Result: blocked (methods_underspecified). In all 12 readings the means order VS > DMS > DLS, and VS is above DLS (p < 1e-5) and DMS (p 0.0033 or less). DLS against DMS gives p 0.054 to 0.082 on the deposited PANs and 0.018 to 0.102 on the Methods-rule set, where it is below 0.05 with 10 and 30 ms smoothing and not without smoothing. The claim holds in 4 of the 12 readings, all on the Methods-rule set with 10 or 30 ms smoothing; it fails in every reading on the deposited PANs (for example 30 ms, no extinction trials: VS 0.216, DMS 0.130, DLS 0.117, DLS against DMS p = 0.065).

Mutual information over all trials (Fig. 5 claims)¶

Per PAN, MI between the four firing levels and a binary event in each 100 ms bin of the EASH axis (bins from E0; a bin belongs to the phase that holds its centre), plus the 100 ms windows ending at E3 and at E4. The bins are not aligned to the events, so a bin can straddle one: the bin from 2.70 to 2.80 s has its centre on E2 (2.75 s) and counts to Phase 3. Events: action (left or right), state (fixed-choice blocks, single and double, against free-choice blocks), reward (rewarded or not). Trials: all choice trials without (O3 a) or with (O3 b) extinction trials; with extinction trials, those of the left and right tones count as fixed and those of the choice tone as free. O1 readings: (a) plug-in MI; (b) the same minus the mean of the neuron's 100 shuffles; (c) plug-in MI minus the Panzeri and Treves (1996) bias estimate. Readings (a) and (b) are the claims file's and decide the outcomes; (c) is a variant taken from the paper: the Results cite Panzeri and Treves (1996) for the MI ("the amount of mutual information between neuronal firing and each task event was calculated (Panzeri and Treves, 1996; Ito and Doya, 2009)"), the paper that gives this correction. Whether it should be a reading is asked of a reader (questions/001642.yaml). Threshold: second largest of 100 region averages with permuted events, computed the same way. As a further variant, action and reward MI are also computed with the events permuted within blocks, to see whether slow drift and block structure make the real labels pass the threshold of labels permuted over the session. Mann-Whitney U tests two-sided. Readings for each claim: unit set (2) x O3 (2) x O1 (a, b), times the claim's own.

In [22]:
G100 = S.bins(0.1)
WIN = np.vstack([G100, [[S.EDGES[3] - .1, S.EDGES[3]], [S.EDGES[4] - .1, S.EDGES[4]]]])
WLEN = WIN[:, 1] - WIN[:, 0]
CEN = G100.mean(1)
PH100 = np.searchsorted(S.EDGES, CEN, "right") - 1  # phase index 0..6 of each grid bin
iE3, iE4 = len(G100), len(G100) + 1

def labels_for(n, var, ext):
    tr = n["tr"]; m = trial_mask(n, ext)
    if var == "action":
        y = (tr.action == 1).to_numpy()
    elif var == "reward":
        y = (tr.reward == 1).to_numpy()
    else:  # state: fixed (SF, DF, or fixed-tone extinction) = 1, free = 0
        y = (tr.cue != "choice").to_numpy()
    return m, y

def mi_set(nset, var, ext, seed, within_blocks=False):
    rng = np.random.default_rng(seed)
    out = {"plugin": ([], []), "pt": ([], [])}
    for n in nset:
        m, y = labels_for(n, var, ext)
        c = S.wcounts(n, WIN)[m]
        grp = n["tr"].block.to_numpy()[m] if within_blocks else None
        res = S.mi_with_shuffles(c, y[m], rng, 100, 1.0, groups=grp)
        for est, (r, sh) in res.items():
            out[est][0].append(r / WLEN); out[est][1].append(sh / WLEN)
    return {est: (np.array(a), np.array(b)) for est, (a, b) in out.items()}  # N x W, N x 100 x W

MI = {}
for k, v in SETS.items():
    for ext in (False, True):
        for j, var in enumerate(["action", "state", "reward"]):
            MI[(k, ext, var)] = mi_set(v, var, ext, SEED + 10 * j + ext)
# Variant of the threshold, not a reading: action and reward labels permuted within blocks
# (extinction trials excluded), to see whether slow drift and block structure pass the
# threshold of labels permuted over the whole session (verifier, round 1).
MI_WB = {}
for k, v in SETS.items():
    for j, var in enumerate(["action", "reward"]):
        MI_WB[(k, False, var)] = mi_set(v, var, False, SEED + 500 + 10 * j + (k != "deposited PANs"), within_blocks=True)

def mi_reading(key, o1, wb=False):
    """Per-neuron MI (N x W) and per-region threshold (W) under O1 reading a or b, or the
    Panzeri-Treves variant c; with ``wb`` the shuffles are permutations within blocks."""
    real, shs = (MI_WB if wb else MI)[key]["pt" if o1 == "c" else "plugin"]
    if o1 == "b":
        mu = shs.mean(1)
        real, shs = real - mu, shs - mu[:, None, :]
    reg = REG[key[0]]
    avg = {r: real[reg == r].mean(0) for r in S.REGIONS}
    thr = {r: S.threshold(shs[reg == r].mean(0)) for r in S.REGIONS}
    return real, reg, avg, thr

def mwu(x, y):
    return stats.mannwhitneyu(x, y).pvalue

def readings():
    for k in SETS:
        for ext in (False, True):
            for o1 in ("a", "b", "c"):
                yield k, ext, o1

def verdict_o1(df, col="holds"):
    """Verdict over the claims file's O1 readings (a, b); c (Panzeri-Treves) is a variant."""
    d, c = df[df.O1 != "c"], df[df.O1 == "c"]
    print(f"Holds in {int(d[col].sum())} of {len(d)} readings (O1 a and b): {rule_outcome(d[col])}; "
          f"Panzeri-Treves variant (c): holds in {int(c[col].sum())} of {len(c)}")
In [23]:
# Clock check: action and reward information should rise only after the events that define them.
real, reg, avg, thr = mi_reading(("deposited PANs", False, "reward"), "a")
pre = PH100 <= 4; post = PH100 == 5
print("Reward MI (bits/s), all deposited PANs: mean over Phases 1-5", avg["VS"][:len(G100)][pre].mean().round(3),
      "; Phase 6", avg["VS"][:len(G100)][post].mean().round(3), "(VS)")
for r in S.REGIONS:
    a = avg[r][:len(G100)]; t = thr[r][:len(G100)]
    print(f"  {r}: bins above threshold in Phases 1-5: {int((a > t)[pre].sum())} of {int(pre.sum())}; in Phase 6: {int((a > t)[post].sum())} of {int(post.sum())}")
# shifted labels: each trial gets the reward of the previous trial (np.roll by one), which should carry little information after E5
rng = np.random.default_rng(SEED + 99)
sh_mi, tr_mi = [], []
for n in SETS["deposited PANs"]:
    m, y = labels_for(n, "reward", False)
    c = S.wcounts(n, WIN[(PH100 == 5).nonzero()[0]])[m]; yy = y[m]
    lev = S.quartile_levels(c)
    tr_mi.append(S.mi_bits(lev, yy).mean() / .1); sh_mi.append(S.mi_bits(lev, np.roll(yy, 1)).mean() / .1)
print("Phase 6 reward MI with true labels", np.mean(tr_mi).round(3), "against labels shifted by one trial", np.mean(sh_mi).round(3))
Reward MI (bits/s), all deposited PANs: mean over Phases 1-5 0.013 ; Phase 6 0.083 (VS)
  DLS: bins above threshold in Phases 1-5: 17 of 55; in Phase 6: 4 of 4
  DMS: bins above threshold in Phases 1-5: 10 of 55; in Phase 6: 4 of 4
  VS: bins above threshold in Phases 1-5: 19 of 55; in Phase 6: 4 of 4
Phase 6 reward MI with true labels 0.071 against labels shifted by one trial 0.019

fig5b-state-info-vs¶

Information about the block type (fixed- or free-choice) is strongest in VS, especially during the approach to the center hole (Phase 1).

Readings (criterion): per-neuron MI (a) averaged over the Phase 1 bins; (b) in each Phase 1 bin, judged on the bins where the VS average passes its threshold (the claim must hold in every such bin).

In [24]:
rows = []
ph1 = np.where(PH100 == 0)[0]
for k, ext, o1 in readings():
    real, reg, avg, thr = mi_reading((k, ext, "state"), o1)
    vs_pass = [b for b in ph1 if avg["VS"][b] > thr["VS"][b]]
    x = real[:, ph1].mean(1)
    pa = {o: mwu(x[reg == "VS"], x[reg == o]) for o in ["DLS", "DMS"]}
    ma = {r: x[reg == r].mean() for r in S.REGIONS}
    ok_a = all(ma["VS"] > ma[o] and pa[o] < .05 for o in ["DLS", "DMS"]) and len(vs_pass) > 0
    okb = []
    for b in vs_pass:
        okb.append(all(real[reg == "VS", b].mean() > real[reg == o, b].mean() and mwu(real[reg == "VS", b], real[reg == o, b]) < .05 for o in ["DLS", "DMS"]))
    rows.append({"set": k, "ext": ext, "O1": o1, "mean DLS": ma["DLS"], "mean DMS": ma["DMS"], "mean VS": ma["VS"],
                 "p VS-DLS": pa["DLS"], "p VS-DMS": pa["DMS"], "VS bins above thr": f"{len(vs_pass)}/{len(ph1)}",
                 "(a) holds": ok_a, "(b) bins holding": f"{sum(okb)}/{len(okb)}", "(b) holds": len(okb) > 0 and all(okb)})
r5b = pd.DataFrame(rows)
print(r5b.round(4).to_string())
d = r5b[r5b.O1 != "c"]
print("O1 a and b: reading (a) holds in", int(d["(a) holds"].sum()), "of", len(d), "; reading (b) in",
      int(d["(b) holds"].sum()), "of", len(d), ":", rule_outcome(pd.concat([d["(a) holds"], d["(b) holds"]])))
fig, ax = plt.subplots(1, 3, figsize=(11, 2.8), sharey=False)
for i, var in enumerate(["state", "action", "reward"]):
    real, reg, avg, thr = mi_reading(("deposited PANs", False, var), "a")
    for r in S.REGIONS:
        ax[i].plot(CEN, avg[r][:len(G100)], label=r); ax[i].plot(CEN, thr[r][:len(G100)], ls=":", lw=.8)
    for e in S.EDGES: ax[i].axvline(e, color="k", lw=.3)
    ax[i].set_title(f"{var} MI, deposited PANs"); ax[i].set_xlabel("EASH time (s)")
ax[0].set_ylabel("bits/s"); ax[0].legend(fontsize=7); plt.tight_layout(); plt.show()
for var in ["state", "action", "reward"]:
    real, reg, avg, thr = mi_reading(("deposited PANs", False, var), "a")
    print(var, "region averages range", {r: (avg[r].min().round(3), avg[r].max().round(3)) for r in S.REGIONS})
                  set    ext O1  mean DLS  mean DMS  mean VS  p VS-DLS  p VS-DMS VS bins above thr  (a) holds (b) bins holding  (b) holds
0      deposited PANs  False  a    0.0214    0.0323   0.0635    0.0000    0.0262             20/20       True            12/20      False
1      deposited PANs  False  b    0.0119    0.0226   0.0530    0.0000    0.0361             20/20       True             9/20      False
2      deposited PANs  False  c    0.0126    0.0234   0.0533    0.0000    0.0713             20/20      False             8/20      False
3      deposited PANs   True  a    0.0213    0.0317   0.0625    0.0000    0.0224             20/20       True            13/20      False
4      deposited PANs   True  b    0.0122    0.0225   0.0525    0.0000    0.0309             20/20       True            10/20      False
5      deposited PANs   True  c    0.0129    0.0232   0.0527    0.0000    0.0531             20/20      False            10/20      False
6   Methods-rule PANs  False  a    0.0295    0.0302   0.0573    0.0001    0.0214             20/20       True            12/20      False
7   Methods-rule PANs  False  b    0.0198    0.0201   0.0467    0.0001    0.0189             20/20       True             9/20      False
8   Methods-rule PANs  False  c    0.0205    0.0207   0.0470    0.0005    0.0352             20/20       True             9/20      False
9   Methods-rule PANs   True  a    0.0296    0.0298   0.0570    0.0001    0.0180             20/20       True            11/20      False
10  Methods-rule PANs   True  b    0.0203    0.0202   0.0470    0.0001    0.0171             20/20       True            11/20      False
11  Methods-rule PANs   True  c    0.0209    0.0207   0.0473    0.0004    0.0301             20/20       True            10/20      False
O1 a and b: reading (a) holds in 8 of 8 ; reading (b) in 0 of 8 : blocked: the readings disagree
No description has been provided for this image
state region averages range {'DLS': (np.float64(0.015), np.float64(0.05)), 'DMS': (np.float64(0.019), np.float64(0.085)), 'VS': (np.float64(0.025), np.float64(0.088))}
action region averages range {'DLS': (np.float64(0.01), np.float64(0.387)), 'DMS': (np.float64(0.01), np.float64(0.683)), 'VS': (np.float64(0.01), np.float64(0.139))}
reward region averages range {'DLS': (np.float64(0.008), np.float64(0.355)), 'DMS': (np.float64(0.009), np.float64(0.306)), 'VS': (np.float64(0.01), np.float64(0.353))}

Result: blocked (methods_underspecified). With the per-neuron MI averaged over Phase 1 (reading a), VS exceeds DLS (p 0.0001 or less) and DMS (p 0.017 to 0.036) in all 8 readings of unit set, O3 and O1 (a, b), and the VS average is above its threshold in all 20 Phase 1 bins. Per bin (reading b), VS exceeds both regions significantly in only 9 to 13 of the 20 bins, so reading (b) fails in all 8. The readings disagree. With the Panzeri-Treves variant VS against DMS on the deposited PANs gives p = 0.071 and 0.053.

fig5e-action-info-rises-dls¶

Action information (left or right choice) starts rising during cue presentation (Phase 3) only in DLS.

In [25]:
rows = []
ph3 = np.where(PH100 == 2)[0]
for k, ext, o1 in readings():
    real, reg, avg, thr = mi_reading((k, ext, "action"), o1)
    above = {r: [round(CEN[b], 2) for b in ph3 if avg[r][b] > thr[r][b]] for r in S.REGIONS}
    pre = np.where(PH100 <= 1)[0]
    rows.append({"set": k, "ext": ext, "O1": o1, **{f"{r} Phase 3 bins above": len(above[r]) for r in S.REGIONS},
                 **{f"{r} Phases 1-2 bins above": int((avg[r][pre] > thr[r][pre]).sum()) for r in S.REGIONS},
                 "DLS bin centres": above["DLS"][:6], "DMS bin centres": above["DMS"][:6], "VS bin centres": above["VS"][:6],
                 "holds": len(above["DLS"]) > 0 and not above["DMS"] and not above["VS"]})
r5r = pd.DataFrame(rows)
verdict_o1(r5r)
print(f"Phases 1 and 2 hold {int((PH100 <= 1).sum())} bins; Phase 3 holds {len(ph3)} bins, centres {CEN[ph3[0]]:.2f} to {CEN[ph3[-1]]:.2f} s (E2 = {S.EDGES[2]:.2f}, E3 = {S.EDGES[3]:.2f})")
print(r5r.to_string())
real, reg, avg, thr = mi_reading(("deposited PANs", False, "action"), "a")
print("Deposited PANs, O1 a: region average minus threshold in the Phase 3 bins (bits/s):")
print(pd.DataFrame({r: (avg[r] - thr[r])[ph3].round(4) for r in S.REGIONS}, index=CEN[ph3].round(2)).T.to_string())
rows = []
for k in SETS:
    for o1 in ("a", "b", "c"):
        real, reg, avg, thr = mi_reading((k, False, "action"), o1, wb=True)
        rows.append({"set": k, "O1": o1, **{f"{r} Phase 3 bins above": int((avg[r][ph3] > thr[r][ph3]).sum()) for r in S.REGIONS},
                     **{f"{r} Phases 1-2 bins above": int((avg[r][pre] > thr[r][pre]).sum()) for r in S.REGIONS},
                     "holds": (avg["DLS"][ph3] > thr["DLS"][ph3]).any() and not (avg["DMS"][ph3] > thr["DMS"][ph3]).any() and not (avg["VS"][ph3] > thr["VS"][ph3]).any()})
print("\nVariant: threshold from action labels permuted within blocks (extinction trials excluded)")
print(pd.DataFrame(rows).to_string())
Holds in 0 of 8 readings (O1 a and b): not reproduced; Panzeri-Treves variant (c): holds in 0 of 4
Phases 1 and 2 hold 27 bins; Phase 3 holds 15 bins, centres 2.75 to 4.15 s (E2 = 2.75, E3 = 4.25)
                  set    ext O1  DLS Phase 3 bins above  DMS Phase 3 bins above  VS Phase 3 bins above  DLS Phases 1-2 bins above  DMS Phases 1-2 bins above  VS Phases 1-2 bins above                       DLS bin centres                       DMS bin centres                        VS bin centres  holds
0      deposited PANs  False  a                      15                      15                     15                         15                         12                         5  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  False
1      deposited PANs  False  b                      15                      15                     15                         15                         12                         5  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  False
2      deposited PANs  False  c                      15                      15                     15                         15                         11                         4  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  False
3      deposited PANs   True  a                      15                      15                     15                         17                         11                         5  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  False
4      deposited PANs   True  b                      15                      15                     15                         17                         11                         5  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  False
5      deposited PANs   True  c                      15                      15                     14                         17                         10                         5  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.85, 2.95, 3.05, 3.15, 3.25, 3.35]  False
6   Methods-rule PANs  False  a                      15                      15                     15                         14                         11                         2  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  False
7   Methods-rule PANs  False  b                      15                      15                     15                         14                         11                         2  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  False
8   Methods-rule PANs  False  c                      15                      15                     15                         12                         11                         2  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  False
9   Methods-rule PANs   True  a                      15                      15                     14                         16                         11                         3  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.85, 2.95, 3.05, 3.15, 3.25, 3.35]  False
10  Methods-rule PANs   True  b                      15                      15                     14                         16                         11                         3  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.85, 2.95, 3.05, 3.15, 3.25, 3.35]  False
11  Methods-rule PANs   True  c                      15                      15                     14                         16                         11                         3  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.75, 2.85, 2.95, 3.05, 3.15, 3.25]  [2.85, 2.95, 3.05, 3.15, 3.25, 3.35]  False
Deposited PANs, O1 a: region average minus threshold in the Phase 3 bins (bits/s):
       2.75    2.85    2.95    3.05    3.15    3.25    3.35    3.45    3.55    3.65    3.75    3.85    3.95    4.05    4.15
DLS  0.0026  0.0117  0.0120  0.0075  0.0068  0.0110  0.0184  0.0203  0.0242  0.0271  0.0345  0.0357  0.0494  0.0474  0.0596
DMS  0.0034  0.0055  0.0029  0.0048  0.0051  0.0072  0.0154  0.0116  0.0114  0.0118  0.0133  0.0094  0.0130  0.0113  0.0131
VS   0.0016  0.0084  0.0045  0.0089  0.0085  0.0053  0.0096  0.0089  0.0100  0.0036  0.0061  0.0075  0.0109  0.0097  0.0117

Variant: threshold from action labels permuted within blocks (extinction trials excluded)
                 set O1  DLS Phase 3 bins above  DMS Phase 3 bins above  VS Phase 3 bins above  DLS Phases 1-2 bins above  DMS Phases 1-2 bins above  VS Phases 1-2 bins above  holds
0     deposited PANs  a                      15                      15                     14                          9                          4                         0  False
1     deposited PANs  b                      15                      15                     14                          9                          4                         0  False
2     deposited PANs  c                      15                      15                     14                         10                          3                         0  False
3  Methods-rule PANs  a                      15                      15                     15                          9                          3                         2  False
4  Methods-rule PANs  b                      15                      15                     15                          9                          3                         2  False
5  Methods-rule PANs  c                      15                      15                     15                          8                          3                         2  False

Result: blocked (data_missing). It depends on neuron-counts, which is blocked (data_missing), so by Author step 1.5 it is blocked for the same reason (agreed by the verifier in round 3). As tested, the criterion gives not reproduced: In all 8 readings the DMS average is above its threshold in all 15 Phase 3 bins and the VS average in 14 or 15, so the criterion fails. DLS is above its threshold already in 14 to 17 of the 27 bins of Phases 1 and 2. Above the threshold DLS grows from 0.003 to 0.060 bits/s across Phase 3, while DMS stays between 0.003 and 0.015 and VS between 0.002 and 0.012 (deposited PANs, O1 a), so a rise specific to DLS shows in the size of the information but not in the threshold test. With the threshold from labels permuted within blocks, DMS is still above it in all 15 Phase 3 bins and VS in 14 or 15, while the bins above it before the cue fall to 8 to 10 in DLS, 3 to 4 in DMS and 0 to 2 in VS, so the outcome does not come from ignoring the block structure in the shuffle.

fig5e-action-info-cue-offset-dls¶

In the 100 ms before cue offset, action information is significantly higher in DLS than in DMS and VS.

In [26]:
def window_test(var, col, order_pairs):
    rows = []
    for k, ext, o1 in readings():
        real, reg, avg, thr = mi_reading((k, ext, var), o1)
        x = real[:, col] if np.ndim(col) == 0 else real[:, col].mean(1)
        row = {"set": k, "ext": ext, "O1": o1}
        row.update({f"mean {r}": x[reg == r].mean() for r in S.REGIONS})
        for a, b in order_pairs:
            row[f"p {a}-{b}"] = mwu(x[reg == a], x[reg == b])
        rows.append(row)
    return pd.DataFrame(rows)
r5c = window_test("action", iE3, [("DLS", "DMS"), ("DLS", "VS")])
r5c["holds"] = (r5c["mean DLS"] > r5c["mean DMS"]) & (r5c["mean DLS"] > r5c["mean VS"]) & (r5c["p DLS-DMS"] < .05) & (r5c["p DLS-VS"] < .05)
print(r5c.round(5).to_string())
verdict_o1(r5c)
                  set    ext O1  mean DLS  mean DMS  mean VS  p DLS-DMS  p DLS-VS  holds
0      deposited PANs  False  a   0.07401   0.02388  0.02125    0.20761   0.00099  False
1      deposited PANs  False  b   0.06429   0.01340  0.01114    0.06633   0.00113  False
2      deposited PANs  False  c   0.06590   0.01419  0.01243    0.04695   0.00087   True
3      deposited PANs   True  a   0.07565   0.02300  0.02021    0.18878   0.00044  False
4      deposited PANs   True  b   0.06648   0.01302  0.01067    0.05977   0.00039  False
5      deposited PANs   True  c   0.06791   0.01375  0.01182    0.03933   0.00028   True
6   Methods-rule PANs  False  a   0.07323   0.03032  0.02340    0.31446   0.00055  False
7   Methods-rule PANs  False  b   0.06345   0.01961  0.01305    0.15382   0.00098  False
8   Methods-rule PANs  False  c   0.06483   0.02034  0.01403    0.09843   0.00050  False
9   Methods-rule PANs   True  a   0.07449   0.02945  0.02222    0.24663   0.00039  False
10  Methods-rule PANs   True  b   0.06520   0.01912  0.01261    0.10711   0.00081  False
11  Methods-rule PANs   True  c   0.06647   0.01992  0.01329    0.07159   0.00026  False
Holds in 0 of 8 readings (O1 a and b): not reproduced; Panzeri-Treves variant (c): holds in 2 of 4

Result: blocked (data_missing). It depends on neuron-counts, which is blocked (data_missing), so by Author step 1.5 it is blocked for the same reason (agreed by the verifier in round 3). As tested, the criterion gives not reproduced: In the 100 ms before cue offset DLS exceeds VS in every reading (p 0.0011 or less) but not DMS: under O1 (a) and (b) DLS against DMS gives p 0.060 to 0.31 over the two unit sets, so all 8 readings fail. Only the Panzeri-Treves variant on the deposited PANs gives p below 0.05 (DLS 0.066 against DMS 0.014 bits/s, p = 0.047; 0.039 with extinction trials); on the Methods-rule set it gives p = 0.098 and 0.072.

fig5e-action-info-center-exit¶

In the 100 ms before center-hole exit, action information in DMS is higher than in DLS (not significant) and VS, and is weakest in VS.

In [27]:
r5x = window_test("action", iE4, [("DMS", "DLS"), ("DMS", "VS"), ("DLS", "VS")])
r5x["holds"] = (r5x["mean DMS"] > r5x["mean DLS"]) & (r5x["mean DLS"] > r5x["mean VS"]) & (r5x["p DMS-VS"] < .05) & (r5x["p DLS-VS"] < .05)
print(r5x.round(5).to_string())
verdict_o1(r5x)
                  set    ext O1  mean DLS  mean DMS  mean VS  p DMS-DLS  p DMS-VS  p DLS-VS  holds
0      deposited PANs  False  a   0.12224   0.22680  0.02514    0.17345   0.00000   0.00000   True
1      deposited PANs  False  b   0.11279   0.21599  0.01520    0.27250   0.00000   0.00000   True
2      deposited PANs  False  c   0.11394   0.21726  0.01648    0.30042   0.00000   0.00000   True
3      deposited PANs   True  a   0.12212   0.22984  0.02424    0.13042   0.00000   0.00000   True
4      deposited PANs   True  b   0.11308   0.21934  0.01520    0.17694   0.00000   0.00000   True
5      deposited PANs   True  c   0.11414   0.22073  0.01598    0.19669   0.00000   0.00000   True
6   Methods-rule PANs  False  a   0.11994   0.17031  0.03249    0.69049   0.00023   0.00082   True
7   Methods-rule PANs  False  b   0.11022   0.15924  0.02231    0.99074   0.00045   0.00016   True
8   Methods-rule PANs  False  c   0.11123   0.16044  0.02335    0.93985   0.00043   0.00009   True
9   Methods-rule PANs   True  a   0.11913   0.17205  0.03119    0.58333   0.00010   0.00077   True
10  Methods-rule PANs   True  b   0.10986   0.16141  0.02191    0.67685   0.00016   0.00052   True
11  Methods-rule PANs   True  c   0.11076   0.16263  0.02247    0.80425   0.00013   0.00012   True
Holds in 8 of 8 readings (O1 a and b): reproduced; Panzeri-Treves variant (c): holds in 4 of 4

Result: blocked (data_missing). It depends on neuron-counts, which is blocked (data_missing), so by Author step 1.5 it is blocked for the same reason (agreed by the verifier in round 3). As tested, the criterion gives reproduced: All 8 readings hold. In the 100 ms before centre-hole exit action MI is 0.216 to 0.230 bits/s in DMS, 0.113 to 0.122 in DLS and 0.015 to 0.025 in VS on the deposited PANs (0.159 to 0.172, 0.110 to 0.120 and 0.022 to 0.032 on the Methods-rule set). DMS against VS gives p 0.0005 or less and DLS against VS p 0.0008 or less; DMS against DLS gives p 0.13 to 0.99 (paper 0.16).

fig5d-action-info-phase5-dms¶

During action execution (Phase 5), action information is highest in DMS.

Readings: (a) the mean over the Phase 5 bins; (b) the bin of the DMS region peak in Phase 5.

In [28]:
ph5 = np.where(PH100 == 4)[0]
ra = window_test("action", ph5, [("DMS", "DLS"), ("DMS", "VS"), ("DLS", "VS")]); ra["reading"] = "(a) Phase 5 mean"
rows = []
for k, ext, o1 in readings():
    real, reg, avg, thr = mi_reading((k, ext, "action"), o1)
    b = ph5[np.argmax(avg["DMS"][ph5])]
    x = real[:, b]
    row = {"set": k, "ext": ext, "O1": o1, "reading": f"(b) DMS peak bin {CEN[b]:.2f} s"}
    row.update({f"mean {r}": x[reg == r].mean() for r in S.REGIONS})
    for a, c in [("DMS", "DLS"), ("DMS", "VS"), ("DLS", "VS")]:
        row[f"p {a}-{c}"] = mwu(x[reg == a], x[reg == c])
    rows.append(row)
r5d = pd.concat([ra, pd.DataFrame(rows)], ignore_index=True)
r5d["holds"] = (r5d["mean DMS"] > r5d["mean DLS"]) & (r5d["mean DMS"] > r5d["mean VS"]) & (r5d["p DMS-DLS"] < .05) & (r5d["p DMS-VS"] < .05)
print(r5d.round(5).to_string())
verdict_o1(r5d)
                  set    ext O1  mean DLS  mean DMS  mean VS  p DMS-DLS  p DMS-VS  p DLS-VS                  reading  holds
0      deposited PANs  False  a   0.32531   0.53242  0.11476    0.00002       0.0   0.00000         (a) Phase 5 mean   True
1      deposited PANs  False  b   0.31525   0.52178  0.10360    0.00002       0.0   0.00000         (a) Phase 5 mean   True
2      deposited PANs  False  c   0.31665   0.52300  0.10450    0.00002       0.0   0.00000         (a) Phase 5 mean   True
3      deposited PANs   True  a   0.32417   0.53048  0.11441    0.00002       0.0   0.00000         (a) Phase 5 mean   True
4      deposited PANs   True  b   0.31456   0.52031  0.10377    0.00002       0.0   0.00000         (a) Phase 5 mean   True
5      deposited PANs   True  c   0.31592   0.52142  0.10463    0.00002       0.0   0.00000         (a) Phase 5 mean   True
6   Methods-rule PANs  False  a   0.31160   0.47536  0.12055    0.00029       0.0   0.00000         (a) Phase 5 mean   True
7   Methods-rule PANs  False  b   0.30139   0.46436  0.10925    0.00028       0.0   0.00000         (a) Phase 5 mean   True
8   Methods-rule PANs  False  c   0.30262   0.46533  0.10993    0.00033       0.0   0.00000         (a) Phase 5 mean   True
9   Methods-rule PANs   True  a   0.31002   0.47438  0.12004    0.00020       0.0   0.00000         (a) Phase 5 mean   True
10  Methods-rule PANs   True  b   0.30035   0.46391  0.10924    0.00020       0.0   0.00000         (a) Phase 5 mean   True
11  Methods-rule PANs   True  c   0.30146   0.46476  0.10991    0.00022       0.0   0.00000         (a) Phase 5 mean   True
12     deposited PANs  False  a   0.27752   0.68335  0.10354    0.00001       0.0   0.00030  (b) DMS peak bin 4.95 s   True
13     deposited PANs  False  b   0.26801   0.67199  0.09225    0.00002       0.0   0.00007  (b) DMS peak bin 4.95 s   True
14     deposited PANs  False  c   0.26915   0.67368  0.09324    0.00002       0.0   0.00004  (b) DMS peak bin 4.95 s   True
15     deposited PANs   True  a   0.27387   0.68240  0.10190    0.00001       0.0   0.00026  (b) DMS peak bin 4.95 s   True
16     deposited PANs   True  b   0.26483   0.67156  0.09153    0.00002       0.0   0.00007  (b) DMS peak bin 4.95 s   True
17     deposited PANs   True  c   0.26581   0.67311  0.09216    0.00001       0.0   0.00004  (b) DMS peak bin 4.95 s   True
18  Methods-rule PANs  False  a   0.27917   0.56909  0.12142    0.00006       0.0   0.00191  (b) DMS peak bin 4.95 s   True
19  Methods-rule PANs  False  b   0.26944   0.55769  0.11011    0.00012       0.0   0.00037  (b) DMS peak bin 4.95 s   True
20  Methods-rule PANs  False  c   0.27044   0.55891  0.11090    0.00010       0.0   0.00038  (b) DMS peak bin 4.95 s   True
21  Methods-rule PANs   True  a   0.27523   0.56849  0.11941    0.00004       0.0   0.00235  (b) DMS peak bin 4.95 s   True
22  Methods-rule PANs   True  b   0.26593   0.55751  0.10880    0.00005       0.0   0.00076  (b) DMS peak bin 4.95 s   True
23  Methods-rule PANs   True  c   0.26683   0.55872  0.10947    0.00005       0.0   0.00072  (b) DMS peak bin 4.95 s   True
Holds in 16 of 16 readings (O1 a and b): reproduced; Panzeri-Treves variant (c): holds in 8 of 8

Result: blocked (data_missing). It depends on neuron-counts, which is blocked (data_missing), so by Author step 1.5 it is blocked for the same reason (agreed by the verifier in round 3). As tested, the criterion gives reproduced: All 16 readings hold. Over Phase 5 action MI averages 0.46 to 0.53 bits/s in DMS, 0.30 to 0.33 in DLS and 0.10 to 0.12 in VS; at the DMS peak bin (4.95 s) 0.56 to 0.68, 0.26 to 0.28 and 0.09 to 0.12. DMS against DLS gives p 0.0003 or less, DMS against VS p < 1e-5 and DLS against VS p 0.0024 or less.

fig5g-reward-info¶

Reward information rises in all regions after L/R-hole entry and is strongest in VS, then DMS, with DLS significantly below both.

Readings: per-neuron mean over the bins of (a) Phase 6, (b) Phases 6 and 7, (c) the bin of the VS region peak. Part (1), as the criterion words it: the first bin of the whole trial where each region average passes its threshold lies in Phase 6. The first crossing at or after E5 is shown too.

In [29]:
rows = []
for k, ext, o1 in readings():
    real, reg, avg, thr = mi_reading((k, ext, "reward"), o1)
    first_after, first_any = {}, {}
    for r in S.REGIONS:
        ab = avg[r][:len(G100)] > thr[r][:len(G100)]
        idx = np.where(ab & (PH100 >= 5))[0]; first_after[r] = PH100[idx[0]] + 1 if len(idx) else None
        idx = np.where(ab)[0]; first_any[r] = PH100[idx[0]] + 1 if len(idx) else None
    c1 = all(first_any[r] == 6 for r in S.REGIONS)  # the first crossing over the whole trial falls in Phase 6
    bpk = np.argmax(avg["VS"][:len(G100)])
    for rd, cols in [("(a) Phase 6", np.where(PH100 == 5)[0]), ("(b) Phases 6-7", np.where(PH100 >= 5)[0]), (f"(c) VS peak {CEN[bpk]:.2f} s", [bpk])]:
        x = real[:, cols].mean(1)
        m = {r: x[reg == r].mean() for r in S.REGIONS}
        p = {f"p {a}-{b}": mwu(x[reg == a], x[reg == b]) for a, b in [("DLS", "DMS"), ("DLS", "VS"), ("DMS", "VS")]}
        c2 = m["VS"] > m["DMS"] > m["DLS"] and p["p DLS-DMS"] < .05 and p["p DLS-VS"] < .05
        rows.append({"set": k, "ext": ext, "O1": o1, "reading": rd, **{f"mean {r}": m[r] for r in S.REGIONS}, **p,
                     "first phase after E5": [first_after[r] for r in S.REGIONS], "first phase overall": [first_any[r] for r in S.REGIONS],
                     "(1)": c1, "(2)": c2, "holds": c1 and c2})
r5g = pd.DataFrame(rows)
print(r5g.round(5).to_string())
print("Part (1) holds in", int(r5g[r5g.O1 != "c"]["(1)"].sum()), "of", int((r5g.O1 != "c").sum()), "rows (O1 a and b); part (2) in",
      int(r5g[r5g.O1 != "c"]["(2)"].sum()))
verdict_o1(r5g)
rows = []
for k in SETS:
    for o1 in ("a", "b", "c"):
        real, reg, avg, thr = mi_reading((k, False, "reward"), o1, wb=True)
        row = {"set": k, "O1": o1}
        for r in S.REGIONS:
            ab = avg[r][:len(G100)] > thr[r][:len(G100)]
            idx = np.where(ab)[0]
            row[f"{r} first crossing"] = f"{CEN[idx[0]]:.2f} s (Phase {PH100[idx[0]] + 1})" if len(idx) else "none"
            row[f"{r} bins above in Phases 1-5"] = int(ab[PH100 <= 4].sum())
        rows.append(row)
print("\nVariant: threshold from reward labels permuted within blocks (extinction trials excluded)")
print(pd.DataFrame(rows).to_string())
                  set    ext O1             reading  mean DLS  mean DMS  mean VS  p DLS-DMS  p DLS-VS  p DMS-VS first phase after E5 first phase overall    (1)    (2)  holds
0      deposited PANs  False  a         (a) Phase 6   0.05373   0.08527  0.08338    0.39308   0.00105   0.04440            [6, 6, 6]           [1, 2, 1]  False  False  False
1      deposited PANs  False  a      (b) Phases 6-7   0.18690   0.21951  0.26223    0.01403   0.12546   0.43435            [6, 6, 6]           [1, 2, 1]  False  False  False
2      deposited PANs  False  a  (c) VS peak 7.05 s   0.22449   0.27636  0.35268    0.04913   0.00016   0.15658            [6, 6, 6]           [1, 2, 1]  False   True  False
3      deposited PANs  False  b         (a) Phase 6   0.04414   0.07528  0.07280    0.35706   0.00197   0.06608            [6, 6, 6]           [1, 2, 1]  False  False  False
4      deposited PANs  False  b      (b) Phases 6-7   0.17649   0.20903  0.25085    0.01423   0.14070   0.41901            [6, 6, 6]           [1, 2, 1]  False  False  False
5      deposited PANs  False  b  (c) VS peak 7.05 s   0.21508   0.26678  0.34216    0.04913   0.00018   0.17426            [6, 6, 6]           [1, 2, 1]  False   True  False
6      deposited PANs  False  c         (a) Phase 6   0.04573   0.07653  0.07456    0.40532   0.00127   0.03878            [6, 6, 6]           [1, 2, 1]  False  False  False
7      deposited PANs  False  c      (b) Phases 6-7   0.17772   0.21029  0.25286    0.01378   0.12246   0.43126            [6, 6, 6]           [1, 2, 1]  False  False  False
8      deposited PANs  False  c  (c) VS peak 7.05 s   0.21609   0.26760  0.34404    0.04958   0.00019   0.16658            [6, 6, 6]           [1, 2, 1]  False   True  False
9      deposited PANs   True  a         (a) Phase 6   0.05316   0.08524  0.08284    0.42671   0.00197   0.05260            [6, 6, 6]           [1, 1, 1]  False  False  False
10     deposited PANs   True  a      (b) Phases 6-7   0.18607   0.21865  0.25971    0.01263   0.14161   0.39220            [6, 6, 6]           [1, 1, 1]  False  False  False
11     deposited PANs   True  a  (c) VS peak 7.05 s   0.22297   0.27250  0.34942    0.03618   0.00011   0.17259            [6, 6, 6]           [1, 1, 1]  False   True  False
12     deposited PANs   True  b         (a) Phase 6   0.04409   0.07561  0.07283    0.45339   0.00381   0.06686            [6, 6, 6]           [1, 1, 1]  False  False  False
13     deposited PANs   True  b      (b) Phases 6-7   0.17615   0.20862  0.24884    0.01282   0.15603   0.37777            [6, 6, 6]           [1, 1, 1]  False  False  False
14     deposited PANs   True  b  (c) VS peak 7.05 s   0.21387   0.26333  0.33933    0.03154   0.00012   0.18803            [6, 6, 6]           [1, 1, 1]  False   True  False
15     deposited PANs   True  c         (a) Phase 6   0.04548   0.07688  0.07443    0.47459   0.00230   0.04591            [6, 6, 6]           [1, 1, 1]  False  False  False
16     deposited PANs   True  c      (b) Phases 6-7   0.17729   0.20983  0.25074    0.01223   0.13334   0.39513            [6, 6, 6]           [1, 1, 1]  False  False  False
17     deposited PANs   True  c  (c) VS peak 7.05 s   0.21487   0.26414  0.34112    0.03734   0.00013   0.16551            [6, 6, 6]           [1, 1, 1]  False   True  False
18  Methods-rule PANs  False  a         (a) Phase 6   0.05622   0.08640  0.08437    0.21439   0.00006   0.00687            [6, 6, 6]           [1, 1, 1]  False  False  False
19  Methods-rule PANs  False  a      (b) Phases 6-7   0.17746   0.21274  0.23078    0.04752   0.41380   0.38938            [6, 6, 6]           [1, 1, 1]  False  False  False
20  Methods-rule PANs  False  a  (c) VS peak 7.05 s   0.22329   0.25607  0.31993    0.08081   0.00218   0.17972            [6, 6, 6]           [1, 1, 1]  False  False  False
21  Methods-rule PANs  False  b         (a) Phase 6   0.04647   0.07625  0.07366    0.21226   0.00011   0.01055            [6, 6, 6]           [1, 1, 1]  False  False  False
22  Methods-rule PANs  False  b      (b) Phases 6-7   0.16697   0.20196  0.21948    0.04726   0.44529   0.37540            [6, 6, 6]           [1, 1, 1]  False  False  False
23  Methods-rule PANs  False  b  (c) VS peak 7.05 s   0.21379   0.24622  0.30969    0.08183   0.00254   0.19362            [6, 6, 6]           [1, 1, 1]  False  False  False
24  Methods-rule PANs  False  c         (a) Phase 6   0.04786   0.07738  0.07477    0.21439   0.00016   0.00952            [6, 6, 6]           [1, 1, 1]  False  False  False
25  Methods-rule PANs  False  c      (b) Phases 6-7   0.16803   0.20301  0.22094    0.04804   0.43095   0.38761            [6, 6, 6]           [1, 1, 1]  False  False  False
26  Methods-rule PANs  False  c  (c) VS peak 7.05 s   0.21460   0.24682  0.31097    0.07032   0.00238   0.18711            [6, 6, 6]           [1, 1, 1]  False  False  False
27  Methods-rule PANs   True  a         (a) Phase 6   0.05544   0.08640  0.08440    0.28108   0.00011   0.00905            [6, 6, 6]           [1, 1, 1]  False  False  False
28  Methods-rule PANs   True  a      (b) Phases 6-7   0.17651   0.21182  0.22879    0.04081   0.44771   0.34512            [6, 6, 6]           [1, 1, 1]  False  False  False
29  Methods-rule PANs   True  a  (c) VS peak 7.05 s   0.22157   0.25388  0.31843    0.05603   0.00215   0.22806            [6, 6, 6]           [1, 1, 1]  False  False  False
30  Methods-rule PANs   True  b         (a) Phase 6   0.04626   0.07674  0.07412    0.29477   0.00029   0.01249            [6, 6, 6]           [1, 1, 1]  False  False  False
31  Methods-rule PANs   True  b      (b) Phases 6-7   0.16658   0.20154  0.21795    0.04161   0.48146   0.33538            [6, 6, 6]           [1, 1, 1]  False  False  False
32  Methods-rule PANs   True  b  (c) VS peak 7.05 s   0.21237   0.24432  0.30852    0.05354   0.00237   0.24650            [6, 6, 6]           [1, 1, 1]  False  False  False
33  Methods-rule PANs   True  c         (a) Phase 6   0.04742   0.07777  0.07521    0.28525   0.00035   0.01461            [6, 6, 6]           [1, 1, 1]  False  False  False
34  Methods-rule PANs   True  c      (b) Phases 6-7   0.16750   0.20251  0.21935    0.04161   0.45419   0.34758            [6, 6, 6]           [1, 1, 1]  False  False  False
35  Methods-rule PANs   True  c  (c) VS peak 7.05 s   0.21323   0.24505  0.30981    0.05397   0.00229   0.22744            [6, 6, 6]           [1, 1, 1]  False  False  False
Part (1) holds in 0 of 24 rows (O1 a and b); part (2) in 4
Holds in 0 of 24 readings (O1 a and b): not reproduced; Panzeri-Treves variant (c): holds in 0 of 12

Variant: threshold from reward labels permuted within blocks (extinction trials excluded)
                 set O1 DLS first crossing  DLS bins above in Phases 1-5 DMS first crossing  DMS bins above in Phases 1-5 VS first crossing  VS bins above in Phases 1-5
0     deposited PANs  a   5.55 s (Phase 6)                             0   3.35 s (Phase 3)                             3  2.25 s (Phase 2)                            3
1     deposited PANs  b   5.55 s (Phase 6)                             0   3.35 s (Phase 3)                             3  2.25 s (Phase 2)                            3
2     deposited PANs  c   5.55 s (Phase 6)                             0   3.35 s (Phase 3)                             1  2.25 s (Phase 2)                            3
3  Methods-rule PANs  a   0.55 s (Phase 1)                             2   2.45 s (Phase 2)                             4  4.65 s (Phase 4)                            2
4  Methods-rule PANs  b   0.55 s (Phase 1)                             2   2.45 s (Phase 2)                             4  4.65 s (Phase 4)                            2
5  Methods-rule PANs  c   0.55 s (Phase 1)                             4   2.45 s (Phase 2)                             4  4.65 s (Phase 4)                            2

Result: blocked (data_missing). It depends on neuron-counts, which is blocked (data_missing), so by Author step 1.5 it is blocked for the same reason (agreed by the verifier in round 3). As tested, the criterion gives not reproduced: Part (1) fails in every reading: each region's average first passes its threshold in Phase 1 or 2 (first phases for DLS, DMS and VS of 1, 2, 1 or 1, 1, 1), not in Phase 6. The first crossing at or after E5 does fall in Phase 6 for every region and reading. With the threshold from labels permuted within blocks the first crossing on the deposited PANs is in Phase 6 for DLS but in Phase 3 for DMS and Phase 2 for VS, and on the Methods-rule set in Phases 1, 2 and 4, so part (1) fails under that threshold too. Part (2) holds only at the VS peak bin (7.05 s) on the deposited PANs, 4 of the 24 rows (VS 0.34 to 0.35 > DMS 0.26 to 0.28 > DLS 0.21 to 0.22 bits/s; DLS against DMS p 0.032 to 0.049, against VS p < 0.001). Over Phase 6 DMS (0.075 to 0.086) is above VS (0.073 to 0.084) and DLS against DMS gives p 0.21 to 0.45; over Phases 6 and 7 DLS against VS gives p 0.125 to 0.48; on the Methods-rule set DLS against DMS at the VS peak gives p 0.054 to 0.082.

Fig. 6 claims (fig6-event-coding-proportions, fig6-above-chance, fig6bc-similar-fixed-free)¶

A PAN codes an event when its spike counts in the event's window differ between the two conditions by a two-sided Mann-Whitney U test with p < 0.01 (Fig. 6 legend). Windows (Fig. 6 legend): AC the 500 ms before E4, action the 500 ms after E4, Reward1 the 500 ms before E6, Reward2 the 500 ms after E6; state (fixed against free blocks, all trials only) (a) all of Phase 3, (b) the 500 ms before E3. The legend does not say whether the windows are on the EASH axis or in real time around the events; both are run. Trial sets: fixed-choice trials (Fig. 6B), free-choice trials (6C), all trials (6D; O3 without or with extinction trials).

In [30]:
EV_WIN = {"AC": (4, -.5, 0), "action": (4, 0, .5), "Reward1": (6, -.5, 0), "Reward2": (6, 0, .5),
          "state (a)": None, "state (b)": (3, -.5, 0)}
def event_counts(n, ev, axis):
    if ev == "state (a)":
        return S.wcounts(n, [[S.EDGES[2], S.EDGES[3]]])[:, 0]
    e, a, b = EV_WIN[ev]
    if axis == "EASH":
        return S.wcounts(n, [[S.EDGES[e] + a, S.EDGES[e] + b]])[:, 0]
    return S.rcounts(n, e, [[a, b]])[:, 0]

def coding_table(nset, axis):
    rows = []
    for n in nset:
        tr = n["tr"]
        sets = {"fixed": tr.btype.isin(["SF", "DF"]).to_numpy(), "free": (tr.btype == "FREE").to_numpy(),
                "all": (tr.btype != "EXT").to_numpy(), "all+ext": np.ones(len(tr), bool)}
        for ev in EV_WIN:
            c = event_counts(n, ev, axis)
            for sname, m in sets.items():
                if ev.startswith("state"):
                    if not sname.startswith("all"):
                        continue
                    y = (tr.cue != "choice").to_numpy()
                elif ev in ("AC", "action"):
                    y = (tr.action == 1).to_numpy()
                else:
                    y = (tr.reward == 1).to_numpy()
                x1, x0 = c[m & y], c[m & ~y]
                p = stats.mannwhitneyu(x1, x0).pvalue if len(x1) and len(x0) and np.ptp(np.r_[x1, x0]) > 0 else 1.0
                rows.append({"region": n["region"], "subject": n["subject"], "event": ev, "trials": sname, "p": p})
    return pd.DataFrame(rows)
CODING = {(k, ax): coding_table(v, ax) for k, v in SETS.items() for ax in ("EASH", "real")}

def props(k, ax):
    ct = CODING[(k, ax)]
    ct = ct.assign(coding=ct.p < .01)
    return ct.groupby(["trials", "event", "region"]).coding.agg(["sum", "size", "mean"]).reset_index()
In [31]:
rows = []
for k in SETS:
    for ax in ("EASH", "real"):
        P = props(k, ax)
        for ts in ("all", "all+ext"):
            Pa = P[P.trials == ts].pivot(index="event", columns="region", values="mean")
            Ps = P[P.trials == ts].pivot(index="event", columns="region", values="sum")
            Pn = P[P.trials == ts].pivot(index="event", columns="region", values="size")
            for st in ("state (a)", "state (b)"):
                want = {st: "VS", "Reward1": "VS", "AC": "DLS", "action": "DMS"}
                got = {e: Pa.loc[e].idxmax() for e in want}
                row = {"set": k, "axis": ax, "trials": ts, "state window": st}
                row.update({f"{e} largest": got[e] for e in want if e != st}); row["state largest"] = got[st]
                row["holds"] = all(got[e] == want[e] for e in want)
                rows.append(row)
            if k == "deposited PANs" and ts == "all":
                print(f"Deposited PANs, {ax} axis, all trials without extinction: proportion coding (count/n)")
                print((Pa.round(3).astype(str) + " (" + Ps.astype(int).astype(str) + "/" + Pn.astype(int).astype(str) + ")").to_string())
                for e in Pa.index:
                    ps = {f"{a}-{b}": stats.chi2_contingency([[Ps.loc[e, a], Pn.loc[e, a] - Ps.loc[e, a]], [Ps.loc[e, b], Pn.loc[e, b] - Ps.loc[e, b]]], correction=False)[1]
                          for a, b in [("DLS", "DMS"), ("DLS", "VS"), ("DMS", "VS")]}
                    print(f"   chi2 (no Yates) {e}: " + ", ".join(f"{q} p={v:.4f}" for q, v in ps.items()))
r6 = pd.DataFrame(rows)
print(r6.to_string())
print(r6.groupby("set").holds.agg(["sum", "size"]).to_string())
print("Holds in", int(r6.holds.sum()), "of", len(r6), "readings:", rule_outcome(r6.holds))
P = props("deposited PANs", "EASH")
ct = CODING[("deposited PANs", "EASH")]
print("\nBy rat (deposited PANs, EASH axis, all trials), proportion coding per event:")
print(ct[ct.trials == "all"].assign(c=lambda d: d.p < .01).groupby(["event", "subject"]).c.mean().unstack().round(2).to_string())
Deposited PANs, EASH axis, all trials without extinction: proportion coding (count/n)
region                 DLS             DMS              VS
event                                                     
AC          0.422 (86/204)  0.411 (46/112)  0.196 (27/138)
Reward1     0.319 (65/204)  0.321 (36/112)  0.435 (60/138)
Reward2    0.525 (107/204)  0.705 (79/112)  0.696 (96/138)
action     0.588 (120/204)  0.839 (94/112)  0.384 (53/138)
state (a)   0.426 (87/204)  0.509 (57/112)  0.493 (68/138)
state (b)   0.289 (59/204)  0.348 (39/112)  0.362 (50/138)
   chi2 (no Yates) AC: DLS-DMS p=0.8515, DLS-VS p=0.0000, DMS-VS p=0.0002
   chi2 (no Yates) Reward1: DLS-DMS p=0.9593, DLS-VS p=0.0286, DMS-VS p=0.0669
   chi2 (no Yates) Reward2: DLS-DMS p=0.0018, DLS-VS p=0.0016, DMS-VS p=0.8677
   chi2 (no Yates) action: DLS-DMS p=0.0000, DLS-VS p=0.0002, DMS-VS p=0.0000
   chi2 (no Yates) state (a): DLS-DMS p=0.1592, DLS-VS p=0.2270, DMS-VS p=0.7992
   chi2 (no Yates) state (b): DLS-DMS p=0.2781, DLS-VS p=0.1546, DMS-VS p=0.8168
Deposited PANs, real axis, all trials without extinction: proportion coding (count/n)
region                 DLS             DMS              VS
event                                                     
AC          0.466 (95/204)  0.375 (42/112)  0.196 (27/138)
Reward1     0.368 (75/204)  0.455 (51/112)  0.543 (75/138)
Reward2    0.525 (107/204)  0.705 (79/112)  0.696 (96/138)
action     0.627 (128/204)  0.848 (95/112)  0.362 (50/138)
state (a)   0.426 (87/204)  0.509 (57/112)  0.493 (68/138)
state (b)    0.27 (55/204)   0.33 (37/112)  0.413 (57/138)
   chi2 (no Yates) AC: DLS-DMS p=0.1197, DLS-VS p=0.0000, DMS-VS p=0.0016
   chi2 (no Yates) Reward1: DLS-DMS p=0.1277, DLS-VS p=0.0013, DMS-VS p=0.1658
   chi2 (no Yates) Reward2: DLS-DMS p=0.0018, DLS-VS p=0.0016, DMS-VS p=0.8677
   chi2 (no Yates) action: DLS-DMS p=0.0000, DLS-VS p=0.0000, DMS-VS p=0.0000
   chi2 (no Yates) state (a): DLS-DMS p=0.1592, DLS-VS p=0.2270, DMS-VS p=0.7992
   chi2 (no Yates) state (b): DLS-DMS p=0.2555, DLS-VS p=0.0056, DMS-VS p=0.1795
                  set  axis   trials state window Reward1 largest AC largest action largest state largest  holds
0      deposited PANs  EASH      all    state (a)              VS        DLS            DMS           DMS  False
1      deposited PANs  EASH      all    state (b)              VS        DLS            DMS            VS   True
2      deposited PANs  EASH  all+ext    state (a)              VS        DMS            DMS           DMS  False
3      deposited PANs  EASH  all+ext    state (b)              VS        DMS            DMS            VS  False
4      deposited PANs  real      all    state (a)              VS        DLS            DMS           DMS  False
5      deposited PANs  real      all    state (b)              VS        DLS            DMS            VS   True
6      deposited PANs  real  all+ext    state (a)              VS        DLS            DMS           DMS  False
7      deposited PANs  real  all+ext    state (b)              VS        DLS            DMS            VS   True
8   Methods-rule PANs  EASH      all    state (a)              VS        DLS            DMS            VS   True
9   Methods-rule PANs  EASH      all    state (b)              VS        DLS            DMS            VS   True
10  Methods-rule PANs  EASH  all+ext    state (a)              VS        DLS            DMS            VS   True
11  Methods-rule PANs  EASH  all+ext    state (b)              VS        DLS            DMS            VS   True
12  Methods-rule PANs  real      all    state (a)              VS        DLS            DMS            VS   True
13  Methods-rule PANs  real      all    state (b)              VS        DLS            DMS            VS   True
14  Methods-rule PANs  real  all+ext    state (a)              VS        DLS            DMS            VS   True
15  Methods-rule PANs  real  all+ext    state (b)              VS        DLS            DMS            VS   True
                   sum  size
set                         
Methods-rule PANs    8     8
deposited PANs       3     8
Holds in 11 of 16 readings: blocked: the readings disagree

By rat (deposited PANs, EASH axis, all trials), proportion coding per event:
subject     091   092   101   108   114   115   116
event                                              
AC         0.49  0.30  0.42  0.21  0.52  0.16  0.44
Reward1    0.56  0.19  0.42  0.35  0.30  0.32  0.43
Reward2    0.73  0.51  0.55  0.58  0.41  0.62  0.80
action     0.64  0.66  0.70  0.42  0.57  0.38  0.73
state (a)  0.44  0.42  0.48  0.51  0.43  0.46  0.52
state (b)  0.27  0.31  0.33  0.35  0.33  0.38  0.30

Result: blocked (methods_underspecified). The claim holds in 11 of 16 readings: all 8 on the Methods-rule set and 3 of 8 on the deposited PANs. On the deposited PANs VS has the largest Reward1 proportion and DMS the largest action proportion in every reading, but with the state window over all of Phase 3 (reading a) DMS has the largest state proportion (0.509 against VS 0.493 and DLS 0.426), and on the EASH axis with extinction trials included DMS has the largest AC proportion. With the 500 ms before E3 (reading b) VS has the largest state proportion (0.362 against 0.348 and 0.289 on the EASH axis). No state pair differs significantly on the EASH axis (chi-square p 0.15 to 0.82).

In [32]:
rows = []
for k in SETS:
    for ax in ("EASH", "real"):
        P = props(k, ax)
        P["binom p"] = [stats.binomtest(int(s), int(n), .01, alternative="greater").pvalue for s, n in zip(P["sum"], P["size"])]
        P["set"] = k; P["axis"] = ax
        rows.append(P)
r6c = pd.concat(rows, ignore_index=True)
r6c["sig"] = r6c["binom p"] < .01
print(r6c.groupby(["set", "axis", "trials"]).sig.agg(["sum", "size"]))
print("Tests not significant:")
print(r6c[~r6c.sig].to_string())
print("Smallest proportion:", r6c.loc[r6c["mean"].idxmin(), ["set", "axis", "trials", "event", "region", "sum", "size", "mean", "binom p"]].to_dict())
print("All tests p < 0.01:", bool(r6c.sig.all()), "; deposited PANs:", bool(r6c[r6c.set == "deposited PANs"].sig.all()))
                                sum  size
set               axis trials            
Methods-rule PANs EASH all       18    18
                       all+ext   18    18
                       fixed     12    12
                       free      12    12
                  real all       18    18
                       all+ext   18    18
                       fixed     12    12
                       free      12    12
deposited PANs    EASH all       18    18
                       all+ext   18    18
                       fixed     12    12
                       free      12    12
                  real all       18    18
                       all+ext   18    18
                       fixed     12    12
                       free      12    12
Tests not significant:
Empty DataFrame
Columns: [trials, event, region, sum, size, mean, binom p, set, axis, sig]
Index: []
Smallest proportion: {'set': 'deposited PANs', 'axis': 'real', 'trials': 'free', 'event': 'AC', 'region': 'VS', 'sum': 13, 'size': 138, 'mean': 0.09420289855072464, 'binom p': 1.845230070798638e-09}
All tests p < 0.01: True ; deposited PANs: True

Result: blocked (data_missing). It depends on fig6-event-coding-proportions, which is blocked (methods_underspecified), and through the unit sets on neuron-counts, which is blocked (data_missing), so by Author step 1.5 it is blocked; both reasons apply, and data_missing is recorded (agreed by the verifier in round 3, which noted that methods_underspecified, the reason of the direct parent, applies too). As tested, the criterion gives reproduced: Every proportion of event-coding neurons, in every region, event and trial set, both unit sets and both window axes, is above 0.01 by a one-sided binomial test at p < 0.01 (the smallest proportion is 0.094, 13 of 138 VS PANs for AC in free-choice trials with real-time windows, binomial p = 1.8e-9).

In [33]:
rows = []
for k in SETS:
    for ax in ("EASH", "real"):
        P = props(k, ax)
        for ev in ["AC", "action", "Reward1", "Reward2"]:
            f = P[(P.trials == "fixed") & (P.event == ev)].set_index("region")
            g = P[(P.trials == "free") & (P.event == ev)].set_index("region")
            row = {"set": k, "axis": ax, "event": ev, "largest fixed": f["mean"].idxmax(), "largest free": g["mean"].idxmax()}
            for r in S.REGIONS:
                pr = stats.chi2_contingency([[f.loc[r, "sum"], f.loc[r, "size"] - f.loc[r, "sum"]], [g.loc[r, "sum"], g.loc[r, "size"] - g.loc[r, "sum"]]], correction=False)[1]
                row[r] = f"{f.loc[r, 'mean']:.2f}/{g.loc[r, 'mean']:.2f} p={pr:.3f}"
            row["same"] = row["largest fixed"] == row["largest free"]
            rows.append(row)
r6b = pd.DataFrame(rows)
print("Region columns: proportion fixed/free and chi-square p of the difference")
print(r6b.to_string())
h6b = r6b.groupby(["set", "axis"]).same.all().rename("same largest region for all four events")
print(h6b.to_string())
print("Holds in", int(h6b.sum()), "of", len(h6b), "readings:", rule_outcome(h6b))
Region columns: proportion fixed/free and chi-square p of the difference
                  set  axis    event largest fixed largest free                DLS                DMS                 VS   same
0      deposited PANs  EASH       AC           DMS          DLS  0.36/0.31 p=0.249  0.38/0.24 p=0.021  0.17/0.13 p=0.315  False
1      deposited PANs  EASH   action           DMS          DMS  0.56/0.52 p=0.427  0.79/0.69 p=0.095  0.30/0.30 p=1.000   True
2      deposited PANs  EASH  Reward1            VS           VS  0.22/0.25 p=0.412  0.22/0.28 p=0.355  0.30/0.38 p=0.163   True
3      deposited PANs  EASH  Reward2            VS           VS  0.47/0.39 p=0.109  0.60/0.61 p=0.891  0.62/0.62 p=0.901   True
4      deposited PANs  real       AC           DMS          DLS  0.37/0.32 p=0.252  0.38/0.28 p=0.117  0.15/0.09 p=0.143  False
5      deposited PANs  real   action           DMS          DMS  0.60/0.50 p=0.037  0.78/0.68 p=0.099  0.27/0.25 p=0.784   True
6      deposited PANs  real  Reward1            VS           VS  0.25/0.27 p=0.652  0.31/0.38 p=0.262  0.40/0.41 p=0.902   True
7      deposited PANs  real  Reward2            VS           VS  0.47/0.39 p=0.109  0.60/0.61 p=0.891  0.62/0.62 p=0.901   True
8   Methods-rule PANs  EASH       AC           DLS          DLS  0.38/0.32 p=0.273  0.34/0.23 p=0.039  0.22/0.16 p=0.247   True
9   Methods-rule PANs  EASH   action           DMS          DMS  0.54/0.50 p=0.464  0.73/0.68 p=0.305  0.31/0.30 p=0.888   True
10  Methods-rule PANs  EASH  Reward1            VS           VS  0.23/0.26 p=0.627  0.22/0.29 p=0.229  0.36/0.46 p=0.114   True
11  Methods-rule PANs  EASH  Reward2            VS           VS  0.44/0.39 p=0.289  0.56/0.58 p=0.724  0.61/0.61 p=1.000   True
12  Methods-rule PANs  real       AC           DLS          DLS  0.37/0.32 p=0.323  0.32/0.26 p=0.247  0.16/0.11 p=0.254   True
13  Methods-rule PANs  real   action           DMS          DMS  0.56/0.45 p=0.047  0.73/0.63 p=0.061  0.29/0.25 p=0.559   True
14  Methods-rule PANs  real  Reward1            VS           VS  0.25/0.27 p=0.635  0.27/0.33 p=0.308  0.36/0.43 p=0.289   True
15  Methods-rule PANs  real  Reward2            VS           VS  0.44/0.39 p=0.289  0.56/0.58 p=0.724  0.61/0.61 p=1.000   True
set                axis
Methods-rule PANs  EASH     True
                   real     True
deposited PANs     EASH    False
                   real    False
Holds in 2 of 4 readings: blocked: the readings disagree

Result: blocked (methods_underspecified). On the Methods-rule set the region with the largest proportion is the same in fixed- and free-choice trials for all four events on both axes (AC DLS, action DMS, Reward1 and Reward2 VS), so 2 of the 4 readings hold. On the deposited PANs it is the same for action, Reward1 and Reward2 but not for AC (fixed DMS 0.38 against DLS 0.36; free DLS 0.31 against DMS 0.24 on the EASH axis). Of the 12 fixed against free differences per region and event on the deposited PANs, EASH axis, one is significant (DMS AC, 0.38 against 0.24, p = 0.021).

Regression with BIC selection (Fig. 8 claims and no-policy-coding)¶

QL(t) and QR(t) are the predictive means of the FQ model with time-varying parameters, run over each session's free-choice sequence with the drift SDs chosen on the training half of the alternate split (the fit above). Regressors (Results, model 2): constant, trial index t, a(t) (1 left, 2 right), r(t), a(t-1), r(t-1) (the previous choice trial of the session), QL(t), QR(t). For each neuron and window, the subset with the smallest BIC is chosen among all subsets of the seven non-constant terms with the constant always in (claims file O7, reading c), and a term is coded when its coefficient has p < 0.01 in that model (Methods). Readings: trials (O7 a) free-choice trials only, (O7 b) all choice trials outside extinction blocks with QL and QR carried through the session; windows (O6) 500 ms before and after (i) E1 to E7 or (ii) E0 to E6, (a) in real time or (b) on the EASH axis (EASH windows beyond E0 or E7 do not exist and are dropped). A window belongs to the phase that holds its centre on the EASH axis. The regression is run on both unit sets, so each claim has 16 readings (unit set x O7 x event set x window axis). Proportions are tested against a chance level of 0.01 by a one-sided binomial test at p < 0.01 (Fig. 8 legend; chance as the claims file reads it). Mann-Whitney U tests on 0/1 indicators (O5).

In [34]:
sa, sk = MODEL_RES["alt"][1]["FQ variable"]
rngq = np.random.default_rng(SEED + 30)
QV = {}
for s in names:
    a, r = SESS[s]
    _, mq = M.pf_session("FQ", a, r, sa, sk, rngq, return_q=True)
    g = fc[fc.session == s]
    QV[s] = (g.trial.to_numpy(), mq)
print("FQ variable drift SDs used:", sa, sk)

# value after the update of a free-choice trial: the predictive mean for the next free trial
def q_carried(ses, trials, is_free):
    ft, mq = QV.get(ses, (np.array([], int), np.zeros((0, 2))))
    out = np.zeros((len(trials), 2))
    for i, (t, f) in enumerate(zip(trials, is_free)):
        j = np.searchsorted(ft, t, "left")
        if f:
            out[i] = mq[j]
        elif j < len(ft):
            out[i] = mq[j]  # predictive mean for the next free trial = value after the last one
        elif len(ft):
            out[i] = mq[-1]
    return out

NAMES = ["const", "t", "a", "r", "a1", "r1", "QL", "QR"]
def win_list(evset, axis):
    evs = range(1, 8) if evset == "i" else range(0, 7)
    out = []
    for e in evs:
        for side, (a, b) in (("before", (-.5, 0)), ("after", (0, .5))):
            lo, hi = S.EDGES[e] + a, S.EDGES[e] + b
            if axis == "EASH" and (lo < -1e-9 or hi > S.EDGES[-1] + 1e-9):
                continue
            ph = int(np.searchsorted(S.EDGES, (lo + hi) / 2, "right"))  # 1..7, 0 before E0, 8 after E7
            out.append((f"{side} E{e}", e, a, b, ph))
    return out

def regress_all(nset, trialset, evset, axis):
    wl = win_list(evset, axis)
    rows = []
    for n in nset:
        tr = n["tr"]
        allch = T[(T.session == n["session"]) & T.choice].sort_values("trial")
        prev = {t: (a_, r_) for t, a_, r_ in zip(allch.trial.to_numpy()[1:], allch.action.to_numpy()[:-1], allch.reward.to_numpy()[:-1])}
        m = ((tr.btype == "FREE") if trialset == "a" else (tr.btype != "EXT")).to_numpy().copy()
        m &= np.array([t in prev for t in tr.trial])
        idx = np.where(m)[0]
        if len(idx) < 20:
            continue
        tt = tr.iloc[idx]
        q = q_carried(n["session"], tt.trial.to_numpy(), (tt.btype == "FREE").to_numpy())
        pa = np.array([prev[t] for t in tt.trial])
        X = np.column_stack([np.ones(len(idx)), tt.trial.to_numpy(), tt.action.to_numpy(), tt.reward.to_numpy(),
                             pa[:, 0], pa[:, 1], q[:, 0], q[:, 1]]).astype(float)
        if axis == "EASH":
            Y = S.wcounts(n, [[S.EDGES[e] + a, S.EDGES[e] + b] for _, e, a, b, _ in wl], idx)
        else:
            Y = np.column_stack([S.rcounts(n, e, [[a, b]], idx)[:, 0] for _, e, a, b, _ in wl])
        sel = M.bic_select(X, Y.astype(float), NAMES)
        for (wn, e, a, b, ph), res in zip(wl, sel):
            row = {"region": n["region"], "subject": n["subject"], "unit": n["unit"], "session": n["session"], "window": wn, "phase": ph, "n": len(idx)}
            for v in NAMES[1:]:
                row[v] = v in res and res[v][1] < .01
                row[v + "_b"] = res[v][0] if v in res else 0.0
            rows.append(row)
    df = pd.DataFrame(rows)
    df["AV"] = df.QL | df.QR
    df["SV"] = df.QL & df.QR & (np.sign(df.QL_b) == np.sign(df.QR_b))
    df["POL"] = df.QL & df.QR & (np.sign(df.QL_b) != np.sign(df.QR_b))
    return df

REGR = {}
for k, v in SETS.items():
    for trialset in ("a", "b"):
        for evset in ("i", "ii"):
            for axis in ("real", "EASH"):
                REGR[(k, trialset, evset, axis)] = regress_all(v, trialset, evset, axis)
print({k: len(v) for k, v in REGR.items()})

def prop_table(df, var):
    g = df.groupby(["window", "phase", "region"])[var].agg(["sum", "size"]).reset_index()
    g["prop"] = g["sum"] / g["size"]
    g["binom p"] = [stats.binomtest(int(s), int(n), .01, alternative="greater").pvalue for s, n in zip(g["sum"], g["size"])]
    return g
FQ variable drift SDs used: 0.01 0.05
{('deposited PANs', 'a', 'i', 'real'): 6356, ('deposited PANs', 'a', 'i', 'EASH'): 5902, ('deposited PANs', 'a', 'ii', 'real'): 6356, ('deposited PANs', 'a', 'ii', 'EASH'): 5902, ('deposited PANs', 'b', 'i', 'real'): 6356, ('deposited PANs', 'b', 'i', 'EASH'): 5902, ('deposited PANs', 'b', 'ii', 'real'): 6356, ('deposited PANs', 'b', 'ii', 'EASH'): 5902, ('Methods-rule PANs', 'a', 'i', 'real'): 6286, ('Methods-rule PANs', 'a', 'i', 'EASH'): 5837, ('Methods-rule PANs', 'a', 'ii', 'real'): 6286, ('Methods-rule PANs', 'a', 'ii', 'EASH'): 5837, ('Methods-rule PANs', 'b', 'i', 'real'): 6286, ('Methods-rule PANs', 'b', 'i', 'EASH'): 5837, ('Methods-rule PANs', 'b', 'ii', 'real'): 6286, ('Methods-rule PANs', 'b', 'ii', 'EASH'): 5837}
In [35]:
rows = []
for key, df in REGR.items():
    P = {v: prop_table(df, v) for v in ("a", "r", "r1", "a1")}
    sig = {v: P[v][P[v]["binom p"] < .01] for v in P}
    e4 = {"before": ["before E4"], "after": ["after E4"]}
    c1 = all(((sig["a"].region == reg) & sig["a"].window.isin(["before E4", "before E3", "after E3", "before E2", "after E2"]) ).any()
             and ((sig["a"].region == reg) & sig["a"].window.isin(["after E4", "before E5", "after E5", "before E6"])).any() for reg in S.REGIONS)
    after_e5 = [w for w in df.window.unique() if w in ("after E5", "before E6", "after E6", "before E7", "after E7")]
    c2 = all(((sig["r"].region == reg) & sig["r"].window.isin(after_e5)).any() for reg in S.REGIONS)
    phases = sorted(p for p in df.phase.unique() if 1 <= p <= 7)
    miss3 = [(reg, ph) for reg in S.REGIONS for ph in phases if not ((sig["r1"].region == reg) & (sig["r1"].phase == ph)).any()]
    c3 = not miss3
    c4 = ((sig["a1"].region == "DMS") & (sig["a1"].phase == 5)).any()
    rows.append({"set": key[0], "trials": key[1], "events": key[2], "axis": key[3], "(1) a(t) before and after E4": c1, "(2) r(t) after E5": c2,
                 "(3) r(t-1) every phase": c3, "(3) region, phase without": miss3, "(4) a(t-1) DMS Phase 5": c4, "holds": c1 and c2 and c3 and c4})
r8 = pd.DataFrame(rows)
print(r8.to_string())
print("Holds in", int(r8.holds.sum()), "of", len(r8), "readings:", rule_outcome(r8.holds))
key0 = ("deposited PANs", "a", "i", "real")
for kk in [("deposited PANs", "a", "ii", "EASH"), ("Methods-rule PANs", "a", "ii", "EASH")]:
    P = prop_table(REGR[kk], "r1")
    print(f"r(t-1), {kk[0]}, free-choice trials, E0-E6, EASH axis, Phase 7 windows:")
    print(P[P.phase == 7].round(3).to_string())
for v in ("a", "a1", "r", "r1"):
    P = prop_table(REGR[key0], v)
    print(f"\n{v}: proportion coding, deposited PANs, free-choice trials, E1-E7, real time (* binomial p < 0.01)")
    P["cell"] = P.prop.round(2).astype(str) + np.where(P["binom p"] < .01, "*", "")
    print(P.pivot(index=["phase", "window"], columns="region", values="cell").to_string())
                  set trials events  axis  (1) a(t) before and after E4  (2) r(t) after E5  (3) r(t-1) every phase (3) region, phase without  (4) a(t-1) DMS Phase 5  holds
0      deposited PANs      a      i  real                          True               True                    True                        []                    True   True
1      deposited PANs      a      i  EASH                          True               True                    True                        []                    True   True
2      deposited PANs      a     ii  real                          True               True                   False                [(DMS, 7)]                    True  False
3      deposited PANs      a     ii  EASH                          True               True                   False                [(DMS, 7)]                    True  False
4      deposited PANs      b      i  real                          True               True                    True                        []                    True   True
5      deposited PANs      b      i  EASH                          True               True                    True                        []                    True   True
6      deposited PANs      b     ii  real                          True               True                    True                        []                    True   True
7      deposited PANs      b     ii  EASH                          True               True                    True                        []                    True   True
8   Methods-rule PANs      a      i  real                          True               True                    True                        []                    True   True
9   Methods-rule PANs      a      i  EASH                          True               True                    True                        []                    True   True
10  Methods-rule PANs      a     ii  real                          True               True                    True                        []                    True   True
11  Methods-rule PANs      a     ii  EASH                          True               True                    True                        []                    True   True
12  Methods-rule PANs      b      i  real                          True               True                    True                        []                    True   True
13  Methods-rule PANs      b      i  EASH                          True               True                    True                        []                    True   True
14  Methods-rule PANs      b     ii  real                          True               True                    True                        []                    True   True
15  Methods-rule PANs      b     ii  EASH                          True               True                    True                        []                    True   True
Holds in 14 of 16 readings: blocked: the readings disagree
r(t-1), deposited PANs, free-choice trials, E0-E6, EASH axis, Phase 7 windows:
      window  phase region  sum  size   prop  binom p
18  after E6      7    DLS   10   204  0.049    0.000
19  after E6      7    DMS    4   112  0.036    0.027
20  after E6      7     VS   21   138  0.152    0.000
r(t-1), Methods-rule PANs, free-choice trials, E0-E6, EASH axis, Phase 7 windows:
      window  phase region  sum  size   prop  binom p
18  after E6      7    DLS   11   183  0.060      0.0
19  after E6      7    DMS    8   147  0.054      0.0
20  after E6      7     VS   17   119  0.143      0.0

a: proportion coding, deposited PANs, free-choice trials, E1-E7, real time (* binomial p < 0.01)
region             DLS    DMS     VS
phase window                        
1     before E1  0.07*   0.03  0.07*
2     after E1   0.06*   0.03   0.02
      before E2  0.04*   0.03   0.02
3     after E2   0.05*  0.04*  0.05*
      before E3  0.16*   0.1*  0.07*
4     after E3   0.26*   0.3*  0.12*
      before E4  0.26*   0.2*  0.09*
5     after E4   0.49*  0.67*  0.27*
      before E5   0.5*  0.71*   0.3*
6     after E5   0.44*  0.46*   0.3*
      before E6  0.45*  0.46*   0.3*
7     after E6    0.5*  0.71*  0.33*
      before E7  0.21*  0.26*  0.13*
8     after E7   0.14*  0.18*  0.07*

a1: proportion coding, deposited PANs, free-choice trials, E1-E7, real time (* binomial p < 0.01)
region             DLS    DMS     VS
phase window                        
1     before E1  0.06*   0.04  0.07*
2     after E1   0.06*  0.05*   0.04
      before E2  0.05*  0.09*   0.04
3     after E2   0.04*  0.07*   0.02
      before E3  0.03*  0.05*   0.04
4     after E3   0.04*   0.04  0.04*
      before E4  0.03*  0.07*  0.04*
5     after E4    0.01  0.11*   0.04
      before E5  0.05*  0.07*  0.04*
6     after E5   0.03*  0.07*   0.02
      before E6  0.03*  0.05*   0.04
7     after E6   0.06*  0.05*   0.03
      before E7   0.02   0.04   0.01
8     after E7    0.02   0.03   0.02

r: proportion coding, deposited PANs, free-choice trials, E1-E7, real time (* binomial p < 0.01)
region             DLS    DMS     VS
phase window                        
1     before E1   0.02    0.0   0.04
2     after E1     0.0    0.0   0.01
      before E2  0.03*   0.03   0.04
3     after E2    0.01   0.01   0.03
      before E3    0.0   0.03   0.01
4     after E3    0.01  0.05*  0.04*
      before E4    0.0   0.04   0.01
5     after E4    0.01  0.06*   0.01
      before E5   0.01   0.03   0.04
6     after E5   0.35*  0.32*  0.33*
      before E6  0.29*  0.37*  0.42*
7     after E6   0.37*   0.6*  0.61*
      before E7  0.63*  0.67*  0.71*
8     after E7   0.55*  0.58*  0.57*

r1: proportion coding, deposited PANs, free-choice trials, E1-E7, real time (* binomial p < 0.01)
region             DLS    DMS     VS
phase window                        
1     before E1  0.16*  0.11*   0.2*
2     after E1   0.11*  0.15*  0.21*
      before E2  0.09*  0.12*  0.25*
3     after E2   0.11*  0.07*  0.17*
      before E3  0.08*  0.08*  0.18*
4     after E3   0.05*  0.09*  0.12*
      before E4  0.06*  0.07*  0.15*
5     after E4   0.03*  0.05*  0.12*
      before E5  0.04*  0.14*  0.13*
6     after E5   0.05*  0.09*  0.08*
      before E6  0.06*   0.1*  0.07*
7     after E6   0.05*   0.04  0.15*
      before E7  0.06*  0.11*  0.09*
8     after E7   0.06*  0.05*  0.07*

Result: blocked (methods_underspecified). The claim holds in 14 of 16 readings. It fails on the deposited PANs with free-choice trials and the windows around E0 to E6, where DMS has no window above chance in Phase 7, whose only window is then the one after E6 (4 of 112, 0.036, binomial p = 0.027). On the Methods-rule set the same window gives 8 of 147 (0.054, p < 0.001), and all four parts hold in all 8 readings.

In [36]:
def ph5_windows(df):
    return sorted(w for w in df.window.unique() if (df[df.window == w].phase == 5).all())
rows = []
for key, df in REGR.items():
    P = prop_table(df, "AV")
    for w in ph5_windows(df):
        d = df[df.window == w]
        pr = {r: d[d.region == r].AV.mean() for r in S.REGIONS}
        pl = stats.mannwhitneyu(d[d.region == "DMS"].AV.astype(float), d[d.region == "DLS"].AV.astype(float)).pvalue
        pv = stats.mannwhitneyu(d[d.region == "DMS"].AV.astype(float), d[d.region == "VS"].AV.astype(float)).pvalue
        rows.append({"set": key[0], "trials": key[1], "events": key[2], "axis": key[3], "window": w, **{f"AV {r}": round(pr[r], 3) for r in S.REGIONS},
                     "p DMS-DLS": pl, "p DMS-VS": pv, "holds": max(pr, key=pr.get) == "DMS" and pl < .05})
r8e = pd.DataFrame(rows)
print(r8e.round(4).to_string())
h8e = r8e.groupby(["set", "trials", "events", "axis"]).holds.any().rename("holds in a Phase 5 window")
print(h8e.to_string())
print("Holds in", int(h8e.sum()), "of", len(h8e), "readings:", rule_outcome(h8e))
d = REGR[("deposited PANs", "a", "i", "EASH")]; d = d[d.window == "before E5"]
print("\nBy rat, action-value coding before E5 (deposited PANs, free-choice trials, EASH axis):")
print(d.groupby(["subject", "region"]).AV.agg(["mean", "size"]).unstack().round(2).to_string())
P = prop_table(REGR[key0], "AV"); P["cell"] = P.prop.round(2).astype(str) + np.where(P["binom p"] < .01, "*", "")
print("\nAction-value coding, deposited PANs, free-choice trials, E1-E7, real time:")
print(P.pivot(index=["phase", "window"], columns="region", values="cell").to_string())
                  set trials events  axis     window  AV DLS  AV DMS  AV VS  p DMS-DLS  p DMS-VS  holds
0      deposited PANs      a      i  real   after E4   0.206   0.241  0.341     0.4702    0.0874  False
1      deposited PANs      a      i  real  before E5   0.186   0.295  0.341     0.0276    0.4403  False
2      deposited PANs      a      i  EASH   after E4   0.216   0.268  0.326     0.2960    0.3192  False
3      deposited PANs      a      i  EASH  before E5   0.176   0.321  0.261     0.0034    0.2945   True
4      deposited PANs      a     ii  real   after E4   0.206   0.241  0.341     0.4702    0.0874  False
5      deposited PANs      a     ii  real  before E5   0.186   0.295  0.341     0.0276    0.4403  False
6      deposited PANs      a     ii  EASH   after E4   0.216   0.268  0.326     0.2960    0.3192  False
7      deposited PANs      a     ii  EASH  before E5   0.176   0.321  0.261     0.0034    0.2945   True
8      deposited PANs      b      i  real   after E4   0.235   0.312  0.413     0.1366    0.1021  False
9      deposited PANs      b      i  real  before E5   0.206   0.375  0.377     0.0012    0.9774  False
10     deposited PANs      b      i  EASH   after E4   0.265   0.411  0.428     0.0077    0.7899  False
11     deposited PANs      b      i  EASH  before E5   0.250   0.339  0.370     0.0921    0.6205  False
12     deposited PANs      b     ii  real   after E4   0.235   0.312  0.413     0.1366    0.1021  False
13     deposited PANs      b     ii  real  before E5   0.206   0.375  0.377     0.0012    0.9774  False
14     deposited PANs      b     ii  EASH   after E4   0.265   0.411  0.428     0.0077    0.7899  False
15     deposited PANs      b     ii  EASH  before E5   0.250   0.339  0.370     0.0921    0.6205  False
16  Methods-rule PANs      a      i  real   after E4   0.219   0.211  0.319     0.8666    0.0453  False
17  Methods-rule PANs      a      i  real  before E5   0.224   0.252  0.336     0.5578    0.1321  False
18  Methods-rule PANs      a      i  EASH   after E4   0.235   0.218  0.303     0.7106    0.1157  False
19  Methods-rule PANs      a      i  EASH  before E5   0.202   0.265  0.261     0.1768    0.9305  False
20  Methods-rule PANs      a     ii  real   after E4   0.219   0.211  0.319     0.8666    0.0453  False
21  Methods-rule PANs      a     ii  real  before E5   0.224   0.252  0.336     0.5578    0.1321  False
22  Methods-rule PANs      a     ii  EASH   after E4   0.235   0.218  0.303     0.7106    0.1157  False
23  Methods-rule PANs      a     ii  EASH  before E5   0.202   0.265  0.261     0.1768    0.9305  False
24  Methods-rule PANs      b      i  real   after E4   0.262   0.293  0.387     0.5426    0.1069  False
25  Methods-rule PANs      b      i  real  before E5   0.251   0.340  0.345     0.0782    0.9409  False
26  Methods-rule PANs      b      i  EASH   after E4   0.306   0.388  0.378     0.1206    0.8737  False
27  Methods-rule PANs      b      i  EASH  before E5   0.284   0.320  0.328     0.4845    0.8906  False
28  Methods-rule PANs      b     ii  real   after E4   0.262   0.293  0.387     0.5426    0.1069  False
29  Methods-rule PANs      b     ii  real  before E5   0.251   0.340  0.345     0.0782    0.9409  False
30  Methods-rule PANs      b     ii  EASH   after E4   0.306   0.388  0.378     0.1206    0.8737  False
31  Methods-rule PANs      b     ii  EASH  before E5   0.284   0.320  0.328     0.4845    0.8906  False
set                trials  events  axis
Methods-rule PANs  a       i       EASH    False
                                   real    False
                           ii      EASH    False
                                   real    False
                   b       i       EASH    False
                                   real    False
                           ii      EASH    False
                                   real    False
deposited PANs     a       i       EASH     True
                                   real    False
                           ii      EASH     True
                                   real    False
                   b       i       EASH    False
                                   real    False
                           ii      EASH    False
                                   real    False
Holds in 2 of 16 readings: blocked: the readings disagree

By rat, action-value coding before E5 (deposited PANs, free-choice trials, EASH axis):
         mean              size            
region    DLS   DMS    VS   DLS   DMS    VS
subject                                    
091      0.17  0.00  0.36  30.0   1.0  14.0
092      0.14  0.42  0.36  28.0  24.0  25.0
101      0.20  0.27  0.00  20.0  11.0   2.0
108      0.27  0.17  0.00  22.0  12.0   9.0
114      0.18  0.30   NaN  44.0  10.0   NaN
115      0.00  0.00  0.23  14.0   9.0  69.0
116      0.20  0.40  0.32  46.0  45.0  19.0

Action-value coding, deposited PANs, free-choice trials, E1-E7, real time:
region             DLS    DMS     VS
phase window                        
1     before E1  0.17*  0.17*  0.29*
2     after E1   0.19*  0.19*  0.21*
      before E2  0.13*  0.18*  0.18*
3     after E2   0.12*  0.21*  0.21*
      before E3  0.17*  0.26*  0.19*
4     after E3   0.15*  0.19*  0.22*
      before E4  0.14*  0.21*  0.25*
5     after E4   0.21*  0.24*  0.34*
      before E5  0.19*  0.29*  0.34*
6     after E5    0.2*  0.18*  0.24*
      before E6  0.15*  0.18*  0.22*
7     after E6    0.2*  0.29*  0.23*
      before E7  0.09*  0.12*  0.17*
8     after E7   0.13*  0.08*  0.12*

Result: blocked (methods_underspecified). The claim holds in 2 of 16 readings, both on the deposited PANs with free-choice trials and EASH-axis windows: in the 500 ms before E5 action-value coding is 0.321 in DMS, 0.261 in VS and 0.176 in DLS (DMS against DLS p = 0.0034, against VS p = 0.29). With real-time windows VS is highest (0.341 against DMS 0.295); with all choice trials VS is highest in every Phase 5 window on the deposited PANs; on the Methods-rule set DMS is never significantly above DLS (p 0.078 to 0.87).

In [37]:
rows = []
for key, df in REGR.items():
    for w in ph5_windows(df):
        d = df[df.window == w]
        dm = d[d.region == "DMS"]
        frac = dm[dm.AV].QR.mean() if dm.AV.any() else np.nan
        p = stats.mannwhitneyu(dm.QR.astype(float), d[d.region == "DLS"].QR.astype(float)).pvalue
        rows.append({"set": key[0], "trials": key[1], "events": key[2], "axis": key[3], "window": w, "DMS AV neurons": int(dm.AV.sum()),
                     "of them coding QR": frac, "QR DMS": dm.QR.mean(), "QR DLS": d[d.region == "DLS"].QR.mean(), "p": p,
                     "holds": frac > .5 and dm.QR.mean() > d[d.region == "DLS"].QR.mean() and p < .05})
r8q = pd.DataFrame(rows)
print(r8q.round(4).to_string())
h8q = r8q.groupby(["set", "trials", "events", "axis"]).holds.any().rename("holds in a Phase 5 window")
print(h8q.to_string())
print("Holds in", int(h8q.sum()), "of", len(h8q), "readings:", rule_outcome(h8q))
                  set trials events  axis     window  DMS AV neurons  of them coding QR  QR DMS  QR DLS       p  holds
0      deposited PANs      a      i  real   after E4              27             0.7037  0.1696  0.0735  0.0085   True
1      deposited PANs      a      i  real  before E5              33             0.6364  0.1875  0.0784  0.0040   True
2      deposited PANs      a      i  EASH   after E4              30             0.6000  0.1607  0.1078  0.1774  False
3      deposited PANs      a      i  EASH  before E5              36             0.4722  0.1518  0.1127  0.3194  False
4      deposited PANs      a     ii  real   after E4              27             0.7037  0.1696  0.0735  0.0085   True
5      deposited PANs      a     ii  real  before E5              33             0.6364  0.1875  0.0784  0.0040   True
6      deposited PANs      a     ii  EASH   after E4              30             0.6000  0.1607  0.1078  0.1774  False
7      deposited PANs      a     ii  EASH  before E5              36             0.4722  0.1518  0.1127  0.3194  False
8      deposited PANs      b      i  real   after E4              35             0.5714  0.1786  0.1324  0.2706  False
9      deposited PANs      b      i  real  before E5              42             0.6190  0.2321  0.0931  0.0007   True
10     deposited PANs      b      i  EASH   after E4              46             0.6304  0.2589  0.1225  0.0021   True
11     deposited PANs      b      i  EASH  before E5              38             0.6053  0.2054  0.1225  0.0503  False
12     deposited PANs      b     ii  real   after E4              35             0.5714  0.1786  0.1324  0.2706  False
13     deposited PANs      b     ii  real  before E5              42             0.6190  0.2321  0.0931  0.0007   True
14     deposited PANs      b     ii  EASH   after E4              46             0.6304  0.2589  0.1225  0.0021   True
15     deposited PANs      b     ii  EASH  before E5              38             0.6053  0.2054  0.1225  0.0503  False
16  Methods-rule PANs      a      i  real   after E4              31             0.6129  0.1293  0.0710  0.0763  False
17  Methods-rule PANs      a      i  real  before E5              37             0.5405  0.1361  0.0929  0.2179  False
18  Methods-rule PANs      a      i  EASH   after E4              32             0.5625  0.1224  0.1093  0.7109  False
19  Methods-rule PANs      a      i  EASH  before E5              39             0.4615  0.1224  0.1257  0.9304  False
20  Methods-rule PANs      a     ii  real   after E4              31             0.6129  0.1293  0.0710  0.0763  False
21  Methods-rule PANs      a     ii  real  before E5              37             0.5405  0.1361  0.0929  0.2179  False
22  Methods-rule PANs      a     ii  EASH   after E4              32             0.5625  0.1224  0.1093  0.7109  False
23  Methods-rule PANs      a     ii  EASH  before E5              39             0.4615  0.1224  0.1257  0.9304  False
24  Methods-rule PANs      b      i  real   after E4              43             0.6047  0.1769  0.1257  0.1947  False
25  Methods-rule PANs      b      i  real  before E5              50             0.6000  0.2041  0.1038  0.0111   True
26  Methods-rule PANs      b      i  EASH   after E4              57             0.6316  0.2449  0.1257  0.0050   True
27  Methods-rule PANs      b      i  EASH  before E5              47             0.5957  0.1905  0.1257  0.1063  False
28  Methods-rule PANs      b     ii  real   after E4              43             0.6047  0.1769  0.1257  0.1947  False
29  Methods-rule PANs      b     ii  real  before E5              50             0.6000  0.2041  0.1038  0.0111   True
30  Methods-rule PANs      b     ii  EASH   after E4              57             0.6316  0.2449  0.1257  0.0050   True
31  Methods-rule PANs      b     ii  EASH  before E5              47             0.5957  0.1905  0.1257  0.1063  False
set                trials  events  axis
Methods-rule PANs  a       i       EASH    False
                                   real    False
                           ii      EASH    False
                                   real    False
                   b       i       EASH     True
                                   real     True
                           ii      EASH     True
                                   real     True
deposited PANs     a       i       EASH    False
                                   real     True
                           ii      EASH    False
                                   real     True
                   b       i       EASH     True
                                   real     True
                           ii      EASH     True
                                   real     True
Holds in 10 of 16 readings: blocked: the readings disagree

Result: blocked (methods_underspecified). The claim holds in 10 of 16 readings. With free-choice trials it holds with real-time windows on the deposited PANs (0.64 to 0.70 of the DMS action-value neurons code QR; QR proportion in DMS 0.17 to 0.19 against DLS 0.07 to 0.08, p 0.004 to 0.009) and fails with EASH-axis windows (0.47 and 0.60 code QR; p 0.18 and 0.32) and on the Methods-rule set (p 0.076 to 0.93). With all choice trials it holds in a Phase 5 window in all 8 readings (for example after E4 on the EASH axis, DMS 0.26 against DLS 0.12, p = 0.0021, deposited PANs).

In [38]:
rows = []
for key, df in REGR.items():
    phases = sorted(p for p in df.phase.unique() if 1 <= p <= 7)
    largest = {}
    for ph in phases:
        ok = False
        for w in df[df.phase == ph].window.unique():
            d = df[df.window == w]
            pr = {r: d[d.region == r].SV.mean() for r in S.REGIONS}
            ok |= pr["VS"] > max(pr["DLS"], pr["DMS"])
        largest[ph] = ok
    def vs_test(w):
        d = df[df.window == w]
        if not len(d):
            return False, np.nan, np.nan
        x = d[d.region == "VS"].SV.astype(float)
        p1 = stats.mannwhitneyu(x, d[d.region == "DLS"].SV.astype(float)).pvalue
        p2 = stats.mannwhitneyu(x, d[d.region == "DMS"].SV.astype(float)).pvalue
        ok = x.mean() > d[d.region == "DLS"].SV.mean() and x.mean() > d[d.region == "DMS"].SV.mean() and p1 < .05 and p2 < .05
        return ok, p1, p2
    ph1 = [vs_test(w) + (w,) for w in df[df.phase == 1].window.unique()]
    ph4 = vs_test("after E3")
    rows.append({"set": key[0], "trials": key[1], "events": key[2], "axis": key[3], "VS largest in phases": [ph for ph in phases if largest[ph]],
                 "Phase 1 tests (ok, p DLS, p DMS, window)": [(o, round(a, 4), round(b, 4), w) for o, a, b, w in ph1],
                 "first half Phase 4 (after E3)": (ph4[0], round(ph4[1], 4), round(ph4[2], 4)),
                 "holds": all(largest.values()) and any(o for o, *_ in ph1) and ph4[0]})
r8f = pd.DataFrame(rows)
print(r8f.to_string())
print("Holds in", int(r8f.holds.sum()), "of", len(r8f), "readings:", rule_outcome(r8f.holds))
P = prop_table(REGR[key0], "SV"); P["cell"] = P.prop.round(3).astype(str) + np.where(P["binom p"] < .01, "*", "")
print("\nState-value coding, deposited PANs, free-choice trials, E1-E7, real time:")
print(P.pivot(index=["phase", "window"], columns="region", values="cell").to_string())
                  set trials events  axis   VS largest in phases                                 Phase 1 tests (ok, p DLS, p DMS, window) first half Phase 4 (after E3)  holds
0      deposited PANs      a      i  real  [1, 2, 3, 4, 5, 6, 7]                                       [(True, 0.0002, 0.029, before E1)]       (False, 0.0137, 0.4837)  False
1      deposited PANs      a      i  EASH  [1, 2, 3, 4, 5, 6, 7]                                       [(True, 0.0002, 0.029, before E1)]       (False, 0.0005, 0.7577)  False
2      deposited PANs      a     ii  real  [1, 2, 3, 4, 5, 6, 7]    [(False, 0.0308, 0.6757, after E0), (True, 0.0002, 0.029, before E1)]       (False, 0.0137, 0.4837)  False
3      deposited PANs      a     ii  EASH  [1, 2, 3, 4, 5, 6, 7]    [(False, 0.0308, 0.6757, after E0), (True, 0.0002, 0.029, before E1)]       (False, 0.0005, 0.7577)  False
4      deposited PANs      b      i  real  [1, 2, 3, 4, 5, 6, 7]                                     [(False, 0.0004, 0.1008, before E1)]       (False, 0.1039, 0.4837)  False
5      deposited PANs      b      i  EASH     [1, 2, 3, 5, 6, 7]                                     [(False, 0.0004, 0.1008, before E1)]       (False, 0.3621, 0.1198)  False
6      deposited PANs      b     ii  real  [1, 2, 3, 4, 5, 6, 7]  [(False, 0.0308, 0.7382, after E0), (False, 0.0004, 0.1008, before E1)]       (False, 0.1039, 0.4837)  False
7      deposited PANs      b     ii  EASH     [1, 2, 3, 5, 6, 7]  [(False, 0.0308, 0.7382, after E0), (False, 0.0004, 0.1008, before E1)]       (False, 0.3621, 0.1198)  False
8   Methods-rule PANs      a      i  real  [1, 2, 3, 4, 5, 6, 7]                                      [(True, 0.0001, 0.0008, before E1)]       (False, 0.0373, 0.1799)  False
9   Methods-rule PANs      a      i  EASH  [1, 2, 3, 4, 5, 6, 7]                                      [(True, 0.0001, 0.0008, before E1)]       (False, 0.0001, 0.0533)  False
10  Methods-rule PANs      a     ii  real  [1, 2, 3, 4, 5, 6, 7]   [(False, 0.0803, 0.3071, after E0), (True, 0.0001, 0.0008, before E1)]       (False, 0.0373, 0.1799)  False
11  Methods-rule PANs      a     ii  EASH  [1, 2, 3, 4, 5, 6, 7]   [(False, 0.0803, 0.3071, after E0), (True, 0.0001, 0.0008, before E1)]       (False, 0.0001, 0.0533)  False
12  Methods-rule PANs      b      i  real  [1, 2, 3, 4, 5, 6, 7]                                     [(False, 0.0004, 0.0588, before E1)]       (False, 0.0373, 0.5063)  False
13  Methods-rule PANs      b      i  EASH     [1, 2, 3, 4, 6, 7]                                     [(False, 0.0004, 0.0588, before E1)]        (False, 0.1769, 0.643)  False
14  Methods-rule PANs      b     ii  real  [1, 2, 3, 4, 5, 6, 7]  [(False, 0.0803, 0.5091, after E0), (False, 0.0004, 0.0588, before E1)]       (False, 0.0373, 0.5063)  False
15  Methods-rule PANs      b     ii  EASH     [1, 2, 3, 4, 6, 7]  [(False, 0.0803, 0.5091, after E0), (False, 0.0004, 0.0588, before E1)]        (False, 0.1769, 0.643)  False
Holds in 0 of 16 readings: not reproduced

State-value coding, deposited PANs, free-choice trials, E1-E7, real time:
region             DLS     DMS      VS
phase window                          
1     before E1  0.005   0.018   0.08*
2     after E1    0.01   0.009   0.022
      before E2   0.01   0.009   0.022
3     after E2   0.015   0.036  0.043*
      before E3  0.015   0.018  0.051*
4     after E3   0.005   0.027  0.043*
      before E4    0.0  0.045*  0.051*
5     after E4     0.0   0.027  0.109*
      before E5   0.02   0.027  0.065*
6     after E5     0.0   0.018  0.058*
      before E6    0.0   0.009  0.051*
7     after E6   0.015   0.027  0.043*
      before E7   0.01     0.0   0.014
8     after E7   0.015   0.018   0.036

Result: blocked (data_missing). It depends on fig8a-d-action-reward-coding, which is blocked (methods_underspecified), and through the unit sets on neuron-counts, which is blocked (data_missing), so by Author step 1.5 it is blocked; both reasons apply, and data_missing is recorded (agreed by the verifier in round 3, which noted that methods_underspecified, the reason of the direct parent, applies too). As tested, the criterion gives not reproduced: No reading holds (0 of 16). VS has the largest proportion of state-value neurons in every phase in 12 of the 16 readings, and in the 500 ms before E1 it exceeds DLS and DMS with free-choice trials (deposited PANs p = 0.0002 and 0.029; Methods-rule set p = 0.0001 and 0.0008). In the window after E3 (first half of Phase 4) VS is never above DMS with p < 0.05 (p 0.053 to 0.76), and with all choice trials the Phase 1 test against DMS fails as well (p = 0.10 and 0.059).

In [39]:
rows = []
for key, df in REGR.items():
    P = prop_table(df, "POL")
    rows.append({"set": key[0], "trials": key[1], "events": key[2], "axis": key[3], "largest proportion": P.prop.max(),
                 "where": tuple(P.loc[P.prop.idxmax(), ["region", "window"]]), "smallest binomial p": P["binom p"].min(),
                 "region-windows with p < 0.01": int((P["binom p"] < .01).sum())})
rp = pd.DataFrame(rows)
print(rp.round(5).to_string())
print("Absence holds in", int((rp["region-windows with p < 0.01"] == 0).sum()), "of", len(rp), "readings:",
      rule_outcome(rp["region-windows with p < 0.01"] == 0))
                  set trials events  axis  largest proportion             where  smallest binomial p  region-windows with p < 0.01
0      deposited PANs      a      i  real             0.01471   (DLS, after E6)              0.33420                             0
1      deposited PANs      a      i  EASH             0.01786   (DMS, after E4)              0.30850                             0
2      deposited PANs      a     ii  real             0.01471   (DLS, after E6)              0.33420                             0
3      deposited PANs      a     ii  EASH             0.01786   (DMS, after E4)              0.30850                             0
4      deposited PANs      b      i  real             0.03571   (DMS, after E2)              0.02652                             0
5      deposited PANs      b      i  EASH             0.02679   (DMS, after E1)              0.10273                             0
6      deposited PANs      b     ii  real             0.03571   (DMS, after E2)              0.02652                             0
7      deposited PANs      b     ii  EASH             0.02679   (DMS, after E1)              0.10273                             0
8   Methods-rule PANs      a      i  real             0.01093   (DLS, after E5)              0.54725                             0
9   Methods-rule PANs      a      i  EASH             0.01639   (DLS, after E1)              0.27719                             0
10  Methods-rule PANs      a     ii  real             0.01093   (DLS, after E5)              0.54725                             0
11  Methods-rule PANs      a     ii  EASH             0.01639   (DLS, after E1)              0.27719                             0
12  Methods-rule PANs      b      i  real             0.02732  (DLS, before E3)              0.03780                             0
13  Methods-rule PANs      b      i  EASH             0.03401   (DMS, after E1)              0.01663                             0
14  Methods-rule PANs      b     ii  real             0.02732  (DLS, before E3)              0.03780                             0
15  Methods-rule PANs      b     ii  EASH             0.03401   (DMS, after E1)              0.01663                             0
Absence holds in 16 of 16 readings: reproduced

Result: blocked (data_missing). It depends on fig8a-d-action-reward-coding, which is blocked (methods_underspecified), and through the unit sets on neuron-counts, which is blocked (data_missing), so by Author step 1.5 it is blocked; both reasons apply, and data_missing is recorded (agreed by the verifier in round 3, which noted that methods_underspecified, the reason of the direct parent, applies too). As tested, the criterion gives reproduced: In all 16 readings, on both unit sets, no region and window has a proportion of policy-coding neurons above the chance level of 0.01 at p < 0.01: the largest proportion is 0.011 to 0.036 and the smallest binomial p 0.017. The chance level 0.01 is conservative for a joint event (QL and QR both coded), as the claims file notes; this is asked of a reader (questions/001642.yaml).

Action information by block type (Fig. 9 and Fig. 10 claims)¶

Per PAN, action MI from the last 20 choice trials of each block (Fig. 9 legend and Results), in a sliding window of the preceding 500 ms with 50 ms steps on the EASH axis (Fig. 9 legend), plus the 500 ms windows ending at E2, E3 and E4. Block types: single fixed (SF), double fixed (DF), free with higher probabilities (90, 50) or (50, 90) (FH), free with lower probabilities (50, 10) or (10, 50) (FL). Readings of how the blocks of one type are combined: (a) their last 20 trials pooled into one MI estimate per neuron; (b) MI per block, averaged over the blocks. Blocks with fewer than 20 choice trials give all of theirs. O1 readings (a) and (b), with the Panzeri-Treves variant (c), as before; readings per claim: unit set (2) x combination (2) x O1 (2), times the claim's own. Variant: reading (a) with the labels of the threshold permuted within blocks.

In [40]:
T_END = np.round(np.arange(0.5, S.EDGES[-1] + 1e-9, 0.05), 3)
SLW = np.column_stack([T_END - .5, T_END])
SPW = np.array([[S.EDGES[e] - .5, S.EDGES[e]] for e in (2, 3, 4)])  # ending at E2, E3, E4
W9 = np.vstack([SLW, SPW])
iw = {"E2": len(SLW), "E3": len(SLW) + 1, "E4": len(SLW) + 2}
PH_END = np.searchsorted(S.EDGES, T_END, "left")  # phase (1..7) containing each window end (end on an edge counts to the earlier phase)

def btype9(tr):
    bt = tr.btype.to_numpy().astype(object)
    hi = (tr.btype == "FREE") & ((tr.rule_L == 90) | (tr.rule_R == 90))
    lo = (tr.btype == "FREE") & ((tr.rule_L == 10) | (tr.rule_R == 10))
    bt[hi.to_numpy()] = "FH"; bt[lo.to_numpy()] = "FL"
    return bt

def blocks_last20(n):
    tr = n["tr"]; bt = btype9(tr)
    out = {}
    for b in np.unique(tr.block):
        idx = np.where(tr.block.to_numpy() == b)[0]
        typ = bt[idx[0]]
        if typ in ("SF", "DF", "FH", "FL"):
            out.setdefault(typ, []).append(idx[-20:])
    out["FIX"] = out.get("SF", []) + out.get("DF", [])
    out["FREE"] = out.get("FH", []) + out.get("FL", [])
    return out

def mi9(n, rng, rng_wb):
    """Action MI (bits/s) per block type, readings a (pooled) and b (per block), with shuffles."""
    tr = n["tr"]; y = (tr.action == 1).to_numpy()
    C = S.wcounts(n, W9)
    res = {}
    for typ, blks in blocks_last20(n).items():
        if not blks:
            continue
        idx = np.concatenate(blks)
        pooled = S.mi_with_shuffles(C[idx], y[idx], rng, 100, 0.5)
        if typ in ("SF", "DF", "FH", "FL"):  # variant: pooled trials, labels permuted within blocks
            wb = S.mi_with_shuffles(C[idx], y[idx], rng_wb, 100, 0.5, groups=tr.block.to_numpy()[idx])
            for est in ("plugin", "pt"):
                res[(typ, "a-wb", est)] = wb[est]
        per = [S.mi_with_shuffles(C[bi], y[bi], rng, 100, 0.5) for bi in blks]
        for est in ("plugin", "pt"):
            res[(typ, "a", est)] = pooled[est]
            res[(typ, "b", est)] = (np.mean([p[est][0] for p in per], 0), np.mean([p[est][1] for p in per], 0).astype(np.float32))
    return res

R9 = {}
for k, v in SETS.items():
    rng = np.random.default_rng(SEED + 900 + (k != "deposited PANs"))
    rng_wb = np.random.default_rng(SEED + 950 + (k != "deposited PANs"))  # own stream, so the variant leaves the others unchanged
    R9[k] = [mi9(n, rng, rng_wb) for n in v]

def get9(k, typ, comb, o1):
    """Per-neuron MI (N x W), regions, region averages and thresholds, for neurons that have the block type.
    ``comb`` "a-wb" is reading (a) with the labels of the threshold permuted within blocks (a variant)."""
    est = "pt" if o1 == "c" else "plugin"
    have = [i for i, r in enumerate(R9[k]) if (typ, comb, est) in r]
    real = np.array([R9[k][i][(typ, comb, est)][0] for i in have])
    shs = np.array([R9[k][i][(typ, comb, est)][1] for i in have])
    if o1 == "b":
        mu = shs.mean(1); real = real - mu; shs = shs - mu[:, None, :]
    reg = REG[k][have]
    avg = {r: real[reg == r].mean(0) for r in S.REGIONS}
    thr = {r: S.threshold(shs[reg == r].mean(0)) for r in S.REGIONS}
    return real, reg, avg, thr, np.array(have)

def rise(avg, thr):
    """First crossing overall, and start of the sustained rise (above threshold from there through Phase 5)."""
    a = avg[:len(SLW)] > thr[:len(SLW)]
    first = np.argmax(a) if a.any() else None
    end5 = np.where(PH_END <= 5)[0][-1]
    sus = None
    for i in range(end5, -1, -1):
        if a[i]:
            sus = i
        else:
            break
    return first, sus

def readings9(combs=("a", "b")):
    for k in SETS:
        for comb in combs:
            for o1 in ("a", "b", "c"):
                yield k, comb, o1
In [41]:
rows = []
for k, comb, o1 in readings9():
    row = {"set": k, "comb": comb, "O1": o1}
    ok1, ok2 = True, True
    for typ in ("SF", "DF", "FH", "FL"):
        real, reg, avg, thr, _ = get9(k, typ, comb, o1)
        t_s = {}
        for r in S.REGIONS:
            f, s = rise(avg[r], thr[r])
            t_s[r] = s
            row[f"{typ} {r}"] = (f"first {T_END[f]:.2f} (P{PH_END[f]}); " if f is not None else "none; ") + \
                                (f"rise {T_END[s]:.2f} (P{PH_END[s]})" if s is not None else "no rise")
        ph = {r: PH_END[t_s[r]] if t_s[r] is not None else None for r in S.REGIONS}
        if typ in ("SF", "DF"):
            ok1 &= ph["DLS"] == 3 and ph["DMS"] == 4 and ph["VS"] == 5
        else:
            ok2 &= None not in t_s.values() and t_s["DLS"] < t_s["DMS"] < t_s["VS"]
    row["(1)"] = ok1; row["(2)"] = ok2; row["holds"] = ok1 and ok2
    rows.append(row)
r9 = pd.DataFrame(rows)
rows = []
for k, comb, o1 in readings9(("a-wb",)):
    row = {"set": k, "comb": comb, "O1": o1}
    for typ in ("SF", "DF", "FH", "FL"):
        real, reg, avg, thr, _ = get9(k, typ, comb, o1)
        for r in S.REGIONS:
            f, s = rise(avg[r], thr[r])
            row[f"{typ} {r}"] = (f"first {T_END[f]:.2f} (P{PH_END[f]}); " if f is not None else "none; ") + \
                                (f"rise {T_END[s]:.2f} (P{PH_END[s]})" if s is not None else "no rise")
    rows.append(row)
r9wb = pd.DataFrame(rows)
print("Phases: E1", S.EDGES[1], "E2", S.EDGES[2], "E3", S.EDGES[3], "E4", round(S.EDGES[4], 2), "E5", round(S.EDGES[5], 2), "E6", round(S.EDGES[6], 2))
print(r9.T.to_string())
verdict_o1(r9)
print("\nVariant: last 20 trials pooled (a), threshold from labels permuted within blocks")
print(r9wb.T.to_string())
print("Neurons with each block type (deposited):", {t: len(get9("deposited PANs", t, "a", "a")[4]) for t in ("SF", "DF", "FH", "FL")})
fig, ax = plt.subplots(1, 4, figsize=(13, 2.8), sharey=True)
for i, typ in enumerate(("SF", "DF", "FH", "FL")):
    real, reg, avg, thr, _ = get9("deposited PANs", typ, "a", "a")
    for r in S.REGIONS:
        ax[i].plot(T_END, avg[r][:len(SLW)], label=r); ax[i].plot(T_END, thr[r][:len(SLW)], ls=":", lw=.8)
    for e in S.EDGES: ax[i].axvline(e, color="k", lw=.3)
    ax[i].set_title(f"{typ} (pooled, plug-in)"); ax[i].set_xlabel("window end (s)")
ax[0].set_ylabel("action MI (bits/s)"); ax[0].legend(fontsize=7); plt.tight_layout(); plt.show()
Phases: E1 2.0 E2 2.75 E3 4.25 E4 4.79 E5 5.55 E6 5.93
                                     0                                1                                2                                3                                4                                5                                6                                7                                8                                9                                10                               11
set                      deposited PANs                   deposited PANs                   deposited PANs                   deposited PANs                   deposited PANs                   deposited PANs                Methods-rule PANs                Methods-rule PANs                Methods-rule PANs                Methods-rule PANs                Methods-rule PANs                Methods-rule PANs
comb                                  a                                a                                a                                b                                b                                b                                a                                a                                a                                b                                b                                b
O1                                    a                                b                                c                                a                                b                                c                                a                                b                                c                                a                                b                                c
SF DLS  first 1.00 (P1); rise 2.85 (P3)  first 1.00 (P1); rise 2.85 (P3)  first 1.00 (P1); rise 2.85 (P3)  first 0.65 (P1); rise 4.10 (P3)  first 0.65 (P1); rise 4.10 (P3)  first 0.65 (P1); rise 4.10 (P3)  first 1.00 (P1); rise 2.85 (P3)  first 1.00 (P1); rise 2.85 (P3)  first 1.05 (P1); rise 2.85 (P3)  first 1.20 (P1); rise 4.25 (P3)  first 1.20 (P1); rise 4.25 (P3)  first 1.20 (P1); rise 4.25 (P3)
SF DMS  first 0.80 (P1); rise 3.10 (P3)  first 0.80 (P1); rise 3.10 (P3)  first 0.80 (P1); rise 3.10 (P3)  first 0.60 (P1); rise 4.40 (P4)  first 0.60 (P1); rise 4.40 (P4)  first 0.60 (P1); rise 4.50 (P4)  first 0.80 (P1); rise 3.05 (P3)  first 0.80 (P1); rise 3.05 (P3)  first 0.80 (P1); rise 3.05 (P3)  first 0.75 (P1); rise 4.10 (P3)  first 0.75 (P1); rise 4.10 (P3)  first 0.75 (P1); rise 4.50 (P4)
SF VS   first 0.50 (P1); rise 3.00 (P3)  first 0.50 (P1); rise 3.00 (P3)  first 0.50 (P1); rise 3.00 (P3)  first 0.85 (P1); rise 5.05 (P5)  first 0.85 (P1); rise 5.05 (P5)  first 0.85 (P1); rise 5.10 (P5)  first 0.50 (P1); rise 3.05 (P3)  first 0.50 (P1); rise 3.05 (P3)  first 0.50 (P1); rise 3.05 (P3)  first 0.85 (P1); rise 4.85 (P5)  first 0.85 (P1); rise 4.85 (P5)  first 0.85 (P1); rise 4.85 (P5)
DF DLS  first 2.80 (P3); rise 2.80 (P3)  first 2.80 (P3); rise 2.80 (P3)  first 2.75 (P2); rise 2.75 (P2)  first 0.50 (P1); rise 3.40 (P3)  first 0.50 (P1); rise 3.40 (P3)  first 0.50 (P1); rise 3.40 (P3)  first 2.85 (P3); rise 3.00 (P3)  first 2.85 (P3); rise 3.00 (P3)  first 2.85 (P3); rise 3.00 (P3)  first 0.50 (P1); rise 3.40 (P3)  first 0.50 (P1); rise 3.40 (P3)  first 0.50 (P1); rise 3.40 (P3)
DF DMS  first 3.05 (P3); rise 3.05 (P3)  first 3.05 (P3); rise 3.05 (P3)  first 3.10 (P3); rise 3.10 (P3)  first 3.20 (P3); rise 3.20 (P3)  first 3.20 (P3); rise 3.20 (P3)  first 3.20 (P3); rise 3.20 (P3)  first 1.00 (P1); rise 2.95 (P3)  first 1.00 (P1); rise 2.95 (P3)  first 1.00 (P1); rise 2.95 (P3)  first 3.10 (P3); rise 3.20 (P3)  first 3.10 (P3); rise 3.20 (P3)  first 3.10 (P3); rise 3.20 (P3)
DF VS   first 3.15 (P3); rise 3.15 (P3)  first 3.15 (P3); rise 3.15 (P3)  first 3.15 (P3); rise 3.15 (P3)  first 3.40 (P3); rise 3.95 (P3)  first 3.40 (P3); rise 3.95 (P3)  first 3.40 (P3); rise 3.95 (P3)  first 3.20 (P3); rise 3.20 (P3)  first 3.20 (P3); rise 3.20 (P3)  first 3.20 (P3); rise 3.20 (P3)  first 1.05 (P1); rise 4.40 (P4)  first 1.05 (P1); rise 4.40 (P4)  first 1.05 (P1); rise 4.40 (P4)
FH DLS  first 0.75 (P1); rise 2.15 (P2)  first 0.75 (P1); rise 2.15 (P2)  first 0.75 (P1); rise 2.15 (P2)  first 2.10 (P2); rise 4.30 (P4)  first 2.10 (P2); rise 4.30 (P4)  first 2.10 (P2); rise 4.30 (P4)  first 0.75 (P1); rise 1.10 (P1)  first 0.75 (P1); rise 1.10 (P1)  first 0.75 (P1); rise 1.10 (P1)  first 1.20 (P1); rise 4.40 (P4)  first 1.20 (P1); rise 4.40 (P4)  first 1.20 (P1); rise 4.40 (P4)
FH DMS  first 0.90 (P1); rise 3.80 (P3)  first 0.90 (P1); rise 3.80 (P3)  first 0.90 (P1); rise 3.80 (P3)  first 1.55 (P1); rise 4.55 (P4)  first 1.55 (P1); rise 4.55 (P4)  first 0.95 (P1); rise 4.55 (P4)  first 0.70 (P1); rise 3.80 (P3)  first 0.70 (P1); rise 3.80 (P3)  first 0.70 (P1); rise 3.80 (P3)  first 1.60 (P1); rise 4.55 (P4)  first 1.60 (P1); rise 4.55 (P4)  first 1.60 (P1); rise 4.75 (P4)
FH VS   first 0.60 (P1); rise 3.85 (P3)  first 0.60 (P1); rise 3.85 (P3)  first 0.60 (P1); rise 3.85 (P3)  first 1.10 (P1); rise 4.70 (P4)  first 1.10 (P1); rise 4.70 (P4)  first 1.10 (P1); rise 4.75 (P4)  first 0.60 (P1); rise 3.90 (P3)  first 0.60 (P1); rise 3.90 (P3)  first 0.60 (P1); rise 3.90 (P3)  first 1.10 (P1); rise 4.60 (P4)  first 1.10 (P1); rise 4.60 (P4)  first 1.10 (P1); rise 4.60 (P4)
FL DLS  first 0.50 (P1); rise 3.75 (P3)  first 0.50 (P1); rise 3.75 (P3)  first 0.50 (P1); rise 3.75 (P3)  first 3.35 (P3); rise 4.40 (P4)  first 3.35 (P3); rise 4.40 (P4)  first 3.65 (P3); rise 4.40 (P4)  first 0.50 (P1); rise 2.35 (P2)  first 0.50 (P1); rise 2.35 (P2)  first 0.50 (P1); rise 2.60 (P2)  first 3.35 (P3); rise 4.40 (P4)  first 3.35 (P3); rise 4.40 (P4)  first 3.35 (P3); rise 4.65 (P4)
FL DMS  first 0.50 (P1); rise 4.30 (P4)  first 0.50 (P1); rise 4.30 (P4)  first 0.50 (P1); rise 4.30 (P4)  first 0.70 (P1); rise 4.35 (P4)  first 0.70 (P1); rise 4.35 (P4)  first 0.70 (P1); rise 4.45 (P4)  first 0.50 (P1); rise 3.65 (P3)  first 0.50 (P1); rise 3.65 (P3)  first 0.50 (P1); rise 3.65 (P3)  first 0.90 (P1); rise 4.60 (P4)  first 0.90 (P1); rise 4.60 (P4)  first 0.90 (P1); rise 4.60 (P4)
FL VS   first 0.50 (P1); rise 4.00 (P3)  first 0.50 (P1); rise 4.00 (P3)  first 0.50 (P1); rise 4.00 (P3)  first 1.05 (P1); rise 4.80 (P5)  first 1.05 (P1); rise 4.80 (P5)  first 2.25 (P2); rise 4.85 (P5)  first 0.50 (P1); rise 4.00 (P3)  first 0.50 (P1); rise 4.00 (P3)  first 0.50 (P1); rise 4.00 (P3)  first 3.80 (P3); rise 4.75 (P4)  first 3.80 (P3); rise 4.75 (P4)  first 3.80 (P3); rise 4.75 (P4)
(1)                               False                            False                            False                            False                            False                            False                            False                            False                            False                            False                            False                            False
(2)                               False                            False                            False                            False                            False                             True                             True                             True                             True                             True                             True                            False
holds                             False                            False                            False                            False                            False                            False                            False                            False                            False                            False                            False                            False
Holds in 0 of 8 readings (O1 a and b): not reproduced; Panzeri-Treves variant (c): holds in 0 of 4

Variant: last 20 trials pooled (a), threshold from labels permuted within blocks
                                      0                                1                                2                                3                                4                                5
set                      deposited PANs                   deposited PANs                   deposited PANs                Methods-rule PANs                Methods-rule PANs                Methods-rule PANs
comb                               a-wb                             a-wb                             a-wb                             a-wb                             a-wb                             a-wb
O1                                    a                                b                                c                                a                                b                                c
SF DLS  first 1.05 (P1); rise 3.60 (P3)  first 1.05 (P1); rise 3.60 (P3)  first 1.05 (P1); rise 3.60 (P3)  first 3.40 (P3); rise 3.60 (P3)  first 3.40 (P3); rise 3.60 (P3)  first 3.40 (P3); rise 3.60 (P3)
SF DMS  first 3.65 (P3); rise 4.40 (P4)  first 3.65 (P3); rise 4.40 (P4)  first 3.65 (P3); rise 4.40 (P4)  first 3.60 (P3); rise 4.00 (P3)  first 3.60 (P3); rise 4.00 (P3)  first 3.60 (P3); rise 4.00 (P3)
SF VS   first 0.60 (P1); rise 4.35 (P4)  first 0.60 (P1); rise 4.35 (P4)  first 0.60 (P1); rise 4.35 (P4)  first 3.35 (P3); rise 4.25 (P3)  first 3.35 (P3); rise 4.25 (P3)  first 4.25 (P3); rise 4.25 (P3)
DF DLS  first 1.75 (P1); rise 3.00 (P3)  first 1.75 (P1); rise 3.00 (P3)  first 1.75 (P1); rise 3.00 (P3)  first 1.75 (P1); rise 2.85 (P3)  first 1.75 (P1); rise 2.85 (P3)  first 1.75 (P1); rise 2.85 (P3)
DF DMS  first 1.05 (P1); rise 3.05 (P3)  first 1.05 (P1); rise 3.05 (P3)  first 2.20 (P2); rise 3.05 (P3)  first 2.95 (P3); rise 2.95 (P3)  first 2.95 (P3); rise 2.95 (P3)  first 2.95 (P3); rise 2.95 (P3)
DF VS   first 3.10 (P3); rise 3.10 (P3)  first 3.10 (P3); rise 3.10 (P3)  first 3.15 (P3); rise 3.15 (P3)  first 3.15 (P3); rise 3.15 (P3)  first 3.15 (P3); rise 3.15 (P3)  first 3.15 (P3); rise 3.15 (P3)
FH DLS  first 2.25 (P2); rise 3.75 (P3)  first 2.25 (P2); rise 3.75 (P3)  first 2.25 (P2); rise 3.75 (P3)  first 1.25 (P1); rise 3.75 (P3)  first 1.25 (P1); rise 3.75 (P3)  first 1.25 (P1); rise 3.65 (P3)
FH DMS  first 1.55 (P1); rise 4.45 (P4)  first 1.55 (P1); rise 4.45 (P4)  first 1.60 (P1); rise 4.40 (P4)  first 0.95 (P1); rise 3.90 (P3)  first 0.95 (P1); rise 3.90 (P3)  first 0.95 (P1); rise 4.00 (P3)
FH VS   first 1.80 (P1); rise 4.85 (P5)  first 1.80 (P1); rise 4.85 (P5)  first 1.60 (P1); rise 4.85 (P5)  first 1.20 (P1); rise 4.85 (P5)  first 1.20 (P1); rise 4.85 (P5)  first 1.20 (P1); rise 4.85 (P5)
FL DLS  first 2.85 (P3); rise 3.85 (P3)  first 2.85 (P3); rise 3.85 (P3)  first 2.85 (P3); rise 3.85 (P3)  first 1.85 (P1); rise 3.75 (P3)  first 1.85 (P1); rise 3.75 (P3)  first 1.85 (P1); rise 3.75 (P3)
FL DMS  first 0.75 (P1); rise 4.45 (P4)  first 0.75 (P1); rise 4.45 (P4)  first 0.75 (P1); rise 4.45 (P4)  first 3.90 (P3); rise 4.40 (P4)  first 3.90 (P3); rise 4.40 (P4)  first 3.90 (P3); rise 4.40 (P4)
FL VS   first 0.60 (P1); rise 4.70 (P4)  first 0.60 (P1); rise 4.70 (P4)  first 0.60 (P1); rise 4.70 (P4)  first 0.80 (P1); rise 4.65 (P4)  first 0.80 (P1); rise 4.65 (P4)  first 0.80 (P1); rise 4.70 (P4)
Neurons with each block type (deposited): {'SF': 454, 'DF': 454, 'FH': 454, 'FL': 454}
No description has been provided for this image

Result: blocked (data_missing). It depends on neuron-counts, which is blocked (data_missing), so by Author step 1.5 it is blocked for the same reason (agreed by the verifier in round 3). As tested, the criterion gives not reproduced: No reading gives the rise of DLS in Phase 3, DMS in Phase 4 and VS in Phase 5 in both fixed-choice block types: part (1) fails in all 12 rows, so in all 8 readings. With the last 20 trials pooled, all three regions start their sustained rise between 2.75 and 3.20 s, at cue onset or early in Phase 3, in single and double fixed-choice blocks. With MI per block, single fixed-choice blocks on the deposited PANs show the order (DLS 4.10 s in Phase 3, DMS 4.40 to 4.50 in Phase 4, VS 5.05 to 5.10 in Phase 5), but in double fixed-choice blocks all three rise in Phase 3 (3.20 to 3.95 s). In free-choice blocks the order DLS, DMS, VS holds in 6 of the 12 rows. In most conditions the first crossing comes in Phase 1. With the threshold from labels permuted within blocks (trials pooled) all three regions still start their rise in Phase 3 in double fixed-choice blocks (2.85 to 3.15 s).

In [42]:
rows = []
for k, comb, o1 in readings9():
    for typ in ("SF", "DF", "FH", "FL"):
        real, reg, avg, thr, _ = get9(k, typ, comb, o1)
        for w in ("E3", "E4"):
            x = real[:, iw[w]]
            md, ml = x[reg == "DMS"].mean(), x[reg == "DLS"].mean()
            p = mwu(x[reg == "DMS"], x[reg == "DLS"])
            rows.append({"set": k, "comb": comb, "O1": o1, "block": typ, "window end": w, "mean DMS": md, "mean DLS": ml,
                         "p": p, "DMS sig. above DLS": md > ml and p < .05})
r9d = pd.DataFrame(rows)
print(r9d.round(4).to_string())
print("Cases with DMS significantly above DLS:", int(r9d["DMS sig. above DLS"].sum()), "of", len(r9d))
h9d = (~r9d.groupby(["set", "comb", "O1"])["DMS sig. above DLS"].any()).rename("holds").reset_index()
print(h9d.to_string())
verdict_o1(h9d)
                  set comb O1 block window end  mean DMS  mean DLS       p  DMS sig. above DLS
0      deposited PANs    a  a    SF         E3    0.0350    0.0541  0.7253               False
1      deposited PANs    a  a    SF         E4    0.0868    0.0702  0.3892               False
2      deposited PANs    a  a    DF         E3    0.0307    0.0605  0.7373               False
3      deposited PANs    a  a    DF         E4    0.0892    0.0809  0.9600               False
4      deposited PANs    a  a    FH         E3    0.0316    0.0471  0.8889               False
5      deposited PANs    a  a    FH         E4    0.0628    0.0648  0.1530               False
6      deposited PANs    a  a    FL         E3    0.0256    0.0339  0.6462               False
7      deposited PANs    a  a    FL         E4    0.0609    0.0603  0.5852               False
8      deposited PANs    a  b    SF         E3    0.0187    0.0380  0.4569               False
9      deposited PANs    a  b    SF         E4    0.0692    0.0534  0.2992               False
10     deposited PANs    a  b    DF         E3    0.0119    0.0426  0.1577               False
11     deposited PANs    a  b    DF         E4    0.0704    0.0622  0.9328               False
12     deposited PANs    a  b    FH         E3    0.0108    0.0259  0.9195               False
13     deposited PANs    a  b    FH         E4    0.0421    0.0444  0.3101               False
14     deposited PANs    a  b    FL         E3    0.0053    0.0143  0.4218               False
15     deposited PANs    a  b    FL         E4    0.0382    0.0394  0.9979               False
16     deposited PANs    a  c    SF         E3    0.0202    0.0407  0.3481               False
17     deposited PANs    a  c    SF         E4    0.0717    0.0565  0.4339               False
18     deposited PANs    a  c    DF         E3    0.0146    0.0456  0.0850               False
19     deposited PANs    a  c    DF         E4    0.0736    0.0658  0.9308               False
20     deposited PANs    a  c    FH         E3    0.0149    0.0299  0.8168               False
21     deposited PANs    a  c    FH         E4    0.0461    0.0484  0.2947               False
22     deposited PANs    a  c    FL         E3    0.0074    0.0177  0.3172               False
23     deposited PANs    a  c    FL         E4    0.0422    0.0433  0.9323               False
24     deposited PANs    b  a    SF         E3    0.0778    0.0834  0.6389               False
25     deposited PANs    b  a    SF         E4    0.1230    0.0932  0.0888               False
26     deposited PANs    b  a    DF         E3    0.1194    0.1350  0.8333               False
27     deposited PANs    b  a    DF         E4    0.1825    0.1714  0.9343               False
28     deposited PANs    b  a    FH         E3    0.0924    0.0967  0.6828               False
29     deposited PANs    b  a    FH         E4    0.1172    0.1079  0.7963               False
30     deposited PANs    b  a    FL         E3    0.1112    0.0984  0.3229               False
31     deposited PANs    b  a    FL         E4    0.1486    0.1228  0.1212               False
32     deposited PANs    b  b    SF         E3    0.0003    0.0095  0.0591               False
33     deposited PANs    b  b    SF         E4    0.0390    0.0180  0.0192                True
34     deposited PANs    b  b    DF         E3    0.0132    0.0377  0.7520               False
35     deposited PANs    b  b    DF         E4    0.0765    0.0711  0.4233               False
36     deposited PANs    b  b    FH         E3    0.0027    0.0043  0.8828               False
37     deposited PANs    b  b    FH         E4    0.0274    0.0198  0.1270               False
38     deposited PANs    b  b    FL         E3    0.0119    0.0051  0.4537               False
39     deposited PANs    b  b    FL         E4    0.0390    0.0260  0.2335               False
40     deposited PANs    b  c    SF         E3    0.0557    0.0663  0.2950               False
41     deposited PANs    b  c    SF         E4    0.1010    0.0748  0.0825               False
42     deposited PANs    b  c    DF         E3    0.0665    0.0889  0.8899               False
43     deposited PANs    b  c    DF         E4    0.1350    0.1303  0.7008               False
44     deposited PANs    b  c    FH         E3    0.0603    0.0634  0.7726               False
45     deposited PANs    b  c    FH         E4    0.0868    0.0778  0.6089               False
46     deposited PANs    b  c    FL         E3    0.0729    0.0622  0.2430               False
47     deposited PANs    b  c    FL         E4    0.1065    0.0864  0.1301               False
48  Methods-rule PANs    a  a    SF         E3    0.0468    0.0517  0.4600               False
49  Methods-rule PANs    a  a    SF         E4    0.0738    0.0718  0.8622               False
50  Methods-rule PANs    a  a    DF         E3    0.0384    0.0632  0.9750               False
51  Methods-rule PANs    a  a    DF         E4    0.0768    0.0809  0.3689               False
52  Methods-rule PANs    a  a    FH         E3    0.0375    0.0494  0.3186               False
53  Methods-rule PANs    a  a    FH         E4    0.0573    0.0664  0.2836               False
54  Methods-rule PANs    a  a    FL         E3    0.0306    0.0351  0.8481               False
55  Methods-rule PANs    a  a    FL         E4    0.0516    0.0619  0.2931               False
56  Methods-rule PANs    a  b    SF         E3    0.0270    0.0346  0.9597               False
57  Methods-rule PANs    a  b    SF         E4    0.0539    0.0543  0.4098               False
58  Methods-rule PANs    a  b    DF         E3    0.0160    0.0437  0.1347               False
59  Methods-rule PANs    a  b    DF         E4    0.0555    0.0609  0.1604               False
60  Methods-rule PANs    a  b    FH         E3    0.0134    0.0265  0.5929               False
61  Methods-rule PANs    a  b    FH         E4    0.0347    0.0442  0.3243               False
62  Methods-rule PANs    a  b    FL         E3    0.0070    0.0144  0.6853               False
63  Methods-rule PANs    a  b    FL         E4    0.0272    0.0392  0.0734               False
64  Methods-rule PANs    a  c    SF         E3    0.0289    0.0371  0.8358               False
65  Methods-rule PANs    a  c    SF         E4    0.0561    0.0569  0.3680               False
66  Methods-rule PANs    a  c    DF         E3    0.0185    0.0466  0.1432               False
67  Methods-rule PANs    a  c    DF         E4    0.0590    0.0643  0.1306               False
68  Methods-rule PANs    a  c    FH         E3    0.0172    0.0306  0.7921               False
69  Methods-rule PANs    a  c    FH         E4    0.0378    0.0480  0.2947               False
70  Methods-rule PANs    a  c    FL         E3    0.0093    0.0175  0.4504               False
71  Methods-rule PANs    a  c    FL         E4    0.0305    0.0430  0.0726               False
72  Methods-rule PANs    b  a    SF         E3    0.0977    0.0868  0.2895               False
73  Methods-rule PANs    b  a    SF         E4    0.1225    0.1003  0.1702               False
74  Methods-rule PANs    b  a    DF         E3    0.1481    0.1447  0.2041               False
75  Methods-rule PANs    b  a    DF         E4    0.1775    0.1807  0.6991               False
76  Methods-rule PANs    b  a    FH         E3    0.1098    0.1042  0.3971               False
77  Methods-rule PANs    b  a    FH         E4    0.1260    0.1172  0.5438               False
78  Methods-rule PANs    b  a    FL         E3    0.1263    0.1118  0.2262               False
79  Methods-rule PANs    b  a    FL         E4    0.1481    0.1326  0.3551               False
80  Methods-rule PANs    b  b    SF         E3    0.0079    0.0067  0.8367               False
81  Methods-rule PANs    b  b    SF         E4    0.0277    0.0181  0.6156               False
82  Methods-rule PANs    b  b    DF         E3    0.0217    0.0373  0.9279               False
83  Methods-rule PANs    b  b    DF         E4    0.0597    0.0723  0.0430               False
84  Methods-rule PANs    b  b    FH         E3    0.0026    0.0032  0.9870               False
85  Methods-rule PANs    b  b    FH         E4    0.0239    0.0183  0.2616               False
86  Methods-rule PANs    b  b    FL         E3    0.0108    0.0094  0.7059               False
87  Methods-rule PANs    b  b    FL         E4    0.0267    0.0246  0.7202               False
88  Methods-rule PANs    b  c    SF         E3    0.0729    0.0679  0.5235               False
89  Methods-rule PANs    b  c    SF         E4    0.0968    0.0796  0.3206               False
90  Methods-rule PANs    b  c    DF         E3    0.0810    0.0927  0.7557               False
91  Methods-rule PANs    b  c    DF         E4    0.1178    0.1331  0.1219               False
92  Methods-rule PANs    b  c    FH         E3    0.0692    0.0651  0.4792               False
93  Methods-rule PANs    b  c    FH         E4    0.0889    0.0817  0.5608               False
94  Methods-rule PANs    b  c    FL         E3    0.0780    0.0709  0.5565               False
95  Methods-rule PANs    b  c    FL         E4    0.0987    0.0900  0.6621               False
Cases with DMS significantly above DLS: 1 of 96
                  set comb O1  holds
0   Methods-rule PANs    a  a   True
1   Methods-rule PANs    a  b   True
2   Methods-rule PANs    a  c   True
3   Methods-rule PANs    b  a   True
4   Methods-rule PANs    b  b   True
5   Methods-rule PANs    b  c   True
6      deposited PANs    a  a   True
7      deposited PANs    a  b   True
8      deposited PANs    a  c   True
9      deposited PANs    b  a   True
10     deposited PANs    b  b  False
11     deposited PANs    b  c   True
Holds in 7 of 8 readings (O1 a and b): blocked: the readings disagree; Panzeri-Treves variant (c): holds in 4 of 4

Result: blocked (methods_underspecified). Of the 96 tests (both unit sets, both block combinations, O1 a, b and the Panzeri-Treves variant, four block types, two windows), one shows DMS significantly above DLS: deposited PANs, MI per block, shuffle-corrected MI (O1 b), single fixed-choice blocks, window ending at E4 (0.039 against 0.018 bits/s, p = 0.019). That reading fails and the other 7 of the 8 readings hold. The criterion counts any of the eight tests of a reading at p < 0.05 without correction, so one test near chance decides the outcome; this is asked of a reader (questions/001642.yaml).

fig10a-dls-fixed-above-free, fig10b-dms-fixed-above-free, fig10c-vs-no-fixed-free-difference¶

Windows: the 500 ms ending at E3 (end of Phase 3) and at E4 (end of Phase 4); the 500 ms ending at E2 is shown as a variant for "500 ms before cue presentation". Fixed is SF and DF, free is FH and FL, combined (a) as the per-neuron mean of the two block types or (b) with the trials pooled (for block-combination reading b, pooled means all SF and DF blocks averaged). Test: (a) Wilcoxon signed-rank over neurons (paired), (b) Mann-Whitney U (unpaired).

In [43]:
def fixed_free(k, comb, o1, region, how):
    if how == "mean":
        A = [get9(k, t, comb, o1) for t in ("SF", "DF", "FH", "FL")]
        reg = A[0][1]
        fx = (A[0][0] + A[1][0]) / 2; fr = (A[2][0] + A[3][0]) / 2
    else:
        a, b = get9(k, "FIX", comb, o1), get9(k, "FREE", comb, o1)
        reg = a[1]; fx, fr = a[0], b[0]
    m = reg == region
    return fx[m], fr[m]

def fig10_rows(region):
    rows = []
    for k, comb, o1 in readings9():
        for how in ("mean", "pooled"):
            for w in ("E3", "E4", "E2"):
                fx, fr = fixed_free(k, comb, o1, region, how)
                x, y = fx[:, iw[w]], fr[:, iw[w]]
                pw = stats.wilcoxon(x, y).pvalue; pm = mwu(x, y)
                rows.append({"set": k, "comb": comb, "O1": o1, "fixed/free": how, "window end": w, "n": len(x),
                             "mean fixed": x.mean(), "mean free": y.mean(), "p Wilcoxon": pw, "p MWU": pm})
    return pd.DataFrame(rows)
In [44]:
r10a = fig10_rows("DLS")
print(r10a.round(5).to_string())
main = r10a[r10a["window end"] != "E2"]
rows = []
for k, comb, o1 in readings9():
    cr, cs, pk = {}, {}, {}
    for typ in ("SF", "DF", "FH", "FL"):
        real, reg, avg, thr, _ = get9(k, typ, comb, o1)
        f, s = rise(avg["DLS"], thr["DLS"])
        cr[typ] = T_END[f] if f is not None else np.nan
        cs[typ] = T_END[s] if s is not None else np.nan
        m34 = (PH_END == 3) | (PH_END == 4)
        pk[typ] = avg["DLS"][:len(SLW)][m34].max()
    rows.append({"set": k, "comb": comb, "O1": o1, **{f"first {t}": cr[t] for t in cr}, **{f"rise {t}": cs[t] for t in cs},
                 **{f"peak P3-4 {t}": round(pk[t], 3) for t in pk},
                 "order (first crossing)": min(cr["SF"], cr["DF"]) < cr["FH"] < cr["FL"],
                 "order (sustained rise, variant)": min(cs["SF"], cs["DF"]) < cs["FH"] < cs["FL"],
                 "FL peak lowest": pk["FL"] == min(pk.values())})
ordr = pd.DataFrame(rows)
print(ordr.to_string())
def fig10_holds(main, absence=False, order=None):
    """One row per reading: unit set, block combination, O1, fixed/free combination and test."""
    rows = []
    for (k, comb, o1, how), d in main.groupby(["set", "comb", "O1", "fixed/free"]):
        for test, col in (("Wilcoxon", "p Wilcoxon"), ("MWU", "p MWU")):
            row = {"set": k, "comb": comb, "O1": o1, "fixed/free": how, "test": test}
            if absence:
                row["holds"] = not bool((d[col] < .05).any())
            else:
                row["fixed > free, both windows"] = bool(((d["mean fixed"] > d["mean free"]) & (d[col] < .05)).all())
                row["holds"] = row["fixed > free, both windows"]
                if order is not None:
                    o = order[(order.set == k) & (order.comb == comb) & (order.O1 == o1)].iloc[0]
                    row["order"] = o["order (first crossing)"]; row["FL peak lowest"] = o["FL peak lowest"]
                    row["holds"] = row["holds"] and row["order"] and row["FL peak lowest"]
            rows.append(row)
    return pd.DataFrame(rows)
h10a = fig10_holds(main, order=ordr)
print(h10a.to_string())
verdict_o1(h10a)
                  set comb O1 fixed/free window end    n  mean fixed  mean free  p Wilcoxon    p MWU
0      deposited PANs    a  a       mean         E3  204     0.05732    0.04052     0.26813  0.78914
1      deposited PANs    a  a       mean         E4  204     0.07555    0.06257     0.11142  0.65176
2      deposited PANs    a  a       mean         E2  204     0.02279    0.02991     0.00799  0.01236
3      deposited PANs    a  a     pooled         E3  204     0.04728    0.02960     0.02219  0.29410
4      deposited PANs    a  a     pooled         E4  204     0.06380    0.04831     0.06688  0.53327
5      deposited PANs    a  a     pooled         E2  204     0.01116    0.01727     0.00668  0.02900
6      deposited PANs    a  b       mean         E3  204     0.04028    0.02010     0.00982  0.06838
7      deposited PANs    a  b       mean         E4  204     0.05778    0.04188     0.01298  0.12266
8      deposited PANs    a  b       mean         E2  204     0.00279    0.00506     0.63654  0.85509
9      deposited PANs    a  b     pooled         E3  204     0.03888    0.01927     0.00061  0.01282
10     deposited PANs    a  b     pooled         E4  204     0.05510    0.03795     0.00689  0.05753
11     deposited PANs    a  b     pooled         E2  204     0.00122    0.00515     0.21859  0.71117
12     deposited PANs    a  c       mean         E3  204     0.04313    0.02381     0.03864  0.09549
13     deposited PANs    a  c       mean         E4  204     0.06119    0.04585     0.02890  0.19672
14     deposited PANs    a  c       mean         E2  204     0.00479    0.00800     0.38240  0.58609
15     deposited PANs    a  c     pooled         E3  204     0.03974    0.02044     0.00159  0.02094
16     deposited PANs    a  c     pooled         E4  204     0.05604    0.03925     0.01577  0.06581
17     deposited PANs    a  c     pooled         E2  204     0.00164    0.00603     0.13769  0.49113
18     deposited PANs    b  a       mean         E3  204     0.10916    0.09756     0.61050  0.95012
19     deposited PANs    b  a       mean         E4  204     0.13230    0.11536     0.01766  0.51062
20     deposited PANs    b  a       mean         E2  204     0.11312    0.12132     0.04633  0.43167
21     deposited PANs    b  a     pooled         E3  204     0.10737    0.09761     0.82009  0.94611
22     deposited PANs    b  a     pooled         E4  204     0.12975    0.11549     0.03509  0.60178
23     deposited PANs    b  a     pooled         E2  204     0.11242    0.12150     0.02517  0.38644
24     deposited PANs    b  b       mean         E3  204     0.02362    0.00468     0.01824  0.05836
25     deposited PANs    b  b       mean         E4  204     0.04455    0.02287     0.00065  0.00969
26     deposited PANs    b  b       mean         E2  204     0.00443    0.00154     0.72232  0.91008
27     deposited PANs    b  b     pooled         E3  204     0.02262    0.00503     0.01901  0.05403
28     deposited PANs    b  b     pooled         E4  204     0.04269    0.02256     0.00067  0.00724
29     deposited PANs    b  b     pooled         E2  204     0.00425    0.00151     0.79989  0.86895
30     deposited PANs    b  c       mean         E3  204     0.07759    0.06282     0.29015  0.74681
31     deposited PANs    b  c       mean         E4  204     0.10255    0.08209     0.00692  0.22135
32     deposited PANs    b  c       mean         E2  204     0.06491    0.07278     0.05191  0.30546
33     deposited PANs    b  c     pooled         E3  204     0.07697    0.06286     0.30331  0.72908
34     deposited PANs    b  c     pooled         E4  204     0.10099    0.08221     0.00894  0.20984
35     deposited PANs    b  c     pooled         E2  204     0.06586    0.07294     0.07085  0.39013
36  Methods-rule PANs    a  a       mean         E3  183     0.05745    0.04228     0.26188  0.61465
37  Methods-rule PANs    a  a       mean         E4  183     0.07637    0.06416     0.02507  0.20951
38  Methods-rule PANs    a  a       mean         E2  183     0.02432    0.03311     0.00662  0.01069
39  Methods-rule PANs    a  a     pooled         E3  183     0.04715    0.03117     0.06032  0.34181
40  Methods-rule PANs    a  a     pooled         E4  183     0.06287    0.04948     0.02450  0.23670
41  Methods-rule PANs    a  a     pooled         E2  183     0.01164    0.01933     0.00215  0.01067
42  Methods-rule PANs    a  b       mean         E3  183     0.03914    0.02042     0.01364  0.02902
43  Methods-rule PANs    a  b       mean         E4  183     0.05759    0.04167     0.00205  0.01168
44  Methods-rule PANs    a  b       mean         E2  183     0.00289    0.00627     0.69245  0.99172
45  Methods-rule PANs    a  b     pooled         E3  183     0.03807    0.02011     0.00575  0.05952
46  Methods-rule PANs    a  b     pooled         E4  183     0.05381    0.03843     0.00154  0.01436
47  Methods-rule PANs    a  b     pooled         E2  183     0.00085    0.00645     0.05259  0.32796
48  Methods-rule PANs    a  c       mean         E3  183     0.04184    0.02405     0.03738  0.06807
49  Methods-rule PANs    a  c       mean         E4  183     0.06060    0.04552     0.00407  0.02949
50  Methods-rule PANs    a  c       mean         E2  183     0.00476    0.00905     0.41551  0.65193
51  Methods-rule PANs    a  c     pooled         E3  183     0.03887    0.02129     0.01115  0.07450
52  Methods-rule PANs    a  c     pooled         E4  183     0.05448    0.03964     0.00465  0.02583
53  Methods-rule PANs    a  c     pooled         E2  183     0.00137    0.00710     0.06354  0.30412
54  Methods-rule PANs    b  a       mean         E3  183     0.11578    0.10801     0.94334  0.90561
55  Methods-rule PANs    b  a       mean         E4  183     0.14052    0.12490     0.04767  0.45386
56  Methods-rule PANs    b  a       mean         E2  183     0.12453    0.13655     0.00746  0.17269
57  Methods-rule PANs    b  a     pooled         E3  183     0.11378    0.10812     0.79332  0.78507
58  Methods-rule PANs    b  a     pooled         E4  183     0.13783    0.12499     0.08448  0.55327
59  Methods-rule PANs    b  a     pooled         E2  183     0.12386    0.13677     0.00404  0.15563
60  Methods-rule PANs    b  b       mean         E3  183     0.02198    0.00631     0.04231  0.21458
61  Methods-rule PANs    b  b       mean         E4  183     0.04522    0.02145     0.00022  0.00318
62  Methods-rule PANs    b  b       mean         E2  183     0.00612    0.00311     0.75915  0.90875
63  Methods-rule PANs    b  b     pooled         E3  183     0.02117    0.00587     0.03131  0.16088
64  Methods-rule PANs    b  b     pooled         E4  183     0.04302    0.02256     0.00074  0.00598
65  Methods-rule PANs    b  b     pooled         E2  183     0.00635    0.00319     0.62375  0.95666
66  Methods-rule PANs    b  c       mean         E3  183     0.08029    0.06797     0.33069  0.87594
67  Methods-rule PANs    b  c       mean         E4  183     0.10633    0.08588     0.00989  0.16686
68  Methods-rule PANs    b  c       mean         E2  183     0.07115    0.08196     0.01672  0.09494
69  Methods-rule PANs    b  c     pooled         E3  183     0.07965    0.06807     0.37170  0.88373
70  Methods-rule PANs    b  c     pooled         E4  183     0.10478    0.08597     0.01327  0.16236
71  Methods-rule PANs    b  c     pooled         E2  183     0.07238    0.08217     0.02567  0.14968
                  set comb O1  first SF  first DF  first FH  first FL  rise SF  rise DF  rise FH  rise FL  peak P3-4 SF  peak P3-4 DF  peak P3-4 FH  peak P3-4 FL  order (first crossing)  order (sustained rise, variant)  FL peak lowest
0      deposited PANs    a  a      1.00      2.80      0.75      0.50     2.85     2.80     2.15     3.75         0.067         0.076         0.061         0.055                   False                            False            True
1      deposited PANs    a  b      1.00      2.80      0.75      0.50     2.85     2.80     2.15     3.75         0.050         0.057         0.040         0.034                   False                            False            True
2      deposited PANs    a  c      1.00      2.75      0.75      0.50     2.85     2.75     2.15     3.75         0.054         0.061         0.044         0.037                   False                            False            True
3      deposited PANs    b  a      0.65      0.50      2.10      3.35     4.10     3.40     4.30     4.40         0.106         0.164         0.119         0.126                    True                             True           False
4      deposited PANs    b  b      0.65      0.50      2.10      3.35     4.10     3.40     4.30     4.40         0.015         0.063         0.020         0.027                    True                             True           False
5      deposited PANs    b  c      0.65      0.50      2.10      3.65     4.10     3.40     4.30     4.40         0.079         0.122         0.079         0.088                    True                             True           False
6   Methods-rule PANs    a  a      1.00      2.85      0.75      0.50     2.85     3.00     1.10     2.35         0.068         0.076         0.065         0.057                   False                            False            True
7   Methods-rule PANs    a  b      1.00      2.85      0.75      0.50     2.85     3.00     1.10     2.35         0.050         0.056         0.043         0.034                   False                            False            True
8   Methods-rule PANs    a  c      1.05      2.85      0.75      0.50     2.85     3.00     1.10     2.60         0.053         0.059         0.047         0.038                   False                            False            True
9   Methods-rule PANs    b  a      1.20      0.50      1.20      3.35     4.25     3.40     4.40     4.40         0.116         0.173         0.131         0.142                    True                            False           False
10  Methods-rule PANs    b  b      1.20      0.50      1.20      3.35     4.25     3.40     4.40     4.40         0.015         0.065         0.019         0.024                    True                            False           False
11  Methods-rule PANs    b  c      1.20      0.50      1.20      3.35     4.25     3.40     4.40     4.65         0.087         0.125         0.083         0.091                    True                             True           False
                  set comb O1 fixed/free      test  fixed > free, both windows  holds  order  FL peak lowest
0   Methods-rule PANs    a  a       mean  Wilcoxon                       False  False  False            True
1   Methods-rule PANs    a  a       mean       MWU                       False  False  False            True
2   Methods-rule PANs    a  a     pooled  Wilcoxon                       False  False  False            True
3   Methods-rule PANs    a  a     pooled       MWU                       False  False  False            True
4   Methods-rule PANs    a  b       mean  Wilcoxon                        True  False  False            True
5   Methods-rule PANs    a  b       mean       MWU                        True  False  False            True
6   Methods-rule PANs    a  b     pooled  Wilcoxon                        True  False  False            True
7   Methods-rule PANs    a  b     pooled       MWU                       False  False  False            True
8   Methods-rule PANs    a  c       mean  Wilcoxon                        True  False  False            True
9   Methods-rule PANs    a  c       mean       MWU                       False  False  False            True
10  Methods-rule PANs    a  c     pooled  Wilcoxon                        True  False  False            True
11  Methods-rule PANs    a  c     pooled       MWU                       False  False  False            True
12  Methods-rule PANs    b  a       mean  Wilcoxon                       False  False   True           False
13  Methods-rule PANs    b  a       mean       MWU                       False  False   True           False
14  Methods-rule PANs    b  a     pooled  Wilcoxon                       False  False   True           False
15  Methods-rule PANs    b  a     pooled       MWU                       False  False   True           False
16  Methods-rule PANs    b  b       mean  Wilcoxon                        True  False   True           False
17  Methods-rule PANs    b  b       mean       MWU                       False  False   True           False
18  Methods-rule PANs    b  b     pooled  Wilcoxon                        True  False   True           False
19  Methods-rule PANs    b  b     pooled       MWU                       False  False   True           False
20  Methods-rule PANs    b  c       mean  Wilcoxon                       False  False   True           False
21  Methods-rule PANs    b  c       mean       MWU                       False  False   True           False
22  Methods-rule PANs    b  c     pooled  Wilcoxon                       False  False   True           False
23  Methods-rule PANs    b  c     pooled       MWU                       False  False   True           False
24     deposited PANs    a  a       mean  Wilcoxon                       False  False  False            True
25     deposited PANs    a  a       mean       MWU                       False  False  False            True
26     deposited PANs    a  a     pooled  Wilcoxon                       False  False  False            True
27     deposited PANs    a  a     pooled       MWU                       False  False  False            True
28     deposited PANs    a  b       mean  Wilcoxon                        True  False  False            True
29     deposited PANs    a  b       mean       MWU                       False  False  False            True
30     deposited PANs    a  b     pooled  Wilcoxon                        True  False  False            True
31     deposited PANs    a  b     pooled       MWU                       False  False  False            True
32     deposited PANs    a  c       mean  Wilcoxon                        True  False  False            True
33     deposited PANs    a  c       mean       MWU                       False  False  False            True
34     deposited PANs    a  c     pooled  Wilcoxon                        True  False  False            True
35     deposited PANs    a  c     pooled       MWU                       False  False  False            True
36     deposited PANs    b  a       mean  Wilcoxon                       False  False   True           False
37     deposited PANs    b  a       mean       MWU                       False  False   True           False
38     deposited PANs    b  a     pooled  Wilcoxon                       False  False   True           False
39     deposited PANs    b  a     pooled       MWU                       False  False   True           False
40     deposited PANs    b  b       mean  Wilcoxon                        True  False   True           False
41     deposited PANs    b  b       mean       MWU                       False  False   True           False
42     deposited PANs    b  b     pooled  Wilcoxon                        True  False   True           False
43     deposited PANs    b  b     pooled       MWU                       False  False   True           False
44     deposited PANs    b  c       mean  Wilcoxon                       False  False   True           False
45     deposited PANs    b  c       mean       MWU                       False  False   True           False
46     deposited PANs    b  c     pooled  Wilcoxon                       False  False   True           False
47     deposited PANs    b  c     pooled       MWU                       False  False   True           False
Holds in 0 of 32 readings (O1 a and b): not reproduced; Panzeri-Treves variant (c): holds in 0 of 16

Result: blocked (data_missing). It depends on fig9-temporal-order-all-blocks and through it on neuron-counts, which is blocked (data_missing), so by Author step 1.5 it is blocked for the same reason (agreed by the verifier in round 3). As tested, the criterion gives not reproduced: No reading holds (0 of 32). With MI per block the first crossings come in the order SF or DF (0.50 s), FH (1.20 to 2.10), FL (3.35 to 3.65), but the FL peak in Phases 3 and 4 is not the lowest of the four (for example FL 0.126 against SF 0.106 bits/s, deposited PANs, O1 a). With the last 20 trials pooled FL's peak is the lowest, but FL and FH cross first (FL 0.50 s, FH 0.75, SF 1.00 to 1.05, DF 2.75 to 2.85). Fixed above free in both windows holds only under O1 (b), with the Wilcoxon test (and on the Methods-rule set once with the Mann-Whitney test), and in the Panzeri-Treves variant with the Wilcoxon test, which decides nothing; under O1 (a) the window ending at E3 gives Wilcoxon p = 0.27 (deposited PANs, trials pooled, mean of block types). The order by sustained rise, shown as a variant, fails in 8 of the 12 rows.

In [45]:
r10b = fig10_rows("DMS")
print(r10b.round(5).to_string())
main = r10b[r10b["window end"] != "E2"]
h10b = fig10_holds(main)
print(h10b.to_string())
verdict_o1(h10b)
                  set comb O1 fixed/free window end    n  mean fixed  mean free  p Wilcoxon    p MWU
0      deposited PANs    a  a       mean         E3  112     0.03282    0.02860     0.98929  0.57982
1      deposited PANs    a  a       mean         E4  112     0.08799    0.06183     0.02052  0.54437
2      deposited PANs    a  a       mean         E2  112     0.01846    0.02593     0.00635  0.03292
3      deposited PANs    a  a     pooled         E3  112     0.02469    0.01583     0.19607  0.73834
4      deposited PANs    a  a     pooled         E4  112     0.07798    0.04698     0.00125  0.17386
5      deposited PANs    a  a     pooled         E2  112     0.00921    0.01467     0.02736  0.10574
6      deposited PANs    a  b       mean         E3  112     0.01531    0.00805     0.22654  0.77678
7      deposited PANs    a  b       mean         E4  112     0.06981    0.04018     0.00160  0.09127
8      deposited PANs    a  b       mean         E2  112     0.00099    0.00513     0.18079  0.31035
9      deposited PANs    a  b     pooled         E3  112     0.01616    0.00591     0.05459  0.14291
10     deposited PANs    a  b     pooled         E4  112     0.06912    0.03614     0.00011  0.01937
11     deposited PANs    a  b     pooled         E2  112     0.00053    0.00433     0.32219  0.65158
12     deposited PANs    a  c       mean         E3  112     0.01742    0.01115     0.39618  0.96464
13     deposited PANs    a  c       mean         E4  112     0.07267    0.04415     0.00477  0.17617
14     deposited PANs    a  c       mean         E2  112     0.00305    0.00854     0.03928  0.07721
15     deposited PANs    a  c     pooled         E3  112     0.01673    0.00678     0.07924  0.17583
16     deposited PANs    a  c     pooled         E4  112     0.06998    0.03752     0.00026  0.02047
17     deposited PANs    a  c     pooled         E2  112     0.00120    0.00526     0.22494  0.66351
18     deposited PANs    b  a       mean         E3  112     0.09856    0.10181     0.37748  0.59974
19     deposited PANs    b  a       mean         E4  112     0.15271    0.13290     0.13949  0.86979
20     deposited PANs    b  a       mean         E2  112     0.09415    0.10289     0.10155  0.52604
21     deposited PANs    b  a     pooled         E3  112     0.09747    0.10192     0.30958  0.57701
22     deposited PANs    b  a     pooled         E4  112     0.15090    0.13293     0.17518  0.92034
23     deposited PANs    b  a     pooled         E2  112     0.09365    0.10281     0.08674  0.49426
24     deposited PANs    b  b       mean         E3  112     0.00673    0.00734     0.74947  0.47239
25     deposited PANs    b  b       mean         E4  112     0.05772    0.03317     0.03712  0.46732
26     deposited PANs    b  b       mean         E2  112     0.00336    0.00847     0.42804  0.43999
27     deposited PANs    b  b     pooled         E3  112     0.00657    0.00678     0.80060  0.58407
28     deposited PANs    b  b     pooled         E4  112     0.05648    0.03242     0.04213  0.37250
29     deposited PANs    b  b     pooled         E2  112     0.00401    0.00888     0.34542  0.41833
30     deposited PANs    b  c       mean         E3  112     0.06105    0.06658     0.21944  0.30400
31     deposited PANs    b  c       mean         E4  112     0.11803    0.09667     0.09166  0.72207
32     deposited PANs    b  c       mean         E2  112     0.05820    0.06648     0.13871  0.36046
33     deposited PANs    b  c     pooled         E3  112     0.06114    0.06663     0.20250  0.36155
34     deposited PANs    b  c     pooled         E4  112     0.11717    0.09658     0.09222  0.68686
35     deposited PANs    b  c     pooled         E2  112     0.05865    0.06636     0.15403  0.40308
36  Methods-rule PANs    a  a       mean         E3  147     0.04261    0.03405     0.63923  0.76068
37  Methods-rule PANs    a  a       mean         E4  147     0.07529    0.05445     0.05434  0.37766
38  Methods-rule PANs    a  a       mean         E2  147     0.02140    0.02768     0.01889  0.14116
39  Methods-rule PANs    a  a     pooled         E3  147     0.03109    0.01888     0.26015  0.71616
40  Methods-rule PANs    a  a     pooled         E4  147     0.06185    0.03917     0.00526  0.21894
41  Methods-rule PANs    a  a     pooled         E2  147     0.01022    0.01475     0.01099  0.08263
42  Methods-rule PANs    a  b       mean         E3  147     0.02151    0.01018     0.16317  0.47599
43  Methods-rule PANs    a  b       mean         E4  147     0.05471    0.03096     0.00600  0.06741
44  Methods-rule PANs    a  b       mean         E2  147     0.00045    0.00448     0.13905  0.47218
45  Methods-rule PANs    a  b     pooled         E3  147     0.02086    0.00740     0.06984  0.13550
46  Methods-rule PANs    a  b     pooled         E4  147     0.05187    0.02706     0.00019  0.02167
47  Methods-rule PANs    a  b     pooled         E2  147    -0.00001    0.00330     0.20391  0.44925
48  Methods-rule PANs    a  c       mean         E3  147     0.02370    0.01323     0.21333  0.57516
49  Methods-rule PANs    a  c       mean         E4  147     0.05755    0.03417     0.00956  0.10634
50  Methods-rule PANs    a  c       mean         E2  147     0.00280    0.00721     0.09027  0.25422
51  Methods-rule PANs    a  c     pooled         E3  147     0.02136    0.00809     0.08153  0.15203
52  Methods-rule PANs    a  c     pooled         E4  147     0.05261    0.02834     0.00046  0.03939
53  Methods-rule PANs    a  c     pooled         E2  147     0.00061    0.00396     0.20322  0.37878
54  Methods-rule PANs    b  a       mean         E3  147     0.12288    0.11807     0.89997  0.96717
55  Methods-rule PANs    b  a       mean         E4  147     0.15000    0.13707     0.22980  0.89196
56  Methods-rule PANs    b  a       mean         E2  147     0.10686    0.11425     0.09630  0.41823
57  Methods-rule PANs    b  a     pooled         E3  147     0.12108    0.11814     0.73214  0.97264
58  Methods-rule PANs    b  a     pooled         E4  147     0.14825    0.13691     0.28316  0.93112
59  Methods-rule PANs    b  a     pooled         E2  147     0.10597    0.11411     0.05937  0.37396
60  Methods-rule PANs    b  b       mean         E3  147     0.01481    0.00671     0.17523  0.30412
61  Methods-rule PANs    b  b       mean         E4  147     0.04372    0.02528     0.04514  0.47726
62  Methods-rule PANs    b  b       mean         E2  147     0.00263    0.00612     0.47311  0.46460
63  Methods-rule PANs    b  b     pooled         E3  147     0.01453    0.00700     0.15692  0.27841
64  Methods-rule PANs    b  b     pooled         E4  147     0.04260    0.02520     0.02959  0.39040
65  Methods-rule PANs    b  b     pooled         E2  147     0.00322    0.00603     0.46009  0.56074
66  Methods-rule PANs    b  c       mean         E3  147     0.07697    0.07361     0.84515  0.97154
67  Methods-rule PANs    b  c       mean         E4  147     0.10727    0.09380     0.20598  0.84553
68  Methods-rule PANs    b  c       mean         E2  147     0.06300    0.07011     0.20529  0.26465
69  Methods-rule PANs    b  c     pooled         E3  147     0.07699    0.07363     0.83155  0.93657
70  Methods-rule PANs    b  c     pooled         E4  147     0.10696    0.09355     0.18465  0.72130
71  Methods-rule PANs    b  c     pooled         E2  147     0.06355    0.06994     0.22756  0.32524
                  set comb O1 fixed/free      test  fixed > free, both windows  holds
0   Methods-rule PANs    a  a       mean  Wilcoxon                       False  False
1   Methods-rule PANs    a  a       mean       MWU                       False  False
2   Methods-rule PANs    a  a     pooled  Wilcoxon                       False  False
3   Methods-rule PANs    a  a     pooled       MWU                       False  False
4   Methods-rule PANs    a  b       mean  Wilcoxon                       False  False
5   Methods-rule PANs    a  b       mean       MWU                       False  False
6   Methods-rule PANs    a  b     pooled  Wilcoxon                       False  False
7   Methods-rule PANs    a  b     pooled       MWU                       False  False
8   Methods-rule PANs    a  c       mean  Wilcoxon                       False  False
9   Methods-rule PANs    a  c       mean       MWU                       False  False
10  Methods-rule PANs    a  c     pooled  Wilcoxon                       False  False
11  Methods-rule PANs    a  c     pooled       MWU                       False  False
12  Methods-rule PANs    b  a       mean  Wilcoxon                       False  False
13  Methods-rule PANs    b  a       mean       MWU                       False  False
14  Methods-rule PANs    b  a     pooled  Wilcoxon                       False  False
15  Methods-rule PANs    b  a     pooled       MWU                       False  False
16  Methods-rule PANs    b  b       mean  Wilcoxon                       False  False
17  Methods-rule PANs    b  b       mean       MWU                       False  False
18  Methods-rule PANs    b  b     pooled  Wilcoxon                       False  False
19  Methods-rule PANs    b  b     pooled       MWU                       False  False
20  Methods-rule PANs    b  c       mean  Wilcoxon                       False  False
21  Methods-rule PANs    b  c       mean       MWU                       False  False
22  Methods-rule PANs    b  c     pooled  Wilcoxon                       False  False
23  Methods-rule PANs    b  c     pooled       MWU                       False  False
24     deposited PANs    a  a       mean  Wilcoxon                       False  False
25     deposited PANs    a  a       mean       MWU                       False  False
26     deposited PANs    a  a     pooled  Wilcoxon                       False  False
27     deposited PANs    a  a     pooled       MWU                       False  False
28     deposited PANs    a  b       mean  Wilcoxon                       False  False
29     deposited PANs    a  b       mean       MWU                       False  False
30     deposited PANs    a  b     pooled  Wilcoxon                       False  False
31     deposited PANs    a  b     pooled       MWU                       False  False
32     deposited PANs    a  c       mean  Wilcoxon                       False  False
33     deposited PANs    a  c       mean       MWU                       False  False
34     deposited PANs    a  c     pooled  Wilcoxon                       False  False
35     deposited PANs    a  c     pooled       MWU                       False  False
36     deposited PANs    b  a       mean  Wilcoxon                       False  False
37     deposited PANs    b  a       mean       MWU                       False  False
38     deposited PANs    b  a     pooled  Wilcoxon                       False  False
39     deposited PANs    b  a     pooled       MWU                       False  False
40     deposited PANs    b  b       mean  Wilcoxon                       False  False
41     deposited PANs    b  b       mean       MWU                       False  False
42     deposited PANs    b  b     pooled  Wilcoxon                       False  False
43     deposited PANs    b  b     pooled       MWU                       False  False
44     deposited PANs    b  c       mean  Wilcoxon                       False  False
45     deposited PANs    b  c       mean       MWU                       False  False
46     deposited PANs    b  c     pooled  Wilcoxon                       False  False
47     deposited PANs    b  c     pooled       MWU                       False  False
Holds in 0 of 32 readings (O1 a and b): not reproduced; Panzeri-Treves variant (c): holds in 0 of 16

Result: blocked (data_missing). It depends on fig9-temporal-order-all-blocks and through it on neuron-counts, which is blocked (data_missing), so by Author step 1.5 it is blocked for the same reason (agreed by the verifier in round 3). As tested, the criterion gives not reproduced: No reading holds (0 of 32). At the window ending at E4 fixed exceeds free with the Wilcoxon test in most readings (trials pooled, O1 a: 0.078 against 0.047 bits/s, p = 0.0013, deposited PANs), but at the window ending at E3 no reading gives p < 0.05 (smallest Wilcoxon p 0.055, deposited PANs, O1 b, trials pooled; Mann-Whitney p 0.135 or more).

In [46]:
r10c = fig10_rows("VS")
print(r10c.round(5).to_string())
main = r10c[r10c["window end"] != "E2"]
h10c = fig10_holds(main, absence=True)
print(h10c.to_string())
verdict_o1(h10c)
rows = []
for k, comb, o1 in readings9():
    row = {"set": k, "comb": comb, "O1": o1}
    for typ in ("SF", "DF", "FH", "FL"):
        real, reg, avg, thr, _ = get9(k, typ, comb, o1)
        m3 = PH_END == 3
        a = avg["VS"][:len(SLW)][m3]; t = thr["VS"][:len(SLW)][m3]
        row[f"{typ} P3 bins above"] = int((a > t).sum()); row[f"{typ} P3 peak"] = round(a.max(), 3)
    rows.append(row)
print("VS region average in Phase 3 (window ends in Phase 3):")
print(pd.DataFrame(rows).to_string())
                  set comb O1 fixed/free window end    n  mean fixed  mean free  p Wilcoxon    p MWU
0      deposited PANs    a  a       mean         E3  138     0.03028    0.02982     0.93920  0.65582
1      deposited PANs    a  a       mean         E4  138     0.03334    0.03134     0.85247  0.84869
2      deposited PANs    a  a       mean         E2  138     0.02033    0.03185     0.00019  0.00353
3      deposited PANs    a  a     pooled         E3  138     0.01979    0.01804     0.63478  0.85519
4      deposited PANs    a  a     pooled         E4  138     0.02207    0.02044     0.58256  0.91053
5      deposited PANs    a  a     pooled         E2  138     0.01002    0.01619     0.00541  0.03339
6      deposited PANs    a  b       mean         E3  138     0.01189    0.01015     0.68864  0.84691
7      deposited PANs    a  b       mean         E4  138     0.01695    0.01244     0.36134  0.68883
8      deposited PANs    a  b       mean         E2  138     0.00118    0.01029     0.00247  0.01721
9      deposited PANs    a  b     pooled         E3  138     0.01067    0.00784     0.24892  0.34624
10     deposited PANs    a  b     pooled         E4  138     0.01381    0.01081     0.24442  0.49300
11     deposited PANs    a  b     pooled         E2  138     0.00067    0.00561     0.09976  0.19176
12     deposited PANs    a  c       mean         E3  138     0.01520    0.01388     0.77424  0.80288
13     deposited PANs    a  c       mean         E4  138     0.01971    0.01655     0.62572  0.83571
14     deposited PANs    a  c       mean         E2  138     0.00346    0.01351     0.00127  0.00761
15     deposited PANs    a  c     pooled         E3  138     0.01172    0.00926     0.35027  0.45988
16     deposited PANs    a  c     pooled         E4  138     0.01453    0.01217     0.39070  0.62879
17     deposited PANs    a  c     pooled         E2  138     0.00125    0.00630     0.06994  0.12787
18     deposited PANs    b  a       mean         E3  138     0.09964    0.08632     0.00274  0.18618
19     deposited PANs    b  a       mean         E4  138     0.09384    0.09490     0.92803  0.92370
20     deposited PANs    b  a       mean         E2  138     0.10010    0.10312     0.52582  0.80872
21     deposited PANs    b  a     pooled         E3  138     0.09789    0.08634     0.00546  0.22556
22     deposited PANs    b  a     pooled         E4  138     0.09269    0.09498     0.72026  0.99579
23     deposited PANs    b  a     pooled         E2  138     0.09903    0.10319     0.36809  0.71118
24     deposited PANs    b  b       mean         E3  138     0.00860   -0.00003     0.01858  0.04575
25     deposited PANs    b  b       mean         E4  138     0.01252    0.01010     0.40179  0.40467
26     deposited PANs    b  b       mean         E2  138     0.00211    0.00164     0.92634  0.78660
27     deposited PANs    b  b     pooled         E3  138     0.00832   -0.00000     0.02461  0.08486
28     deposited PANs    b  b     pooled         E4  138     0.01179    0.01026     0.46667  0.60335
29     deposited PANs    b  b     pooled         E2  138     0.00117    0.00151     0.76200  0.97654
30     deposited PANs    b  c       mean         E3  138     0.06556    0.05313     0.02381  0.26664
31     deposited PANs    b  c       mean         E4  138     0.06331    0.06269     0.78805  0.89381
32     deposited PANs    b  c       mean         E2  138     0.06013    0.06257     0.45248  0.45486
33     deposited PANs    b  c     pooled         E3  138     0.06506    0.05318     0.03260  0.26925
34     deposited PANs    b  c     pooled         E4  138     0.06317    0.06272     0.86917  0.88428
35     deposited PANs    b  c     pooled         E2  138     0.06036    0.06260     0.43728  0.50548
36  Methods-rule PANs    a  a       mean         E3  119     0.03242    0.03379     0.80798  0.60196
37  Methods-rule PANs    a  a       mean         E4  119     0.03985    0.03929     0.86732  0.97146
38  Methods-rule PANs    a  a       mean         E2  119     0.02151    0.03146     0.00646  0.04049
39  Methods-rule PANs    a  a     pooled         E3  119     0.02029    0.01958     0.71638  0.85212
40  Methods-rule PANs    a  a     pooled         E4  119     0.02674    0.02644     0.65340  0.95045
41  Methods-rule PANs    a  a     pooled         E2  119     0.01013    0.01594     0.01304  0.07610
42  Methods-rule PANs    a  b       mean         E3  119     0.01236    0.01191     0.73003  0.97296
43  Methods-rule PANs    a  b       mean         E4  119     0.02144    0.01844     0.20212  0.54493
44  Methods-rule PANs    a  b       mean         E2  119     0.00092    0.00819     0.04277  0.10497
45  Methods-rule PANs    a  b     pooled         E3  119     0.01028    0.00833     0.29734  0.31014
46  Methods-rule PANs    a  b     pooled         E4  119     0.01750    0.01636     0.45034  0.93546
47  Methods-rule PANs    a  b     pooled         E2  119     0.00010    0.00430     0.20401  0.37819
48  Methods-rule PANs    a  c       mean         E3  119     0.01507    0.01529     0.83933  0.79789
49  Methods-rule PANs    a  c       mean         E4  119     0.02363    0.02175     0.40803  0.70577
50  Methods-rule PANs    a  c       mean         E2  119     0.00269    0.01066     0.03456  0.11458
51  Methods-rule PANs    a  c     pooled         E3  119     0.01107    0.00970     0.41255  0.49072
52  Methods-rule PANs    a  c     pooled         E4  119     0.01803    0.01707     0.47552  0.99399
53  Methods-rule PANs    a  c     pooled         E2  119     0.00045    0.00478     0.17794  0.26497
54  Methods-rule PANs    b  a       mean         E3  119     0.11101    0.10095     0.05192  0.33690
55  Methods-rule PANs    b  a       mean         E4  119     0.11459    0.11691     0.70453  0.95795
56  Methods-rule PANs    b  a       mean         E2  119     0.11493    0.11315     0.82993  0.90408
57  Methods-rule PANs    b  a     pooled         E3  119     0.10974    0.10103     0.07475  0.37413
58  Methods-rule PANs    b  a     pooled         E4  119     0.11386    0.11703     0.59036  0.91901
59  Methods-rule PANs    b  a     pooled         E2  119     0.11410    0.11309     0.96827  0.95045
60  Methods-rule PANs    b  b       mean         E3  119     0.00613    0.00145     0.41710  0.67318
61  Methods-rule PANs    b  b       mean         E4  119     0.01593    0.01534     0.58853  0.59411
62  Methods-rule PANs    b  b       mean         E2  119     0.00170   -0.00010     0.93448  0.83444
63  Methods-rule PANs    b  b     pooled         E3  119     0.00624    0.00136     0.31873  0.55814
64  Methods-rule PANs    b  b     pooled         E4  119     0.01608    0.01509     0.58124  0.58761
65  Methods-rule PANs    b  b     pooled         E2  119     0.00189   -0.00026     0.72432  0.72052
66  Methods-rule PANs    b  c       mean         E3  119     0.06949    0.06088     0.21655  0.38331
67  Methods-rule PANs    b  c       mean         E4  119     0.07537    0.07752     0.93448  0.97146
68  Methods-rule PANs    b  c       mean         E2  119     0.06846    0.06618     0.88195  0.86987
69  Methods-rule PANs    b  c     pooled         E3  119     0.06986    0.06098     0.21655  0.33879
70  Methods-rule PANs    b  c     pooled         E4  119     0.07599    0.07759     0.91132  0.90408
71  Methods-rule PANs    b  c     pooled         E2  119     0.06924    0.06605     0.80726  0.97897
                  set comb O1 fixed/free      test  holds
0   Methods-rule PANs    a  a       mean  Wilcoxon   True
1   Methods-rule PANs    a  a       mean       MWU   True
2   Methods-rule PANs    a  a     pooled  Wilcoxon   True
3   Methods-rule PANs    a  a     pooled       MWU   True
4   Methods-rule PANs    a  b       mean  Wilcoxon   True
5   Methods-rule PANs    a  b       mean       MWU   True
6   Methods-rule PANs    a  b     pooled  Wilcoxon   True
7   Methods-rule PANs    a  b     pooled       MWU   True
8   Methods-rule PANs    a  c       mean  Wilcoxon   True
9   Methods-rule PANs    a  c       mean       MWU   True
10  Methods-rule PANs    a  c     pooled  Wilcoxon   True
11  Methods-rule PANs    a  c     pooled       MWU   True
12  Methods-rule PANs    b  a       mean  Wilcoxon   True
13  Methods-rule PANs    b  a       mean       MWU   True
14  Methods-rule PANs    b  a     pooled  Wilcoxon   True
15  Methods-rule PANs    b  a     pooled       MWU   True
16  Methods-rule PANs    b  b       mean  Wilcoxon   True
17  Methods-rule PANs    b  b       mean       MWU   True
18  Methods-rule PANs    b  b     pooled  Wilcoxon   True
19  Methods-rule PANs    b  b     pooled       MWU   True
20  Methods-rule PANs    b  c       mean  Wilcoxon   True
21  Methods-rule PANs    b  c       mean       MWU   True
22  Methods-rule PANs    b  c     pooled  Wilcoxon   True
23  Methods-rule PANs    b  c     pooled       MWU   True
24     deposited PANs    a  a       mean  Wilcoxon   True
25     deposited PANs    a  a       mean       MWU   True
26     deposited PANs    a  a     pooled  Wilcoxon   True
27     deposited PANs    a  a     pooled       MWU   True
28     deposited PANs    a  b       mean  Wilcoxon   True
29     deposited PANs    a  b       mean       MWU   True
30     deposited PANs    a  b     pooled  Wilcoxon   True
31     deposited PANs    a  b     pooled       MWU   True
32     deposited PANs    a  c       mean  Wilcoxon   True
33     deposited PANs    a  c       mean       MWU   True
34     deposited PANs    a  c     pooled  Wilcoxon   True
35     deposited PANs    a  c     pooled       MWU   True
36     deposited PANs    b  a       mean  Wilcoxon  False
37     deposited PANs    b  a       mean       MWU   True
38     deposited PANs    b  a     pooled  Wilcoxon  False
39     deposited PANs    b  a     pooled       MWU   True
40     deposited PANs    b  b       mean  Wilcoxon  False
41     deposited PANs    b  b       mean       MWU  False
42     deposited PANs    b  b     pooled  Wilcoxon  False
43     deposited PANs    b  b     pooled       MWU   True
44     deposited PANs    b  c       mean  Wilcoxon  False
45     deposited PANs    b  c       mean       MWU   True
46     deposited PANs    b  c     pooled  Wilcoxon  False
47     deposited PANs    b  c     pooled       MWU   True
Holds in 27 of 32 readings (O1 a and b): blocked: the readings disagree; Panzeri-Treves variant (c): holds in 14 of 16
VS region average in Phase 3 (window ends in Phase 3):
                  set comb O1  SF P3 bins above  SF P3 peak  DF P3 bins above  DF P3 peak  FH P3 bins above  FH P3 peak  FL P3 bins above  FL P3 peak
0      deposited PANs    a  a                26       0.043                23       0.038                18       0.033                28       0.034
1      deposited PANs    a  b                26       0.025                23       0.018                18       0.013                28       0.012
2      deposited PANs    a  c                26       0.028                23       0.021                17       0.017                25       0.016
3      deposited PANs    b  a                 1       0.091                17       0.137                 4       0.107                 2       0.116
4      deposited PANs    b  b                 1       0.007                17       0.021                 4       0.012                 2       0.011
5      deposited PANs    b  c                 1       0.071                17       0.083                 3       0.074                 0       0.073
6   Methods-rule PANs    a  a                25       0.041                22       0.037                17       0.038                29       0.040
7   Methods-rule PANs    a  b                25       0.021                22       0.015                17       0.016                29       0.017
8   Methods-rule PANs    a  c                25       0.023                22       0.018                15       0.020                28       0.020
9   Methods-rule PANs    b  a                 1       0.103                12       0.146                 3       0.120                 1       0.129
10  Methods-rule PANs    b  b                 1       0.008                12       0.021                 3       0.012                 1       0.012
11  Methods-rule PANs    b  c                 0       0.079                12       0.080                 3       0.082                 1       0.080

Result: blocked (methods_underspecified). The absence holds in 27 of the 32 readings. It fails with MI per block on the deposited PANs: with the Wilcoxon test fixed exceeds free at the window ending at E3 (O1 a, mean of block types, 0.100 against 0.086 bits/s, p = 0.0027; O1 b p = 0.019 and 0.025), and with the Mann-Whitney test under O1 (b) and the mean of block types (p = 0.046). With the last 20 trials pooled no window gives p < 0.05 under either test. The VS region average passes its threshold in Phase 3 in all four block types when pooled (15 to 29 windows each); with MI per block it does so in 0 to 1 window for SF, 12 to 17 for DF, 3 to 4 for FH and 0 to 2 for FL, so a peak specific to single fixed-choice blocks is not seen.

fig10d-dls-stay-above-switch¶

In free-choice blocks, DLS action information is stronger in stay trials than in switch trials in Phase 3, while DMS shows no difference between stay and switch trials.

Stay: the action repeats that of the previous choice trial of the session; switch: it does not. Trials: (a) the last 20 trials of each free-choice block, (b) all free-choice trials. MI pooled over the selected trials per neuron, windows ending at E3 and E4, Mann-Whitney U test.

In [47]:
def stay_switch(nset, which, rng):
    out = []
    for n in nset:
        tr = n["tr"]; y = (tr.action == 1).to_numpy()
        allch = T[(T.session == n["session"]) & T.choice].sort_values("trial")
        prev = dict(zip(allch.trial.to_numpy()[1:], allch.action.to_numpy()[:-1]))
        pa = np.array([prev.get(t, np.nan) for t in tr.trial])
        stay = pa == tr.action.to_numpy()
        sw = np.isfinite(pa) & ~stay
        if which == "last20":
            sel = np.zeros(len(tr), bool)
            for blks in (blocks_last20(n).get("FREE", []),):
                for bi in blks:
                    sel[bi] = True
        else:
            sel = (tr.btype == "FREE").to_numpy()
        C = S.wcounts(n, SPW)
        r = {}
        for nm, m in (("stay", sel & stay), ("switch", sel & sw)):
            res = S.mi_with_shuffles(C[m], y[m], rng, 100, 0.5)
            r[nm] = (res["plugin"][0], res["plugin"][1].mean(0), int(m.sum()), res["pt"][0])
        out.append(r)
    return out
SS = {(k, w): stay_switch(v, w, np.random.default_rng(SEED + 1000 + 10 * (k != "deposited PANs") + (w == "all"))) for k, v in SETS.items() for w in ("last20", "all")}
In [48]:
rows = []
for (k, w), res in SS.items():
    reg = REG[k]
    for o1 in ("a", "b", "c"):
        for region in ("DLS", "DMS"):
            m = reg == region
            def val(r, wi):
                return r[3][wi] if o1 == "c" else r[0][wi] - (r[1][wi] if o1 == "b" else 0)
            for wi, wn in ((1, "E3"), (2, "E4")):
                st = np.array([val(r["stay"], wi) for r in res])[m]
                sw = np.array([val(r["switch"], wi) for r in res])[m]
                rows.append({"set": k, "trials": w, "O1": o1, "region": region, "window end": wn,
                             "mean stay": st.mean(), "mean switch": sw.mean(), "p MWU": mwu(st, sw)})
r10d = pd.DataFrame(rows)
print(r10d.round(5).to_string())
ns = pd.DataFrame([{"stay": r["stay"][2], "switch": r["switch"][2]} for r in SS[("deposited PANs", "last20")]])
na = pd.DataFrame([{"stay": r["stay"][2], "switch": r["switch"][2]} for r in SS[("deposited PANs", "all")]])
print("Trials per neuron (median), last 20:", ns.median().to_dict(), "; all free-choice:", na.median().to_dict())
hold = r10d.groupby(["set", "trials", "O1"]).apply(lambda d: bool(
    ((d.region == "DLS") & (d["window end"] == "E3") & (d["mean stay"] > d["mean switch"]) & (d["p MWU"] < .05)).any()
    and not ((d.region == "DMS") & (d["p MWU"] < .05)).any()), include_groups=False)
h10d = hold.rename("holds").reset_index()
print(h10d.to_string())
verdict_o1(h10d)
                  set  trials O1 region window end  mean stay  mean switch    p MWU
0      deposited PANs  last20  a    DLS         E3    0.04392      0.03276  0.93674
1      deposited PANs  last20  a    DLS         E4    0.06225      0.05190  0.86828
2      deposited PANs  last20  a    DMS         E3    0.02351      0.04187  0.03566
3      deposited PANs  last20  a    DMS         E4    0.05245      0.07843  0.00466
4      deposited PANs  last20  b    DLS         E3    0.02838      0.00109  0.00000
5      deposited PANs  last20  b    DLS         E4    0.04636      0.01884  0.00004
6      deposited PANs  last20  b    DMS         E3    0.00864      0.01028  0.08192
7      deposited PANs  last20  b    DMS         E4    0.03734      0.04113  0.19070
8      deposited PANs  last20  c    DLS         E3    0.03076      0.00814  0.00002
9      deposited PANs  last20  c    DLS         E4    0.04943      0.02595  0.00050
10     deposited PANs  last20  c    DMS         E3    0.01077      0.01690  0.28817
11     deposited PANs  last20  c    DMS         E4    0.03960      0.05014  0.71818
12     deposited PANs     all  a    DLS         E3    0.03540      0.01934  0.17817
13     deposited PANs     all  a    DLS         E4    0.04779      0.04005  0.76212
14     deposited PANs     all  a    DMS         E3    0.01567      0.02141  0.86979
15     deposited PANs     all  a    DMS         E4    0.04153      0.05709  0.51068
16     deposited PANs     all  b    DLS         E3    0.02728      0.00684  0.00013
17     deposited PANs     all  b    DLS         E4    0.03953      0.02726  0.01763
18     deposited PANs     all  b    DMS         E3    0.00743      0.00881  0.11589
19     deposited PANs     all  b    DMS         E4    0.03262      0.04251  0.20735
20     deposited PANs     all  c    DLS         E3    0.02804      0.00832  0.00014
21     deposited PANs     all  c    DLS         E4    0.04025      0.02859  0.02139
22     deposited PANs     all  c    DMS         E3    0.00819      0.00992  0.17649
23     deposited PANs     all  c    DMS         E4    0.03343      0.04485  0.30692
24  Methods-rule PANs  last20  a    DLS         E3    0.04543      0.03332  0.65363
25  Methods-rule PANs  last20  a    DLS         E4    0.06532      0.05390  0.68030
26  Methods-rule PANs  last20  a    DMS         E3    0.02757      0.04762  0.00418
27  Methods-rule PANs  last20  a    DMS         E4    0.04472      0.06802  0.01252
28  Methods-rule PANs  last20  b    DLS         E3    0.02909     -0.00060  0.00000
29  Methods-rule PANs  last20  b    DLS         E4    0.04863      0.01822  0.00003
30  Methods-rule PANs  last20  b    DMS         E3    0.01015      0.01103  0.14093
31  Methods-rule PANs  last20  b    DMS         E4    0.02811      0.02852  0.01535
32  Methods-rule PANs  last20  c    DLS         E3    0.03114      0.00598  0.00001
33  Methods-rule PANs  last20  c    DLS         E4    0.05131      0.02511  0.00027
34  Methods-rule PANs  last20  c    DMS         E3    0.01241      0.01708  0.25965
35  Methods-rule PANs  last20  c    DMS         E4    0.02984      0.03636  0.14167
36  Methods-rule PANs     all  a    DLS         E3    0.03668      0.01944  0.11478
37  Methods-rule PANs     all  a    DLS         E4    0.05106      0.04005  0.58850
38  Methods-rule PANs     all  a    DMS         E3    0.01628      0.02089  0.93657
39  Methods-rule PANs     all  a    DMS         E4    0.03751      0.04699  0.52885
40  Methods-rule PANs     all  b    DLS         E3    0.02794      0.00602  0.00005
41  Methods-rule PANs     all  b    DLS         E4    0.04220      0.02622  0.01991
42  Methods-rule PANs     all  b    DMS         E3    0.00713      0.00664  0.01209
43  Methods-rule PANs     all  b    DMS         E4    0.02818      0.03196  0.03574
44  Methods-rule PANs     all  c    DLS         E3    0.02874      0.00734  0.00008
45  Methods-rule PANs     all  c    DLS         E4    0.04288      0.02728  0.01274
46  Methods-rule PANs     all  c    DMS         E3    0.00769      0.00796  0.03134
47  Methods-rule PANs     all  c    DMS         E4    0.02858      0.03383  0.09619
Trials per neuron (median), last 20: {'stay': 152.0, 'switch': 66.0} ; all free-choice: {'stay': 252.0, 'switch': 167.5}
                  set  trials O1  holds
0   Methods-rule PANs     all  a  False
1   Methods-rule PANs     all  b  False
2   Methods-rule PANs     all  c  False
3   Methods-rule PANs  last20  a  False
4   Methods-rule PANs  last20  b  False
5   Methods-rule PANs  last20  c   True
6      deposited PANs     all  a  False
7      deposited PANs     all  b   True
8      deposited PANs     all  c   True
9      deposited PANs  last20  a  False
10     deposited PANs  last20  b   True
11     deposited PANs  last20  c   True
Holds in 2 of 8 readings (O1 a and b): blocked: the readings disagree; Panzeri-Treves variant (c): holds in 3 of 4

Result: blocked (methods_underspecified). The claim holds in 2 of the 8 readings: on the deposited PANs with shuffle-corrected MI (O1 b), DLS stay exceeds switch at the window ending at E3 (last 20 trials 0.028 against 0.001 bits/s, p < 1e-5; all free-choice trials 0.027 against 0.007, p = 0.00013), and DMS shows no difference (p 0.082 to 0.21). With plug-in MI (O1 a), which is biased upward for the fewer switch trials (median 66 against 152 trials per neuron in the last 20 trials), DLS shows no difference (p 0.94 and 0.87 at E3 and E4 with the last 20 trials, 0.18 and 0.76 with all), and with the last 20 trials DMS switch exceeds stay (p = 0.036 and 0.005). On the Methods-rule set DLS stay exceeds switch under O1 (b) (p < 1e-4), but DMS differs between stay and switch in 3 of the 4 readings (p 0.004 to 0.036). The Panzeri-Treves variant holds in 3 of 4.

Summary¶

Claim Outcome Rests on an assumption
trial-counts reproduced no
trials-per-block reproduced no
fig2c-extinction-differs reproduced no
fig2b-extinction-time-course reproduced no
fig2d-f-decision-trees reproduced no
fig2g-fq-variable-best not reproduced yes (model forms and priors)
actor-critic-near-chance reproduced no
neuron-counts blocked (data_missing)
fig4b-vs-phase1 blocked (data_missing)
fig4b-dms-phase5 blocked (methods_underspecified)
fig4b-vs-phase7 blocked (methods_underspecified)
fig4c-activation-duration blocked (methods_underspecified)
fig5b-state-info-vs blocked (methods_underspecified)
fig5e-action-info-rises-dls blocked (data_missing)
fig5e-action-info-cue-offset-dls blocked (data_missing)
fig5e-action-info-center-exit blocked (data_missing)
fig5d-action-info-phase5-dms blocked (data_missing)
fig5g-reward-info blocked (data_missing)
fig6-event-coding-proportions blocked (methods_underspecified)
fig6-above-chance blocked (data_missing)
fig6bc-similar-fixed-free blocked (methods_underspecified)
fig8a-d-action-reward-coding blocked (methods_underspecified)
fig8e-action-value-dms blocked (methods_underspecified)
fig8e-qr-dms blocked (methods_underspecified)
fig8f-state-value-vs blocked (data_missing)
no-policy-coding blocked (data_missing)
fig9-temporal-order-all-blocks blocked (data_missing)
fig9-dms-never-above-dls blocked (methods_underspecified)
fig10a-dls-fixed-above-free blocked (data_missing)
fig10b-dms-fixed-above-free blocked (data_missing)
fig10c-vs-no-fixed-free-difference blocked (methods_underspecified)
fig10d-dls-stay-above-switch blocked (methods_underspecified)

6 reproduced, 1 not reproduced, 25 blocked (12 methods_underspecified, 13 data_missing).

Neuron-counts is blocked (data_missing): the waveform and histology exclusions cannot be applied, and no count computable from the dandiset is below the lower end of its tolerance under reading (4i), so the counts cannot be decided. By Author step 1.5 the twelve neural claims that depend on it and were not already blocked are blocked for the same reason. Three of them (fig6-above-chance, fig8f-state-value-vs, no-policy-coding) depend directly on a claim blocked as methods_underspecified, so that reason applies to them too. The verifier agreed with all thirteen changes in round 3. Each conclusion above still gives the result as tested.

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 neural claims are run on two unit sets, the units the dandiset flags as PANs (204, 112, 138) and a set rebuilt from the Methods (183, 147, 119), which cannot apply the waveform and histology conditions; both are readings of the unit selection. Where a criterion names readings of a method (the claims file's O1 to O8, windows, tests, how trials are combined), every reading is run and the outcome is the one they all give; where they disagree the claim is blocked. The Panzeri-Treves bias correction of the mutual information and a threshold from labels permuted within blocks are shown as variants and decide no outcome. The choice models use 86 sessions where the paper used 202, and their equations, which are missing from the paper's text, follow the claims file's reading, with assumed particle-filter priors.

What was found about the dataset. The trial table's state codes are described as 1 = left, 2 = right, 3 = choice tone, but the data show 2 = left, 3 = right and 1 = choice tone. The dandiset holds 859 units, more than the paper's stable neurons, with a PANs flag that does not follow the Methods' ISI rule alone (174 units pass the rule without the flag, and 38 flagged units fail exclusion condition 3) and with no record of the stability and duplicate exclusions; 15 CS units carry the flag though the paper analyses only DLS, DMS and VS. The files hold no waveforms, amplitudes or depths. One file (LE115_14) has behaviour but no units, so there are 87 files for the paper's 86 recording sessions. Some events are out of the task's stated range (cue durations from 0.009 s where the paper gives 1 to 2 s). The behavioural model comparison of 202 sessions cannot be repeated, as the dandiset holds 86.