Human iEEG coding dimension, timescale and coupling: Kauvar, Richman, Liu et al. (2025), dandiset 001347¶
Paper. Kauvar IV, Richman EB, Liu TX, et al. (2025). Conserved brain-wide emergence of emotional response from sensory experience in humans and mice. Science 388, eadt3971. doi:10.1126/science.adt3971. The claims file was written from the version of record (29 May 2025) with Materials and Methods, figure legends and the supplement, including Table S3.
Dandiset. DANDI:001347, version
0.250528.0702, the only published version. The paper cites the dandiset without a version, so the
latest published version is pinned (see dandi_io.py). The mouse Neuropixels data used for
figs37a are in DANDI:001326, version
0.250528.1957, its only published version.
What this notebook reads. For the 7 included iEEG participants (SD168, SD172, SD181, SD185,
SD186, SD211, SD245), the per-session files sub-SD*/sub-SD*_ses-puff<Session>_ecephys.nwb
(LFP at 200 Hz, 20 min around the eyepuff assay, an electrode table with region labels, and 20 DC
channels, one of which carries the puff TTL) and the behaviour files
sub-SD*/sub-SD*_ses-puff_behavior.nwb (trials used, puff frames of the video, per-trial eye
closure). For figs37a, the 13 Neuropixels sessions of DANDI:001326, processed with the entry's
mouse_npx.py.
Outside input. The paper's code record
Zenodo 10.5281/zenodo.14920570
(kauvar-richman-liu-2025_zenodo.zip, md5 bd1fb567121aaf0291337783df57bcfc, git commit b873ca5)
is fetched at run time and its md5 checked. Two things are read from it: the list of bad channels
per participant (ketman/analyze/utils.py, bad_ch; the dataset does not mark bad channels), a
method detail shown as one reading against the dataset-only channel set; and the Yeo7 network label
of each bipolar channel (anat/pts_ch_labels.pkl), which the dataset lacks and which figs35 needs
(data: with_labels, tested by the link claim ieeg-channel-atlas-link). The analysis follows the
code (human_ieeg/scripts/analyze_airpuff_ieeg_cd.py, ketman/analyze/trace_utils.py,
cd_utils.py, for_reference/analyze_airpuff_ieeg_top_cd_network.py), reimplemented in
ieeg_cd.py, whose docstring says where each parameter comes from.
Random numbers: the random-time null of the clock check uses seed 0 per participant, the Yeo7 shuffle uses seed 1.
| Claim | Data | Status |
|---|---|---|
| fig6c-human-persistent-activity-reduced | dataset | tested |
| fig6e-human-fast-activity-unchanged | dataset | tested |
| figs37c-persistent-reduction-across-bands | dataset | tested |
| figs37b-fast-unchanged-across-bands | dataset | tested |
| fig6g-human-timescale-shorter | dataset | tested |
| fig6i-human-coupling-reduced | dataset | tested |
| figs38a-baseline-coupling-not-different | dataset | tested |
| figs38b-ketamine-coupling-loss-larger-at-persistent-sites | dataset | tested |
| figs38h-prepuff-coupling-predicts-persistence | dataset | tested |
| ieeg-channel-atlas-link (link) | with labels | tested |
| figs35-persistent-dimension-distributed | with labels | tested |
| figs37a-beta-most-similar-to-mouse | with inputs | tested |
import os, time, warnings
os.environ.setdefault("OMP_NUM_THREADS", "1")
import numpy as np
import pandas as pd
import scipy.stats as st
import yaml
import matplotlib.pyplot as plt
from statsmodels.stats.multitest import multipletests
import dandi_io
import ieeg_cd as ic
pd.set_option("display.width", 200)
pd.set_option("display.max_columns", 30)
pd.set_option("display.max_rows", 200)
warnings.filterwarnings("ignore", category=RuntimeWarning)
T0 = time.time()
with open("../../claims/001347/10.1126-science.adt3971.yaml") as f:
CLAIMS = {c["id"]: c for c in yaml.safe_load(f)["claims"]}
def expected(cid):
# Expected values of a claim, read from the claims file for comparison only.
return [(e["quantity"], e["value"], e.get("tolerance")) for e in CLAIMS[cid].get("expected", [])]
ZF = ic.fetch_code_zip()
BAD = ic.code_bad_channels(ZF)
LABELS = ic.code_channel_labels(ZF)
print("code record fetched, md5 checked; bad-channel lists for",
sum(pt in BAD for pt in ic.PARTICIPANTS), "of 7 participants")
code record fetched, md5 checked; bad-channel lists for 7 of 7 participants
Data check¶
Every participant's sessions are listed from the archive, and one file's electrode table is shown in full. The processing cell then streams the 22 LFP files used (three per participant, plus SD245's Preinfusion file, which the code does not use for the coding dimension; see below) and reduces each to what the claims need. It runs the participants in four parallel processes and takes about 8 to 12 minutes (466 s and 690 s in two runs).
assets = dandi_io.list_assets()
rows = []
for pt in ic.PARTICIPANTS:
ses = sorted(p.split("_ses-puff")[1].split("_")[0] for p in assets
if p.startswith(f"sub-{pt}/") and p.endswith("_ecephys.nwb"))
beh_file = f"sub-{pt}/sub-{pt}_ses-puff_behavior.nwb" in assets
rows.append(dict(participant=pt, ecephys_sessions=", ".join(ses), behaviour_file=beh_file,
preinfusion_file_code=ic.PRE_SESSION_CODE[pt]))
print(pd.DataFrame(rows).to_string(index=False))
f = dandi_io.open_h5("sub-SD181/sub-SD181_ses-puffPreinfusion_ecephys.nwb")
e = f["general/extracellular_ephys/electrodes"]
print("\nelectrode table columns:", list(e.attrs["colnames"]))
for col in e.attrs["colnames"]:
if col == "group":
continue
v = e[col][:]
print(f" {col}: {len(v)} rows, first values {v[:3]}" +
(f", NaN fraction {np.isnan(v).mean():.2f}" if v.dtype.kind == "f" else ""))
ts = f["processing/ecephys/LFP/v_trace"]
print("LFP:", ts["data"].shape, "unit attribute:", ts["data"].attrs["unit"],
"| comments:", ts.attrs["comments"], "| rate:", ts["starting_time"].attrs["rate"])
print("DC channels:", [x.decode() for x in f["acquisition/dc_channels/channel_name"][:]])
participant ecephys_sessions behaviour_file preinfusion_file_code
SD168 Baseline, Infusion, Postinfusion True Baseline
SD172 Baseline, Infusion, Postinfusion True Baseline
SD181 Control, Infusion, Postinfusion, Preinfusion True Preinfusion
SD185 Baseline, Control, Infusion, Postinfusion, Preinfusion True Preinfusion
SD186 Control, Infusion, Postinfusion, Preinfusion True Preinfusion
SD211 Baseline, Control, Infusion, Postinfusion, Postinfusionfast, Preinfusion True Preinfusion
SD245 Baseline, Control, Infusion, Postinfusion, Preinfusion True Baseline
electrode table columns: ['location', 'group', 'group_name', 'label', 'x', 'y', 'z', 'imp', 'filtering'] location: 122 rows, first values [b'ACC' b'ACC' b'ACC'] group_name: 122 rows, first values [b'RaCN' b'RaCN' b'RaCN'] label: 122 rows, first values [b'RaCN1' b'RaCN2' b'RaCN3'] x: 122 rows, first values [nan nan nan], NaN fraction 1.00 y: 122 rows, first values [nan nan nan], NaN fraction 1.00 z: 122 rows, first values [nan nan nan], NaN fraction 1.00 imp: 122 rows, first values [nan nan nan], NaN fraction 1.00 filtering: 122 rows, first values [b'unknown' b'unknown' b'unknown'] LFP: (240000, 122) unit attribute: volts | comments: scale_to_microvolts=0.390625 | rate: 200.0 DC channels: ['DC01', 'DC02', 'CCEP', 'DC04', 'DC05', 'DC06', 'DC07', 'DC08', 'DC09', 'DC10', 'DC11', 'DC12', 'DC13', 'DC14', 'DC15', 'DC16', 'SpO2', 'Pulse', 'CO2Wave', 'EtCO2']
t = time.time()
RES, ALT, BEH = ic.run_all(BAD, max_workers=4)
EX = ic.extra_session(RES["SD245"], "Preinfusion")
print(f"processed in {time.time() - t:.0f} s")
processed in 589 s
rows = []
for pt in ic.PARTICIPANTS:
r, b = RES[pt], BEH[pt]
wt = b["which_trials"]
for c in ic.CONDITIONS:
s = r["sessions"][c]
bkey = ic.BEHAVIOUR_PRE[r["pre_ses"]] if c == "preinfusion" else c
vid = b["events"][bkey]
n = min(len(vid), len(s["puffs"]))
d = np.diff(s["puffs"][:n]) - np.diff(vid[:n])
rows.append(dict(pt=pt, cond=c, file=s["file_session"], mono=s["n_mono"], bipolar=s["n_pairs"],
ttl_puffs=len(s["puffs"]), first_puff_sample=s["puffs"][0],
video_puffs=len(vid), max_interval_diff_samples=int(np.abs(d).max()),
trials_used=len(wt), max_trial_index=int(wt.max()),
raw_p1=round(s["raw_range"][0]), raw_p99=round(s["raw_range"][1]),
dc2_name=s["dc_name"]))
chk = pd.DataFrame(rows)
print(chk.to_string(index=False))
print("\ntrials used per participant:", {pt: len(BEH[pt]["which_trials"]) for pt in ic.PARTICIPANTS},
"total", sum(len(BEH[pt]["which_trials"]) for pt in ic.PARTICIPANTS))
rows = []
for pt in ic.PARTICIPANTS:
pr, m = RES[pt]["pairs"], RES[pt]["masks"]
labels = set(pr["a"]) | set(pr["b"])
rows.append(dict(pt=pt, bipolar_pairs=len(pr), out_of_brain_or_excluded=int(pr["excluded"].sum()),
white_matter=int(pr["wm"].sum()),
kept_wm_excl=int(m[(True, "none")].sum()), kept_wm_excl_codebad=int(m[(True, "code")].sum()),
kept_all=int(m[(False, "none")].sum()), kept_all_codebad=int(m[(False, "code")].sum()),
code_bad_listed=len(BAD[pt]), code_bad_found_in_labels=sum(x in labels for x in BAD[pt])))
print(pd.DataFrame(rows).to_string(index=False))
pt cond file mono bipolar ttl_puffs first_puff_sample video_puffs max_interval_diff_samples trials_used max_trial_index raw_p1 raw_p99 dc2_name
SD168 preinfusion Baseline 168 154 40 120001 40 2 24 39 -1794 2201 DC03
SD168 infusion Infusion 168 154 40 120001 40 1 24 39 -1699 2033 DC03
SD168 postinfusion Postinfusion 168 154 40 120001 40 1 24 39 -1677 2042 DC03
SD172 preinfusion Baseline 174 162 40 120001 40 2 39 39 -2101 2525 DC03
SD172 infusion Infusion 174 162 40 120001 40 38 39 39 -1960 2225 DC03
SD172 postinfusion Postinfusion 174 162 40 120001 40 1 39 39 -3371 3480 DC03
SD181 preinfusion Preinfusion 122 113 40 120001 40 2 30 31 -316 323 CCEP
SD181 infusion Infusion 122 113 40 120001 40 1 30 31 -388 372 CCEP
SD181 postinfusion Postinfusion 122 113 40 120002 40 2 30 31 -277 323 CCEP
SD185 preinfusion Preinfusion 116 106 40 120002 40 3 31 31 -645 585 CCEP
SD185 infusion Infusion 116 106 32 120001 32 3 31 31 -741 539 CCEP
SD185 postinfusion Postinfusion 116 106 40 120001 40 3 31 31 -682 436 CCEP
SD186 preinfusion Preinfusion 88 81 40 120003 40 1 12 13 -335 411 CCEP
SD186 infusion Infusion 88 81 32 120011 32 1 12 13 -354 374 CCEP
SD186 postinfusion Postinfusion 88 81 32 120012 32 1 12 13 -382 381 CCEP
SD211 preinfusion Preinfusion 112 105 40 120002 40 1 39 39 -388 415 CCEP
SD211 infusion Infusion 112 105 40 120001 40 2 39 39 -494 400 CCEP
SD211 postinfusion Postinfusion 112 105 40 120002 40 2 39 39 -361 433 CCEP
SD245 preinfusion Baseline 206 190 40 120001 40 1 39 39 -585 687 DC03
SD245 infusion Infusion 206 190 40 120002 40 1 39 39 -556 572 DC03
SD245 postinfusion Postinfusion 206 190 40 120002 40 1 39 39 -507 628 DC03
trials used per participant: {'SD168': 24, 'SD172': 39, 'SD181': 30, 'SD185': 31, 'SD186': 12, 'SD211': 39, 'SD245': 39} total 214
pt bipolar_pairs out_of_brain_or_excluded white_matter kept_wm_excl kept_wm_excl_codebad kept_all kept_all_codebad code_bad_listed code_bad_found_in_labels
SD168 154 6 56 92 89 148 144 11 10
SD172 162 16 28 118 108 146 135 27 26
SD181 113 7 28 78 74 106 102 11 11
SD185 106 20 26 62 59 86 83 21 21
SD186 81 9 13 59 58 72 71 10 10
SD211 105 8 15 82 67 97 82 23 23
SD245 190 20 45 126 115 170 153 33 29
# Clock check: the puff-locked change (mean over the response window minus the 0.5 s before the
# puff, averaged over trials, absolute value averaged over channels) of the broadband LFP
# (0.05 to 0.5 s) and of beta power (0.05 to 1.5 s), at the TTL puff times, at 20 sets of 40
# random times in the 10 min before the assay, and at the TTL times shifted by -2.5 s and +2.5 s.
rows = []
for pt in ic.PARTICIPANTS:
for band in ("broadband", "beta"):
c = RES[pt]["clock"][band]
rows.append(dict(pt=pt, signal=band, true=c["true"], random_mean=c["null"].mean(), random_max=c["null"].max(),
shift_minus2p5=c["shift"][0], shift_plus2p5=c["shift"][1],
true_over_random_max=c["true"] / c["null"].max()))
clock = pd.DataFrame(rows)
print(clock.round(3).to_string(index=False))
for band in ("broadband", "beta"):
g = clock[clock.signal == band]
print(f"{band}: true value above every random set in {int((g.true > g.random_max).sum())} of 7 participants, "
f"above both shifted sets in {int(((g.true > g.shift_minus2p5) & (g.true > g.shift_plus2p5)).sum())} of 7")
pt signal true random_mean random_max shift_minus2p5 shift_plus2p5 true_over_random_max SD168 broadband 0.229 0.093 0.121 0.112 0.080 1.890 SD168 beta 0.108 0.073 0.112 0.093 0.067 0.962 SD172 broadband 0.254 0.059 0.078 0.067 0.055 3.277 SD172 beta 0.080 0.060 0.079 0.061 0.054 1.020 SD181 broadband 0.190 0.055 0.065 0.067 0.053 2.910 SD181 beta 0.218 0.071 0.089 0.100 0.087 2.438 SD185 broadband 0.163 0.061 0.088 0.054 0.036 1.846 SD185 beta 0.146 0.072 0.094 0.083 0.066 1.557 SD186 broadband 0.431 0.104 0.137 0.125 0.105 3.136 SD186 beta 0.213 0.091 0.118 0.072 0.086 1.797 SD211 broadband 0.189 0.057 0.078 0.105 0.094 2.440 SD211 beta 0.090 0.053 0.079 0.049 0.068 1.145 SD245 broadband 0.148 0.044 0.050 0.035 0.039 2.983 SD245 beta 0.077 0.070 0.079 0.068 0.070 0.977 broadband: true value above every random set in 7 of 7 participants, above both shifted sets in 7 of 7 beta: true value above every random set in 5 of 7 participants, above both shifted sets in 7 of 7
Checks of the metadata against the data:
- Session files. SD168 and SD172 have no Preinfusion file; their pre-infusion eyepuff session is
the Baseline file, recorded the day before (
ketman/DATASETS.py). The code takes the Baseline file as "preinfusion" for these two. For SD245 the code lists both Baseline and Preinfusion and renames 'baseline' to 'preinfusion' after loading, which replaces the Preinfusion data by the Baseline data in the coding-dimension path (load_and_organize_raw_traces,load_patients_erp), while the timescale path (load_raw_traces_and_merge_to_anat) keeps the Preinfusion file. SD245's behaviour file holds only 'baseline' eye-closure events. Both SD245 files are run here as readings. - Puff times. The TTL is on DC channel index 2, named 'DC03' in three participants' files and 'CCEP' in the other four, so the channel name does not identify it; the code reads index 2. 40 onsets are found in every preinfusion session (32 in some infusion and postinfusion sessions), with the first at sample 120001 to 120012, the middle of the 20-min epoch, as the epoch description ("10 min pre and post puff start") says. Their intervals match the puff frames of the 200-Hz video within 3 samples, except the first interval of SD172's infusion session (38 samples; its first trial is not used). The puff-locked broadband response at the TTL times is larger than at every random set of times and at the shifted times in every participant (counts above). The puff times are consistent with sharing the LFP clock.
- Trials. The trials used (
which_trialsof the behaviour files) total 214 across participants, the number Table S3 gives for fig. S38H. - Units. The LFP's unit attribute is 'volts', but the values are of order 100 to 1000 and the series comment and device description give a 'scale_to_microvolts' factor (0.39 or 0.098), so the stored values are digitiser units. All analyses here are z-scored, so the scale does not matter. The x, y, z columns of the electrode table are all NaN.
- Channels. The dataset gives a region label per contact, including 'WM', 'OUT OF BRAIN', 'EXCLUDE' and 'EXCLUDE AREA', but no bad-channel flag and no Yeo7 network label.
fig6c-human-persistent-activity-reduced¶
In humans, eyepuff-evoked activity along the persistent (beta band power) dimension falls during ketamine (1.36 to 0.41) and partly recovers after infusion (0.72).
Criterion: H-CD with the persistent window, beta band; reproduced when, under a combination of readings of Open C and Open D, both corrected p < 0.05 in the stated direction and the three means are within tolerance. The table shows every combination of Open C (Methods or code z-scoring), Open D (white matter excluded or kept), the bad-channel list (none, or the code's), the code's per-trial baseline subtraction (with or without) and SD245's preinfusion file (Baseline as in the code, or Preinfusion).
print("expected:", expected("fig6c-human-persistent-activity-reduced"))
T6C = ic.readings_table(RES, ALT, "beta", "persistent")
lo = [v - t for _, v, t in expected("fig6c-human-persistent-activity-reduced")]
hi = [v + t for _, v, t in expected("fig6c-human-persistent-activity-reduced")]
T6C["means_in_tol"] = [(lo[0] <= a <= hi[0]) and (lo[1] <= b <= hi[1]) and (lo[2] <= c <= hi[2])
for a, b, c in zip(T6C.pre, T6C.ket, T6C.post)]
T6C["tests_hold"] = ((T6C.pcorr_pre_ket < 0.05) & (T6C.t_pre_ket > 0) &
(T6C.pcorr_post_ket < 0.05) & (T6C.t_post_ket > 0))
cols = ["open_c", "wm_excluded", "bad_list", "trial_baseline", "sd245_pre", "pre", "ket", "post",
"t_pre_ket", "pcorr_pre_ket", "t_post_ket", "pcorr_post_ket", "tests_hold", "means_in_tol"]
print(T6C[cols].round(3).to_string())
print("\nreadings with tests holding:", int(T6C.tests_hold.sum()), "of", len(T6C),
"| tests and means:", int((T6C.tests_hold & T6C.means_in_tol).sum()))
for key, g in T6C.groupby(["open_c", "bad_list"]):
print(key, "tests hold", int(g.tests_hold.sum()), "of", len(g), "| tests and means", int((g.tests_hold & g.means_in_tol).sum()))
expected: [('persistent projection 0.5 to 1.5 s preinfusion', 1.36, 0.16), ('persistent projection 0.5 to 1.5 s ketamine', 0.41, 0.07), ('persistent projection 0.5 to 1.5 s postinfusion', 0.72, 0.11)]
open_c wm_excluded bad_list trial_baseline sd245_pre pre ket post t_pre_ket pcorr_pre_ket t_post_ket pcorr_post_ket tests_hold means_in_tol
0 methods True none True code 1.616 0.464 0.732 7.799 0.000 2.579 0.042 True False
1 methods True none True alt 1.643 0.453 0.676 8.207 0.000 1.794 0.123 False False
2 methods True none False code 1.617 0.455 0.718 7.806 0.000 2.291 0.062 False False
3 methods True none False alt 1.632 0.440 0.663 8.011 0.000 1.683 0.143 False False
4 methods True code True code 1.628 0.405 0.706 8.127 0.000 2.814 0.031 True False
5 methods True code True alt 1.661 0.405 0.658 8.450 0.000 1.974 0.096 False False
6 methods True code False code 1.629 0.393 0.700 7.739 0.000 2.559 0.043 True False
7 methods True code False alt 1.650 0.388 0.647 7.904 0.000 1.855 0.113 False False
8 methods False none True code 1.634 0.443 0.807 7.821 0.000 3.249 0.017 True False
9 methods False none True alt 1.649 0.426 0.725 7.548 0.001 2.758 0.033 True False
10 methods False none False code 1.641 0.437 0.795 7.655 0.001 2.992 0.024 True False
11 methods False none False alt 1.647 0.419 0.713 7.416 0.001 2.514 0.046 True False
12 methods False code True code 1.640 0.407 0.787 8.382 0.000 3.268 0.017 True False
13 methods False code True alt 1.660 0.403 0.712 8.139 0.000 2.772 0.032 True False
14 methods False code False code 1.647 0.401 0.782 8.042 0.000 3.049 0.023 True False
15 methods False code False alt 1.657 0.395 0.701 7.866 0.000 2.533 0.045 True False
16 code True none True code 1.371 0.482 0.754 5.416 0.003 2.885 0.028 True False
17 code True none True alt 1.424 0.447 0.701 5.819 0.002 2.649 0.038 True True
18 code True none False code 1.364 0.478 0.747 5.525 0.003 2.789 0.032 True True
19 code True none False alt 1.415 0.433 0.690 5.901 0.002 2.625 0.039 True True
20 code True code True code 1.363 0.411 0.724 5.876 0.002 3.172 0.019 True True
21 code True code True alt 1.426 0.386 0.679 6.251 0.002 2.907 0.027 True True
22 code True code False code 1.358 0.405 0.721 5.873 0.002 3.075 0.022 True True
23 code True code False alt 1.416 0.369 0.669 6.233 0.002 2.870 0.028 True True
24 code False none True code 1.391 0.472 0.828 5.726 0.002 2.858 0.029 True True
25 code False none True alt 1.441 0.433 0.767 5.526 0.003 2.827 0.030 True True
26 code False none False code 1.387 0.471 0.826 5.795 0.002 2.785 0.032 True True
27 code False none False alt 1.438 0.426 0.760 5.529 0.003 2.751 0.033 True True
28 code False code True code 1.391 0.424 0.802 6.106 0.002 2.984 0.025 True True
29 code False code True alt 1.447 0.390 0.749 5.890 0.002 2.937 0.026 True True
30 code False code False code 1.389 0.424 0.803 6.079 0.002 2.912 0.027 True True
31 code False code False alt 1.443 0.383 0.743 5.831 0.002 2.859 0.029 True True
readings with tests holding: 27 of 32 | tests and means: 15
('code', 'code') tests hold 8 of 8 | tests and means 8
('code', 'none') tests hold 8 of 8 | tests and means 7
('methods', 'code') tests hold 6 of 8 | tests and means 0
('methods', 'none') tests hold 5 of 8 | tests and means 0
# Per participant, the code's readings (Open C code, white matter excluded, code bad list,
# per-trial baseline, SD245 Baseline file), and with the dataset-only channel set.
for bad in ("code", "none"):
v = ic.cd_summary(RES, ALT, "beta", "persistent", True, bad, True, "code")
df = pd.DataFrame(v, index=ic.PARTICIPANTS)
print(f"bad list = {bad}"); print(df.round(3).to_string())
print("ketamine below preinfusion in", int((df.infusion < df.preinfusion).sum()), "of 7;",
"postinfusion above ketamine in", int((df.postinfusion > df.infusion).sum()), "of 7")
tr = {c: ic.cd_summary(RES, ALT, "beta", "persistent", True, "code", True, "code", traces=True)[c] for c in ic.CONDITIONS}
fig, ax = plt.subplots(figsize=(4, 2.6))
for c, col in zip(ic.CONDITIONS, ["k", "m", "c"]):
m, s = tr[c].mean(0), st.sem(tr[c], axis=0)
ax.plot(ic.TT - 0.05, m, col, label=c); ax.fill_between(ic.TT - 0.05, m - s, m + s, color=col, alpha=0.2)
ax.set_xlim(-1, 2); ax.set_xlabel("time from puff (s, code axis)"); ax.set_ylabel("projection (z)"); ax.legend(fontsize=7)
print("plotted range of the mean traces:", round(min(tr[c].mean(0).min() for c in tr), 2), "to", round(max(tr[c].mean(0).max() for c in tr), 2))
plt.show()
bad list = code
preinfusion infusion postinfusion
SD168 1.044 0.135 0.527
SD172 1.837 0.201 0.789
SD181 1.979 0.540 0.990
SD185 1.380 0.543 0.860
SD186 0.850 0.397 0.160
SD211 1.098 0.443 0.831
SD245 1.355 0.619 0.912
ketamine below preinfusion in 7 of 7; postinfusion above ketamine in 6 of 7
bad list = none
preinfusion infusion postinfusion
SD168 1.071 0.136 0.535
SD172 1.827 0.237 0.802
SD181 1.957 0.593 0.893
SD185 1.507 0.830 1.069
SD186 0.850 0.396 0.160
SD211 0.975 0.442 0.810
SD245 1.408 0.742 1.009
ketamine below preinfusion in 7 of 7; postinfusion above ketamine in 6 of 7
plotted range of the mean traces: -1.1 to 2.02
Result: reproduced under the code's z-scoring (Open C reading b), the paper's numbers recovered. With the code's readings (white matter excluded, the code's bad-channel list, SD245 Baseline file) the means are 1.363, 0.411 and 0.724, with t = 5.876 (corrected p = 0.002) for preinfusion against ketamine and t = 3.172 (corrected p = 0.019) for postinfusion against ketamine; the paper gives 1.36, 0.41, 0.72, t = 5.887 and 3.171. With white matter kept (Open D b) the three means are also within tolerance. Without the code's bad-channel list the tests hold in all 8 Open C (b) readings and the means are within tolerance in 7 of them (with white matter kept, 1.391, 0.472, 0.828; the exception is white matter excluded with the per-trial baseline, ketamine 0.482). Under the Methods z-scoring (Open C a) the preinfusion mean is 1.616 to 1.661 in every reading, outside tolerance; the preinfusion test holds in all 16 of those readings and the postinfusion test in 11. Ketamine is below preinfusion in all 7 participants.
fig6e-human-fast-activity-unchanged¶
In humans, activity along the fast dimension (0.05 to 0.10 s) is not changed by ketamine (4.12, 4.00, 3.86).
Criterion: a claim of absence judged on the paper's test; reproduced when both corrected p >= 0.05.
print("expected:", expected("fig6e-human-fast-activity-unchanged"))
T6E = ic.readings_table(RES, ALT, "beta", "fast")
T6E["both_ns"] = (T6E.pcorr_pre_ket >= 0.05) & (T6E.pcorr_post_ket >= 0.05)
cols = ["open_c", "wm_excluded", "bad_list", "trial_baseline", "sd245_pre", "pre", "ket", "post",
"t_pre_ket", "pcorr_pre_ket", "t_post_ket", "pcorr_post_ket", "both_ns"]
print(T6E[cols].round(3).to_string())
for key, g in T6E.groupby(["open_c", "bad_list"]):
print(key, "both non-significant in", int(g.both_ns.sum()), "of", len(g))
v = ic.cd_summary(RES, ALT, "beta", "fast", True, "code", True, "code")
d = v["preinfusion"] - v["infusion"]
print("\ncode readings, per participant:"); print(pd.DataFrame(v, index=ic.PARTICIPANTS).round(3).to_string())
print(f"pre - ket mean {d.mean():.3f}, Cohen dz {d.mean() / d.std(ddof=1):.2f}, 95% CI of the mean difference "
f"{d.mean() - st.t.ppf(0.975, 6) * st.sem(d):.3f} to {d.mean() + st.t.ppf(0.975, 6) * st.sem(d):.3f}")
# Readings where the absence fails (a corrected p < 0.05), by Open C and bad-channel list
for key, g in T6E.groupby(["open_c", "bad_list"]):
f = g[~g.both_ns]
print(key, "| failing readings:", len(f), "of", len(g),
"| pre vs ket corrected p", round(g.pcorr_pre_ket.min(), 3), "to", round(g.pcorr_pre_ket.max(), 3),
"| post vs ket corrected p", round(g.pcorr_post_ket.min(), 3), "to", round(g.pcorr_post_ket.max(), 3))
f = T6E[~T6E.both_ns]
print("\nfailing readings:"); print(f[cols].round(3).to_string())
expected: [('fast projection preinfusion', 4.12, 0.31), ('fast projection ketamine', 4.0, 0.41), ('fast projection postinfusion', 3.86, 0.38)]
open_c wm_excluded bad_list trial_baseline sd245_pre pre ket post t_pre_ket pcorr_pre_ket t_post_ket pcorr_post_ket both_ns
0 methods True none True code 4.034 3.690 3.960 1.114 0.308 2.147 0.151 True
1 methods True none True alt 4.032 3.707 3.997 1.077 0.323 2.298 0.122 True
2 methods True none False code 4.032 3.706 3.984 1.056 0.332 2.180 0.144 True
3 methods True none False alt 4.026 3.722 4.021 1.011 0.351 2.332 0.117 True
4 methods True code True code 4.182 3.739 4.043 1.748 0.131 3.266 0.034 False
5 methods True code True alt 4.177 3.762 4.076 1.708 0.139 3.394 0.029 False
6 methods True code False code 4.176 3.754 4.068 1.648 0.150 3.275 0.034 False
7 methods True code False alt 4.167 3.775 4.100 1.602 0.160 3.402 0.029 False
8 methods False none True code 4.254 4.041 4.301 0.858 0.424 2.522 0.090 True
9 methods False none True alt 4.232 4.038 4.315 0.806 0.451 2.699 0.071 True
10 methods False none False code 4.252 4.049 4.312 0.810 0.449 2.563 0.085 True
11 methods False none False alt 4.228 4.046 4.326 0.751 0.481 2.733 0.068 True
12 methods False code True code 4.361 4.087 4.383 1.436 0.201 3.167 0.039 False
13 methods False code True alt 4.338 4.089 4.398 1.396 0.212 3.356 0.031 False
14 methods False code False code 4.357 4.093 4.389 1.353 0.225 3.159 0.039 False
15 methods False code False alt 4.332 4.094 4.403 1.305 0.240 3.334 0.031 False
16 code True none True code 4.556 4.145 4.041 1.176 0.475 -0.762 0.475 True
17 code True none True alt 4.599 4.139 4.025 1.437 0.402 -0.828 0.439 True
18 code True none False code 4.546 4.149 4.049 1.145 0.501 -0.716 0.501 True
19 code True none False alt 4.592 4.146 4.036 1.396 0.424 -0.786 0.462 True
20 code True code True code 4.120 4.006 3.866 0.433 0.680 -1.072 0.650 True
21 code True code True alt 4.165 4.001 3.856 0.700 0.510 -1.105 0.510 True
22 code True code False code 4.121 4.018 3.880 0.402 0.701 -1.061 0.659 True
23 code True code False alt 4.168 4.015 3.872 0.671 0.527 -1.101 0.527 True
24 code False none True code 4.227 4.072 3.991 0.477 0.650 -0.519 0.650 True
25 code False none True alt 4.295 4.090 3.979 0.681 0.521 -0.700 0.521 True
26 code False none False code 4.218 4.071 3.989 0.451 0.668 -0.519 0.668 True
27 code False none False alt 4.289 4.093 3.980 0.646 0.542 -0.707 0.542 True
28 code False code True code 3.838 3.967 3.861 -0.503 0.633 -0.723 0.633 True
29 code False code True alt 3.905 3.982 3.855 -0.326 0.755 -0.866 0.755 True
30 code False code False code 3.838 3.971 3.857 -0.527 0.617 -0.787 0.617 True
31 code False code False alt 3.908 3.990 3.854 -0.353 0.737 -0.939 0.737 True
('code', 'code') both non-significant in 8 of 8
('code', 'none') both non-significant in 8 of 8
('methods', 'code') both non-significant in 0 of 8
('methods', 'none') both non-significant in 8 of 8
code readings, per participant:
preinfusion infusion postinfusion
SD168 4.742 3.564 3.313
SD172 4.880 4.590 3.778
SD181 3.460 3.941 3.796
SD185 4.426 4.277 4.552
SD186 4.376 4.451 4.406
SD211 2.533 1.885 2.025
SD245 4.421 5.335 5.188
pre - ket mean 0.114, Cohen dz 0.16, 95% CI of the mean difference -0.529 to 0.756
('code', 'code') | failing readings: 0 of 8 | pre vs ket corrected p 0.51 to 0.755 | post vs ket corrected p 0.51 to 0.755
('code', 'none') | failing readings: 0 of 8 | pre vs ket corrected p 0.402 to 0.668 | post vs ket corrected p 0.439 to 0.668
('methods', 'code') | failing readings: 8 of 8 | pre vs ket corrected p 0.131 to 0.24 | post vs ket corrected p 0.029 to 0.039
('methods', 'none') | failing readings: 0 of 8 | pre vs ket corrected p 0.308 to 0.481 | post vs ket corrected p 0.068 to 0.151
failing readings:
open_c wm_excluded bad_list trial_baseline sd245_pre pre ket post t_pre_ket pcorr_pre_ket t_post_ket pcorr_post_ket both_ns
4 methods True code True code 4.182 3.739 4.043 1.748 0.131 3.266 0.034 False
5 methods True code True alt 4.177 3.762 4.076 1.708 0.139 3.394 0.029 False
6 methods True code False code 4.176 3.754 4.068 1.648 0.150 3.275 0.034 False
7 methods True code False alt 4.167 3.775 4.100 1.602 0.160 3.402 0.029 False
12 methods False code True code 4.361 4.087 4.383 1.436 0.201 3.167 0.039 False
13 methods False code True alt 4.338 4.089 4.398 1.396 0.212 3.356 0.031 False
14 methods False code False code 4.357 4.093 4.389 1.353 0.225 3.159 0.039 False
15 methods False code False alt 4.332 4.094 4.403 1.305 0.240 3.334 0.031 False
Result: reproduced under the code's z-scoring (Open C reading b); under the Methods z-scoring with the code's bad-channel list the absence fails. Under the code's readings the means are 4.120, 4.006 and 3.866 with t = 0.433 (corrected p = 0.680) for preinfusion against ketamine, matching the paper's 4.12, 4.00, 3.86 and t = 0.432. In all 16 Open C (b) readings both corrected p are 0.402 or above. Under the Methods z-scoring (Open C a) with the code's bad-channel list, all 8 readings fail: postinfusion against ketamine gives corrected p = 0.029 to 0.039 (postinfusion higher than ketamine), while preinfusion against ketamine gives 0.131 to 0.240. Under Open C (a) without the code's list no corrected p is below 0.05 (smallest 0.068). The code's reading is adopted because it reproduces the paper's values, so the outcome rests on that choice. The preinfusion minus ketamine difference is 0.114 (95% CI -0.529 to 0.756, Cohen dz 0.16).
figs37c-persistent-reduction-across-bands¶
The ketamine reduction of the persistent projection holds in every band except broadband LFP, and recovers significantly after infusion in delta and beta.
Criterion: H-CD with the persistent window in each band, under the readings that reproduce fig6c; reproduced when pre against ketamine is significant in each filtered band (not in broadband) and post against ketamine is significant in delta and beta; partially reproduced when four of the five filtered bands hold. Shown with the per-trial baseline subtraction and SD245 Baseline file (the code's), for each Open C, Open D and bad-channel reading.
print("expected:", expected("figs37c-persistent-reduction-across-bands"))
rows = []
for band in ic.BANDS:
t = ic.readings_table(RES, ALT, band, "persistent", sd245s=("code",), bsubs=(True,))
t.insert(0, "band", band)
rows.append(t)
T37C = pd.concat(rows, ignore_index=True)
cols = ["band", "open_c", "wm_excluded", "bad_list", "pre", "ket", "post", "t_pre_ket", "pcorr_pre_ket",
"t_post_ket", "pcorr_post_ket"]
print(T37C[cols].round(3).to_string())
filtered = ["delta", "theta", "alpha", "low gamma", "high gamma"]
print()
for key, g in T37C.groupby(["open_c", "wm_excluded", "bad_list"]):
g = g.set_index("band")
sig_pre = [b for b in filtered if g.loc[b, "pcorr_pre_ket"] < 0.05 and g.loc[b, "t_pre_ket"] > 0]
print(key, "| pre>ket significant in", len(sig_pre), "of 5 filtered bands", sig_pre,
"| broadband p", round(g.loc["broadband", "pcorr_pre_ket"], 3),
"| post>ket delta p", round(g.loc["delta", "pcorr_post_ket"], 3), "beta p", round(g.loc["beta", "pcorr_post_ket"], 3))
expected: [('delta preinfusion', 0.79, 0.16), ('delta ketamine', 0.18, 0.07), ('theta preinfusion', 0.82, 0.22), ('theta ketamine', 0.11, 0.08), ('alpha preinfusion', 0.97, 0.21), ('alpha ketamine', 0.25, 0.12), ('low gamma preinfusion', 1.32, 0.08), ('low gamma ketamine', 0.49, 0.17), ('high gamma preinfusion', 0.9, 0.11), ('high gamma ketamine', 0.27, 0.13), ('broadband preinfusion', 1.66, 0.05), ('broadband ketamine', 1.37, 0.14)]
band open_c wm_excluded bad_list pre ket post t_pre_ket pcorr_pre_ket t_post_ket pcorr_post_ket
0 delta methods True none 1.032 0.306 0.605 3.729 0.020 2.317 0.060
1 delta methods True code 1.008 0.305 0.599 3.817 0.018 2.323 0.059
2 delta methods False none 0.858 0.366 0.540 4.323 0.010 1.379 0.217
3 delta methods False code 0.843 0.369 0.537 4.487 0.008 1.462 0.194
4 delta code True none 0.817 0.164 0.442 3.618 0.022 2.476 0.048
5 delta code True code 0.793 0.177 0.437 3.929 0.015 2.499 0.047
6 delta code False none 0.674 0.241 0.375 5.442 0.003 1.231 0.265
7 delta code False code 0.659 0.245 0.371 5.684 0.003 1.274 0.250
8 theta methods True none 0.978 0.254 0.414 3.514 0.025 1.309 0.238
9 theta methods True code 0.985 0.237 0.412 3.468 0.027 1.294 0.243
10 theta methods False none 0.953 0.345 0.496 2.465 0.098 0.691 0.515
11 theta methods False code 0.942 0.323 0.482 2.329 0.118 0.679 0.523
12 theta code True none 0.814 0.125 0.356 3.220 0.036 2.009 0.091
13 theta code True code 0.818 0.109 0.349 3.241 0.035 1.930 0.102
14 theta code False none 0.776 0.230 0.404 2.578 0.084 1.123 0.304
15 theta code False code 0.765 0.202 0.387 2.435 0.102 1.039 0.339
16 alpha methods True none 1.231 0.350 0.634 4.266 0.011 1.737 0.133
17 alpha methods True code 1.196 0.351 0.635 4.772 0.006 1.813 0.120
18 alpha methods False none 1.193 0.269 0.641 3.355 0.031 1.755 0.130
19 alpha methods False code 1.172 0.266 0.638 3.474 0.026 1.784 0.125
20 alpha code True none 1.003 0.258 0.476 4.244 0.011 1.713 0.138
21 alpha code True code 0.972 0.249 0.471 4.621 0.007 1.779 0.126
22 alpha code False none 0.980 0.175 0.504 3.183 0.038 1.769 0.127
23 alpha code False code 0.961 0.163 0.500 3.264 0.034 1.815 0.119
24 beta methods True none 1.616 0.464 0.732 7.799 0.000 2.579 0.042
25 beta methods True code 1.628 0.405 0.706 8.127 0.000 2.814 0.031
26 beta methods False none 1.634 0.443 0.807 7.821 0.000 3.249 0.017
27 beta methods False code 1.640 0.407 0.787 8.382 0.000 3.268 0.017
28 beta code True none 1.371 0.482 0.754 5.416 0.003 2.885 0.028
29 beta code True code 1.363 0.411 0.724 5.876 0.002 3.172 0.019
30 beta code False none 1.391 0.472 0.828 5.726 0.002 2.858 0.029
31 beta code False code 1.391 0.424 0.802 6.106 0.002 2.984 0.025
32 low gamma methods True none 1.683 0.686 0.667 6.597 0.001 -0.146 0.889
33 low gamma methods True code 1.677 0.581 0.540 6.501 0.001 -0.294 0.778
34 low gamma methods False none 1.695 0.661 0.610 4.368 0.009 -0.299 0.775
35 low gamma methods False code 1.662 0.630 0.511 5.190 0.004 -0.741 0.486
36 low gamma code True none 1.354 0.641 0.637 7.891 0.000 -0.047 0.964
37 low gamma code True code 1.316 0.490 0.521 6.233 0.002 0.392 0.709
38 low gamma code False none 1.353 0.675 0.601 4.853 0.006 -0.666 0.530
39 low gamma code False code 1.300 0.607 0.510 5.981 0.002 -0.892 0.407
40 high gamma methods True none 1.149 0.293 0.399 4.852 0.006 0.595 0.573
41 high gamma methods True code 1.107 0.308 0.378 4.817 0.006 0.409 0.697
42 high gamma methods False none 1.053 0.304 0.413 4.124 0.012 0.604 0.568
43 high gamma methods False code 1.020 0.313 0.407 3.817 0.018 0.534 0.612
44 high gamma code True none 0.940 0.260 0.394 6.226 0.002 1.186 0.280
45 high gamma code True code 0.898 0.267 0.389 6.863 0.001 1.200 0.275
46 high gamma code False none 0.871 0.282 0.398 5.987 0.002 1.229 0.265
47 high gamma code False code 0.847 0.287 0.398 5.372 0.003 1.286 0.246
48 broadband methods True none 1.802 1.370 1.559 4.002 0.014 1.351 0.225
49 broadband methods True code 1.766 1.317 1.546 3.843 0.017 1.541 0.174
50 broadband methods False none 1.878 1.355 1.618 5.799 0.002 2.261 0.064
51 broadband methods False code 1.852 1.294 1.603 5.615 0.003 2.491 0.047
52 broadband code True none 1.681 1.425 1.495 2.560 0.086 0.531 0.615
53 broadband code True code 1.658 1.367 1.485 2.629 0.078 0.789 0.460
54 broadband code False none 1.734 1.404 1.531 4.585 0.008 1.250 0.258
55 broadband code False code 1.718 1.340 1.519 4.557 0.008 1.535 0.176
('code', np.False_, 'code') | pre>ket significant in 4 of 5 filtered bands ['delta', 'alpha', 'low gamma', 'high gamma'] | broadband p 0.008 | post>ket delta p 0.25 beta p 0.025
('code', np.False_, 'none') | pre>ket significant in 4 of 5 filtered bands ['delta', 'alpha', 'low gamma', 'high gamma'] | broadband p 0.008 | post>ket delta p 0.265 beta p 0.029
('code', np.True_, 'code') | pre>ket significant in 5 of 5 filtered bands ['delta', 'theta', 'alpha', 'low gamma', 'high gamma'] | broadband p 0.078 | post>ket delta p 0.047 beta p 0.019
('code', np.True_, 'none') | pre>ket significant in 5 of 5 filtered bands ['delta', 'theta', 'alpha', 'low gamma', 'high gamma'] | broadband p 0.086 | post>ket delta p 0.048 beta p 0.028
('methods', np.False_, 'code') | pre>ket significant in 4 of 5 filtered bands ['delta', 'alpha', 'low gamma', 'high gamma'] | broadband p 0.003 | post>ket delta p 0.194 beta p 0.017
('methods', np.False_, 'none') | pre>ket significant in 4 of 5 filtered bands ['delta', 'alpha', 'low gamma', 'high gamma'] | broadband p 0.002 | post>ket delta p 0.217 beta p 0.017
('methods', np.True_, 'code') | pre>ket significant in 5 of 5 filtered bands ['delta', 'theta', 'alpha', 'low gamma', 'high gamma'] | broadband p 0.017 | post>ket delta p 0.059 beta p 0.031
('methods', np.True_, 'none') | pre>ket significant in 5 of 5 filtered bands ['delta', 'theta', 'alpha', 'low gamma', 'high gamma'] | broadband p 0.014 | post>ket delta p 0.06 beta p 0.042
Result: reproduced, resting on the white-matter reading (Open D a). Under the code's readings (Open C b, white matter excluded) the reduction from preinfusion to ketamine is significant in all five filtered bands and not in broadband (corrected p = 0.078 with the code's bad-channel list, 0.086 without), and the recovery after infusion is significant in delta (p = 0.047 and 0.048) and beta. The means (delta 0.793 and 0.177, theta 0.818 and 0.109, alpha 0.972 and 0.249, low gamma 1.316 and 0.490, high gamma 0.898 and 0.267, broadband 1.658 and 1.367 with the code's list) match Table S3. With white matter kept (Open D b, which also reproduces fig6c), theta (p = 0.10) and the delta recovery fail, a partial reproduction; under the Methods z-scoring broadband becomes significant.
figs37b-fast-unchanged-across-bands¶
Activity along the fast dimension does not differ across preinfusion, ketamine and postinfusion in any frequency band.
Criterion: a claim of absence judged on the paper's tests; reproduced when no test in any band gives corrected p < 0.05.
rows = []
for band in ic.BANDS:
t = ic.readings_table(RES, ALT, band, "fast", sd245s=("code",), bsubs=(True,))
t.insert(0, "band", band)
rows.append(t)
T37B = pd.concat(rows, ignore_index=True)
print(T37B[cols].round(3).to_string())
print()
for key, g in T37B.groupby(["open_c", "wm_excluded", "bad_list"]):
sig = g[(g.pcorr_pre_ket < 0.05) | (g.pcorr_post_ket < 0.05)]
print(key, "| tests with corrected p < 0.05:", len(sig), list(zip(sig.band, sig.pcorr_pre_ket.round(3), sig.pcorr_post_ket.round(3))))
# The failing tests under the Methods z-scoring (Open C a), by bad-channel list
f = T37B[(T37B.open_c == "methods") & ((T37B.pcorr_pre_ket < 0.05) | (T37B.pcorr_post_ket < 0.05))]
print("\nOpen C (a) tests with corrected p < 0.05:")
print(f[cols].round(3).to_string())
for bad, g in f.groupby("bad_list"):
print(f"bad list {bad}: bands {sorted(set(g.band))}; low gamma pre vs ket corrected p",
round(g[g.band == "low gamma"].pcorr_pre_ket.min(), 3), "to", round(g[g.band == "low gamma"].pcorr_pre_ket.max(), 3),
"| beta post vs ket corrected p", list(g[g.band == "beta"].pcorr_post_ket.round(3)))
band open_c wm_excluded bad_list pre ket post t_pre_ket pcorr_pre_ket t_post_ket pcorr_post_ket
0 delta methods True none 2.355 2.288 2.243 0.860 0.489 -0.737 0.489
1 delta methods True code 2.333 2.280 2.257 0.726 0.718 -0.378 0.718
2 delta methods False none 2.469 2.461 2.436 0.172 0.869 -0.454 0.869
3 delta methods False code 2.466 2.462 2.441 0.094 0.929 -0.375 0.929
4 delta code True none 3.218 3.147 3.118 0.964 0.633 -0.503 0.633
5 delta code True code 3.204 3.151 3.139 0.817 0.859 -0.185 0.859
6 delta code False none 3.333 3.309 3.296 0.702 0.761 -0.318 0.761
7 delta code False code 3.332 3.312 3.300 0.595 0.784 -0.286 0.784
8 theta methods True none 2.737 2.763 2.717 -0.461 0.661 -0.645 0.661
9 theta methods True code 2.724 2.747 2.712 -0.420 0.689 -0.489 0.689
10 theta methods False none 2.899 2.897 2.902 0.061 0.953 0.097 0.953
11 theta methods False code 2.901 2.895 2.907 0.146 0.888 0.215 0.888
12 theta code True none 3.837 3.845 3.864 -0.199 0.849 0.419 0.849
13 theta code True code 3.830 3.842 3.862 -0.274 0.794 0.427 0.794
14 theta code False none 3.883 3.878 3.906 0.137 0.896 0.754 0.896
15 theta code False code 3.878 3.875 3.903 0.079 0.940 0.690 0.940
16 alpha methods True none 3.042 3.126 3.019 -1.120 0.306 -2.101 0.161
17 alpha methods True code 3.043 3.124 3.020 -1.073 0.325 -1.933 0.203
18 alpha methods False none 3.079 3.168 3.086 -1.658 0.148 -2.064 0.148
19 alpha methods False code 3.083 3.169 3.089 -1.638 0.153 -1.839 0.153
20 alpha code True none 3.898 3.927 3.890 -0.737 0.489 -0.743 0.489
21 alpha code True code 3.894 3.926 3.891 -0.847 0.510 -0.701 0.510
22 alpha code False none 3.922 3.948 3.937 -0.469 0.835 -0.218 0.835
23 alpha code False code 3.921 3.948 3.939 -0.496 0.872 -0.168 0.872
24 beta methods True none 4.034 3.690 3.960 1.114 0.308 2.147 0.151
25 beta methods True code 4.182 3.739 4.043 1.748 0.131 3.266 0.034
26 beta methods False none 4.254 4.041 4.301 0.858 0.424 2.522 0.090
27 beta methods False code 4.361 4.087 4.383 1.436 0.201 3.167 0.039
28 beta code True none 4.556 4.145 4.041 1.176 0.475 -0.762 0.475
29 beta code True code 4.120 4.006 3.866 0.433 0.680 -1.072 0.650
30 beta code False none 4.227 4.072 3.991 0.477 0.650 -0.519 0.650
31 beta code False code 3.838 3.967 3.861 -0.503 0.633 -0.723 0.633
32 low gamma methods True none 4.612 3.327 3.569 3.719 0.020 0.561 0.595
33 low gamma methods True code 4.637 3.266 3.682 3.238 0.035 0.876 0.415
34 low gamma methods False none 4.828 3.782 4.146 3.663 0.021 1.011 0.351
35 low gamma methods False code 4.881 3.848 4.288 2.980 0.049 1.015 0.349
36 low gamma code True none 3.431 3.062 3.278 1.163 0.524 0.676 0.524
37 low gamma code True code 3.195 2.887 3.178 1.256 0.271 1.211 0.271
38 low gamma code False none 3.333 2.959 3.342 1.472 0.317 1.092 0.317
39 low gamma code False code 3.110 2.858 3.234 1.460 0.226 1.349 0.226
40 high gamma methods True none 2.295 1.605 2.146 2.150 0.150 1.576 0.166
41 high gamma methods True code 2.304 1.447 2.137 1.718 0.137 1.825 0.137
42 high gamma methods False none 2.276 1.547 1.955 2.437 0.101 1.523 0.179
43 high gamma methods False code 2.282 1.402 1.943 1.884 0.165 1.580 0.165
44 high gamma code True none 3.723 3.979 3.836 -0.842 0.761 -0.318 0.761
45 high gamma code True code 3.637 3.637 3.714 0.002 0.998 0.359 0.998
46 high gamma code False none 3.768 4.099 3.952 -0.993 0.717 -0.380 0.717
47 high gamma code False code 3.675 3.759 3.843 -0.649 0.574 0.594 0.574
48 broadband methods True none 2.605 2.115 2.217 1.534 0.352 0.489 0.642
49 broadband methods True code 2.607 2.114 2.249 1.702 0.279 0.736 0.490
50 broadband methods False none 2.928 2.214 2.551 2.273 0.104 1.915 0.104
51 broadband methods False code 2.899 2.207 2.560 2.366 0.065 2.255 0.065
52 broadband code True none 2.339 1.872 1.963 0.797 0.807 0.256 0.807
53 broadband code True code 2.348 1.881 1.990 0.815 0.767 0.310 0.767
54 broadband code False none 3.333 2.797 2.827 0.915 0.791 0.098 0.925
55 broadband code False code 3.391 2.818 2.889 1.027 0.688 0.255 0.808
('code', np.False_, 'code') | tests with corrected p < 0.05: 0 []
('code', np.False_, 'none') | tests with corrected p < 0.05: 0 []
('code', np.True_, 'code') | tests with corrected p < 0.05: 0 []
('code', np.True_, 'none') | tests with corrected p < 0.05: 0 []
('methods', np.False_, 'code') | tests with corrected p < 0.05: 2 [('beta', 0.201, 0.039), ('low gamma', 0.049, 0.349)]
('methods', np.False_, 'none') | tests with corrected p < 0.05: 1 [('low gamma', 0.021, 0.351)]
('methods', np.True_, 'code') | tests with corrected p < 0.05: 2 [('beta', 0.131, 0.034), ('low gamma', 0.035, 0.415)]
('methods', np.True_, 'none') | tests with corrected p < 0.05: 1 [('low gamma', 0.02, 0.595)]
Open C (a) tests with corrected p < 0.05:
band open_c wm_excluded bad_list pre ket post t_pre_ket pcorr_pre_ket t_post_ket pcorr_post_ket
25 beta methods True code 4.182 3.739 4.043 1.748 0.131 3.266 0.034
27 beta methods False code 4.361 4.087 4.383 1.436 0.201 3.167 0.039
32 low gamma methods True none 4.612 3.327 3.569 3.719 0.020 0.561 0.595
33 low gamma methods True code 4.637 3.266 3.682 3.238 0.035 0.876 0.415
34 low gamma methods False none 4.828 3.782 4.146 3.663 0.021 1.011 0.351
35 low gamma methods False code 4.881 3.848 4.288 2.980 0.049 1.015 0.349
bad list code: bands ['beta', 'low gamma']; low gamma pre vs ket corrected p 0.035 to 0.049 | beta post vs ket corrected p [0.034, 0.039]
bad list none: bands ['low gamma']; low gamma pre vs ket corrected p 0.02 to 0.021 | beta post vs ket corrected p []
Result: reproduced under the code's z-scoring (Open C reading b); under the Methods z-scoring the absence fails. Under Open C (b) no band gives a corrected p below 0.05 in any of the four Open D and bad-channel readings, and the code's readings give delta t = 0.817 (p = 0.859), as Table S3 does. Under the Methods z-scoring (Open C a) the claim fails in all four readings: the low-gamma fast projection is lower during ketamine than before (corrected p = 0.035 with white matter excluded and 0.049 with it kept, with the code's bad-channel list; 0.020 and 0.021 without), and with the code's list beta postinfusion against ketamine also gives p = 0.034 (white matter excluded) and 0.039 (kept). The code's reading is adopted because it reproduces the paper's values (fig6e and the delta row), so the outcome rests on that choice.
fig6g-human-timescale-shorter¶
In humans, the baseline intrinsic timescale of the persistent population is shorter during ketamine (0.09 s) than before (0.11 s).
Criterion: H-TAU with the fig6c weights; reproduced when, under a reading of Open E, the paired t-test gives p < 0.05 with ketamine shorter and both means are within tolerance.
print("expected:", expected("fig6g-human-timescale-shorter"))
rows, per_pt = [], {}
for wm in (True, False):
for bad in ("code", "none"):
for sd in ("Preinfusion", "Baseline"):
for period in ("10min", "8min"):
for lag in (1, 0):
tau = ic.timescales(RES, EX, wm, bad, period, lag, sd)
t, p = st.ttest_rel(tau["preinfusion"], tau["infusion"])
rows.append(dict(wm_excluded=wm, bad_list=bad, sd245_pre=sd, period=period, start_lag=lag,
pre=tau["preinfusion"].mean(), ket=tau["infusion"].mean(), t=t, p=p,
n_shorter=int((tau["infusion"] < tau["preinfusion"]).sum())))
per_pt[(wm, bad, sd, period, lag)] = tau
T6G = pd.DataFrame(rows)
T6G["holds"] = (T6G.p < 0.05) & (T6G.t > 0)
T6G["means_in_tol"] = (T6G.pre.between(0.10, 0.12)) & (T6G.ket.between(0.08, 0.10))
print(T6G.round(4).to_string())
print("\ncode readings (white matter excluded, code bad list, SD245 Preinfusion file, 10 min, lag 1), per participant:")
print(pd.DataFrame(per_pt[(True, "code", "Preinfusion", "10min", 1)], index=ic.PARTICIPANTS).round(3).to_string())
expected: [('timescale preinfusion', 0.11, 0.01), ('timescale ketamine', 0.09, 0.01)]
wm_excluded bad_list sd245_pre period start_lag pre ket t p n_shorter holds means_in_tol
0 True code Preinfusion 10min 1 0.1153 0.0924 4.7843 0.0030 7 True True
1 True code Preinfusion 10min 0 0.1121 0.0904 4.7289 0.0032 7 True True
2 True code Preinfusion 8min 1 0.1201 0.0904 3.2667 0.0171 7 True False
3 True code Preinfusion 8min 0 0.1167 0.0886 3.3079 0.0162 7 True True
4 True code Baseline 10min 1 0.1288 0.0924 2.4781 0.0479 7 True False
5 True code Baseline 10min 0 0.1238 0.0904 2.7147 0.0349 7 True False
6 True code Baseline 8min 1 0.1377 0.0904 2.5689 0.0424 7 True False
7 True code Baseline 8min 0 0.1328 0.0886 2.7028 0.0354 7 True False
8 True none Preinfusion 10min 1 0.1197 0.0916 6.8539 0.0005 7 True True
9 True none Preinfusion 10min 0 0.1150 0.0892 6.4573 0.0007 7 True True
10 True none Preinfusion 8min 1 0.1232 0.0880 5.1360 0.0021 7 True False
11 True none Preinfusion 8min 0 0.1187 0.0862 4.8990 0.0027 7 True True
12 True none Baseline 10min 1 0.1287 0.0916 4.9599 0.0026 7 True False
13 True none Baseline 10min 0 0.1219 0.0892 6.3099 0.0007 7 True False
14 True none Baseline 8min 1 0.1381 0.0880 3.6880 0.0102 7 True False
15 True none Baseline 8min 0 0.1311 0.0862 4.0519 0.0067 7 True False
16 False code Preinfusion 10min 1 0.1210 0.0968 3.8663 0.0083 7 True False
17 False code Preinfusion 10min 0 0.1175 0.0947 4.2720 0.0053 7 True True
18 False code Preinfusion 8min 1 0.1236 0.0995 3.7811 0.0092 7 True False
19 False code Preinfusion 8min 0 0.1199 0.0973 3.8505 0.0085 7 True True
20 False code Baseline 10min 1 0.1362 0.0968 2.1828 0.0718 7 False False
21 False code Baseline 10min 0 0.1316 0.0947 2.3360 0.0582 7 False False
22 False code Baseline 8min 1 0.1415 0.0995 2.1055 0.0799 7 False False
23 False code Baseline 8min 0 0.1370 0.0973 2.1898 0.0711 7 False False
24 False none Preinfusion 10min 1 0.1244 0.0955 6.0317 0.0009 7 True False
25 False none Preinfusion 10min 0 0.1193 0.0929 6.5464 0.0006 7 True True
26 False none Preinfusion 8min 1 0.1256 0.0969 6.8002 0.0005 7 True False
27 False none Preinfusion 8min 0 0.1208 0.0944 6.5111 0.0006 7 True False
28 False none Baseline 10min 1 0.1377 0.0955 3.0542 0.0224 7 True False
29 False none Baseline 10min 0 0.1311 0.0929 3.4031 0.0144 7 True False
30 False none Baseline 8min 1 0.1427 0.0969 2.6114 0.0400 7 True False
31 False none Baseline 8min 0 0.1365 0.0944 2.7182 0.0347 7 True False
code readings (white matter excluded, code bad list, SD245 Preinfusion file, 10 min, lag 1), per participant:
preinfusion infusion
SD168 0.089 0.059
SD172 0.072 0.070
SD181 0.179 0.150
SD185 0.084 0.075
SD186 0.103 0.066
SD211 0.149 0.122
SD245 0.131 0.105
Result: reproduced under the code's 10-min reading of Open E. With the code's readings (10 min, fit from lag one sample, white matter excluded, the code's bad-channel list, SD245's Preinfusion file) the timescale is 0.115 s before and 0.092 s during ketamine, t = 4.78, p = 0.003 (paper 0.11, 0.09, t = 4.74, p = 0.0032), shorter in all 7 participants. The Methods' reading (8 min, fit from lag 0) gives 0.117 s and 0.089 s, p = 0.016, also within tolerance. The test holds (p < 0.05, ketamine shorter in all 7) in 28 of the 32 readings; it fails only with white matter kept, the code's list and SD245's Baseline file. The means are outside tolerance in every reading that uses SD245's Baseline file (preinfusion 0.122 to 0.143 s).
fig6i-human-coupling-reduced¶
In humans, beta phase locking among the most persistent sites at baseline is lower during ketamine than before (0.979 of preinfusion).
Criterion: H-PLV with the persistent sites of the fig6c weights; reproduced when, under a reading of Open F, the paired t-test across the 7 participants gives p < 0.05 with ketamine lower and the ketamine ratio is within tolerance. Open F reading (a), the 25-min windows before and during the infusion, cannot be run: the dataset holds only the 20-min epochs around each eyepuff session. The reading run is (b), the 10 min before the eyepuff assay in each session (Table S3). The Methods say "we used sliding 5-second windows to compute phase locking value" without a stride. The main reading uses non-overlapping windows (stride 5 s; the fig. S38 code describes its PLV input as "5 sec w+s", printed in the fig. S38 section); strides of 2.5 s and 1 s are shown as variants.
print("expected:", expected("fig6i-human-coupling-reduced"))
rows = []
for stride in ic.STRIDES:
for wm in (True, False):
for bad in ("code", "none"):
for sd in ("Baseline", "Preinfusion"):
r = ic.plv_ratio(RES, EX, wm, bad, sd, stride)
t, p = st.ttest_rel(np.ones(7), r["ratio"])
tz, pz = st.ttest_1samp(r["z"], 0)
rows.append(dict(stride_s=stride, wm_excluded=wm, bad_list=bad, sd245_pre=sd,
windows=r["n_windows"][0], ratio_mean=r["ratio"].mean(),
ratio_sem=st.sem(r["ratio"]), t=t, p=p, n_lower=int((r["ratio"] < 1).sum()),
z_change_mean=r["z"].mean(), t_z=tz, p_z=pz, edges=sum(r["n_edges"])))
T6I = pd.DataFrame(rows)
T6I["holds"] = (T6I.p < 0.05) & (T6I.t > 0)
T6I["ratio_in_tol"] = T6I.ratio_mean.between(0.979 - 0.0061, 0.979 + 0.0061)
print(T6I.round(4).to_string())
for stride, g in T6I.groupby("stride_s"):
print(f"stride {stride} s: test holds in {int(g.holds.sum())} of {len(g)}, ratio in tolerance in "
f"{int(g.ratio_in_tol.sum())}, ratio {g.ratio_mean.min():.4f} to {g.ratio_mean.max():.4f}, "
f"p {g.p.min():.4f} to {g.p.max():.4f}")
r = ic.plv_ratio(RES, EX, True, "code", "Baseline")
print("\nper participant (stride 5 s, white matter excluded, code bad list):")
print(pd.DataFrame({"pre_plv": r["pre"], "ket_plv": r["ket"], "ratio": r["ratio"], "z_change": r["z"],
"edges": r["n_edges"]}, index=ic.PARTICIPANTS).round(4).to_string())
expected: [('phase locking during ketamine, divided by preinfusion', 0.979, 0.0061)]
stride_s wm_excluded bad_list sd245_pre windows ratio_mean ratio_sem t p n_lower z_change_mean t_z p_z edges holds ratio_in_tol
0 5.0 True code Baseline 120 0.9600 0.0141 2.8337 0.0298 6 -0.0819 -2.7414 0.0337 184 True False
1 5.0 True code Preinfusion 120 0.9633 0.0141 2.6109 0.0401 6 -0.0750 -2.4899 0.0472 184 True False
2 5.0 True none Baseline 120 0.9255 0.0194 3.8311 0.0086 7 -0.1363 -4.5331 0.0040 231 True False
3 5.0 True none Preinfusion 120 0.9288 0.0202 3.5277 0.0124 7 -0.1295 -4.0803 0.0065 231 True False
4 5.0 False code Baseline 120 0.9514 0.0086 5.6578 0.0013 7 -0.1033 -5.1145 0.0022 396 True False
5 5.0 False code Preinfusion 120 0.9554 0.0088 5.0556 0.0023 7 -0.0955 -4.4723 0.0042 396 True False
6 5.0 False none Baseline 120 0.9425 0.0103 5.5702 0.0014 7 -0.1172 -5.1262 0.0022 448 True False
7 5.0 False none Preinfusion 120 0.9461 0.0111 4.8717 0.0028 7 -0.1103 -4.5169 0.0040 448 True False
8 2.5 True code Baseline 239 0.9597 0.0121 3.3309 0.0158 7 -0.0838 -3.1691 0.0193 184 True False
9 2.5 True code Preinfusion 239 0.9630 0.0122 3.0389 0.0228 7 -0.0769 -2.8521 0.0291 184 True False
10 2.5 True none Baseline 239 0.9282 0.0199 3.6031 0.0113 7 -0.1313 -4.2036 0.0057 231 True False
11 2.5 True none Preinfusion 239 0.9319 0.0207 3.2869 0.0167 7 -0.1239 -3.7538 0.0095 231 True False
12 2.5 False code Baseline 239 0.9510 0.0083 5.8811 0.0011 7 -0.1059 -5.2833 0.0019 396 True False
13 2.5 False code Preinfusion 239 0.9551 0.0087 5.1757 0.0021 7 -0.0981 -4.5670 0.0038 396 True False
14 2.5 False none Baseline 239 0.9430 0.0104 5.4936 0.0015 7 -0.1163 -5.0750 0.0023 448 True False
15 2.5 False none Preinfusion 239 0.9467 0.0111 4.7880 0.0030 7 -0.1092 -4.4504 0.0043 448 True False
16 1.0 True code Baseline 596 0.9593 0.0120 3.3940 0.0146 7 -0.0852 -3.2688 0.0171 184 True False
17 1.0 True code Preinfusion 596 0.9625 0.0121 3.0965 0.0212 7 -0.0786 -2.9443 0.0258 184 True False
18 1.0 True none Baseline 596 0.9277 0.0201 3.5944 0.0114 7 -0.1330 -4.1364 0.0061 231 True False
19 1.0 True none Preinfusion 596 0.9314 0.0209 3.2818 0.0168 7 -0.1258 -3.7039 0.0100 231 True False
20 1.0 False code Baseline 596 0.9512 0.0084 5.8392 0.0011 7 -0.1049 -5.2301 0.0020 396 True False
21 1.0 False code Preinfusion 596 0.9552 0.0086 5.1800 0.0021 7 -0.0973 -4.5521 0.0039 396 True False
22 1.0 False none Baseline 596 0.9434 0.0098 5.7573 0.0012 7 -0.1149 -5.2927 0.0018 448 True False
23 1.0 False none Preinfusion 596 0.9471 0.0106 5.0083 0.0024 7 -0.1077 -4.6241 0.0036 448 True False
stride 1.0 s: test holds in 8 of 8, ratio in tolerance in 0, ratio 0.9277 to 0.9625, p 0.0011 to 0.0212
stride 2.5 s: test holds in 8 of 8, ratio in tolerance in 0, ratio 0.9282 to 0.9630, p 0.0011 to 0.0228
stride 5.0 s: test holds in 8 of 8, ratio in tolerance in 0, ratio 0.9255 to 0.9633, p 0.0013 to 0.0401
per participant (stride 5 s, white matter excluded, code bad list):
pre_plv ket_plv ratio z_change edges
SD168 0.1003 0.0992 0.9898 -0.0198 28
SD172 0.1135 0.1058 0.9324 -0.1220 45
SD181 0.1284 0.1155 0.8992 -0.2262 21
SD185 0.0903 0.0910 1.0086 0.0171 10
SD186 0.0986 0.0944 0.9579 -0.0781 10
SD211 0.1597 0.1570 0.9832 -0.0478 15
SD245 0.0962 0.0913 0.9489 -0.0962 55
Result: partially reproduced. Beta phase locking among the persistent sites is lower during ketamine than before in all 24 readings (paired t-test p = 0.0011 to 0.0401), but the mean ratio, 0.960 with the code's channel readings and non-overlapping windows, is below the paper's 0.979 ± 0.0061 in every reading (0.9255 to 0.9633). Sliding windows do not change this: with strides of 2.5 s and 1 s the ratio is 0.9597 and 0.9593 with the code's channel readings, and 0.9277 to 0.9630 over all their readings, none within tolerance. Open F (a) could not be run, and the exclusion of epileptic or sleep periods is not available.
figs38a-baseline-coupling-not-different and figs38b-ketamine-coupling-loss-larger-at-persistent-sites¶
figs38a: Before infusion, phase locking among high-persistence sites does not differ from that among low-persistence sites in any band.
figs38b: The ketamine decrease in phase locking is larger among high-persistence sites than among low-persistence sites, significantly in the alpha, beta and gamma bands.
Criteria: per band, top and bottom 10% of absolute persistent weight (weights in that band), edges within each set, PLV regressed on high against low edge identity with a mixed-effects model grouped by participant, Benjamini-Hochberg over bands. figs38a uses preinfusion PLV (absence: reproduced when no band gives corrected p < 0.05); figs38b uses the ketamine minus preinfusion change (reproduced when alpha, beta and gamma give corrected p < 0.05 with larger decreases among high edges and the beta coefficient is within -0.038 ± 0.019). The paper's figure gives the change in z units ("Ket - Pre phase locking (z)", code ylabel; Methods z-score each channel's PLV to its preinfusion window), so both the raw change and the change z-scored by the preinfusion window SD are shown. Bonferroni (the code's 'pval_bonf') is shown beside BH.
Readings run (see the ieeg_cd docstring):
- Bands: the Table S3 bands, gamma 30 to 50 Hz ('main'), and the fig. S38 code's bands (1, 4),
(5, 8), (9, 12), (13, 30), (31, 70), (71, 95) ('code',
main(), lines 88 to 89, printed below), with weights, sites and PLV all in those bands. Gamma is 'low gamma' in the first and 'gamma' (31 to 70 Hz) in the second. - Weights that rank the sites: the persistent weights of each band (fig. S38B legend, "for CDs computed using power in each spectral band"), or the beta persistent weights for every band (the code's comment, lines 231 to 232, "version 24-06-07 uses beta CD weights 0.5-1.5 to sort top v bot CD electrodes").
- Sites: int (cd_utils.cd_pctile) or ceil of 10% of the kept channels, or ranked with white matter kept and white-matter sites then removed (the Methods' order of the two steps).
- Channels: white matter excluded (Methods) or kept, the code's bad-channel list or none.
- Windows: stride 5 s (main), 2.5 s and 1 s; and an adjacent-edge filter (pairs of bipolar channels on the same shank with first contact numbers 1 apart; plot_utils to_mask_adj_contacts).
The code reads the high and low edges from a precomputed file (top_v_bot_cd_plv_edges.h5, not in
the code record), so the paper's site selection is checked here only through its edge count, 716.
# The fig. S38 code: band edges, the precomputed edge file and the site selection it describes
src = ZF.read(ic.CODE_ROOT + "human_ieeg/scripts/for_reference/analyze_airpuff_ieeg_top_cd_network.py").decode().splitlines()
for a, b in ((86, 99), (229, 234), (247, 259), (293, 298)):
print("\n".join(f"{i + 1:4d} {src[i]}" for i in range(a - 1, b)), "\n")
cdu = ZF.read(ic.CODE_ROOT + "ketman/analyze/cd_utils.py").decode().splitlines()
print("ketman/analyze/cd_utils.py")
print("\n".join(f"{i + 1:4d} {cdu[i]}" for i in range(176, 182)))
86 # compare PLV between high and low beta CD electrodes across bands
87 # one version focused on beta band, the other on all freq bands
88 for f_to_plot in [[(13, 30)],
89 [(1, 4), (5, 8), (9, 12), (13, 30), (31, 70), (71, 95)]]:
90 for outcome_var in ['sync_change', 'sync_base', 'sync_ket']:
91 plot_top_v_bot_cd_plv(outcome_var=outcome_var,
92 freq_bands_to_plot=f_to_plot,
93 to_plot_fig=True,
94 indep_var='top_cd',
95 grouping_var='pt',
96 pval_to_use='pval_bonf',
97 plot_dir=plot_dir,
98 DROPBOX_DIR=DROPBOX_DIR,
99 )
229
230 # using 5 sec w+s plv data from `all_edges_puff_pts_240521.h5`
231 # version 24-06-07 uses beta CD weights 0.5-1.5 to sort top v bot CD
232 # electrodes
233 cd_edges = pd.read_hdf(os.path.join(plot_dir,
234 f'top_v_bot_cd_plv_edges.h5'))
247 mlm_results = []
248 for f in freq_bands_to_plot:
249 print(f)
250 m_df = cd_edges.loc[cd_edges.band == str(f)].copy()
251
252 lmm_inter = smf.mixedlm(f"{outcome_var} ~ {indep_var}",
253 m_df,
254 groups=m_df[grouping_var],
255 # re_formula=f"{indep_var}", # include
256 # slope+intercept random effects
257 re_formula="~1",
258 # include intercept random effects
259 ).fit()
293
294 r, pval_corr = statsmodels.stats.multitest.fdrcorrection(
295 mlm_results['pval_indep'], method='indep')
296 mlm_results['pval_indep_bh'] = pval_corr
297 mlm_results['pval_bonf'] = mlm_results['pval_indep'] * len(
298 freq_bands_to_plot)
ketman/analyze/cd_utils.py
177 def cd_pctile(cd_df, pt, pctile=10):
178 cd = cd_df[(cd_df.pt == pt)]['cd'].values
179 inds = np.argsort(np.abs(cd))
180 top = inds[-int(pctile / 100.0 * len(cd)):]
181 bot = inds[:int(pctile / 100.0 * len(cd))]
182 return top, bot
# Sites and edges per participant in each channel and selection reading, next to the paper's 716
rows, per_pt = [], []
for drop in (False, True):
for sel in ic.S38_SELECTIONS:
for wm in (True, False):
for bad in ("code", "none"):
if sel == "rank_wm_kept" and not wm:
continue
# set sizes from int and ceil do not depend on band or weights; the other readings do
bands_w = [("main", "beta", "band")] if (sel != "rank_wm_kept" and not drop) else \
[(bs, b, w) for bs, bb in (("main", ic.PLV_BANDS), ("code", ic.CODE_BANDS)) for b in bb for w in ic.S38_WEIGHTS]
tot = []
for bs, b, w in bands_w:
c = ic.s38_counts(RES, wm, bad, sel, drop, bs, b, w)
tot.append(int(c.high_edges.sum() + c.low_edges.sum()))
if (bs, b, w) == ("main", "beta", "band"):
per_pt.append(pd.concat({(sel, wm, bad, drop): c}, names=["sites", "wm_excluded", "bad_list", "drop_adjacent"]))
rows.append(dict(sites=sel, wm_excluded=wm, bad_list=bad, drop_adjacent=drop,
total_edges_min=min(tot), total_edges_max=max(tot), paper=716))
CNT = pd.DataFrame(rows)
print(CNT.to_string(index=False))
print("\nper participant, beta band with its own weights (rank_wm_kept and the adjacent filter depend on band and weights)")
print(pd.concat(per_pt).unstack(level=-1).to_string())
print("\nany reading with 716 edges:", bool(((CNT.total_edges_min <= 716) & (CNT.total_edges_max >= 716)).any()))
# Channel counts alone: total edges 2 * sum k(k - 1) / 2 with k = int, ceil or round of 10 % of the
# channels, over channel sets from the dataset and from the code record's bipolar list
import math
rows = []
for pt in ic.PARTICIPANTS:
pr = RES[pt]["pairs"]
bad = set(BAD.get(pt, []))
isbad = (pr.a.isin(bad) | pr.b.isin(bad)).values
ex, wm = pr.excluded.values, pr.wm.values
names = list(LABELS["pt_elec_names_bipo"][pt]); an = [str(x) for x in LABELS["pt_elec_anats_bipo"][pt]]
cbad = np.array([any(c in bad for c in n.split("-")) for n in names])
cwm = np.array(["WM" in a for a in an]); cex = np.array([("OUT OF BRAIN" in a) or ("EXCLUDE" in a) for a in an])
rows.append({"pt": pt, "dataset all": len(pr), "dataset not excluded": int((~ex).sum()),
"dataset not excluded, no bad": int((~ex & ~isbad).sum()), "dataset no WM": int((~ex & ~wm).sum()),
"dataset no WM, no bad": int((~ex & ~wm & ~isbad).sum()), "dataset all, no WM (excluded kept)": int((~wm).sum()),
"code list all": len(names), "code list no bad": int((~cbad).sum()),
"code list not excluded, no bad": int((~cex & ~cbad).sum()), "code list no WM": int((~cwm & ~cex).sum()),
"code list no WM, no bad": int((~cwm & ~cex & ~cbad).sum())})
NCH = pd.DataFrame(rows).set_index("pt")
print("\nchannels per participant:"); print(NCH.T.to_string())
fk = {"int": lambda n: int(0.1 * n), "ceil": lambda n: math.ceil(0.1 * n), "round": lambda n: round(0.1 * n)}
tot = pd.DataFrame({r: {c: sum(f(n) * (f(n) - 1) for n in NCH[c]) for c in NCH} for r, f in fk.items()})
print("\ntotal edges (high + low) by channel set and rounding:"); print(tot.to_string())
print("channel sets giving 716:", [(c, r) for c in tot.index for r in tot.columns if tot.loc[c, r] == 716],
"| nearest:", int(tot.values.flat[np.abs(tot.values - 716).argmin()]))
sites wm_excluded bad_list drop_adjacent total_edges_min total_edges_max paper
int True code False 368 368 716
int True none False 462 462 716
int False code False 792 792 716
int False none False 896 896 716
ceil True code False 472 472 716
ceil True none False 578 578 716
ceil False code False 942 942 716
ceil False none False 1020 1020 716
rank_wm_kept True code False 350 494 716
rank_wm_kept True none False 423 571 716
int True code True 351 358 716
int True none True 440 450 716
int False code True 762 773 716
int False none True 862 876 716
ceil True code True 450 458 716
ceil True none True 553 564 716
ceil False code True 908 917 716
ceil False none True 983 997 716
rank_wm_kept True code True 339 476 716
rank_wm_kept True none True 410 553 716
per participant, beta band with its own weights (rank_wm_kept and the adjacent filter depend on band and weights)
high_sites high_edges low_sites low_edges
SD168 SD172 SD181 SD185 SD186 SD211 SD245 SD168 SD172 SD181 SD185 SD186 SD211 SD245 SD168 SD172 SD181 SD185 SD186 SD211 SD245 SD168 SD172 SD181 SD185 SD186 SD211 SD245
sites wm_excluded bad_list drop_adjacent
ceil False code False 15 14 11 9 8 9 16 105 91 55 36 28 36 120 15 14 11 9 8 9 16 105 91 55 36 28 36 120
True 15 14 11 9 8 9 16 100 88 54 32 26 34 118 15 14 11 9 8 9 16 103 88 51 34 27 35 118
none False 15 15 11 9 8 10 17 105 105 55 36 28 45 136 15 15 11 9 8 10 17 105 105 55 36 28 45 136
True 15 15 11 9 8 10 17 100 102 54 32 26 42 134 15 15 11 9 8 10 17 103 102 51 34 27 43 134
True code False 9 11 8 6 6 7 12 36 55 28 15 15 21 66 9 11 8 6 6 7 12 36 55 28 15 15 21 66
True 9 11 8 6 6 7 12 35 53 27 15 14 21 66 9 11 8 6 6 7 12 36 52 25 15 15 20 64
none False 10 12 8 7 6 9 13 45 66 28 21 15 36 78 10 12 8 7 6 9 13 45 66 28 21 15 36 78
True 10 12 8 7 6 9 13 44 64 27 19 14 34 78 10 12 8 7 6 9 13 45 63 25 21 14 34 76
int False code False 14 13 10 8 7 8 15 91 78 45 28 21 28 105 14 13 10 8 7 8 15 91 78 45 28 21 28 105
True 14 13 10 8 7 8 15 86 75 44 24 20 26 105 14 13 10 8 7 8 15 89 76 41 26 20 27 103
none False 14 14 10 8 7 9 17 91 91 45 28 21 36 136 14 14 10 8 7 9 17 91 91 45 28 21 36 136
True 14 14 10 8 7 9 17 86 88 44 24 20 34 134 14 14 10 8 7 9 17 89 88 41 26 20 34 134
True code False 8 10 7 5 5 6 11 28 45 21 10 10 15 55 8 10 7 5 5 6 11 28 45 21 10 10 15 55
True 8 10 7 5 5 6 11 27 44 20 10 10 15 55 8 10 7 5 5 6 11 28 43 19 10 10 14 53
none False 9 11 7 6 5 8 12 36 55 21 15 10 28 66 9 11 7 6 5 8 12 36 55 21 15 10 28 66
True 9 11 7 6 5 8 12 35 53 20 13 10 26 66 9 11 7 6 5 8 12 36 53 19 15 10 26 64
rank_wm_kept True code False 8 11 7 4 7 8 12 28 55 21 6 21 28 66 9 9 9 5 4 7 11 36 36 36 10 6 21 55
True 8 11 7 4 7 8 12 27 53 20 6 20 26 66 9 9 9 5 4 7 11 36 34 33 10 6 20 53
none False 8 12 7 5 7 9 13 28 66 21 10 21 36 78 9 9 9 5 4 8 13 36 36 36 10 6 28 78
True 8 12 7 5 7 9 13 27 64 20 8 20 34 78 9 9 9 5 4 8 13 36 34 33 10 6 26 76
any reading with 716 edges: False
channels per participant:
pt SD168 SD172 SD181 SD185 SD186 SD211 SD245
dataset all 154 162 113 106 81 105 190
dataset not excluded 148 146 106 86 72 97 170
dataset not excluded, no bad 144 135 102 83 71 82 153
dataset no WM 92 118 78 62 59 82 126
dataset no WM, no bad 89 108 74 59 58 67 115
dataset all, no WM (excluded kept) 98 134 85 80 68 90 145
code list all 167 173 121 115 87 111 205
code list no bad 152 139 104 85 71 84 160
code list not excluded, no bad 152 139 104 85 71 84 157
code list no WM 101 121 81 64 59 85 131
code list no WM, no bad 97 110 76 61 58 69 118
total edges (high + low) by channel set and rounding:
int ceil round
dataset all 1138 1278 1158
dataset not excluded 896 1020 1006
dataset not excluded, no bad 792 942 818
dataset no WM 462 578 532
dataset no WM, no bad 368 472 458
dataset all, no WM (excluded kept) 624 724 654
code list all 1300 1490 1370
code list no bad 850 972 876
code list not excluded, no bad 820 972 876
code list no WM 540 664 550
code list no WM, no bad 414 502 490
channel sets giving 716: [] | nearest: 724
print("expected figs38b:", expected("figs38b-ketamine-coupling-loss-larger-at-persistent-sites"))
for cid in ("figs38a-baseline-coupling-not-different", "figs38b-ketamine-coupling-loss-larger-at-persistent-sites"):
print(f"paper, {cid}:")
for s_ in CLAIMS[cid]["statistics"]:
print(f" {s_['about']:>10}: {s_['statistic']}, CI {s_['ci']['low']} to {s_['ci']['high']}, BH p {s_['p']}, {s_['n']}")
# Main readings (weights in the band, int sites, stride 5 s) in the Table S3 bands and in the
# fig. S38 code's bands, for every channel reading: coefficient, 95% CI, BH and Bonferroni p
T38 = pd.concat([ic.s38_models(RES, bset, wm, bad) for bset in ("main", "code")
for wm in (True, False) for bad in ("code", "none")], ignore_index=True)
show = ["bands", "wm_excluded", "bad_list", "outcome", "band", "coef", "ci_low", "ci_high", "p", "p_bh", "p_bonf", "n", "converged"]
print(T38[show].round(4).to_string())
expected figs38b: [('beta coefficient, ketamine change in PLV, high against low edges', -0.038, 0.019)]
paper, figs38a-baseline-coupling-not-different:
delta: coefficient = 0.0017, CI -0.005 to 0.008, BH p 0.76, 716 edges, 7 participants
theta: coefficient = 0.0026, CI -0.004 to 0.009, BH p 0.76, 716 edges, 7 participants
alpha: coefficient = 0.0017, CI -0.006 to 0.009, BH p 0.76, 716 edges, 7 participants
beta: coefficient = 0.0016, CI -0.005 to 0.008, BH p 0.76, 716 edges, 7 participants
gamma: coefficient = 0.0018, CI -0.004 to 0.007, BH p 0.76, 716 edges, 7 participants
high gamma: coefficient = -0.00060, CI -0.006 to 0.005, BH p 0.83, 716 edges, 7 participants
paper, figs38b-ketamine-coupling-loss-larger-at-persistent-sites:
delta: coefficient = -0.0038, CI -0.024 to 0.016, BH p 0.7, 716 edges, 7 participants
theta: coefficient = -0.016, CI -0.038 to 0.005, BH p 0.16, 716 edges, 7 participants
alpha: coefficient = -0.028, CI -0.05 to -0.007, BH p 0.021, 716 edges, 7 participants
beta: coefficient = -0.038, CI -0.057 to -0.02, BH p 0.00026, 716 edges, 7 participants
gamma: coefficient = -0.023, CI -0.04 to -0.006, BH p 0.019, 716 edges, 7 participants
high gamma: coefficient = -0.012, CI -0.028 to 0.003, BH p 0.16, 716 edges, 7 participants
bands wm_excluded bad_list outcome band coef ci_low ci_high p p_bh p_bonf n converged 0 main True code sync_base delta -0.0063 -0.0190 0.0064 0.3312 0.3312 1.0000 368 True 1 main True code sync_base theta 0.0227 0.0080 0.0374 0.0024 0.0120 0.0146 368 False 2 main True code sync_base alpha 0.0140 0.0026 0.0254 0.0162 0.0325 0.0974 368 True 3 main True code sync_base beta -0.0082 -0.0239 0.0074 0.3022 0.3312 1.0000 368 False 4 main True code sync_base low gamma 0.0094 0.0010 0.0177 0.0280 0.0420 0.1679 368 False 5 main True code sync_base high gamma 0.0161 0.0051 0.0270 0.0040 0.0120 0.0241 368 False 6 main True code sync_change delta -0.0070 -0.0120 -0.0019 0.0068 0.0204 0.0409 368 False 7 main True code sync_change theta -0.0084 -0.0138 -0.0030 0.0022 0.0131 0.0131 368 True 8 main True code sync_change alpha -0.0060 -0.0107 -0.0013 0.0130 0.0259 0.0777 368 True 9 main True code sync_change beta -0.0025 -0.0049 -0.0001 0.0408 0.0612 0.2447 368 True 10 main True code sync_change low gamma 0.0006 -0.0011 0.0022 0.5117 0.5117 1.0000 368 True 11 main True code sync_change high gamma 0.0008 -0.0008 0.0024 0.3053 0.3663 1.0000 368 False 12 main True code sync_change_z delta -0.0549 -0.0964 -0.0134 0.0095 0.0266 0.0571 368 True 13 main True code sync_change_z theta -0.0706 -0.1152 -0.0260 0.0019 0.0115 0.0115 368 True 14 main True code sync_change_z alpha -0.0420 -0.0818 -0.0023 0.0381 0.0572 0.2286 368 True 15 main True code sync_change_z beta -0.0452 -0.0810 -0.0094 0.0133 0.0266 0.0797 368 True 16 main True code sync_change_z low gamma 0.0111 -0.0220 0.0442 0.5118 0.5118 1.0000 368 True 17 main True code sync_change_z high gamma 0.0171 -0.0228 0.0571 0.4000 0.4800 1.0000 368 True 18 main True none sync_base delta -0.0018 -0.0135 0.0100 0.7694 0.8270 1.0000 462 True 19 main True none sync_base theta 0.0170 0.0041 0.0300 0.0097 0.0292 0.0584 462 True 20 main True none sync_base alpha 0.0143 0.0035 0.0251 0.0092 0.0292 0.0552 462 True 21 main True none sync_base beta -0.0016 -0.0157 0.0126 0.8270 0.8270 1.0000 462 True 22 main True none sync_base low gamma 0.0109 -0.0006 0.0224 0.0637 0.0956 0.3823 462 True 23 main True none sync_base high gamma 0.0114 0.0000 0.0227 0.0494 0.0956 0.2965 462 True 24 main True none sync_change delta -0.0079 -0.0122 -0.0035 0.0004 0.0013 0.0026 462 True 25 main True none sync_change theta -0.0046 -0.0091 -0.0002 0.0418 0.0626 0.2506 462 True 26 main True none sync_change alpha -0.0095 -0.0146 -0.0043 0.0003 0.0013 0.0020 462 True 27 main True none sync_change beta -0.0044 -0.0072 -0.0017 0.0015 0.0030 0.0089 462 True 28 main True none sync_change low gamma 0.0003 -0.0019 0.0025 0.7934 0.7934 1.0000 462 True 29 main True none sync_change high gamma 0.0005 -0.0009 0.0019 0.4873 0.5848 1.0000 462 True 30 main True none sync_change_z delta -0.0635 -0.0994 -0.0275 0.0005 0.0011 0.0032 462 True 31 main True none sync_change_z theta -0.0363 -0.0742 0.0017 0.0608 0.0913 0.3651 462 True 32 main True none sync_change_z alpha -0.0697 -0.1087 -0.0306 0.0005 0.0011 0.0028 462 True 33 main True none sync_change_z beta -0.0626 -0.0969 -0.0282 0.0004 0.0011 0.0021 462 True 34 main True none sync_change_z low gamma 0.0124 -0.0212 0.0459 0.4702 0.5357 1.0000 462 False 35 main True none sync_change_z high gamma 0.0112 -0.0243 0.0467 0.5357 0.5357 1.0000 462 True 36 main False code sync_base delta -0.0046 -0.0140 0.0047 0.3318 0.3403 1.0000 792 True 37 main False code sync_base theta 0.0271 0.0163 0.0380 0.0000 0.0000 0.0000 792 True 38 main False code sync_base alpha 0.0180 0.0096 0.0264 0.0000 0.0001 0.0002 792 True 39 main False code sync_base beta 0.0058 -0.0061 0.0176 0.3403 0.3403 1.0000 792 True 40 main False code sync_base low gamma 0.0035 -0.0010 0.0080 0.1295 0.1942 0.7768 792 True 41 main False code sync_base high gamma 0.0119 0.0047 0.0192 0.0012 0.0024 0.0072 792 True 42 main False code sync_change delta -0.0041 -0.0075 -0.0007 0.0175 0.0262 0.1050 792 True 43 main False code sync_change theta -0.0108 -0.0149 -0.0067 0.0000 0.0000 0.0000 792 True 44 main False code sync_change alpha -0.0052 -0.0086 -0.0018 0.0028 0.0085 0.0171 792 True 45 main False code sync_change beta -0.0028 -0.0048 -0.0009 0.0048 0.0095 0.0286 792 True 46 main False code sync_change low gamma 0.0003 -0.0008 0.0014 0.6017 0.6017 1.0000 792 True 47 main False code sync_change high gamma 0.0004 -0.0007 0.0015 0.4984 0.5981 1.0000 792 True 48 main False code sync_change_z delta -0.0336 -0.0610 -0.0062 0.0161 0.0242 0.0968 792 True 49 main False code sync_change_z theta -0.0882 -0.1210 -0.0553 0.0000 0.0000 0.0000 792 True 50 main False code sync_change_z alpha -0.0408 -0.0699 -0.0118 0.0059 0.0118 0.0353 792 True 51 main False code sync_change_z beta -0.0435 -0.0721 -0.0149 0.0029 0.0087 0.0174 792 True 52 main False code sync_change_z low gamma 0.0070 -0.0146 0.0286 0.5250 0.5250 1.0000 792 True 53 main False code sync_change_z high gamma 0.0091 -0.0181 0.0363 0.5133 0.5250 1.0000 792 True 54 main False none sync_base delta -0.0047 -0.0136 0.0041 0.2929 0.3486 1.0000 896 True 55 main False none sync_base theta 0.0221 0.0125 0.0318 0.0000 0.0000 0.0000 896 True 56 main False none sync_base alpha 0.0150 0.0072 0.0227 0.0002 0.0005 0.0010 896 True 57 main False none sync_base beta 0.0052 -0.0057 0.0160 0.3486 0.3486 1.0000 896 True 58 main False none sync_base low gamma 0.0057 -0.0002 0.0116 0.0595 0.0893 0.3573 896 True 59 main False none sync_base high gamma 0.0105 0.0032 0.0178 0.0048 0.0097 0.0291 896 True 60 main False none sync_change delta -0.0037 -0.0068 -0.0005 0.0232 0.0349 0.1395 896 True 61 main False none sync_change theta -0.0096 -0.0133 -0.0059 0.0000 0.0000 0.0000 896 True 62 main False none sync_change alpha -0.0063 -0.0100 -0.0026 0.0008 0.0024 0.0047 896 True 63 main False none sync_change beta -0.0029 -0.0049 -0.0009 0.0046 0.0092 0.0275 896 True 64 main False none sync_change low gamma 0.0003 -0.0010 0.0016 0.6903 0.6903 1.0000 896 True 65 main False none sync_change high gamma 0.0005 -0.0006 0.0015 0.3878 0.4654 1.0000 896 True 66 main False none sync_change_z delta -0.0298 -0.0550 -0.0045 0.0210 0.0315 0.1259 896 True 67 main False none sync_change_z theta -0.0770 -0.1069 -0.0470 0.0000 0.0000 0.0000 896 True 68 main False none sync_change_z alpha -0.0482 -0.0769 -0.0196 0.0010 0.0029 0.0058 896 True 69 main False none sync_change_z beta -0.0399 -0.0674 -0.0125 0.0043 0.0087 0.0261 896 True 70 main False none sync_change_z low gamma 0.0111 -0.0109 0.0331 0.3220 0.3864 1.0000 896 True 71 main False none sync_change_z high gamma 0.0094 -0.0166 0.0354 0.4774 0.4774 1.0000 896 False 72 code True code sync_base delta -0.0063 -0.0190 0.0064 0.3312 0.3312 1.0000 368 True 73 code True code sync_base theta 0.0234 0.0101 0.0367 0.0006 0.0034 0.0034 368 True 74 code True code sync_base alpha 0.0166 0.0031 0.0301 0.0162 0.0429 0.0970 368 False 75 code True code sync_base beta -0.0099 -0.0228 0.0030 0.1339 0.2009 0.8035 368 True 76 code True code sync_base gamma 0.0079 -0.0053 0.0211 0.2415 0.2898 1.0000 368 False 77 code True code sync_base high gamma 0.0106 0.0016 0.0196 0.0214 0.0429 0.1286 368 True 78 code True code sync_change delta -0.0070 -0.0120 -0.0019 0.0068 0.0409 0.0409 368 False 79 code True code sync_change theta -0.0023 -0.0071 0.0025 0.3448 0.4783 1.0000 368 False 80 code True code sync_change alpha -0.0018 -0.0059 0.0023 0.3939 0.4783 1.0000 368 False 81 code True code sync_change beta 0.0008 -0.0014 0.0029 0.4783 0.4783 1.0000 368 True 82 code True code sync_change gamma -0.0018 -0.0038 0.0001 0.0593 0.1780 0.3561 368 True 83 code True code sync_change high gamma 0.0005 -0.0008 0.0019 0.4263 0.4783 1.0000 368 True 84 code True code sync_change_z delta -0.0549 -0.0964 -0.0134 0.0095 0.0571 0.0571 368 True 85 code True code sync_change_z theta -0.0242 -0.0632 0.0149 0.2246 0.4493 1.0000 368 True 86 code True code sync_change_z alpha -0.0092 -0.0425 0.0242 0.5902 0.7082 1.0000 368 False 87 code True code sync_change_z beta 0.0061 -0.0271 0.0393 0.7186 0.7186 1.0000 368 True 88 code True code sync_change_z gamma -0.0366 -0.0788 0.0056 0.0895 0.2684 0.5367 368 True 89 code True code sync_change_z high gamma 0.0098 -0.0208 0.0403 0.5321 0.7082 1.0000 368 True 90 code True none sync_base delta -0.0018 -0.0135 0.0100 0.7694 0.9233 1.0000 462 True 91 code True none sync_base theta 0.0203 0.0080 0.0325 0.0012 0.0061 0.0072 462 True 92 code True none sync_base alpha 0.0182 0.0062 0.0303 0.0031 0.0061 0.0184 462 True 93 code True none sync_base beta -0.0006 -0.0154 0.0141 0.9319 0.9319 1.0000 462 True 94 code True none sync_base gamma 0.0137 -0.0029 0.0304 0.1064 0.1596 0.6385 462 True 95 code True none sync_base high gamma 0.0140 0.0049 0.0232 0.0027 0.0061 0.0164 462 True 96 code True none sync_change delta -0.0079 -0.0122 -0.0035 0.0004 0.0026 0.0026 462 True 97 code True none sync_change theta -0.0028 -0.0072 0.0016 0.2097 0.3146 1.0000 462 True 98 code True none sync_change alpha -0.0039 -0.0075 -0.0003 0.0318 0.0954 0.1907 462 True 99 code True none sync_change beta -0.0004 -0.0031 0.0023 0.7937 0.7937 1.0000 462 True 100 code True none sync_change gamma -0.0012 -0.0035 0.0010 0.2796 0.3355 1.0000 462 True 101 code True none sync_change high gamma 0.0009 -0.0002 0.0021 0.1188 0.2375 0.7126 462 False 102 code True none sync_change_z delta -0.0635 -0.0994 -0.0275 0.0005 0.0032 0.0032 462 True 103 code True none sync_change_z theta -0.0247 -0.0602 0.0108 0.1734 0.2681 1.0000 462 True 104 code True none sync_change_z alpha -0.0270 -0.0560 0.0021 0.0686 0.2057 0.4114 462 True 105 code True none sync_change_z beta 0.0007 -0.0320 0.0335 0.9652 0.9652 1.0000 462 True 106 code True none sync_change_z gamma -0.0167 -0.0573 0.0238 0.4184 0.5021 1.0000 462 True 107 code True none sync_change_z high gamma 0.0186 -0.0085 0.0458 0.1787 0.2681 1.0000 462 False 108 code False code sync_base delta -0.0046 -0.0140 0.0047 0.3318 0.3318 1.0000 792 True 109 code False code sync_base theta 0.0161 0.0072 0.0250 0.0004 0.0007 0.0022 792 True 110 code False code sync_base alpha 0.0195 0.0111 0.0278 0.0000 0.0000 0.0000 792 True 111 code False code sync_base beta 0.0055 -0.0051 0.0160 0.3102 0.3318 1.0000 792 True 112 code False code sync_base gamma 0.0041 -0.0030 0.0111 0.2617 0.3318 1.0000 792 True 113 code False code sync_base high gamma 0.0096 0.0044 0.0148 0.0003 0.0007 0.0019 792 True 114 code False code sync_change delta -0.0041 -0.0075 -0.0007 0.0175 0.0262 0.1050 792 True 115 code False code sync_change theta -0.0049 -0.0084 -0.0015 0.0050 0.0178 0.0301 792 True 116 code False code sync_change alpha -0.0039 -0.0066 -0.0011 0.0059 0.0178 0.0356 792 True 117 code False code sync_change beta -0.0008 -0.0026 0.0010 0.3972 0.3972 1.0000 792 True 118 code False code sync_change gamma -0.0014 -0.0026 -0.0003 0.0149 0.0262 0.0891 792 True 119 code False code sync_change high gamma 0.0006 -0.0005 0.0017 0.2713 0.3255 1.0000 792 True 120 code False code sync_change_z delta -0.0336 -0.0610 -0.0062 0.0161 0.0323 0.0968 792 True 121 code False code sync_change_z theta -0.0426 -0.0698 -0.0153 0.0022 0.0131 0.0131 792 True 122 code False code sync_change_z alpha -0.0311 -0.0535 -0.0087 0.0065 0.0196 0.0391 792 True 123 code False code sync_change_z beta -0.0155 -0.0442 0.0131 0.2876 0.2876 1.0000 792 True 124 code False code sync_change_z gamma -0.0301 -0.0558 -0.0043 0.0221 0.0331 0.1324 792 True 125 code False code sync_change_z high gamma 0.0141 -0.0094 0.0376 0.2406 0.2876 1.0000 792 True 126 code False none sync_base delta -0.0047 -0.0136 0.0041 0.2929 0.3058 1.0000 896 True 127 code False none sync_base theta 0.0127 0.0049 0.0206 0.0015 0.0035 0.0091 896 True 128 code False none sync_base alpha 0.0195 0.0118 0.0272 0.0000 0.0000 0.0000 896 True 129 code False none sync_base beta 0.0052 -0.0048 0.0153 0.3058 0.3058 1.0000 896 True 130 code False none sync_base gamma 0.0057 -0.0033 0.0148 0.2155 0.3058 1.0000 896 True 131 code False none sync_base high gamma 0.0091 0.0034 0.0149 0.0018 0.0035 0.0105 896 True 132 code False none sync_change delta -0.0037 -0.0068 -0.0005 0.0232 0.0368 0.1395 896 True 133 code False none sync_change theta -0.0046 -0.0077 -0.0014 0.0048 0.0143 0.0286 896 True 134 code False none sync_change alpha -0.0049 -0.0075 -0.0024 0.0001 0.0008 0.0008 896 True 135 code False none sync_change beta -0.0022 -0.0041 -0.0002 0.0306 0.0368 0.1838 896 False 136 code False none sync_change gamma -0.0016 -0.0030 -0.0002 0.0260 0.0368 0.1562 896 True 137 code False none sync_change high gamma 0.0008 -0.0004 0.0020 0.1690 0.1690 1.0000 896 True 138 code False none sync_change_z delta -0.0298 -0.0550 -0.0045 0.0210 0.0398 0.1259 896 True 139 code False none sync_change_z theta -0.0396 -0.0647 -0.0146 0.0019 0.0058 0.0116 896 True 140 code False none sync_change_z alpha -0.0399 -0.0606 -0.0192 0.0002 0.0009 0.0009 896 True 141 code False none sync_change_z beta -0.0299 -0.0573 -0.0024 0.0332 0.0398 0.1991 896 True 142 code False none sync_change_z gamma -0.0311 -0.0598 -0.0025 0.0330 0.0398 0.1983 896 True 143 code False none sync_change_z high gamma 0.0209 -0.0028 0.0445 0.0840 0.0840 0.5040 896 True
# All readings: band set x weight source x site selection x channel reading (stride 5 s), and for
# the band weights with int sites, strides 2.5 s and 1 s and the adjacent-edge filter
t = time.time()
parts = []
for bset in ("main", "code"):
for wsrc in ic.S38_WEIGHTS:
for sel in ic.S38_SELECTIONS:
for wm in (True, False):
for bad in ("code", "none"):
if sel == "rank_wm_kept" and not wm:
continue
if (wsrc, sel) != ("band", "int"):
parts.append(ic.s38_models(RES, bset, wm, bad, wsrc, sel))
for wm in (True, False):
for bad in ("code", "none"):
if (wsrc, sel) == ("band", "int"):
for stride, drop in ((2.5, False), (1.0, False), (5.0, True)):
parts.append(ic.s38_models(RES, bset, wm, bad, wsrc, sel, stride, drop))
T38V = pd.concat([T38] + parts, ignore_index=True)
RKEY = ["bands", "weights", "sites", "stride_s", "drop_adjacent", "wm_excluded", "bad_list"]
print(f"{T38V.groupby(RKEY).ngroups} readings, {len(T38V)} models in {time.time() - t:.0f} s")
64 readings, 1152 models in 35 s
# figs38a: bands with BH-corrected p < 0.05 for preinfusion PLV, high against low edges
rows = []
for key, g in T38V[T38V.outcome == "sync_base"].groupby(RKEY, sort=False):
s = g[g.p_bh < 0.05]
rows.append(dict(zip(RKEY, key), edges=g.n.iloc[0], n_bands_differ=len(s),
differing=", ".join(f"{b} {c:+.4f} (p {p:.3f})" for b, c, p in zip(s.band, s.coef, s.p_bh)),
max_abs_coef=g.coef.abs().max()))
A38 = pd.DataFrame(rows)
print(A38.round(4).to_string())
print("\nreadings with no band differing (absence holds):", int((A38.n_bands_differ == 0).sum()), "of", len(A38))
print("main readings (Table S3 bands, band weights, int, stride 5 s):")
print(A38[(A38.weights == "band") & (A38.sites == "int") & (A38.stride_s == 5.0) & ~A38.drop_adjacent].round(4).to_string())
for (bs, w), g in A38.groupby(["bands", "weights"]):
print(f"bands {bs}, weights {w}: absence holds in {int((g.n_bands_differ == 0).sum())} of {len(g)} readings; "
f"largest |coefficient| per reading {g.max_abs_coef.min():.4f} to {g.max_abs_coef.max():.4f}; "
f"theta and alpha both differ in {int(g.differing.str.contains('theta').mul(g.differing.str.contains('alpha')).sum())}")
print("readings where the absence holds:")
print(A38[A38.n_bands_differ == 0][RKEY + ["edges", "max_abs_coef"]].round(4).to_string())
bands weights sites stride_s drop_adjacent wm_excluded bad_list edges n_bands_differ differing max_abs_coef 0 main band int 5.0 False True code 368 4 theta +0.0227 (p 0.012), alpha +0.0140 (p 0.032), low gamma +0.0094 (p 0.042), high gamma +0.0161 (p 0.012) 0.0227 1 main band int 5.0 False True none 462 2 theta +0.0170 (p 0.029), alpha +0.0143 (p 0.029) 0.0170 2 main band int 5.0 False False code 792 3 theta +0.0271 (p 0.000), alpha +0.0180 (p 0.000), high gamma +0.0119 (p 0.002) 0.0271 3 main band int 5.0 False False none 896 3 theta +0.0221 (p 0.000), alpha +0.0150 (p 0.000), high gamma +0.0105 (p 0.010) 0.0221 4 code band int 5.0 False True code 368 3 theta +0.0234 (p 0.003), alpha +0.0166 (p 0.043), high gamma +0.0106 (p 0.043) 0.0234 5 code band int 5.0 False True none 462 3 theta +0.0203 (p 0.006), alpha +0.0182 (p 0.006), high gamma +0.0140 (p 0.006) 0.0203 6 code band int 5.0 False False code 792 3 theta +0.0161 (p 0.001), alpha +0.0195 (p 0.000), high gamma +0.0096 (p 0.001) 0.0195 7 code band int 5.0 False False none 896 3 theta +0.0127 (p 0.004), alpha +0.0195 (p 0.000), high gamma +0.0091 (p 0.004) 0.0195 8 main band int 2.5 False True code 368 4 theta +0.0216 (p 0.012), alpha +0.0145 (p 0.024), low gamma +0.0093 (p 0.044), high gamma +0.0160 (p 0.012) 0.0216 9 main band int 1.0 False True code 368 4 theta +0.0215 (p 0.013), alpha +0.0143 (p 0.027), low gamma +0.0092 (p 0.047), high gamma +0.0159 (p 0.013) 0.0215 10 main band int 5.0 True True code 356 0 0.0124 11 main band int 2.5 False True none 462 2 theta +0.0164 (p 0.039), alpha +0.0142 (p 0.039) 0.0164 12 main band int 1.0 False True none 462 2 theta +0.0162 (p 0.043), alpha +0.0141 (p 0.043) 0.0162 13 main band int 5.0 True True none 446 0 0.0084 14 main band int 2.5 False False code 792 3 theta +0.0269 (p 0.000), alpha +0.0179 (p 0.000), high gamma +0.0121 (p 0.002) 0.0269 15 main band int 1.0 False False code 792 3 theta +0.0266 (p 0.000), alpha +0.0178 (p 0.000), high gamma +0.0119 (p 0.002) 0.0266 16 main band int 5.0 True False code 764 3 delta -0.0068 (p 0.042), theta +0.0199 (p 0.000), alpha +0.0074 (p 0.009) 0.0199 17 main band int 2.5 False False none 896 3 theta +0.0218 (p 0.000), alpha +0.0147 (p 0.001), high gamma +0.0107 (p 0.008) 0.0218 18 main band int 1.0 False False none 896 3 theta +0.0216 (p 0.000), alpha +0.0144 (p 0.001), high gamma +0.0105 (p 0.010) 0.0216 19 main band int 5.0 True False none 864 2 theta +0.0149 (p 0.001), alpha +0.0072 (p 0.022) 0.0149 20 main band ceil 5.0 False True code 472 4 theta +0.0218 (p 0.005), alpha +0.0147 (p 0.012), low gamma +0.0104 (p 0.024), high gamma +0.0124 (p 0.038) 0.0218 21 main band ceil 5.0 False True none 578 2 theta +0.0207 (p 0.002), alpha +0.0183 (p 0.002) 0.0207 22 main band ceil 5.0 False False code 942 4 theta +0.0283 (p 0.000), alpha +0.0178 (p 0.000), low gamma +0.0056 (p 0.038), high gamma +0.0088 (p 0.019) 0.0283 23 main band ceil 5.0 False False none 1020 3 theta +0.0248 (p 0.000), alpha +0.0167 (p 0.000), high gamma +0.0080 (p 0.045) 0.0248 24 main band rank_wm_kept 5.0 False True code 387 2 theta +0.0293 (p 0.001), alpha +0.0228 (p 0.000) 0.0293 25 main band rank_wm_kept 5.0 False True none 467 2 theta +0.0221 (p 0.007), alpha +0.0153 (p 0.007) 0.0221 26 main beta int 5.0 False True code 368 0 0.0082 27 main beta int 5.0 False True none 462 0 0.0091 28 main beta int 5.0 False False code 792 0 0.0077 29 main beta int 5.0 False False none 896 0 0.0052 30 main beta ceil 5.0 False True code 472 0 0.0077 31 main beta ceil 5.0 False True none 578 0 0.0084 32 main beta ceil 5.0 False False code 942 0 0.0073 33 main beta ceil 5.0 False False none 1020 0 0.0048 34 main beta rank_wm_kept 5.0 False True code 425 0 0.0054 35 main beta rank_wm_kept 5.0 False True none 490 0 0.0080 36 code band int 2.5 False True code 368 3 theta +0.0228 (p 0.005), alpha +0.0176 (p 0.032), high gamma +0.0108 (p 0.038) 0.0228 37 code band int 1.0 False True code 368 3 theta +0.0232 (p 0.004), alpha +0.0179 (p 0.028), high gamma +0.0106 (p 0.043) 0.0232 38 code band int 5.0 True True code 356 0 0.0120 39 code band int 2.5 False True none 462 3 theta +0.0200 (p 0.005), alpha +0.0192 (p 0.005), high gamma +0.0142 (p 0.005) 0.0200 40 code band int 1.0 False True none 462 3 theta +0.0204 (p 0.004), alpha +0.0196 (p 0.004), high gamma +0.0141 (p 0.005) 0.0204 41 code band int 5.0 True True none 446 0 0.0112 42 code band int 2.5 False False code 792 3 theta +0.0158 (p 0.001), alpha +0.0194 (p 0.000), high gamma +0.0097 (p 0.001) 0.0194 43 code band int 1.0 False False code 792 3 theta +0.0159 (p 0.001), alpha +0.0196 (p 0.000), high gamma +0.0097 (p 0.001) 0.0196 44 code band int 5.0 True False code 764 1 alpha +0.0103 (p 0.000) 0.0103 45 code band int 2.5 False False none 896 3 theta +0.0127 (p 0.003), alpha +0.0194 (p 0.000), high gamma +0.0094 (p 0.003) 0.0194 46 code band int 1.0 False False none 896 3 theta +0.0126 (p 0.003), alpha +0.0195 (p 0.000), high gamma +0.0093 (p 0.003) 0.0195 47 code band int 5.0 True False none 864 1 alpha +0.0109 (p 0.000) 0.0109 48 code band ceil 5.0 False True code 472 3 theta +0.0192 (p 0.005), alpha +0.0193 (p 0.005), high gamma +0.0106 (p 0.020) 0.0193 49 code band ceil 5.0 False True none 578 3 theta +0.0150 (p 0.010), alpha +0.0170 (p 0.004), high gamma +0.0126 (p 0.004) 0.0170 50 code band ceil 5.0 False False code 942 3 theta +0.0140 (p 0.002), alpha +0.0182 (p 0.000), high gamma +0.0086 (p 0.004) 0.0182 51 code band ceil 5.0 False False none 1020 3 theta +0.0117 (p 0.003), alpha +0.0205 (p 0.000), high gamma +0.0082 (p 0.003) 0.0205 52 code band rank_wm_kept 5.0 False True code 387 3 theta +0.0214 (p 0.009), alpha +0.0181 (p 0.007), high gamma +0.0155 (p 0.007) 0.0214 53 code band rank_wm_kept 5.0 False True none 467 3 theta +0.0145 (p 0.050), alpha +0.0198 (p 0.003), high gamma +0.0167 (p 0.008) 0.0198 54 code beta int 5.0 False True code 368 0 0.0078 55 code beta int 5.0 False True none 462 0 0.0091 56 code beta int 5.0 False False code 792 0 0.0058 57 code beta int 5.0 False False none 896 0 0.0053 58 code beta ceil 5.0 False True code 472 0 0.0075 59 code beta ceil 5.0 False True none 578 0 0.0055 60 code beta ceil 5.0 False False code 942 0 0.0051 61 code beta ceil 5.0 False False none 1020 0 0.0048 62 code beta rank_wm_kept 5.0 False True code 425 0 0.0050 63 code beta rank_wm_kept 5.0 False True none 490 0 0.0059 readings with no band differing (absence holds): 24 of 64 main readings (Table S3 bands, band weights, int, stride 5 s): bands weights sites stride_s drop_adjacent wm_excluded bad_list edges n_bands_differ differing max_abs_coef 0 main band int 5.0 False True code 368 4 theta +0.0227 (p 0.012), alpha +0.0140 (p 0.032), low gamma +0.0094 (p 0.042), high gamma +0.0161 (p 0.012) 0.0227 1 main band int 5.0 False True none 462 2 theta +0.0170 (p 0.029), alpha +0.0143 (p 0.029) 0.0170 2 main band int 5.0 False False code 792 3 theta +0.0271 (p 0.000), alpha +0.0180 (p 0.000), high gamma +0.0119 (p 0.002) 0.0271 3 main band int 5.0 False False none 896 3 theta +0.0221 (p 0.000), alpha +0.0150 (p 0.000), high gamma +0.0105 (p 0.010) 0.0221 4 code band int 5.0 False True code 368 3 theta +0.0234 (p 0.003), alpha +0.0166 (p 0.043), high gamma +0.0106 (p 0.043) 0.0234 5 code band int 5.0 False True none 462 3 theta +0.0203 (p 0.006), alpha +0.0182 (p 0.006), high gamma +0.0140 (p 0.006) 0.0203 6 code band int 5.0 False False code 792 3 theta +0.0161 (p 0.001), alpha +0.0195 (p 0.000), high gamma +0.0096 (p 0.001) 0.0195 7 code band int 5.0 False False none 896 3 theta +0.0127 (p 0.004), alpha +0.0195 (p 0.000), high gamma +0.0091 (p 0.004) 0.0195 bands code, weights band: absence holds in 2 of 22 readings; largest |coefficient| per reading 0.0103 to 0.0234; theta and alpha both differ in 18 bands code, weights beta: absence holds in 10 of 10 readings; largest |coefficient| per reading 0.0048 to 0.0091; theta and alpha both differ in 0 bands main, weights band: absence holds in 2 of 22 readings; largest |coefficient| per reading 0.0084 to 0.0293; theta and alpha both differ in 20 bands main, weights beta: absence holds in 10 of 10 readings; largest |coefficient| per reading 0.0048 to 0.0091; theta and alpha both differ in 0 readings where the absence holds: bands weights sites stride_s drop_adjacent wm_excluded bad_list edges max_abs_coef 10 main band int 5.0 True True code 356 0.0124 13 main band int 5.0 True True none 446 0.0084 26 main beta int 5.0 False True code 368 0.0082 27 main beta int 5.0 False True none 462 0.0091 28 main beta int 5.0 False False code 792 0.0077 29 main beta int 5.0 False False none 896 0.0052 30 main beta ceil 5.0 False True code 472 0.0077 31 main beta ceil 5.0 False True none 578 0.0084 32 main beta ceil 5.0 False False code 942 0.0073 33 main beta ceil 5.0 False False none 1020 0.0048 34 main beta rank_wm_kept 5.0 False True code 425 0.0054 35 main beta rank_wm_kept 5.0 False True none 490 0.0080 38 code band int 5.0 True True code 356 0.0120 41 code band int 5.0 True True none 446 0.0112 54 code beta int 5.0 False True code 368 0.0078 55 code beta int 5.0 False True none 462 0.0091 56 code beta int 5.0 False False code 792 0.0058 57 code beta int 5.0 False False none 896 0.0053 58 code beta ceil 5.0 False True code 472 0.0075 59 code beta ceil 5.0 False True none 578 0.0055 60 code beta ceil 5.0 False False code 942 0.0051 61 code beta ceil 5.0 False False none 1020 0.0048 62 code beta rank_wm_kept 5.0 False True code 425 0.0050 63 code beta rank_wm_kept 5.0 False True none 490 0.0059
Result: figs38a not reproduced with the weights of each band, as the criterion sets; the absence holds under the code's sorting of sites by beta weights. With the beta persistent weights ranking the sites for every band (the code's comment, lines 231 to 232), no band differs in any of the 20 readings (largest absolute coefficient per reading 0.0048 to 0.0091; the paper's coefficients are 0.0006 to 0.0026 in absolute value). With the weights computed in each band (the fig. S38B legend), the absence holds in only 4 of the 44 readings, all with white matter excluded and the adjacent-edge filter; in the other 40 at least one band differs, theta and alpha both in 38 (preinfusion phase locking higher among high-persistence edges, largest coefficient per reading 0.0084 to 0.0293). No reading gives the paper's 716 edges: the readings give 339 to 1020, and no channel set from the dataset or the code record's channel list gives 716 with int, ceil or round (nearest 724). The figure legend and the code differ on the weights, and the outcome rests on the legend's per-band reading, which the criterion sets.
# figs38b: ketamine - preinfusion change, high against low edges, raw and z-scored by the
# preinfusion window SD. Gamma is 'low gamma' (30 to 50 Hz) in the Table S3 bands, 'gamma'
# (31 to 70 Hz) in the code's bands.
rows = []
for key, g in T38V[T38V.outcome.isin(["sync_change", "sync_change_z"])].groupby(RKEY + ["outcome"], sort=False):
g = g.set_index("band")
gam = "low gamma" if key[0] == "main" else "gamma"
hold = {b: bool(g.loc[b, "p_bh"] < 0.05 and g.loc[b, "coef"] < 0) for b in ("alpha", "beta", gam)}
rows.append(dict(zip(RKEY + ["outcome"], key), alpha_p=g.loc["alpha", "p_bh"], beta_p=g.loc["beta", "p_bh"],
gamma_p=g.loc[gam, "p_bh"], alpha=hold["alpha"], beta=hold["beta"], gamma=hold[gam],
beta_coef=g.loc["beta", "coef"], beta_ci_low=g.loc["beta", "ci_low"], beta_ci_high=g.loc["beta", "ci_high"],
gamma_coef=g.loc[gam, "coef"], beta_in_tol=bool(-0.057 <= g.loc["beta", "coef"] <= -0.019)))
B38 = pd.DataFrame(rows)
B38["all_three_and_tol"] = B38.alpha & B38.beta & B38.gamma & B38.beta_in_tol
B38["beta_and_tol"] = B38.beta & B38.beta_in_tol
print(B38.round(4).to_string())
for out, g in B38.groupby("outcome"):
print(f"\n{out}: {len(g)} readings; full criterion (alpha, beta, gamma, beta in tolerance) in "
f"{int(g.all_three_and_tol.sum())}; beta significant and in tolerance in {int(g.beta_and_tol.sum())}")
print(g[g.all_three_and_tol][RKEY + ["alpha_p", "beta_p", "gamma_p", "beta_coef", "beta_ci_low", "beta_ci_high"]].round(4).to_string())
print("\nby band set and weight source (z units):")
for (bs, w), g in B38[B38.outcome == "sync_change_z"].groupby(["bands", "weights"]):
print(f"bands {bs}, weights {w}: {len(g)} readings; alpha holds {int(g.alpha.sum())}, beta {int(g.beta.sum())}, "
f"gamma {int(g.gamma.sum())}, beta in tolerance and significant {int(g.beta_and_tol.sum())}, full criterion {int(g.all_three_and_tol.sum())}; "
f"beta coefficient {g.beta_coef.min():.4f} to {g.beta_coef.max():.4f}")
print("\nper band, beta weights for every band (int sites, stride 5 s), z units:")
m = T38V[(T38V.weights == "beta") & (T38V.sites == "int") & (T38V.stride_s == 5.0) & ~T38V.drop_adjacent & (T38V.outcome == "sync_change_z")]
print(m[["bands", "wm_excluded", "bad_list", "band", "coef", "ci_low", "ci_high", "p_bh"]].round(4).to_string(index=False))
bands weights sites stride_s drop_adjacent wm_excluded bad_list outcome alpha_p beta_p gamma_p alpha beta gamma beta_coef beta_ci_low beta_ci_high gamma_coef beta_in_tol all_three_and_tol beta_and_tol
0 main band int 5.0 False True code sync_change 0.0259 0.0612 0.5117 True False False -0.0025 -0.0049 -0.0001 0.0006 False False False
1 main band int 5.0 False True code sync_change_z 0.0572 0.0266 0.5118 False True False -0.0452 -0.0810 -0.0094 0.0111 True False True
2 main band int 5.0 False True none sync_change 0.0013 0.0030 0.7934 True True False -0.0044 -0.0072 -0.0017 0.0003 False False False
3 main band int 5.0 False True none sync_change_z 0.0011 0.0011 0.5357 True True False -0.0626 -0.0969 -0.0282 0.0124 False False False
4 main band int 5.0 False False code sync_change 0.0085 0.0095 0.6017 True True False -0.0028 -0.0048 -0.0009 0.0003 False False False
5 main band int 5.0 False False code sync_change_z 0.0118 0.0087 0.5250 True True False -0.0435 -0.0721 -0.0149 0.0070 True False True
6 main band int 5.0 False False none sync_change 0.0024 0.0092 0.6903 True True False -0.0029 -0.0049 -0.0009 0.0003 False False False
7 main band int 5.0 False False none sync_change_z 0.0029 0.0087 0.3864 True True False -0.0399 -0.0674 -0.0125 0.0111 True False True
8 code band int 5.0 False True code sync_change 0.4783 0.4783 0.1780 False False False 0.0008 -0.0014 0.0029 -0.0018 False False False
9 code band int 5.0 False True code sync_change_z 0.7082 0.7186 0.2684 False False False 0.0061 -0.0271 0.0393 -0.0366 False False False
10 code band int 5.0 False True none sync_change 0.0954 0.7937 0.3355 False False False -0.0004 -0.0031 0.0023 -0.0012 False False False
11 code band int 5.0 False True none sync_change_z 0.2057 0.9652 0.5021 False False False 0.0007 -0.0320 0.0335 -0.0167 False False False
12 code band int 5.0 False False code sync_change 0.0178 0.3972 0.0262 True False True -0.0008 -0.0026 0.0010 -0.0014 False False False
13 code band int 5.0 False False code sync_change_z 0.0196 0.2876 0.0331 True False True -0.0155 -0.0442 0.0131 -0.0301 False False False
14 code band int 5.0 False False none sync_change 0.0008 0.0368 0.0368 True True True -0.0022 -0.0041 -0.0002 -0.0016 False False False
15 code band int 5.0 False False none sync_change_z 0.0009 0.0398 0.0398 True True True -0.0299 -0.0573 -0.0024 -0.0311 True True True
16 main band int 2.5 False True code sync_change 0.0207 0.0731 0.4005 True False False -0.0023 -0.0046 -0.0000 0.0007 False False False
17 main band int 2.5 False True code sync_change_z 0.0256 0.0233 0.3542 True True False -0.0426 -0.0755 -0.0097 0.0145 True False True
18 main band int 1.0 False True code sync_change 0.0325 0.0845 0.3278 True False False -0.0022 -0.0044 0.0001 0.0008 False False False
19 main band int 1.0 False True code sync_change_z 0.0628 0.0268 0.2800 False True False -0.0404 -0.0724 -0.0084 0.0183 True False True
20 main band int 5.0 True True code sync_change 0.2009 0.1160 0.5046 False False False -0.0019 -0.0039 0.0001 0.0005 False False False
21 main band int 5.0 True True code sync_change_z 0.3369 0.0788 0.5031 False False False -0.0345 -0.0673 -0.0017 0.0102 True False False
22 main band int 2.5 False True none sync_change 0.0021 0.0028 0.5181 True True False -0.0043 -0.0070 -0.0017 0.0007 False False False
23 main band int 2.5 False True none sync_change_z 0.0011 0.0010 0.2010 True True False -0.0610 -0.0927 -0.0293 0.0218 False False False
24 main band int 1.0 False True none sync_change 0.0017 0.0024 0.5900 True True False -0.0044 -0.0070 -0.0017 0.0007 False False False
25 main band int 1.0 False True none sync_change_z 0.0016 0.0006 0.1604 True True False -0.0614 -0.0923 -0.0304 0.0236 False False False
26 main band int 5.0 True True none sync_change 0.0073 0.0427 0.3741 True True False -0.0021 -0.0039 -0.0003 0.0007 False False False
27 main band int 5.0 True True none sync_change_z 0.0104 0.0279 0.4078 True True False -0.0367 -0.0660 -0.0074 0.0133 True False True
28 main band int 2.5 False False code sync_change 0.0053 0.0121 0.6382 True True False -0.0027 -0.0046 -0.0008 0.0003 False False False
29 main band int 2.5 False False code sync_change_z 0.0059 0.0059 0.4895 True True False -0.0413 -0.0686 -0.0141 0.0084 True False True
30 main band int 1.0 False False code sync_change 0.0106 0.0133 0.6596 True True False -0.0026 -0.0045 -0.0007 0.0002 False False False
31 main band int 1.0 False False code sync_change_z 0.0108 0.0099 0.5607 True True False -0.0403 -0.0673 -0.0134 0.0067 True False True
32 main band int 5.0 True False code sync_change 0.0018 0.1187 0.7984 True False False -0.0014 -0.0029 0.0001 0.0001 False False False
33 main band int 5.0 True False code sync_change_z 0.0058 0.0950 0.6582 True False False -0.0224 -0.0457 0.0009 0.0046 True False False
34 main band int 2.5 False False none sync_change 0.0029 0.0103 0.6216 True True False -0.0028 -0.0047 -0.0008 0.0003 False False False
35 main band int 2.5 False False none sync_change_z 0.0033 0.0077 0.2819 True True False -0.0385 -0.0646 -0.0124 0.0123 True False True
36 main band int 1.0 False False none sync_change 0.0079 0.0083 0.7690 True True False -0.0028 -0.0048 -0.0009 0.0002 False False False
37 main band int 1.0 False False none sync_change_z 0.0078 0.0078 0.3819 True True False -0.0394 -0.0652 -0.0136 0.0101 True False True
38 main band int 5.0 True False none sync_change 0.0004 0.1758 0.3708 True False False -0.0011 -0.0025 0.0003 0.0005 False False False
39 main band int 5.0 True False none sync_change_z 0.0005 0.1722 0.2696 True False False -0.0177 -0.0396 0.0043 0.0121 False False False
40 main band ceil 5.0 False True code sync_change 0.0242 0.1842 0.1842 True False False -0.0014 -0.0034 0.0005 0.0011 False False False
41 main band ceil 5.0 False True code sync_change_z 0.0712 0.1743 0.1743 False False False -0.0243 -0.0549 0.0063 0.0213 True False False
42 main band ceil 5.0 False True none sync_change 0.0012 0.0402 0.5095 True True False -0.0026 -0.0049 -0.0003 0.0006 False False False
43 main band ceil 5.0 False True none sync_change_z 0.0031 0.0602 0.2529 True False False -0.0313 -0.0611 -0.0014 0.0185 True False False
44 main band ceil 5.0 False False code sync_change 0.0158 0.0888 0.2981 True False False -0.0017 -0.0034 0.0001 0.0006 False False False
45 main band ceil 5.0 False False code sync_change_z 0.0298 0.0906 0.2558 True False False -0.0248 -0.0507 0.0011 0.0125 True False False
46 main band ceil 5.0 False False none sync_change 0.0047 0.0220 0.4819 True True False -0.0023 -0.0041 -0.0005 0.0005 False False False
47 main band ceil 5.0 False False none sync_change_z 0.0102 0.0227 0.2195 True True False -0.0318 -0.0570 -0.0066 0.0142 True False True
48 main band rank_wm_kept 5.0 False True code sync_change 0.0013 0.0301 0.3276 True True False -0.0027 -0.0050 -0.0004 0.0008 False False False
49 main band rank_wm_kept 5.0 False True code sync_change_z 0.0063 0.0176 0.3604 True True False -0.0438 -0.0779 -0.0098 0.0147 True False True
50 main band rank_wm_kept 5.0 False True none sync_change 0.0004 0.0120 0.6081 True True False -0.0036 -0.0062 -0.0009 0.0006 False False False
51 main band rank_wm_kept 5.0 False True none sync_change_z 0.0021 0.0101 0.2675 True True False -0.0465 -0.0801 -0.0129 0.0182 True False True
52 main beta int 5.0 False True code sync_change 0.9186 0.1970 0.6756 False False False -0.0025 -0.0049 -0.0001 -0.0006 False False False
53 main beta int 5.0 False True code sync_change_z 0.7986 0.0797 0.5194 False False False -0.0452 -0.0810 -0.0094 -0.0146 True False False
54 main beta int 5.0 False True none sync_change 0.1051 0.0089 0.2433 False True False -0.0044 -0.0072 -0.0017 -0.0017 False False False
55 main beta int 5.0 False True none sync_change_z 0.1469 0.0021 0.1639 False True False -0.0626 -0.0969 -0.0282 -0.0273 False False False
56 main beta int 5.0 False False code sync_change 0.8939 0.0286 0.0762 False True False -0.0028 -0.0048 -0.0009 -0.0016 False False False
57 main beta int 5.0 False False code sync_change_z 0.9571 0.0174 0.0659 False True False -0.0435 -0.0721 -0.0149 -0.0305 True False True
58 main beta int 5.0 False False none sync_change 0.4637 0.0275 0.0372 False True True -0.0029 -0.0049 -0.0009 -0.0020 False False False
59 main beta int 5.0 False False none sync_change_z 0.6159 0.0255 0.0255 False True True -0.0399 -0.0674 -0.0125 -0.0343 True False True
60 main beta ceil 5.0 False True code sync_change 0.5530 0.4551 0.5530 False False False -0.0014 -0.0034 0.0005 -0.0005 False False False
61 main beta ceil 5.0 False True code sync_change_z 0.4711 0.3594 0.4711 False False False -0.0243 -0.0549 0.0063 -0.0116 True False False
62 main beta ceil 5.0 False True none sync_change 0.0645 0.0804 0.1287 False False False -0.0026 -0.0049 -0.0003 -0.0017 False False False
63 main beta ceil 5.0 False True none sync_change_z 0.0721 0.0856 0.0856 False False False -0.0313 -0.0611 -0.0014 -0.0294 True False False
64 main beta ceil 5.0 False False code sync_change 0.5545 0.1777 0.1743 False False False -0.0017 -0.0034 0.0001 -0.0014 False False False
65 main beta ceil 5.0 False False code sync_change_z 0.5845 0.1813 0.1345 False False False -0.0248 -0.0507 0.0011 -0.0273 True False False
66 main beta ceil 5.0 False False none sync_change 0.3861 0.0571 0.0571 False False False -0.0023 -0.0041 -0.0005 -0.0017 False False False
67 main beta ceil 5.0 False False none sync_change_z 0.5094 0.0411 0.0411 False True True -0.0318 -0.0570 -0.0066 -0.0299 True False True
68 main beta rank_wm_kept 5.0 False True code sync_change 0.8689 0.1204 0.5130 False False False -0.0027 -0.0050 -0.0004 -0.0008 False False False
69 main beta rank_wm_kept 5.0 False True code sync_change_z 0.8853 0.0703 0.5377 False False False -0.0438 -0.0779 -0.0098 -0.0157 True False False
70 main beta rank_wm_kept 5.0 False True none sync_change 0.2436 0.0480 0.3003 False True False -0.0036 -0.0062 -0.0009 -0.0015 False False False
71 main beta rank_wm_kept 5.0 False True none sync_change_z 0.2331 0.0398 0.2331 False True False -0.0465 -0.0801 -0.0129 -0.0231 True False True
72 code band int 2.5 False True code sync_change 0.3327 0.3327 0.1774 False False False 0.0011 -0.0009 0.0032 -0.0018 False False False
73 code band int 2.5 False True code sync_change_z 0.5093 0.5093 0.2404 False False False 0.0135 -0.0169 0.0438 -0.0356 False False False
74 code band int 1.0 False True code sync_change 0.3983 0.3983 0.2167 False False False 0.0010 -0.0010 0.0030 -0.0017 False False False
75 code band int 1.0 False True code sync_change_z 0.5552 0.5552 0.2149 False False False 0.0109 -0.0182 0.0400 -0.0322 False False False
76 code band int 5.0 True True code sync_change 0.7531 0.6063 0.7531 False False False 0.0008 -0.0009 0.0025 -0.0002 False False False
77 code band int 5.0 True True code sync_change_z 0.6508 0.6508 0.6508 False False False 0.0092 -0.0209 0.0392 -0.0071 False False False
78 code band int 2.5 False True none sync_change 0.0312 0.6641 0.4441 True False False -0.0006 -0.0032 0.0020 -0.0011 False False False
79 code band int 2.5 False True none sync_change_z 0.0690 0.8368 0.6546 False False False -0.0032 -0.0335 0.0272 -0.0131 False False False
80 code band int 1.0 False True none sync_change 0.0222 0.5220 0.3384 True False False -0.0008 -0.0034 0.0017 -0.0013 False False False
81 code band int 1.0 False True none sync_change_z 0.0350 0.5893 0.4668 True False False -0.0081 -0.0375 0.0213 -0.0174 False False False
82 code band int 5.0 True True none sync_change 0.5128 0.4592 0.4246 False False False 0.0007 -0.0009 0.0024 0.0006 False False False
83 code band int 5.0 True True none sync_change_z 0.7318 0.4999 0.4999 False False False 0.0117 -0.0165 0.0398 0.0128 False False False
84 code band int 2.5 False False code sync_change 0.0408 0.3807 0.0499 True False True -0.0009 -0.0026 0.0008 -0.0012 False False False
85 code band int 2.5 False False code sync_change_z 0.0380 0.2733 0.0709 True False False -0.0165 -0.0434 0.0103 -0.0245 False False False
86 code band int 1.0 False False code sync_change 0.0241 0.3175 0.0356 True False True -0.0010 -0.0027 0.0007 -0.0013 False False False
87 code band int 1.0 False False code sync_change_z 0.0334 0.2081 0.0447 True False True -0.0183 -0.0445 0.0080 -0.0264 False False False
88 code band int 5.0 True False code sync_change 0.0432 0.9776 0.1356 True False False 0.0000 -0.0013 0.0013 -0.0007 False False False
89 code band int 5.0 True False code sync_change_z 0.0616 0.9394 0.1441 False False False -0.0009 -0.0232 0.0215 -0.0179 False False False
90 code band int 2.5 False False none sync_change 0.0007 0.0404 0.0520 True True False -0.0022 -0.0041 -0.0004 -0.0014 False False False
91 code band int 2.5 False False none sync_change_z 0.0009 0.0294 0.0637 True True False -0.0307 -0.0565 -0.0049 -0.0267 True False True
92 code band int 1.0 False False none sync_change 0.0008 0.0235 0.0456 True True True -0.0023 -0.0042 -0.0004 -0.0015 False False False
93 code band int 1.0 False False none sync_change_z 0.0006 0.0204 0.0463 True True True -0.0318 -0.0570 -0.0065 -0.0283 True True True
94 code band int 5.0 True False none sync_change 0.0028 0.3840 0.3840 True False False -0.0005 -0.0018 0.0007 -0.0005 False False False
95 code band int 5.0 True False none sync_change_z 0.0051 0.4009 0.2660 True False False -0.0091 -0.0304 0.0122 -0.0145 False False False
96 code band ceil 5.0 False True code sync_change 0.1590 0.4696 0.4412 False False False 0.0008 -0.0011 0.0027 -0.0009 False False False
97 code band ceil 5.0 False True code sync_change_z 0.3502 0.7853 0.6134 False False False 0.0066 -0.0224 0.0357 -0.0155 False False False
98 code band ceil 5.0 False True none sync_change 0.0536 0.4121 0.4121 False False False -0.0010 -0.0034 0.0014 -0.0008 False False False
99 code band ceil 5.0 False True none sync_change_z 0.1187 0.6898 0.7182 False False False -0.0086 -0.0386 0.0214 -0.0063 False False False
100 code band ceil 5.0 False False code sync_change 0.0025 0.1873 0.0341 True False True -0.0011 -0.0027 0.0005 -0.0013 False False False
101 code band ceil 5.0 False False code sync_change_z 0.0021 0.1695 0.0493 True False True -0.0180 -0.0436 0.0077 -0.0260 False False False
102 code band ceil 5.0 False False none sync_change 0.0000 0.0361 0.0295 True True True -0.0020 -0.0037 -0.0002 -0.0015 False False False
103 code band ceil 5.0 False False none sync_change_z 0.0001 0.0411 0.0411 True True True -0.0270 -0.0520 -0.0020 -0.0288 True True True
104 code band rank_wm_kept 5.0 False True code sync_change 0.2552 0.5716 0.1161 False False False 0.0008 -0.0014 0.0029 -0.0014 False False False
105 code band rank_wm_kept 5.0 False True code sync_change_z 0.4097 0.6923 0.1956 False False False 0.0071 -0.0258 0.0401 -0.0279 False False False
106 code band rank_wm_kept 5.0 False True none sync_change 0.0301 0.1773 0.1497 True False False -0.0019 -0.0046 0.0008 -0.0015 False False False
107 code band rank_wm_kept 5.0 False True none sync_change_z 0.0482 0.3537 0.2239 True False False -0.0156 -0.0485 0.0173 -0.0240 False False False
108 code beta int 5.0 False True code sync_change 0.9635 0.1913 0.9635 False False False -0.0025 -0.0048 -0.0002 0.0001 False False False
109 code beta int 5.0 False True code sync_change_z 0.8798 0.0794 0.8798 False False False -0.0439 -0.0786 -0.0092 0.0024 True False False
110 code beta int 5.0 False True none sync_change 0.1126 0.0082 0.4118 False True False -0.0046 -0.0074 -0.0018 -0.0008 False False False
111 code beta int 5.0 False True none sync_change_z 0.1057 0.0017 0.5431 False True False -0.0617 -0.0951 -0.0284 -0.0101 False False False
112 code beta int 5.0 False False code sync_change 0.8549 0.0130 0.3742 False True False -0.0030 -0.0049 -0.0011 -0.0010 False False False
113 code beta int 5.0 False False code sync_change_z 0.9271 0.0079 0.3906 False True False -0.0469 -0.0754 -0.0183 -0.0210 True False True
114 code beta int 5.0 False False none sync_change 0.4637 0.0095 0.3838 False True False -0.0032 -0.0052 -0.0012 -0.0012 False False False
115 code beta int 5.0 False False none sync_change_z 0.4973 0.0058 0.3775 False True False -0.0458 -0.0729 -0.0186 -0.0235 True False True
116 code beta ceil 5.0 False True code sync_change 0.8523 0.2370 0.7771 False False False -0.0015 -0.0034 0.0004 -0.0004 False False False
117 code beta ceil 5.0 False True code sync_change_z 0.9489 0.1987 0.8535 False False False -0.0252 -0.0550 0.0045 -0.0081 True False False
118 code beta ceil 5.0 False True none sync_change 0.1417 0.0765 0.2778 False False False -0.0030 -0.0053 -0.0006 -0.0011 False False False
119 code beta ceil 5.0 False True none sync_change_z 0.1729 0.0793 0.2264 False False False -0.0367 -0.0657 -0.0077 -0.0216 True False False
120 code beta ceil 5.0 False False code sync_change 0.3808 0.1732 0.3808 False False False -0.0019 -0.0036 -0.0002 -0.0010 False False False
121 code beta ceil 5.0 False False code sync_change_z 0.4078 0.1753 0.3259 False False False -0.0287 -0.0545 -0.0029 -0.0231 True False False
122 code beta ceil 5.0 False False none sync_change 0.4892 0.0382 0.3786 False True False -0.0025 -0.0043 -0.0007 -0.0011 False False False
123 code beta ceil 5.0 False False none sync_change_z 0.6220 0.0325 0.3004 False True False -0.0354 -0.0603 -0.0104 -0.0230 True False True
124 code beta rank_wm_kept 5.0 False True code sync_change 0.9956 0.0559 0.6766 False False False -0.0030 -0.0053 -0.0007 -0.0005 False False False
125 code beta rank_wm_kept 5.0 False True code sync_change_z 0.8853 0.0350 0.8417 False True False -0.0470 -0.0805 -0.0136 -0.0091 True False True
126 code beta rank_wm_kept 5.0 False True none sync_change 0.4084 0.0235 0.4084 False True False -0.0040 -0.0067 -0.0013 -0.0008 False False False
127 code beta rank_wm_kept 5.0 False True none sync_change_z 0.3807 0.0129 0.5134 False True False -0.0515 -0.0843 -0.0186 -0.0116 True False True
sync_change: 64 readings; full criterion (alpha, beta, gamma, beta in tolerance) in 0; beta significant and in tolerance in 0
Empty DataFrame
Columns: [bands, weights, sites, stride_s, drop_adjacent, wm_excluded, bad_list, alpha_p, beta_p, gamma_p, beta_coef, beta_ci_low, beta_ci_high]
Index: []
sync_change_z: 64 readings; full criterion (alpha, beta, gamma, beta in tolerance) in 3; beta significant and in tolerance in 26
bands weights sites stride_s drop_adjacent wm_excluded bad_list alpha_p beta_p gamma_p beta_coef beta_ci_low beta_ci_high
15 code band int 5.0 False False none 0.0009 0.0398 0.0398 -0.0299 -0.0573 -0.0024
93 code band int 1.0 False False none 0.0006 0.0204 0.0463 -0.0318 -0.0570 -0.0065
103 code band ceil 5.0 False False none 0.0001 0.0411 0.0411 -0.0270 -0.0520 -0.0020
by band set and weight source (z units):
bands code, weights band: 22 readings; alpha holds 11, beta 4, gamma 6, beta in tolerance and significant 4, full criterion 3; beta coefficient -0.0318 to 0.0135
bands code, weights beta: 10 readings; alpha holds 0, beta 6, gamma 0, beta in tolerance and significant 5, full criterion 0; beta coefficient -0.0617 to -0.0252
bands main, weights band: 22 readings; alpha holds 18, beta 16, gamma 0, beta in tolerance and significant 13, full criterion 0; beta coefficient -0.0626 to -0.0177
bands main, weights beta: 10 readings; alpha holds 0, beta 5, gamma 2, beta in tolerance and significant 4, full criterion 0; beta coefficient -0.0626 to -0.0243
per band, beta weights for every band (int sites, stride 5 s), z units:
bands wm_excluded bad_list band coef ci_low ci_high p_bh
main True code delta -0.0032 -0.0405 0.0341 0.8658
main True code theta -0.0339 -0.0704 0.0026 0.1892
main True code alpha -0.0091 -0.0501 0.0320 0.7986
main True code beta -0.0452 -0.0810 -0.0094 0.0797
main True code low gamma -0.0146 -0.0449 0.0157 0.5194
main True code high gamma -0.0292 -0.0635 0.0050 0.1892
main True none delta -0.0225 -0.0558 0.0109 0.2239
main True none theta 0.0017 -0.0323 0.0357 0.9215
main True none alpha -0.0411 -0.0819 -0.0002 0.1469
main True none beta -0.0626 -0.0969 -0.0282 0.0021
main True none low gamma -0.0273 -0.0591 0.0045 0.1639
main True none high gamma -0.0253 -0.0562 0.0057 0.1639
main False code delta -0.0024 -0.0268 0.0220 0.9571
main False code theta -0.0298 -0.0608 0.0012 0.1189
main False code alpha 0.0008 -0.0273 0.0288 0.9571
main False code beta -0.0435 -0.0721 -0.0149 0.0174
main False code low gamma -0.0305 -0.0566 -0.0044 0.0659
main False code high gamma -0.0212 -0.0464 0.0041 0.1506
main False none delta -0.0127 -0.0361 0.0107 0.4003
main False none theta -0.0134 -0.0404 0.0137 0.4003
main False none alpha -0.0073 -0.0360 0.0213 0.6159
main False none beta -0.0399 -0.0674 -0.0125 0.0255
main False none low gamma -0.0343 -0.0599 -0.0088 0.0255
main False none high gamma -0.0205 -0.0442 0.0033 0.1819
code True code delta -0.0032 -0.0405 0.0341 0.8798
code True code theta -0.0321 -0.0683 0.0040 0.2431
code True code alpha -0.0094 -0.0474 0.0285 0.8798
code True code beta -0.0439 -0.0786 -0.0092 0.0794
code True code gamma 0.0024 -0.0286 0.0333 0.8798
code True code high gamma -0.0219 -0.0551 0.0113 0.3914
code True none delta -0.0225 -0.0558 0.0109 0.2791
code True none theta -0.0198 -0.0524 0.0127 0.2791
code True none alpha -0.0408 -0.0788 -0.0028 0.1057
code True none beta -0.0617 -0.0951 -0.0284 0.0017
code True none gamma -0.0101 -0.0425 0.0223 0.5431
code True none high gamma -0.0199 -0.0494 0.0095 0.2791
code False code delta -0.0024 -0.0268 0.0220 0.9271
code False code theta 0.0012 -0.0245 0.0269 0.9271
code False code alpha 0.0033 -0.0224 0.0290 0.9271
code False code beta -0.0469 -0.0754 -0.0183 0.0079
code False code gamma -0.0210 -0.0527 0.0108 0.3906
code False code high gamma -0.0202 -0.0445 0.0040 0.3066
code False none delta -0.0127 -0.0361 0.0107 0.4330
code False none theta 0.0095 -0.0145 0.0334 0.4973
code False none alpha -0.0090 -0.0351 0.0170 0.4973
code False none beta -0.0458 -0.0729 -0.0186 0.0058
code False none gamma -0.0235 -0.0536 0.0066 0.3775
code False none high gamma -0.0138 -0.0367 0.0091 0.4330
Result: figs38b partially reproduced: beta holds in most readings, the three-band claim only in a few. In z units, the main reading (Table S3 bands, weights of each band, white matter excluded, the code's bad-channel list) gives beta -0.0452 (95% CI -0.0810 to -0.0094, BH p = 0.0266), within -0.038 ± 0.019, alpha p = 0.0572 and low gamma positive (p = 0.5118). Over all 64 readings, beta is significant and within tolerance in 26. Alpha, beta and gamma all hold with beta in tolerance in 3 readings, all with the fig. S38 code's bands, the weights of each band, white matter kept and no bad-channel list (stride 5 s: alpha p = 0.0009, beta -0.0299, CI -0.0573 to -0.0024, p = 0.0398, gamma p = 0.0398; also stride 1 s and ceil sites). In the code's bands with white matter excluded beta is not significant in any reading with the weights of each band. With the beta weights for every band, the reading under which figs38a holds, beta is significant in 11 of 20 readings and alpha in none, so only the beta part of the claim holds there. The raw change (PLV units) meets the full criterion in no reading.
figs38h-prepuff-coupling-predicts-persistence¶
Before infusion, single-trial pre-puff beta phase locking predicts post-puff persistent activity (and affective eye closure) across participants; during ketamine it does not.
Criterion: per trial, beta PLV averaged over all edges between kept channels in the 0.5 s before the
puff; persistent activity the single-trial projection of beta power on the persistent weights,
averaged over 0.5 to 1.5 s; affective eye closure per trial from the behaviour file; mixed-effects
model with a random intercept per participant. Reproduced when both preinfusion coefficients are
positive with p < 0.05 and both infusion coefficients have p >= 0.05. The code z-scores the
single-trial projections over all trials and does not subtract each trial's pre-puff mean (the line
is commented out, compute_all_cd); the Methods describe a baseline subtraction over 0.5 to 0 s
before the puff for the projection. Both are run, with and without the code's per-trial 2-s baseline.
rows = []
for bad in ("code", "none"):
for wm_plv in (False, True):
for reading in ("code", "methods"):
for tb in (True, False):
for sub in (False, True):
df = ic.trial_table(RES, BEH, wm_plv, True, bad, reading, tb, sub)
for c in ("preinfusion", "infusion"):
d = df[df.cond == c]
for y in ("persistence", "eye"):
m = ic.mixed(d, f"{y} ~ plv", "plv")
rows.append(dict(bad_list=bad, plv_wm_kept=not wm_plv, open_c=reading, trial_baseline=tb,
prepuff_sub=sub, cond=c, outcome=y, **m))
T38H = pd.DataFrame(rows)
print(T38H.round(4).to_string())
key = ["bad_list", "plv_wm_kept", "open_c", "trial_baseline", "prepuff_sub"]
print()
for k, g in T38H.groupby(key):
g = g.set_index(["cond", "outcome"])
ok = all(g.loc[("preinfusion", y), "coef"] > 0 and g.loc[("preinfusion", y), "p"] < 0.05 for y in ("persistence", "eye")) and \
all(g.loc[("infusion", y), "p"] >= 0.05 for y in ("persistence", "eye"))
print(k, "criterion met:", ok)
prim = T38H[(T38H.bad_list == "code") & T38H.plv_wm_kept & (T38H.open_c == "code") & T38H.trial_baseline & T38H.prepuff_sub]
print("\nmain reading (code bad list, PLV over all kept channels, Open C code, trial baseline, pre-puff subtraction):")
print(prim[["cond", "outcome", "coef", "ci_low", "ci_high", "p", "n"]].round(4).to_string(index=False))
bad_list plv_wm_kept open_c trial_baseline prepuff_sub cond outcome coef ci_low ci_high p n converged
0 code True code True False preinfusion persistence 6.3023 -0.4400 13.0445 0.0669 214 True
1 code True code True False preinfusion eye 2.5746 0.8623 4.2870 0.0032 214 True
2 code True code True False infusion persistence 2.4938 -7.4668 12.4543 0.6236 214 True
3 code True code True False infusion eye 0.0291 -2.3012 2.3594 0.9805 214 True
4 code True code True True preinfusion persistence 12.3812 3.0851 21.6772 0.0090 214 True
5 code True code True True preinfusion eye 2.5746 0.8623 4.2870 0.0032 214 True
6 code True code True True infusion persistence -6.2118 -19.3087 6.8851 0.3526 214 True
7 code True code True True infusion eye 0.0291 -2.3012 2.3594 0.9805 214 True
8 code True code False False preinfusion persistence 2.8446 -3.1195 8.8087 0.3499 214 True
9 code True code False False preinfusion eye 2.5746 0.8623 4.2870 0.0032 214 True
10 code True code False False infusion persistence -0.2936 -6.3758 5.7885 0.9246 214 False
11 code True code False False infusion eye 0.0291 -2.3012 2.3594 0.9805 214 True
12 code True code False True preinfusion persistence 12.0431 2.8819 21.2043 0.0100 214 True
13 code True code False True preinfusion eye 2.5746 0.8623 4.2870 0.0032 214 True
14 code True code False True infusion persistence -6.0297 -19.0373 6.9779 0.3636 214 True
15 code True code False True infusion eye 0.0291 -2.3012 2.3594 0.9805 214 True
16 code True methods True False preinfusion persistence 6.5290 0.5920 12.4661 0.0311 214 False
17 code True methods True False preinfusion eye 2.5746 0.8623 4.2870 0.0032 214 True
18 code True methods True False infusion persistence 2.1936 -7.6256 12.0127 0.6615 214 True
19 code True methods True False infusion eye 0.0291 -2.3012 2.3594 0.9805 214 True
20 code True methods True True preinfusion persistence 10.1723 1.2978 19.0468 0.0247 214 True
21 code True methods True True preinfusion eye 2.5746 0.8623 4.2870 0.0032 214 True
22 code True methods True True infusion persistence -6.3462 -19.2023 6.5099 0.3333 214 True
23 code True methods True True infusion eye 0.0291 -2.3012 2.3594 0.9805 214 True
24 code True methods False False preinfusion persistence 3.1403 -2.7190 8.9996 0.2935 214 False
25 code True methods False False preinfusion eye 2.5746 0.8623 4.2870 0.0032 214 True
26 code True methods False False infusion persistence 0.5193 -5.9272 6.9659 0.8745 214 True
27 code True methods False False infusion eye 0.0291 -2.3012 2.3594 0.9805 214 True
28 code True methods False True preinfusion persistence 9.8103 0.5602 19.0605 0.0376 214 False
29 code True methods False True preinfusion eye 2.5746 0.8623 4.2870 0.0032 214 True
30 code True methods False True infusion persistence -3.8014 -13.8918 6.2891 0.4603 214 True
31 code True methods False True infusion eye 0.0291 -2.3012 2.3594 0.9805 214 True
32 code False code True False preinfusion persistence 6.0137 -0.7265 12.7538 0.0803 214 False
33 code False code True False preinfusion eye 2.4164 0.7560 4.0768 0.0043 214 True
34 code False code True False infusion persistence -0.4321 -9.9251 9.0609 0.9289 214 True
35 code False code True False infusion eye 0.0030 -2.2147 2.2208 0.9979 214 True
36 code False code True True preinfusion persistence 12.4755 3.2612 21.6899 0.0080 214 True
37 code False code True True preinfusion eye 2.4164 0.7560 4.0768 0.0043 214 True
38 code False code True True infusion persistence -11.4861 -23.8909 0.9186 0.0696 214 True
39 code False code True True infusion eye 0.0030 -2.2147 2.2208 0.9979 214 True
40 code False code False False preinfusion persistence 2.5283 -3.4444 8.5011 0.4067 214 True
41 code False code False False preinfusion eye 2.4164 0.7560 4.0768 0.0043 214 True
42 code False code False False infusion persistence 0.7828 -7.1713 8.7368 0.8471 214 True
43 code False code False False infusion eye 0.0030 -2.2147 2.2208 0.9979 214 True
44 code False code False True preinfusion persistence 11.9949 2.8855 21.1042 0.0099 214 True
45 code False code False True preinfusion eye 2.4164 0.7560 4.0768 0.0043 214 True
46 code False code False True infusion persistence -11.3328 -23.6531 0.9875 0.0714 214 True
47 code False code False True infusion eye 0.0030 -2.2147 2.2208 0.9979 214 True
48 code False methods True False preinfusion persistence 6.2331 0.4436 12.0226 0.0348 214 True
49 code False methods True False preinfusion eye 2.4164 0.7560 4.0768 0.0043 214 True
50 code False methods True False infusion persistence -0.1948 -9.5522 9.1626 0.9675 214 True
51 code False methods True False infusion eye 0.0030 -2.2147 2.2208 0.9979 214 True
52 code False methods True True preinfusion persistence 10.2626 1.3701 19.1551 0.0237 214 True
53 code False methods True True preinfusion eye 2.4164 0.7560 4.0768 0.0043 214 True
54 code False methods True True infusion persistence -7.6854 -17.2300 1.8591 0.1145 214 True
55 code False methods True True infusion eye 0.0030 -2.2147 2.2208 0.9979 214 True
56 code False methods False False preinfusion persistence 2.8026 -3.0321 8.6374 0.3465 214 True
57 code False methods False False preinfusion eye 2.4164 0.7560 4.0768 0.0043 214 True
58 code False methods False False infusion persistence 0.0987 -6.5945 6.7919 0.9769 214 True
59 code False methods False False infusion eye 0.0030 -2.2147 2.2208 0.9979 214 True
60 code False methods False True preinfusion persistence 9.6614 0.5207 18.8021 0.0383 214 True
61 code False methods False True preinfusion eye 2.4164 0.7560 4.0768 0.0043 214 True
62 code False methods False True infusion persistence -11.0081 -23.3320 1.3157 0.0800 214 True
63 code False methods False True infusion eye 0.0030 -2.2147 2.2208 0.9979 214 True
64 none True code True False preinfusion persistence 5.8668 -1.5528 13.2863 0.1212 214 True
65 none True code True False preinfusion eye 2.7465 0.9707 4.5222 0.0024 214 True
66 none True code True False infusion persistence 0.2224 -10.0502 10.4950 0.9662 214 True
67 none True code True False infusion eye 0.1866 -2.1529 2.5262 0.8757 214 True
68 none True code True True preinfusion persistence 11.6948 1.4822 21.9074 0.0248 214 True
69 none True code True True preinfusion eye 2.7465 0.9707 4.5222 0.0024 214 True
70 none True code True True infusion persistence -8.7785 -22.0129 4.4560 0.1936 214 True
71 none True code True True infusion eye 0.1866 -2.1529 2.5262 0.8757 214 True
72 none True code False False preinfusion persistence 2.5412 -3.6670 8.7494 0.4224 214 True
73 none True code False False preinfusion eye 2.7465 0.9707 4.5222 0.0024 214 True
74 none True code False False infusion persistence -2.8628 -9.2348 3.5092 0.3785 214 False
75 none True code False False infusion eye 0.1866 -2.1529 2.5262 0.8757 214 True
76 none True code False True preinfusion persistence 11.6511 1.5623 21.7399 0.0236 214 True
77 none True code False True preinfusion eye 2.7465 0.9707 4.5222 0.0024 214 True
78 none True code False True infusion persistence -8.4676 -21.6103 4.6751 0.2067 214 True
79 none True code False True infusion eye 0.1866 -2.1529 2.5262 0.8757 214 True
80 none True methods True False preinfusion persistence 6.5583 1.3332 11.7834 0.0139 214 False
81 none True methods True False preinfusion eye 2.7465 0.9707 4.5222 0.0024 214 True
82 none True methods True False infusion persistence 0.2320 -9.8599 10.3239 0.9641 214 True
83 none True methods True False infusion eye 0.1866 -2.1529 2.5262 0.8757 214 True
84 none True methods True True preinfusion persistence 10.2261 0.2319 20.2202 0.0449 214 True
85 none True methods True True preinfusion eye 2.7465 0.9707 4.5222 0.0024 214 True
86 none True methods True True infusion persistence -6.2004 -16.2099 3.8092 0.2247 214 True
87 none True methods True True infusion eye 0.1866 -2.1529 2.5262 0.8757 214 True
88 none True methods False False preinfusion persistence 3.3408 -2.3658 9.0475 0.2512 214 True
89 none True methods False False preinfusion eye 2.7465 0.9707 4.5222 0.0024 214 True
90 none True methods False False infusion persistence -1.6921 -8.3885 5.0043 0.6204 214 True
91 none True methods False False infusion eye 0.1866 -2.1529 2.5262 0.8757 214 True
92 none True methods False True preinfusion persistence 10.3555 0.2383 20.4728 0.0448 214 True
93 none True methods False True preinfusion eye 2.7465 0.9707 4.5222 0.0024 214 True
94 none True methods False True infusion persistence -5.9962 -16.1728 4.1804 0.2482 214 True
95 none True methods False True infusion eye 0.1866 -2.1529 2.5262 0.8757 214 True
96 none False code True False preinfusion persistence 5.4628 -1.9637 12.8892 0.1494 214 True
97 none False code True False preinfusion eye 2.6158 0.8828 4.3488 0.0031 214 True
98 none False code True False infusion persistence -3.1927 -11.2096 4.8242 0.4351 214 False
99 none False code True False infusion eye 0.1366 -2.0620 2.3351 0.9031 214 True
100 none False code True True preinfusion persistence 11.0938 1.0731 21.1144 0.0300 214 True
101 none False code True True preinfusion eye 2.6158 0.8828 4.3488 0.0031 214 True
102 none False code True True infusion persistence -11.2023 -21.0280 -1.3765 0.0254 214 True
103 none False code True True infusion eye 0.1366 -2.0620 2.3351 0.9031 214 True
104 none False code False False preinfusion persistence 2.5678 -3.7244 8.8599 0.4238 214 True
105 none False code False False preinfusion eye 2.6158 0.8828 4.3488 0.0031 214 True
106 none False code False False infusion persistence -2.7295 -9.1584 3.6994 0.4053 214 True
107 none False code False False infusion eye 0.1366 -2.0620 2.3351 0.9031 214 True
108 none False code False True preinfusion persistence 11.2849 1.2301 21.3397 0.0278 214 False
109 none False code False True preinfusion eye 2.6158 0.8828 4.3488 0.0031 214 True
110 none False code False True infusion persistence -13.9794 -26.2389 -1.7199 0.0254 214 True
111 none False code False True infusion eye 0.1366 -2.0620 2.3351 0.9031 214 True
112 none False methods True False preinfusion persistence 6.1718 0.8208 11.5228 0.0238 214 True
113 none False methods True False preinfusion eye 2.6158 0.8828 4.3488 0.0031 214 True
114 none False methods True False infusion persistence -1.7157 -9.6466 6.2151 0.6716 214 True
115 none False methods True False infusion eye 0.1366 -2.0620 2.3351 0.9031 214 True
116 none False methods True True preinfusion persistence 9.6106 -0.2163 19.4376 0.0553 214 True
117 none False methods True True preinfusion eye 2.6158 0.8828 4.3488 0.0031 214 True
118 none False methods True True infusion persistence -13.6028 -25.6869 -1.5187 0.0274 214 True
119 none False methods True True infusion eye 0.1366 -2.0620 2.3351 0.9031 214 True
120 none False methods False False preinfusion persistence 3.3518 -2.2748 8.9784 0.2430 214 False
121 none False methods False False preinfusion eye 2.6158 0.8828 4.3488 0.0031 214 True
122 none False methods False False infusion persistence -1.3232 -8.0487 5.4024 0.6998 214 False
123 none False methods False False infusion eye 0.1366 -2.0620 2.3351 0.9031 214 True
124 none False methods False True preinfusion persistence 9.6487 -0.3163 19.6138 0.0577 214 True
125 none False methods False True preinfusion eye 2.6158 0.8828 4.3488 0.0031 214 True
126 none False methods False True infusion persistence -13.5301 -25.7906 -1.2695 0.0305 214 True
127 none False methods False True infusion eye 0.1366 -2.0620 2.3351 0.9031 214 True
('code', np.False_, 'code', np.False_, np.False_) criterion met: False
('code', np.False_, 'code', np.False_, np.True_) criterion met: True
('code', np.False_, 'code', np.True_, np.False_) criterion met: False
('code', np.False_, 'code', np.True_, np.True_) criterion met: True
('code', np.False_, 'methods', np.False_, np.False_) criterion met: False
('code', np.False_, 'methods', np.False_, np.True_) criterion met: True
('code', np.False_, 'methods', np.True_, np.False_) criterion met: True
('code', np.False_, 'methods', np.True_, np.True_) criterion met: True
('code', np.True_, 'code', np.False_, np.False_) criterion met: False
('code', np.True_, 'code', np.False_, np.True_) criterion met: True
('code', np.True_, 'code', np.True_, np.False_) criterion met: False
('code', np.True_, 'code', np.True_, np.True_) criterion met: True
('code', np.True_, 'methods', np.False_, np.False_) criterion met: False
('code', np.True_, 'methods', np.False_, np.True_) criterion met: True
('code', np.True_, 'methods', np.True_, np.False_) criterion met: True
('code', np.True_, 'methods', np.True_, np.True_) criterion met: True
('none', np.False_, 'code', np.False_, np.False_) criterion met: False
('none', np.False_, 'code', np.False_, np.True_) criterion met: False
('none', np.False_, 'code', np.True_, np.False_) criterion met: False
('none', np.False_, 'code', np.True_, np.True_) criterion met: False
('none', np.False_, 'methods', np.False_, np.False_) criterion met: False
('none', np.False_, 'methods', np.False_, np.True_) criterion met: False
('none', np.False_, 'methods', np.True_, np.False_) criterion met: True
('none', np.False_, 'methods', np.True_, np.True_) criterion met: False
('none', np.True_, 'code', np.False_, np.False_) criterion met: False
('none', np.True_, 'code', np.False_, np.True_) criterion met: True
('none', np.True_, 'code', np.True_, np.False_) criterion met: False
('none', np.True_, 'code', np.True_, np.True_) criterion met: True
('none', np.True_, 'methods', np.False_, np.False_) criterion met: False
('none', np.True_, 'methods', np.False_, np.True_) criterion met: True
('none', np.True_, 'methods', np.True_, np.False_) criterion met: True
('none', np.True_, 'methods', np.True_, np.True_) criterion met: True
main reading (code bad list, PLV over all kept channels, Open C code, trial baseline, pre-puff subtraction):
cond outcome coef ci_low ci_high p n
preinfusion persistence 12.3812 3.0851 21.6772 0.0090 214
preinfusion eye 2.5746 0.8623 4.2870 0.0032 214
infusion persistence -6.2118 -19.3087 6.8851 0.3526 214
infusion eye 0.0291 -2.3012 2.3594 0.9805 214
Result: reproduced, resting on the per-trial pre-puff subtraction. In the main reading (214 trials of 7 participants) pre-puff beta phase locking predicts persistent activity before infusion (coefficient 12.38, 95% CI 3.09 to 21.68, p = 0.009; the paper 12.12, p = 0.0006) and affective eye closure (2.57, p = 0.003; the paper 3.35), and neither during ketamine (p = 0.35 and 0.98). Eye closure behaves this way in every reading. For persistent activity the criterion depends on the readings: with the code's bad-channel list it is met in all 8 readings that subtract each trial's mean over 0.5 to 0 s before the puff and in 2 of the 8 that do not; without the code's list, in 4 of 8 and 2 of 8. Without the subtraction (the code's line is commented out) the preinfusion coefficient is mostly between 2.5 and 6 with p >= 0.05. The subtraction is adopted because the Methods describe this baseline step for the projection and it gives the paper's coefficient.
ieeg-channel-atlas-link¶
Link claim (added by this attempt): the Yeo7 labels of the code record's anat/pts_ch_labels.pkl
match the dataset's channels by participant and contact label, and the record's region label of
each contact agrees with the dataset's electrode location.
rows = []
for pt in ic.PARTICIPANTS:
pr = RES[pt]["pairs"]
mono = dict(zip(LABELS["pt_elec_names_mono"][pt], LABELS["pt_elec_anats_mono"][pt]))
contacts = pd.concat([pr[["a", "loc_a"]].set_axis(["contact", "region"], axis=1),
pr[["b", "loc_b"]].set_axis(["contact", "region"], axis=1)]).drop_duplicates("contact")
found = contacts.contact.isin(list(mono))
agree = np.mean([str(mono[c]) == r for c, r in zip(contacts.contact[found], contacts.region[found])])
bip = set(LABELS["pt_elec_names_bipo"][pt])
rows.append(dict(pt=pt, contacts=len(contacts), contacts_matched=found.mean(), region_agreement=agree,
bipolar_pairs=len(pr), pairs_matched=pr.name.isin(bip).mean()))
LINK = pd.DataFrame(rows)
print(LINK.round(3).to_string(index=False))
print("all contacts and pairs matched:", bool((LINK.contacts_matched == 1).all() and (LINK.pairs_matched == 1).all()),
"| minimum region agreement:", round(LINK.region_agreement.min(), 3))
pt contacts contacts_matched region_agreement bipolar_pairs pairs_matched SD168 168 1.0 1.0 154 1.0 SD172 174 1.0 1.0 162 1.0 SD181 122 1.0 1.0 113 1.0 SD185 116 1.0 1.0 106 1.0 SD186 88 1.0 1.0 81 1.0 SD211 112 1.0 1.0 105 1.0 SD245 206 1.0 1.0 190 1.0 all contacts and pairs matched: True | minimum region agreement: 1.0
Result: the link holds. Every contact and every within-shank bipolar pair of the 7 participants
is found in the code record's label file under the same name, and the record's region label agrees
with the dataset's location for the fraction of contacts printed above.
figs35-persistent-dimension-distributed¶
Participation in the human persistent dimension is spread uniformly across Yeo7 networks, whereas the fast dimension is over-represented in the somatomotor network.
Criterion: absolute weights divided by each participant's maximum; per Yeo7 network the median; the labels shuffled across channels 1000 times, two-sided percentile p, BH across networks. Persistent: reproduced when no network has corrected p < 0.05; fast: reproduced when somatomotor is over-represented with corrected p < 0.05. Channels with a mixed or 'Depth' label take part in the shuffle but belong to no network (as in the code).
print("expected:", expected("figs35-persistent-dimension-distributed"))
for bad in ("code", "none"):
for window in ("persistent", "fast"):
df = ic.yeo_table(RES, LABELS, window, True, bad)
out = ic.yeo_shuffle(df, seed=1)
print(f"\n{window}, bad list {bad}: {len(df)} channels, {int(df.yeo7.isin(ic.YEO7).sum())} with a single Yeo7 label, "
f"unmatched {int((df.yeo7 == 'unmatched').sum())}")
print(out.round(3).to_string(index=False))
expected: [('fast participation, somatomotor, mean', 0.446, 0.045), ('persistent participation, frontoparietal, mean', 0.35, 0.037)]
persistent, bad list code: 570 channels, 275 with a single Yeo7 label, unmatched 0
network n median mean sem shuffle_2.5 shuffle_97.5 p p_bh
Default 87 0.242 0.276 0.022 0.199 0.298 0.818 0.998
Dorsal Attention 18 0.292 0.356 0.060 0.139 0.403 0.446 0.998
Frontoparietal 23 0.350 0.339 0.037 0.149 0.385 0.114 0.684
Limbic 34 0.233 0.284 0.035 0.162 0.349 0.758 0.998
Somatomotor 50 0.253 0.329 0.030 0.183 0.324 0.924 0.998
Ventral Attention 63 0.246 0.315 0.032 0.188 0.307 0.998 0.998
fast, bad list code: 570 channels, 275 with a single Yeo7 label, unmatched 0
network n median mean sem shuffle_2.5 shuffle_97.5 p p_bh
Default 87 0.123 0.162 0.015 0.121 0.199 0.064 0.077
Dorsal Attention 18 0.080 0.133 0.027 0.082 0.272 0.038 0.072
Frontoparietal 23 0.070 0.130 0.027 0.094 0.261 0.010 0.030
Limbic 34 0.115 0.126 0.018 0.104 0.237 0.120 0.120
Somatomotor 50 0.446 0.437 0.045 0.111 0.219 0.000 0.000
Ventral Attention 63 0.209 0.307 0.032 0.116 0.209 0.048 0.072
persistent, bad list none: 617 channels, 289 with a single Yeo7 label, unmatched 0
network n median mean sem shuffle_2.5 shuffle_97.5 p p_bh
Default 94 0.239 0.270 0.020 0.193 0.294 0.948 0.948
Dorsal Attention 21 0.286 0.368 0.059 0.152 0.375 0.532 0.948
Frontoparietal 23 0.350 0.339 0.037 0.153 0.359 0.086 0.516
Limbic 34 0.233 0.281 0.035 0.165 0.349 0.852 0.948
Somatomotor 50 0.248 0.320 0.029 0.176 0.330 0.866 0.948
Ventral Attention 67 0.255 0.333 0.034 0.181 0.307 0.662 0.948
fast, bad list none: 617 channels, 289 with a single Yeo7 label, unmatched 0
network n median mean sem shuffle_2.5 shuffle_97.5 p p_bh
Default 94 0.126 0.161 0.013 0.120 0.187 0.126 0.126
Dorsal Attention 21 0.080 0.136 0.024 0.080 0.236 0.046 0.092
Frontoparietal 23 0.070 0.105 0.018 0.088 0.245 0.012 0.036
Limbic 34 0.108 0.122 0.017 0.100 0.213 0.100 0.120
Somatomotor 50 0.404 0.434 0.045 0.108 0.199 0.000 0.000
Ventral Attention 67 0.193 0.271 0.026 0.113 0.195 0.064 0.096
Result: reproduced. With the code's readings the channel counts per network are 87, 18, 23, 34, 50 and 63 (the paper: 88, 18, 23, 34, 50, 63). No network deviates in the persistent dimension (smallest BH-corrected p 0.68 with the code's bad-channel list, 0.52 without), and in the fast dimension the somatomotor median (0.446 with the code's list, the paper's 0.446) exceeds every shuffle (corrected p = 0). The persistent frontoparietal median is 0.35, the paper's value (the claims file's expected values are medians, the measure the legend names).
figs37a-beta-most-similar-to-mouse¶
Of the human frequency bands, the beta band power persistent projection is the most similar (highest correlation) to the mouse firing-rate persistent projection.
Criterion: Pearson correlation between the mean preinfusion persistent projection across
participants for each human band and the mean preinfusion mouse persistent projection across
sessions, over a shared peri-puff time axis from 0.5 s before to 1.5 s after the puff. The mouse
projection is computed with mouse_npx.py of this entry (Methods, Coding dimension, mouse
peri-puff; 13 sessions of DANDI:001326): weights from 0.5 to 1 s against the 1 s before each puff
over puff-modulated cells, projection of the preinfusion epoch average, z-scored over its 3-s window
with the 1 s before the puff subtracted. The mouse trace has 10-ms bins, so the human trace is
averaged into the same 10-ms bins.
import mouse_npx
t = time.time()
MOUSE = []
for p in mouse_npx.npx_paths():
R = mouse_npx.process_session(p)
MOUSE.append({(var, first): mouse_npx.persist_projection(R, var=var, first_only=first)["pre"]
for var in ("M", "C") for first in (True, False)} | {"path": p, "n_sel": R["n_sel"]})
del R
print(f"{len(MOUSE)} mouse sessions in {time.time() - t:.0f} s; selected cells per session:",
[m["n_sel"] for m in MOUSE])
mt = np.arange(300) * 0.01 - 1.0 # mouse bin starts, s from the puff
sel = (mt >= -0.5 - 1e-9) & (mt < 1.5 - 1e-9)
rows = []
for open_c in ("code", "methods"):
for wm in (True, False):
human = {}
for band in ic.BANDS:
tr = ic.cd_summary(RES, ALT, band, "persistent", wm, "code", True, open_c, traces=True)["preinfusion"].mean(0)
tt = ic.TT - 0.05 if open_c == "code" else ic.TT
# average the 5-ms human samples into the mouse's 10-ms bins
human[band] = np.array([tr[(tt >= a - 1e-9) & (tt < a + 0.01 - 1e-9)].mean() for a in mt[sel]])
for var in ("M", "C"):
for first in (True, False):
mouse = np.mean([m[(var, first)] for m in MOUSE], axis=0)[sel]
r = {band: st.pearsonr(human[band], mouse)[0] for band in ic.BANDS}
best = max(r, key=r.get)
rows.append(dict(open_c=open_c, wm_excluded=wm, mouse_var=var, mouse_first_puff=first,
best=best, **{k: round(v, 3) for k, v in r.items()}))
T37A = pd.DataFrame(rows)
print(T37A.to_string(index=False))
print("readings where beta has the highest correlation:", int((T37A.best == "beta").sum()), "of", len(T37A))
13 mouse sessions in 162 s; selected cells per session: [754, 404, 621, 451, 310, 579, 649, 65, 378, 415, 638, 670, 619] open_c wm_excluded mouse_var mouse_first_puff best delta theta alpha beta low gamma high gamma broadband code True M True beta 0.580 0.464 0.617 0.901 0.769 0.657 0.894 code True M False broadband 0.524 0.387 0.557 0.848 0.717 0.644 0.854 code True C True beta 0.509 0.385 0.546 0.889 0.797 0.711 0.871 code True C False beta 0.447 0.304 0.480 0.831 0.745 0.700 0.824 code False M True broadband 0.469 0.459 0.637 0.899 0.730 0.588 0.901 code False M False broadband 0.415 0.384 0.580 0.851 0.679 0.583 0.862 code False C True beta 0.392 0.382 0.567 0.889 0.760 0.649 0.885 code False C False broadband 0.333 0.303 0.504 0.836 0.709 0.645 0.840 methods True M True beta 0.433 0.311 0.470 0.870 0.834 0.757 0.838 methods True M False beta 0.379 0.237 0.409 0.802 0.778 0.727 0.779 methods True C True low gamma 0.355 0.229 0.391 0.847 0.852 0.784 0.799 methods True C False low gamma 0.293 0.149 0.323 0.775 0.796 0.757 0.734 methods False M True beta 0.303 0.296 0.490 0.872 0.803 0.698 0.857 methods False M False beta 0.252 0.222 0.431 0.810 0.748 0.673 0.799 methods False C True beta 0.221 0.212 0.412 0.852 0.826 0.731 0.823 methods False C False beta 0.164 0.133 0.346 0.787 0.771 0.708 0.760 readings where beta has the highest correlation: 10 of 16
Result: reproduced, resting on the human readings of fig6c and the first-puff mouse projection. With the human readings that reproduce fig6c (Open C b, white matter excluded) and the mouse persistent projection of the first puff of each series (the mouse code's choice), beta has the highest correlation with the mouse trace (0.901 with per-neuron variances, 0.889 with the pooled variance), ahead of broadband (0.894 and 0.871). The margin over broadband is small, and beta is highest in 10 of the 16 readings: broadband is highest in 4 (all-puff mouse average, or white matter kept with per-neuron variances) and low gamma in 2 (Methods z-scoring with pooled variance). All 13 sessions of DANDI:001326 were used; the paper does not say which sessions enter this comparison. The correlation does not depend on how either trace is z-scored, only on its time course.
Summary¶
| Claim | Outcome | Key numbers |
|---|---|---|
| fig6c-human-persistent-activity-reduced | reproduced | 1.363, 0.411, 0.724; t = 5.876 and 3.172 (code readings) |
| fig6e-human-fast-activity-unchanged | reproduced (assumed Open C b) | 4.120, 4.006, 3.866; t = 0.433, p = 0.680; fails under Open C a with the code's list (post vs ket p = 0.029 to 0.039) |
| figs37c-persistent-reduction-across-bands | reproduced (assumed Open D a) | all filtered bands significant, broadband p = 0.078 |
| figs37b-fast-unchanged-across-bands | reproduced (assumed Open C b) | no corrected p < 0.05 under Open C b; under Open C a low gamma p = 0.020 to 0.049, beta post vs ket p = 0.034 and 0.039 |
| fig6g-human-timescale-shorter | reproduced | 0.115 s and 0.092 s, t = 4.78, p = 0.003 |
| fig6i-human-coupling-reduced | partially reproduced | ratio 0.960 (p = 0.030), outside 0.979 ± 0.0061 in every reading, also with 2.5-s and 1-s strides |
| figs38a-baseline-coupling-not-different | not reproduced (per-band weights, criterion); holds with beta weights (code) | no band differs in 20 of 20 beta-weight readings; with per-band weights at least one band differs in 40 of 44 readings, theta and alpha both in 38; no reading gives 716 edges |
| figs38b-ketamine-coupling-loss-larger-at-persistent-sites | partially reproduced | beta -0.045 (z) within tolerance; full criterion in 3 of 64 readings (code bands, white matter kept, no bad list) |
| figs38h-prepuff-coupling-predicts-persistence | reproduced (assumed pre-puff subtraction) | 12.38 (p = 0.009) before, p = 0.35 during ketamine |
| ieeg-channel-atlas-link | holds | all contacts and pairs matched |
| figs35-persistent-dimension-distributed | reproduced | somatomotor fast median 0.446 |
| figs37a-beta-most-similar-to-mouse | reproduced (assumed readings) | beta r = 0.901, broadband 0.894; beta highest in 10 of 16 readings |
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.
Differences from the paper's method: the bad-channel list is read from the code record, as the dataset does not mark bad channels, and every claim is also shown without it; bipolar pairs are formed within each electrode group; the 60-Hz notch uses Q = 20 (Methods) where the code uses 30; the phase-locking windows are the 10 min before each eyepuff session (Table S3), as the 25-min windows of the Methods are not in the dataset; the 5-s PLV windows do not overlap in the main reading (the Methods' "sliding" windows have no stated stride; strides of 2.5 s and 1 s are shown); periods of epileptic or sleep activity are not excluded; the fig. S38 edge sets are formed here, while the code reads them from a precomputed file, and none of the selections tried gives the paper's 716 edges; the figs38a absence holds only when sites are sorted by beta weights (code comment) where the fig. S38B legend says per-band weights.
About the dataset: bad channels and Yeo7 labels are not in it; the TTL channel is named 'CCEP'; the LFP unit attribute says volts while the values are digitiser units with a scale factor in a comment; the electrode coordinates are all NaN; SD245's coding-dimension preinfusion is its Baseline file in the code, though a Preinfusion file exists.
print(f"notebook run time {(time.time() - T0) / 60:.1f} min")
notebook run time 13.5 min