Gao et al. (2026) on dandiset 001683: band power, asymmetry index and seizure PLI¶

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).

This notebook streams all 70 labelled EEG blocks (2.9 GB each, about 205 GB) once and reduces each as it loads (tfus.process_block): the Welch PSD of the two labelling channels (8 and 25, Fig. S1) after a common average reference and a 60 Hz notch, over the whole block and over the seizure periods; 30 to 80 Hz power in 1 s bins for the clock check of the labels; and the phase lag index over the seizure periods for every pair of one ipsilateral and one contralateral channel. It takes about 22 minutes with four processes. It also reads the 13 EEG recordings made before the first 4-AP injection (EEG data for PLV analysis) for Figs. S5 and S7.

Claim Tested here
fig4-no-theta-alpha-gamma-power-change yes
fig4c-beta-decrease yes
figs4-sham-power-no-change yes
fig4ef-ai-increase yes
figs5-seizures-lower-ai yes, the pre-4-AP state from the PLV recordings (13 of 16 rats)
fig6-epileptic-pli-s1-decrease yes
figs7-seizure-pli-s1-vs-non-s1 yes, as figs5-seizures-lower-ai
In [1]:
import time
import warnings

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

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()
big = assets[assets["size"] > 2e9]
lab = [m for m in tfus.read_all_meta(big.asset_id.tolist()) if m["kind"] == "Labeled_data"]
M = {m["asset_id"]: m for m in lab}
blocks = tfus.assign_blocks(lab)
print(f"dandiset {tfus.DANDISET_ID} version {tfus.DANDISET_VERSION}: {len(lab)} labelled blocks, "
      f"{sum(m['n_samples'] * m['n_channels'] * 8 for m in lab) / 1e9:.0f} GB of samples")
dandiset 001683 version 0.260109.2104: 70 labelled blocks, 205 GB of samples
In [2]:
t0 = time.time()
R = tfus.process_blocks(lab, workers=4)
print(f"processed {len(R)} blocks in {(time.time() - t0) / 60:.1f} min")
processed 70 blocks in 20.9 min

Data check¶

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

In [3]:
print("Rats per group:", blocks.groupby("group").subject.nunique().to_dict(), "; blocks per group:", blocks.groupby("group").size().to_dict())
print("Blocks per rat:", blocks.groupby("subject").size().to_dict())
m0 = lab[0]
e = m0["electrodes"]
print("\nElectrode table of the EEG files (x, y in mm; location):")
print(e.assign(channel=np.arange(1, 33)).set_index("channel").T.to_string())
same = all(m["electrodes"][["x", "y"]].equals(m0["electrodes"][["x", "y"]]) for m in lab)
print("Same electrode table in every block file:", same)
print(f"Channel {tfus.IPSI_CH} at x={e.x[tfus.IPSI_CH - 1]}, y={e.y[tfus.IPSI_CH - 1]}; channel {tfus.CONTRA_CH} at x={e.x[tfus.CONTRA_CH - 1]}, y={e.y[tfus.CONTRA_CH - 1]}")
print("Burr holes (Methods A): AP -2 mm, ML +2.5 (right, injection, ipsilateral) and -2.5 (left)")
print(f"Channels 1-16 have x > 0: {bool((e.x[:16] > 0).all())}; channels 17-32 x < 0: {bool((e.x[16:] < 0).all())}")
plv = [m for m in tfus.read_all_meta(assets[(assets['size'] > 0.2e9) & (assets['size'] < 0.4e9)].asset_id.tolist()) if m["kind"].startswith("EEG data for PLV")]
print("\nNotes of the dandiset's PLV files (the source of the S1 channel lists):", sorted({m['notes'] for m in plv}))
f, p = R[m0["asset_id"]]["psd_block"]
print(f"\nPSD: {len(f)} bins, {f[1] - f[0]:.2f} Hz apart, 0 to {f[-1]:.0f} Hz; values {p.min():.2e} to {p.max():.2e} V^2/Hz")
raw = tfus.read_rows(m0, 1_000_000, 1_003_052)
print(f"Raw EEG, 1 s of block 1: {raw.min() * 1e6:.0f} to {raw.max() * 1e6:.0f} uV; per-channel SD {raw.std(axis=0).min() * 1e6:.0f} to {raw.std(axis=0).max() * 1e6:.0f} uV")
Rats per group: {'sham': 6, 'tFUS': 10} ; blocks per group: {'sham': 30, 'tFUS': 40}
Blocks per rat: {'BH624': 4, 'BH626': 4, 'BH634': 4, 'BH635': 5, 'BH638': 4, 'BH642': 4, 'BH644': 4, 'BH646': 4, 'BH649': 5, 'BH650': 4, 'BH653': 4, 'BH659': 5, 'BH660': 4, 'BH662': 5, 'BH663': 5, 'BH665': 5}

Electrode table of the EEG files (x, y in mm; location):
channel      1      2      3      4      5      6      7      8      9      10     11     12     13     14     15     16     17     18     19     20     21     22     23     24     25     26     27     28     29     30     31     32
x           4.4    3.0    1.5    4.4    3.0    1.5    4.0    2.8    1.2    2.8    1.2    3.8    2.8    1.2    2.5    1.2   -1.2   -2.5   -1.2   -2.8   -3.8   -1.2   -2.8   -1.2   -2.8   -4.0   -1.5   -3.0   -4.4   -1.5   -3.0   -4.4
y          -7.0   -7.0   -7.0   -5.0   -5.0   -5.0   -3.0   -3.0   -3.0   -1.0   -1.0    0.6    1.5    1.5    3.5    3.6    3.6    3.5    1.5    1.5    0.6   -1.0   -1.0   -3.0   -3.0   -3.0   -5.0   -5.0   -5.0   -7.0   -7.0   -7.0
z           0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0
location  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull  Skull
Same electrode table in every block file: True
Channel 8 at x=2.8, y=-3.0; channel 25 at x=-2.8, y=-3.0
Burr holes (Methods A): AP -2 mm, ML +2.5 (right, injection, ipsilateral) and -2.5 (left)
Channels 1-16 have x > 0: True; channels 17-32 x < 0: True
Notes of the dandiset's PLV files (the source of the S1 channel lists): ['EEG signal for PLV analysis, ipsilateral channel 1-16 (S1: 7,8,10,12),contralateral channel 17-32(S1: 21,23,25,26)']

PSD: 3053 bins, 0.50 Hz apart, 0 to 1526 Hz; values 1.73e-18 to 8.85e-13 V^2/Hz
Raw EEG, 1 s of block 1: -16 to 14 uV; per-channel SD 1 to 5 uV

The electrode table puts channels 1 to 16 on the right (ipsilateral to the injection) and 17 to 32 on the left, and channels 8 and 25 at ML +/-2.8 mm, AP -3 mm, next to the burr holes, which fits the encircled electrodes of Fig. S1. The values are in volts, of the order of microvolts (per-channel SD of a few microvolts in the excerpt), a plausible scale for a skull EEG.

Clock check of the labels. The 30 to 80 Hz power of channel 8 (ipsilateral labels) and channel 25 (contralateral labels) in 1 s bins, inside the labelled seizures against outside, with the label times read as minutes, shifted later by 30 s to 600 s, and read as seconds.

In [4]:
rows = []
for a, r in R.items():
    g = r["gamma_1s"]; nb = len(g)
    for k, h in enumerate(("ipsilateral", "contralateral")):
        s = tfus.seizures(M[a], h)
        for shift in (0, 30, 60, 120, 600, "read as seconds"):
            inside = np.zeros(nb, bool)
            pairs = s[["start", "stop"]].to_numpy() / (60 if shift == "read as seconds" else 1)
            for x, y in pairs:
                off = 0 if shift == "read as seconds" else shift
                inside[max(0, int(x + off)):min(nb, int(np.ceil(y + off)))] = True
            if inside.any() and (~inside).any():
                rows.append({"block": a, "hemi": h, "labels": shift, "inside/outside": g[inside, k].mean() / g[~inside, k].mean()})
cc = pd.DataFrame(rows)
print(cc.groupby("labels", sort=False)["inside/outside"].describe().round(2).to_string())
print(f"\nFile-hemispheres where gamma power is higher inside the labels (as minutes, no shift): "
      f"{(cc[cc.labels == 0]['inside/outside'] > 1).sum()} of {(cc.labels == 0).sum()}")
                 count   mean   std   min   25%    50%    75%    max
labels                                                              
0                136.0  14.37  9.68  2.55  7.16  12.40  18.46  50.36
30               136.0   3.38  2.46  0.82  1.78   2.73   4.43  18.74
60               136.0   0.76  0.82  0.13  0.35   0.52   0.74   6.26
120              136.0   0.66  0.40  0.11  0.37   0.54   0.84   1.76
600              136.0   1.05  0.69  0.24  0.61   0.90   1.20   4.50
read as seconds  136.0   0.90  1.72  0.13  0.28   0.44   0.75  13.72

File-hemispheres where gamma power is higher inside the labels (as minutes, no shift): 136 of 136

With the labels read as minutes, 30 to 80 Hz power inside them is many times that outside in every block and hemisphere (the paper's labelling rule, Methods C); shifted by 60 s or more, or read as seconds, the contrast is gone. So the labels and the EEG share a clock, and the label times are in minutes. The two blocks without seizures (BH634 and BH638, post 2) have no labels to test.

In [5]:
# Per rat, hemisphere, block: band power ratios (M5), under the readings segment (block, seizure)
# and total (3-300 Hz, 0 Hz to Nyquist); and the asymmetry index (Eq. 1) on the band power.
info = blocks.set_index("asset_id")
bp, ai = [], []
for a, r in R.items():
    i = info.loc[a]
    base = {"subject": i.subject, "group": i.group, "block": i.block}
    for seg, key in (("block", None), ("seizure", "seiz")):
        for k, h in enumerate(("ipsilateral", "contralateral")):
            if key is None:
                f, p = r["psd_block"]; p = p[:, k]
            else:
                f, p = r["psd_seiz_ipsi" if k == 0 else "psd_seiz_contra"]
                if f is None:
                    continue
                p = p[:, 0]
            pw = tfus.band_powers(f, p)
            for band in tfus.BANDS:
                for tot in ("total_3_300", "total_all"):
                    bp.append({**base, "hemi": h, "segment": seg, "total": tot, "band": band, "ratio": pw[band] / pw[tot]})
        f, p = r["psd_block"] if key is None else r["psd_seiz_merged"]
        if f is None:
            continue
        pw = tfus.band_powers(f, p)
        for band in tfus.BANDS:
            ip, co = pw[band]
            ai.append({**base, "segment": seg, "band": band, "ai": (ip - co) / (ip + co),
                       "ai_ratio": (ip / pw["total_3_300"][0] - co / pw["total_3_300"][1]) / (ip / pw["total_3_300"][0] + co / pw["total_3_300"][1])})
bp, ai = pd.DataFrame(bp), pd.DataFrame(ai)
print(f"Band power rows: {len(bp)}; AI rows: {len(ai)}")
print("Ranges of the band ratios:", bp.groupby(["band"]).ratio.agg(["min", "max"]).round(4).to_dict("index"))
print("Ranges of AI:", ai.groupby("band").ai.agg(["min", "max"]).round(3).to_dict("index"))
print("Blocks without a seizure PSD (no seizure of 2 s or more):", sorted(set((r.subject, r.block) for r in blocks.itertuples()) - set(map(tuple, bp[bp.segment == 'seizure'][["subject", "block"]].drop_duplicates().to_numpy()))))
Band power rows: 2208; AI rows: 552
Ranges of the band ratios: {'alpha': {'min': 0.0718, 'max': 0.3021}, 'beta': {'min': 0.2283, 'max': 0.6144}, 'gamma': {'min': 0.0709, 'max': 0.3886}, 'theta': {'min': 0.02, 'max': 0.3288}}
Ranges of AI: {'alpha': {'min': -0.98, 'max': 0.139}, 'beta': {'min': -0.992, 'max': 0.249}, 'gamma': {'min': -0.996, 'max': 0.225}, 'theta': {'min': -0.959, 'max': 0.442}}
Blocks without a seizure PSD (no seizure of 2 s or more): [('BH634', 'post2'), ('BH638', 'post2')]

fig4-no-theta-alpha-gamma-power-change¶

There are no significant changes in theta, alpha or gamma power ratios in either hemisphere.

A claim of absence. Band power ratios (M5) for sham and tFUS, blocks baseline to post 2, group by block two-way ANOVA per hemisphere and band, with Bonferroni post hoc tests (M3). The claim covers the within-group comparisons against baseline. Every reading of M5 (segment: whole block or seizure periods; total: 3 to 300 Hz or 0 Hz to Nyquist) and of M3 is run. As in seizure_metrics.ipynb, the repeated-measures reading is the one adopted where the ANOVA readings disagree (see the summary there: it is the reading that gives the paper's own significant within-group changes of Fig. 3).

In [6]:
def band_tests(df, value="ratio", bands=tfus.BANDS, by_hemi=True):
    rows = []
    for (seg, tot), d in df.groupby(["segment", "total"]):
        for band in bands:
            for h in (("ipsilateral", "contralateral") if by_hemi else (None,)):
                dd = d[(d.band == band) & ((d.hemi == h) if h else True)]
                for k, (table, post) in tfus.group_block_tests(dd, value).items():
                    for r in post.itertuples():
                        rows.append({"segment": seg, "total": tot, "band": band, "hemi": h, "anova": k,
                                     "comparison": r.comparison, "family": r.family, "diff": r.diff,
                                     "p_family": r.p_family, "p_all": r.p_all})
    return pd.DataFrame(rows)

T4 = band_tests(bp)
w = T4[T4.family == "within"]
summary = (w.assign(sig_i=w.p_family < 0.05, sig_ii=w.p_all < 0.05)
             .groupby(["band", "segment", "total", "anova"])[["sig_i", "sig_ii"]].sum())
print("Number of significant within-group comparisons against baseline (of 12: 2 groups x 3 blocks x 2 hemispheres):")
print(summary.unstack("anova").to_string())
print("\nThe significant ones, theta, alpha and gamma:")
print(w[(w.band != "beta") & (w.p_family < 0.05)].round(4).to_string(index=False))
Number of significant within-group comparisons against baseline (of 12: 2 groups x 3 blocks x 2 hemispheres):
                             sig_i            sig_ii         
anova                     ordinary repeated ordinary repeated
band  segment total                                          
alpha block   total_3_300        0        0        0        0
              total_all          0        0        0        0
      seizure total_3_300        0        0        0        0
              total_all          0        0        0        0
beta  block   total_3_300        1        9        0        8
              total_all          1        9        0        9
      seizure total_3_300        0        4        0        2
              total_all          0        5        0        2
gamma block   total_3_300        0        0        0        0
              total_all          0        0        0        0
      seizure total_3_300        0        0        0        0
              total_all          0        0        0        0
theta block   total_3_300        0        4        0        4
              total_all          0        5        0        4
      seizure total_3_300        0        4        0        3
              total_all          0        4        0        3

The significant ones, theta, alpha and gamma:
segment       total  band          hemi    anova              comparison family    diff  p_family  p_all
  block total_3_300 theta   ipsilateral repeated     sham baseline-post1 within -0.0367    0.0218 0.0364
  block total_3_300 theta   ipsilateral repeated     sham baseline-post2 within -0.0378    0.0169 0.0281
  block total_3_300 theta contralateral repeated     sham baseline-post1 within -0.0317    0.0213 0.0355
  block total_3_300 theta contralateral repeated     sham baseline-post2 within -0.0340    0.0113 0.0188
  block   total_all theta   ipsilateral repeated sham baseline-condition within -0.0301    0.0395 0.0659
  block   total_all theta   ipsilateral repeated     sham baseline-post1 within -0.0327    0.0202 0.0337
  block   total_all theta   ipsilateral repeated     sham baseline-post2 within -0.0325    0.0213 0.0355
  block   total_all theta contralateral repeated     sham baseline-post1 within -0.0303    0.0231 0.0386
  block   total_all theta contralateral repeated     sham baseline-post2 within -0.0323    0.0135 0.0225
seizure total_3_300 theta   ipsilateral repeated sham baseline-condition within -0.0385    0.0373 0.0621
seizure total_3_300 theta   ipsilateral repeated     sham baseline-post1 within -0.0459    0.0080 0.0134
seizure total_3_300 theta   ipsilateral repeated     sham baseline-post2 within -0.0528    0.0018 0.0029
seizure total_3_300 theta contralateral repeated     sham baseline-post2 within -0.0389    0.0203 0.0338
seizure   total_all theta   ipsilateral repeated sham baseline-condition within -0.0376    0.0355 0.0592
seizure   total_all theta   ipsilateral repeated     sham baseline-post1 within -0.0441    0.0088 0.0147
seizure   total_all theta   ipsilateral repeated     sham baseline-post2 within -0.0502    0.0022 0.0037
seizure   total_all theta contralateral repeated     sham baseline-post2 within -0.0383    0.0203 0.0339
In [7]:
print("Group mean band ratios (seizure segment, 3-300 Hz total):")
print(bp[(bp.segment == "seizure") & (bp.total == "total_3_300") & (bp.block != "post3")]
      .groupby(["band", "hemi", "group", "block"]).ratio.mean().unstack().round(4).to_string())
print("\nGroup mean band ratios (whole block, 3-300 Hz total):")
print(bp[(bp.segment == "block") & (bp.total == "total_3_300") & (bp.block != "post3")]
      .groupby(["band", "hemi", "group", "block"]).ratio.mean().unstack().round(4).to_string())
print("\nBetween-group comparisons (reported, not deciding), significant under the own family:")
b = T4[(T4.family == "between") & (T4.p_family < 0.05)]
print(b.round(4).to_string(index=False) if len(b) else "none")
Group mean band ratios (seizure segment, 3-300 Hz total):
block                      baseline  condition   post1   post2
band  hemi          group                                     
alpha contralateral sham     0.1473     0.1551  0.1535  0.1575
                    tFUS     0.1416     0.1420  0.1402  0.1216
      ipsilateral   sham     0.1458     0.1557  0.1497  0.1487
                    tFUS     0.1390     0.1363  0.1356  0.1180
beta  contralateral sham     0.4955     0.4634  0.4556  0.4524
                    tFUS     0.4908     0.4833  0.4972  0.5221
      ipsilateral   sham     0.4960     0.4445  0.4290  0.4175
                    tFUS     0.4930     0.4871  0.5001  0.5181
gamma contralateral sham     0.2343     0.2311  0.2255  0.2203
                    tFUS     0.2224     0.2235  0.2238  0.2324
      ipsilateral   sham     0.2126     0.2005  0.1964  0.1916
                    tFUS     0.2091     0.2144  0.2145  0.2207
theta contralateral sham     0.0777     0.1021  0.1106  0.1166
                    tFUS     0.0945     0.0975  0.0769  0.0781
      ipsilateral   sham     0.0784     0.1169  0.1243  0.1312
                    tFUS     0.0962     0.0961  0.0776  0.0781

Group mean band ratios (whole block, 3-300 Hz total):
block                      baseline  condition   post1   post2
band  hemi          group                                     
alpha contralateral sham     0.1502     0.1592  0.1568  0.1573
                    tFUS     0.1408     0.1425  0.1429  0.1323
      ipsilateral   sham     0.1471     0.1540  0.1481  0.1406
                    tFUS     0.1372     0.1369  0.1355  0.1315
beta  contralateral sham     0.4755     0.4429  0.4289  0.4268
                    tFUS     0.4558     0.4359  0.4213  0.4198
      ipsilateral   sham     0.4430     0.3856  0.3560  0.3463
                    tFUS     0.4447     0.4167  0.3941  0.3909
gamma contralateral sham     0.2132     0.2004  0.1961  0.1881
                    tFUS     0.2053     0.1939  0.1851  0.1884
      ipsilateral   sham     0.1791     0.1629  0.1592  0.1532
                    tFUS     0.1874     0.1768  0.1678  0.1646
theta contralateral sham     0.0908     0.1156  0.1224  0.1248
                    tFUS     0.1057     0.1118  0.1057  0.1081
      ipsilateral   sham     0.0977     0.1302  0.1344  0.1355
                    tFUS     0.1061     0.1155  0.1150  0.1183

Between-group comparisons (reported, not deciding), significant under the own family:
none

Result: not reproduced, resting on an assumption. The ANOVA readings disagree, and the M5 readings agree within each. Under the ordinary reading no within-group comparison against baseline is significant for theta, alpha or gamma under any of the four M5 readings. Under the repeated-measures reading, adopted as the paper's test (see the summary), the sham theta ratio rises above baseline in 4 or 5 of the 12 comparisons under every M5 reading (ipsilateral post 2: Bonferroni p = 0.017 over the whole block, where the 3-300 Hz ratio goes from 0.098 to 0.136, and p = 0.0018 over the seizure periods, from 0.078 to 0.131). Alpha and gamma have none. No between-group comparison is significant.

fig4c-beta-decrease¶

The beta power ratio of the tFUS group decreased significantly during stimulation and post 1 compared with baseline.

Reproduced when, under a combination of the M3, M5 and hemisphere readings, the condition block and post 1 are both significantly lower than baseline.

In [8]:
wb = T4[(T4.band == "beta") & T4.comparison.isin(["tFUS baseline-condition", "tFUS baseline-post1"])]
print("tFUS beta ratio, baseline minus block (positive = decrease), with p under families (i) and (ii):")
print(wb.pivot_table(index=["segment", "total", "anova", "hemi"], columns="comparison", values=["diff", "p_family", "p_all"]).round(4).to_string())
both = wb.assign(ok=(wb.p_family < 0.05) & (wb["diff"] > 0)).groupby(["segment", "total", "anova", "hemi"]).ok.sum()
print("\nCombinations with both comparisons significant decreases (family i):", list(both[both == 2].index))
print("\ntFUS beta ratio means:")
print(bp[(bp.band == "beta") & (bp.group == "tFUS") & (bp.block != "post3")].groupby(["segment", "total", "hemi", "block"]).ratio.mean().unstack().round(4).to_string())
tFUS beta ratio, baseline minus block (positive = decrease), with p under families (i) and (ii):
                                                              diff                                       p_all                                    p_family                    
comparison                                 tFUS baseline-condition tFUS baseline-post1 tFUS baseline-condition tFUS baseline-post1 tFUS baseline-condition tFUS baseline-post1
segment total       anova    hemi                                                                                                                                             
block   total_3_300 ordinary contralateral                  0.0199              0.0345                  1.0000              1.0000                  1.0000              1.0000
                             ipsilateral                    0.0280              0.0506                  1.0000              0.5507                  1.0000              0.3304
                    repeated contralateral                  0.0199              0.0345                  1.0000              0.0674                  0.6433              0.0404
                             ipsilateral                    0.0280              0.0506                  0.5969              0.0112                  0.3581              0.0067
        total_all   ordinary contralateral                  0.0222              0.0392                  1.0000              1.0000                  1.0000              1.0000
                             ipsilateral                    0.0333              0.0587                  1.0000              0.3942                  1.0000              0.2365
                    repeated contralateral                  0.0222              0.0392                  0.8079              0.0291                  0.4847              0.0175
                             ipsilateral                    0.0333              0.0587                  0.3170              0.0032                  0.1902              0.0019
seizure total_3_300 ordinary contralateral                  0.0075             -0.0064                  1.0000              1.0000                  1.0000              1.0000
                             ipsilateral                    0.0059             -0.0071                  1.0000              1.0000                  1.0000              1.0000
                    repeated contralateral                  0.0075             -0.0064                  1.0000              1.0000                  1.0000              1.0000
                             ipsilateral                    0.0059             -0.0071                  1.0000              1.0000                  1.0000              1.0000
        total_all   ordinary contralateral                  0.0075             -0.0059                  1.0000              1.0000                  1.0000              1.0000
                             ipsilateral                    0.0076             -0.0055                  1.0000              1.0000                  1.0000              1.0000
                    repeated contralateral                  0.0075             -0.0059                  1.0000              1.0000                  1.0000              1.0000
                             ipsilateral                    0.0076             -0.0055                  1.0000              1.0000                  1.0000              1.0000

Combinations with both comparisons significant decreases (family i): []

tFUS beta ratio means:
block                              baseline  condition   post1   post2
segment total       hemi                                              
block   total_3_300 contralateral    0.4558     0.4359  0.4213  0.4198
                    ipsilateral      0.4447     0.4167  0.3941  0.3909
        total_all   contralateral    0.4453     0.4231  0.4061  0.4033
                    ipsilateral      0.4282     0.3949  0.3695  0.3648
seizure total_3_300 contralateral    0.4908     0.4833  0.4972  0.5221
                    ipsilateral      0.4930     0.4871  0.5001  0.5181
        total_all   contralateral    0.4856     0.4781  0.4915  0.5165
                    ipsilateral      0.4855     0.4779  0.4911  0.5058

Result: partially reproduced. Over the whole block under the repeated-measures reading the tFUS beta ratio at post 1 is significantly below baseline in both hemispheres (3-300 Hz total: p = 0.0067 ipsilateral, 0.040 contralateral; 0 Hz to Nyquist: 0.0019 and 0.018), but the condition block is not (p = 0.19 to 0.64), although its mean is lower (ipsilateral 0.445 at baseline, 0.417 at the condition block). Over the seizure periods the beta ratio does not fall (ipsilateral 0.493, 0.487 and 0.500) and no comparison is significant. Under the ordinary reading none is.

figs4-sham-power-no-change¶

In the sham group, band power ratios show no significant change among time blocks or between hemispheres.

A claim of absence. Sham rats, five blocks, per band a two-way ANOVA (hemisphere by block) with Bonferroni post hoc tests; no block or hemisphere effect nor post hoc comparison may be significant in any band.

In [9]:
rows = []
for (seg, tot), d in bp[bp.group == "sham"].groupby(["segment", "total"]):
    for band in tfus.BANDS:
        dd = d[d.band == band]
        for k, (table, post) in tfus.hemi_block_tests(dd, "ratio").items():
            rows.append({"segment": seg, "total": tot, "band": band, "anova": k,
                         "p_hemi": table.p.iloc[0], "p_block": table.p.iloc[1], "p_interaction": table.p.iloc[2],
                         "posthoc_sig_i": int((post.p_family < 0.05).sum()), "posthoc_sig_ii": int((post.p_all < 0.05).sum()),
                         "smallest": post.loc[post.p_family.idxmin(), "comparison"], "smallest_p": post.p_family.min()})
S4 = pd.DataFrame(rows)
print(S4.round(4).to_string(index=False))
segment       total  band    anova  p_hemi  p_block  p_interaction  posthoc_sig_i  posthoc_sig_ii                  smallest  smallest_p
  block total_3_300 theta ordinary  0.2536   0.1562         0.9991              0               0 ipsila baseline-condition      1.0000
  block total_3_300 theta repeated  0.0982   0.0107         0.9959              0               0     ipsila baseline-post3      0.3489
  block total_3_300 alpha ordinary  0.4328   0.9920         0.9963              0               0 ipsila baseline-condition      1.0000
  block total_3_300 alpha repeated  0.2321   0.9611         0.9814              0               0 ipsila baseline-condition      1.0000
  block total_3_300  beta ordinary  0.0000   0.0004         0.4875              4               3     ipsila baseline-post3      0.0007
  block total_3_300  beta repeated  0.0000   0.0000         0.2348              7               6     ipsila baseline-post3      0.0000
  block total_3_300 gamma ordinary  0.0037   0.6538         0.9972              0               0         ipsi-contra post3      0.4768
  block total_3_300 gamma repeated  0.0004   0.4240         0.9929              0               0         ipsi-contra post3      0.1831
  block   total_all theta ordinary  0.5254   0.2152         0.9997              0               0 ipsila baseline-condition      1.0000
  block   total_all theta repeated  0.3386   0.0155         0.9983              0               0     ipsila baseline-post1      0.6453
  block   total_all alpha ordinary  0.2029   0.9858         0.9928              0               0 ipsila baseline-condition      1.0000
  block   total_all alpha repeated  0.0479   0.9266         0.9606              0               0         ipsi-contra post2      0.8142
  block   total_all  beta ordinary  0.0000   0.0002         0.4561              5               4     ipsila baseline-post3      0.0004
  block   total_all  beta repeated  0.0000   0.0000         0.2344              8               7     ipsila baseline-post3      0.0000
  block   total_all gamma ordinary  0.0004   0.5102         0.9952              0               0         ipsi-contra post3      0.2200
  block   total_all gamma repeated  0.0000   0.3209         0.9903              0               0         ipsi-contra post3      0.0834
seizure total_3_300 theta ordinary  0.4307   0.3398         0.9975              0               0 ipsila baseline-condition      1.0000
seizure total_3_300 theta repeated  0.2273   0.0394         0.9868              0               0     ipsila baseline-post2      0.4010
seizure total_3_300 alpha ordinary  0.8265   0.9773         0.9998              0               0 ipsila baseline-condition      1.0000
seizure total_3_300 alpha repeated  0.7068   0.8533         0.9987              0               0 ipsila baseline-condition      1.0000
seizure total_3_300  beta ordinary  0.1825   0.2143         0.9382              0               0     ipsila baseline-post3      0.7331
seizure total_3_300  beta repeated  0.0213   0.0030         0.6524              1               1     ipsila baseline-post3      0.0089
seizure total_3_300 gamma ordinary  0.1928   0.9412         0.9999              0               0 ipsila baseline-condition      1.0000
seizure total_3_300 gamma repeated  0.0280   0.6857         0.9988              0               0 ipsila baseline-condition      1.0000
seizure   total_all theta ordinary  0.5103   0.3531         0.9984              0               0 ipsila baseline-condition      1.0000
seizure   total_all theta repeated  0.3072   0.0400         0.9909              0               0     ipsila baseline-post2      0.4371
seizure   total_all alpha ordinary  0.7136   0.9824         0.9996              0               0 ipsila baseline-condition      1.0000
seizure   total_all alpha repeated  0.5274   0.8806         0.9969              0               0 ipsila baseline-condition      1.0000
seizure   total_all  beta ordinary  0.0895   0.1932         0.9199              0               0     ipsila baseline-post3      0.6101
seizure   total_all  beta repeated  0.0041   0.0025         0.5921              2               1     ipsila baseline-post3      0.0065
seizure   total_all gamma ordinary  0.1327   0.9299         0.9998              0               0 ipsila baseline-condition      1.0000
seizure   total_all gamma repeated  0.0130   0.6577         0.9980              0               0         ipsi-contra post3      0.9130

Result: not reproduced, resting on an assumption. Beta varies with block and hemisphere: over the whole block the block and hemisphere effects are significant under both readings (ordinary block p = 0.0004 and 0.0002 for the two totals, hemisphere p below 0.0001, with 4 and 5 post hoc comparisons significant), and over the seizure periods under the repeated-measures reading (block p = 0.0030 and 0.0025, 1 and 2 post hoc comparisons). Gamma has a hemisphere effect over the whole block (ordinary p = 0.0037 and 0.0004) and, under the repeated reading, over the seizure periods too (p = 0.028 and 0.013); the repeated reading also finds a theta block effect (p = 0.011 to 0.040). Under the ordinary reading over the seizure periods nothing is significant in any band (smallest p = 0.09), so the M5 readings disagree under that ANOVA reading; under the repeated-measures reading, the one adopted, they agree.

fig4ef-ai-increase¶

The normalized asymmetry index of the tFUS group increases significantly relative to baseline in the theta and alpha bands, and differs significantly from the sham group in every band.

AI per rat, band and block (Eq. 1, on the band power of channels 8 and 25), normalized to the group's mean baseline AI by (a) division or (b) subtraction (M5), for the whole block and for the seizure periods (the union of both hemispheres' labels); group by block two-way ANOVA per band. Reproduced when, under one combination of readings, at least one tFUS block is significantly above baseline in theta and in alpha, and sham against tFUS is significant at one block or more in each of the four bands.

In [10]:
# AI on the band power (`ai`) and, as a second reading (verifier, round 1), on the band over 3-300 Hz
# ratios (`ai_ratio`): the paper calls the ratio "absolute power" and Eq. 1 says "PSD".
d = ai[ai.block != "post3"].copy()
rows, bases = [], []
for value in ("ai", "ai_ratio"):
    base = d[d.block == "baseline"].groupby(["segment", "band", "group"])[value].mean().rename("base")
    dv = d.join(base, on=["segment", "band", "group"])
    dv["norm_div"] = dv[value] / dv.base
    dv["norm_sub"] = dv[value] - dv.base
    bases.append(base.rename(value))
    for seg in ("block", "seizure"):
        for norm in ("norm_div", "norm_sub"):
            for band in tfus.BANDS:
                dd = dv[(dv.segment == seg) & (dv.band == band)]
                for k, (table, post) in tfus.group_block_tests(dd, norm).items():
                    for r in post.itertuples():
                        rows.append({"value": value, "segment": seg, "norm": norm, "band": band, "anova": k, "comparison": r.comparison,
                                     "family": r.family, "diff": r.diff, "p_family": r.p_family, "p_all": r.p_all,
                                     "tFUS base": base.loc[(seg, band, "tFUS")]})
    if value == "ai":
        print("Group means of normalized AI (AI on band power):")
        print(dv.groupby(["segment", "band", "group", "block"])[["norm_div", "norm_sub"]].mean().unstack().round(3).to_string())
TA = pd.DataFrame(rows)
print("\nGroup mean baseline AI, on band power and on band ratios (its sign decides what an increase means under division):")
print(pd.concat(bases, axis=1).unstack().round(4).to_string())
Group means of normalized AI (AI on band power):
                    norm_div                         norm_sub                        
block               baseline condition  post1  post2 baseline condition  post1  post2
segment band  group                                                                  
block   alpha sham       1.0     0.985  0.936  1.012      0.0     0.009  0.039 -0.007
              tFUS       1.0     0.909  0.829  0.702     -0.0     0.023  0.044  0.077
        beta  sham       1.0     1.005  0.979  1.023      0.0    -0.003  0.013 -0.014
              tFUS       1.0     0.911  0.842  0.802      0.0     0.023  0.040  0.050
        gamma sham       1.0     1.005  0.960  0.998      0.0    -0.003  0.025  0.001
              tFUS       1.0     0.915  0.832  0.864      0.0     0.025  0.048  0.039
        theta sham       1.0     0.976  0.932  0.980     -0.0     0.014  0.040  0.012
              tFUS       1.0     0.847  0.663  0.591      0.0     0.037  0.082  0.100
seizure alpha sham       1.0     1.000  0.988  1.053      0.0    -0.000  0.008 -0.035
              tFUS       1.0     1.005  0.909  1.097      0.0    -0.001  0.026 -0.027
        beta  sham       1.0     1.010  0.991  1.037      0.0    -0.006  0.006 -0.024
              tFUS       1.0     0.947  0.864  1.093      0.0     0.015  0.037 -0.025
        gamma sham       1.0     1.020  0.989  1.029     -0.0    -0.012  0.007 -0.018
              tFUS       1.0     0.938  0.861  1.057      0.0     0.019  0.042 -0.017
        theta sham       1.0     0.976  0.962  1.021      0.0     0.015  0.024 -0.014
              tFUS       1.0     1.028  0.866  1.088     -0.0    -0.007  0.036 -0.023
Group mean baseline AI, on band power and on band ratios (its sign decides what an increase means under division):
                   ai         ai_ratio        
group            sham    tFUS     sham    tFUS
segment band                                  
block   alpha -0.6064 -0.2576  -0.0050 -0.0158
        beta  -0.6072 -0.2543  -0.0348 -0.0108
        gamma -0.6093 -0.2882  -0.0885 -0.0467
        theta -0.5845 -0.2441   0.0400 -0.0014
seizure alpha -0.6509 -0.2838  -0.0011 -0.0131
        beta  -0.6332 -0.2723  -0.0027  0.0016
        gamma -0.6313 -0.3027  -0.0583 -0.0319
        theta -0.6457 -0.2673   0.0201  0.0047
In [11]:
def ai_verdict(t):
    # "increase", two readings: the normalized value rises above its baseline (baseline minus block < 0),
    # or the AI itself rises; they agree under subtraction and are opposite under division when the
    # group's baseline AI is negative (then a rising AI gives a falling ratio).
    up_norm, up_ai = {}, {}
    for band in ("theta", "alpha"):
        x = t[(t.band == band) & t.comparison.str.startswith("tFUS baseline") & (t.p_family < 0.05)]
        up_norm[band] = bool((x["diff"] < 0).any())
        flip = (t.name[2] == "norm_div") & (x["tFUS base"] < 0)
        up_ai[band] = bool((np.where(flip, x["diff"] > 0, x["diff"] < 0)).any())
    between = {band: bool((t[(t.band == band) & (t.family == "between")].p_family < 0.05).any()) for band in tfus.BANDS}
    return pd.Series({**{f"norm up {k}": v for k, v in up_norm.items()}, **{f"AI up {k}": v for k, v in up_ai.items()},
                      **{f"between {k}": v for k, v in between.items()}})

V = TA.groupby(["value", "segment", "norm", "anova"]).apply(ai_verdict)
print(V.to_string())
print("\nSignificant comparisons (own family):")
print(TA[TA.p_family < 0.05].round(4).to_string(index=False))
                                    norm up theta  norm up alpha  AI up theta  AI up alpha  between theta  between alpha  between beta  between gamma
value    segment norm     anova                                                                                                                      
ai       block   norm_div ordinary          False          False        False        False          False          False         False          False
                          repeated          False          False         True         True          False          False         False          False
                 norm_sub ordinary          False          False        False        False          False          False         False          False
                          repeated           True           True         True         True          False          False         False          False
         seizure norm_div ordinary          False          False        False        False          False          False         False          False
                          repeated          False          False        False        False          False          False         False          False
                 norm_sub ordinary          False          False        False        False          False          False         False          False
                          repeated          False          False        False        False          False          False         False          False
ai_ratio block   norm_div ordinary          False          False        False        False          False          False         False          False
                          repeated          False          False        False        False          False          False         False          False
                 norm_sub ordinary          False          False        False        False          False          False         False          False
                          repeated          False          False        False        False          False          False         False          False
         seizure norm_div ordinary          False          False        False        False          False          False         False          False
                          repeated          False          False        False        False          False          False         False          False
                 norm_sub ordinary          False          False        False        False          False          False         False          False
                          repeated          False          False        False        False          False          False         False          False

Significant comparisons (own family):
   value segment     norm  band    anova          comparison family    diff  p_family  p_all  tFUS base
      ai   block norm_div theta repeated tFUS baseline-post1 within  0.3375    0.0146 0.0244    -0.2441
      ai   block norm_div theta repeated tFUS baseline-post2 within  0.4090    0.0020 0.0033    -0.2441
      ai   block norm_div alpha repeated tFUS baseline-post2 within  0.2982    0.0005 0.0009    -0.2576
      ai   block norm_div  beta repeated tFUS baseline-post2 within  0.1976    0.0090 0.0150    -0.2543
      ai   block norm_div gamma repeated tFUS baseline-post1 within  0.1682    0.0097 0.0161    -0.2882
      ai   block norm_sub theta repeated tFUS baseline-post1 within -0.0824    0.0495 0.0825    -0.2441
      ai   block norm_sub theta repeated tFUS baseline-post2 within -0.0998    0.0100 0.0167    -0.2441
      ai   block norm_sub alpha repeated tFUS baseline-post2 within -0.0768    0.0117 0.0195    -0.2576
ai_ratio   block norm_div alpha repeated sham baseline-post2 within -8.1976    0.0136 0.0226    -0.0158
ai_ratio   block norm_div gamma repeated tFUS baseline-post2 within -0.6111    0.0397 0.0662    -0.0467
ai_ratio   block norm_sub  beta repeated sham baseline-post1 within  0.0544    0.0045 0.0075    -0.0108
ai_ratio   block norm_sub  beta repeated sham baseline-post2 within  0.0668    0.0004 0.0006    -0.0108
ai_ratio seizure norm_sub  beta repeated sham baseline-post2 within  0.0391    0.0068 0.0113     0.0016

Result: partially reproduced, resting on an assumption. With AI on the band power (Eq. 1), the mean baseline AI is negative in both groups (whole block: sham -0.58 to -0.61, tFUS -0.24 to -0.29), so the two normalizations read an increase in opposite directions. Over the whole block under the repeated-measures reading the tFUS AI rises above baseline, toward balance, in theta and alpha under both normalizations once the sign is read this way (subtraction: theta post 1 p = 0.0495, post 2 p = 0.010, alpha post 2 p = 0.012; division, where a rising AI is a falling ratio: theta post 2 p = 0.0020, alpha post 2 p = 0.0005). Read literally, as the normalized value rising, only subtraction gives it. Over the seizure periods nothing is significant. Sham against tFUS is not significant in any band, block or combination of readings. With AI on the band ratios (the verifier's second reading) the baseline AI is near 0 (-0.09 to +0.04), no tFUS block differs from baseline in theta or alpha, and no group difference is significant. So only the first part of the claim holds, under one combination of readings, and the outcome rests on computing AI on the band power: on band ratios it would be not reproduced.

figs5-seizures-lower-ai¶

During seizures (baseline block, after 4-AP) the asymmetry index is negative and differs from zero in every band, more than in the pre-4-AP baseline state; seizures disrupt the normal interhemispheric balance.

The claims file reads the pre-4-AP state as (a) the resting baseline recording of the target confirmation or (b) the first recording before the first injection, where the dataset holds one. Reading (a) cannot be run: the resting recordings (EP data, BASELINE) hold only the 64 intracranial channels of left S1, not the EEG. Reading (b) can, for 13 of the 16 rats (all 6 sham and 7 of the 10 tFUS rats; BH638, BH642 and BH644 have none): each rat's EEG file labelled EEG data for PLV analysis is its last recording before the first labelled block, and it ends 64 to 176 min before that block starts (table below), so before the monitoring block of about 62.5 min that the first injection opens (Fig. 1E, Methods D). The first version of this attempt missed this and blocked the claim; the verifier found it. That recording carries a 20 ms tFUS pulse every 2 s, so the pre-4-AP state is taken from the gaps between pulses, 250 ms after one onset to 20 ms before the next (tfus.pre_state), with the whole recording as a variant. This is an assumption: the paper's pre-4-AP baseline may have been a recording without pulses.

AI (Eq. 1, not normalized) on the band power of channels 8 and 25, and, as a second reading, on the band over 3-300 Hz ratios (the paper calls that ratio "absolute power"; Eq. 1 says "PSD"). Seizure AI is that of the merged seizure periods of the baseline block. Rats: (a) all 16 (13 with a pre-4-AP recording), (b) the 10 tFUS rats (7). Tests: one-sample t against 0 per band (Fig. S5 legend); seizure against pre-4-AP by paired t and by a two-way ANOVA (state by band, ordinary and repeated measures) with Bonferroni post hoc tests per band.

In [12]:
# The pre-4-AP recordings: timing against each rat's first labelled block, then band power and PLI.
first = blocks[blocks.order == 0].set_index("subject")
rows = []
for m in plv:
    if m["subject"] not in first.index:
        continue
    t0 = pd.Timestamp(m["start"]); t1 = t0 + pd.Timedelta(seconds=m["n_samples"] / m["rate"])
    later = [pd.Timestamp(x["start"]) for x in lab if x["subject"] == m["subject"]]
    rows.append({"subject": m["subject"], "group": first.loc[m["subject"], "group"], "PLV start": str(t0)[:19],
                 "PLV minutes": round((t1 - t0).total_seconds() / 60, 1),
                 "min from PLV end to first block": round((pd.Timestamp(first.loc[m["subject"], "start"]) - t1).total_seconds() / 60, 1),
                 "first block is earliest labelled": pd.Timestamp(first.loc[m["subject"], "start"]) == min(later)})
PT = pd.DataFrame(rows).sort_values(["group", "subject"])
print(PT.to_string(index=False))
print("Epilepsy rats without a PLV recording:", sorted(set(blocks.subject) - set(PT.subject)))
t0 = time.time()
PRE = tfus.pre_states([m for m in plv if m["subject"] in set(PT.subject)], workers=4)
print(f"pre-4-AP state of {len(PRE)} rats in {time.time() - t0:.0f} s; gaps per recording "
      f"{min(r['n_gaps'] for r in PRE.values())} to {max(r['n_gaps'] for r in PRE.values())}, gap length "
      f"{min(r['gap_s'] for r in PRE.values()):.2f} to {max(r['gap_s'] for r in PRE.values()):.2f} s")
rows = []
for s, r in PRE.items():
    for reading in ("gaps", "whole"):
        f, p = r["psd_" + reading]
        pw = tfus.band_powers(f, p)
        for band in tfus.BANDS:
            ip, co = pw[band]
            ri, rc = ip / pw["total_3_300"][0], co / pw["total_3_300"][1]
            rows.append({"subject": s, "group": first.loc[s, "group"], "pre": reading, "band": band,
                         "ai": (ip - co) / (ip + co), "ai_ratio": (ri - rc) / (ri + rc)})
PA = pd.DataFrame(rows)
print("\nPre-4-AP AI, mean (min to max) over the 13 rats:")
print(PA.groupby(["pre", "band"])[["ai", "ai_ratio"]].agg(["mean", "min", "max"]).round(3).to_string())
subject group           PLV start  PLV minutes  min from PLV end to first block  first block is earliest labelled
  BH635  sham 2024-12-13 18:58:05          7.3                            172.5                              True
  BH649  sham 2025-02-16 20:52:12          6.7                             87.9                              True
  BH659  sham 2025-02-28 19:35:14          6.7                            143.9                              True
  BH662  sham 2025-03-11 16:18:14          6.7                             71.0                              True
  BH663  sham 2025-03-13 18:20:01          6.9                            175.6                              True
  BH665  sham 2025-03-18 17:14:39          6.7                             64.0                              True
  BH624  tFUS 2024-12-03 17:20:27          8.4                            127.8                              True
  BH626  tFUS 2024-11-29 19:35:44          5.0                            107.5                              True
  BH634  tFUS 2024-12-11 19:31:27          7.4                             65.1                              True
  BH646  tFUS 2025-02-22 18:58:25          6.7                             86.3                              True
  BH650  tFUS 2025-02-18 17:58:00          6.7                             89.8                              True
  BH653  tFUS 2025-02-11 18:05:58          6.7                             72.2                              True
  BH660  tFUS 2025-03-04 18:08:40          6.7                             70.3                              True
Epilepsy rats without a PLV recording: ['BH638', 'BH642', 'BH644']
pre-4-AP state of 13 rats in 118 s; gaps per recording 199 to 300, gap length 0.73 to 1.73 s

Pre-4-AP AI, mean (min to max) over the 13 rats:
                ai               ai_ratio              
              mean    min    max     mean    min    max
pre   band                                             
gaps  alpha -0.199 -0.665  0.203   -0.024 -0.194  0.143
      beta  -0.214 -0.674  0.118   -0.042 -0.156  0.074
      gamma -0.264 -0.741  0.014   -0.093 -0.209  0.034
      theta -0.173 -0.641  0.273    0.006 -0.162  0.198
whole alpha -0.192 -0.667  0.234   -0.015 -0.147  0.105
      beta  -0.221 -0.673  0.130   -0.047 -0.164  0.074
      gamma -0.269 -0.737  0.009   -0.096 -0.204  0.017
      theta -0.174 -0.645  0.262    0.006 -0.172  0.181
In [13]:
sa = ai[(ai.segment == "seizure") & (ai.block == "baseline")]
rows = []
for value in ("ai", "ai_ratio"):
    for rats, dd in (("16 rats", sa), ("10 tFUS rats", sa[sa.group == "tFUS"]),
                     ("13 rats with pre", sa[sa.subject.isin(PRE)]), ("7 tFUS rats with pre", sa[sa.subject.isin(PRE) & (sa.group == "tFUS")])):
        for band in tfus.BANDS:
            x = dd[dd.band == band][value]
            t = stats.ttest_1samp(x, 0)
            rows.append({"AI on": value, "rats": rats, "band": band, "n": len(x), "seizure AI": x.mean(), "sem": x.sem(), "t": t.statistic, "p": t.pvalue})
print("Seizure AI of the baseline block against 0 (one-sample t):")
print(pd.DataFrame(rows).round(4).to_string(index=False))
rows, verdict = [], []
for value in ("ai", "ai_ratio"):
    for pre in ("gaps", "whole"):
        for rats in ("13 rats", "7 tFUS rats"):
            pp = PA[(PA.pre == pre) & ((PA.group == "tFUS") if rats.startswith("7") else True)]
            m = pp[["subject", "band", value]].rename(columns={value: "pre"}).merge(
                sa[["subject", "band", value]].rename(columns={value: "seizure"}), on=["subject", "band"])
            long = pd.concat([m.assign(state="pre", y=m.pre), m.assign(state="seizure", y=m.seizure)])[["subject", "band", "state", "y"]]
            comps = [(band, {"state": "seizure", "band": band}, {"state": "pre", "band": band}, "bands") for band in tfus.BANDS]
            anova = {k: tfus.twoway(long, "y", "state", "band", "subject", comps, rm=(k == "repeated"))[1].set_index("comparison")
                     for k in ("ordinary", "repeated")}
            sig0, lower = {}, {}
            for band in tfus.BANDS:
                x = m[m.band == band]
                t0 = stats.ttest_1samp(x.seizure, 0); tp = stats.ttest_1samp(x.pre, 0); tr = stats.ttest_rel(x.seizure, x.pre)
                rows.append({"AI on": value, "pre": pre, "rats": rats, "band": band, "n": len(x),
                             "seizure": x.seizure.mean(), "p seizure vs 0": t0.pvalue, "pre-4-AP": x.pre.mean(), "p pre vs 0": tp.pvalue,
                             "seizure - pre": (x.seizure - x.pre).mean(), "p paired": tr.pvalue,
                             "p ANOVA ordinary": anova["ordinary"].loc[band, "p_family"], "p ANOVA repeated": anova["repeated"].loc[band, "p_family"]})
                sig0[band] = (t0.pvalue < 0.05) and x.seizure.mean() < 0
                lower[band] = {k: (p < 0.05) and (x.seizure - x.pre).mean() < 0 for k, p in
                               (("paired", tr.pvalue), ("ordinary", anova["ordinary"].loc[band, "p_family"]), ("repeated", anova["repeated"].loc[band, "p_family"]))}
            for test in ("paired", "ordinary", "repeated"):
                verdict.append({"AI on": value, "pre": pre, "rats": rats, "test": test, "seizure below 0 in all bands": all(sig0.values()),
                                "seizure below pre in": ", ".join(b for b in tfus.BANDS if lower[b][test]) or "none",
                                "reproduced": all(sig0.values()) and lower["alpha"][test] and lower["beta"][test]})
S5 = pd.DataFrame(rows)
print("\nSeizure against pre-4-AP AI, per band (p of the ANOVA post hoc tests Bonferroni over the four bands):")
print(S5.round(4).to_string(index=False))
print("\nCriterion per combination of readings:")
print(pd.DataFrame(verdict).to_string(index=False))
Seizure AI of the baseline block against 0 (one-sample t):
   AI on                 rats  band  n  seizure AI    sem       t      p
      ai              16 rats theta 16     -0.4092 0.0634 -6.4586 0.0000
      ai              16 rats alpha 16     -0.4215 0.0614 -6.8695 0.0000
      ai              16 rats  beta 16     -0.4077 0.0605 -6.7434 0.0000
      ai              16 rats gamma 16     -0.4260 0.0597 -7.1366 0.0000
      ai         10 tFUS rats theta 10     -0.2673 0.0576 -4.6424 0.0012
      ai         10 tFUS rats alpha 10     -0.2838 0.0542 -5.2341 0.0005
      ai         10 tFUS rats  beta 10     -0.2723 0.0482 -5.6479 0.0003
      ai         10 tFUS rats gamma 10     -0.3027 0.0471 -6.4209 0.0001
      ai     13 rats with pre theta 13     -0.4524 0.0731 -6.1913 0.0000
      ai     13 rats with pre alpha 13     -0.4668 0.0698 -6.6844 0.0000
      ai     13 rats with pre  beta 13     -0.4465 0.0704 -6.3470 0.0000
      ai     13 rats with pre gamma 13     -0.4556 0.0712 -6.3999 0.0000
      ai 7 tFUS rats with pre theta  7     -0.2867 0.0829 -3.4589 0.0135
      ai 7 tFUS rats with pre alpha  7     -0.3089 0.0771 -4.0090 0.0070
      ai 7 tFUS rats with pre  beta  7     -0.2865 0.0698 -4.1078 0.0063
      ai 7 tFUS rats with pre gamma  7     -0.3050 0.0684 -4.4582 0.0043
ai_ratio              16 rats theta 16      0.0105 0.0305  0.3429 0.7364
ai_ratio              16 rats alpha 16     -0.0086 0.0196 -0.4387 0.6671
ai_ratio              16 rats  beta 16     -0.0000 0.0031 -0.0097 0.9924
ai_ratio              16 rats gamma 16     -0.0418 0.0261 -1.6017 0.1301
ai_ratio         10 tFUS rats theta 10      0.0047 0.0247  0.1896 0.8539
ai_ratio         10 tFUS rats alpha 10     -0.0131 0.0190 -0.6891 0.5081
ai_ratio         10 tFUS rats  beta 10      0.0016 0.0031  0.4957 0.6320
ai_ratio         10 tFUS rats gamma 10     -0.0319 0.0162 -1.9701 0.0803
ai_ratio     13 rats with pre theta 13      0.0076 0.0376  0.2008 0.8442
ai_ratio     13 rats with pre alpha 13     -0.0151 0.0238 -0.6351 0.5373
ai_ratio     13 rats with pre  beta 13     -0.0012 0.0036 -0.3286 0.7481
ai_ratio     13 rats with pre gamma 13     -0.0380 0.0319 -1.1904 0.2569
ai_ratio 7 tFUS rats with pre theta  7     -0.0032 0.0351 -0.0910 0.9304
ai_ratio 7 tFUS rats with pre alpha  7     -0.0271 0.0254 -1.0681 0.3265
ai_ratio 7 tFUS rats with pre  beta  7      0.0001 0.0037  0.0320 0.9755
ai_ratio 7 tFUS rats with pre gamma  7     -0.0207 0.0204 -1.0162 0.3487
Seizure against pre-4-AP AI, per band (p of the ANOVA post hoc tests Bonferroni over the four bands):
   AI on   pre        rats  band  n  seizure  p seizure vs 0  pre-4-AP  p pre vs 0  seizure - pre  p paired  p ANOVA ordinary  p ANOVA repeated
      ai  gaps     13 rats theta 13  -0.4524          0.0000   -0.1731      0.0450        -0.2793    0.0001            0.0279            0.0000
      ai  gaps     13 rats alpha 13  -0.4668          0.0000   -0.1993      0.0217        -0.2674    0.0000            0.0387            0.0000
      ai  gaps     13 rats  beta 13  -0.4465          0.0000   -0.2138      0.0152        -0.2327    0.0001            0.0950            0.0000
      ai  gaps     13 rats gamma 13  -0.4556          0.0000   -0.2641      0.0007        -0.1915    0.0006            0.2466            0.0000
      ai  gaps 7 tFUS rats theta  7  -0.2867          0.0135   -0.0334      0.7354        -0.2533    0.0224            0.0866            0.0000
      ai  gaps 7 tFUS rats alpha  7  -0.3089          0.0070   -0.0453      0.5983        -0.2636    0.0054            0.0685            0.0000
      ai  gaps 7 tFUS rats  beta  7  -0.2865          0.0063   -0.0880      0.2620        -0.1986    0.0003            0.2756            0.0009
      ai  gaps 7 tFUS rats gamma  7  -0.3050          0.0043   -0.1577      0.0220        -0.1473    0.0033            0.6951            0.0177
      ai whole     13 rats theta 13  -0.4524          0.0000   -0.1740      0.0446        -0.2784    0.0001            0.0292            0.0000
      ai whole     13 rats alpha 13  -0.4668          0.0000   -0.1922      0.0273        -0.2746    0.0000            0.0324            0.0000
      ai whole     13 rats  beta 13  -0.4465          0.0000   -0.2206      0.0127        -0.2260    0.0002            0.1135            0.0000
      ai whole     13 rats gamma 13  -0.4556          0.0000   -0.2686      0.0006        -0.1870    0.0006            0.2744            0.0000
      ai whole 7 tFUS rats theta  7  -0.2867          0.0135   -0.0211      0.8206        -0.2655    0.0122            0.0629            0.0000
      ai whole 7 tFUS rats alpha  7  -0.3089          0.0070   -0.0452      0.6054        -0.2637    0.0035            0.0657            0.0000
      ai whole 7 tFUS rats  beta  7  -0.2865          0.0063   -0.1011      0.2077        -0.1854    0.0006            0.3470            0.0009
      ai whole 7 tFUS rats gamma  7  -0.3050          0.0043   -0.1628      0.0193        -0.1422    0.0039            0.7447            0.0136
ai_ratio  gaps     13 rats theta 13   0.0076          0.8442    0.0056      0.8654         0.0019    0.9730            1.0000            1.0000
ai_ratio  gaps     13 rats alpha 13  -0.0151          0.5373   -0.0243      0.4209         0.0091    0.8389            1.0000            1.0000
ai_ratio  gaps     13 rats  beta 13  -0.0012          0.7481   -0.0416      0.0776         0.0404    0.0910            1.0000            1.0000
ai_ratio  gaps     13 rats gamma 13  -0.0380          0.2569   -0.0930      0.0014         0.0550    0.1708            0.6214            0.6228
ai_ratio  gaps 7 tFUS rats theta  7  -0.0032          0.9304    0.0409      0.4226        -0.0441    0.5434            1.0000            1.0000
ai_ratio  gaps 7 tFUS rats alpha  7  -0.0271          0.3265    0.0292      0.3492        -0.0564    0.2697            0.6775            0.6787
ai_ratio  gaps 7 tFUS rats  beta  7   0.0001          0.9755   -0.0141      0.5826         0.0143    0.5774            1.0000            1.0000
ai_ratio  gaps 7 tFUS rats gamma  7  -0.0207          0.3487   -0.0840      0.0115         0.0633    0.0052            0.4944            0.4960
ai_ratio whole     13 rats theta 13   0.0076          0.8442    0.0059      0.8538         0.0016    0.9766            1.0000            1.0000
ai_ratio whole     13 rats alpha 13  -0.0151          0.5373   -0.0150      0.5546        -0.0001    0.9977            1.0000            1.0000
ai_ratio whole     13 rats  beta 13  -0.0012          0.7481   -0.0466      0.0444         0.0455    0.0550            0.8907            0.8921
ai_ratio whole     13 rats gamma 13  -0.0380          0.2569   -0.0958      0.0006         0.0578    0.1295            0.4882            0.4898
ai_ratio whole 7 tFUS rats theta  7  -0.0032          0.9304    0.0570      0.1658        -0.0602    0.3446            0.4447            0.4469
ai_ratio whole 7 tFUS rats alpha  7  -0.0271          0.3265    0.0326      0.2655        -0.0597    0.1816            0.4549            0.4571
ai_ratio whole 7 tFUS rats  beta  7   0.0001          0.9755   -0.0243      0.3481         0.0244    0.3500            1.0000            1.0000
ai_ratio whole 7 tFUS rats gamma  7  -0.0207          0.3487   -0.0858      0.0134         0.0652    0.0065            0.3406            0.3429

Criterion per combination of readings:
   AI on   pre        rats     test  seizure below 0 in all bands      seizure below pre in  reproduced
      ai  gaps     13 rats   paired                          True theta, alpha, beta, gamma        True
      ai  gaps     13 rats ordinary                          True              theta, alpha       False
      ai  gaps     13 rats repeated                          True theta, alpha, beta, gamma        True
      ai  gaps 7 tFUS rats   paired                          True theta, alpha, beta, gamma        True
      ai  gaps 7 tFUS rats ordinary                          True                      none       False
      ai  gaps 7 tFUS rats repeated                          True theta, alpha, beta, gamma        True
      ai whole     13 rats   paired                          True theta, alpha, beta, gamma        True
      ai whole     13 rats ordinary                          True              theta, alpha       False
      ai whole     13 rats repeated                          True theta, alpha, beta, gamma        True
      ai whole 7 tFUS rats   paired                          True theta, alpha, beta, gamma        True
      ai whole 7 tFUS rats ordinary                          True                      none       False
      ai whole 7 tFUS rats repeated                          True theta, alpha, beta, gamma        True
ai_ratio  gaps     13 rats   paired                         False                      none       False
ai_ratio  gaps     13 rats ordinary                         False                      none       False
ai_ratio  gaps     13 rats repeated                         False                      none       False
ai_ratio  gaps 7 tFUS rats   paired                         False                      none       False
ai_ratio  gaps 7 tFUS rats ordinary                         False                      none       False
ai_ratio  gaps 7 tFUS rats repeated                         False                      none       False
ai_ratio whole     13 rats   paired                         False                      none       False
ai_ratio whole     13 rats ordinary                         False                      none       False
ai_ratio whole     13 rats repeated                         False                      none       False
ai_ratio whole 7 tFUS rats   paired                         False                      none       False
ai_ratio whole 7 tFUS rats ordinary                         False                      none       False
ai_ratio whole 7 tFUS rats repeated                         False                      none       False

Result: reproduced, resting on assumptions. With AI on the band power, the seizure AI of the baseline block is negative and below 0 in every band: -0.41 to -0.43 over the 16 rats (p < 0.0001 in each band), -0.27 to -0.30 over the 10 tFUS rats (p = 0.0001 to 0.0012), and the same over the 13 and 7 rats that have a pre-4-AP recording (p < 0.0001; p = 0.004 to 0.014). It is lower than the pre-4-AP AI of the gaps between pulses in every band, for all 13 rats (seizure - pre -0.19 to -0.28; paired t p = 0.0006 or less; repeated-measures ANOVA p < 0.0001) and for the 7 tFUS rats (paired p = 0.0003 to 0.022; repeated p = 0.018 or less); the whole recording gives the same. The ordinary two-way ANOVA finds it in theta and alpha only for the 13 rats (p = 0.028 and 0.039; beta 0.095) and in no band for the 7. The pre-4-AP AI is itself negative (-0.17 to -0.26, below 0 in every band for the 13 rats, p = 0.0007 to 0.045; for the 7 tFUS rats only in gamma, p = 0.022, the band Fig. S5 marks). The outcome rests on two choices. (1) The pre-4-AP state is the gaps between the 20 ms pulses of the last recording before the first injection, the only pre-4-AP EEG in the dandiset. (2) AI is computed on the band power, as Methods E says ("the relative difference in PSD") and the Fig. 4 legend ("calculated using PSD values"). On the band over 3-300 Hz ratios the seizure AI is near 0 (-0.04 to +0.01) and not below 0 in any band (p = 0.08 to 0.99), and the claim fails under every combination.

fig6-epileptic-pli-s1-decrease¶

In epileptic rats, the S1 PLI of the tFUS group decreases in theta, alpha, beta and gamma bands during stimulation, post 1 and post 2 relative to baseline seizures, while non-S1 PLI does not decrease; the decrease of S1 connectivity is significant.

PLI (M6) over the seizure periods of each block (the union of both hemispheres' labels, periods of 1 s or more), per band, averaged over the 16 S1 pairs (left S1 with right S1 channels) and the 144 non-S1 pairs; per seizure and averaged (reading a) or over the concatenated seizure samples (reading b); normalized to the group's mean baseline-block PLI by difference or ratio. Reproduced when, under one combination of readings, the tFUS S1 mean is below baseline in all four bands for the condition block, post 1 and post 2, the tFUS non-S1 mean is not below baseline in most of those 12 cells, and a group by block two-way ANOVA per band and region finds sham against tFUS significant for S1 in at least one band and block.

In [14]:
rows = []
for a, r in R.items():
    i = info.loc[a]
    for band in tfus.BANDS:
        v = r["pli"][band]
        if v is None:
            continue
        for reading in ("per_seizure", "concat"):
            pm = tfus.pair_means(v[reading])
            for region in ("S1", "nonS1"):
                rows.append({"subject": i.subject, "group": i.group, "block": i.block, "band": band,
                             "reading": reading, "region": region, "pli": pm[region], "n_seizures": v["n"], "seconds": v["seconds"]})
P = pd.DataFrame(rows)
P = P[P.block != "post3"]
print("Rat-blocks with seizure PLI:", P[["subject", "block"]].drop_duplicates().shape[0], "of", int((blocks.block != "post3").sum()))
print("PLI range:", round(P.pli.min(), 3), "to", round(P.pli.max(), 3))
base = P[P.block == "baseline"].groupby(["group", "band", "reading", "region"]).pli.mean().rename("base")
P = P.join(base, on=["group", "band", "reading", "region"])
P["diff"] = P.pli - P.base
P["ratio"] = P.pli / P.base
G = P.groupby(["reading", "region", "band", "group", "block"])[["diff", "ratio"]].mean()
print("\nGroup mean normalized PLI (difference from the group's baseline):")
print(G["diff"].unstack().round(4).to_string())
Rat-blocks with seizure PLI: 62 of 64
PLI range: 0.021 to 0.51

Group mean normalized PLI (difference from the group's baseline):
block                           baseline  condition   post1   post2
reading     region band  group                                     
concat      S1     alpha sham        0.0    -0.0185 -0.0561 -0.0437
                         tFUS        0.0    -0.0252 -0.0301 -0.0683
                   beta  sham       -0.0    -0.0236 -0.0222 -0.0149
                         tFUS        0.0     0.0060  0.0253  0.0106
                   gamma sham       -0.0    -0.0028 -0.0062 -0.0072
                         tFUS        0.0     0.0091  0.0015  0.0014
                   theta sham        0.0    -0.0336 -0.1086 -0.0935
                         tFUS        0.0    -0.0470 -0.0532 -0.0700
            nonS1  alpha sham        0.0    -0.0206 -0.0465 -0.0464
                         tFUS        0.0    -0.0112 -0.0011 -0.0303
                   beta  sham       -0.0    -0.0337 -0.0379 -0.0397
                         tFUS        0.0    -0.0040  0.0119  0.0074
                   gamma sham        0.0    -0.0047 -0.0134 -0.0116
                         tFUS        0.0    -0.0013  0.0063  0.0055
                   theta sham       -0.0    -0.0138 -0.0521 -0.0441
                         tFUS        0.0    -0.0221 -0.0193 -0.0382
per_seizure S1     alpha sham       -0.0     0.0062 -0.0345 -0.0255
                         tFUS        0.0    -0.0258 -0.0322 -0.0572
                   beta  sham        0.0    -0.0144 -0.0191 -0.0137
                         tFUS       -0.0    -0.0070  0.0098  0.0002
                   gamma sham        0.0    -0.0080 -0.0146 -0.0152
                         tFUS        0.0     0.0051 -0.0045  0.0018
                   theta sham       -0.0    -0.0216 -0.0798 -0.0690
                         tFUS        0.0    -0.0309 -0.0455 -0.0578
            nonS1  alpha sham       -0.0    -0.0056 -0.0310 -0.0215
                         tFUS        0.0    -0.0078 -0.0033 -0.0245
                   beta  sham       -0.0    -0.0265 -0.0313 -0.0327
                         tFUS        0.0    -0.0059  0.0055  0.0039
                   gamma sham        0.0    -0.0032 -0.0113 -0.0101
                         tFUS       -0.0    -0.0006  0.0004  0.0044
                   theta sham       -0.0    -0.0064 -0.0314 -0.0251
                         tFUS        0.0    -0.0151 -0.0187 -0.0289
In [15]:
rows = []
for reading in ("per_seizure", "concat"):
    for norm in ("diff", "ratio"):
        g = G[norm].xs(reading, level="reading").unstack()
        ref = 0.0 if norm == "diff" else 1.0
        t = g.xs("tFUS", level="group")
        s1 = t.xs("S1", level="region")[["condition", "post1", "post2"]]
        ns = t.xs("nonS1", level="region")[["condition", "post1", "post2"]]
        sig = []
        for band in tfus.BANDS:
            dd = P[(P.reading == reading) & (P.region == "S1") & (P.band == band)]
            for k, (table, post) in tfus.group_block_tests(dd, norm).items():
                for r in post[(post.family == "between") & (post.p_family < 0.05)].itertuples():
                    sig.append(f"{band} {r.comparison} [{k}] p={r.p_family:.3g}")
        rows.append({"reading": reading, "norm": norm, "tFUS S1 cells below baseline (of 12)": int((s1 < ref).sum().sum()),
                     "tFUS non-S1 cells not below baseline (of 12)": int((ns >= ref).sum().sum()),
                     "S1 sham-tFUS significant": "; ".join(sig) if sig else "none"})
print(pd.DataFrame(rows).to_string(index=False))
print("\nPer rat, tFUS S1 PLI difference from the group baseline, per_seizure reading:")
print(P[(P.group == "tFUS") & (P.region == "S1") & (P.reading == "per_seizure")].pivot_table(index=["band", "subject"], columns="block", values="diff").round(3).unstack(0).to_string())
    reading  norm  tFUS S1 cells below baseline (of 12)  tFUS non-S1 cells not below baseline (of 12) S1 sham-tFUS significant
per_seizure  diff                                     8                                             4                     none
per_seizure ratio                                     8                                             4                     none
     concat  diff                                     6                                             4                     none
     concat ratio                                     6                                             4                     none

Per rat, tFUS S1 PLI difference from the group baseline, per_seizure reading:
block   baseline                      condition                       post1                       post2                     
band       alpha   beta  gamma  theta     alpha   beta  gamma  theta  alpha   beta  gamma  theta  alpha   beta  gamma  theta
subject                                                                                                                     
BH624     -0.051 -0.010 -0.010 -0.064    -0.032 -0.035 -0.017 -0.069  0.064  0.023  0.027 -0.012  0.009  0.010  0.008  0.048
BH626      0.010 -0.022 -0.016  0.092    -0.052 -0.011 -0.003 -0.065 -0.013 -0.043  0.012 -0.086 -0.041 -0.037  0.012 -0.118
BH634      0.018 -0.010 -0.034 -0.037     0.040 -0.002 -0.032 -0.120 -0.049  0.092  0.032 -0.038    NaN    NaN    NaN    NaN
BH638      0.066 -0.017 -0.024  0.016     0.039 -0.016 -0.008  0.068  0.054 -0.010 -0.023 -0.013    NaN    NaN    NaN    NaN
BH642      0.095 -0.022  0.071  0.132     0.050 -0.013  0.070  0.060 -0.041  0.005 -0.019 -0.045 -0.067  0.023  0.023 -0.034
BH644     -0.068 -0.004 -0.042  0.088    -0.106 -0.001 -0.046  0.131 -0.071 -0.013 -0.045  0.044 -0.057 -0.034 -0.046 -0.040
BH646     -0.036 -0.074 -0.053 -0.041    -0.054 -0.063 -0.033 -0.079 -0.070 -0.053 -0.058 -0.091 -0.093 -0.052 -0.052 -0.084
BH650      0.025  0.048  0.001 -0.014    -0.044  0.021  0.020 -0.048 -0.051  0.060 -0.014 -0.018 -0.060  0.046  0.008 -0.037
BH653      0.001  0.033  0.097 -0.030    -0.028  0.030  0.112 -0.060 -0.082  0.023  0.068 -0.099 -0.058  0.049  0.084 -0.073
BH660     -0.060  0.078  0.009 -0.141    -0.072  0.020 -0.012 -0.127 -0.063  0.015 -0.027 -0.097 -0.091 -0.002 -0.021 -0.125

Result: not reproduced. Per seizure and averaged (reading a of M6), the tFUS S1 PLI is below the group's baseline in 8 of the 12 band and block cells: in theta and alpha at all three blocks, in beta only at the condition block and in gamma only at post 1; over the concatenated seizure samples, 6 of 12. The non-S1 PLI falls as well: it is not below baseline in only 4 of 12 cells under every reading, where the claim needs most of the 12. No sham against tFUS comparison of S1 PLI is significant in any band or block under either ANOVA reading. So the S1 decrease holds in two bands only, the S1 specificity fails and the group difference fails. The first version of this attempt called this partial, as the criterion's partial clause names the first and last of these failures; the verifier judged it not reproduced, since the non-S1 part, which the partial clause does not cover, fails too, and this revision agrees.

figs7-seizure-pli-s1-vs-non-s1¶

Comparing seizures (baseline block) with the pre-4-AP baseline state, the PLI change of S1 pairs differs significantly from that of non-S1 pairs in every band.

The pre-4-AP state is the gaps between pulses of each rat's PLV recording, as for figs5-seizures-lower-ai (13 of the 16 rats; reading (a) of the state cannot be run). Per rat, band and region, the change is the seizure PLI of the baseline block minus (reading a) or over (reading b) the pre-4-AP PLI; the seizure PLI per seizure averaged or over the concatenated seizure samples (M6), the pre-4-AP PLI over the concatenated gap samples. The pre-4-AP PLI per gap, averaged, is shown as well; its gaps of 1.7 s are far shorter than the seizures, so it is biased upwards against them (see the PLI bias in wild_type.ipynb) and it is not used for the change. Two-way ANOVA (region by band, ordinary and repeated measures) of the change with Bonferroni post hoc tests of S1 against non-S1 per band; rats (a) all 13, (b) the 7 tFUS rats. Reproduced when, under one combination, S1 is significantly higher than non-S1 in all four bands.

In [16]:
pre_pli = []
for s, r in PRE.items():
    for band in tfus.BANDS:
        for reading in ("concat", "per_gap", "whole"):
            pm = tfus.pair_means(r["pli"][band][reading])
            for region in ("S1", "nonS1"):
                pre_pli.append({"subject": s, "band": band, "pre reading": reading, "region": region, "pre": pm[region]})
pre_pli = pd.DataFrame(pre_pli)
print("Pre-4-AP PLI, mean over the 13 rats (concatenated gaps, per gap, whole recording):")
print(pre_pli.pivot_table(index=["band", "region"], columns="pre reading", values="pre").round(4).to_string())
sz = P[(P.block == "baseline")][["subject", "group", "band", "reading", "region", "pli"]]
C = sz.merge(pre_pli[pre_pli["pre reading"] == "concat"][["subject", "band", "region", "pre"]], on=["subject", "band", "region"])
C["diff"] = C.pli - C.pre
C["ratio"] = C.pli / C.pre
print("\nSeizure PLI of the baseline block, pre-4-AP PLI and the change, mean over the 13 rats:")
print(C.groupby(["reading", "band", "region"])[["pli", "pre", "diff", "ratio"]].mean().round(4).unstack("region").to_string())
rows, verdict = [], []
for reading in ("per_seizure", "concat"):
    for norm in ("diff", "ratio"):
        for rats in ("13 rats", "7 tFUS rats"):
            dd = C[(C.reading == reading) & ((C.group == "tFUS") if rats.startswith("7") else True)]
            comps = [(band, {"region": "S1", "band": band}, {"region": "nonS1", "band": band}, "bands") for band in tfus.BANDS]
            for k in ("ordinary", "repeated"):
                post = tfus.twoway(dd, norm, "region", "band", "subject", comps, rm=(k == "repeated"))[1].set_index("comparison")
                ok = [b for b in tfus.BANDS if post.loc[b, "p_family"] < 0.05 and post.loc[b, "diff"] > 0]
                for b in tfus.BANDS:
                    rows.append({"seizure reading": reading, "change": norm, "rats": rats, "anova": k, "band": b,
                                 "S1 - nonS1": post.loc[b, "diff"], "p": post.loc[b, "p_family"]})
                verdict.append({"seizure reading": reading, "change": norm, "rats": rats, "anova": k,
                                "bands with S1 significantly higher": ", ".join(ok) or "none", "n": len(ok)})
print("\nS1 against non-S1 change per band (Bonferroni over the four bands):")
print(pd.DataFrame(rows).round(4).to_string(index=False))
print("\nCriterion per combination of readings:")
print(pd.DataFrame(verdict).to_string(index=False))
Pre-4-AP PLI, mean over the 13 rats (concatenated gaps, per gap, whole recording):
pre reading   concat  per_gap   whole
band  region                         
alpha S1      0.0749   0.2758  0.0763
      nonS1   0.0875   0.2778  0.0885
beta  S1      0.0511   0.1429  0.0516
      nonS1   0.0541   0.1426  0.0543
gamma S1      0.0289   0.0887  0.0284
      nonS1   0.0626   0.1045  0.0625
theta S1      0.0767   0.3136  0.0754
      nonS1   0.0755   0.3123  0.0766

Seizure PLI of the baseline block, pre-4-AP PLI and the change, mean over the 13 rats:
                      pli             pre            diff           ratio        
region                 S1   nonS1      S1   nonS1      S1   nonS1      S1   nonS1
reading     band                                                                 
concat      alpha  0.1825  0.1451  0.0749  0.0875  0.1076  0.0575  3.4074  1.9120
            beta   0.1446  0.1413  0.0511  0.0541  0.0935  0.0871  4.2384  3.6456
            gamma  0.1014  0.0849  0.0289  0.0626  0.0725  0.0224  3.8496  2.3345
            theta  0.2425  0.1551  0.0767  0.0755  0.1658  0.0796  4.2897  2.6360
per_seizure alpha  0.1957  0.1628  0.0749  0.0875  0.1209  0.0752  3.6740  2.1808
            beta   0.1542  0.1457  0.0511  0.0541  0.1031  0.0915  4.7252  3.9490
            gamma  0.1059  0.0902  0.0289  0.0626  0.0770  0.0276  4.1575  2.5560
            theta  0.2496  0.1788  0.0767  0.0755  0.1729  0.1032  4.4388  3.1250
S1 against non-S1 change per band (Bonferroni over the four bands):
seizure reading change        rats    anova  band  S1 - nonS1      p
    per_seizure   diff     13 rats ordinary theta      0.0696 0.0294
    per_seizure   diff     13 rats ordinary alpha      0.0456 0.3040
    per_seizure   diff     13 rats ordinary  beta      0.0116 1.0000
    per_seizure   diff     13 rats ordinary gamma      0.0494 0.2204
    per_seizure   diff     13 rats repeated theta      0.0696 0.0017
    per_seizure   diff     13 rats repeated alpha      0.0456 0.0735
    per_seizure   diff     13 rats repeated  beta      0.0116 1.0000
    per_seizure   diff     13 rats repeated gamma      0.0494 0.0437
    per_seizure   diff 7 tFUS rats ordinary theta      0.0558 0.1175
    per_seizure   diff 7 tFUS rats ordinary alpha      0.0504 0.1935
    per_seizure   diff 7 tFUS rats ordinary  beta      0.0217 1.0000
    per_seizure   diff 7 tFUS rats ordinary gamma      0.0348 0.6735
    per_seizure   diff 7 tFUS rats repeated theta      0.0558 0.1185
    per_seizure   diff 7 tFUS rats repeated alpha      0.0504 0.1944
    per_seizure   diff 7 tFUS rats repeated  beta      0.0217 1.0000
    per_seizure   diff 7 tFUS rats repeated gamma      0.0348 0.6726
    per_seizure  ratio     13 rats ordinary theta      1.3138 1.0000
    per_seizure  ratio     13 rats ordinary alpha      1.4932 0.8025
    per_seizure  ratio     13 rats ordinary  beta      0.7762 1.0000
    per_seizure  ratio     13 rats ordinary gamma      1.6015 0.6806
    per_seizure  ratio     13 rats repeated theta      1.3138 0.4287
    per_seizure  ratio     13 rats repeated alpha      1.4932 0.2708
    per_seizure  ratio     13 rats repeated  beta      0.7762 1.0000
    per_seizure  ratio     13 rats repeated gamma      1.6015 0.2016
    per_seizure  ratio 7 tFUS rats ordinary theta      1.5736 1.0000
    per_seizure  ratio 7 tFUS rats ordinary alpha      1.4555 1.0000
    per_seizure  ratio 7 tFUS rats ordinary  beta      1.9040 1.0000
    per_seizure  ratio 7 tFUS rats ordinary gamma      1.1472 1.0000
    per_seizure  ratio 7 tFUS rats repeated theta      1.5736 0.9895
    per_seizure  ratio 7 tFUS rats repeated alpha      1.4555 1.0000
    per_seizure  ratio 7 tFUS rats repeated  beta      1.9040 0.6527
    per_seizure  ratio 7 tFUS rats repeated gamma      1.1472 1.0000
         concat   diff     13 rats ordinary theta      0.0862 0.0067
         concat   diff     13 rats ordinary alpha      0.0501 0.2526
         concat   diff     13 rats ordinary  beta      0.0064 1.0000
         concat   diff     13 rats ordinary gamma      0.0501 0.2521
         concat   diff     13 rats repeated theta      0.0862 0.0004
         concat   diff     13 rats repeated alpha      0.0501 0.0769
         concat   diff     13 rats repeated  beta      0.0064 1.0000
         concat   diff     13 rats repeated gamma      0.0501 0.0766
         concat   diff 7 tFUS rats ordinary theta      0.0733 0.0242
         concat   diff 7 tFUS rats ordinary alpha      0.0555 0.1383
         concat   diff 7 tFUS rats ordinary  beta      0.0163 1.0000
         concat   diff 7 tFUS rats ordinary gamma      0.0366 0.6290
         concat   diff 7 tFUS rats repeated theta      0.0733 0.0255
         concat   diff 7 tFUS rats repeated alpha      0.0555 0.1412
         concat   diff 7 tFUS rats repeated  beta      0.0163 1.0000
         concat   diff 7 tFUS rats repeated gamma      0.0366 0.6326
         concat  ratio     13 rats ordinary theta      1.6538 0.4040
         concat  ratio     13 rats ordinary alpha      1.4953 0.5504
         concat  ratio     13 rats ordinary  beta      0.5928 1.0000
         concat  ratio     13 rats ordinary gamma      1.5151 0.5302
         concat  ratio     13 rats repeated theta      1.6538 0.1095
         concat  ratio     13 rats repeated alpha      1.4953 0.1819
         concat  ratio     13 rats repeated  beta      0.5928 1.0000
         concat  ratio     13 rats repeated gamma      1.5151 0.1711
         concat  ratio 7 tFUS rats ordinary theta      1.8302 1.0000
         concat  ratio 7 tFUS rats ordinary alpha      1.3738 1.0000
         concat  ratio 7 tFUS rats ordinary  beta      1.6075 1.0000
         concat  ratio 7 tFUS rats ordinary gamma      1.1058 1.0000
         concat  ratio 7 tFUS rats repeated theta      1.8302 0.5397
         concat  ratio 7 tFUS rats repeated alpha      1.3738 1.0000
         concat  ratio 7 tFUS rats repeated  beta      1.6075 0.7514
         concat  ratio 7 tFUS rats repeated gamma      1.1058 1.0000

Criterion per combination of readings:
seizure reading change        rats    anova bands with S1 significantly higher  n
    per_seizure   diff     13 rats ordinary                              theta  1
    per_seizure   diff     13 rats repeated                       theta, gamma  2
    per_seizure   diff 7 tFUS rats ordinary                               none  0
    per_seizure   diff 7 tFUS rats repeated                               none  0
    per_seizure  ratio     13 rats ordinary                               none  0
    per_seizure  ratio     13 rats repeated                               none  0
    per_seizure  ratio 7 tFUS rats ordinary                               none  0
    per_seizure  ratio 7 tFUS rats repeated                               none  0
         concat   diff     13 rats ordinary                              theta  1
         concat   diff     13 rats repeated                              theta  1
         concat   diff 7 tFUS rats ordinary                              theta  1
         concat   diff 7 tFUS rats repeated                              theta  1
         concat  ratio     13 rats ordinary                               none  0
         concat  ratio     13 rats repeated                               none  0
         concat  ratio 7 tFUS rats ordinary                               none  0
         concat  ratio 7 tFUS rats repeated                               none  0

Result: partially reproduced, resting on an assumption. With the pre-4-AP state taken from the gaps between pulses of the PLV recording (13 rats), the seizure PLI of the baseline block is 2 to 5 times the pre-4-AP PLI in both regions (concatenated reading: S1 0.10 to 0.24 against 0.03 to 0.08). The S1 change is larger than the non-S1 change in every band (difference reading, S1 minus non-S1 0.006 to 0.087), but significantly so only in theta under every ANOVA and rat reading over concatenated samples (13 rats p = 0.0067 ordinary, 0.0004 repeated; 7 tFUS rats 0.024 and 0.026), and in theta and gamma per seizure under the repeated reading (p = 0.0017 and 0.044). Alpha and beta never reach significance, and the ratio reading finds nothing. One or two of four bands is the criterion's partial outcome. Unlike Fig. S7B, where seizure non-S1 is below zero, both changes here are positive. The per-gap pre-4-AP PLI (0.09 to 0.31) is 1.7 to 4 times the concatenated one, the short-window bias, so it is not used.

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
fig4-no-theta-alpha-gamma-power-change not reproduced (assumed)
fig4c-beta-decrease partially reproduced
figs4-sham-power-no-change not reproduced (assumed)
fig4ef-ai-increase partially reproduced (assumed)
figs5-seizures-lower-ai reproduced (assumed)
fig6-epileptic-pli-s1-decrease not reproduced
figs7-seizure-pli-s1-vs-non-s1 partially reproduced (assumed)

The outcomes of the other fifteen claims are in seizure_metrics.ipynb and wild_type.ipynb.

How the analysis differs from the paper's. No ICA is applied: which components the authors removed is not recorded. The EEG is re-referenced to the common average and notched at 60 Hz, as in Methods C. The labelling channels 8 and 25 are read from the drawing of Fig. S1 and the S1 channels from the notes of the dandiset's PLV files; the paper's text lists neither. The segment analysed, the total of the band ratio and the normalization of AI and PLI are not fixed by the paper and are run under each reading. AI is computed on the band power, as Methods E and the Fig. 4 legend say, with AI on the band ratios shown as a second reading; the two disagree for figs5-seizures-lower-ai and fig4ef-ai-increase, which rest on this choice. The repeated-measures ANOVA reading, a mixed model with t and F tests on Satterthwaite degrees of freedom, is adopted where the ANOVA readings disagree on a claim of absence, as in seizure_metrics.ipynb. The pre-4-AP state of Figs. S5 and S7 is taken from the gaps between the 20 ms pulses of each rat's last recording before the first injection, which 13 of the 16 rats have; the paper's own pre-4-AP baseline may have been a recording without pulses. During the condition block of the tFUS rats the EEG carries the pulse responses at 1 Hz; the paper does not say whether they were removed, and they are not.

What was found about the dataset. The seizure labels share the EEG's clock and are in minutes: 30 to 80 Hz power inside them is 2.5 to 50 times that outside, and the contrast is gone when they are shifted by a minute or read as seconds. The EEG before the first 4-AP injection is there for 13 of the 16 rats, as the PLV recordings, which end 64 to 176 min before the baseline block; they are not described as pre-4-AP recordings and carry tFUS pulses. The baseline AI on the band power is strongly negative in both groups (mean contralateral band power about 1.7 (tFUS) to 4 (sham) times the ipsilateral), and negative before 4-AP too (-0.17 to -0.26), while the AI on band ratios is near 0, so the asymmetry is in the total power of the two channels; the paper reports only AI normalized to the baseline.

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