Gao et al. (2026) on dandiset 001683: evoked potentials and PLI in wild-type rats¶

Paper. Gao H, Frake A, Durand DM, He B (2026). Transcranial focused ultrasound stimulation targeting white matter inhibits seizures in a rat model of epilepsy. IEEE Trans Neural Syst Rehabil Eng 34, 251-259. doi:10.1109/tnsre.2025.3644273. The claims file was written from the NIH author manuscript (PMC12848950) and the supplement.

Dandiset. DANDI:001683, version 0.260109.2104, the only published version (the paper cites none; see seizure_metrics.ipynb).

The wild-type phase, before any 4-AP: the target-confirmation recordings (EP data: a resting BASELINE recording and one recording per transducer position, each with about 200 bursts, from the 64-channel intracranial array in left S1), and one EEG recording per rat labelled EEG data for PLV analysis (32 skull channels, *_1Hz_20ms_CC).

Claim Tested here
fig5b-tfus-evoked-potentials yes
fig5cdj-wild-type-gamma-pli-decrease blocked (data_missing): no EEG of the resting baseline (the sham); the tFUS part is run
fig5ghi-low-band-pli-s1-only yes
In [1]:
import re
import time
import warnings
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
import multiprocessing as mp

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

import tfus

warnings.filterwarnings("ignore")
pd.set_option("display.width", 220)
pd.set_option("display.max_columns", 40)
pd.set_option("display.max_rows", 300)

started = time.time()
assets = tfus.list_assets()
small = assets[assets["size"] < 2e9]
metas = tfus.read_all_meta(small.asset_id.tolist())
ep = [m for m in metas if m["kind"] == "EP data"]
plv = [m for m in metas if m["kind"].startswith("EEG data for PLV")]
print(f"dandiset {tfus.DANDISET_ID} version {tfus.DANDISET_VERSION}: {len(small)} files under 2 GB; "
      f"EP files {len(ep)}, PLV files {len(plv)}, other {len(metas) - len(ep) - len(plv)}; read in {time.time() - started:.0f} s")
dandiset 001683 version 0.260109.2104: 248 files under 2 GB; EP files 228, PLV files 20, other 0; read in 113 s

Data check¶

Each check of the metadata against the values is stated under its output.

In [2]:
def position(m):
    lab = m["label"].split("_", 1)[1]
    if lab == "BASELINE":
        return "BASELINE"
    lab = lab.replace("_", "")
    for key in ("CENTER2", "CENTER", "SHALLOW1mm", "DEEP1mm", "FRONT05mm", "FRONT1mm", "BACK05mm", "BACK1mm", "LSIDE05mm", "RSIDE05mm"):
        if "S1" in lab:
            return "S1:" + lab
        if key in lab:
            return key
    return "?" + lab

E = pd.DataFrame([{"subject": m["subject"], "label": m["label"], "position": position(m), "start": m["start"],
                   "n_trials": len(m["intervals"]), "seconds": m["n_samples"] / m["rate"], "channels": m["n_channels"],
                   "spacing": np.median(np.diff(np.sort(m["intervals"].start))), "window": np.median(m["intervals"].stop - m["intervals"].start),
                   "group": m["group"], "asset_id": m["asset_id"]} for m in ep]).sort_values(["subject", "start"])
print("EP files per rat:", E.groupby("subject").size().to_dict())
print("Rats with EP files:", E.subject.nunique(), "(paper: 23 wild-type rats, Fig. 5B N = 23)")
print("Positions recorded:", E.position.value_counts().to_dict())
print("Channels:", E.channels.unique().tolist(), "; locations:", sorted({tuple(m['electrodes'].location.unique()) for m in ep}),
      "; rate:", sorted({m['rate'] for m in ep}))
print("Interval spacing (s):", E.spacing.round(3).value_counts().to_dict(), "; interval length (s):", E.window.round(3).value_counts().to_dict())
print("Trials per file:", E.groupby("position").n_trials.agg(["min", "median", "max"]).to_string())
print("Tags of the EP intervals:", sorted({t for m in ep for t in m["intervals"].tag}))
P = pd.DataFrame([{"subject": m["subject"], "label": m["label"], "start": m["start"], "n_trials": len(m["intervals"]),
                   "spacing": np.median(np.diff(np.sort(m["intervals"].start))), "seconds": m["n_samples"] / m["rate"],
                   "channels": m["n_channels"]} for m in plv]).sort_values("subject")
print("\nPLV files:", len(P), "rats; labels:", sorted(P.label.str.split("_", n=1).str[1].unique()))
print(P.to_string(index=False))
print("Rats with EP files but no PLV file:", sorted(set(E.subject) - set(P.subject)))
same = all(m["electrodes"][["x", "y"]].equals(plv[0]["electrodes"][["x", "y"]]) for m in plv)
print("PLV electrode tables all the same:", same)
other = [m for m in metas if m["kind"] not in ("EP data",) and not m["kind"].startswith("EEG data for PLV")]
print("Other kinds among the small files:", sorted({m['kind'] for m in other}))
EP files per rat: {'BH624': 9, 'BH626': 7, 'BH634': 9, 'BH635': 10, 'BH638': 10, 'BH642': 9, 'BH644': 10, 'BH645': 10, 'BH646': 11, 'BH647': 10, 'BH648': 10, 'BH649': 10, 'BH650': 10, 'BH651': 10, 'BH652': 13, 'BH653': 10, 'BH659': 10, 'BH660': 10, 'BH661': 10, 'BH662': 10, 'BH663': 10, 'BH665': 10, 'BH666': 10}
Rats with EP files: 23 (paper: 23 wild-type rats, Fig. 5B N = 23)
Positions recorded: {'BASELINE': 23, 'CENTER': 23, 'FRONT05mm': 23, 'BACK1mm': 23, 'FRONT1mm': 23, 'LSIDE05mm': 23, 'RSIDE05mm': 23, 'BACK05mm': 22, 'DEEP1mm': 22, 'SHALLOW1mm': 18, 'CENTER2': 1, 'S1:150020067S1': 1, 'S1:1500S1SHALLOW1mm': 1, 'S1:1500S1L05F1mm': 1, 'S1:1500S1R05B05mm': 1}
Channels: [64] ; locations: [('Left S1',)] ; rate: [3051.7578125]
Interval spacing (s): {2.0: 220, 2.5: 8} ; interval length (s): {2.2: 228}
Trials per file:                      min  median  max
position                             
BACK05mm             199   200.0  252
BACK1mm              200   200.0  253
BASELINE             120   150.0  175
CENTER               199   200.0  264
CENTER2              214   214.0  214
DEEP1mm              200   200.0  250
FRONT05mm            199   200.0  250
FRONT1mm             200   200.0  263
LSIDE05mm            200   200.0  253
RSIDE05mm            199   200.0  250
S1:150020067S1       205   205.0  205
S1:1500S1L05F1mm     200   200.0  200
S1:1500S1R05B05mm    202   202.0  202
S1:1500S1SHALLOW1mm  200   200.0  200
SHALLOW1mm           199   200.0  230
Tags of the EP intervals: ['tFUS']

PLV files: 20 rats; labels: ['1Hz_20ms_CC', 'CC_1Hz_20ms_15']
subject                label                            start  n_trials  spacing    seconds  channels
  BH624 BH624_CC_1Hz_20ms_15 2024-12-03T17:20:27.000000-05:00       251 1.999995 502.561505        32
  BH626    BH626_1Hz_20ms_CC 2024-11-29T19:35:44.000000-05:00       301 0.999997 301.402685        32
  BH634    BH634_1Hz_20ms_CC 2024-12-11T19:31:27.000000-05:00       221 1.999995 443.337933        32
  BH635    BH635_1Hz_20ms_CC 2024-12-13T18:58:05.000000-05:00       220 1.999995 440.401920        32
  BH645    BH645_1Hz_20ms_CC 2025-01-14T18:00:19.000000-05:00       200 1.999995 400.723804        32
  BH646    BH646_1Hz_20ms_CC 2025-02-22T18:58:25.000000-05:00       200 1.999995 401.143235        32
  BH647    BH647_1Hz_20ms_CC 2025-01-21T18:08:14.000000-05:00       201 1.999995 403.072614        32
  BH648    BH648_1Hz_20ms_CC 2025-02-13T18:10:54.000000-05:00       200 1.999995 400.723804        32
  BH649    BH649_1Hz_20ms_CC 2025-02-16T20:52:12.000000-05:00       200 1.999995 400.556032        32
  BH650    BH650_1Hz_20ms_CC 2025-02-18T17:58:00.000000-05:00       200 1.999995 401.478779        32
  BH651    BH651_1Hz_20ms_CC 2025-02-04T19:26:29.000000-05:00       200 1.999995 401.311007        32
  BH652    BH652_1Hz_20ms_CC 2025-02-07T20:01:16.000000-05:00       200 1.999995 400.388260        32
  BH653    BH653_1Hz_20ms_CC 2025-02-11T18:05:58.000000-05:00       200 1.999995 400.388260        32
  BH659    BH659_1Hz_20ms_CC 2025-02-28T19:35:14.000000-05:00       200 1.999995 401.227121        32
  BH660    BH660_1Hz_20ms_CC 2025-03-04T18:08:40.000000-05:00       200 1.999995 400.723804        32
  BH661    BH661_1Hz_20ms_CC 2025-03-06T18:17:22.000000-05:00       200 1.999995 400.556032        32
  BH662    BH662_1Hz_20ms_CC 2025-03-11T16:18:14.000000-04:00       200 1.999995 401.143235        32
  BH663    BH663_1Hz_20ms_CC 2025-03-13T18:20:01.000000-04:00       206 1.999995 413.810033        32
  BH665    BH665_1Hz_20ms_CC 2025-03-18T17:14:39.000000-04:00       201 1.999995 403.492045        32
  BH666    BH666_1Hz_20ms_CC 2025-02-25T17:40:30.000000-05:00       206 1.999995 413.810033        32
Rats with EP files but no PLV file: ['BH638', 'BH642', 'BH644']
PLV electrode tables all the same: True
Other kinds among the small files: []

The EP files hold the 64 intracranial channels of left S1 only; there is no EEG in them. The resting BASELINE recordings last about 4 to 5 minutes and carry 120 to 151 intervals every 2 s, tagged tFUS like the stimulated ones. The PLV EEG files are recordings with 20 ms pulses (1Hz_20ms_CC), the pulse of the epilepsy experiment (Methods D), made during the wild-type phase, of 20 of the 23 rats. Their intervals come every 2 s in most files, every 1 s in a few. No EEG recording of a resting baseline (the sham of Figs. 5E-F) is in the dandiset.

In [3]:
# Alignment of the intervals with the response: the mean EEG of the PLV files and the mean LFP of the
# CENTER files around the interval starts, baseline-subtracted, in 10 ms bins.
def mean_response(m, n=100, pre=0.05, post=0.2):
    x = tfus.read_epochs(m, np.sort(m["intervals"].start.to_numpy())[:n], pre=pre, post=post)
    x = x - x[:, :int(pre * tfus.RATE)].mean(axis=1, keepdims=True)
    return np.abs(x.mean(axis=0)).max(axis=1) * 1e6     # peak over channels of the trial mean, uV

rows = []
for kind, files in (("PLV EEG", plv[:5]), ("EP LFP CENTER", [m for m in ep if position(m) == "CENTER"][:5]),
                    ("EP LFP BASELINE", [m for m in ep if position(m) == "BASELINE"][:5])):
    for m in files:
        r = mean_response(m)
        t = (np.arange(len(r)) - int(0.05 * tfus.RATE)) / tfus.RATE * 1000
        rows.append({"kind": kind, "subject": m["subject"], "pre -50-0 ms": r[t < 0].max(), "0-40 ms": r[(t >= 0) & (t < 40)].max(),
                     "40-200 ms": r[t >= 40].max()})
print("Peak over channels of |trial mean| (uV), first 100 intervals of five files of each kind:")
print(pd.DataFrame(rows).round(2).to_string(index=False))
Peak over channels of |trial mean| (uV), first 100 intervals of five files of each kind:
           kind subject  pre -50-0 ms  0-40 ms  40-200 ms
        PLV EEG   BH624          0.66    10.66       4.74
        PLV EEG   BH626          0.50    13.55       5.80
        PLV EEG   BH634          0.84     7.09       3.14
        PLV EEG   BH635          1.24     7.14       5.03
        PLV EEG   BH645          0.84     9.89       3.18
  EP LFP CENTER   BH624          7.13     9.80      28.25
  EP LFP CENTER   BH626         20.03    14.05      18.18
  EP LFP CENTER   BH634          5.82    13.16      17.04
  EP LFP CENTER   BH635          6.85    11.48      21.46
  EP LFP CENTER   BH638          5.80     8.35      25.76
EP LFP BASELINE   BH624          7.72    16.04       8.38
EP LFP BASELINE   BH626         16.21    20.63      47.00
EP LFP BASELINE   BH634          6.76     7.84      20.22
EP LFP BASELINE   BH635          9.47     8.33      12.57
EP LFP BASELINE   BH638         11.31    14.32      19.64
In [4]:
# Alignment of the EP intervals with the bursts (verifier, round 1). The intervals last 2.2 s and start
# 2 s apart; a burst at another lag would still show at a fixed lag of the 2 s cycle. Two checks on the
# first 40 cycles of every CENTER and BASELINE file: (1) the RMS over the 64 channels of the
# trial-mean LFP (3-300 Hz) over the whole cycle, -100 to 1900 ms from the interval start, in 10 ms
# bins; (2) the power at 1400-1520 Hz, the band of the bursts' 1.5 kHz pulse repetition frequency (just
# under the 1526 Hz Nyquist frequency), where an ultrasound artifact would mark the 67 ms burst.
from scipy import signal as sg
for kind, files in (("EP", ep), ("PLV", plv)):
    L = np.concatenate([(m["intervals"].stop - m["intervals"].start).to_numpy() for m in files])
    print(f"{kind} files, interval stop - start: {L.min():.4f} to {L.max():.4f} s; start spacing:",
          sorted({round(float(np.median(np.diff(np.sort(m['intervals'].start)))), 3) for m in files}))
SOS_LFP = sg.butter(4, [3, 300], btype="bandpass", fs=tfus.RATE, output="sos")
SOS_PRF = sg.butter(4, [1400, 1520], btype="bandpass", fs=tfus.RATE, output="sos")

def cycle_profile(m, n=40):
    on = np.sort(m["intervals"].start.to_numpy())[1:n + 1]
    pre, L, b = int(0.1 * tfus.RATE), int(2.0 * tfus.RATE), int(0.01 * tfus.RATE)
    i0, i1 = int(on[0] * tfus.RATE) - pre, int(on[-1] * tfus.RATE) - pre + L
    x = tfus.read_rows(m, i0, i1, threads=8)
    idx = [int(t * tfus.RATE) - pre - i0 for t in on]
    lfp = sg.sosfiltfilt(SOS_LFP, x, axis=0)
    mu = np.mean([lfp[i:i + L] for i in idx], axis=0)
    rms = np.sqrt((mu ** 2).mean(1)) * 1e6
    hf = (sg.sosfiltfilt(SOS_PRF, x, axis=0) ** 2).mean(1)
    pw = np.mean([hf[i:i + L] for i in idx], axis=0)
    nb = L // b
    return rms[:nb * b].reshape(nb, b).mean(1), pw[:nb * b].reshape(nb, b).mean(1)

t_cyc = np.arange(int(2.0 * tfus.RATE) // int(0.01 * tfus.RATE)) * 10 - 100
prof = {}
with ThreadPoolExecutor(4) as ex:
    jobs = [m for m in ep if position(m) in ("CENTER", "BASELINE")]
    for m, r in zip(jobs, ex.map(cycle_profile, jobs)):
        prof[(m["subject"], position(m))] = r
burst = (t_cyc >= 0) & (t_cyc < 70)
rows = []
for (s, pos), (rms, pw) in prof.items():
    rows.append({"subject": s, "position": pos, "LFP RMS 0-70 ms / rest (uV)": f"{rms[burst].mean():.2f} / {rms[~burst & (t_cyc >= 0)].mean():.2f}",
                 "LFP RMS peak lag (ms)": int(t_cyc[np.argmax(rms)]),
                 "1.4-1.5 kHz power 0-70 ms / rest": pw[burst].mean() / pw[~burst & (t_cyc >= 0)].mean(),
                 "1.4-1.5 kHz peak lag (ms)": int(t_cyc[np.argmax(pw)])})
AL = pd.DataFrame(rows).sort_values(["position", "subject"])
print(AL.round(3).to_string(index=False))
for pos in ("CENTER", "BASELINE"):
    a = AL[AL.position == pos]
    print(f"{pos}: 1.4-1.5 kHz power ratio 0-70 ms over the rest of the cycle, median {a['1.4-1.5 kHz power 0-70 ms / rest'].median():.3f}, "
          f"above 1.1 in {(a['1.4-1.5 kHz power 0-70 ms / rest'] > 1.1).sum()} of {len(a)} rats; "
          f"high-frequency peak within 0-70 ms in {((a['1.4-1.5 kHz peak lag (ms)'] >= 0) & (a['1.4-1.5 kHz peak lag (ms)'] < 70)).sum()}; "
          f"LFP RMS peak within 0-200 ms in {((a['LFP RMS peak lag (ms)'] >= 0) & (a['LFP RMS peak lag (ms)'] < 200)).sum()}")
mean_rms = {pos: np.mean([v[0] for k, v in prof.items() if k[1] == pos], axis=0) for pos in ("CENTER", "BASELINE")}
for pos, r in mean_rms.items():
    print(f"{pos}, mean over rats of the cycle RMS profile: 0-200 ms {r[(t_cyc >= 0) & (t_cyc < 200)].mean():.2f} uV, "
          f"200-1900 ms {r[t_cyc >= 200].mean():.2f} uV, max {r.max():.2f} uV at {int(t_cyc[np.argmax(r)])} ms")
EP files, interval stop - start: 2.2000 to 2.2000 s; start spacing: [2.0, 2.5]
PLV files, interval stop - start: 2.2000 to 2.2000 s; start spacing: [1.0, 2.0]
subject position LFP RMS 0-70 ms / rest (uV)  LFP RMS peak lag (ms)  1.4-1.5 kHz power 0-70 ms / rest  1.4-1.5 kHz peak lag (ms)
  BH624 BASELINE                 3.57 / 5.30                   1440                             0.981                       1130
  BH626 BASELINE                8.42 / 10.49                    130                             1.009                        120
  BH634 BASELINE                 4.61 / 4.28                   1310                             1.008                        640
  BH635 BASELINE                 3.46 / 5.07                    910                             0.992                       1470
  BH638 BASELINE                 4.21 / 6.03                    330                             1.064                       1910
  BH642 BASELINE                 7.89 / 9.99                   1560                             0.990                        530
  BH644 BASELINE                 2.35 / 3.42                   1640                             0.994                        700
  BH645 BASELINE                 3.90 / 3.66                   1450                             0.996                       1800
  BH646 BASELINE                 4.38 / 4.39                    -80                             1.015                       1630
  BH647 BASELINE                 4.49 / 2.98                   1600                             0.997                       1680
  BH648 BASELINE                 4.45 / 5.80                   1520                             1.001                       1760
  BH649 BASELINE                 6.64 / 5.04                    640                             0.978                        740
  BH650 BASELINE                 6.00 / 5.93                   1770                             0.869                        820
  BH651 BASELINE                 3.73 / 3.57                   1840                             0.996                       1610
  BH652 BASELINE                 4.17 / 3.56                    130                             0.991                       1320
  BH653 BASELINE                 6.96 / 6.17                   1630                             0.979                       1580
  BH659 BASELINE                 3.80 / 4.82                   1830                             0.998                        750
  BH660 BASELINE                 8.12 / 4.48                   1820                             1.038                       1820
  BH661 BASELINE                 9.45 / 7.46                    620                             1.086                        320
  BH662 BASELINE                12.07 / 7.39                   1570                             1.019                        140
  BH663 BASELINE                 2.93 / 3.46                    880                             1.013                       1540
  BH665 BASELINE                 3.03 / 7.31                   1250                             0.967                        190
  BH666 BASELINE                 4.96 / 9.52                   1880                             0.915                       1610
  BH624   CENTER                 4.53 / 6.49                    910                             1.458                         30
  BH626   CENTER                 1.39 / 7.49                   1250                             0.980                        960
  BH634   CENTER                 5.71 / 6.74                    470                             1.082                         50
  BH635   CENTER                 2.96 / 4.74                    970                             5.793                         30
  BH638   CENTER                 3.45 / 7.41                    590                             0.782                        560
  BH642   CENTER               11.38 / 16.79                    160                             1.021                       1440
  BH644   CENTER                 2.97 / 4.34                    210                             1.072                         20
  BH645   CENTER                 4.49 / 4.61                   1660                             1.435                         20
  BH646   CENTER                 3.93 / 7.26                    360                             0.964                       1440
  BH647   CENTER                 2.85 / 3.08                   1050                             1.072                         40
  BH648   CENTER                 3.65 / 5.14                   1750                             1.071                        150
  BH649   CENTER                 2.47 / 2.56                   1190                             1.605                         20
  BH650   CENTER                 8.55 / 9.25                    310                             1.336                        310
  BH651   CENTER                 1.54 / 2.94                    840                             1.951                         30
  BH652   CENTER                 3.36 / 5.13                    290                             1.167                         10
  BH653   CENTER                5.65 / 10.22                   1460                             1.595                         30
  BH659   CENTER                 1.55 / 3.76                    240                             1.366                         20
  BH660   CENTER                 5.94 / 6.31                    420                             1.655                         40
  BH661   CENTER                 4.25 / 4.69                   1720                             1.079                       1720
  BH662   CENTER                4.17 / 10.00                    580                             0.978                        800
  BH663   CENTER                 2.26 / 3.50                    450                             1.096                         60
  BH665   CENTER                 3.49 / 8.07                    350                             1.057                        340
  BH666   CENTER                3.85 / 13.42                    220                             0.987                        320
CENTER: 1.4-1.5 kHz power ratio 0-70 ms over the rest of the cycle, median 1.082, above 1.1 in 10 of 23 rats; high-frequency peak within 0-70 ms in 13; LFP RMS peak within 0-200 ms in 1
BASELINE: 1.4-1.5 kHz power ratio 0-70 ms over the rest of the cycle, median 0.996, above 1.1 in 0 of 23 rats; high-frequency peak within 0-70 ms in 0; LFP RMS peak within 0-200 ms in 2
CENTER, mean over rats of the cycle RMS profile: 0-200 ms 5.20 uV, 200-1900 ms 6.76 uV, max 13.56 uV at 220 ms
BASELINE, mean over rats of the cycle RMS profile: 0-200 ms 5.88 uV, 200-1900 ms 5.62 uV, max 8.06 uV at 120 ms

In the PLV EEG the mean response after the interval start is many times the pre-onset level, so the interval starts are the pulse onsets, in seconds (these files' tables are in seconds, unlike the seizure labels). In the intracranial EP files the LFP shows no clear response at any lag of the 2 s cycle, in CENTER as in BASELINE (second table). The bursts can still be located: power at 1.4 to 1.5 kHz, the band of their 1.5 kHz pulse repetition frequency, peaks 10 to 60 ms after the interval start in most CENTER recordings and in none of the resting ones (counts printed above), so the interval starts are the burst onsets. An EP absent from the LFP is therefore not a misalignment of the intervals.

fig5b-tfus-evoked-potentials¶

tFUS of the CC in wild-type rats evokes potentials in the left S1 LFP that differ significantly from the sham (resting) recording at some time points.

For each rat, the LFP around the first 200 bursts of the target-confirmation recording at the chosen coordinates, and around pseudo onsets in the resting BASELINE recording, each trial baseline-subtracted over -20 to 0 ms, averaged over trials. Readings of the claims file: the channel, (a) the mean over the 64 channels or (b) each channel; the sham onsets, (a) every 2 s from the start of the resting recording or (b) 200 onsets drawn at random (seed 0); the ANOVA, ordinary or repeated measures (tfus.timepoint_tests; the repeated reading adds a random intercept per rat to the same two-way ANOVA), Bonferroni over the time points from 0 to 200 ms. The dandiset does not say which position was chosen. The paper says "the coordinates with the clearest EP were used" (supplement, Target Confirmation); two readings are run: (a) the CENTER recording, the first estimate, and (b) the position whose channel-mean EP has the largest peak from 0 to 200 ms. Reading (b) picks the position on the data it then tests, so it is also run with the position picked on the odd trials and the test made on the even trials (largest, split). The BASELINE file's own interval starts are shown as a third sham variant.

In [5]:
rng = np.random.default_rng(0)
n0 = int(round(tfus.EP_PRE * tfus.RATE))
evo = {}          # (subject, position) -> evoked (time, channels)

evo_half = {}     # (subject, position) -> (evoked of the odd trials, evoked of the even trials)

def ep_job(m):
    on = np.sort(m["intervals"].start.to_numpy())[:tfus.N_TRIALS]
    x = tfus.read_epochs(m, on, threads=16)
    return (m["subject"], position(m)), tfus.evoked(x), (tfus.evoked(x[0::2]), tfus.evoked(x[1::2]))

t0 = time.time()
stim_files = [m for m in ep if position(m) not in ("BASELINE",) and not position(m).startswith("S1:")]
with ThreadPoolExecutor(4) as ex:
    for k, v, h in ex.map(ep_job, stim_files):
        evo[k], evo_half[k] = v, h
sham = {}
for m in [m for m in ep if position(m) == "BASELINE"]:
    T = m["n_samples"] / tfus.RATE
    grid = np.arange(2.0, T - tfus.EP_POST, 2.0)[:tfus.N_TRIALS]
    rand = np.sort(rng.uniform(tfus.EP_PRE, T - tfus.EP_POST, tfus.N_TRIALS))
    own = np.sort(m["intervals"].start.to_numpy())[:tfus.N_TRIALS]
    sham[m["subject"]] = {name: tfus.evoked(tfus.read_epochs(m, on, threads=16)) for name, on in
                          (("every 2 s", grid), ("random", rand), ("file intervals", own))}
    sham[m["subject"]]["n"] = {"every 2 s": len(grid), "random": len(rand), "file intervals": len(own)}
print(f"evoked potentials of {len(evo)} stimulated recordings and {len(sham)} resting recordings in {time.time() - t0:.0f} s")
print("Sham onsets per rat (every 2 s):", {s: v["n"]["every 2 s"] for s, v in sham.items()})
evoked potentials of 201 stimulated recordings and 23 resting recordings in 276 s
Sham onsets per rat (every 2 s): {'BH624': 122, 'BH626': 150, 'BH634': 150, 'BH635': 150, 'BH638': 150, 'BH642': 150, 'BH644': 150, 'BH645': 150, 'BH646': 150, 'BH647': 150, 'BH648': 150, 'BH649': 150, 'BH650': 150, 'BH651': 151, 'BH653': 150, 'BH659': 150, 'BH660': 150, 'BH662': 150, 'BH663': 150, 'BH665': 150, 'BH652': 175, 'BH661': 150, 'BH666': 150}
In [6]:
t_ms = (np.arange(-n0, int(round(tfus.EP_POST * tfus.RATE))) / tfus.RATE) * 1000
post = t_ms >= 0
rats = sorted(sham)
peak = {k: np.abs(v.mean(axis=1)[post]).max() for k, v in evo.items()}
chosen_b = {s: max([k for k in evo if k[0] == s], key=lambda k: peak[k])[1] for s in rats}
peak_odd = {k: np.abs(v[0].mean(axis=1)[post]).max() for k, v in evo_half.items()}
chosen_split = {s: max([k for k in evo if k[0] == s], key=lambda k: peak_odd[k])[1] for s in rats}
print("Position with the largest channel-mean EP peak (reading b):", pd.Series(chosen_b).value_counts().to_dict())
print("Same, picked on the odd trials:", pd.Series(chosen_split).value_counts().to_dict(),
      f"; same position as reading (b) in {sum(chosen_b[s] == chosen_split[s] for s in rats)} of {len(rats)} rats")
rows, results = [], {}
for pos_reading in ("CENTER", "largest", "largest, split"):
    if pos_reading == "largest, split":
        A = np.stack([evo_half[(s, chosen_split[s])][1] for s in rats])    # even trials only
    else:
        keys = [(s, "CENTER" if pos_reading == "CENTER" else chosen_b[s]) for s in rats]
        A = np.stack([evo[k] for k in keys])                   # rats, time, channels
    for sham_reading in ("every 2 s", "random", "file intervals"):
        B = np.stack([sham[s][sham_reading] for s in rats])
        res = tfus.timepoint_tests(A.mean(axis=2)[:, post], B.mean(axis=2)[:, post])
        per_ch = [tfus.timepoint_tests(A[:, post, c], B[:, post, c]) for c in range(A.shape[2])]
        for anova in ("ordinary", "repeated"):
            col = f"p_{anova}"
            sig = res[col] < 0.05
            rows.append({"position": pos_reading, "sham onsets": sham_reading, "anova": anova,
                         "mean of 64: significant time points": int(sig.sum()), "of": len(res),
                         "first (ms)": round(float(t_ms[post][sig.to_numpy()][0]), 1) if sig.any() else None,
                         "smallest p": res[col].min(),
                         "channels with any significant point": sum(int((r[col] < 0.05).any()) for r in per_ch)})
        results[(pos_reading, sham_reading)] = (A, B, res)
TB = pd.DataFrame(rows)
print(TB.round(5).to_string(index=False))
Position with the largest channel-mean EP peak (reading b): {'BACK1mm': 5, 'FRONT1mm': 4, 'RSIDE05mm': 3, 'LSIDE05mm': 3, 'SHALLOW1mm': 3, 'CENTER': 2, 'FRONT05mm': 1, 'DEEP1mm': 1, 'BACK05mm': 1}
Same, picked on the odd trials: {'DEEP1mm': 4, 'SHALLOW1mm': 4, 'FRONT1mm': 4, 'BACK1mm': 3, 'BACK05mm': 3, 'CENTER': 2, 'RSIDE05mm': 1, 'LSIDE05mm': 1, 'FRONT05mm': 1} ; same position as reading (b) in 12 of 23 rats
      position    sham onsets    anova  mean of 64: significant time points  of  first (ms)  smallest p  channels with any significant point
        CENTER      every 2 s ordinary                                    0 610         NaN     1.00000                                    1
        CENTER      every 2 s repeated                                    0 610         NaN     1.00000                                   12
        CENTER         random ordinary                                   13 610        66.5     0.01311                                   39
        CENTER         random repeated                                   26 610        64.2     0.00067                                   55
        CENTER file intervals ordinary                                    0 610         NaN     1.00000                                    3
        CENTER file intervals repeated                                    0 610         NaN     0.43929                                   22
       largest      every 2 s ordinary                                    0 610         NaN     1.00000                                   25
       largest      every 2 s repeated                                    0 610         NaN     1.00000                                   29
       largest         random ordinary                                    0 610         NaN     1.00000                                   34
       largest         random repeated                                    0 610         NaN     0.09138                                   37
       largest file intervals ordinary                                    0 610         NaN     1.00000                                   33
       largest file intervals repeated                                    0 610         NaN     0.58149                                   43
largest, split      every 2 s ordinary                                    0 610         NaN     1.00000                                   11
largest, split      every 2 s repeated                                    0 610         NaN     1.00000                                   17
largest, split         random ordinary                                    0 610         NaN     1.00000                                   18
largest, split         random repeated                                    0 610         NaN     0.05414                                   47
largest, split file intervals ordinary                                    0 610         NaN     1.00000                                   14
largest, split file intervals repeated                                    0 610         NaN     1.00000                                   35
In [7]:
A, B, res = results[("CENTER", "every 2 s")]
a, b = A.mean(axis=2) * 1e6, B.mean(axis=2) * 1e6
fig, ax = plt.subplots(figsize=(7, 3))
for x, lab in ((a, "tFUS (CENTER)"), (b, "sham (every 2 s)")):
    m, s = x.mean(0), x.std(0) / np.sqrt(len(x))
    ax.plot(t_ms, m, label=lab); ax.fill_between(t_ms, m - s, m + s, alpha=0.3)
sig = np.zeros(len(t_ms), bool); sig[post] = res.p_repeated.to_numpy() < 0.05
ax.fill_between(t_ms, -100, 100, where=sig, color="gold", alpha=0.3, label="p < 0.05 (repeated)")
lim = np.abs(np.concatenate([a.mean(0), b.mean(0)])).max() * 1.5
ax.set_ylim(-lim, lim); ax.set_xlabel("ms from onset"); ax.set_ylabel("channel-mean LFP (uV)"); ax.legend(fontsize=7)
plt.tight_layout(); plt.show()
print(f"Plotted means: tFUS {a.mean(0).min():.2f} to {a.mean(0).max():.2f} uV, sham {b.mean(0).min():.2f} to {b.mean(0).max():.2f} uV; axis +/-{lim:.2f} uV holds both means")
print("Per rat, peak |channel-mean EP| from 0 to 200 ms (uV), CENTER against sham every 2 s:")
print(pd.DataFrame({"tFUS": np.abs(a[:, post]).max(1), "sham": np.abs(b[:, post]).max(1)}, index=rats).round(2).T.to_string())
No description has been provided for this image
Plotted means: tFUS -1.30 to 3.10 uV, sham -1.55 to 1.72 uV; axis +/-4.65 uV holds both means
Per rat, peak |channel-mean EP| from 0 to 200 ms (uV), CENTER against sham every 2 s:
      BH624  BH626  BH634  BH635  BH638  BH642  BH644  BH645  BH646  BH647  BH648  BH649  BH650  BH651  BH652  BH653  BH659  BH660  BH661  BH662  BH663  BH665  BH666
tFUS   5.57   5.41  10.13  10.29   8.81  24.21   6.08   7.05   5.69   6.32   3.58   5.90   7.91   6.34  16.97  15.67   3.50   8.21   7.04  14.31   4.36  20.82  16.32
sham   5.85   9.59  10.23  12.64   6.87  20.68   5.21   5.04   6.87   4.73   7.37  12.19  10.88   8.44   3.13  11.41   9.52   8.87  10.04  14.07   5.95   9.11  12.21

Result: blocked (methods_underspecified). The readings the criterion names disagree. With the mean over the 64 channels, two of the eighteen combinations of position, sham onsets and ANOVA find significant time points, both with the CENTER position and random sham onsets (ordinary: 13 of 610 points from 66.5 ms, smallest Bonferroni p = 0.013; repeated measures: 26 points from 64.2 ms, p = 0.00067); the other sixteen find none (smallest p = 0.054 to 1), including the largest-EP position chosen on the odd trials and tested on the even ones. With each channel tested, 1 to 55 of the 64 channels have a significant point, depending on the combination. The mean channel-mean EP at the CENTER position reaches 3.1 uV, the sham 1.7 uV. The intervals mark the burst onsets (the 1.4-1.5 kHz power peaks 10 to 60 ms after the interval start in 13 of 23 CENTER recordings and in none of the resting ones), so the missing EP is not a misalignment. The criterion blocks the claim when the readings disagree; which channels, which position and which sham onsets the paper used are questions for its authors.

Wild-type PLI¶

PLI (M6) of the PLV EEG files, first 200 pulses, in the windows pre (-20 to 0 ms), tFUS (0 to 20 ms) and post (20 to 200 ms), for every pair of one ipsilateral and one contralateral channel: per trial and averaged (reading a) or over the concatenated samples of all trials (reading b). The PLI of a short window is biased upwards, the more so the fewer samples it holds, so the 549 samples of 20 to 200 ms cannot be compared with the 61 of the pre window (the first version of this attempt did, and its post-window decreases were that bias). The post window is therefore the mean PLI of its nine 20 ms sub-windows, each as long as the pre window; the whole window is shown as post_full. Each window's PLI is also given with a noise floor, the same PLI with the contralateral channels taken from the next trial. The change from pre is a difference (reading a) or a ratio (reading b), of the mean over the pairs of a region (for the ratio, the region's mean PLI over its mean pre PLI, a standard choice, as pair-wise ratios explode where the pre PLI is near 0). The dandiset's PLV files are the recordings with 20 ms pulses, which fits the Methods' "tFUS (20 ms of stimulation)"; the claims file reads the epochs as the 200 bursts of the target confirmation, whose EEG is not in the dandiset. These files are used, and this is recorded as a deviation.

In [8]:
t0 = time.time()
with ProcessPoolExecutor(3, mp_context=mp.get_context("spawn")) as ex:
    W = dict(zip([m["subject"] for m in plv], ex.map(tfus.wild_pli, plv)))
print(f"PLI of {len(W)} PLV files in {time.time() - t0:.0f} s; trials per file: {sorted({v['n_trials'] for v in W.values()})}")
k = len(tfus.S1_IPSI)
rows = []
for s, r in W.items():
    for band in tfus.BANDS:
        for reading in ("per_trial", "concat"):
            pre = r[band]["pre"][reading]
            for win in ("tfus", "post", "post_full"):
                x = r[band][win][reading]
                for norm in ("diff", "ratio"):
                    f = (lambda u, v: u - v) if norm == "diff" else (lambda u, v: u / v)
                    rows.append({"subject": s, "band": band, "reading": reading, "window": win, "norm": norm,
                                 "S1": f(x[:k, :k].mean(), pre[:k, :k].mean()), "nonS1": f(x[k:, k:].mean(), pre[k:, k:].mean()),
                                 "pairs decreasing": float((x < pre).mean()), "pre S1": pre[:k, :k].mean(), "pre nonS1": pre[k:, k:].mean()})
WP = pd.DataFrame(rows)
print("PLI before onset (pre window), mean over rats:")
print(WP[(WP.norm == "diff") & (WP.window == "tfus")].groupby(["band", "reading"])[["pre S1", "pre nonS1"]].mean().round(3).to_string())
print("\nMean over rats of the change from pre (S1 pairs, non-S1 pairs), and the fraction of all 256 pairs that decrease:")
WM = WP.groupby(["band", "reading", "norm", "window"])[["S1", "nonS1", "pairs decreasing"]].mean()
print(WM.round(4).unstack("window").to_string())
# Noise floor (verifier, round 1): the PLI of each window with the contralateral channels taken from the
# next trial, against the same-trial PLI. "post" is the mean over the nine 20 ms sub-windows of 20-200 ms,
# as long as the pre and tFUS windows; "post_full" is the whole 549-sample window.
rows = []
for s, r in W.items():
    for band in tfus.BANDS:
        for reading in ("per_trial", "concat"):
            for win in ("pre", "tfus", "post", "post_full"):
                x, f = r[band][win][reading], r[band][win][reading + "_shuffled"]
                rows.append({"subject": s, "band": band, "reading": reading, "window": win,
                             "S1": x[:k, :k].mean(), "S1 floor": f[:k, :k].mean(),
                             "nonS1": x[k:, k:].mean(), "nonS1 floor": f[k:, k:].mean()})
FL = pd.DataFrame(rows)
FLm = FL.groupby(["band", "reading", "window"])[["S1", "S1 floor", "nonS1", "nonS1 floor"]].mean()
print("\nPLI and its trial-shuffled noise floor, mean over rats:")
print(FLm.round(4).unstack("window").to_string())
PLI of 20 PLV files in 264 s; trials per file: [199, 200]
PLI before onset (pre window), mean over rats:
                 pre S1  pre nonS1
band  reading                     
alpha concat      0.120      0.133
      per_trial   0.969      0.970
beta  concat      0.112      0.121
      per_trial   0.854      0.857
gamma concat      0.060      0.074
      per_trial   0.625      0.628
theta concat      0.102      0.114
      per_trial   0.976      0.976

Mean over rats of the change from pre (S1 pairs, non-S1 pairs), and the fraction of all 256 pairs that decrease:
                           S1                     nonS1                   pairs decreasing                  
window                   post post_full    tfus    post post_full    tfus             post post_full    tfus
band  reading   norm                                                                                        
alpha concat    diff  -0.0102   -0.0167  0.0047 -0.0136   -0.0207  0.0042           0.5646    0.6240  0.4461
                ratio  0.9501    0.8778  1.0523  0.9077    0.8434  1.0305           0.5646    0.6240  0.4461
      per_trial diff  -0.0019   -0.2437  0.0002 -0.0027   -0.2427 -0.0000           0.6082    1.0000  0.4977
                ratio  0.9981    0.7485  1.0002  0.9972    0.7497  1.0000           0.6082    1.0000  0.4977
beta  concat    diff  -0.0161   -0.0417  0.0700 -0.0263   -0.0532  0.0782           0.5561    0.7176  0.2344
                ratio  0.8898    0.6374  1.6050  0.8230    0.5708  1.6528           0.5561    0.7176  0.2344
      per_trial diff  -0.0016   -0.4785  0.0246 -0.0053   -0.4806  0.0257           0.5650    1.0000  0.2184
                ratio  0.9983    0.4396  1.0290  0.9939    0.4394  1.0300           0.5650    1.0000  0.2184
gamma concat    diff  -0.0083   -0.0290  0.0019 -0.0021   -0.0155  0.0051           0.4670    0.6229  0.4697
                ratio  0.8843    0.5251  1.0385  0.9671    0.7479  1.0841           0.4670    0.6229  0.4697
      per_trial diff   0.0046   -0.3858 -0.0126  0.0035   -0.3860 -0.0237           0.4486    1.0000  0.6918
                ratio  1.0077    0.3832  0.9799  1.0057    0.3854  0.9626           0.4486    1.0000  0.6918
theta concat    diff  -0.0012   -0.0059  0.0027 -0.0022   -0.0066  0.0026           0.5094    0.5516  0.4576
                ratio  1.0186    0.9624  1.0370  0.9801    0.9313  1.0183           0.5094    0.5516  0.4576
      per_trial diff  -0.0001   -0.1852  0.0003 -0.0004   -0.1859  0.0002           0.5375    1.0000  0.4986
                ratio  0.9999    0.8102  1.0003  0.9996    0.8095  1.0002           0.5375    1.0000  0.4986

PLI and its trial-shuffled noise floor, mean over rats:
                     S1                           S1 floor                             nonS1                           nonS1 floor                          
window             post post_full     pre    tfus     post post_full     pre    tfus    post post_full     pre    tfus        post post_full     pre    tfus
band  reading                                                                                                                                               
alpha concat     0.1101    0.1035  0.1203  0.1250   0.0845    0.0762  0.1002  0.1033  0.1193    0.1122  0.1329  0.1371      0.0990    0.0910  0.1112  0.1145
      per_trial  0.9669    0.7251  0.9687  0.9689   0.9667    0.7242  0.9669  0.9688  0.9673    0.7272  0.9700  0.9700      0.9669    0.7236  0.9700  0.9700
beta  concat     0.0955    0.0699  0.1116  0.1816   0.0714    0.0463  0.0906  0.1594  0.0943    0.0673  0.1206  0.1988      0.0747    0.0471  0.1041  0.1799
      per_trial  0.8524    0.3754  0.8540  0.8786   0.8527    0.3760  0.8525  0.8778  0.8519    0.3766  0.8572  0.8829      0.8517    0.3743  0.8556  0.8817
gamma concat     0.0515    0.0308  0.0598  0.0617   0.0433    0.0192  0.0501  0.0543  0.0722    0.0588  0.0743  0.0794      0.0445    0.0198  0.0526  0.0553
      per_trial  0.6301    0.2396  0.6254  0.6128   0.6293    0.2385  0.6276  0.6149  0.6315    0.2420  0.6281  0.6044      0.6275    0.2362  0.6242  0.6009
theta concat     0.1011    0.0963  0.1023  0.1049   0.0841    0.0787  0.0799  0.0837  0.1115    0.1071  0.1137  0.1163      0.0933    0.0879  0.0963  0.0988
      per_trial  0.9756    0.7906  0.9757  0.9760   0.9754    0.7888  0.9762  0.9756  0.9756    0.7900  0.9759  0.9761      0.9753    0.7876  0.9760  0.9760

fig5cdj-wild-type-gamma-pli-decrease¶

In wild-type rats, gamma band PLI decreases during and after tFUS relative to the pre-tFUS window in most brain regions, on average in both S1 and non-S1 regions, while it increases slightly in the sham.

The sham (the resting baseline recording of the target confirmation) has no EEG in the dandiset, so the claim is blocked. The tFUS part is shown: the mean change of S1 and non-S1 pairs in both windows, and the fraction of pairs that decrease.

In [9]:
g = WM.loc["gamma"]
print(g.round(4).unstack("window").to_string())
print("\nGamma PLI against its trial-shuffled floor (means over rats):")
print(FLm.loc["gamma"].round(4).unstack("window").to_string())
per_rat = WP[(WP.band == "gamma") & (WP.norm == "diff")].pivot_table(index="subject", columns=["reading", "window"], values=["S1", "nonS1"])
per_rat = per_rat.loc[:, per_rat.columns.get_level_values("window") != "post_full"]
print("\nPer rat, gamma PLI difference from pre:")
print(per_rat.round(4).to_string())
                     S1                     nonS1                   pairs decreasing                  
window             post post_full    tfus    post post_full    tfus             post post_full    tfus
reading   norm                                                                                        
concat    diff  -0.0083   -0.0290  0.0019 -0.0021   -0.0155  0.0051           0.4670    0.6229  0.4697
          ratio  0.8843    0.5251  1.0385  0.9671    0.7479  1.0841           0.4670    0.6229  0.4697
per_trial diff   0.0046   -0.3858 -0.0126  0.0035   -0.3860 -0.0237           0.4486    1.0000  0.6918
          ratio  1.0077    0.3832  0.9799  1.0057    0.3854  0.9626           0.4486    1.0000  0.6918

Gamma PLI against its trial-shuffled floor (means over rats):
               S1                           S1 floor                             nonS1                           nonS1 floor                          
window       post post_full     pre    tfus     post post_full     pre    tfus    post post_full     pre    tfus        post post_full     pre    tfus
reading                                                                                                                                               
concat     0.0515    0.0308  0.0598  0.0617   0.0433    0.0192  0.0501  0.0543  0.0722    0.0588  0.0743  0.0794      0.0445    0.0198  0.0526  0.0553
per_trial  0.6301    0.2396  0.6254  0.6128   0.6293    0.2385  0.6276  0.6149  0.6315    0.2420  0.6281  0.6044      0.6275    0.2362  0.6242  0.6009

Per rat, gamma PLI difference from pre:
             S1                             nonS1                          
reading  concat         per_trial          concat         per_trial        
window     post    tfus      post    tfus    post    tfus      post    tfus
subject                                                                    
BH624   -0.0183 -0.0034    0.0066 -0.0222 -0.0165 -0.0109    0.0024 -0.0217
BH626   -0.0101 -0.0015   -0.0083 -0.0304 -0.0048  0.0070    0.0082 -0.0181
BH634   -0.0048  0.0079    0.0295  0.0093 -0.0034  0.0138    0.0199 -0.0099
BH635   -0.0184  0.0019    0.0195 -0.0328  0.0046  0.0053    0.0169 -0.0070
BH645   -0.0293 -0.0028    0.0025 -0.0103 -0.0163 -0.0148   -0.0031 -0.0441
BH646   -0.0022 -0.0008    0.0031 -0.0024 -0.0051  0.0070    0.0091 -0.0204
BH647   -0.0108  0.0100    0.0014 -0.0138 -0.0102  0.0061   -0.0020 -0.0514
BH648   -0.0001  0.0069    0.0144 -0.0082  0.0036  0.0188    0.0035 -0.0355
BH649   -0.0127  0.0026   -0.0022 -0.0108 -0.0003  0.0054    0.0035 -0.0090
BH650   -0.0025  0.0242    0.0005 -0.0108 -0.0031 -0.0035   -0.0000 -0.0332
BH651    0.0048  0.0083    0.0243  0.0066 -0.0166  0.0098    0.0185 -0.0228
BH652   -0.0079 -0.0028   -0.0025 -0.0168 -0.0042  0.0015    0.0027 -0.0010
BH653   -0.0102 -0.0053   -0.0100 -0.0172  0.0027  0.0072   -0.0077 -0.0605
BH659   -0.0246 -0.0019    0.0043 -0.0011  0.0065  0.0178    0.0030 -0.0107
BH660   -0.0085 -0.0105   -0.0126 -0.0150 -0.0035 -0.0018   -0.0080 -0.0040
BH661   -0.0089 -0.0115   -0.0033 -0.0075 -0.0032  0.0004   -0.0022 -0.0236
BH662    0.0098  0.0120   -0.0005 -0.0201  0.0026  0.0121   -0.0035 -0.0444
BH663   -0.0132  0.0002    0.0063 -0.0267 -0.0018 -0.0166    0.0001 -0.0172
BH665    0.0157  0.0130    0.0056 -0.0147  0.0236  0.0183    0.0075 -0.0302
BH666   -0.0138 -0.0089    0.0140 -0.0074  0.0027  0.0186    0.0009 -0.0090

Result: blocked (data_missing). Without the resting-state EEG the sham part cannot be tested. The tFUS part does not hold either once the windows are of equal length. Per trial, the PLI equals its trial-shuffled floor in every window (gamma S1 0.625 pre, 0.613 tFUS, 0.630 post, floors 0.628, 0.615, 0.629), so it measures the window length and not coupling. Over concatenated samples the gamma PLI changes little: S1 +0.002 in the tFUS window and -0.008 after it, non-S1 +0.005 and -0.002, with 47% of the 256 pairs decreasing in each window. The decreases the first version of this attempt reported in the 20 to 200 ms window (S1 -0.029, non-S1 -0.016 concatenated, 100% of pairs per trial) were the bias of comparing 549 samples with 61: they appear again with the whole window (post_full) and vanish with its 20 ms sub-windows.

fig5ghi-low-band-pli-s1-only¶

In wild-type rats, theta, alpha and beta PLI decrease only within the S1 regions during tFUS.

"During the tFUS conditions" read as (a) the 0 to 20 ms window or (b) both windows. Reproduced when, under one combination of readings, the mean normalized PLI of the S1 pairs is below the pre-tFUS reference in all three bands and the non-S1 mean is not below it in any of them.

In [10]:
rows = []
for reading in ("per_trial", "concat"):
    for norm in ("diff", "ratio"):
        ref = 0.0 if norm == "diff" else 1.0
        for win_reading, wins in (("a: 0-20 ms", ("tfus",)), ("b: both windows", ("tfus", "post"))):
            ok_s1, ok_ns = [], []
            for band in ("theta", "alpha", "beta"):
                for w in wins:
                    v = WM.loc[(band, reading, norm, w)]
                    ok_s1.append(v.S1 < ref); ok_ns.append(v.nonS1 >= ref)
            rows.append({"reading": reading, "norm": norm, "window": win_reading,
                         "S1 below in all": all(ok_s1), "S1 below (cells)": f"{sum(ok_s1)}/{len(ok_s1)}",
                         "non-S1 not below in all": all(ok_ns), "non-S1 not below (cells)": f"{sum(ok_ns)}/{len(ok_ns)}"})
print(pd.DataFrame(rows).to_string(index=False))
rows = []
for reading in ("per_trial", "concat"):
    for norm in ("diff", "ratio"):
        ref = 0.0 if norm == "diff" else 1.0
        for win_reading, wins in (("a: 0-20 ms", ("tfus",)), ("b: both windows", ("tfus", "post"))):
            bands_ok = [band for band in ("theta", "alpha", "beta")
                        if all(WM.loc[(band, reading, norm, w)].S1 < ref and WM.loc[(band, reading, norm, w)].nonS1 >= ref for w in wins)]
            rows.append({"reading": reading, "norm": norm, "window": win_reading, "bands with S1 below and non-S1 not below": ", ".join(bands_ok) or "none"})
print("\nPer band:")
print(pd.DataFrame(rows).to_string(index=False))
print("\nThe same with the whole 20-200 ms window (post_full), biased by its length (shown for comparison):")
rows = []
for reading in ("per_trial", "concat"):
    for norm in ("diff", "ratio"):
        ref = 0.0 if norm == "diff" else 1.0
        bands_ok = [band for band in ("theta", "alpha", "beta")
                    if all(WM.loc[(band, reading, norm, w)].S1 < ref and WM.loc[(band, reading, norm, w)].nonS1 >= ref for w in ("tfus", "post_full"))]
        rows.append({"reading": reading, "norm": norm, "bands with S1 below and non-S1 not below": ", ".join(bands_ok) or "none"})
print(pd.DataFrame(rows).to_string(index=False))
print("\nMeans over rats, theta, alpha, beta:")
print(WM.loc[["theta", "alpha", "beta"]].round(4).unstack("window").to_string())
  reading  norm          window  S1 below in all S1 below (cells)  non-S1 not below in all non-S1 not below (cells)
per_trial  diff      a: 0-20 ms            False              0/3                    False                      2/3
per_trial  diff b: both windows            False              3/6                    False                      2/6
per_trial ratio      a: 0-20 ms            False              0/3                    False                      2/3
per_trial ratio b: both windows            False              3/6                    False                      2/6
   concat  diff      a: 0-20 ms            False              0/3                     True                      3/3
   concat  diff b: both windows            False              3/6                    False                      3/6
   concat ratio      a: 0-20 ms            False              0/3                     True                      3/3
   concat ratio b: both windows            False              2/6                    False                      3/6

Per band:
  reading  norm          window bands with S1 below and non-S1 not below
per_trial  diff      a: 0-20 ms                                     none
per_trial  diff b: both windows                                     none
per_trial ratio      a: 0-20 ms                                     none
per_trial ratio b: both windows                                     none
   concat  diff      a: 0-20 ms                                     none
   concat  diff b: both windows                                     none
   concat ratio      a: 0-20 ms                                     none
   concat ratio b: both windows                                     none

The same with the whole 20-200 ms window (post_full), biased by its length (shown for comparison):
  reading  norm bands with S1 below and non-S1 not below
per_trial  diff                                     none
per_trial ratio                                     none
   concat  diff                                     none
   concat ratio                                     none

Means over rats, theta, alpha, beta:
                           S1                     nonS1                   pairs decreasing                  
window                   post post_full    tfus    post post_full    tfus             post post_full    tfus
band  reading   norm                                                                                        
theta concat    diff  -0.0012   -0.0059  0.0027 -0.0022   -0.0066  0.0026           0.5094    0.5516  0.4576
                ratio  1.0186    0.9624  1.0370  0.9801    0.9313  1.0183           0.5094    0.5516  0.4576
      per_trial diff  -0.0001   -0.1852  0.0003 -0.0004   -0.1859  0.0002           0.5375    1.0000  0.4986
                ratio  0.9999    0.8102  1.0003  0.9996    0.8095  1.0002           0.5375    1.0000  0.4986
alpha concat    diff  -0.0102   -0.0167  0.0047 -0.0136   -0.0207  0.0042           0.5646    0.6240  0.4461
                ratio  0.9501    0.8778  1.0523  0.9077    0.8434  1.0305           0.5646    0.6240  0.4461
      per_trial diff  -0.0019   -0.2437  0.0002 -0.0027   -0.2427 -0.0000           0.6082    1.0000  0.4977
                ratio  0.9981    0.7485  1.0002  0.9972    0.7497  1.0000           0.6082    1.0000  0.4977
beta  concat    diff  -0.0161   -0.0417  0.0700 -0.0263   -0.0532  0.0782           0.5561    0.7176  0.2344
                ratio  0.8898    0.6374  1.6050  0.8230    0.5708  1.6528           0.5561    0.7176  0.2344
      per_trial diff  -0.0016   -0.4785  0.0246 -0.0053   -0.4806  0.0257           0.5650    1.0000  0.2184
                ratio  0.9983    0.4396  1.0290  0.9939    0.4394  1.0300           0.5650    1.0000  0.2184

Result: not reproduced, resting on an assumption. In no band and under no combination of readings does the S1 PLI fall while the non-S1 PLI does not, with equal-length windows or with the whole 20 to 200 ms window. In the 0 to 20 ms window the S1 PLI is not below pre in theta, alpha or beta under any reading (differences +0.0002 to +0.070). After it, with 20 ms sub-windows over concatenated samples, both regions fall slightly in alpha (S1 -0.010, non-S1 -0.014) and beta (-0.016, -0.026). The per-trial PLI is at its trial-shuffled floor (theta S1 pre 0.976, floor 0.976), so the per-trial reading cannot show a change, and the concatenated PLI (0.10 to 0.20) is about 0.02 above its floor. The outcome rests on the assumption that the PLV EEG files, the recordings with 20 ms pulses, stand for the target-confirmation EEG that the claims file names and the dandiset lacks; without it the claim would be blocked (data missing), as fig5cdj-wild-type-gamma-pli-decrease is.

Summary¶

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.

Claim Outcome
fig5b-tfus-evoked-potentials blocked: methods underspecified
fig5cdj-wild-type-gamma-pli-decrease blocked: data missing
fig5ghi-low-band-pli-s1-only not reproduced (assumed)

The outcomes of the other nineteen claims are in seizure_metrics.ipynb and eeg_blocks.ipynb.

How the analysis differs from the paper's. The position whose bursts form the tFUS EPs is not recorded; the CENTER recording and the position with the largest EP are both run. The wild-type PLI uses the dandiset's PLV EEG files, recordings with 20 ms pulses, since the EEG of the target-confirmation bursts is not in the dandiset; the Methods' "tFUS (20 ms of stimulation)" fits these files; fig5ghi-low-band-pli-s1-only rests on this assumption. The repeated-measures reading of the EP test adds a random intercept per rat to the group by time point ANOVA. Short windows bias the PLI upwards, so the 20 to 200 ms window is compared with the pre window through its nine 20 ms sub-windows, and each PLI is given with a trial-shuffled noise floor.

What was found about the dataset. The EP files of all 23 rats are there, one per transducer position plus a resting recording, with interval tables in seconds whose starts are the burst onsets (1.4-1.5 kHz power, the pulse repetition frequency, peaks just after them in most CENTER recordings). The LFP shows no clear evoked response at any lag of the 2 s cycle. The resting recordings hold no EEG, so the sham of Figs. 5E-F cannot be computed. The PLV EEG files cover 20 of the 23 rats (not BH638, BH642, BH644). The chosen position is not recorded.

In [11]:
print(f"Notebook ran in {(time.time() - started) / 60:.1f} min")
Notebook ran in 11.7 min