Hasnain, Han & Economo (2025) on DANDI:000363: reading G2 of 'good'¶

A second notebook for the same entry. It repeats the tests of the Figure 4 claims on the ALM and medulla sessions under reading G2 of the unit selection, where the main notebook (reproduce_hasnain_2025.ipynb) uses reading G1. The paper selects "sessions with at least 30 units classified as 'good' in each region of interest" (Methods, "Curation of Mesoscale Activity Map Dataset"). The units table has two 'good' labels: classification (G1) and unit_quality (G2). Only units classified good carry a CCF label, so under G2 a unit takes the label of the nearest unit classified good on the same probe, by the CCF coordinates of their electrodes, within 20 um (map_subspace.transfer_labels; an assumption). The main notebook gives the session and unit counts under both readings and the check of the label transfer.

Dataset: DANDI:000363, version 0.231012.2129, streamed. Claims tested here, under G2: fig4b-medulla-selectivity, fig4c-alm-null-potent-similar, fig4c-medulla-null-smaller, fig4d-decoding-asymmetry and fig4e-medulla-null-lower-dimension. fig4d-alm-predicts-medulla-null and fig4f-medulla-null-not-spanning-alm are tested in the main notebook only (the first needs the bilateral sessions, 31 under G2; the second is left to the main notebook to keep this one within the time limit). Methods, readings and seeds are those of the main notebook; the readings run here are the main reading (W1, B1, D1, baseline z-score) and B2, on which fig4c-medulla-null-smaller rests in the main notebook.

In [1]:
import os
os.environ.setdefault("OMP_NUM_THREADS", "2")
import collections
import resource
import time
import zlib

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy import stats

import map_subspace as ms

T0 = time.time()
KEY = "hasnain-2025"


def seed(claim, k=0):
    return zlib.crc32(f"{KEY}/{claim}".encode()) + k


SEED_OFFSETS = [0, 1000, 2000, 3000, 4000]
pd.set_option("display.width", 200)
pd.set_option("display.max_columns", 30)

Data check¶

Units tables of every file, the G2 selection, and for each selected session the trials kept, the movement threshold and the clock checks of the main notebook (tongue latency after the go cue; lick direction decoded from spike counts 0.8 to 1.0 s after the go cue against shuffled labels).

In [2]:
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cross_val_score

assets = ms.asset_urls()
tables = ms.survey(assets)
urls = dict(assets)
bil_g2, alm_med = ms.select_sessions(tables, label="quality")
print("G2: bilateral sessions %d; ALM and medulla sessions %d from %d mice, %d ALM and %d medulla units"
      % (len(bil_g2), len(alm_med), len({p.split("/")[0] for p in alm_med}),
         sum(len(v["ALM"]) for v in alm_med.values()), sum(len(v["medulla"]) for v in alm_med.values())))
_, alm_med_g1 = ms.select_sessions(tables)
print("ALM and medulla sessions also selected under G1:", sum(p in alm_med_g1 for p in alm_med))

W = ms.WINDOWS["W1"]
sessions, rows = {}, []
labels_seen = collections.defaultdict(collections.Counter)
rng_check = np.random.default_rng(seed("map-session-selection", 1))
for p, regions in alm_med.items():
    ids = sorted(set(regions["ALM"]) | set(regions["medulla"]))
    s = ms.load_session(urls[p], ids)
    for k in ("outcome", "photostim_duration", "early_lick"):
        labels_seen[k].update(s["trials"][k])
    gos = ms.go_times(s)
    keep = ms.trial_mask(s)
    go = gos[keep]
    speed = ms.speed_bins(s, go, W)
    finite = speed[np.isfinite(speed) & (speed > 0)]
    log_thr = ms.otsu_threshold(np.log10(finite))
    f = ms.open_file(urls[p])
    tg = f["acquisition/BehavioralTimeSeries/Camera0_side_TongueTracking"]
    tts, tlik = tg["timestamps"][:], tg["data"][:, 2]
    hit = np.array(s["trials"]["outcome"])[keep] == "hit"
    lat = []
    for g in go[hit]:
        lo, hi = np.searchsorted(tts, [g, g + 1.0])
        k = np.where(tlik[lo:hi] > 0.9)[0]
        lat.append(tts[lo + k[0]] - g if len(k) else np.nan)
    right = np.array(s["trials"]["trial_instruction"])[keep] == "right"
    X = np.stack([np.diff(np.searchsorted(s["spikes"][i], np.c_[go + 0.8, go + 1.0]), axis=1)[:, 0] for i in ids], axis=1)
    clf = LogisticRegression(C=0.1, max_iter=2000)
    acc = cross_val_score(clf, X, right, cv=5).mean()
    acc_sh = cross_val_score(clf, X, rng_check.permutation(right), cv=5).mean()
    sessions[p] = dict(sess=s, keep=keep, go=go, speed=speed, log_thr=log_thr)
    rows.append(dict(session=p.split("/")[1][:30], G1=p in alm_med_g1, ALM=len(regions["ALM"]),
                     ALM_side="+".join(regions["alm_sides"]), medulla=len(regions["medulla"]),
                     trials=len(keep), kept=int(keep.sum()), hits=int(hit.sum()), speed_thr=round(10 ** log_thr, 1),
                     tongue_lat_ms=round(1000 * np.nanmedian(lat)), acc_go_08=round(acc, 2), acc_shuffled=round(acc_sh, 2)))
    del f
sel_df = pd.DataFrame(rows)
print(sel_df.to_string())
print("trial labels:", {k: dict(v) for k, v in labels_seen.items()})
print("decoding above shuffled labels in %d of %d sessions; tongue latency %d to %d ms"
      % ((sel_df.acc_go_08 > sel_df.acc_shuffled + 0.1).sum(), len(sel_df), sel_df.tongue_lat_ms.min(), sel_df.tongue_lat_ms.max()))
print("elapsed %.0f s, peak memory %.0f MB" % (time.time() - T0, resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e3))
G2: bilateral sessions 31; ALM and medulla sessions 19 from 7 mice, 1501 ALM and 1745 medulla units
ALM and medulla sessions also selected under G1: 5
                           session     G1  ALM   ALM_side  medulla  trials  kept  hits  speed_thr  tongue_lat_ms  acc_go_08  acc_shuffled
0   sub-456773_ses-20191002T143533  False   50   left ALM      167     581   334   293       25.6             98       0.84          0.46
1   sub-456773_ses-20191004T143720  False   34   left ALM      215     491   284   243       27.0             85       0.87          0.45
2   sub-456774_ses-20191021T142044  False   58   left ALM       59     440   208   167       26.4            113       0.83          0.48
3   sub-456773_ses-20191005T142316  False   40   left ALM       96     700   425   376       30.2             77       0.83          0.51
4   sub-456774_ses-20191023T142402  False   30  right ALM      168     530   208   195       23.6            148       0.95          0.59
5   sub-456774_ses-20191022T133136   True  109   left ALM      298     570   135   111       24.5            262       0.85          0.50
6   sub-460432_ses-20191218T111453  False   73   left ALM       30     520   286   192       23.3            105       0.79          0.55
7   sub-460432_ses-20191219T134919  False   56  right ALM       30     450   233   164       22.7            140       0.86          0.54
8   sub-460434_ses-20191112T114755  False  219   left ALM       39     480   161   135       26.0            183       0.76          0.49
9   sub-460434_ses-20191113T135640  False  186   left ALM       42     423   186   148       27.1            100       0.84          0.58
10  sub-460434_ses-20191114T142520  False   50  right ALM       84     503   230   169       26.7            100       0.90          0.48
11  sub-460436_ses-20200109T111437   True  122  right ALM       89     517   294   255       30.0            119       0.93          0.51
12  sub-460436_ses-20200110T142717   True   76  right ALM      106     500   307   280       32.3            114       0.87          0.46
13  sub-484676_ses-20210413T112028  False  110   left ALM       35     550   332   312       28.5            100       0.96          0.50
14  sub-484676_ses-20210419T130102   True   68  right ALM       42     600   335   296       46.9             56       0.89          0.45
15  sub-484676_ses-20210420T130906  False   82  right ALM       52     534   312   272       28.9             67       0.87          0.56
16  sub-484677_ses-20210418T132006   True   61  right ALM       73     720   420   355       32.2            126       0.96          0.59
17  sub-484677_ses-20210419T161140  False   47  right ALM       44     480   273   211       31.1            124       0.88          0.52
18  sub-484677_ses-20210420T170516  False   30  right ALM       76     650   382   342       31.0            115       0.93          0.50
trial labels: {'outcome': {'hit': 7201, 'miss': 1509, 'ignore': 1529}, 'photostim_duration': {'N/A': 8123, '0.5000': 2116}, 'early_lick': {'early': 1064, 'no early': 9175}}
decoding above shuffled labels in 19 of 19 sessions; tongue latency 56 to 262 ms
elapsed 419 s, peak memory 3064 MB

Claim fig4b-medulla-selectivity, reading G2¶

Medullary reticular nucleus units are selective for lick direction in each epoch, most in the response epoch (sample 7%, delay 21%, response 49% of 724 units).

As in the main notebook (M7): correct trials, equal random samples of right and left trials, AUROC per epoch, 1000 label shuffles, readings E1 and E2, Bonferroni (p < 0.01) and p < 0.05.

In [3]:
def selectivity(rng):
    out = []
    for p, s in alm_med.items():
        v = sessions[p]
        trials = v["sess"]["trials"]
        out_arr = np.array(trials["outcome"])[v["keep"]]
        instr = np.array(trials["trial_instruction"])[v["keep"]]
        r_idx = np.where((out_arr == "hit") & (instr == "right"))[0]
        l_idx = np.where((out_arr == "hit") & (instr == "left"))[0]
        n = min(len(r_idx), len(l_idx))
        pick = np.r_[rng.choice(r_idx, n, replace=False), rng.choice(l_idx, n, replace=False)]
        is_right = np.r_[np.ones(n, bool), np.zeros(n, bool)]
        r = ms.rates([v["sess"]["spikes"][i] for i in s["medulla"]], v["go"][pick], ms.WINDOWS["W1"])
        tax = ms.WINDOWS["W1"][0] + ms.BIN * np.arange(r.shape[1])
        for j in range(r.shape[2]):
            row = dict(session=p.split("/")[1][:30], unit=s["medulla"][j], n_per_side=n)
            for ep, (a, b) in ms.EPOCHS.items():
                row[ep] = ms.selectivity_p(r[:, (tax >= a) & (tax < b), j].mean(1), is_right, rng)[1]
            out.append(row)
    return pd.DataFrame(out)


def summarize_sel(df, alpha):
    sig = {ep: df[ep] < alpha for ep in ms.EPOCHS}
    e1 = {"sample": sig["sample"], "delay": sig["early_delay"] | sig["late_delay"],
          "response": sig["early_response"] | sig["late_response"]}
    res = {f"E1 {k}": 100 * v.mean() for k, v in e1.items()}
    res.update({f"E2 {k}": 100 * v.mean() for k, v in sig.items()})
    return res


sel_runs = {k: selectivity(np.random.default_rng(seed("fig4b-medulla-selectivity", k))) for k in SEED_OFFSETS}
print("medulla units:", len(sel_runs[0]))
tab = pd.DataFrame({(off, a): summarize_sel(df, a) for off, df in sel_runs.items() for a in (0.01, 0.05)}).T
tab.index.names = ["seed offset", "alpha"]
print(tab.round(1).to_string())
print("expected: sample 7 +- 0.7, delay 21 +- 2.1, response 49 +- 4.9")
print("by session (claim seed, Bonferroni, E1):")
print(sel_runs[0].groupby("session").apply(lambda d: pd.Series(summarize_sel(d, 0.01))).iloc[:, :3].round(1).to_string())
print("elapsed %.0f s" % (time.time() - T0))
medulla units: 1745
                   E1 sample  E1 delay  E1 response  E2 sample  E2 early_delay  E2 late_delay  E2 early_response  E2 late_response
seed offset alpha                                                                                                                 
0           0.01        16.7      28.3         63.4       16.7            19.1           22.2               48.4              45.2
            0.05        25.0      39.3         71.7       25.0            28.4           31.0               57.0              53.8
1000        0.01        17.6      28.0         63.7       17.6            19.3           22.0               48.7              46.3
            0.05        26.5      39.7         71.9       26.5            28.2           31.5               56.3              54.1
2000        0.01        17.0      28.7         63.5       17.0            19.5           22.7               48.5              45.7
            0.05        25.5      39.3         71.5       25.5            28.7           31.0               56.3              53.8
3000        0.01        16.6      27.7         63.6       16.6            19.2           21.7               49.1              45.3
            0.05        24.8      38.6         71.9       24.8            27.9           30.9               56.3              54.0
4000        0.01        16.7      28.1         63.9       16.7            19.3           21.5               49.1              45.3
            0.05        25.0      39.4         71.6       25.0            28.6           30.9               56.6              53.4
expected: sample 7 +- 0.7, delay 21 +- 2.1, response 49 +- 4.9
by session (claim seed, Bonferroni, E1):
                                E1 sample  E1 delay  E1 response
session                                                         
sub-456773_ses-20191002T143533        3.0      18.0         49.1
sub-456773_ses-20191004T143720       17.7      25.1         55.8
sub-456773_ses-20191005T142316       12.5      17.7         67.7
sub-456774_ses-20191021T142044       22.0      28.8         32.2
sub-456774_ses-20191022T133136       23.8      33.9         62.1
sub-456774_ses-20191023T142402       17.9      28.6         66.1
sub-460432_ses-20191218T111453       13.3      46.7         56.7
sub-460432_ses-20191219T134919        6.7      23.3         73.3
sub-460434_ses-20191112T114755        7.7      10.3         46.2
sub-460434_ses-20191113T135640        2.4       4.8         52.4
sub-460434_ses-20191114T142520       11.9      28.6         67.9
sub-460436_ses-20200109T111437       22.5      33.7         71.9
sub-460436_ses-20200110T142717        1.9      20.8         72.6
sub-484676_ses-20210413T112028       42.9      65.7         60.0
sub-484676_ses-20210419T130102       38.1      45.2         66.7
sub-484676_ses-20210420T130906       13.5      46.2         76.9
sub-484677_ses-20210418T132006       39.7      47.9         80.8
sub-484677_ses-20210419T161140       11.4      15.9         81.8
sub-484677_ses-20210420T170516       11.8      19.7         82.9
elapsed 674 s

Result (reading G2): partially reproduced. Of 1745 medulla units in 19 sessions, under E1 with the Bonferroni threshold 16.7% are selective in the sample epoch, 28.3% in the delay epoch and 63.4% in the response epoch (paper 7, 21 and 49%); over the five seeds 16.6 to 17.6%, 27.7 to 28.7% and 63.4 to 63.9%. The order holds, and no value is within tolerance under E1, E2 or either threshold. By session the sample value runs from 1.9 to 42.9%.

Per-region subspaces, reading G2¶

Main reading and B2, the subspace generator seeded as in the main notebook. Then the variance explained (M6, V1 to V3) and the paired t tests of fig4c, and the dimensionality of fig4e.

In [4]:
def prepare(p, region_ids, short_runs_move):
    v = sessions[p]
    r = ms.rates([v["sess"]["spikes"][i] for i in region_ids], v["go"], W)
    z, nfb = ms.zscore(r, W)
    return z, ms.movement_mask(v["speed"], v["log_thr"], short_runs_move=short_runs_move), nfb


fits, fit_rows = {}, []
rng_sub = np.random.default_rng(seed("fig4c-alm-null-potent-similar"))
for p, s in alm_med.items():
    for reg in ("ALM", "medulla"):
        for rname in ("main", "B2"):
            z, mv, nfb = prepare(p, s[reg], rname == "B2")
            fit = ms.fit_region(z, mv, rng_sub)
            fit["proj"] = (z @ fit["qn"]).astype(np.float32)
            fits[(p, reg, rname)] = fit
            ve = ms.ve_readings(fit)
            fit_rows.append(dict(session=p.split("/")[1][:30], region=reg, reading=rname, units=z.shape[2],
                                 d_null=fit["d"][0], d_pot=fit["d"][1], d_null_raw=fit["d_raw"][0],
                                 moving=round(float((mv == 1).sum() / (mv >= 0).sum()), 2), fallback=nfb,
                                 z_absmax=round(float(np.abs(z).max())),
                                 **{f"{k} {n}": 100 * x for k, vv in ve.items() for n, x in zip(("null", "pot"), vv[:2])}))
    print(p.split("/")[1][:30], "done, elapsed %.0f s" % (time.time() - T0))
fit_df = pd.DataFrame(fit_rows)
print(fit_df.round(1).to_string())
print("peak memory %.0f MB" % (resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e3))
sub-456773_ses-20191002T143533 done, elapsed 745 s
sub-456773_ses-20191004T143720 done, elapsed 818 s
sub-456774_ses-20191021T142044 done, elapsed 840 s
sub-456773_ses-20191005T142316 done, elapsed 903 s
sub-456774_ses-20191023T142402 done, elapsed 943 s
sub-456774_ses-20191022T133136 done, elapsed 998 s
sub-460432_ses-20191218T111453 done, elapsed 1025 s
sub-460432_ses-20191219T134919 done, elapsed 1044 s
sub-460434_ses-20191112T114755 done, elapsed 1083 s
sub-460434_ses-20191113T135640 done, elapsed 1130 s
sub-460434_ses-20191114T142520 done, elapsed 1159 s
sub-460436_ses-20200109T111437 done, elapsed 1218 s
sub-460436_ses-20200110T142717 done, elapsed 1272 s
sub-484676_ses-20210413T112028 done, elapsed 1277 s
sub-484676_ses-20210419T130102 done, elapsed 1311 s
sub-484676_ses-20210420T130906 done, elapsed 1353 s
sub-484677_ses-20210418T132006 done, elapsed 1411 s
sub-484677_ses-20210419T161140 done, elapsed 1433 s
sub-484677_ses-20210420T170516 done, elapsed 1472 s
                           session   region reading  units  d_null  d_pot  d_null_raw  moving  fallback  z_absmax  V1 null  V1 pot  V2 null  V2 pot  V3 null  V3 pot
0   sub-456773_ses-20191002T143533      ALM    main     50      16      9          16     0.4         2       123     65.5    89.8     35.9    34.9     85.2    98.4
1   sub-456773_ses-20191002T143533      ALM      B2     50      12     10          12     0.5         2       123     60.9    90.6     28.2    37.5     87.1    98.1
2   sub-456773_ses-20191002T143533  medulla    main    167      18     14          18     0.4        12      5099     11.7    88.4     11.7    88.2     13.2    88.9
3   sub-456773_ses-20191002T143533  medulla      B2    167      33     14          33     0.5        12      5099      1.9    98.3      1.9    98.1      8.2    98.5
4   sub-456773_ses-20191004T143720      ALM    main     34       9      9           9     0.4         2       455     70.7    61.7     41.0    35.8     90.6    72.0
5   sub-456773_ses-20191004T143720      ALM      B2     34       7      9           7     0.6         2       455     48.8    81.4     25.7    47.2     75.6    86.7
6   sub-456773_ses-20191004T143720  medulla    main    215      33     23          33     0.4        10     50011     46.1    53.9     46.1    53.8     46.3    53.9
7   sub-456773_ses-20191004T143720  medulla      B2    215      36     27          36     0.6        10     50011     43.2    56.8     43.2    56.8     43.4    56.8
8   sub-456774_ses-20191021T142044      ALM    main     58      16      9          16     0.4         3        76     69.4    72.5     37.1    29.0     93.0    86.5
9   sub-456774_ses-20191021T142044      ALM      B2     58      23      9          23     0.4         3        76     62.1    83.5     40.2    33.4     90.5    92.2
10  sub-456774_ses-20191021T142044  medulla    main     59       5      4           5     0.4        12      3406     40.2    60.2     39.8    59.5     40.5    61.1
11  sub-456774_ses-20191021T142044  medulla      B2     59       6      4           6     0.4        12      3406     41.2    59.1     40.8    58.5     42.7    59.1
12  sub-456773_ses-20191005T142316      ALM    main     40      14     14          14     0.4         4       220     12.8    92.0     11.9    85.5     60.2    94.2
13  sub-456773_ses-20191005T142316      ALM      B2     40      14     14          14     0.6         4       220     12.2    92.6     11.3    86.1     72.7    93.5
14  sub-456773_ses-20191005T142316  medulla    main     96      19     18          19     0.4         5       174     52.8    71.2     32.2    42.6     79.6    86.1
15  sub-456773_ses-20191005T142316  medulla      B2     96      17     19          17     0.6         5       174     47.7    75.3     28.0    45.9     83.2    83.3
16  sub-456774_ses-20191023T142402      ALM    main     30       7      7           7     0.4         2       112     33.0    89.5     20.7    56.1     71.2    94.1
17  sub-456774_ses-20191023T142402      ALM      B2     30       9      7           9     0.4         2       112     31.5    93.2     21.3    58.4     80.7    96.0
18  sub-456774_ses-20191023T142402  medulla    main    168       3      2           3     0.4        14     15613     21.6    78.6     21.5    78.2     21.7    80.4
19  sub-456774_ses-20191023T142402  medulla      B2    168      13      2          13     0.4        14     15613     84.9    15.1     84.8    15.0     89.5    14.1
20  sub-456774_ses-20191022T133136      ALM    main    109      14     10          14     0.3         9       224     42.9    81.1     23.3    39.1     81.3    92.0
21  sub-456774_ses-20191022T133136      ALM      B2    109      15      8          15     0.4         9       224     39.7    84.3     22.0    38.0     86.5    92.4
22  sub-456774_ses-20191022T133136  medulla    main    298      34      8          34     0.3        30       871     31.3    78.2     28.9    63.3     56.6    84.7
23  sub-456774_ses-20191022T133136  medulla      B2    298      42      7          42     0.4        30       871     23.5    87.3     21.9    68.9     77.4    90.0
24  sub-460432_ses-20191218T111453      ALM    main     73      12      9          12     0.4         9      4605     96.7     3.5     95.8     3.5     97.7     3.9
25  sub-460432_ses-20191218T111453      ALM      B2     73      11      6          11     0.5         9      4605     97.7     2.4     96.8     2.3     99.2     2.7
26  sub-460432_ses-20191218T111453  medulla    main     30       6      4           6     0.4         6     45215     58.2    41.8     58.2    41.8     58.2    41.9
27  sub-460432_ses-20191218T111453  medulla      B2     30       7      3           7     0.5         6     45215     29.7    70.3     29.7    70.2     29.8    70.3
28  sub-460432_ses-20191219T134919      ALM    main     56       4     12           4     0.4         7       205     58.3    70.5     26.7    48.6     82.3    76.3
29  sub-460432_ses-20191219T134919      ALM      B2     56       4     11           4     0.4         7       205     24.2    93.4     11.1    62.5     76.0    96.7
30  sub-460432_ses-20191219T134919  medulla    main     30       4      2           4     0.4         1       102     57.0    60.8     45.5    39.5     64.6    75.1
31  sub-460432_ses-20191219T134919  medulla      B2     30       2      2           2     0.4         1       102     63.5    54.0     41.3    35.0     78.8    66.1
32  sub-460434_ses-20191112T114755      ALM    main    219      13     15          13     0.4        18       170     49.8    68.7     23.0    33.2     84.6    81.3
33  sub-460434_ses-20191112T114755      ALM      B2    219      22     11          22     0.4        18       170     26.8    94.2     14.5    41.1     82.1    97.1
34  sub-460434_ses-20191112T114755  medulla    main     39       6      6           6     0.4         3       240     46.4    59.8     40.2    51.8     70.6    67.1
35  sub-460434_ses-20191112T114755  medulla      B2     39       9      6           9     0.4         3       240     21.4    85.2     19.4    73.8     69.0    87.1
36  sub-460434_ses-20191113T135640      ALM    main    186      15      6          15     0.4        39     53615     61.3    38.7     61.3    38.7     95.1    66.2
37  sub-460434_ses-20191113T135640      ALM      B2    186      37      7          37     0.5        39     53615     58.4    41.6     58.4    41.6     94.0    58.6
38  sub-460434_ses-20191113T135640  medulla    main     42      12      4          12     0.4         3       188     24.1    94.2     21.6    69.0     64.4    97.9
39  sub-460434_ses-20191113T135640  medulla      B2     42      13      6          13     0.5         3       188     14.5    97.7     13.2    77.8     75.9    99.1
40  sub-460434_ses-20191114T142520      ALM    main     50      16      8          16     0.4        13       204     27.8    90.6     22.4    63.7     55.5    93.6
41  sub-460434_ses-20191114T142520      ALM      B2     50      12      7          12     0.5        13       204     33.0    83.8     25.2    57.0     76.3    85.4
42  sub-460434_ses-20191114T142520  medulla    main     84      12      3          12     0.4         3       192     47.0    83.3     36.4    41.4     76.1    92.2
43  sub-460434_ses-20191114T142520  medulla      B2     84       9      4           9     0.5         3       192     27.9    93.6     20.1    51.4     81.2    96.7
44  sub-460436_ses-20200109T111437      ALM    main    122       8      8           8     0.5         1       115     43.4    80.6     18.1    33.6     68.0    87.4
45  sub-460436_ses-20200109T111437      ALM      B2    122      19      5          19     0.6         1       115     33.3    96.2     18.4    34.4     77.9    98.3
46  sub-460436_ses-20200109T111437  medulla    main     89       3      3           3     0.5         9       333     71.3    50.4     36.0    25.4     84.3    59.0
47  sub-460436_ses-20200109T111437  medulla      B2     89      15      3          15     0.6         9       333     29.3    95.0     22.3    48.0     67.3    96.2
48  sub-460436_ses-20200110T142717      ALM    main     76      16      7          16     0.5         4       213     32.5    91.0     22.3    52.3     51.7    93.4
49  sub-460436_ses-20200110T142717      ALM      B2     76      18      7          18     0.7         4       213     29.2    94.4     20.6    54.3     69.5    95.5
50  sub-460436_ses-20200110T142717  medulla    main    106       4      7           4     0.5        13       751     35.3    74.0     27.1    63.8     53.3    78.2
51  sub-460436_ses-20200110T142717  medulla      B2    106      12      5          12     0.7        13       751     30.3    80.7     27.7    64.9     87.5    83.1
52  sub-484676_ses-20210413T112028      ALM    main    110      18      7          18     0.5        12      1363     49.5    66.8     41.7    45.1     73.2    76.9
53  sub-484676_ses-20210413T112028      ALM      B2    110       5      5           5     0.6        12      1363     49.3    67.6     30.2    41.4     76.1    72.5
54  sub-484676_ses-20210413T112028  medulla    main     35       5      5           5     0.5         1       155     84.9    27.6     69.1    22.5     93.6    52.7
55  sub-484676_ses-20210413T112028  medulla      B2     35       2      6           2     0.6         1       155     94.7    34.2     59.9    29.3     99.0    53.3
56  sub-484676_ses-20210419T130102      ALM    main     68       6      8           6     0.5         4       454     69.7    64.9     28.5    30.5     80.4    77.6
57  sub-484676_ses-20210419T130102      ALM      B2     68       5      9           5     0.8         4       454     63.8    69.8     23.6    34.5     92.3    74.6
58  sub-484676_ses-20210419T130102  medulla    main     42       9      8           9     0.5         5       174     58.7    68.2     38.5    42.6     74.8    75.6
59  sub-484676_ses-20210419T130102  medulla      B2     42       8      7           8     0.8         5       174     42.6    86.9     26.6    51.3     69.8    89.7
60  sub-484676_ses-20210420T130906      ALM    main     82       7      4           7     0.6         2     33422     43.2    56.8     43.2    56.8     43.2    56.8
61  sub-484676_ses-20210420T130906      ALM      B2     82      10      5          10     0.7         2     33422     25.4    74.6     25.4    74.6     25.4    74.6
62  sub-484676_ses-20210420T130906  medulla    main     52       7      9           7     0.6         2       192     43.6    73.3     29.6    53.1     77.5    80.2
63  sub-484676_ses-20210420T130906  medulla      B2     52      11      9          11     0.7         2       192     38.6    75.7     29.6    54.9     79.6    79.1
64  sub-484677_ses-20210418T132006      ALM    main     61      15     15          15     0.3         2        81     72.1    79.9     33.7    37.4     83.8    90.3
65  sub-484677_ses-20210418T132006      ALM      B2     61      11     16          11     0.5         2        81     64.8    84.7     24.8    41.3     86.2    90.6
66  sub-484677_ses-20210418T132006  medulla    main     73      12     12          12     0.3         4       112     44.0    73.5     28.1    46.9     70.7    88.4
67  sub-484677_ses-20210418T132006  medulla      B2     73      12     13          12     0.5         4       112     37.0    79.6     23.7    51.8     84.1    88.6
68  sub-484677_ses-20210419T161140      ALM    main     47       7      8           7     0.4         0        79     51.8    81.1     24.7    40.8     85.6    93.7
69  sub-484677_ses-20210419T161140      ALM      B2     47      10      6          10     0.5         0        79     49.4    86.8     27.2    38.9     89.8    95.3
70  sub-484677_ses-20210419T161140  medulla    main     44       9      7           9     0.4         1       128     47.9    71.6     34.6    47.7     78.8    83.6
71  sub-484677_ses-20210419T161140  medulla      B2     44      10      6          10     0.5         1       128     46.4    74.6     34.6    46.6     91.7    80.5
72  sub-484677_ses-20210420T170516      ALM    main     30       4      3           4     0.4         5       261     44.4    61.3     37.2    50.2     51.2    67.1
73  sub-484677_ses-20210420T170516      ALM      B2     30       5      3           5     0.5         5       261     37.1    68.9     31.6    56.5     46.1    70.3
74  sub-484677_ses-20210420T170516  medulla    main     76      12      5          12     0.4         3       196     32.1    80.6     28.0    61.9     65.0    89.1
75  sub-484677_ses-20210420T170516  medulla      B2     76      15      6          15     0.5         3       196     28.8    82.5     25.7    65.5     77.8    86.2
peak memory 3133 MB

Claims fig4c-alm-null-potent-similar and fig4c-medulla-null-smaller, reading G2¶

In MAP ALM the movement-null and movement-potent subspaces explain comparable variance (36.0 +- 7.40% and 37.1 +- 8.70%; paired t test p = 0.15, 16 sessions).

In the medullary reticular nuclei the movement-null subspace explains less variance than the movement-potent subspace (26.4 +- 3.90% against 44.8 +- 7.12%; p = 1.9e-9, 16 sessions).

In [5]:
ve_rows = []
for (rname, reg), d in fit_df.groupby(["reading", "region"]):
    for V in ("V1", "V2", "V3"):
        a, b = d[f"{V} null"].values, d[f"{V} pot"].values
        t, pv = stats.ttest_rel(a, b)
        ve_rows.append(dict(region=reg, reading=rname, V=V, n=len(a), null_mean=a.mean(), null_sd=a.std(ddof=1),
                            pot_mean=b.mean(), pot_sd=b.std(ddof=1), diff=(a - b).mean(), t=t, p=pv,
                            null_below_pot=int((a < b).sum())))
ve_tab = pd.DataFrame(ve_rows)
print(ve_tab.round(3).to_string())
print("expected ALM null 36.0 +- 7.4, potent 37.1 +- 8.7 (p = 0.15); medulla null 26.4 +- 3.9, potent 44.8 +- 7.12 (p = 1.9e-9)")
alm_ok = ve_tab[(ve_tab.region == "ALM") & (abs(ve_tab.null_mean - 36.0) <= 7.4) & (abs(ve_tab.pot_mean - 37.1) <= 8.7)]
med_ok = ve_tab[(ve_tab.region == "medulla") & (abs(ve_tab.null_mean - 26.4) <= 3.9) & (abs(ve_tab.pot_mean - 44.8) <= 7.12)]
print("ALM readings with both means in tolerance:", alm_ok[["reading", "V", "null_mean", "pot_mean", "p"]].round(4).values.tolist())
print("medulla readings with both means in tolerance:", med_ok[["reading", "V", "null_mean", "pot_mean", "p"]].round(4).values.tolist())
     region reading   V   n  null_mean  null_sd  pot_mean  pot_sd    diff      t      p  null_below_pot
0       ALM      B2  V1  19     44.610   20.179    78.109  22.680 -33.499 -3.673  0.002              17
1       ALM      B2  V2  19     29.307   19.459    46.375  17.885 -17.069 -2.181  0.043              16
2       ALM      B2  V3  19     78.107   17.233    82.689  22.521  -4.582 -0.663  0.516              15
3   medulla      B2  V1  19     39.319   22.352    73.779  21.831 -34.460 -3.491  0.003              16
4   medulla      B2  V2  19     31.276   17.940    55.988  18.640 -24.712 -3.075  0.007              16
5   medulla      B2  V3  19     70.302   23.224    77.776  20.883  -7.474 -0.981  0.340              13
6       ALM    main  V1  19     52.349   19.490    70.575  21.509 -18.226 -2.113  0.049              15
7       ALM    main  V2  19     34.129   18.826    42.894  16.758  -8.765 -1.186  0.251              14
8       ALM    main  V3  19     75.459   16.275    79.046  21.604  -3.587 -0.526  0.606              12
9   medulla    main  V1  19     44.957   17.373    67.863  16.399 -22.907 -3.087  0.006              16
10  medulla    main  V2  19     35.429   13.192    52.263  16.466 -16.834 -2.631  0.017              15
11  medulla    main  V3  19     62.612   20.665    75.584  15.450 -12.972 -2.110  0.049              15
expected ALM null 36.0 +- 7.4, potent 37.1 +- 8.7 (p = 0.15); medulla null 26.4 +- 3.9, potent 44.8 +- 7.12 (p = 1.9e-9)
ALM readings with both means in tolerance: [['main', 'V2', 34.1286, 42.8937, 0.2509]]
medulla readings with both means in tolerance: []

Result (reading G2). fig4c-alm-null-potent-similar: under the main reading with V2, ALM null and potent variance are 33.9 and 42.7%, both within tolerance of 36.0 and 37.1%, and the paired t test finds no difference (p = 0.251 over 19 sessions; 0.249 to 0.261 over the seeds below), which the criterion counts as reproduced. With V1 the main-reading p is 0.050 (0.050 to 0.058 over the seeds); under B2 potent exceeds null (V1 p = 0.002, V2 p = 0.041) with means out of tolerance. fig4c-medulla-null-smaller: null is below potent under the main reading (V1 46.3 against 67.3%, p = 0.020; V2 35.7 against 51.7%, p = 0.027) and under B2 (V2 30.8 against 56.4%, p = 0.005), lower in 15 or 16 of 19 sessions, with the null mean outside 26.4 +- 3.9% in each, which the criterion counts as partially reproduced. Single units dominate some regions: the largest |z| is above 1000 in 9 of the 38 regions, and in sub-460432_ses-20191218 the ALM null subspace holds 95.7% of the variance (V2).

Seed check: the main reading again under the claim's seed plus 1000 to 4000 (dimension shuffles and the optimizer's start). B2 is run under the claim's seed only, to keep the notebook within the time limit; in the main notebook B2 moved the t test p by less than 0.004 over the five seeds.

In [6]:
seed_rows = []
for k in SEED_OFFSETS[1:]:
    rng_k = np.random.default_rng(seed("fig4c-alm-null-potent-similar", k))
    for p, s in alm_med.items():
        for reg in ("ALM", "medulla"):
            for rname in ("main",):
                z, mv, _ = prepare(p, s[reg], rname == "B2")
                fit = ms.fit_region(z, mv, rng_k)
                ve = ms.ve_readings(fit)
                seed_rows.append(dict(offset=k, reading=rname, session=p, region=reg, d_null_raw=fit["d_raw"][0],
                                      **{f"{V} {n}": 100 * x for V, vv in ve.items() for n, x in zip(("null", "pot"), vv[:2])}))
    print("offset", k, "elapsed %.0f s" % (time.time() - T0))
seed_df = pd.concat([pd.DataFrame(seed_rows),
                     fit_df.assign(offset=0, session=[next(p for p in alm_med if r in p) for r in fit_df.session])])
srows = []
for (off, rname, reg), d in seed_df.groupby(["offset", "reading", "region"]):
    for V in ("V1", "V2", "V3"):
        t, pv = stats.ttest_rel(d[f"{V} null"], d[f"{V} pot"])
        srows.append(dict(offset=off, reading=rname, region=reg, V=V, null=d[f"{V} null"].mean(), pot=d[f"{V} pot"].mean(), p=pv))
print(pd.DataFrame(srows).round(4).to_string())
for (off, rname), d in seed_df.groupby(["offset", "reading"]):
    d = d.sort_values("session")
    a, b = d[d.region == "ALM"].d_null_raw.values, d[d.region == "medulla"].d_null_raw.values
    print(f"offset {off} {rname}: N1 medulla {b.mean():.1f}, ALM {a.mean():.1f}, p = {stats.ttest_rel(b, a).pvalue:.3g}")
print("elapsed %.0f s" % (time.time() - T0))
offset 1000 elapsed 1872 s
offset 2000 elapsed 2269 s
offset 3000 elapsed 2663 s
offset 4000 elapsed 3054 s
    offset reading   region   V     null      pot       p
0        0      B2      ALM  V1  44.6102  78.1093  0.0017
1        0      B2      ALM  V2  29.3065  46.3754  0.0427
2        0      B2      ALM  V3  78.1071  82.6888  0.5155
3        0      B2  medulla  V1  39.3189  73.7794  0.0026
4        0      B2  medulla  V2  31.2756  55.9875  0.0065
5        0      B2  medulla  V3  70.3024  77.7761  0.3396
6        0    main      ALM  V1  52.3486  70.5750  0.0488
7        0    main      ALM  V2  34.1286  42.8937  0.2509
8        0    main      ALM  V3  75.4586  79.0456  0.6055
9        0    main  medulla  V1  44.9566  67.8632  0.0064
10       0    main  medulla  V2  35.4291  52.2629  0.0170
11       0    main  medulla  V3  62.6116  75.5836  0.0491
12    1000    main      ALM  V1  52.4691  70.6873  0.0488
13    1000    main      ALM  V2  34.4169  42.8902  0.2662
14    1000    main      ALM  V3  75.4052  79.1214  0.5927
15    1000    main  medulla  V1  45.4683  67.6270  0.0099
16    1000    main  medulla  V2  35.2115  52.1832  0.0160
17    1000    main  medulla  V3  63.0386  75.4834  0.0642
18    2000    main      ALM  V1  52.3992  70.4920  0.0505
19    2000    main      ALM  V2  34.1465  42.8798  0.2538
20    2000    main      ALM  V3  75.4199  78.9715  0.6096
21    2000    main  medulla  V1  44.6965  68.0469  0.0055
22    2000    main  medulla  V2  35.2926  52.4889  0.0139
23    2000    main  medulla  V3  62.4123  75.8349  0.0423
24    3000    main      ALM  V1  52.4969  70.5218  0.0511
25    3000    main      ALM  V2  34.2842  42.8858  0.2595
26    3000    main      ALM  V3  75.5833  78.9638  0.6253
27    3000    main  medulla  V1  44.9992  67.7704  0.0066
28    3000    main  medulla  V2  35.4735  52.2989  0.0176
29    3000    main  medulla  V3  62.6027  75.5233  0.0492
30    4000    main      ALM  V1  52.4820  70.5775  0.0503
31    4000    main      ALM  V2  34.3054  42.8852  0.2631
32    4000    main      ALM  V3  75.5047  79.0405  0.6102
33    4000    main  medulla  V1  44.5914  67.9428  0.0048
34    4000    main  medulla  V2  35.2585  52.4113  0.0145
35    4000    main  medulla  V3  62.4284  75.7157  0.0412
offset 0 B2: N1 medulla 14.3, ALM 13.1, p = 0.699
offset 0 main: N1 medulla 11.2, ALM 11.4, p = 0.925
offset 1000 main: N1 medulla 11.1, ALM 11.7, p = 0.803
offset 2000 main: N1 medulla 11.4, ALM 11.3, p = 0.982
offset 3000 main: N1 medulla 11.2, ALM 11.5, p = 0.87
offset 4000 main: N1 medulla 11.2, ALM 11.6, p = 0.872
elapsed 3054 s

Claim fig4e-medulla-null-lower-dimension, reading G2¶

The movement-null subspace has lower dimensionality in the medullary reticular nuclei than in ALM (paired t test, p = 7.4e-5).

N1 (shuffle dimension of the stationary activity) and N2 (participation ratio of the movement-null covariance), main reading and B2.

In [7]:
dim_rows = []
for p, s in alm_med.items():
    for rname in ("main", "B2"):
        row = dict(session=p.split("/")[1][:30], reading=rname)
        for reg in ("ALM", "medulla"):
            fit = fits[(p, reg, rname)]
            row[f"{reg} units"] = len(s[reg])
            row[f"{reg} N1"] = fit["d_raw"][0]
            row[f"{reg} N2"] = ms.participation_ratio(fit["qn"].T @ fit["C"] @ fit["qn"])
        dim_rows.append(row)
dim_df = pd.DataFrame(dim_rows)
print(dim_df.round(2).to_string())
for rname, d in dim_df.groupby("reading"):
    for m in ("N1", "N2"):
        t, pv = stats.ttest_rel(d[f"medulla {m}"], d[f"ALM {m}"])
        print(f"{rname} {m}: medulla mean {d[f'medulla {m}'].mean():.2f}, ALM mean {d[f'ALM {m}'].mean():.2f}, t = {t:.2f}, "
              f"p = {pv:.3g}, medulla lower in {(d[f'medulla {m}'] < d[f'ALM {m}']).sum()} of {len(d)}")
                           session reading  ALM units  ALM N1  ALM N2  medulla units  medulla N1  medulla N2
0   sub-456773_ses-20191002T143533    main         50      16   15.11            167          18        1.11
1   sub-456773_ses-20191002T143533      B2         50      12   11.46            167          33        2.38
2   sub-456773_ses-20191004T143720    main         34       9    5.33            215          33        1.00
3   sub-456773_ses-20191004T143720      B2         34       7    5.75            215          36        1.00
4   sub-456774_ses-20191021T142044    main         58      16   10.85             59           5        1.03
5   sub-456774_ses-20191021T142044      B2         58      23   15.80             59           6        1.03
6   sub-456773_ses-20191005T142316    main         40      14    9.02             96          19        9.97
7   sub-456773_ses-20191005T142316      B2         40      14    8.53             96          17        8.42
8   sub-456774_ses-20191023T142402    main         30       7    5.00            168           3        1.39
9   sub-456774_ses-20191023T142402      B2         30       9    7.38            168          13        1.01
10  sub-456774_ses-20191022T133136    main        109      14    6.62            298          34        3.90
11  sub-456774_ses-20191022T133136      B2        109      15    7.52            298          42        6.08
12  sub-460432_ses-20191218T111453    main         73      12    1.01             30           6        1.00
13  sub-460432_ses-20191218T111453      B2         73      11    1.01             30           7        1.00
14  sub-460432_ses-20191219T134919    main         56       4    1.93             30           4        1.65
15  sub-460432_ses-20191219T134919      B2         56       4    3.45             30           2        1.09
16  sub-460434_ses-20191112T114755    main        219      13    2.92             39           6        2.20
17  sub-460434_ses-20191112T114755      B2        219      22   13.39             39           9        2.27
18  sub-460434_ses-20191113T135640    main        186      15    1.10             42          12        6.64
19  sub-460434_ses-20191113T135640      B2        186      37    1.00             42          13        6.94
20  sub-460434_ses-20191114T142520    main         50      16   12.02             84          12        5.81
21  sub-460434_ses-20191114T142520      B2         50      12    4.78             84           9        5.20
22  sub-460436_ses-20200109T111437    main        122       8    3.79             89           3        1.64
23  sub-460436_ses-20200109T111437      B2        122      19   13.42             89          15        5.91
24  sub-460436_ses-20200110T142717    main         76      16    9.70            106           4        2.67
25  sub-460436_ses-20200110T142717      B2         76      18   12.85            106          12        3.43
26  sub-484676_ses-20210413T112028    main        110      18    3.93             35           5        1.60
27  sub-484676_ses-20210413T112028      B2        110       5    2.31             35           2        1.20
28  sub-484676_ses-20210419T130102    main         68       6    4.09             42           9        5.62
29  sub-484676_ses-20210419T130102      B2         68       5    3.17             42           8        6.16
30  sub-484676_ses-20210420T130906    main         82       7    1.00             52           7        2.67
31  sub-484676_ses-20210420T130906      B2         82      10    1.00             52          11        2.92
32  sub-484677_ses-20210418T132006    main         61      15   13.08             73          12        6.53
33  sub-484677_ses-20210418T132006      B2         61      11    9.34             73          12        6.61
34  sub-484677_ses-20210419T161140    main         47       7    5.46             44           9        4.26
35  sub-484677_ses-20210419T161140      B2         47      10    7.52             44          10        4.50
36  sub-484677_ses-20210420T170516    main         30       4    1.27             76          12        3.25
37  sub-484677_ses-20210420T170516      B2         30       5    1.58             76          15        3.87
B2 N1: medulla mean 14.32, ALM mean 13.11, t = 0.39, p = 0.699, medulla lower in 9 of 19
B2 N2: medulla mean 3.74, ALM mean 6.91, t = -2.57, p = 0.0193, medulla lower in 14 of 19
main N1: medulla mean 11.21, ALM mean 11.42, t = -0.10, p = 0.925, medulla lower in 10 of 19
main N2: medulla mean 3.37, ALM mean 5.96, t = -2.44, p = 0.0255, medulla lower in 14 of 19

Result (reading G2). N1 does not differ (medulla 10.9, ALM 10.9, p = 0.98; 0.86 to 1.00 over the seeds; under B2 p = 0.876). N2 is lower in the medulla (3.35 against 5.93, p = 0.027, lower in 14 of 19 sessions; under B2 3.72 against 6.92, p = 0.018), which the criterion counts as reproduced under N2. In 5 sessions the medulla N2 is below 1.4, and each of these regions has a unit whose |z| exceeds 3000, so N2 there measures one unit.

Claim fig4d-decoding-asymmetry, reading G2¶

Prediction is asymmetric; ALM movement-null activity is predicted less well from the medulla (21 +- 6.7%) than the medulla from ALM (paired t test p = 1.2e-4, 16 sessions).

As in the main notebook (M8): ridge with lambda 0.01, readings T1 and T2, R1 and R2, predictors standardized or not; main-reading subspaces; under the claim's seed and four more.

In [8]:
bins = np.arange(int(round((ms.TASK_SPAN[0] - W[0]) / ms.BIN)), int(round((ms.TASK_SPAN[1] - W[0]) / ms.BIN)))
ALL_READ = [(s_, p_) for s_ in (False, True) for p_ in (True, False)]


def decode(rng, readings):
    out = []
    for p in alm_med:
        v = sessions[p]
        hit = np.array(v["sess"]["trials"]["outcome"])[v["keep"]] == "hit"
        for T in ("T1", "T2"):
            idx = np.arange(len(hit)) if T == "T1" else np.where(hit)[0]
            perm = rng.permutation(idx)
            ntr = int(round(0.7 * len(perm)))
            for src, tgt in (("ALM", "medulla"), ("medulla", "ALM")):
                xs, xt = fits[(p, src, "main")]["proj"], fits[(p, tgt, "main")]["proj"]
                for stdz, pooled in readings:
                    r2 = ms.ridge_r2(xs, xt, perm[:ntr], perm[ntr:], bins, stdz, pooled)
                    out.append(dict(session=p, T=T, src=src, std=stdz, R="R1" if pooled else "R2", r2=100 * r2.mean(),
                                    ppt=9 * xs.shape[2] / ntr))
    return pd.DataFrame(out)


def dec_summary(df):
    res = []
    for (T, stdz, R), d in df.groupby(["T", "std", "R"]):
        am_ = d[d.src == "ALM"].set_index("session").r2
        ma_ = d[d.src == "medulla"].set_index("session").r2
        res.append(dict(T=T, std=stdz, R=R, ALM_to_med=am_.mean(), med_to_ALM=ma_.mean(),
                        sem=ma_.std(ddof=1) / np.sqrt(len(ma_)), p_asym=stats.ttest_rel(am_, ma_.loc[am_.index]).pvalue,
                        sessions_above_0=int((ma_ > 0).sum())))
    return pd.DataFrame(res)


dec_runs = {k: decode(np.random.default_rng(seed("fig4d-alm-predicts-medulla-null", k)), ALL_READ if k == 0 else ALL_READ[::2])
            for k in SEED_OFFSETS}
print(dec_summary(dec_runs[0]).round(4).to_string())
print("expected medulla to ALM 21 +- 6.7, below ALM to medulla (p = 1.2e-4)")
for k in SEED_OFFSETS[1:]:
    print("offset", k)
    print(dec_summary(dec_runs[k]).round(4).to_string())
d0 = dec_runs[0][(dec_runs[0]["T"] == "T1") & (~dec_runs[0]["std"]) & (dec_runs[0].R == "R1")]
print("T1, unstandardized, R1, per session: R2 above 0 in %d of %d; Spearman correlation of R2 with predictors per training trial %.2f"
      % ((d0.r2 > 0).sum(), len(d0), stats.spearmanr(d0.r2, d0.ppt).correlation))
print("elapsed %.0f s, peak memory %.0f MB" % (time.time() - T0, resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e3))
    T    std   R    ALM_to_med    med_to_ALM           sem  p_asym  sessions_above_0
0  T1  False  R1 -2.305357e+07 -1.043531e+08  1.015211e+08  0.4405                 0
1  T1  False  R2 -3.024338e+07 -1.477675e+08  1.442790e+08  0.4324                 0
2  T1   True  R1 -1.166022e+07 -9.914631e+07  9.747170e+07  0.3798                 0
3  T1   True  R2 -1.180209e+07 -1.406590e+08  1.385688e+08  0.3622                 0
4  T2  False  R1 -2.275593e+07 -3.226205e+06  2.126994e+06  0.2185                 0
5  T2  False  R2 -2.489205e+07 -5.367612e+06  4.052112e+06  0.2026                 0
6  T2   True  R1 -1.764214e+07 -2.184690e+06  1.409228e+06  0.2153                 0
7  T2   True  R2 -1.897085e+07 -3.558428e+06  2.601033e+06  0.1973                 0
expected medulla to ALM 21 +- 6.7, below ALM to medulla (p = 1.2e-4)
offset 1000
    T    std   R    ALM_to_med    med_to_ALM           sem  p_asym  sessions_above_0
0  T1  False  R1 -6.934882e+06 -1.047046e+07  6.755574e+06  0.4625                 0
1  T1   True  R1 -1.325286e+06 -7.477979e+06  5.276269e+06  0.2283                 0
2  T2  False  R1 -5.304361e+06 -6.677264e+06  5.343752e+06  0.6575                 0
3  T2   True  R1 -3.728648e+06 -3.575836e+06  3.424294e+06  0.9473                 0
offset 2000
    T    std   R    ALM_to_med    med_to_ALM           sem  p_asym  sessions_above_0
0  T1  False  R1 -4.157976e+09 -5.920676e+06  5.347760e+06  0.3286                 0
1  T1   True  R1 -4.281325e+09 -3.042279e+06  2.832675e+06  0.3304                 0
2  T2  False  R1 -3.652562e+06 -5.450411e+06  4.648439e+06  0.5015                 0
3  T2   True  R1 -3.612808e+06 -3.633217e+06  3.352487e+06  0.9867                 0
offset 3000
    T    std   R    ALM_to_med    med_to_ALM           sem  p_asym  sessions_above_0
0  T1  False  R1 -3.373494e+07 -2.706730e+07  2.253051e+07  0.8591                 0
1  T1   True  R1 -2.844780e+06 -2.519651e+07  2.205096e+07  0.3086                 0
2  T2  False  R1 -3.762149e+06 -2.106649e+07  2.026367e+07  0.3432                 0
3  T2   True  R1 -3.601821e+06 -1.302191e+07  1.255588e+07  0.3511                 0
offset 4000
    T    std   R    ALM_to_med    med_to_ALM           sem  p_asym  sessions_above_0
0  T1  False  R1 -2.300560e+07 -2.927669e+06  2.058592e+06  0.3023                 0
1  T1   True  R1 -8.958196e+06 -1.542923e+06  1.199613e+06  0.2453                 0
2  T2  False  R1 -1.915978e+07 -5.307553e+06  4.010098e+06  0.2975                 0
3  T2   True  R1 -1.819270e+07 -3.343618e+06  2.510928e+06  0.2964                 0
T1, unstandardized, R1, per session: R2 above 0 in 0 of 38; Spearman correlation of R2 with predictors per training trial -0.23
elapsed 3383 s, peak memory 3533 MB

Result (reading G2): not reproduced. Every mean R2 is below -10^6 % (no session has a medulla to ALM R2 above zero), and the paired t test of ALM to medulla against medulla to ALM gives p = 0.15 to 0.46 under the claim's seed and 0.17 to 0.87 over the other seeds.

Summary (reading G2)¶

Claim Under G2
fig4b-medulla-selectivity Partially reproduced (16.7, 28.3, 63.4%)
fig4c-alm-null-potent-similar Reproduced (main reading, V2: 33.9 against 42.7%, p = 0.251)
fig4c-medulla-null-smaller Partially reproduced (test holds, null mean out of tolerance)
fig4e-medulla-null-lower-dimension Reproduced under N2 (p = 0.027), not under N1 (p = 0.98)
fig4d-decoding-asymmetry Not reproduced

The attempt's outcomes rest on reading G1 (main notebook), whose bilateral unit counts are near the paper's. G1 is held fixed while the readings of M3 to M6 are searched, so the two claims that hold here under G2 are recorded as not reproduced or partially reproduced under G1; G2 gives about 2.5 times the paper's units and transfers CCF labels from the nearest unit classified good. 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.

The shuffle dimensions of a few regions here, and with them the variance explained, the dimensionality and the decoding R2, differ in their last digits or more between processors (see the main notebook's summary); an earlier execution on another runner gave the same verdicts.