Reproducing Schapiro et al. (2024) from Dryad dataset 1rn8pk129¶

Paper. Schapiro KA, Rittenberg JD, Kenngott M, Marder E (2024). Ih block reveals separation of timescales in pyloric rhythm response to temperature changes in Cancer borealis. eLife 13:RP98844. doi:10.7554/elife.98844. The claims file was written from the version of record (full text from Europe PMC, PMC11479588), with its Methods, figure legends, Figure 1-figure supplement 1 and Table 1.

Dataset. DRYAD:1rn8pk129, "Data from: Effects of Cs on temperature response of C. borealis pyloric rhythm", version id 310115 (published 2024-08-09). The paper cites the dataset's DOI, which always resolves to the newest version, and no version. Two versions are published: 290160 (2024-04-23) and 310115. 310115 is the newest, and it is the one that matches the paper as published: its README and analysis script add the voltage-clamp cells of the revision (Figure 1-figure supplement 1 and the Ih numbers of the version of record), and only VoltageClampData.mat, VoltageClampTraceData.mat (new), MakePaperFigures_Clean.m and README.md differ between the two (same SHA-256 for every other file, from the public file lists). The files are staged from Dryad, checked against their SHA-256, and read in place (docs/archives.md, "Dryad"); the digest of each file read is printed below.

Code. The dataset holds the paper's MATLAB code (MakePaperFigures_Clean.m, CalculateFrequencyPhaseEtc.m, extractBurstFrequency_Final.m, Phase_Calc.m, ProbabilityUpDown.m). The helper pyloric.py ports the parts used here; its docstring says where each parameter comes from.

Claims.

Claim Tested
figs1-ih-reduced-11c, figs1-ih-reduced-21c blocked (data missing): VoltageClampData.mat holds one trial per experiment, no Cs+ trial
fig1-cs-lower-frequency-11c, fig1d-difference-grows-with-temperature, fig1e-q10-lower-in-cs tested
fig1f-two-saline-frequency-change-same tested on the deposited per-experiment table (spike data of 5 of 6 control experiments are not deposited)
fig1e-two-saline-q10-same, fig1e-saline-q10-same-across-designs blocked (data missing): the criterion's Q10 reading cannot be computed without the control experiments' spike data
fig2c-decrease-by-depolarizing-phase tested on the experiments with intracellular PD traces and spike times; the Cs+ + PTX example on its raw trace
fig3d, fig3e, fig4c, fig4d, fig4e tested
fig5b, table1 (four claims), fig5d, lp-duty-cycle-preserved, matched-period-lp-earlier tested
fig6a (three claims) tested
In [1]:
import time
import warnings
import resource

import numpy as np
import pandas as pd
from scipy import stats

import pyloric as P

warnings.filterwarnings("ignore", category=RuntimeWarning)
pd.set_option("display.width", 220)
pd.set_option("display.max_columns", 40)
pd.set_option("display.max_rows", 200)
np.set_printoptions(precision=3, suppress=True, linewidth=200)
started = time.time()

S = P.load_mat("SummaryStatistics.mat")
EXPTS = ["_".join(str(np.ravel(x)[0]).split("_")[1:3]) for x in np.ravel(S["files"]["name"])]
PTX_EXPTS = ["969_147", "969_150", "969_152", "969_154", "981_035"]
spike_files = sorted(p.name for p in P.DATA_DIR.glob("*_SpikeAndTemp.mat"))
A = {f.split("_Spike")[0]: P.analyse(f.split("_Spike")[0]) for f in spike_files}
A["981_035_PD2"] = P.analyse("981_035", pd_key="PD2")
print(f"{len(spike_files)} SpikeAndTemp files analysed in {time.time() - started:.0f} s; "
      f"peak memory {resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6:.2f} GB")
print("The 21 saline/Cs+ experiments of SummaryStatistics.mat:", EXPTS)
24 SpikeAndTemp files analysed in 37 s; peak memory 0.45 GB
The 21 saline/Cs+ experiments of SummaryStatistics.mat: ['965_106', '969_058', '969_062', '969_065', '969_068', '969_070', '969_083', '969_085', '969_087', '969_088', '969_089', '969_091', '969_106', '969_113', '969_115', '969_128', '969_135', '969_147', '969_150', '969_152', '981_010']
In [2]:
# SHA-256 of every file this notebook reads (the public file list of version 310115 gives the same).
read = spike_files + ["SummaryStatistics.mat", "SummaryStatisticsPTX.mat", "Sawtooth.mat", "SawtoothPTX.mat",
                      "LPAdvanceSamePeriod.mat", "VoltageClampData.mat", "VoltageClampTraceData.mat",
                      "MakePaperFigures_Clean.m"] + [f"Raw_Expt_{e}.mat" for e in ("969_087", "969_113", "969_115", "969_137", "969_147", "981_007", "981_037")]
for f in read:
    print(f"{P.sha256(P.DATA_DIR / f)}  {f}")
dc5c26d9e8c9139c3d85bb0721cc1b534a2b6061360e6785a0317b99ddc07153  965_106_SpikeAndTemp.mat
3537c339090bd978e7b36d38243b6515c4bce80cf0e452fd4161d3d962ba1481  969_058_SpikeAndTemp.mat
1cf80dd0033f2b661d20b3076dbd1747cda6046d1374e5f1f3ae2951092de671  969_062_SpikeAndTemp.mat
8b3d0d8ab37917e6ca1476089c88be0f746e23395650dc933687807acb4ce0ee  969_065_SpikeAndTemp.mat
c0db93d1a2e61ad91d16c8f74cbedf283188c42e84bc7bc7d2d50877cae4205e  969_068_SpikeAndTemp.mat
d43d5e1b0b10ce4fef17be5a1464d3f4ae85f327043c244a4b7af0c8ad234071  969_070_SpikeAndTemp.mat
0e09326b796ed9cfecb056a4fc6063b4dc19563190e0487d655ab2ed7e0cf9c4  969_083_SpikeAndTemp.mat
ab98c42feeae91e7feef8b99c9601830d9acefadd730d4685163ff0b69e46d55  969_085_SpikeAndTemp.mat
fc77a97f5b948d6080c3a7cf232620bb1391582e0434673c0773e0fa56c27a68  969_087_SpikeAndTemp.mat
0e0f0d860a9e0de09fff93a248b7c7d2e27871d50ba3d5658b85148359a5bb50  969_088_SpikeAndTemp.mat
2ae7fc8be16b585e31ef742bfda9ab7eb388074071734da32415c1081e76b77a  969_089_SpikeAndTemp.mat
113978eac595193f30dabfa5603733fad594eacc4067066d58372c5d1e432f3f  969_091_SpikeAndTemp.mat
997685e1c1b748e64a62736c1e20d00473afa0388e54b55f2cba49b1cab55609  969_106_SpikeAndTemp.mat
e1048f2f6b36b8abe96783ee5bf5a548c871f67bcf7f9222c49703117f85127a  969_113_SpikeAndTemp.mat
431b8d3132896dd46de6012a24b832b8d121abd11a6f01f22a242f7dff975812  969_115_SpikeAndTemp.mat
361a9428ed8ea3be03c89866d144314d2da2f0cc4960f48b3a5ac2ff0bdadf3d  969_128_SpikeAndTemp.mat
a05fe3465425beb17fbcff41e20276bcb00f70965cd633c62c94e35ef8b9e881  969_135_SpikeAndTemp.mat
ca24cc96526a64aa13f844477ccaf4e95898b1de80e02eb347f3a13ad17de334  969_147_SpikeAndTemp.mat
6fb0b352b622b7f5984fc9e2c706a2e1afac428592df2065ad2a3aa1b9c55e9b  969_150_SpikeAndTemp.mat
a5aaf400d7a7b160e06069848a3b960f78d335cf87d5a747e4c71e6bae61a35c  969_152_SpikeAndTemp.mat
50eeaea07b02b3dc6f4b037453fb2c8d3515444f5cae7388964d69acf6e160e7  969_154_SpikeAndTemp.mat
16a99c487981f7d6d9176ad50a37ffe998dbd810cf2ab7f5a0d91ab393f026a8  981_010_SpikeAndTemp.mat
d7cdd1a5186ff6a976d53c258544708cb78fe46019d05bad1046d9ec7f2de7ca  981_025_SpikeAndTemp.mat
8a8893ddf0e8bfd4cea3632f7436b27ac4286c7e7738d0ddf5e8773fcf6eeb8c  981_035_SpikeAndTemp.mat
6b5566f7d76f031da7928662a801e1969e54bf90ba46b4748ce03707fdab19c0  SummaryStatistics.mat
b7afbab9b8f22358fc34b17a76033eb409be38c264e2ba97561cbf4424ed8ba5  SummaryStatisticsPTX.mat
c38d4b234f6720fcabf3eca3893f133d3d27c18b8a82826fa32c5c499716b615  Sawtooth.mat
48f0ca0bb4e4c0013f6fd4f2078fbb6d548a0a33bec710d484bdd5bed81e0746  SawtoothPTX.mat
81c507df31583aba0ab39d73db6aabbdcc738912e58374d4fe98ccbeaec9d1f6  LPAdvanceSamePeriod.mat
e696381152fd8459476a182ab9792ee28690518c0446dc6837e3dd53f19ad099  VoltageClampData.mat
bd7b79ee54bbf5189d679dafbe48e60a829e34d42005e5cdef4f628929f5e05f  VoltageClampTraceData.mat
cdc06a95301a10bed7511bf49fd8e4b352a414ef3608cd3d5db818962c3a3738  MakePaperFigures_Clean.m
b5eb59da0368b2bab6a8dcfccec1107d5c8d10d0ecd3e4ee6b58cd566852bf73  Raw_Expt_969_087.mat
fe8546616120dc83fbcc3f2163fe58c3ba859890191e7537752a3c74d6cac071  Raw_Expt_969_113.mat
24fdcee1ae56595cb8397e014ba2a311fef27594c9334044a924b35b28899e5f  Raw_Expt_969_115.mat
7bb4c6ad67c837af97a13e748a27035f11a6c6ec90b828fb2ff40a06ec43c75f  Raw_Expt_969_137.mat
2a5c80d562375608611ed17e32e4b7a2b59b71d59e5d282635a1c1832016aeb4  Raw_Expt_969_147.mat
6c40d1d6d30b956e65c852dd1b666c81c9a69a8b51100cad76d7ff27c5dbaa9a  Raw_Expt_981_007.mat
c5a9b12eebf67cd390e89b78b2cad5f1e190086b42cb8e2f9458c0e8d9121702  Raw_Expt_981_037.mat

Data check¶

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

In [3]:
rows = []
for e, d in A.items():
    c = d["cycles"]
    rows.append({"expt": e, "in_21": e in EXPTS, "PTX": e.split("_PD2")[0] in PTX_EXPTS,
                 "PD": len(d["PD2" if e.endswith("PD2") else "PD"]), "LP": len(d.get("LP", [])), "PY": len(d.get("PY", [])),
                 "spikes_end_min": round(d["PD"][-1] / 60, 1), "files": len(d["fileTimes"]),
                 "fileTimes_end_min": round(d["fileTimes"][-1] / 60, 1), "x_sub_end_min": round(d["x_sub"].max(), 1),
                 "Tempsub_dt_s": round(np.median(np.diff(d["x_sub"][:1000])) * 60, 3),
                 "Tempsub_min": round(np.nanmin(d["Tempsub"]), 1), "Tempsub_max": round(np.nanmax(d["Tempsub"]), 1),
                 "n_below_5C": int(np.sum(d["Tempsub"] < 5)), "cycles": len(c["freq"]),
                 "conditions": "; ".join(f"{k} {v[0].tolist()}-{v[1].tolist()}" for k, v in d["Timings"].items())})
info = pd.DataFrame(rows)
print(info.to_string(index=False))
print("\nExperiments with LP spikes:", int((info[info.in_21].LP > 0).sum()), "of 21; with PY spikes:",
      int((info[info.in_21].PY > 0).sum()), "of 21")
       expt  in_21   PTX     PD     LP     PY  spikes_end_min  files  fileTimes_end_min  x_sub_end_min  Tempsub_dt_s  Tempsub_min  Tempsub_max  n_below_5C  cycles                                                                                                                                      conditions
    965_106   True False  55968  85022      0           110.0     57              110.0          109.0          0.02          9.9         21.3           0    6996                                                                                                                   Saline [0]-[13]; Cs [32]-[46]
    969_058   True False 128255  91753      0           150.3     77              151.1          149.6          0.02         10.8         25.2           0   12642                                                                                                                   Saline [0]-[21]; Cs [43]-[56]
    969_062   True False  49374  40473 115175            95.5     49               95.5           93.5          0.02         10.4         21.8           0    6420                                                                                                                   Saline [0]-[13]; Cs [25]-[37]
    969_065   True False 107166  64717  64358           150.0     76              150.0          148.0          0.02         10.9         26.5           0   12372                                                                                                                   Saline [0]-[16]; Cs [37]-[53]
    969_068   True False 131058  90130  97514           200.3    103              200.3          200.1          0.02         10.1         25.3           0   15906                                                                                                                  Saline [59]-[82]; Cs [11]-[43]
    969_070   True False 123717  46836      0           139.5     71              139.6          137.8          0.02         -8.9         21.5         704   10876                                                                                                                   Saline [48]-[63]; Cs [8]-[30]
    969_083   True False  80812  76354      0           139.6     74              146.0          174.0          0.02         10.7         25.6           0    8416                                                                                                                   Saline [3]-[17]; Cs [29]-[43]
    969_085   True False 172645 112887  48449           128.0     65              128.0          126.0          0.02         10.6         25.3           0    9486                                                                                                                   Saline [2]-[17]; Cs [30]-[44]
    969_087   True False  89061  75322 235622           123.4     63              123.4          121.7          0.02         -9.2         31.6        3497    9183                                                                                                                   Saline [30]-[47]; Cs [3]-[21]
    969_088   True False  82134 115023  14815           136.0     69              136.0          134.0          0.02          6.4         25.3           0   12453                                                                                                                   Saline [4]-[22]; Cs [33]-[52]
    969_089   True False  77465  66259      0           149.6     76              149.6          147.8          0.02        -46.7         23.2           1    8184                                                                                                                  Saline [50]-[67]; Cs [14]-[32]
    969_091   True False  70886  52945  89695           126.2     66              126.2          126.1          0.02          6.8         23.4           0   10136                                                                                                                  Saline [41]-[58]; Cs [10]-[27]
    969_106   True False  76643  64980      0           218.1    111              218.1          216.1          0.02         10.5         23.3           0    9686                                                                                                                   Saline [0]-[18]; Cs [31]-[43]
    969_113   True False 105134  62590  72633           141.6     72              141.6          139.6          0.02         10.4         21.1           0   10617                                                                                                                  Saline [54]-[64]; Cs [31]-[42]
    969_115   True False  42902  54738  21892           134.0     68              134.0          132.0          0.02         10.5         21.1           0    9294                                                                                                                  Saline [52]-[62]; Cs [13]-[24]
    969_128   True False  40995  71465      0           116.0     59              116.0          114.0          0.02         10.6         20.5           0    5812                                                                                                                  Saline [46]-[55]; Cs [18]-[31]
    969_135   True False  69807  89946 158925           130.0     66              130.0          128.0          0.02         10.5         23.5           0    9503                                                                                                                  Saline [47]-[58]; Cs [14]-[27]
    969_147   True  True 246984 143281  77790           192.0     97              192.0          190.0          0.02         10.6         21.4           0   11922                                  Saline [1]-[12]; Cs_1 [30]-[40]; Cs_2 [46]-[52]; Saline Down [55]-[59]; PTX_Cs [72]-[82]; Wash (PTX) [90]-[93]
    969_150   True  True 208307  50182 119064           204.0    103              204.0          202.0          0.02         10.4         21.3           0   15116                                                                                  Saline [30]-[40]; Cs [9]-[19]; PTX_Cs [58]-[69]; PTX [84]-[94]
    969_152   True  True  69229  50742  88078           122.0     62              122.0          278.4          0.02         10.5         23.5           0   10450                                                                                                 Saline [1]-[11]; Cs [22]-[32]; PTX_Cs [47]-[57]
    969_154  False  True  71869  38769      0           114.0     58              114.0          112.0          0.02         10.2         21.3           0    7650                                                                                                 Saline [22]-[28]; Cs [7]-[13]; PTX_Cs [40]-[46]
    981_010   True False  28008  29309      0            81.2     42               81.2          142.1          0.02         10.6         21.7           0    4178                                                                                                                   Saline [1]-[13]; Cs [28]-[38]
    981_025  False False  93569      0      0           232.0    117              232.0          230.0          0.02         10.4         21.7           0   16312 Saline Steps [1]-[23]; Saline Ramp [28]-[38]; Cs Ramp Slow [47]-[57]; Cs Ramp Fast [64]-[69]; Cs Ramp Small Fast [76]-[81]; Cs Steps [90]-[108]
    981_035  False  True 128322      0      0           126.0     64              126.0          124.0          0.02         10.8         20.9           0    9176                                                                                                 Saline [27]-[37]; Cs [7]-[17]; PTX_Cs [47]-[57]
981_035_PD2  False  True  86153      0      0           126.0     64              126.0          124.0          0.02         10.8         20.9           0    6950                                                                                                 Saline [27]-[37]; Cs [7]-[17]; PTX_Cs [47]-[57]

Experiments with LP spikes: 21 of 21; with PY spikes: 13 of 21

The README says spike times, a subsampled temperature (Tempsub) and its time (x_sub), the condition table Timings (file indices) and the file start times (fileTimes). The values agree: spike times are in seconds (they end at the last file time), x_sub is in minutes, sampled every 0.02 min (1.2 s), and file times are 120 s apart, as the Methods' 2 min files imply. The 21 experiments of the summary files are all deposited as spike files; each has PD and LP spikes, and PY spikes are present in the number printed (the paper's Table 1 uses 12 with PY). Three files go beyond this: 981_025 is a control experiment (two saline protocols, then Cs+ ramps), 981_035 and 969_154 are picrotoxin experiments outside the 21. 981_035 holds two PD spike trains, PD and PD2, which the README does not mention. In two files (969_152, 981_010) the temperature runs on after the sorted spikes end (to 278 and 142 min against 122 and 81 min); the spikes and the temperature agree on the windows used (the step protocol in each window, below), so this only means the temperature recording continued. Temperatures below 5 C (to -46.7 C), impossible in this preparation, occur in three files: thermocouple dropouts, shown in the cell finding-temperature-dropouts.

In [4]:
# Temperature samples far outside the 10-26 C protocol, and whether they fall in an analysis window.
for e in ["969_070", "969_087", "969_089"]:
    d = P.load_spikes(e)
    t, x = d["Tempsub"], d["x_sub"][: len(d["Tempsub"])] * 60
    bad = np.nonzero(t < 5)[0]
    wins = [(d["fileTimes"][a[0]], d["fileTimes"][min(b[0] + 1, len(d["fileTimes"]) - 1)]) for a, b in d["Timings"].values()]
    inwin = sum(any(w0 < x[i] < w1 for w0, w1 in wins) for i in bad)
    print(f"{e}: {len(bad)} samples below 5 C, min {t.min():.1f} C, at {x[bad].min() / 60:.1f}-{x[bad].max() / 60:.1f} min; "
          f"{inwin} inside a condition window")
969_070: 704 samples below 5 C, min -8.9 C, at 137.6-137.8 min; 0 inside a condition window
969_087: 3497 samples below 5 C, min -9.2 C, at 120.5-121.7 min; 0 inside a condition window
969_089: 1 samples below 5 C, min -46.7 C, at 27.5-27.5 min; 0 inside a condition window
In [5]:
# Is any recording deposited twice? Compare every pair of PD spike trains: fraction of spikes of one
# within 1 ms of a spike of the other (independent recordings give the chance level, a few percent).
def coincidence(a, b, tol=0.001):
    i = np.clip(np.searchsorted(a, b), 1, len(a) - 1)
    return float(np.mean(np.minimum(np.abs(a[i] - b), np.abs(a[i - 1] - b)) < tol))

names = sorted(A)
pd_trains = {e: A[e]["PD2" if e.endswith("PD2") else "PD"] for e in names}
co = pd.DataFrame([[coincidence(pd_trains[a], pd_trains[b]) if a != b else np.nan for b in names] for a in names], index=names, columns=names)
print("Largest PD coincidence of each train with any other file (1 ms):")
print(co.max(axis=1).round(3).sort_values(ascending=False).head(6).to_string())
lens = info.set_index("expt")[["PD", "LP", "PY", "cycles"]]
print("\nPairs with identical PD spike counts:", [(a, b) for i, a in enumerate(names) for b in names[i + 1:] if lens.PD[a] == lens.PD[b]])
Largest PD coincidence of each train with any other file (1 ms):
969_085    0.053
969_147    0.042
969_058    0.038
981_035    0.035
969_070    0.031
969_150    0.030

Pairs with identical PD spike counts: []

No two files share their PD spike trains beyond chance, so no recording is deposited twice as a spike file. 981_035's PD and PD2 trains are not the same spikes either (the coincidence is printed above); the next cell shows what they are. The picrotoxin summaries enter them as two experiments: SummaryStatisticsPTX.mat as BurstAvgs_981_035 and BurstAvgs_981_035_2, and SawtoothPTX.mat with six columns for five files (both printed in the next cell).

In [6]:
# 981_035 holds two PD spike trains, PD and PD2, and one temperature trace. Two PD neurons of one
# preparation are electrically coupled and burst together; two preparations burst independently.
SP = P.load_mat("SummaryStatisticsPTX.mat")
SWP = P.load_mat("SawtoothPTX.mat")
print("SummaryStatisticsPTX files:", [str(np.ravel(x)[0]) for x in np.ravel(SP["files"]["name"])])
print("SawtoothPTX files:", [str(np.ravel(x)[0]) for x in np.ravel(SWP["files"]["name"])], "DecFreq shape", np.asarray(SWP["DecFreq"]).shape)
print("Measured mean temperatures of the saline holds, rows 5 and 6 (981_035 and 981_035_2):")
print(np.asarray(SP["TotalActTemp_S"])[4:6].round(3))
d, d2 = A["981_035"], A["981_035_PD2"]
print("981_035 variables:", [k for k in ("PD", "PD2", "LP", "PY") if k in d and len(d[k])], "PD spikes", len(d["PD"]), "PD2 spikes", len(d["PD2"]))
s1, s2 = d["all_starts"], d2["all_starts"]
def nearest(a, b):
    i = np.clip(np.searchsorted(a, b), 1, len(a) - 1)
    return np.minimum(np.abs(a[i] - b), np.abs(a[i - 1] - b))
half = np.median(np.diff(s1)) / 2
for tol in (0.02, 0.05, 0.1):
    print(f"PD2 burst starts within {1e3 * tol:.0f} ms of a PD burst start: {np.mean(nearest(s1, s2) < tol):.3f}; "
          f"with PD2 shifted by half a median PD period ({half:.2f} s, chance): {np.mean(nearest(s1, s2 + half) < tol):.3f}")
print(f"PD and PD2 spikes within 1 ms of each other: {coincidence(d['PD'], d['PD2']):.3f} of PD2 spikes")
for cnd, (a, b) in d["Timings"].items():
    m1 = P.condition_mask(s1, d["fileTimes"], a[0], b[0]); m2 = P.condition_mask(s2, d["fileTimes"], a[0], b[0])
    print(f"{cnd}: bursts PD {m1.sum()}, PD2 {m2.sum()}; median burst frequency PD {1 / np.median(np.diff(s1[m1])):.2f} Hz, PD2 {1 / np.median(np.diff(s2[m2])):.2f} Hz")
SummaryStatisticsPTX files: ['BurstAvgs_969_147.mat', 'BurstAvgs_969_150.mat', 'BurstAvgs_969_152.mat', 'BurstAvgs_969_154.mat', 'BurstAvgs_981_035.mat', 'BurstAvgs_981_035_2.mat']
SawtoothPTX files: ['969_147', '969_150', '969_152', '969_154', '981_035'] DecFreq shape (3, 6)
Measured mean temperatures of the saline holds, rows 5 and 6 (981_035 and 981_035_2):
[[10.893 12.774 14.813 16.941 18.867 20.703]
 [10.897 12.769 14.812 16.94  18.862 20.702]]
981_035 variables: ['PD', 'PD2'] PD spikes 128322 PD2 spikes 86153
PD2 burst starts within 20 ms of a PD burst start: 0.055; with PD2 shifted by half a median PD period (0.40 s, chance): 0.052
PD2 burst starts within 50 ms of a PD burst start: 0.140; with PD2 shifted by half a median PD period (0.40 s, chance): 0.130
PD2 burst starts within 100 ms of a PD burst start: 0.266; with PD2 shifted by half a median PD period (0.40 s, chance): 0.268
PD and PD2 spikes within 1 ms of each other: 0.034 of PD2 spikes
Saline: bursts PD 2069, PD2 1856; median burst frequency PD 1.79 Hz, PD2 1.58 Hz
Cs: bursts PD 1449, PD2 699; median burst frequency PD 1.17 Hz, PD2 0.64 Hz
PTX_Cs: bursts PD 1679, PD2 1382; median burst frequency PD 1.44 Hz, PD2 1.10 Hz

The two trains do not burst together: PD2 bursts start near a PD burst start no more often than when PD2 is shifted by half a period, and the two run at different frequencies in every condition (printed above). Two PD neurons of one preparation would burst together, so PD and PD2 are two rhythms: two preparations recorded with one thermocouple, which is why the summaries give them the same measured temperatures. The paper's six picrotoxin experiments are six preparations, as it says. The README does not describe PD2, and nothing in the file says that it is a second preparation.

In [7]:
# Clock check. Spike times and temperature share a clock if pyloric frequency follows the temperature
# steps with no delay: correlate each cycle's frequency with the temperature k minutes later
# (Tempsub interpolated at the cycle start + k), in the saline window of each experiment. With 4 min
# holds and 2 C steps, a clock offset of a minute or more moves the peak away from 0.
shifts = np.arange(-6, 6.01, 0.25)
res = []
for e in EXPTS:
    d = A[e]
    c = d["cycles"]
    a, b = d["Timings"]["Saline"]
    m = np.nonzero(P.condition_mask(c["start"], d["fileTimes"], a[0], b[0]) & (c["freq"] > 1 / 8))[0]
    tt, TT = d["x_sub"][: len(d["Tempsub"])] * 60, d["Tempsub"]
    ok = ~np.isnan(TT) & (TT > 5)
    r = [np.corrcoef(c["freq"][m], np.interp(c["start"][m] + k * 60, tt[ok], TT[ok]))[0, 1] for k in shifts]
    res.append({"expt": e, "best_shift_min": shifts[int(np.nanargmax(r))], "r_at_0": r[int(np.argmin(np.abs(shifts)))], "r_best": np.nanmax(r),
                "r_at_-3min": r[int(np.argmin(np.abs(shifts + 3)))], "r_at_+3min": r[int(np.argmin(np.abs(shifts - 3)))]})
res = pd.DataFrame(res)
print(res.round(3).to_string(index=False))
print("\nmedian best shift:", res.best_shift_min.median(), "min; experiments with |best shift| <= 0.5 min:",
      int((res.best_shift_min.abs() <= 0.5).sum()), "of", len(res), "; correlation lower at +3 min than at 0 in",
      int((res["r_at_+3min"] < res.r_at_0).sum()), "of", len(res))
   expt  best_shift_min  r_at_0  r_best  r_at_-3min  r_at_+3min
965_106            4.75   0.448   0.771       0.393       0.620
969_058           -1.00   0.987   0.995       0.990       0.933
969_062           -4.75   0.694   0.728       0.720       0.356
969_065           -4.75   0.945   0.958       0.947       0.921
969_068            1.50   0.658   0.686       0.612       0.665
969_070            5.75   0.677   0.830       0.624       0.723
969_083           -4.25   0.972   0.978       0.974       0.555
969_085            0.00   0.977   0.977       0.957       0.546
969_087            4.50   0.884   0.890       0.833       0.876
969_088            0.25   0.987   0.987       0.981       0.835
969_089            1.00   0.887   0.888       0.860       0.794
969_091            0.00   0.964   0.964       0.952       0.801
969_106           -4.00   0.984   0.991       0.984       0.917
969_113           -0.25   0.977   0.978       0.960       0.893
969_115            1.00   0.883   0.897       0.789       0.721
969_128           -5.00   0.771   0.814       0.770       0.122
969_135            0.00   0.988   0.988       0.979       0.806
969_147            0.25   0.994   0.995       0.983       0.539
969_150            0.75   0.897   0.902       0.861       0.693
969_152            0.00   0.993   0.993       0.980       0.246
981_010            0.25   0.950   0.953       0.915       0.737

median best shift: 0.0 min; experiments with |best shift| <= 0.5 min: 8 of 21 ; correlation lower at +3 min than at 0 in 18 of 21

The correlation of each cycle's frequency with the temperature at the same time is high in most experiments (r at 0 printed above) and drops when the temperature is taken 3 min later in most of them (count printed above). The best shift itself is within 0.5 min of 0 in only some experiments and spreads over several minutes, because the frequency follows the temperature with a delay and stays near a plateau over the 4 min holds, so the slow protocol cannot place it more precisely. This check is weak: it is consistent with a shared clock, not proof of it. The support for a shared clock is the raw traces of 969_113 (next cell) and the close agreement of the per-experiment values recomputed here from spikes and temperature with the deposited SummaryStatistics.mat (below), which needs spikes and temperature on one clock.

In [8]:
# Raw_Expt_969_113: intracellular PD, sample 0 at t = 0 of the spike times? The mean PD voltage
# around the PD spike times should peak at lag 0.
d = A["969_113"]
t0, t1 = 3800.0, 3860.0
v, n_samples = P.raw_trace("969_113", "PD", t0, t1)
sp = d["PD"][(d["PD"] > t0 + 0.05) & (d["PD"] < t1 - 0.05)]
shifts = np.arange(-20, 21)  # in 0.1 ms samples
prof = [np.mean(v[np.round((sp - t0) * 1e4).astype(int) + s]) for s in shifts]
print(f"Raw_Expt_969_113: {n_samples} samples = {n_samples / 1e4 / 60:.1f} min at 10 kHz; x_sub of 969_113 ends at {d['x_sub'].max():.1f} min")
print(f"{len(sp)} PD spikes in {t0:.0f}-{t1:.0f} s; mean PD voltage at the spike time {prof[20]:.1f} mV, "
      f"peak at shift {shifts[int(np.argmax(prof))] / 10:.1f} ms; voltage 20 ms before the spikes {np.mean(v[np.round((sp - t0) * 1e4).astype(int) - 200]):.1f} mV")
tr, _ = P.raw_trace("969_113", "temp", t0, t1)
c = d["cycles"]
k = (c["start"] > t0) & (c["start"] < t1)
print(f"temperature channel {tr.mean():.2f} C over the window; Tempsub cycle mean {np.nanmean(c['temp'][k]):.2f} C")
Raw_Expt_969_113: 83782528 samples = 139.6 min at 10 kHz; x_sub of 969_113 ends at 139.6 min
697 PD spikes in 3800-3860 s; mean PD voltage at the spike time -43.5 mV, peak at shift -0.1 ms; voltage 20 ms before the spikes -46.9 mV
temperature channel 11.56 C over the window; Tempsub cycle mean 11.56 C

The intracellular PD voltage peaks within a fraction of a millisecond of the deposited PD spike times, and the raw temperature channel equals Tempsub over the same window: the raw trace, the spike times and the temperature share one clock in 969_113.

In [9]:
# Agreement of this port of the deposited code with the deposited per-experiment values, with the
# cycles left by the outlier removal before a removed cycle (extract_bursts, `gap`) kept, as the
# deposited code keeps them, and left out, the main reading here.
def dep(name, rows=slice(None), cols=slice(2, 8)):
    return np.asarray(S[name])[rows, cols]

CS = {e: ("Cs" if "Cs" in A[e]["Timings"] else "Cs_1") for e in EXPTS}
ng = np.array([A[e]["cycles"]["gap"].sum() for e in EXPTS]); nc = np.array([len(A[e]["cycles"]["gap"]) for e in EXPTS])
print(f"gap cycles: {ng.sum()} of {nc.sum()} cycles ({100 * ng.sum() / nc.sum():.1f}%), {ng.min()}-{ng.max()} per experiment")
c = A["969_128"]["cycles"]; g = np.nonzero(c["gap"])[0]
j = g[np.nanargmax(c["LP_ON"][g])]
print(f"example, 969_128 cycle {j}: period kept {c['period'][j]:.2f} s, next start kept {A['969_128']['all_starts'][j + 1] - c['start'][j]:.2f} s later, LP ON phase {c['LP_ON'][j]:.2f}")
spec = [("TotalSals", "freq", "S"), ("TotalLPON_S", "LP_ON", "S"), ("TotalPDOFF_S", "PD_OFF", "S"), ("TotalLPOFF_S", "LP_OFF", "S"),
        ("TotalExpts", "freq", "C"), ("TotalLPON_E", "LP_ON", "C"), ("TotalPDOFF_E", "PD_OFF", "C"), ("TotalLPOFF_E", "LP_OFF", "C")]
big = []
for dg in (False, True):
    print(f"\ngap cycles {'left out (main reading)' if dg else 'kept (deposited code)'}:")
    for k, m, cnd in spec:
        hs = [P.hold_means(A[e], "Saline" if cnd == "S" else CS[e], strict_cs=(cnd == "C" and m == "freq"), drop_gaps=dg) for e in EXPTS]
        v = np.array([h[m] for h in hs])
        dd = np.abs(v - dep(k))
        print(f"  {k:14s} values {np.sum(~np.isnan(dd)):3d}; |this - deposited| median {np.nanmedian(dd):.4f}, 90th percentile {np.nanpercentile(dd, 90):.4f}, max {np.nanmax(dd):.3f}; "
              f"NaN here only {int(np.sum(np.isnan(v) & ~np.isnan(dep(k))))}, deposited only {int(np.sum(~np.isnan(v) & np.isnan(dep(k))))}")
        if dg:
            for i, jj in zip(*np.nonzero(dd > 0.04)):
                f_ = A[EXPTS[i]]["cycles"]["freq"][hs[i]["cycle_index"][int(P.TARGETS[jj])]]
                big.append({"value": k, "expt": EXPTS[i], "target_C": int(P.TARGETS[jj]), "here": v[i, jj], "deposited": dep(k)[i, jj], "cycles": hs[i]["n"][jj],
                            "cycle freq CV": np.std(f_) / np.mean(f_)})
print("\nDifferences above 0.04 that remain with the gap cycles left out, with the cycle-to-cycle CV of frequency in those cycles:")
print(pd.DataFrame(big).round(3).to_string(index=False))
allcv = [np.std(A[e]["cycles"]["freq"][h]) / np.mean(A[e]["cycles"]["freq"][h]) for e in EXPTS for cnd in ("Saline", CS[e])
         for h in P.hold_means(A[e], cnd)["cycle_index"].values() if len(h) > 1]
print(f"cycle-to-cycle CV of frequency over all holds: median {np.median(allcv):.3f}, 90th percentile {np.percentile(allcv, 90):.3f}")
gap cycles: 3375 of 209648 cycles (1.6%), 98-313 per experiment
example, 969_128 cycle 2902: period kept 0.70 s, next start kept 23.20 s later, LP ON phase 32.17

gap cycles kept (deposited code):
  TotalSals      values 124; |this - deposited| median 0.0032, 90th percentile 0.0078, max 0.136; NaN here only 0, deposited only 1
  TotalLPON_S    values 125; |this - deposited| median 0.0035, 90th percentile 0.0114, max 0.289; NaN here only 0, deposited only 0
  TotalPDOFF_S   values 125; |this - deposited| median 0.0042, 90th percentile 0.0180, max 0.107; NaN here only 0, deposited only 0
  TotalLPOFF_S   values 125; |this - deposited| median 0.0039, 90th percentile 0.0130, max 0.289; NaN here only 0, deposited only 0
  TotalExpts     values 124; |this - deposited| median 0.0056, 90th percentile 0.0326, max 0.204; NaN here only 0, deposited only 0
  TotalLPON_E    values 124; |this - deposited| median 0.0044, 90th percentile 0.0150, max 0.853; NaN here only 0, deposited only 0
  TotalPDOFF_E   values 124; |this - deposited| median 0.0048, 90th percentile 0.0198, max 0.105; NaN here only 0, deposited only 0
  TotalLPOFF_E   values 124; |this - deposited| median 0.0046, 90th percentile 0.0167, max 0.840; NaN here only 0, deposited only 0

gap cycles left out (main reading):
  TotalSals      values 124; |this - deposited| median 0.0033, 90th percentile 0.0078, max 0.136; NaN here only 0, deposited only 1
  TotalLPON_S    values 125; |this - deposited| median 0.0007, 90th percentile 0.0016, max 0.088; NaN here only 0, deposited only 0
  TotalPDOFF_S   values 125; |this - deposited| median 0.0005, 90th percentile 0.0016, max 0.107; NaN here only 0, deposited only 0
  TotalLPOFF_S   values 125; |this - deposited| median 0.0007, 90th percentile 0.0019, max 0.085; NaN here only 0, deposited only 0
  TotalExpts     values 124; |this - deposited| median 0.0062, 90th percentile 0.0339, max 0.208; NaN here only 0, deposited only 0
  TotalLPON_E    values 124; |this - deposited| median 0.0007, 90th percentile 0.0040, max 0.041; NaN here only 0, deposited only 0
  TotalPDOFF_E   values 124; |this - deposited| median 0.0004, 90th percentile 0.0040, max 0.034; NaN here only 0, deposited only 0
  TotalLPOFF_E   values 124; |this - deposited| median 0.0009, 90th percentile 0.0037, max 0.037; NaN here only 0, deposited only 0

Differences above 0.04 that remain with the gap cycles left out, with the cycle-to-cycle CV of frequency in those cycles:
       value    expt  target_C  here  deposited  cycles  cycle freq CV
   TotalSals 969_147        21 1.948      2.083     234          0.023
 TotalLPON_S 965_106        21 0.285      0.197      89          0.572
TotalPDOFF_S 965_106        21 0.152      0.046      89          0.572
TotalLPOFF_S 965_106        21 0.320      0.235      89          0.572
  TotalExpts 965_106        21 0.313      0.244      20          0.542
  TotalExpts 969_062        17 0.886      0.931     104          0.254
  TotalExpts 969_070        21 1.113      1.187     201          0.280
  TotalExpts 969_089        21 0.675      0.759      66          0.537
  TotalExpts 969_147        21 1.093      0.982     160          0.114
  TotalExpts 969_150        21 0.670      0.462      82          0.438
  TotalExpts 981_010        21 0.995      1.111     110          0.364
 TotalLPON_E 969_128        17 0.184      0.144     153          0.271
cycle-to-cycle CV of frequency over all holds: median 0.037, 90th percentile 0.114

Recomputed from the spike files with the deposited code's rules, the per-experiment frequencies and phases agree with the deposited SummaryStatistics.mat to within a few thousandths in most values, with a few larger differences (printed above). The outlier removal of the deposited extractBurstFrequency_Final.m deletes a cycle's start together with its frequency, so the cycle before it keeps its own period while its phases are measured up to a start two or more bursts later (in the 969_128 example, an LP ON phase of 32). These cycles are 1.6% of all cycles. With them left out, the median phase difference from the deposited values is five to twelve times smaller and the largest phase difference falls from 0.85 to 0.11, while the frequencies barely change; so the summary phases were most likely made by code that did not include these cycles. This attempt leaves them out of the hold means and phases (an assumption; each claim's section shows the deposited code's reading, gaps kept, as a variant). Of the 12 differences above 0.04 that remain, 10 are in holds where the rhythm is irregular from cycle to cycle (frequency CV 0.25 to 0.57, against a median of 0.037 over all holds), so a small change in which cycles enter moves the mean; the other two, 969_147 at 21 C in saline (CV 0.023) and in Cs+ (CV 0.11), are not explained. All claims below are computed from the spike files.

In [10]:
# The outlier removal of the deposited extractBurstFrequency_Final.m, printed for comparison with the
# port (pyloric.extract_bursts).
src_m = (P.DATA_DIR / "extractBurstFrequency_Final.m").read_text().splitlines()
i0 = next(i for i, l in enumerate(src_m) if l.startswith("%Some code"))
print("\n".join(f"{i + 1:3d}  {l}" for i, l in enumerate(src_m) if i >= i0 and l.strip()))
 46  %Some code that makes sure that a huge jump wasn't identified for some
 47  %reason and removes any bursts that were much faster or slower than the
 48  %surrounding bursts
 49  checkflag=1;
 50  while checkflag>0
 51      ToRemove=[];
 52  for P=11:length(burstFreq)-10
 53      pastmean=nanmean(abs(diff(burstFreq(P-10:P-5))));
 54      futuremean=nanmean(abs(diff(burstFreq(P+5:P+10))));
 55      if abs(burstFreq(P)-burstFreq(P-1))>3*pastmean & abs(burstFreq(P)-burstFreq(P+1))>3*futuremean
 56          ToRemove(P)=1;
 57      end
 58  end
 59  checkflag=sum(ToRemove);
 60  ToRemove=find(ToRemove==1);
 62  StartTime(ToRemove)=[];
 63  burstFreq(ToRemove)=[];
 64  sp_per_burst(ToRemove)=[];
 65  cyclePeriod(ToRemove)=[];
 66  burstDuration(ToRemove)=[];
 67  end

These are the lines that extract_bursts ports: the same loop over P = 11 to length(burstFreq) - 10, the same windows (P-10 to P-5 and P+5 to P+10), the same threefold criterion on both sides, the removal repeated until no cycle is flagged, and StartTime(P) deleted together with burstFreq(P), cyclePeriod(P) and burstDuration(P). Deleting StartTime(P) leaves cycle P-1 with its own period while the next start kept is that of burst P+1: these are the gap cycles of the cell above. The deposited code thus makes them; the summaries' phases agree with leaving them out (above).

In [11]:
# The two-saline control experiments (Figure 1E, F): which are deposited?
CT = S["ControlTable"]
print(CT.to_string())
ctl = [str(np.ravel(x)[0]) for x in CT["Expt"] if np.size(x)]
print("\nControl experiments:", ctl, "; with a SpikeAndTemp file:", [e for e in ctl if f"{e}_SpikeAndTemp.mat" in spike_files])
print("Second protocol type:", dict(zip(ctl, [str(np.ravel(x)[0]) for x in CT["Type_2"] if np.size(x)])))
   Deg_11_1  Deg_11_2  Deg_21_1  Deg_21_2       Expt   Type_1        Type_2  Change_1  Change_2   Q10_1   Q10_2  FreqDiff_1  FreqDiff_2
0  0.857572  0.965437  1.971407  1.790831  [965_129]  [Steps]       [Steps]       1.0       2.0  2.3680  1.9000    1.113834    0.825394
1  0.763600  0.838400  1.899338  2.013693  [965_134]  [Steps]       [Steps]       1.0       2.0  2.5362  2.5836    1.135738    1.175293
2  1.186000  1.090200  1.986600  1.747600  [965_139]  [Steps]       [Steps]       1.0       2.0  1.7790  1.6413    0.800600    0.657400
3  0.993141  0.986388  1.615738  1.714091  [965_146]  [Steps]  [Ramp_10min]       1.0       2.0  1.6242  1.7116    0.622598    0.727703
4  1.194407  1.204819  2.380614  2.197078  [981_025]  [Steps]        [Ramp]       1.0       2.0  1.9800  1.8590    1.186207    0.992259
5  1.077885  0.992457  1.538378  1.284852  [982_005]  [Steps]  [Ramp_10min]       1.0       2.0  1.5760  1.2810    0.460493    0.292394
6  0.000000  0.000000  0.000000  0.000000         []       []            []       0.0       0.0  1.9772  1.8294    0.886600    0.778400
7  0.000000  0.000000  0.000000  0.000000         []       []            []       0.0       0.0  0.3975  0.4300    0.304000    0.302900

Control experiments: ['965_129', '965_134', '965_139', '965_146', '981_025', '982_005'] ; with a SpikeAndTemp file: ['981_025']
Second protocol type: {'965_129': 'Steps', '965_134': 'Steps', '965_139': 'Steps', '965_146': 'Ramp_10min', '981_025': 'Ramp', '982_005': 'Ramp_10min'}

ControlTable lists six control experiments; only 981_025 has a spike file. The other five (965_129, 965_134, 965_139, 965_146, 982_005) are present only as the table's per-experiment means (11 and 21 C frequencies, Q10, frequency change). Rows 7 and 8 of the table hold no experiment (their values equal the column means and SDs of rows 1 to 6). The table says the second protocol was a ramp, not steps, in three of the six (965_146, 981_025, 982_005); the paper says "two consecutive temperature changes in saline".

In [12]:
# Voltage clamp: what VoltageClampData.mat holds against what its ConditionsKey describes.
VC = P.load_mat("VoltageClampData.mat")["VoltageClampData"]
for n in VC.dtype.names:
    e = VC[n].ravel()[0]
    key = np.ravel(e["ConditionsKey"].ravel()[0]).astype(int)
    desc = [str(np.ravel(c)[0]) for c in np.ravel(e["ConditionDescriptions"].ravel()[0])]
    V = e["Voltage"].ravel()[0]
    ncs = sum("cs" in desc[k - 1].lower() for k in key)
    print(f"{n}: ConditionsKey lists {len(key)} trials, {ncs} of them Cs+; Voltage array {V.shape} (trials x steps x samples); "
          f"trial 1 is condition {key[0]} '{desc[key[0] - 1]}'")
VT = P.load_mat("VoltageClampTraceData.mat")["VoltageClampDataTraces"]
print("\nVoltageClampTraceData:", {n: [(str(np.ravel(r['Cell_Temperature'])[0]), str(np.ravel(r['Condition'])[0]), str(np.ravel(r['fileNames'])[0])) for r in VT[n].ravel()[0].ravel()] for n in VT.dtype.names})
Expt_969_149: ConditionsKey lists 14 trials, 6 of them Cs+; Voltage array (1, 7, 300000) (trials x steps x samples); trial 1 is condition 1 'PD1 11 Deg Saline'
Expt_969_152: ConditionsKey lists 18 trials, 5 of them Cs+; Voltage array (1, 7, 300000) (trials x steps x samples); trial 1 is condition 1 'LP 11 Deg Saline'
Expt_969_156: ConditionsKey lists 5 trials, 2 of them Cs+; Voltage array (1, 7, 300000) (trials x steps x samples); trial 1 is condition 1 'PD 11 Saline'
Expt_970_092: ConditionsKey lists 6 trials, 2 of them Cs+; Voltage array (1, 4, 300000) (trials x steps x samples); trial 1 is condition 1 'LP 11 Deg PTX TTX'
Expt_970_093: ConditionsKey lists 6 trials, 3 of them Cs+; Voltage array (1, 4, 300000) (trials x steps x samples); trial 1 is condition 1 'PD 21 Deg TTX PTX'
Expt_981_027: ConditionsKey lists 16 trials, 7 of them Cs+; Voltage array (1, 7, 300000) (trials x steps x samples); trial 1 is condition 1 'PD 11 Deg PTX TTX'
Expt_981_030: ConditionsKey lists 11 trials, 3 of them Cs+; Voltage array (1, 3, 300000) (trials x steps x samples); trial 1 is condition 1 'PD 11 Deg PTX TTX'
Expt_981_033: ConditionsKey lists 14 trials, 7 of them Cs+; Voltage array (1, 3, 300000) (trials x steps x samples); trial 1 is condition 1 'LP 21 Deg PTX TTX'
Expt_981_064: ConditionsKey lists 22 trials, 6 of them Cs+; Voltage array (1, 4, 300000) (trials x steps x samples); trial 1 is condition 1 'LP 11 TTX PTX'
Expt_981_065: ConditionsKey lists 22 trials, 8 of them Cs+; Voltage array (1, 4, 300000) (trials x steps x samples); trial 1 is condition 1 'PD 11 TTX PTX'
VoltageClampTraceData: {'Expt_981_065': [('PD 11', 'Saline', '981_065_0013.abf'), ('PD 11', 'Cs', '981_065_0024.abf')], 'Expt_981_064': [('LP 11', 'Saline', '981_064_0017.abf'), ('LP 11', 'Cs', '981_064_0028.abf')], 'Expt_970_093': [('PD 21', 'Saline', '970_093_0012.abf'), ('PD 21', 'Cs', '970_093_0017.abf')], 'Expt_981_033': [('LP 21', 'Saline', '981_033_0027.abf'), ('LP 21', 'Cs', '981_033_0037.abf')]}

VoltageClampData.mat holds one trial per experiment, the first, whose condition is saline or TTX+PTX in every experiment, while its ConditionsKey lists 5 to 22 trials, 2 to 8 of them Cs+. The README says "Trials x steps x time". No Cs+ voltage-clamp trial is in the file. The Cs+ traces of the dataset are the four cells of VoltageClampTraceData.mat (two at 11 C, two at 21 C), the example cells of Figure 1-figure supplement 1. In version 290160 the file was 814 MB, against 98 MB in 310115; it may have held every trial, which this attempt cannot read (it is not staged).

figs1-ih-reduced-11c and figs1-ih-reduced-21c¶

At 11 degrees C and -110 mV, Ih in PD and LP cells was 1.5 nA in saline and 0.23 nA in Cs+, a reduction of 93% (4 PD and 3 LP cells, paired t-test p = 0.0005).

At 21 degrees C and -110 mV, Ih was 3.2 nA in saline and 0.6 nA in Cs+, a reduction of 78% (5 LP and 3 PD cells, paired t-test p = 0.02).

Blocked: the Cs+ trials of 7 cells at 11 C and 8 at 21 C are not in the dataset (above). The two criterion readings are run on the four cells that are deposited with both conditions; and the deposited script's own per-cell values, typed in MakePaperFigures_Clean.m from by-eye readings, are parsed from the script to show what the paper's numbers rest on. Neither decides the outcome.

In [13]:
def ih_readings(t, i, step_on, step_len=12.0):
    """Ih at a hyperpolarising step: initial minus steady-state current (criterion; the deposited
    script's Leak - Sag). The capacitive transient is taken to end 20 ms after the step (standard
    choice); steady state the mean of the last 1 s of the step. Initial current: (a) the mean of the
    first 100 ms after the transient; (b) the current farthest from the steady state in the first
    500 ms, after a 10 ms moving average (standard choice against noise); (c) the least inward
    current (10 ms moving average) in the first 1 s, the point before the slow inward Ih develops,
    after a faster current has relaxed (printed below; a standard choice, closest to the script's
    "initial current" read by eye)."""
    fs = 1 / np.median(np.diff(t))
    a = int(round((step_on + 0.02) * fs))
    ss = np.mean(i[int((step_on + step_len - 1.0) * fs): int((step_on + step_len) * fs)])
    ia = np.mean(i[a: a + int(0.1 * fs)])
    k = int(0.01 * fs)
    w = np.convolve(i[a: a + int(0.5 * fs)], np.ones(k) / k, mode="valid")
    ib = w[int(np.argmax(np.abs(w - ss)))]
    ic = np.max(np.convolve(i[a: a + int(1.0 * fs)], np.ones(k) / k, mode="valid"))
    return ia - ss, ib - ss, ic - ss

rows = []
for n in VT.dtype.names:
    for r in VT[n].ravel()[0].ravel():
        t = np.ravel(r["Time"])
        V = np.asarray(r["Voltage"])[:, 0, :]
        I = np.asarray(r["Current"])[:, 0, :]
        lvl = np.round(np.median(V[int(12 * 1e4): int(18 * 1e4)], axis=0))
        k = int(np.argmin(np.abs(lvl + 110)))
        below = np.nonzero(V[:, k] < (V[: int(1e4), k].mean() + lvl[k]) / 2)[0]
        onset, offset = t[below[0]], t[below[-1]]
        a, b, c_ = ih_readings(t, I[:, k], step_on=onset)
        fs = 1e4
        early = [np.mean(I[int((onset + x) * fs): int((onset + x + 0.05) * fs), k]) for x in (0.02, 0.1, 0.3, 0.6, 1.0, 4.0, 8.0, 11.0)]
        rows.append({"expt": n, "cell": str(np.ravel(r["Cell_Temperature"])[0]), "cond": str(np.ravel(r["Condition"])[0]),
                     "step_onset_s": round(onset, 3), "step_len_s": round(offset - onset, 3), "step_mV": lvl[k], "Ih_a_nA": a, "Ih_b_nA": b, "Ih_c_nA": c_,
                     "I at +0.02, 0.1, 0.3, 0.6, 1, 4, 8, 11 s (nA)": " ".join(f"{x:.2f}" for x in early)})
        if n == "Expt_981_064" and rows[-1]["cond"] == "Saline":
            print(f"{n} LP saline, step to {lvl[k]:.0f} mV: V and I in 0.5 s bins over the whole trace (0-{t[-1]:.0f} s)")
            print("  V (mV):", np.round([V[j: j + 5000, k].mean() for j in range(0, len(t), 5000)], 0).tolist())
            print("  I (nA):", np.round([I[j: j + 5000, k].mean() for j in range(0, len(t), 5000)], 2).tolist())
ih = pd.DataFrame(rows)
print(ih.round(3).to_string(index=False))
w = ih.pivot_table(index=["expt", "cell"], columns="cond", values=["Ih_a_nA", "Ih_b_nA", "Ih_c_nA"])
for r_ in ("a", "b", "c"):
    red = 100 * (1 - w[(f"Ih_{r_}_nA", "Cs")] / w[(f"Ih_{r_}_nA", "Saline")])
    print(f"reading ({r_}) reduction per cell (%):", red.round(1).to_dict())
Expt_981_064 LP saline, step to -110 mV: V and I in 0.5 s bins over the whole trace (0-30 s)
  V (mV): [-51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -54.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -110.0, -106.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0, -51.0]
  I (nA): [-0.09, -0.1, -0.09, -0.11, -0.1, -0.11, -0.13, -0.16, -0.14, -0.15, -0.15, -0.15, -0.15, -0.15, -0.16, -0.15, -0.16, -0.16, -1.9, -20.8, -20.47, -20.63, -20.74, -20.84, -20.91, -20.98, -21.0, -21.03, -21.08, -21.22, -21.24, -21.27, -21.33, -21.32, -21.33, -21.31, -21.29, -21.32, -21.32, -21.35, -21.32, -21.32, -19.61, 0.32, 0.06, 0.07, 0.09, 0.1, 0.12, 0.11, 0.09, 0.08, 0.08, 0.04, 0.03, 0.03, 0.03, 0.04, 0.03, 0.0]
        expt  cell   cond  step_onset_s  step_len_s  step_mV  Ih_a_nA  Ih_b_nA  Ih_c_nA           I at +0.02, 0.1, 0.3, 0.6, 1, 4, 8, 11 s (nA)
Expt_981_065 PD 11 Saline         9.469        12.0   -110.0    1.280    1.702    1.702 -12.62 -12.08 -12.14 -12.31 -12.52 -13.16 -13.51 -13.68
Expt_981_065 PD 11     Cs         9.469        12.0   -110.0   -0.792   -1.711   -0.069        -10.39 -9.70 -9.49 -9.48 -9.46 -9.52 -9.44 -9.37
Expt_981_064 LP 11 Saline         9.469        12.0   -110.0   -0.911   -2.832    0.976 -22.92 -21.10 -20.47 -20.44 -20.56 -21.02 -21.31 -21.36
Expt_981_064 LP 11     Cs         9.469        12.0   -110.0   -1.705   -3.457   -0.067 -19.15 -17.47 -16.94 -16.93 -16.95 -17.13 -16.86 -16.77
Expt_970_093 PD 21 Saline         9.469        12.0   -109.0    1.715    2.223    2.223         -4.54 -4.06 -4.09 -4.11 -4.16 -5.11 -5.68 -6.12
Expt_970_093 PD 21     Cs         9.469        12.0   -109.0   -1.391   -2.295   -0.021         -3.82 -2.99 -2.72 -2.47 -2.25 -2.23 -2.11 -2.22
Expt_981_033 LP 21 Saline         9.469        12.0   -110.0    0.712    2.068    2.068 -12.73 -11.29 -10.88 -10.92 -11.08 -12.14 -12.65 -12.83
Expt_981_033 LP 21     Cs         9.469        12.0   -110.0   -1.561   -3.258    0.047 -12.39 -10.90 -10.40 -10.37 -10.35 -10.34 -10.23 -10.22
reading (a) reduction per cell (%): {('Expt_970_093', 'PD 21'): 181.1, ('Expt_981_033', 'LP 21'): 319.3, ('Expt_981_064', 'LP 11'): -87.1, ('Expt_981_065', 'PD 11'): 161.9}
reading (b) reduction per cell (%): {('Expt_970_093', 'PD 21'): 203.2, ('Expt_981_033', 'LP 21'): 257.5, ('Expt_981_064', 'LP 11'): -22.1, ('Expt_981_065', 'PD 11'): 200.6}
reading (c) reduction per cell (%): {('Expt_970_093', 'PD 21'): 101.0, ('Expt_981_033', 'LP 21'): 97.7, ('Expt_981_064', 'LP 11'): 106.8, ('Expt_981_065', 'PD 11'): 104.1}
In [14]:
# The deposited script's per-cell values (MakePaperFigures_Clean.m, "Stats on Change in Ih"):
# Ih = mean over repeats of (Leak - Sag) at -100, -110, -120 mV, typed from by-eye readings.
import re
src = (P.DATA_DIR / "MakePaperFigures_Clean.m").read_text()
def mat_array(name):
    m = re.search(rf"^{name}=\[(.*?)\]", src, re.S | re.M)
    body = re.sub(r"%[^\n]*", "", m.group(1)).replace("...", "")
    return np.array([[float(x) if x != "nan" else np.nan for x in re.split(r"[ ,]+", r.strip()) if x] for r in body.split(";") if r.strip()])
def cell_ih(prefix):
    return np.nanmean(mat_array(prefix.replace("#", "Leak")) - mat_array(prefix.replace("#", "Sag")), axis=0)
for T, cells_ in ((11, ["PD_149", "LP_152", "PD_156", "PD_027", "LP_030", "LP_064", "PD_065"]),
                  (21, ["PD_149", "LP_152", "LP_027", "LP_033", "PD_033", "LP_092", "LP_064", "PD_093"])):
    sal = np.array([cell_ih(f"{c}_#_{T}_Sal") for c in cells_])[:, 1]
    cs = np.array([cell_ih(f"{c}_#_{T}_Cs") for c in cells_])[:, 1]
    red = 100 * (sal - cs) / sal
    print(f"{T} C, -110 mV, {len(cells_)} cells (script values): saline {np.mean(sal):.2f} +- {np.std(sal, ddof=1):.2f} nA, "
          f"Cs {np.mean(cs):.2f} +- {np.std(cs, ddof=1):.2f} nA, reduction {np.mean(red):.0f} +- {np.std(red, ddof=1):.0f} %, "
          f"paired t p = {stats.ttest_rel(sal, cs).pvalue:.4f}")
# The four cells with deposited traces, against the script's by-eye values at -110 mV.
ihx = ih.set_index(["expt", "cond"])
for e, c_, T in (("Expt_981_065", "PD_065", 11), ("Expt_981_064", "LP_064", 11), ("Expt_970_093", "PD_093", 21), ("Expt_981_033", "LP_033", 21)):
    print(f"{e} ({c_}, {T} C): script saline {cell_ih(f'{c_}_#_{T}_Sal')[1]:.2f}, Cs {cell_ih(f'{c_}_#_{T}_Cs')[1]:.2f} nA; "
          + "; ".join(f"here ({r_}) saline {ihx.loc[(e, 'Saline'), f'Ih_{r_}_nA']:.2f}, Cs {ihx.loc[(e, 'Cs'), f'Ih_{r_}_nA']:.2f}" for r_ in "abc"))
11 C, -110 mV, 7 cells (script values): saline 1.55 +- 0.83 nA, Cs 0.25 +- 0.49 nA, reduction 94 +- 32 %, paired t p = 0.0005
21 C, -110 mV, 8 cells (script values): saline 3.17 +- 2.26 nA, Cs 0.58 +- 0.79 nA, reduction 78 +- 19 %, paired t p = 0.0213
Expt_981_065 (PD_065, 11 C): script saline 1.88, Cs -0.17 nA; here (a) saline 1.28, Cs -0.79; here (b) saline 1.70, Cs -1.71; here (c) saline 1.70, Cs -0.07
Expt_981_064 (LP_064, 11 C): script saline 0.50, Cs -0.30 nA; here (a) saline -0.91, Cs -1.71; here (b) saline -2.83, Cs -3.46; here (c) saline 0.98, Cs -0.07
Expt_970_093 (PD_093, 21 C): script saline 2.13, Cs 0.13 nA; here (a) saline 1.72, Cs -1.39; here (b) saline 2.22, Cs -2.30; here (c) saline 2.22, Cs -0.02
Expt_981_033 (LP_033, 21 C): script saline 2.18, Cs 0.14 nA; here (a) saline 0.71, Cs -1.56; here (b) saline 2.07, Cs -3.26; here (c) saline 2.07, Cs 0.05

Result: blocked (data missing). Ih cannot be measured on the paper's cells: the dataset holds the Cs+ traces of four cells only, two per temperature. The steps are placed correctly (each lasts 12.000 s at -109 or -110 mV, printed above). Readings (a) and (b) give negative values, because the current in the first few hundred ms after the step is a faster inward current that relaxes (in the LP cell at 11 C, -22.9 nA at 20 ms and -20.4 nA at 0.6 s, before the slow Ih develops to -21.4 nA) and in Cs+ the current goes on relaxing over the step. Reading (c), the least inward current in the first second, gives saline Ih of 0.98 to 2.22 nA and Cs+ Ih of -0.07 to 0.05 nA in the four cells (reductions of 98 to 107%), close to the script's by-eye values for the same cells (saline 0.50 to 2.18 nA, Cs+ -0.30 to 0.14 nA). Two cells per temperature cannot test the claim. The script's typed per-cell values give 1.55 and 0.25 nA, 94% and p = 0.0005 at 11 C, and 3.17 and 0.58 nA, 78% and p = 0.021 at 21 C, the paper's numbers; they are readings by eye of traces that are not deposited, so they are shown, not tested.

fig1-cs-lower-frequency-11c¶

At 11 degrees C pyloric frequency was lower in Cs+ than in saline (0.9 against 1.2 Hz, paired t-test p < 0.001).

Per experiment and condition, the mean PD burst frequency over cycles within 0.3 C of 11 C in the first 11 C hold of the condition (O2). The condition windows of the Timings table end at the 21 C hold, so the return to 11 C (the O2 variant) is outside every window, during the solution change, and cannot be used; the deposited code's reading, every 11 C cycle of the window, is the variant. The deposited CalculateFrequencyPhaseEtc.m takes the Cs+ frequency over |T - target| < 0.3 C and the saline frequency over <= 0.3 C; the main reading follows it, and first_le uses <= for both. first_gaps keeps the cycles left by the outlier removal (data check).

In [15]:
# Readings: first 11 C hold (main), every 11 C cycle of the window (the deposited code's), the
# first hold with <= 0.3 C for Cs+ as for saline, and the first hold with the gap cycles kept.
HV = {"first": ("first", True, True), "all": ("all", True, True), "first_le": ("first", False, True), "first_gaps": ("first", True, False)}
H = {w: {e: (P.hold_means(A[e], "Saline", which=wh, drop_gaps=dg), P.hold_means(A[e], CS[e], which=wh, strict_cs=st_, drop_gaps=dg)) for e in EXPTS}
     for w, (wh, st_, dg) in HV.items()}
for w in HV:
    fs = np.array([H[w][e][0]["freq"][0] for e in EXPTS]); fc = np.array([H[w][e][1]["freq"][0] for e in EXPTS])
    ns = [H[w][e][0]["n"][0] for e in EXPTS]; nc = [H[w][e][1]["n"][0] for e in EXPTS]
    r = P.paired(fs, fc)
    print(f"[{w}] saline {r['mean_x']:.2f} +- {r['sd_x']:.2f} Hz, Cs {r['mean_y']:.2f} +- {r['sd_y']:.2f} Hz, n pairs {r['n']}, "
          f"paired t = {r['t']:.2f}, p = {r['p_t']:.2g}; Cs lower in {int(np.sum(fc < fs))}; cycles per experiment saline {min(ns)}-{max(ns)}, Cs {min(nc)}-{max(nc)}")
    print("   experiments without an 11 C Cs value:", [e for e, v in zip(EXPTS, fc) if np.isnan(v)])
f11 = pd.DataFrame({"saline": [H["first"][e][0]["freq"][0] for e in EXPTS], "Cs": [H["first"][e][1]["freq"][0] for e in EXPTS]}, index=EXPTS)
print(f11.round(3).T.to_string())
[first] saline 1.17 +- 0.15 Hz, Cs 0.86 +- 0.22 Hz, n pairs 20, paired t = 7.18, p = 8e-07; Cs lower in 20; cycles per experiment saline 67-1201, Cs 0-255
   experiments without an 11 C Cs value: ['969_070']
[all] saline 1.17 +- 0.15 Hz, Cs 0.86 +- 0.22 Hz, n pairs 20, paired t = 7.18, p = 8e-07; Cs lower in 20; cycles per experiment saline 67-1201, Cs 0-255
   experiments without an 11 C Cs value: ['969_070']
[first_le] saline 1.17 +- 0.15 Hz, Cs 0.86 +- 0.22 Hz, n pairs 20, paired t = 7.18, p = 8e-07; Cs lower in 20; cycles per experiment saline 67-1201, Cs 0-255
   experiments without an 11 C Cs value: ['969_070']
[first_gaps] saline 1.17 +- 0.15 Hz, Cs 0.86 +- 0.22 Hz, n pairs 20, paired t = 7.18, p = 8e-07; Cs lower in 20; cycles per experiment saline 68-1216, Cs 0-259
   experiments without an 11 C Cs value: ['969_070']
        965_106  969_058  969_062  969_065  969_068  969_070  969_083  969_085  969_087  969_088  969_089  969_091  969_106  969_113  969_115  969_128  969_135  969_147  969_150  969_152  981_010
saline    1.349    1.432    1.316    1.173    1.177    1.309    1.004    1.179    1.123    1.357    1.021    1.079    0.979    1.274    1.336    0.922    0.967    1.058    1.304    1.172    1.207
Cs        0.738    1.368    0.822    1.095    1.165      NaN    0.571    0.621    0.787    0.959    0.909    1.040    0.524    1.128    0.797    0.685    0.848    0.591    0.953    0.848    0.762

Result: reproduced. In the first 11 C hold the mean frequency is 1.17 +- 0.15 Hz in saline and 0.86 +- 0.22 Hz in Cs+ over the 20 experiments with both values, within the tolerances of 1.2 and 0.9 Hz; Cs+ is lower in all 20, paired t-test p = 8e-07. The deposited code's reading (every 11 C cycle of the window) selects the same cycles, because every window ends at the 21 C hold; the <= bound for Cs+ and the gap cycles kept give the same values. 969_070 has no Cs+ cycle within 0.3 C of 11 C.

fig1d-difference-grows-with-temperature¶

The difference between a preparation's frequency in saline and in Cs+ increased significantly as temperature increased.

Saline minus Cs+ mean frequency at each holding temperature, one-way repeated-measures ANOVA on temperature: (a) experiments with all six values; (b) the 21, dropping incomplete ones as MATLAB ranova does. The two give the same set.

In [16]:
for w in HV:
    D = np.array([H[w][e][0]["freq"] - H[w][e][1]["freq"] for e in EXPTS])
    F, d1, d2, p, _, n = P.rm_anova(D)
    print(f"[{w}] experiments complete {n} of 21 (incomplete: {[e for e, r in zip(EXPTS, D) if np.isnan(r).any()]}); "
          f"F({d1},{d2}) = {F:.2f}, p = {p:.2g}")
    print("   mean difference by temperature (Hz):", dict(zip(P.TARGETS.tolist(), np.nanmean(D, axis=0).round(3))))
Dd = np.asarray(S["TotalDiffs"])[:, 2:8]
F, d1, d2, p, _, n = P.rm_anova(Dd)
print(f"deposited TotalDiffs: F({d1},{d2}) = {F:.3f}, p = {p:.2g} (paper F(5,85) = 43.259)")
[first] experiments complete 19 of 21 (incomplete: ['969_070', '969_128']); F(5,90) = 44.09, p = 9.1e-23
   mean difference by temperature (Hz): {11: np.float64(0.311), 13: np.float64(0.374), 15: np.float64(0.5), 17: np.float64(0.613), 19: np.float64(0.729), 21: np.float64(0.827)}
[all] experiments complete 19 of 21 (incomplete: ['969_070', '969_128']); F(5,90) = 44.09, p = 9.1e-23
   mean difference by temperature (Hz): {11: np.float64(0.311), 13: np.float64(0.374), 15: np.float64(0.5), 17: np.float64(0.613), 19: np.float64(0.729), 21: np.float64(0.827)}
[first_le] experiments complete 19 of 21 (incomplete: ['969_070', '969_128']); F(5,90) = 44.09, p = 9.1e-23
   mean difference by temperature (Hz): {11: np.float64(0.311), 13: np.float64(0.374), 15: np.float64(0.5), 17: np.float64(0.613), 19: np.float64(0.729), 21: np.float64(0.827)}
[first_gaps] experiments complete 19 of 21 (incomplete: ['969_070', '969_128']); F(5,90) = 44.02, p = 9.6e-23
   mean difference by temperature (Hz): {11: np.float64(0.311), 13: np.float64(0.374), 15: np.float64(0.5), 17: np.float64(0.613), 19: np.float64(0.728), 21: np.float64(0.828)}
deposited TotalDiffs: F(5,85) = 43.259, p = 5.9e-22 (paper F(5,85) = 43.259)

Result: reproduced. The mean saline minus Cs+ difference grows from 0.31 Hz at 11 C to 0.83 Hz at 21 C, and the temperature effect is significant, F(5,90) = 44.1, p = 9e-23, over the 19 experiments with all six values (969_070 and 969_128 are incomplete); every variant gives F >= 44.0. The deposited TotalDiffs gives the paper's F(5,85) = 43.259 from 18 complete experiments; here 969_068 has an 11 C Cs+ value that the deposited table lacks.

fig1e-q10-lower-in-cs¶

The Q10 of pyloric frequency was lower in Cs+ (1.3) than in saline (1.7), paired t-test p < 0.001, N=21.

Q10 from the six holding-temperature means under O1: (a) the fitted Q10 equation (main), (b) log-linear fit (the deposited code), (c) two-point ratio.

In [17]:
Q = {}
for w in HV:
    for r_ in "abc":
        qs = np.array([P.q10(H[w][e][0]["temp"], H[w][e][0]["freq"], r_) for e in EXPTS])
        qc = np.array([P.q10(H[w][e][1]["temp"], H[w][e][1]["freq"], r_) for e in EXPTS])
        Q[(w, r_)] = (qs, qc)
        t = P.paired(qs, qc)
        print(f"[{w}, {r_}] saline {t['mean_x']:.2f} +- {t['sd_x']:.2f}, Cs {t['mean_y']:.2f} +- {t['sd_y']:.2f}, n {t['n']}, "
              f"paired t p = {t['p_t']:.2g}, Wilcoxon p = {t['p_w']:.2g}; Cs lower in {int(np.sum(qc < qs))}")
print("deposited Q10Sal mean %.2f, Q10Expt mean %.2f" % (np.mean(S["Q10Sal"]), np.mean(S["Q10Expt"])))
[first, a] saline 1.68 +- 0.32, Cs 1.35 +- 0.45, n 21, paired t p = 4.1e-05, Wilcoxon p = 6.7e-05; Cs lower in 18
[first, b] saline 1.71 +- 0.33, Cs 1.35 +- 0.50, n 21, paired t p = 0.00011, Wilcoxon p = 0.00029; Cs lower in 16
[first, c] saline 1.71 +- 0.36, Cs 1.34 +- 0.52, n 19, paired t p = 0.00014, Wilcoxon p = 0.00052; Cs lower in 15
[all, a] saline 1.68 +- 0.32, Cs 1.35 +- 0.45, n 21, paired t p = 4.1e-05, Wilcoxon p = 6.7e-05; Cs lower in 18
[all, b] saline 1.71 +- 0.33, Cs 1.35 +- 0.50, n 21, paired t p = 0.00011, Wilcoxon p = 0.00029; Cs lower in 16
[all, c] saline 1.71 +- 0.36, Cs 1.34 +- 0.52, n 19, paired t p = 0.00014, Wilcoxon p = 0.00052; Cs lower in 15
[first_le, a] saline 1.68 +- 0.32, Cs 1.35 +- 0.45, n 21, paired t p = 4.1e-05, Wilcoxon p = 6.7e-05; Cs lower in 18
[first_le, b] saline 1.71 +- 0.33, Cs 1.35 +- 0.50, n 21, paired t p = 0.00011, Wilcoxon p = 0.00029; Cs lower in 16
[first_le, c] saline 1.71 +- 0.36, Cs 1.34 +- 0.52, n 19, paired t p = 0.00014, Wilcoxon p = 0.00052; Cs lower in 15
[first_gaps, a] saline 1.68 +- 0.32, Cs 1.35 +- 0.45, n 21, paired t p = 4.5e-05, Wilcoxon p = 6.7e-05; Cs lower in 18
[first_gaps, b] saline 1.71 +- 0.33, Cs 1.35 +- 0.50, n 21, paired t p = 0.00012, Wilcoxon p = 0.00029; Cs lower in 16
[first_gaps, c] saline 1.71 +- 0.36, Cs 1.34 +- 0.52, n 19, paired t p = 0.00014, Wilcoxon p = 0.00052; Cs lower in 15
deposited Q10Sal mean 1.72, Q10Expt mean 1.34

Result: reproduced. Under reading (a), mean Q10 is 1.68 +- 0.32 in saline and 1.35 +- 0.45 in Cs+ (21 experiments), within the tolerances of 1.7 and 1.3, paired t-test p = 4.1e-05, Cs+ lower in 18. Readings (b), the deposited code's (1.71 against 1.35, p = 0.00011), and (c) (1.71 against 1.34, p = 0.00014, 19 experiments) agree, as do the variants of the 11 C hold.

fig1f-two-saline-frequency-change-same¶

In experiments with two consecutive saline step protocols, the frequency change from 11 to 21 degrees C did not differ between the first (0.9 Hz) and second (0.8 Hz) protocol.

A claim of absence, paired t-test over the 6 experiments. Five of the six are deposited only as ControlTable's per-experiment values, so the test uses the table's 21 C minus 11 C frequency (Deg_21 - Deg_11, equal to FreqDiff). For 981_025, the one with spikes, the value is recomputed from the spike file.

In [18]:
ct = CT.iloc[:6]
d1 = ct.Deg_21_1.astype(float) - ct.Deg_11_1.astype(float)
d2 = ct.Deg_21_2.astype(float) - ct.Deg_11_2.astype(float)
print(pd.DataFrame({"expt": ctl, "change_1": d1.values, "FreqDiff_1": ct.FreqDiff_1.values, "change_2": d2.values, "FreqDiff_2": ct.FreqDiff_2.values}).round(3).to_string(index=False))
t = stats.ttest_rel(d1, d2)
print(f"first {d1.mean():.2f} +- {d1.std(ddof=1):.2f} Hz, second {d2.mean():.2f} +- {d2.std(ddof=1):.2f} Hz, mean difference {np.mean(d1 - d2):.3f} Hz, "
      f"paired t({len(d1) - 1}) = {t.statistic:.2f}, p = {t.pvalue:.3f}")
# 981_025 from its spike file: conditions 'Saline Steps' and 'Saline Ramp'
d = A["981_025"]
for cond in ("Saline Steps", "Saline Ramp"):
    h = P.hold_means(d, cond, which="first")
    print(f"981_025 {cond}: 11 C {h['freq'][0]:.3f} Hz (n {h['n'][0]}), 21 C {h['freq'][-1]:.3f} Hz (n {h['n'][-1]}), change {h['freq'][-1] - h['freq'][0]:.3f} Hz")
   expt  change_1  FreqDiff_1  change_2  FreqDiff_2
965_129     1.114       1.114     0.825       0.825
965_134     1.136       1.136     1.175       1.175
965_139     0.801       0.801     0.657       0.657
965_146     0.623       0.623     0.728       0.728
981_025     1.186       1.186     0.992       0.992
982_005     0.460       0.460     0.292       0.292
first 0.89 +- 0.30 Hz, second 0.78 +- 0.30 Hz, mean difference 0.108 Hz, paired t(5) = 1.77, p = 0.137
981_025 Saline Steps: 11 C 1.163 Hz (n 298), 21 C 2.382 Hz (n 508), change 1.219 Hz
981_025 Saline Ramp: 11 C 1.202 Hz (n 23), 21 C 2.200 Hz (n 107), change 0.998 Hz

Result: reproduced. The changes are 0.89 +- 0.30 Hz (first) and 0.78 +- 0.30 Hz (second), within the tolerances, and the paired t-test does not find a difference, t(5) = 1.77, p = 0.137 (mean difference 0.11 Hz). The test rests on the deposited per-experiment values: the spike data of five of the six experiments are not deposited. For 981_025 the spike file gives a change of 1.22 Hz for the first protocol and 1.00 Hz for the second, against the table's 1.19 and 0.99.

fig1e-two-saline-q10-same and fig1e-saline-q10-same-across-designs¶

In the two-saline experiments the Q10 of the first protocol (2.0) did not differ from that of the second (1.8).

The saline Q10 did not differ between experiments with two saline protocols and those with one saline and one Cs+ protocol.

Blocked: both criteria judge on Q10 under reading (a), the fit to the six holding-temperature means, which needs the control experiments' spike data; five of the six are not deposited. The deposited Q10 values (made by the deposited code, reading (b)) and reading (c) from the table's 11 and 21 C means are shown as variants.

In [19]:
q1, q2 = ct.Q10_1.astype(float).values, ct.Q10_2.astype(float).values
c1, c2 = (ct.Deg_21_1 / ct.Deg_11_1).astype(float).values, (ct.Deg_21_2 / ct.Deg_11_2).astype(float).values
for lab, a, b in (("deposited Q10 (b)", q1, q2), ("reading (c) from table", c1, c2)):
    t = stats.ttest_rel(a, b)
    print(f"{lab}: first {a.mean():.2f} +- {a.std(ddof=1):.2f}, second {b.mean():.2f} +- {b.std(ddof=1):.2f}, paired t p = {t.pvalue:.3f}")
sal21_b = Q[("first", "b")][0]
for lab, x in (("mean of the two", (q1 + q2) / 2), ("first only", q1), ("12 pooled", np.r_[q1, q2])):
    t = stats.ttest_ind(x, sal21_b)
    print(f"across designs, deposited control Q10 {lab} (n {len(x)}, mean {x.mean():.2f}) vs 21 saline Q10 (b) here (mean {np.nanmean(sal21_b):.2f}): "
          f"two-sample t p = {t.pvalue:.3f}")
t = stats.ttest_ind((q1 + q2) / 2, np.ravel(S["Q10Sal"]))
print(f"deposited control mean of two vs deposited Q10Sal: p = {t.pvalue:.3f} (paper p = 0.26)")
deposited Q10 (b): first 1.98 +- 0.40, second 1.83 +- 0.43, paired t p = 0.144
reading (c) from table: first 1.92 +- 0.41, second 1.79 +- 0.36, paired t p = 0.133
across designs, deposited control Q10 mean of the two (n 6, mean 1.90) vs 21 saline Q10 (b) here (mean 1.71): two-sample t p = 0.244
across designs, deposited control Q10 first only (n 6, mean 1.98) vs 21 saline Q10 (b) here (mean 1.71): two-sample t p = 0.110
across designs, deposited control Q10 12 pooled (n 12, mean 1.90) vs 21 saline Q10 (b) here (mean 1.71): two-sample t p = 0.150
deposited control mean of two vs deposited Q10Sal: p = 0.259 (paper p = 0.26)

Result: blocked (data missing). The criterion's Q10 cannot be computed for five of the six control experiments. Under the variants that can be run, neither comparison finds a difference: the deposited Q10 values give 1.98 against 1.83 (paired t p = 0.144) and reading (c) from the table 1.92 against 1.79 (p = 0.133); across designs, p = 0.244 against the 21 saline Q10 values computed here and p = 0.259 against the deposited ones (the paper's p = 0.26).

fig2c-decrease-by-depolarizing-phase¶

In an example preparation in Cs+, the frequency decrease right after the temperature step from 13 toward 15 degrees C came from an elongation of the PD depolarizing phase, not of the bursting, repolarization or inhibitory phases; a Cs+ + PTX example showed the same.

The criterion's windows: the cycles of the 30 s before the 13 to 15 C step against the cycles of the first 30 s of warming whose period exceeds the pre-step mean. The step onset is the first cycle of the warming (the first cycle above 13.3 C, traced back while the smoothed temperature rose by more than 0.01 C per cycle; a standard choice built on the paper's increasing-temperature rule). Reading (a), three phases on the intracellular PD trace (voltage minimum from a 5 ms moving average, a standard choice); reading (b), four phases from PD and LP spikes. Intracellular PD traces with spike times are deposited for two Cs+ experiments, 969_113 (the paper's Figure 2 example, plotted by the deposited script at 67.9 min) and 969_115. Reading (b) needs only spikes and is also run on the other experiments the summary files mark as intracellular, and on all 21 as a variant. The statement's Cs+ + PTX example lies outside the criterion, which takes the Cs+ experiments; it is run as a variant. The deposited MakePaperFigures_Clean.m plots it from Raw_Expt_981_037.mat ("Figure 5F,G: example of Jag in PTX"; the script's figure numbers run one ahead of the paper's, its "Stats for Fig 5C,D,E" being the paper's Figure 4C to E), at 16.06 min for 90 s. That file holds an intracellular PD trace and the temperature, and no spike file is deposited for 981_037, so PD spikes are detected on the trace (pyloric.trace_spikes) and reading (a) is run on the warming at 16 min, which goes from 11 C toward 14 C in that recording, not from 13 C. The seven raw files and their channels are listed first. Reading (b) is also run on 969_152 in Cs+ + PTX.

In [20]:
def phase_shares(e, cond, trace=False, t_from=13, t_to=15, win=30.0, keep_gaps=False):
    d = A[e]
    c = d["cycles"]
    s_idx, e_idx = d["Timings"][cond]
    m = P.condition_mask(c["start"], d["fileTimes"], s_idx[0], e_idx[0])
    k = P.step_onset(c, m, t_from, t_to)
    if k is None:
        return None
    t_on = c["start"][k]
    pre = np.nonzero(m & (c["start"] >= t_on - win) & (c["start"] < t_on))[0]
    post = np.nonzero(m & (c["start"] >= t_on) & (c["start"] < t_on + win))[0]
    if not keep_gaps:
        pre, post = pre[~c["gap"][pre]], post[~c["gap"][post]]
    post = post[c["period"][post] > np.mean(c["period"][pre])]
    ph = {"burst": c["pd_dur"], "repol_b": c["LP_lat_on"] - c["pd_dur"], "inhib_b": c["LP_lat_off"] - c["LP_lat_on"],
          "depol_b": c["period"] - c["LP_lat_off"]}
    if trace:
        v, _ = P.raw_trace(e, "PD", t_on - win - 5, t_on + win + 5)
        v = np.convolve(v, np.ones(50) / 50, mode="same")
        t0 = t_on - win - 5
        rep = np.full(len(c["period"]), np.nan)
        for i in np.r_[pre, post]:
            a = int((c["start"][i] + c["pd_dur"][i] - t0) * 1e4)
            b = int((c["start"][i] + c["period"][i] - t0) * 1e4)
            if b > a:
                rep[i] = (np.argmin(v[a:b])) / 1e4
        ph["repol_a"] = rep
        ph["depol_a"] = c["period"] - c["pd_dur"] - rep
    dper = np.mean(c["period"][post]) - np.mean(c["period"][pre])
    out = {"expt": e, "cond": cond, "onset_min": t_on / 60, "T_onset": c["temp"][k], "n_pre": len(pre), "n_post": len(post),
           "period_pre": np.mean(c["period"][pre]), "period_post": np.mean(c["period"][post]) if len(post) else np.nan, "dperiod_ms": 1e3 * dper}
    for kk, v_ in ph.items():
        out[f"share_{kk}"] = (np.nanmean(v_[post]) - np.nanmean(v_[pre])) / dper if len(post) else np.nan
    return out

rows = [phase_shares(e, CS[e], trace=True) for e in ("969_113", "969_115")]
fa = pd.DataFrame([r for r in rows if r])
print("Intracellular PD traces, Cs+, step 13 -> 15 C; share of the period increase carried by each phase:")
print(fa.round(3).to_string(index=False))
fg = pd.DataFrame([phase_shares(e, CS[e], trace=True, keep_gaps=True) for e in ("969_113", "969_115")])
print("variant, gap cycles kept:")
print(fg[["expt", "n_pre", "n_post", "dperiod_ms", "share_burst", "share_repol_a", "share_depol_a"]].round(3).to_string(index=False))
Intracellular PD traces, Cs+, step 13 -> 15 C; share of the period increase carried by each phase:
   expt cond  onset_min  T_onset  n_pre  n_post  period_pre  period_post  dperiod_ms  share_burst  share_repol_b  share_inhib_b  share_depol_b  share_repol_a  share_depol_a
969_113   Cs     67.879   13.205     34      30       0.826        0.904      78.081        0.047          0.579         -0.748          0.955         -0.340          1.293
969_115   Cs     31.978   13.134     30      21       0.986        1.012      26.053        0.024          0.760         -0.131          0.347         -0.656          1.632
variant, gap cycles kept:
   expt  n_pre  n_post  dperiod_ms  share_burst  share_repol_a  share_depol_a
969_113     35      31      79.833        0.051         -0.355          1.304
969_115     30      21      26.053        0.024         -0.656          1.632
In [21]:
intra = ["969_106", "969_113", "969_115", "969_128", "969_152"]
rb = pd.DataFrame([r for r in (phase_shares(e, CS[e]) for e in EXPTS) if r])
rb["intra"] = rb.expt.isin(intra)
cols = ["expt", "intra", "onset_min", "T_onset", "n_pre", "n_post", "dperiod_ms", "share_burst", "share_repol_b", "share_inhib_b", "share_depol_b"]
print("Reading (b), spikes only, Cs+, 13 -> 15 C, every experiment with a step onset found:")
print(rb[cols].round(3).to_string(index=False))
sub = rb[rb.intra & (rb.n_post > 0)]
print(f"\nintracellular experiments with a period increase: {len(sub)}; depolarizing share > 0.5 in {int((sub.share_depol_b > 0.5).sum())}")
allp = rb[rb.n_post > 0]
print(f"all experiments with a period increase: {len(allp)}; depolarizing share > 0.5 in {int((allp.share_depol_b > 0.5).sum())}; "
      f"median shares burst {allp.share_burst.median():.2f}, repol {allp.share_repol_b.median():.2f}, inhib {allp.share_inhib_b.median():.2f}, depol {allp.share_depol_b.median():.2f}")
print("experiments with no cycle longer than the pre-step mean in the first 30 s:", rb[rb.n_post == 0].expt.tolist())
rbg = pd.DataFrame([r for r in (phase_shares(e, CS[e], keep_gaps=True) for e in EXPTS) if r])
sg, ag = rbg[rbg.expt.isin(intra) & (rbg.n_post > 0)], rbg[rbg.n_post > 0]
print(f"variant, gap cycles kept: intracellular {int((sg.share_depol_b > 0.5).sum())} of {len(sg)}, all {int((ag.share_depol_b > 0.5).sum())} of {len(ag)} with depolarizing share > 0.5; "
      f"largest change of a share against the main reading {np.nanmax(np.abs(rbg.set_index('expt')[cols[7:]] - rb.set_index('expt')[cols[7:]]).values):.3f}")
ptx = phase_shares("969_152", "PTX_Cs")
print("\nCs+ + PTX, 969_152, reading (b):", {k: (round(v, 3) if isinstance(v, float) else v) for k, v in ptx.items()} if ptx else None)
d = A["969_152"]; c = d["cycles"]; t_on = ptx["onset_min"] * 60
nlp = int(np.sum((d["LP"] >= t_on - 30) & (d["LP"] < t_on + 30)))
s_idx, e_idx = d["Timings"]["PTX_Cs"]
mw = P.condition_mask(c["start"], d["fileTimes"], s_idx[0], e_idx[0])
lo, hi = c["start"][mw][0], c["start"][mw][-1]
print(f"969_152, Cs+ + PTX: LP spikes within 30 s of the step onset {nlp}; in the whole condition window {int(np.sum((d['LP'] >= lo) & (d['LP'] <= hi)))} "
      f"(saline window: {int(np.sum(~np.isnan(c['LP_ON'][P.condition_mask(c['start'], d['fileTimes'], *[x[0] for x in d['Timings']['Saline']])])))} cycles with an LP onset)")
Reading (b), spikes only, Cs+, 13 -> 15 C, every experiment with a step onset found:
   expt  intra  onset_min  T_onset  n_pre  n_post  dperiod_ms  share_burst  share_repol_b  share_inhib_b  share_depol_b
965_106  False     72.330   13.317     26      10      26.559       -0.075          0.007         -0.246          1.315
969_058  False     89.077   13.303     43      14      12.925        0.519         -0.476         -0.108          1.065
969_062  False     55.736   12.905     22       2      15.736        0.269         -0.051         -1.212          1.993
969_065  False     80.261   12.874     34       4       2.796       -1.139          2.597         -1.703          1.245
969_068  False     44.904   13.097     33      24      39.499        0.181          0.010          0.034          0.774
969_070  False     32.016   13.310     34      16      17.285        0.017         -0.071          1.342         -0.287
969_083  False     64.319   12.740     13      10     251.762       -0.051          0.082         -0.069          1.038
969_085  False     66.277   13.188     19      13      48.728       -0.116          0.266          0.066          0.783
969_087  False     12.765   12.821     23       4      18.340       -1.547          2.440         -1.700          1.807
969_088  False     80.495   13.302     36      12      20.722       -0.025         -0.134          0.587          0.572
969_089  False     44.133   12.996     27      20     135.926        0.012          0.195          0.137          0.657
969_091  False     34.647   13.153     38      30      58.249        0.161          0.951         -0.846          0.734
969_106   True     68.464   13.174     17       6      46.513       -0.267          0.277          0.209          0.780
969_113   True     67.879   13.205     34      30      78.081        0.047          0.579         -0.748          0.955
969_115   True     31.978   13.134     30      21      26.053        0.024          0.760         -0.131          0.347
969_128   True     48.177   12.910     18       9     298.789        0.281         -0.024         -0.028          0.771
969_135  False     31.812   12.812     28       6      29.011       -0.387          1.255         -1.168          1.300
969_147  False     66.179   13.084     18       0         NaN          NaN            NaN            NaN            NaN
969_150  False     24.824   13.138     33      24      23.511       -0.110          0.603          0.155          0.352
969_152   True     50.031   13.124     32      15      10.738       -0.119          0.152         -2.378          3.345
981_010  False     61.311   13.244     25      20      47.710       -0.463          1.056         -2.035          2.441

intracellular experiments with a period increase: 5; depolarizing share > 0.5 in 4
all experiments with a period increase: 20; depolarizing share > 0.5 in 17; median shares burst -0.04, repol 0.23, inhib -0.12, depol 0.87
experiments with no cycle longer than the pre-step mean in the first 30 s: ['969_147']
variant, gap cycles kept: intracellular 4 of 5, all 16 of 20 with depolarizing share > 0.5; largest change of a share against the main reading 8.303

Cs+ + PTX, 969_152, reading (b): {'expt': '969_152', 'cond': 'PTX_Cs', 'onset_min': np.float64(100.334), 'T_onset': np.float64(13.114), 'n_pre': 30, 'n_post': 7, 'period_pre': np.float64(0.923), 'period_post': np.float64(0.942), 'dperiod_ms': np.float64(18.656), 'share_burst': np.float64(-0.519), 'share_repol_b': np.float64(nan), 'share_inhib_b': np.float64(nan), 'share_depol_b': np.float64(nan)}
969_152, Cs+ + PTX: LP spikes within 30 s of the step onset 0; in the whole condition window 11931 (saline window: 2324 cycles with an LP onset)
In [22]:
# The deposited raw files: channels, and whether a spike file exists for the experiment.
for e in ["969_087", "969_113", "969_115", "969_137", "969_147", "981_007", "981_037"]:
    print(f"Raw_Expt_{e}.mat: channels {P.raw_channels(e)}; spike file {'yes' if f'{e}_SpikeAndTemp.mat' in spike_files else 'no'}")
# Raw files with an intracellular PD channel and no spike file: does the temperature step?
for e in ["981_007"]:
    T_, n_ = P.raw_trace(e, "temp", 0, 1e6)
    Tm = T_[: len(T_) // 300000 * 300000].reshape(-1, 300000).mean(axis=1)
    print(f"Raw_Expt_{e}.mat: {n_ / 6e5:.1f} min; temperature (30 s means) {Tm.min():.2f} to {Tm.max():.2f} C")
    del T_

# Cs+ + PTX example of Figure 4F,G: Raw_Expt_981_037.mat, reading (a) on the warming at 16 min.
t0, t1 = 8 * 60.0, 26 * 60.0
v37, _ = P.raw_trace("981_037", "PD", t0, t1)
T37, _ = P.raw_trace("981_037", "temp", t0, t1)
sp37 = t0 + P.trace_spikes(v37)
st, fr, spb, per, dur, gap = P.extract_bursts(sp37, 0.2, 2, return_gaps=True)
print(f"\n981_037, {t0 / 60:.0f}-{t1 / 60:.0f} min: {len(sp37)} PD spikes detected, {len(st)} bursts, median {np.median(spb):.0f} spikes per burst, "
      f"median frequency {np.median(fr):.2f} Hz; spike peaks {np.percentile(v37[np.round((sp37 - t0) * 1e4).astype(int)], [5, 50, 95]).round(1)} mV "
      f"(5th, 50th, 95th percentile), trace 1st-99th percentile {np.percentile(v37, [1, 99]).round(1)} mV")
ti = t0 + np.arange(len(T37)) / 1e4
csT = np.concatenate([[0.0], np.cumsum(T37)])
a_, b_ = np.searchsorted(ti, st[:-1]), np.searchsorted(ti, st[1:])
c37 = {"temp": (csT[b_] - csT[a_]) / np.maximum(b_ - a_, 1)}
k = P.step_onset(c37, np.ones(len(per), bool), 11, 14)
pre = np.nonzero((st[:-1] >= st[k] - 30) & (st[:-1] < st[k]) & ~gap)[0]
post = np.nonzero((st[:-1] >= st[k]) & (st[:-1] < st[k] + 30) & ~gap)[0]
post = post[per[post] > per[pre].mean()]
vs = np.convolve(v37, np.ones(50) / 50, mode="same")
rep37 = np.full(len(per), np.nan)
for i in np.r_[pre, post]:
    a_, b_ = int((st[i] + dur[i] - t0) * 1e4), int((st[i] + per[i] - t0) * 1e4)
    rep37[i] = np.argmin(vs[a_:b_]) / 1e4
dP = per[post].mean() - per[pre].mean()
print(f"warming onset {st[k] / 60:.2f} min (deposited plotting call 16.06 min) at {c37['temp'][k]:.2f} C, 30 s later {c37['temp'][post[-1]]:.2f} C; "
      f"cycles pre {len(pre)}, post (longer than the pre mean) {len(post)}; period {1e3 * per[pre].mean():.0f} -> {1e3 * per[post].mean():.0f} ms")
for name, x in (("burst", dur), ("repolarization", rep37), ("depolarization", per - dur - rep37)):
    print(f"   share of the period increase, {name}: {(np.nanmean(x[post]) - np.nanmean(x[pre])) / dP:.2f}")
Raw_Expt_969_087.mat: channels ['lvn', 'pdn', 'temp']; spike file yes
Raw_Expt_969_113.mat: channels ['PD', 'LP', 'lvn', 'temp']; spike file yes
Raw_Expt_969_115.mat: channels ['PD', 'LP', 'temp']; spike file yes
Raw_Expt_969_137.mat: channels ['PY', 'lvn', 'pdn', 'temp']; spike file no
Raw_Expt_969_147.mat: channels ['pyn1', 'pdn', 'lvn', 'pyn', 'temp']; spike file yes
Raw_Expt_981_007.mat: channels ['PD', 'lvn', 'pdn', 'temp']; spike file no
Raw_Expt_981_037.mat: channels ['PD', 'temp']; spike file no
Raw_Expt_981_007.mat: 187.4 min; temperature (30 s means) 9.56 to 11.66 C
981_037, 8-26 min: 2813 PD spikes detected, 693 bursts, median 4 spikes per burst, median frequency 0.66 Hz; spike peaks [-32.2 -29.2 -26.5] mV (5th, 50th, 95th percentile), trace 1st-99th percentile [-73.1 -36.1] mV
warming onset 16.10 min (deposited plotting call 16.06 min) at 11.29 C, 30 s later 13.41 C; cycles pre 18, post (longer than the pre mean) 14; period 1628 -> 2146 ms
   share of the period increase, burst: -0.01
   share of the period increase, repolarization: 0.06
   share of the period increase, depolarization: 0.96

Result: reproduced. Under reading (a), on the two Cs+ experiments with an intracellular PD trace and spike times, the depolarizing phase (voltage minimum to the next burst) carries 1.29 (969_113, the paper's example) and 1.63 (969_115) of the period increase in the first 30 s of warming from 13 C, the burst 0.05 and 0.02, and the repolarization shrinks (-0.34 and -0.66); with the gap cycles kept the shares change by at most 0.015. Under reading (b), from spikes, the depolarizing phase (last LP spike to the next PD burst) carries more than half in 4 of the 5 experiments marked intracellular (0.35 in 969_115, where the repolarization to the first LP spike carries 0.76), and in 17 of the 20 Cs+ experiments with a period increase (16 of 20 with the gap cycles kept). The statement's Cs+ + PTX example, outside the criterion: in Raw_Expt_981_037.mat, the trace the deposited script plots as the PTX example, the period rises from 1628 to 2146 ms in the first 30 s of the warming at 16.10 min (from 11.3 C), and the depolarizing phase carries 0.96 of the increase, the burst -0.01 and the repolarization 0.06, so that part holds too, on a step from 11 C, not 13 C, and with spikes detected on the trace. In 969_152 under Cs+ + PTX no LP spike falls within 30 s of the step onset (the window holds LP spikes elsewhere), so reading (b) cannot be formed there. No other raw file can add a Cs+ warming with an intracellular PD trace: 969_087 and 969_147 are extracellular only, 969_137 holds PY, and 981_007, whose PD trace the deposited script plots as the saline and Cs+ example of the paper's Figure 5E, stays between 9.6 and 11.7 C over its 187 min, so it has no warming step.**

fig3d-freq-decrease-while-warming and fig3e-freq-increase-when-stable¶

Among temperature-increasing cycles, the percent with a frequency decrease was higher in Cs+ (31.4%) than in saline (7.5%), and higher in Cs+ in 20 of 21 experiments.

Among temperature-stable cycles, the percent with a frequency increase was higher in Cs+ (27.6%) than in saline (14.1%), and higher in Cs+ in 20 of 21 experiments.

The jag measure under the O3 readings: centred (MATLAB smooth, as the deposited ProbabilityUpDown.m) or trailing moving average; span window, the Timings window (deposited code), with stable cycles those whose smoothed change is within +-0.01 C (|dT| < 0.01, the deposited code and the Figure 3A legend, "change less than 0.01 C/pyloric cycle"); span steps, the step protocol from the first 11 C cycle to the end of the 21 C hold (O3 (a)), and span recording, the window extended over the cooling back to 11 C (O3 (b); the Timings windows end at the 21 C hold, and the cooling comes before the solution change, Methods, Temperature protocol), both with every cycle that did not warm counted as stable (dT <= 0.01, the Methods and the claims file header). The deposited code smooths the whole recording, across condition boundaries; smoothed within smooths only the cycles of the window, a variant.

In [23]:
J = {}
rows = []
for centred, span, within in [(c_, s_, False) for c_ in (True, False) for s_ in ("window", "steps", "recording")] + [(True, "window", True)]:
    v = np.array([[*P.jag_measure(A[e], "Saline", centred, span, smooth_within=within), *P.jag_measure(A[e], CS[e], centred, span, smooth_within=within)] for e in EXPTS])
    J[(centred, span) if not within else "within"] = v
    dec_s, inc_s, dec_c, inc_c = v[:, 0], v[:, 1], v[:, 4], v[:, 5]
    rows.append({"smoothing": ("centred" if centred else "trailing") + (", smoothed within" if within else ""), "span": span,
                 "dec_saline": f"{dec_s.mean():.1f} +- {dec_s.std(ddof=1):.1f}", "dec_Cs": f"{dec_c.mean():.1f} +- {dec_c.std(ddof=1):.1f}",
                 "dec_Cs_higher": int((dec_c > dec_s).sum()), "dec_p": stats.ttest_rel(dec_c, dec_s).pvalue,
                 "inc_saline": f"{inc_s.mean():.1f} +- {inc_s.std(ddof=1):.1f}", "inc_Cs": f"{inc_c.mean():.1f} +- {inc_c.std(ddof=1):.1f}",
                 "inc_Cs_higher": int((inc_c > inc_s).sum()), "inc_p": stats.ttest_rel(inc_c, inc_s).pvalue,
                 "warming_cycles": f"{int(v[:, 2].min())}-{int(v[:, 2].max())}", "stable_cycles": f"{int(v[:, 3].min())}-{int(v[:, 3].max())}"})
print(pd.DataFrame(rows).to_string(index=False))
SW = P.load_mat("Sawtooth.mat")
dep_dec, dep_inc = 100 * np.asarray(SW["DecFreq"]), 100 * np.asarray(SW["IncFreqTempZCnt"])
sw_files = [str(np.ravel(x)[0]) for x in np.ravel(SW["files"]["name"])]
order = [sw_files.index(e) for e in EXPTS]
v = J[(True, "window")]
print(f"\ndeposited Sawtooth.mat: dec saline {dep_dec[0].mean():.1f}, Cs {dep_dec[1].mean():.1f}; inc saline {dep_inc[0].mean():.1f}, Cs {dep_inc[1].mean():.1f}")
print("per experiment, centred/window here against deposited (percent):")
print(pd.DataFrame({"dec_sal": v[:, 0], "dep": dep_dec[0, order], "dec_cs": v[:, 4], "dep ": dep_dec[1, order],
                    "inc_sal": v[:, 1], "dep  ": dep_inc[0, order], "inc_cs": v[:, 5], "dep   ": dep_inc[1, order]}, index=EXPTS).round(1).T.to_string())
               smoothing      span dec_saline       dec_Cs  dec_Cs_higher        dec_p  inc_saline      inc_Cs  inc_Cs_higher        inc_p warming_cycles stable_cycles
                 centred    window 6.3 +- 4.8 31.0 +- 15.7             20 4.292752e-07 13.2 +- 5.4 26.9 +- 6.2             20 3.392825e-09        253-685     1076-4383
                 centred     steps 5.6 +- 5.0 31.6 +- 19.4             20 7.120436e-06 11.8 +- 5.0 25.7 +- 6.9             20 1.120640e-07        253-447     1112-3585
                 centred recording 7.2 +- 5.7 30.9 +- 15.4             20 1.551819e-06 13.4 +- 5.9 27.1 +- 5.7             20 3.070553e-08        259-896     1296-7228
                trailing    window 5.8 +- 4.3 28.4 +- 14.0             20 6.336441e-07 12.5 +- 5.6 26.8 +- 6.2             20 1.658629e-09        243-677     1075-4383
                trailing     steps 5.1 +- 4.9 28.0 +- 17.1             20 1.275150e-05 11.2 +- 5.2 25.1 +- 6.8             20 1.105563e-07        243-440     1112-3592
                trailing recording 6.6 +- 5.5 28.3 +- 13.8             20 2.349829e-06 12.9 +- 6.0 26.9 +- 6.0             20 3.168060e-08        259-890     1300-7231
centred, smoothed within    window 6.3 +- 4.8 31.1 +- 15.7             20 4.165560e-07 13.3 +- 5.3 27.3 +- 6.2             20 2.910652e-09        253-685     1073-4382

deposited Sawtooth.mat: dec saline 7.5, Cs 31.4; inc saline 14.1, Cs 27.6
per experiment, centred/window here against deposited (percent):
         965_106  969_058  969_062  969_065  969_068  969_070  969_083  969_085  969_087  969_088  969_089  969_091  969_106  969_113  969_115  969_128  969_135  969_147  969_150  969_152  981_010
dec_sal     15.3      3.3      9.3     14.3     12.3      2.8      3.0      7.5      2.3      6.0      1.1     10.4      2.5      4.3     12.5     12.4      3.0      0.5      3.3      0.6      5.4
dep         13.8      4.8     12.5     17.5     15.5      4.3      4.7      8.4      3.3      5.8      1.9     10.7      4.5      4.2     12.3     13.2      4.1      2.3      4.2      1.1      8.5
dec_cs      53.5     11.0     21.3     10.4     32.9     27.1     42.8     22.6     25.0     33.2     44.0     34.9     16.2     62.0     25.1     63.6     21.1     32.1     39.5      7.1     25.8
dep         53.8     11.4     23.3     10.4     33.1     28.0     43.3     24.1     26.5     34.0     47.7     34.4     14.8     58.0     26.0     62.1     20.4     31.3     39.8      8.0     29.7
inc_sal     18.6      9.9     17.1     25.1     15.6      8.4     21.1     16.1      6.9     13.5     11.4     14.2      8.5     10.2      9.7     17.8     19.3      6.9      6.8      6.1     12.9
dep         19.4     10.6     18.7     26.7     17.6      8.5     21.4     16.5      7.8     14.0     12.5     14.6     10.0     10.9     10.1     19.5     19.2      7.0      8.1      7.7     16.1
inc_cs      30.8     28.0     33.7     17.9     27.2     25.4     35.7     30.6     18.4     32.8     34.5     31.3     18.5     29.3     16.4     29.2     31.3     23.8     28.1     15.9     26.6
dep         31.8     27.8     34.3     18.5     27.4     25.5     37.5     31.3     20.3     33.1     34.5     31.7     19.8     29.4     17.8     30.6     31.2     24.3     28.8     16.3     28.6

Result: reproduced (both claims). Under the centred window reading (the deposited code's), the percent of warming cycles with a frequency decrease is 6.3 +- 4.8 in saline and 31.0 +- 15.7 in Cs+, higher in Cs+ in 20 of 21, paired t p = 4e-07; the percent of stable cycles with an increase is 13.2 +- 5.4 and 26.9 +- 6.2, higher in Cs+ in 20 of 21, p = 3e-09. All seven readings (centred and trailing; the window, the step protocol, and the window with the cooling, O3 (b); and smoothing within the window) give means within the tolerances, 20 of 21 and p < 2e-05. Per experiment the values are close to the deposited Sawtooth.mat.**

fig4c-ptx-restores-frequency-change, fig4d-ptx-keeps-decrease-while-warming, fig4e-stable-increase-ordering¶

The frequency change from 11 to 21 degrees C differed by condition; it was smaller in Cs+ than in saline or in Cs+ + PTX, with no difference between saline and Cs+ + PTX.

The percent of temperature-increasing cycles with a frequency decrease differed by condition; it was higher in Cs+ and in Cs+ + PTX than in saline, with no difference between Cs+ and Cs+ + PTX.

The percent of temperature-stable cycles with a frequency increase differed between all three conditions, lowest in saline, middle in Cs+ and highest in Cs+ + PTX.

The picrotoxin experiments are the paper's six: 969_147, 969_150, 969_152, 969_154, and the two preparations of 981_035 (its PD and PD2 trains, two rhythms recorded with one thermocouple, data check above). For 969_147 the Cs+ protocol is Cs_1 (it matches the deposited summary; Cs_2 is a second, shorter Cs+ window). 981_035 never came within 0.3 C of 21 C (its top hold is at 20.7 C), so with the 0.3 C rule it has no 21 C value; the deposited summary has one, so a variant uses 0.5 C for the 21 C hold. gaps kept is the frequency change with the cycles left by the outlier removal kept, as the deposited code keeps them.

In [24]:
PTX6 = PTX_EXPTS + ["981_035_PD2"]
CS_PTX = {e: ("Cs_1" if e == "969_147" else "Cs") for e in PTX6}
conds = lambda e: ["Saline", CS_PTX[e], "PTX_Cs"]
def dfreq(e, moe_top, drop_gaps=True):
    out = []
    for i, cnd in enumerate(conds(e)):
        h = P.hold_means(A[e], cnd, which="first", strict_cs=i > 0, drop_gaps=drop_gaps)
        top = P.hold_means(A[e], cnd, which="all", strict_cs=i > 0, moe=moe_top, drop_gaps=drop_gaps)
        out.append(top["freq"][-1] - h["freq"][0])
    return out
names3 = ["saline", "Cs", "Cs+PTX"]
def report(Y, label):
    F, d1, d2, p, _, n = P.rm_anova(Y)
    print(f"  {label}: n {n}, means {dict(zip(names3, np.nanmean(Y[~np.isnan(Y).any(1)], 0).round(3)))}, F({d1},{d2}) = {F:.2f}, p = {p:.3g}")
    for t in P.tukey_rm(Y, names3):
        print(f"     {t['pair']:18s} diff {t['diff']:+.3f}  p multcompare {t['p_multcompare']:.3f}  p classic {t['p_classic']:.3f}")
for moe_top in (0.3, 0.5):
    Y6 = np.array([dfreq(e, moe_top) for e in PTX6])
    print(f"21 C hold within {moe_top} C:")
    print(pd.DataFrame(Y6, index=PTX6, columns=names3).round(3).to_string())
    report(Y6, "six (paper's set)")
    report(np.array([dfreq(e, moe_top, drop_gaps=False) for e in PTX6]), "six, gaps kept")
SPt = np.c_[np.asarray(SP["TotalSals"])[:, -1] - np.asarray(SP["TotalSals"])[:, 0], np.asarray(SP["TotalExpts"])[:, -1] - np.asarray(SP["TotalExpts"])[:, 0],
            np.asarray(SP["TotalExpts1"])[:, -1] - np.asarray(SP["TotalExpts1"])[:, 0]]
print("deposited SummaryStatisticsPTX:")
report(SPt, "six, deposited values")
21 C hold within 0.3 C:
             saline     Cs  Cs+PTX
969_147       0.890  0.502   0.724
969_150       0.793 -0.282   0.435
969_152       1.328  1.085   0.912
969_154       0.621  0.382   0.677
981_035         NaN    NaN   0.639
981_035_PD2     NaN    NaN   0.505
  six (paper's set): n 4, means {'saline': np.float64(0.908), 'Cs': np.float64(0.422), 'Cs+PTX': np.float64(0.687)}, F(2,6) = 4.21, p = 0.072
     saline - Cs        diff +0.486  p multcompare 0.177  p classic 0.062
     saline - Cs+PTX    diff +0.221  p multcompare 0.242  p classic 0.437
     Cs - Cs+PTX        diff -0.265  p multcompare 0.423  p classic 0.323
  six, gaps kept: n 4, means {'saline': np.float64(0.908), 'Cs': np.float64(0.421), 'Cs+PTX': np.float64(0.686)}, F(2,6) = 4.20, p = 0.0724
     saline - Cs        diff +0.486  p multcompare 0.178  p classic 0.062
     saline - Cs+PTX    diff +0.222  p multcompare 0.241  p classic 0.436
     Cs - Cs+PTX        diff -0.265  p multcompare 0.425  p classic 0.326
21 C hold within 0.5 C:
             saline     Cs  Cs+PTX
969_147       0.889  0.487   0.723
969_150       0.813 -0.288   0.435
969_152       1.322  1.101   0.911
969_154       0.639  0.388   0.715
981_035       1.079  0.571   0.906
981_035_PD2   0.794  0.011   0.715
  six (paper's set): n 6, means {'saline': np.float64(0.923), 'Cs': np.float64(0.378), 'Cs+PTX': np.float64(0.734)}, F(2,10) = 10.43, p = 0.00358
     saline - Cs        diff +0.544  p multcompare 0.025  p classic 0.003
     saline - Cs+PTX    diff +0.189  p multcompare 0.114  p classic 0.307
     Cs - Cs+PTX        diff -0.356  p multcompare 0.106  p classic 0.036
  six, gaps kept: n 6, means {'saline': np.float64(0.922), 'Cs': np.float64(0.378), 'Cs+PTX': np.float64(0.734)}, F(2,10) = 10.38, p = 0.00363
     saline - Cs        diff +0.544  p multcompare 0.026  p classic 0.003
     saline - Cs+PTX    diff +0.189  p multcompare 0.115  p classic 0.308
     Cs - Cs+PTX        diff -0.356  p multcompare 0.106  p classic 0.037
deposited SummaryStatisticsPTX:
  six, deposited values: n 6, means {'saline': np.float64(0.907), 'Cs': np.float64(0.347), 'Cs+PTX': np.float64(0.774)}, F(2,10) = 12.27, p = 0.00203
     saline - Cs        diff +0.560  p multcompare 0.041  p classic 0.002
     saline - Cs+PTX    diff +0.133  p multcompare 0.362  p classic 0.520
     Cs - Cs+PTX        diff -0.427  p multcompare 0.010  p classic 0.012
In [25]:
JP = {}
for centred in (True, False):
    for span in ("window", "steps", "recording"):
        JP[(centred, span)] = np.array([[P.jag_measure(A[e], cnd, centred, span)[:2] for cnd in conds(e)] for e in PTX6])
for centred, span in JP:
    v = JP[(centred, span)]
    print(f"[{'centred' if centred else 'trailing'}, {span}] decrease while warming (percent):")
    print(pd.DataFrame(v[:, :, 0], index=PTX6, columns=names3).round(1).T.to_string())
    report(v[:, :, 0], "six")
dp = 100 * np.asarray(SWP["DecFreq"]).T
print("deposited SawtoothPTX DecFreq (percent), columns as its file list plus a sixth:")
print(dp.round(1).T)
report(dp, "six, deposited values")
[centred, window] decrease while warming (percent):
        969_147  969_150  969_152  969_154  981_035  981_035_PD2
saline      0.5      3.3      0.6      4.4      0.9          2.6
Cs         32.1     39.5      7.1     20.6     19.5         54.4
Cs+PTX     16.6     44.9     15.4     38.6     38.9         30.1
  six: n 6, means {'saline': np.float64(2.046), 'Cs': np.float64(28.884), 'Cs+PTX': np.float64(30.761)}, F(2,10) = 13.00, p = 0.00165
     saline - Cs        diff -26.839  p multcompare 0.023  p classic 0.004
     saline - Cs+PTX    diff -28.715  p multcompare 0.004  p classic 0.003
     Cs - Cs+PTX        diff -1.877  p multcompare 0.965  p classic 0.953
[centred, steps] decrease while warming (percent):
        969_147  969_150  969_152  969_154  981_035  981_035_PD2
saline      0.5      3.3      0.6      4.4      0.9          2.6
Cs         32.1     39.5      6.3     20.6     19.5         54.4
Cs+PTX     16.6     44.9     15.4     38.6     38.9         30.1
  six: n 6, means {'saline': np.float64(2.046), 'Cs': np.float64(28.752), 'Cs+PTX': np.float64(30.761)}, F(2,10) = 12.79, p = 0.00175
     saline - Cs        diff -26.706  p multcompare 0.024  p classic 0.005
     saline - Cs+PTX    diff -28.715  p multcompare 0.004  p classic 0.003
     Cs - Cs+PTX        diff -2.009  p multcompare 0.960  p classic 0.946
[centred, recording] decrease while warming (percent):
        969_147  969_150  969_152  969_154  981_035  981_035_PD2
saline      0.5      3.3      0.6      4.4      0.8          2.4
Cs         32.1     39.5      7.1     20.6     17.9         55.9
Cs+PTX     16.6     44.9     15.4     38.6     39.0         31.8
  six: n 6, means {'saline': np.float64(1.993), 'Cs': np.float64(28.857), 'Cs+PTX': np.float64(31.058)}, F(2,10) = 12.63, p = 0.00183
     saline - Cs        diff -26.863  p multcompare 0.026  p classic 0.005
     saline - Cs+PTX    diff -29.064  p multcompare 0.003  p classic 0.003
     Cs - Cs+PTX        diff -2.201  p multcompare 0.953  p classic 0.938
[trailing, window] decrease while warming (percent):
        969_147  969_150  969_152  969_154  981_035  981_035_PD2
saline      0.9      1.9      0.3      2.2      0.3          1.6
Cs         22.2     36.9      6.4     30.1     23.0         58.2
Cs+PTX     15.6     45.9     15.2     43.3     40.4         31.8
  six: n 6, means {'saline': np.float64(1.208), 'Cs': np.float64(29.461), 'Cs+PTX': np.float64(32.024)}, F(2,10) = 14.46, p = 0.00112
     saline - Cs        diff -28.254  p multcompare 0.021  p classic 0.003
     saline - Cs+PTX    diff -30.816  p multcompare 0.005  p classic 0.002
     Cs - Cs+PTX        diff -2.562  p multcompare 0.923  p classic 0.915
[trailing, steps] decrease while warming (percent):
        969_147  969_150  969_152  969_154  981_035  981_035_PD2
saline      0.9      1.9      0.3      2.2      0.3          1.6
Cs         22.2     36.9      1.9     30.1     23.0         58.2
Cs+PTX     15.6     45.9     15.2     43.3     40.4         31.8
  six: n 6, means {'saline': np.float64(1.208), 'Cs': np.float64(28.712), 'Cs+PTX': np.float64(32.024)}, F(2,10) = 13.11, p = 0.0016
     saline - Cs        diff -27.505  p multcompare 0.031  p classic 0.005
     saline - Cs+PTX    diff -30.816  p multcompare 0.005  p classic 0.002
     Cs - Cs+PTX        diff -3.311  p multcompare 0.882  p classic 0.872
[trailing, recording] decrease while warming (percent):
        969_147  969_150  969_152  969_154  981_035  981_035_PD2
saline      0.9      1.9      0.3      2.2      1.1          1.5
Cs         22.2     36.9      6.9     30.1     24.5         63.1
Cs+PTX     15.6     45.9     15.2     43.3     41.2         32.0
  six: n 6, means {'saline': np.float64(1.319), 'Cs': np.float64(30.613), 'Cs+PTX': np.float64(32.19)}, F(2,10) = 13.03, p = 0.00164
     saline - Cs        diff -29.294  p multcompare 0.026  p classic 0.004
     saline - Cs+PTX    diff -30.871  p multcompare 0.005  p classic 0.003
     Cs - Cs+PTX        diff -1.577  p multcompare 0.975  p classic 0.971
deposited SawtoothPTX DecFreq (percent), columns as its file list plus a sixth:
[[ 0.7  3.9  1.1  4.7  1.3  2. ]
 [30.5 38.6  8.  20.9 19.7 55.1]
 [17.6 46.6 16.  38.1 39.3 29.7]]
  six, deposited values: n 6, means {'saline': np.float64(2.283), 'Cs': np.float64(28.796), 'Cs+PTX': np.float64(31.219)}, F(2,10) = 13.08, p = 0.00162
     saline - Cs        diff -26.513  p multcompare 0.024  p classic 0.005
     saline - Cs+PTX    diff -28.937  p multcompare 0.003  p classic 0.003
     Cs - Cs+PTX        diff -2.423  p multcompare 0.941  p classic 0.922
In [26]:
for centred, span in JP:
    v = JP[(centred, span)]
    print(f"[{'centred' if centred else 'trailing'}, {span}] increase while stable (percent):")
    print(pd.DataFrame(v[:, :, 1], index=PTX6, columns=names3).round(1).T.to_string())
    report(v[:, :, 1], "six")
ip = 100 * np.asarray(SWP["IncFreqTempZCnt"]).T
report(ip, "six, deposited values")
[centred, window] increase while stable (percent):
        969_147  969_150  969_152  969_154  981_035  981_035_PD2
saline      6.9      6.8      6.1     12.8      4.3          8.2
Cs         23.8     28.1     15.9     27.3     18.8         33.8
Cs+PTX     31.7     40.9     32.3     41.9     43.0         38.2
  six: n 6, means {'saline': np.float64(7.524), 'Cs': np.float64(24.631), 'Cs+PTX': np.float64(38.012)}, F(2,10) = 79.46, p = 7.27e-07
     saline - Cs        diff -17.107  p multcompare 0.002  p classic 0.000
     saline - Cs+PTX    diff -30.488  p multcompare 0.000  p classic 0.000
     Cs - Cs+PTX        diff -13.381  p multcompare 0.012  p classic 0.001
[centred, steps] increase while stable (percent):
        969_147  969_150  969_152  969_154  981_035  981_035_PD2
saline      6.7      6.8      6.4     12.5      4.3          8.2
Cs         24.5     29.4     16.1     28.2     18.8         33.5
Cs+PTX     31.4     40.6     32.4     41.7     43.0         38.2
  six: n 6, means {'saline': np.float64(7.498), 'Cs': np.float64(25.104), 'Cs+PTX': np.float64(37.886)}, F(2,10) = 77.66, p = 8.1e-07
     saline - Cs        diff -17.606  p multcompare 0.001  p classic 0.000
     saline - Cs+PTX    diff -30.388  p multcompare 0.000  p classic 0.000
     Cs - Cs+PTX        diff -12.782  p multcompare 0.015  p classic 0.001
[centred, recording] increase while stable (percent):
        969_147  969_150  969_152  969_154  981_035  981_035_PD2
saline      5.4      6.3      5.8     17.6      4.6          6.3
Cs         23.1     28.3     21.3     29.6     20.0         34.1
Cs+PTX     30.4     39.4     32.1     40.6     41.6         37.7
  six: n 6, means {'saline': np.float64(7.681), 'Cs': np.float64(26.069), 'Cs+PTX': np.float64(36.965)}, F(2,10) = 80.97, p = 6.65e-07
     saline - Cs        diff -18.388  p multcompare 0.001  p classic 0.000
     saline - Cs+PTX    diff -29.284  p multcompare 0.000  p classic 0.000
     Cs - Cs+PTX        diff -10.896  p multcompare 0.015  p classic 0.002
[trailing, window] increase while stable (percent):
        969_147  969_150  969_152  969_154  981_035  981_035_PD2
saline      4.3      5.5      5.4     11.8      6.0          8.9
Cs         23.3     28.0     15.9     29.2     19.4         31.0
Cs+PTX     28.8     41.3     33.8     41.2     43.2         38.9
  six: n 6, means {'saline': np.float64(6.985), 'Cs': np.float64(24.462), 'Cs+PTX': np.float64(37.89)}, F(2,10) = 95.70, p = 3.02e-07
     saline - Cs        diff -17.477  p multcompare 0.001  p classic 0.000
     saline - Cs+PTX    diff -30.905  p multcompare 0.000  p classic 0.000
     Cs - Cs+PTX        diff -13.428  p multcompare 0.010  p classic 0.000
[trailing, steps] increase while stable (percent):
        969_147  969_150  969_152  969_154  981_035  981_035_PD2
saline      4.3      5.5      5.4     11.5      6.0          8.9
Cs         23.7     28.3     15.1     30.3     19.3         30.7
Cs+PTX     29.2     41.3     34.1     40.9     43.3         38.8
  six: n 6, means {'saline': np.float64(6.919), 'Cs': np.float64(24.572), 'Cs+PTX': np.float64(37.948)}, F(2,10) = 91.19, p = 3.8e-07
     saline - Cs        diff -17.654  p multcompare 0.001  p classic 0.000
     saline - Cs+PTX    diff -31.029  p multcompare 0.000  p classic 0.000
     Cs - Cs+PTX        diff -13.375  p multcompare 0.012  p classic 0.000
[trailing, recording] increase while stable (percent):
        969_147  969_150  969_152  969_154  981_035  981_035_PD2
saline      3.5      5.2      5.0     17.3      5.8          6.8
Cs         22.3     28.0     21.3     31.4     20.9         33.5
Cs+PTX     29.0     40.0     33.6     40.1     41.9         38.3
  six: n 6, means {'saline': np.float64(7.261), 'Cs': np.float64(26.249), 'Cs+PTX': np.float64(37.157)}, F(2,10) = 97.76, p = 2.73e-07
     saline - Cs        diff -18.987  p multcompare 0.001  p classic 0.000
     saline - Cs+PTX    diff -29.896  p multcompare 0.000  p classic 0.000
     Cs - Cs+PTX        diff -10.909  p multcompare 0.013  p classic 0.001
  six, deposited values: n 6, means {'saline': np.float64(7.594), 'Cs': np.float64(25.149), 'Cs+PTX': np.float64(37.866)}, F(2,10) = 69.57, p = 1.36e-06
     saline - Cs        diff -17.555  p multcompare 0.002  p classic 0.000
     saline - Cs+PTX    diff -30.272  p multcompare 0.000  p classic 0.000
     Cs - Cs+PTX        diff -12.717  p multcompare 0.018  p classic 0.002

Result: fig4c partially reproduced, resting on an assumption; fig4d and fig4e reproduced. Frequency change (fig4c): with the criterion's 0.3 C rule the two preparations of 981_035 have no 21 C value, so only four experiments are complete and the condition effect is not significant (F(2,6) = 4.21, p = 0.072; no pair is significant, p >= 0.06). The paper's F(2,10) shows it entered both; taking their top hold with a 0.5 C margin (an assumption), the six give F(2,10) = 10.43, p = 0.0036, saline 0.92, Cs+ 0.38 and Cs+ + PTX 0.73 Hz. Cs+ is below saline under both Tukey readings (p = 0.025 and 0.003), and saline against Cs+ + PTX is not significant (p = 0.114 and 0.307), but Cs+ is below Cs+ + PTX only under the classic Tukey (p = 0.036), not under the multcompare reading of the deposited code (p = 0.106). The full pattern thus holds only with a margin wider than the criterion's and under one of the two post hoc readings; the Cs+ reduction against saline holds there under both. Keeping the gap cycles gives nearly the same values (F(2,10) = 10.38, the same pattern). Decrease while warming (fig4d), centred window, six: F(2,10) = 13.00, p = 0.0017, saline 2.0%, Cs+ 28.9%, Cs+ + PTX 30.8%; both Cs+ conditions above saline (p <= 0.023), Cs+ against Cs+ + PTX not significant (p >= 0.95); all six readings agree (condition p <= 0.002, both Cs+ conditions above saline at p <= 0.031, Cs+ against Cs+ + PTX p >= 0.87). Increase while stable (fig4e): F(2,10) = 79.5, p = 7e-07, saline 7.5% < Cs+ 24.6% < Cs+ + PTX 38.0%, all three pairs significant under both Tukey readings (p <= 0.012); all six readings agree (pairs p <= 0.015).**

Phases at 11 C: fig5b, Table 1, fig5d, LP duty cycle¶

fig5b-pd-burst-shorter: At 11 degrees C the PD burst was modestly shorter in Cs+ (144 ms) than in saline (164 ms).

table1-pd-off-advanced: PD OFF phase advanced in Cs+ (0.12) compared with saline (0.19). table1-lp-on-advanced: LP ON 0.29 against 0.40. table1-lp-off-advanced: LP OFF 0.56 against 0.66. table1-py-phase-unchanged: PY ON (0.58 against 0.60) and PY OFF (0.87 against 0.90) did not differ.

fig5d-pdoff-lpon-delay-smaller: The phase delay between PD OFF and LP ON was smaller in Cs+ (0.17) than in saline (0.21).

lp-duty-cycle-preserved: LP duty cycle did not differ between saline and Cs+ at 11 degrees C.

Per experiment, means over the 11 C cycles: O4 (a), cycles within 0.3 C of 11 C in the first hold (O2); O4 (b), every cycle of the first holding period, from the first cycle within 1 C of 11 C (a standard bound) to the onset of the warming toward 13 C, whatever its temperature. The onset is traced back, by the paper's increasing-temperature rule, from the rise that leaves the band within 0.3 C of 11 C for the last time before 12.7 C is reached, so that a brief rise during the hold does not end it. a_gaps is (a) with the cycles left by the outlier removal kept, as the deposited code keeps them (data check, above). Onsets and offsets as the deposited Phase_Calc.m (the longest run of spikes with gaps of at most 0.11 s in the cycle), which is O6 with the burst rule taken from the paper's code. The deposited code's PD burst duration is period times PD OFF phase (MakePaperFigures_Clean.m, Fig 6B); it is shown as a variant.

In [27]:
def first_hold_cycles(d, cond, reading):
    """Cycles of the first 11 C hold. (a) within 0.3 C of 11 C (O2, as for frequency); (b) every
    cycle of the holding period, from the first cycle of the condition window within 1 C of 11 C
    (a standard bound) to the last cycle before the warming toward 13 C begins (step_onset with
    hold_end: the rise from the last cycle within 0.3 C of 11 C, traced back by the paper's
    increasing-temperature rule), whatever its temperature; (a_gaps) as (a) with the cycles
    left by the outlier removal kept, as the deposited code keeps them."""
    h = P.hold_means(d, cond, which="first", strict_cs=False, drop_gaps=reading != "a_gaps")
    ii = h["cycle_index"][11]
    if reading in ("a", "a_gaps"):
        return ii
    c = d["cycles"]
    s_idx, e_idx = d["Timings"][cond]
    m = P.condition_mask(c["start"], d["fileTimes"], s_idx[0], e_idx[0]) & (c["freq"] > 1 / 8)
    k = P.step_onset(c, m, 11, 13, hold_end=True)
    idx = np.nonzero(m)[0]
    near = idx[np.abs(c["temp"][idx] - 11) <= 1]
    if k is None or not len(near):
        return np.array([], int)
    jj = idx[(idx >= near[0]) & (idx < k)]
    return jj[~c["gap"][jj]]

def per_expt(reading, expts=EXPTS):
    rows = []
    for e in expts:
        d = A[e]
        for cond, lab in (("Saline", "S"), (CS.get(e, "Cs"), "C")):
            ii = first_hold_cycles(d, cond, reading)
            c = d["cycles"]
            r = {"expt": e, "cond": lab, "n": len(ii), "T_min": np.min(c["temp"][ii]) if len(ii) else np.nan, "T_max": np.max(c["temp"][ii]) if len(ii) else np.nan}
            for k in ("freq", "period", "pd_dur", "PD_OFF", "LP_ON", "LP_OFF", "PY_ON", "PY_OFF", "LP_duty"):
                r[k] = np.nanmean(c[k][ii]) if len(ii) else np.nan
            r["delay"] = np.nanmean((c["LP_ON"] - c["PD_OFF"])[ii]) if len(ii) else np.nan
            rows.append(r)
    return pd.DataFrame(rows).pivot(index="expt", columns="cond")

PH = {r_: per_expt(r_) for r_ in ("a", "b", "a_gaps")}
print("O4 (a), per experiment (S saline, C Cs+):")
print(PH["a"][["n", "pd_dur", "PD_OFF", "LP_ON", "LP_OFF", "PY_ON", "PY_OFF"]].round(3).to_string())
print("\nO4 (b), cycles of the whole first holding period: number and temperature range per experiment")
print(PH["b"][["n", "T_min", "T_max"]].round(2).to_string())
onsets = []
for e in EXPTS:
    for cond, lab in (("Saline", "S"), (CS[e], "C")):
        d = A[e]; c = d["cycles"]; s_idx, e_idx = d["Timings"][cond]
        k = P.step_onset(c, P.condition_mask(c["start"], d["fileTimes"], s_idx[0], e_idx[0]) & (c["freq"] > 1 / 8), 11, 13, hold_end=True)
        ia = first_hold_cycles(d, cond, "a")
        onsets.append({"expt": e, "cond": lab, "onset_min": c["start"][k] / 60 if k is not None else np.nan, "T_onset": c["temp"][k] if k is not None else np.nan,
                       "n_a": PH["a"].loc[e, ("n", lab)], "n_b": PH["b"].loc[e, ("n", lab)],
                       "n_a_from_onset": int(np.sum(ia >= k)) if k is not None else 0})
on = pd.DataFrame(onsets)
print("\nOnset of the warming toward 13 C, and the cycles of each reading; experiments where (b) has fewer cycles than (a)\n"
      "(n_a_from_onset: cycles of (a) from the onset on, in the first part of the warming but still within 0.3 C of 11 C):")
print(on[on.n_b < on.n_a].round(2).to_string(index=False))
print(f"cycles per experiment, (a) {int(PH['a']['n'].min().min())}-{int(PH['a']['n'].max().max())}, (b) {int(PH['b']['n'].min().min())}-{int(PH['b']['n'].max().max())}")

def cmp(k, reading, scale=1.0):
    x, y = PH[reading][(k, "S")] * scale, PH[reading][(k, "C")] * scale
    r = P.paired(x, y)
    return r
O4 (a), per experiment (S saline, C Cs+):
           n       pd_dur        PD_OFF         LP_ON        LP_OFF         PY_ON        PY_OFF       
cond       C     S      C      S      C      S      C      S      C      S      C      S      C      S
expt                                                                                                  
965_106  186   543  0.145  0.126  0.106  0.169  0.261  0.425  0.506  0.628    NaN    NaN    NaN    NaN
969_058   22  1201  0.119  0.164  0.163  0.234  0.315  0.437  0.600  0.719    NaN    NaN    NaN    NaN
969_062  111   525  0.126  0.180  0.103  0.236  0.223  0.402  0.514  0.662  0.546  0.661  0.981  0.969
969_065  172   318  0.128  0.141  0.140  0.162  0.337  0.490  0.601  0.621  0.672  0.648  0.973  0.971
969_068  113   262  0.130  0.272  0.152  0.318  0.236  0.377  0.550  0.597  0.673  0.661  0.974  0.954
969_070    0    67    NaN  0.179    NaN  0.234    NaN  0.435    NaN  0.653    NaN    NaN    NaN    NaN
969_083   82   151  0.182  0.224  0.104  0.222  0.236  0.410  0.458  0.656    NaN    NaN    NaN    NaN
969_085   89   163  0.144  0.155  0.089  0.183  0.287  0.448  0.579  0.710  0.625  0.653  0.726  0.977
969_087   64   418  0.149  0.148  0.118  0.166  0.315  0.383  0.654  0.695  0.653  0.684  0.985  0.987
969_088  145   267  0.109  0.132  0.104  0.179  0.285  0.398  0.624  0.731    NaN  0.379    NaN  0.750
969_089  159   221  0.145  0.154  0.131  0.157  0.302  0.330  0.561  0.609    NaN    NaN    NaN    NaN
969_091  200   211  0.149  0.203  0.155  0.218  0.395  0.419  0.621  0.627  0.651  0.552  0.973  0.960
969_106   48   584  0.163  0.145  0.085  0.142  0.280  0.456  0.530  0.642    NaN    NaN    NaN    NaN
969_113  141   164  0.154  0.155  0.173  0.198  0.352  0.384  0.542  0.653  0.293  0.412  0.345  0.441
969_115  112   168  0.130  0.151  0.104  0.202  0.338  0.431  0.530  0.681  0.641  0.447  0.968  0.453
969_128  255   127  0.161  0.149  0.110  0.137  0.196  0.275  0.461  0.532    NaN    NaN    NaN    NaN
969_135  127   144  0.161  0.178  0.137  0.172  0.357  0.352  0.638  0.689  0.654  0.553  0.973  0.973
969_147   88   150  0.141  0.145  0.083  0.153  0.235  0.395  0.553  0.683  0.608  0.712  0.943  0.967
969_150  116   174  0.155  0.168  0.147  0.218  0.307  0.329  0.631  0.681  0.592  0.600  0.940  0.975
969_152  114   170  0.127  0.118  0.108  0.139  0.276  0.406  0.590  0.724  0.563  0.655  0.979  0.980
981_010  106   139  0.174  0.177  0.132  0.212  0.253  0.411  0.559  0.750    NaN    NaN    NaN    NaN

O4 (b), cycles of the whole first holding period: number and temperature range per experiment
           n        T_min         T_max       
cond       C     S      C      S      C      S
expt                                          
965_106  182   526  10.96  10.74  11.24  11.02
969_058   17  1198  11.11  11.10  11.24  11.27
969_062  101   574  11.04  10.45  11.18  11.22
969_065  155   301  10.91  10.97  11.09  11.06
969_068  269   239  10.25  10.79  11.94  10.99
969_070    0   184    NaN  11.14    NaN  11.38
969_083   76   140  11.02  10.73  11.16  11.13
969_085   80   151  10.91  10.91  11.03  11.00
969_087   57   412  11.09  10.97  11.26  11.18
969_088  198   301  10.03  10.03  11.37  11.38
969_089  212   219  10.04  10.09  11.05  11.09
969_091  203   262  10.08  10.01  11.22  11.08
969_106   48   580  11.25  11.04  11.30  11.25
969_113  136   165  11.19  11.04  11.26  11.34
969_115  108   170  10.87  10.94  11.29  11.36
969_128  249   123  10.92  10.93  11.18  11.27
969_135  119   133  10.89  10.87  11.15  11.14
969_147   83   142  10.95  11.01  11.26  11.17
969_150  108   166  10.83  10.87  11.02  11.14
969_152  100   159  10.89  10.82  10.91  11.05
981_010  106   153  10.75  10.59  11.32  11.32
Onset of the warming toward 13 C, and the cycles of each reading; experiments where (b) has fewer cycles than (a)
(n_a_from_onset: cycles of (a) from the onset on, in the first part of the warming but still within 0.3 C of 11 C):
   expt cond  onset_min  T_onset  n_a  n_b  n_a_from_onset
965_106    S       6.94    10.91  543  526              17
965_106    C      68.26    11.12  186  182               4
969_058    S      14.32    11.28 1201 1198               3
969_058    C      86.24    11.14   22   17               5
969_062    C      51.67    11.04  111  101              10
969_065    S       4.52    10.97  318  301              17
969_065    C      76.45    10.92  172  155              17
969_068    S     121.52    10.92  262  239              23
969_083    S       8.37    11.07  151  140              11
969_083    C      60.31    11.10   82   76               6
969_085    S       6.19    10.94  163  151              12
969_085    C      62.27    11.06   89   80               9
969_087    S      66.28    11.14  418  412               6
969_087    C       7.21    11.22   64   57               7
969_089    S     112.92    10.99  221  219              10
969_106    S      10.27    11.21  584  580               4
969_113    C      63.68    11.26  141  136               5
969_115    C      28.33    11.27  112  108               4
969_128    S      94.28    11.20  127  123               4
969_128    C      42.27    11.15  255  249               6
969_135    S      96.41    11.00  144  133              11
969_135    C      30.37    11.03  127  119               8
969_147    S       4.31    11.09  150  142               8
969_147    C      62.40    11.13   88   83               5
969_150    S      62.26    11.09  174  166               8
969_150    C      20.30    10.96  116  108               8
969_152    S       4.40    10.94  170  159              11
969_152    C      46.08    10.91  114  100              14
cycles per experiment, (a) 0-1201, (b) 0-1198
In [28]:
for r_ in ("a", "b", "a_gaps"):
    r = cmp("pd_dur", r_, 1000)
    print(f"[{r_}] PD burst (first to last spike): saline {r['mean_x']:.0f} +- {r['sd_x']:.0f} ms, Cs {r['mean_y']:.0f} +- {r['sd_y']:.0f} ms, n {r['n']}, "
          f"Wilcoxon p = {r['p_w']:.3g}, paired t p = {r['p_t']:.3g}; Cs shorter in {int((PH[r_][('pd_dur', 'C')] < PH[r_][('pd_dur', 'S')]).sum())}")
    xs = PH[r_][("period", "S")] * PH[r_][("PD_OFF", "S")] * 1000; xc = PH[r_][("period", "C")] * PH[r_][("PD_OFF", "C")] * 1000
    r = P.paired(xs, xc)
    print(f"    variant, period x PD OFF (deposited code): saline {r['mean_x']:.0f} +- {r['sd_x']:.0f}, Cs {r['mean_y']:.0f} +- {r['sd_y']:.0f} ms, Wilcoxon p = {r['p_w']:.3g}")
[a] PD burst (first to last spike): saline 164 +- 36 ms, Cs 145 +- 19 ms, n 20, Wilcoxon p = 0.0121, paired t p = 0.0251; Cs shorter in 15
    variant, period x PD OFF (deposited code): saline 164 +- 35, Cs 145 +- 19 ms, Wilcoxon p = 0.0172
[b] PD burst (first to last spike): saline 165 +- 37 ms, Cs 146 +- 19 ms, n 20, Wilcoxon p = 0.0136, paired t p = 0.0217; Cs shorter in 15
    variant, period x PD OFF (deposited code): saline 165 +- 36, Cs 146 +- 19 ms, Wilcoxon p = 0.0172
[a_gaps] PD burst (first to last spike): saline 164 +- 36 ms, Cs 145 +- 19 ms, n 20, Wilcoxon p = 0.0121, paired t p = 0.0249; Cs shorter in 15
    variant, period x PD OFF (deposited code): saline 170 +- 34, Cs 149 +- 18 ms, Wilcoxon p = 0.00944

Result: reproduced. Over the 20 experiments with an 11 C value in both conditions, PD burst duration is 164 +- 36 ms in saline and 145 +- 19 ms in Cs+, within the tolerances, Wilcoxon p = 0.012, shorter in Cs+ in 15. Reading (b) (165 and 146 ms, p = 0.014), the deposited code's measure (period times PD OFF, 164 and 145 ms, p = 0.017) and the gap cycles kept (164 and 145 ms, p = 0.012) agree. Reading (b) holds fewer cycles than reading (a) only by the cycles of (a) that lie in the first part of the warming, after its onset but still within 0.3 C of 11 C (3 to 23 per experiment, printed above).**

In [29]:
for k in ("PD_OFF", "LP_ON", "LP_OFF"):
    for r_ in ("a", "b", "a_gaps"):
        r = cmp(k, r_)
        print(f"[{r_}] {k}: saline {r['mean_x']:.3f} +- {r['sd_x']:.3f}, Cs {r['mean_y']:.3f} +- {r['sd_y']:.3f}, n {r['n']}, paired t = {r['t']:.2f}, p = {r['p_t']:.2g} "
              f"(Wilcoxon {r['p_w']:.2g}; Shapiro-Wilk on the differences p = {r['sw_diff']:.2f}); Cs lower in {int((PH[r_][(k, 'C')] < PH[r_][(k, 'S')]).sum())}")
[a] PD_OFF: saline 0.191 +- 0.044, Cs 0.122 +- 0.027, n 20, paired t = 7.90, p = 2e-07 (Wilcoxon 1.9e-06; Shapiro-Wilk on the differences p = 0.10); Cs lower in 20
[b] PD_OFF: saline 0.191 +- 0.044, Cs 0.123 +- 0.027, n 20, paired t = 7.94, p = 1.9e-07 (Wilcoxon 1.9e-06; Shapiro-Wilk on the differences p = 0.11); Cs lower in 20
[a_gaps] PD_OFF: saline 0.198 +- 0.043, Cs 0.126 +- 0.026, n 20, paired t = 8.58, p = 5.8e-08 (Wilcoxon 1.9e-06; Shapiro-Wilk on the differences p = 0.24); Cs lower in 20
[a] LP_ON: saline 0.398 +- 0.049, Cs 0.289 +- 0.051, n 20, paired t = 7.94, p = 1.9e-07 (Wilcoxon 3.8e-06; Shapiro-Wilk on the differences p = 0.02); Cs lower in 19
[b] LP_ON: saline 0.398 +- 0.049, Cs 0.290 +- 0.051, n 20, paired t = 7.89, p = 2e-07 (Wilcoxon 3.8e-06; Shapiro-Wilk on the differences p = 0.03); Cs lower in 19
[a_gaps] LP_ON: saline 0.404 +- 0.047, Cs 0.295 +- 0.052, n 20, paired t = 7.83, p = 2.3e-07 (Wilcoxon 9.5e-06; Shapiro-Wilk on the differences p = 0.04); Cs lower in 18
[a] LP_OFF: saline 0.664 +- 0.053, Cs 0.565 +- 0.056, n 20, paired t = 8.13, p = 1.3e-07 (Wilcoxon 1.9e-06; Shapiro-Wilk on the differences p = 0.37); Cs lower in 20
[b] LP_OFF: saline 0.664 +- 0.054, Cs 0.565 +- 0.056, n 20, paired t = 8.05, p = 1.5e-07 (Wilcoxon 1.9e-06; Shapiro-Wilk on the differences p = 0.36); Cs lower in 20
[a_gaps] LP_OFF: saline 0.671 +- 0.050, Cs 0.571 +- 0.058, n 20, paired t = 7.60, p = 3.6e-07 (Wilcoxon 1.9e-06; Shapiro-Wilk on the differences p = 0.22); Cs lower in 20

Result: reproduced (three claims). At 11 C, over 20 experiments, PD OFF is 0.191 +- 0.044 in saline and 0.122 +- 0.027 in Cs+ (paired t p = 2e-07), LP ON 0.398 +- 0.049 and 0.289 +- 0.051 (p = 2e-07), LP OFF 0.664 +- 0.053 and 0.565 +- 0.056 (p = 1e-07), all within the tolerances and lower in Cs+ in 20, 19 and 20 experiments; reading (b) (0.191 and 0.123, 0.398 and 0.290, 0.664 and 0.565, 20 experiments each) and the gap cycles kept (0.198 and 0.126, 0.404 and 0.295, 0.671 and 0.571) agree.**

In [30]:
for r_ in ("a", "b", "a_gaps"):
    t = PH[r_]
    have = t[("PY_ON", "S")].notna() & t[("PY_ON", "C")].notna()
    print(f"[{r_}] experiments with PY phases in both conditions: {int(have.sum())} ({t.index[have].tolist()})")
    for k, test in (("PY_ON", "p_t"), ("PY_OFF", "p_w")):
        r = cmp(k, r_)
        print(f"    {k}: saline {r['mean_x']:.3f} +- {r['sd_x']:.3f}, Cs {r['mean_y']:.3f} +- {r['sd_y']:.3f}, mean difference {r['mean_diff']:+.3f}, n {r['n']}, "
              f"paper's test ({'paired t' if test == 'p_t' else 'Wilcoxon'}) p = {r[test]:.3f} (other test {r['p_w' if test == 'p_t' else 'p_t']:.3f})")
[a] experiments with PY phases in both conditions: 12 (['969_062', '969_065', '969_068', '969_085', '969_087', '969_091', '969_113', '969_115', '969_135', '969_147', '969_150', '969_152'])
    PY_ON: saline 0.603 +- 0.094, Cs 0.598 +- 0.104, mean difference +0.006, n 12, paper's test (paired t) p = 0.846 (other test 0.622)
    PY_OFF: saline 0.884 +- 0.204, Cs 0.897 +- 0.188, mean difference -0.013, n 12, paper's test (Wilcoxon) p = 0.677 (other test 0.807)
[b] experiments with PY phases in both conditions: 12 (['969_062', '969_065', '969_068', '969_085', '969_087', '969_091', '969_113', '969_115', '969_135', '969_147', '969_150', '969_152'])
    PY_ON: saline 0.603 +- 0.097, Cs 0.597 +- 0.102, mean difference +0.006, n 12, paper's test (paired t) p = 0.847 (other test 0.677)
    PY_OFF: saline 0.881 +- 0.206, Cs 0.897 +- 0.186, mean difference -0.016, n 12, paper's test (Wilcoxon) p = 0.970 (other test 0.756)
[a_gaps] experiments with PY phases in both conditions: 12 (['969_062', '969_065', '969_068', '969_085', '969_087', '969_091', '969_113', '969_115', '969_135', '969_147', '969_150', '969_152'])
    PY_ON: saline 0.614 +- 0.090, Cs 0.604 +- 0.105, mean difference +0.010, n 12, paper's test (paired t) p = 0.727 (other test 0.677)
    PY_OFF: saline 0.896 +- 0.200, Cs 0.904 +- 0.188, mean difference -0.008, n 12, paper's test (Wilcoxon) p = 0.424 (other test 0.877)

Result: reproduced. Over the 12 experiments with PY phases in both conditions (the paper's 12), PY ON is 0.603 against 0.598 (paired t p = 0.85, difference 0.006) and PY OFF 0.884 against 0.897 (Wilcoxon p = 0.68, difference -0.013), within the tolerances; reading (b) (p = 0.85 and 0.97) and the gap cycles kept (p = 0.73 and 0.42) agree.**

In [31]:
for r_ in ("a", "b", "a_gaps"):
    r = cmp("delay", r_)
    v = P.paired(PH[r_][("LP_ON", "S")] - PH[r_][("PD_OFF", "S")], PH[r_][("LP_ON", "C")] - PH[r_][("PD_OFF", "C")])
    print(f"[{r_}] LP ON - PD OFF per cycle: saline {r['mean_x']:.3f} +- {r['sd_x']:.3f}, Cs {r['mean_y']:.3f} +- {r['sd_y']:.3f}, n {r['n']}, paired t p = {r['p_t']:.3g}; "
          f"difference of the means: saline {v['mean_x']:.3f}, Cs {v['mean_y']:.3f}, p = {v['p_t']:.3g}")
[a] LP ON - PD OFF per cycle: saline 0.207 +- 0.064, Cs 0.167 +- 0.044, n 20, paired t p = 0.0042; difference of the means: saline 0.207, Cs 0.167, p = 0.00421
[b] LP ON - PD OFF per cycle: saline 0.207 +- 0.064, Cs 0.167 +- 0.044, n 20, paired t p = 0.00411; difference of the means: saline 0.207, Cs 0.167, p = 0.00412
[a_gaps] LP ON - PD OFF per cycle: saline 0.206 +- 0.062, Cs 0.169 +- 0.044, n 20, paired t p = 0.00836; difference of the means: saline 0.206, Cs 0.169, p = 0.00798

Result: reproduced. LP ON minus PD OFF is 0.207 +- 0.064 in saline and 0.167 +- 0.044 in Cs+ (20 experiments), within the tolerances, paired t p = 0.004; reading (b) (p = 0.004), the difference of the means and the gap cycles kept (p = 0.008) agree.**

In [32]:
for r_ in ("a", "b", "a_gaps"):
    r = cmp("LP_duty", r_)
    print(f"[{r_}] LP duty cycle: saline {r['mean_x']:.3f} +- {r['sd_x']:.3f}, Cs {r['mean_y']:.3f} +- {r['sd_y']:.3f}, mean difference {r['mean_diff']:+.3f}, "
          f"n {r['n']}, paired t p = {r['p_t']:.3f}")
[a] LP duty cycle: saline 0.267 +- 0.057, Cs 0.276 +- 0.045, mean difference -0.009, n 20, paired t p = 0.445
[b] LP duty cycle: saline 0.266 +- 0.058, Cs 0.276 +- 0.045, mean difference -0.009, n 20, paired t p = 0.433
[a_gaps] LP duty cycle: saline 0.267 +- 0.057, Cs 0.276 +- 0.045, mean difference -0.009, n 20, paired t p = 0.449

Result: reproduced. LP duty cycle is 0.267 in saline and 0.276 in Cs+ (difference -0.009, 20 experiments); the paired t-test does not find a difference, p = 0.445 (reading (b) 0.433, gap cycles kept 0.449).**

matched-period-lp-earlier¶

In cycles of matched period between saline at 11 degrees C and Cs+, PD bursts were 51 ms shorter in Cs+ while LP fired 91 ms earlier and PY latency did not change (1.9 ms), and the PD offset advance did not correlate with the LP onset advance.

Saline reference: the first 11 C hold (O2, O4 (a)). Readings: (a) the Cs+ holding temperature whose mean period is nearest the saline 11 C period; (b) Cs+ cycles of the window with a period within 2% of it. Latencies from the first PD spike; advance is saline minus Cs+. PD offset advance in ms is the PD burst shortening (the PD offset latency is the burst duration). The deposited LPAdvanceSamePeriod.mat, made by code that is not deposited, on a different set of 21 (it adds 969_120, which has no spike file, and 969_154, and lacks 965_106 and 981_010), is shown as a check.

In [33]:
def matched(e, reading, keep_gaps=False):
    d = A[e]; c = d["cycles"]
    ref = first_hold_cycles(d, "Saline", "a_gaps" if keep_gaps else "a")
    if not len(ref):
        return None
    P0 = np.mean(c["period"][ref])
    s_idx, e_idx = d["Timings"][CS[e]]
    m = P.condition_mask(c["start"], d["fileTimes"], s_idx[0], e_idx[0]) & (c["freq"] > 1 / 8) & (keep_gaps | ~c["gap"])
    if reading == "a":
        h = P.hold_means(d, CS[e], strict_cs=True, drop_gaps=not keep_gaps)
        j = int(np.nanargmin(np.abs(h["period"] - P0)))
        jj = h["cycle_index"][int(P.TARGETS[j])]
        lab = int(P.TARGETS[j])
    else:
        jj = np.nonzero(m & (np.abs(c["period"] - P0) <= 0.02 * P0))[0]
        lab = len(jj)
    if not len(jj):
        return None
    f = lambda k, ii: np.nanmean(c[k][ii]) * 1000
    return {"expt": e, "match": lab, "period_sal_ms": P0 * 1000, "period_cs_ms": np.mean(c["period"][jj]) * 1000,
            "PD_short_ms": f("pd_dur", ref) - f("pd_dur", jj), "LP_adv_ms": f("LP_lat_on", ref) - f("LP_lat_on", jj),
            "PY_adv_ms": f("PY_lat_on", ref) - f("PY_lat_on", jj)}

for r_, kg in (("a", False), ("b", False), ("a", True), ("b", True)):
    t = pd.DataFrame([x for x in (matched(e, r_, kg) for e in EXPTS) if x])
    print(f"reading ({r_}){', variant with the gap cycles kept' if kg else ''}; match = {'Cs+ holding temperature' if r_ == 'a' else 'number of Cs+ cycles'}")
    if not kg:
        print(t.round(1).to_string(index=False))
    else:
        print(f"  LP advance larger than PD shortening: {t.LP_adv_ms.mean() > t.PD_short_ms.mean()}")
    ok = t.PD_short_ms.notna() & t.LP_adv_ms.notna()
    rr = stats.pearsonr(t.PD_short_ms[ok], t.LP_adv_ms[ok])
    print(f"  PD shortening {t.PD_short_ms.mean():.0f} +- {t.PD_short_ms.std():.0f} ms, LP advance {t.LP_adv_ms.mean():.0f} +- {t.LP_adv_ms.std():.0f} ms, "
          f"PY advance {t.PY_adv_ms.mean():.1f} +- {t.PY_adv_ms.std():.0f} ms (n {t.PY_adv_ms.notna().sum()}); "
          f"Pearson r = {rr.statistic:.2f}, p = {rr.pvalue:.3f}, n pairs {int(ok.sum())}\n")
L = P.load_mat("LPAdvanceSamePeriod.mat")
cPD = 1000 * (np.asarray(L["meanPDDUR"])[0] - np.asarray(L["meanPDDUR"])[1])
cLP = 1000 * (np.asarray(L["meanLPDelay"])[0] - np.asarray(L["meanLPDelay"])[1])
ok = ~np.isnan(cPD) & ~np.isnan(cLP)
rr = stats.pearsonr(cPD[ok], cLP[ok])
pyo = np.asarray(L["meanPYON"]) / np.asarray(L["meanFreq"])
print(f"deposited LPAdvanceSamePeriod: PD shortening {np.mean(cPD[ok]):.0f} +- {np.std(cPD[ok], ddof=1):.0f} ms, LP {np.mean(cLP[ok]):.0f} +- {np.std(cLP[ok], ddof=1):.0f} ms, "
      f"PY {1000 * np.nanmean(pyo[0] - pyo[1]):.1f} ms (n {int(np.sum(~np.isnan(pyo[0] - pyo[1])))}); r = {rr.statistic:.2f}, p = {rr.pvalue:.4f}, n pairs {int(ok.sum())}")
print("files:", [str(np.ravel(x)[0]) for x in np.ravel(L["files"]["name"])])
reading (a); match = Cs+ holding temperature
   expt  match  period_sal_ms  period_cs_ms  PD_short_ms  LP_adv_ms  PY_adv_ms
965_106     15          741.7         982.3         37.0       62.0        NaN
969_058     13          698.5         708.8         41.5       85.4        NaN
969_062     19          761.3        1162.5         90.8       79.5       36.7
969_065     13          860.4         848.9         22.9      134.1      -19.3
969_068     11          851.6         860.6        142.2      118.1      -16.8
969_070     19          764.4         771.3         77.7       45.9        NaN
969_083     11         1000.6        1753.9         41.8       -3.5        NaN
969_085     21          848.7         861.7         68.5      155.5      -75.2
969_087     21          890.8        1041.9         50.0       82.4       29.4
969_088     15          737.5         764.9         55.0       75.0        NaN
969_089     13          981.3        1032.8         23.2       14.7        NaN
969_091     11          929.0         971.2         53.8        5.2     -118.2
969_106     21         1023.1        1144.0         53.4      195.6        NaN
969_113     13          785.2         844.4          9.0       -1.5       50.9
969_115     13          748.5         992.3         49.8      -43.9     -311.1
969_128     19         1085.2        1082.8        -27.7      138.9        NaN
969_135     13         1034.9        1024.5         50.2      -33.9     -109.2
969_147     19          945.8         958.2         50.7      145.3      112.0
969_150     15          767.3         763.9         57.2       36.7       17.4
969_152     13          853.6         907.5         21.5       90.6       13.9
981_010     17          828.9         894.1         85.5      105.3        NaN
  PD shortening 50 +- 34 ms, LP advance 71 +- 65 ms, PY advance -32.5 +- 110 ms (n 12); Pearson r = 0.10, p = 0.675, n pairs 21

reading (b); match = number of Cs+ cycles
   expt  match  period_sal_ms  period_cs_ms  PD_short_ms  LP_adv_ms  PY_adv_ms
969_058    288          698.5         698.3         42.8       94.0        NaN
969_062      5          761.3         764.2        106.9       52.0      218.7
969_065     78          860.4         862.8         22.3      129.6      -30.1
969_068    484          851.6         852.1        142.0      116.9       21.5
969_070    163          764.4         765.5         75.5       60.5        NaN
969_083     28         1000.6         999.3        114.7      164.3        NaN
969_085    119          848.7         848.0         73.7      166.0      -98.5
969_087     63          890.8         891.4         65.9      140.1      122.6
969_088    141          737.5         735.4         58.8       82.2        NaN
969_089    115          981.3         980.5         31.8       49.0        NaN
969_091    119          929.0         926.9         57.1       16.7      -98.8
969_106     58         1023.1        1023.9         63.7      228.9        NaN
969_113     44          785.2         789.4         11.8       42.5       38.9
969_128     12         1085.2        1087.5         34.2      130.3        NaN
969_135     30         1034.9        1032.7         58.4      -95.7     -159.2
969_147    174          945.8         944.9         49.1      149.0      113.5
969_150    207          767.3         766.8         60.6       40.4       19.0
969_152     28          853.6         860.6         23.5      100.0       25.3
981_010     57          828.9         832.2        109.4      131.3        NaN
  PD shortening 63 +- 35 ms, LP advance 95 +- 71 ms, PY advance 15.7 +- 110 ms (n 11); Pearson r = 0.18, p = 0.461, n pairs 19

reading (a), variant with the gap cycles kept; match = Cs+ holding temperature
  LP advance larger than PD shortening: False
  PD shortening 51 +- 34 ms, LP advance 39 +- 128 ms, PY advance -44.2 +- 111 ms (n 12); Pearson r = 0.50, p = 0.020, n pairs 21

reading (b), variant with the gap cycles kept; match = number of Cs+ cycles
  LP advance larger than PD shortening: True
  PD shortening 63 +- 35 ms, LP advance 96 +- 71 ms, PY advance 23.3 +- 108 ms (n 11); Pearson r = 0.10, p = 0.687, n pairs 19

deposited LPAdvanceSamePeriod: PD shortening 51 +- 30 ms, LP 91 +- 68 ms, PY 1.9 ms (n 9); r = 0.26, p = 0.2928, n pairs 18
files: ['969_058', '969_062', '969_065', '969_068', '969_070', '969_083', '969_085', '969_087', '969_088', '969_089', '969_091', '969_106', '969_113', '969_115', '969_120', '969_128', '969_135', '969_147', '969_150', '969_152', '969_154']

Result: reproduced under both readings. With Cs+ cycles within 2% of the saline 11 C period (reading (b), 19 experiments), PD bursts are 63 +- 35 ms shorter in Cs+, LP fires 95 +- 71 ms earlier and PY 16 +- 110 ms earlier (11 experiments with PY), all within the tolerances, LP advance exceeds PD shortening, and the correlation of the two is not significant (r = 0.18, p = 0.46, 19 pairs). Under reading (a), the Cs+ holding temperature nearest in period (21 experiments), PD shortening is 50 +- 34 ms, LP advance 71 +- 65 ms and PY -33 +- 110 ms, within the tolerances, LP advance exceeds PD shortening, and r = 0.10, p = 0.68. With the gap cycles kept, reading (b) gives the same (63 and 96 ms, r = 0.10, p = 0.69) and reading (a) fails (LP advance 39 ms, below the PD shortening of 51 ms; r = 0.50, p = 0.020), so the outcome does not rest on leaving them out. The deposited LPAdvanceSamePeriod.mat gives the paper's numbers exactly (51 +- 30, 91 +- 68, 1.9 ms, r = 0.26, p = 0.2928 over 18 pairs), on its own set of experiments.**

Phase constancy: fig6a-lp-off-advances-saline, fig6a-lp-advances-cs, fig6a-pd-py-phase-constant¶

In saline, LP OFF phase advanced modestly with temperature, by 0.07 per 10 degrees C; all other phases were constant.

In Cs+, LP ON and LP OFF advanced with temperature, by 0.05 and 0.14 per 10 degrees C.

PD and PY phases were constant with temperature in both saline and Cs+.

Per experiment and condition a line of phase on temperature: O4 (a) through the six per-temperature means against 11, 13, ..., 21 (the deposited code, Fig 7A stats); O4 (b) through the phase of every cycle of the condition window against its temperature ("all cycles", transitions included); the variant b_hold through the cycles within 0.3 C of a target only; a_gaps is (a) with the cycles left by the outlier removal kept, as the deposited code keeps them. Advance per 10 C is minus ten times the slope. Tests against zero across experiments, p times 10 (Bonferroni, Methods); the test is chosen by Shapiro-Wilk on the slopes (p < 0.05: Wilcoxon), and both are printed.

In [34]:
def slopes(reading):
    """(a) line through the six hold means against 11, 13, ..., 21; (b) through every cycle of the
    condition window against its temperature; (b_hold) through the cycles within 0.3 C of a target;
    (a_gaps) as (a) with the cycles left by the outlier removal kept, as the deposited code."""
    out = {}
    for e in EXPTS:
        d = A[e]; c = d["cycles"]
        for cond, lab in (("Saline", "S"), (CS[e], "C")):
            h = P.hold_means(d, cond, strict_cs=False, drop_gaps=reading != "a_gaps")
            s_idx, e_idx = d["Timings"][cond]
            win = P.condition_mask(c["start"], d["fileTimes"], s_idx[0], e_idx[0]) & (c["freq"] > 1 / 8) & ~c["gap"]
            for k in ("PD_OFF", "LP_ON", "LP_OFF", "PY_ON", "PY_OFF"):
                if reading in ("a", "a_gaps"):
                    y = h[k]; x = P.TARGETS.astype(float)
                else:
                    ii = np.concatenate([h["cycle_index"][int(T)] for T in P.TARGETS]) if reading == "b_hold" else np.nonzero(win)[0]
                    y = c[k][ii]; x = c["temp"][ii]
                ok = ~np.isnan(y) & ~np.isnan(x)
                out[(e, lab, k)] = np.polyfit(x[ok], y[ok], 1)[0] if ok.sum() >= 2 and np.ptp(x[ok]) > 0 else np.nan
    s = pd.Series(out).unstack([1, 2])
    return s

READINGS6 = ("a", "b", "b_hold", "a_gaps")
SL = {r_: slopes(r_) for r_ in READINGS6}
rows = []
for r_ in READINGS6:
    for lab in ("S", "C"):
        for k in ("PD_OFF", "LP_ON", "LP_OFF", "PY_ON", "PY_OFF"):
            v = SL[r_][(lab, k)].dropna().values
            sw = stats.shapiro(v).pvalue
            pw = stats.wilcoxon(v).pvalue
            pt = stats.ttest_1samp(v, 0).pvalue
            chosen = pw if sw < 0.05 else pt
            rows.append({"reading": r_, "cond": "saline" if lab == "S" else "Cs", "phase": k, "n": len(v), "advance_per_10C": -10 * v.mean(),
                         "sd": 10 * v.std(ddof=1), "shapiro_p": sw, "test": "Wilcoxon" if sw < 0.05 else "t", "p_adj_chosen": min(1, 10 * chosen),
                         "p_adj_wilcoxon": min(1, 10 * pw), "p_adj_t": min(1, 10 * pt)})
FT = pd.DataFrame(rows)
print(FT.round(4).to_string(index=False))
reading   cond  phase  n  advance_per_10C     sd  shapiro_p     test  p_adj_chosen  p_adj_wilcoxon  p_adj_t
      a saline PD_OFF 21           0.0037 0.0423     0.6279        t        1.0000          1.0000   1.0000
      a saline  LP_ON 21           0.0228 0.0462     0.8503        t        0.3500          0.3192   0.3500
      a saline LP_OFF 21           0.0709 0.0650     0.0076 Wilcoxon        0.0001          0.0001   0.0007
      a saline  PY_ON 13          -0.0527 0.0859     0.9613        t        0.4697          0.6812   0.4697
      a saline PY_OFF 13          -0.0096 0.0864     0.0003 Wilcoxon        1.0000          1.0000   1.0000
      a     Cs PD_OFF 21           0.0169 0.0285     0.5701        t        0.1329          0.2633   0.1329
      a     Cs  LP_ON 21           0.0525 0.0515     0.0194 Wilcoxon        0.0003          0.0003   0.0015
      a     Cs LP_OFF 21           0.1396 0.0961     0.0576        t        0.0000          0.0000   0.0000
      a     Cs  PY_ON 12           0.0375 0.1385     0.3178        t        1.0000          1.0000   1.0000
      a     Cs PY_OFF 12           0.0821 0.1649     0.0306 Wilcoxon        0.3418          0.3418   1.0000
      b saline PD_OFF 21           0.0025 0.0381     0.9504        t        1.0000          1.0000   1.0000
      b saline  LP_ON 21           0.0185 0.0427     0.8697        t        0.6106          0.7014   0.6106
      b saline LP_OFF 21           0.0638 0.0566     0.5256        t        0.0005          0.0005   0.0005
      b saline  PY_ON 13          -0.0437 0.0958     0.1494        t        1.0000          1.0000   1.0000
      b saline PY_OFF 13          -0.0006 0.0701     0.0614        t        1.0000          1.0000   1.0000
      b     Cs PD_OFF 21           0.0141 0.0275     0.5722        t        0.2943          0.5469   0.2943
      b     Cs  LP_ON 21           0.0471 0.0475     0.3511        t        0.0020          0.0005   0.0020
      b     Cs LP_OFF 21           0.1215 0.0802     0.3871        t        0.0000          0.0000   0.0000
      b     Cs  PY_ON 12           0.0576 0.1270     0.9711        t        1.0000          1.0000   1.0000
      b     Cs PY_OFF 12           0.1032 0.1783     0.0139 Wilcoxon        0.4248          0.4248   0.7024
 b_hold saline PD_OFF 21           0.0047 0.0403     0.8215        t        1.0000          1.0000   1.0000
 b_hold saline  LP_ON 21           0.0222 0.0423     0.3882        t        0.2586          0.3192   0.2586
 b_hold saline LP_OFF 21           0.0685 0.0507     0.3992        t        0.0000          0.0001   0.0000
 b_hold saline  PY_ON 13          -0.0523 0.0937     0.8351        t        0.6732          0.9424   0.6732
 b_hold saline PY_OFF 13          -0.0136 0.0775     0.0004 Wilcoxon        1.0000          1.0000   1.0000
 b_hold     Cs PD_OFF 21           0.0173 0.0271     0.6575        t        0.0833          0.1417   0.0833
 b_hold     Cs  LP_ON 21           0.0494 0.0424     0.1542        t        0.0003          0.0001   0.0003
 b_hold     Cs LP_OFF 21           0.1353 0.0787     0.2967        t        0.0000          0.0000   0.0000
 b_hold     Cs  PY_ON 12           0.0387 0.1413     0.3932        t        1.0000          1.0000   1.0000
 b_hold     Cs PY_OFF 12           0.0882 0.1773     0.0099 Wilcoxon        0.2686          0.2686   1.0000
 a_gaps saline PD_OFF 21           0.0015 0.0463     0.5359        t        1.0000          1.0000   1.0000
 a_gaps saline  LP_ON 21           0.0277 0.0655     0.0020 Wilcoxon        0.3844          0.3844   0.6671
 a_gaps saline LP_OFF 21           0.0758 0.0902     0.0000 Wilcoxon        0.0001          0.0001   0.0100
 a_gaps saline  PY_ON 13          -0.0542 0.0828     0.9208        t        0.3602          0.6812   0.3602
 a_gaps saline PY_OFF 13          -0.0119 0.0830     0.0001 Wilcoxon        1.0000          1.0000   1.0000
 a_gaps     Cs PD_OFF 21           0.0117 0.0315     0.9960        t        1.0000          0.8880   1.0000
 a_gaps     Cs  LP_ON 21           0.0095 0.2016     0.0000 Wilcoxon        0.0286          0.0286   1.0000
 a_gaps     Cs LP_OFF 21           0.0962 0.2241     0.0000 Wilcoxon        0.0043          0.0043   0.6314
 a_gaps     Cs  PY_ON 12           0.0352 0.1347     0.2847        t        1.0000          1.0000   1.0000
 a_gaps     Cs PY_OFF 12           0.0796 0.1618     0.0183 Wilcoxon        0.2686          0.2686   1.0000
In [35]:
# The same slope tests on the deposited per-experiment phases of SummaryStatistics.mat (TotalPDOFF_S
# ... TotalPYOFF_E, columns 3 to 8 in MATLAB), as the deposited MakePaperFigures_Clean.m runs them
# ("Stats for Fig7A"): a line against 11, 13, ..., 21 per experiment, PY only where the saline PY ON
# row is complete, the test fixed by its NormalityCheck (2 = signed-rank), p times 10.
NORM_DEP = [1, 1, 2, 1, 2, 1, 2, 2, 1, 2]
xT = P.TARGETS.astype(float)
rows = []
for j, (cnd, lab) in enumerate((("S", "saline"), ("E", "Cs"))):
    for i, k in enumerate(("PDOFF", "LPON", "LPOFF", "PYON", "PYOFF")):
        Y = np.asarray(S[f"Total{k}_{cnd}"])[:, 2:8].astype(float)
        py_ok = ~np.isnan(np.asarray(S["TotalPYON_S"])[:, 2:8].astype(float)).any(axis=1)
        v = []
        for r, y in enumerate(Y):
            ok = ~np.isnan(y)
            if (k.startswith("PY") and not py_ok[r]) or ok.sum() < 2:
                continue
            v.append(np.polyfit(xT[ok], y[ok], 1)[0])
        v = np.array(v)
        pw, pt = stats.wilcoxon(v).pvalue, stats.ttest_1samp(v, 0).pvalue
        rows.append({"cond": lab, "phase": k, "n": len(v), "advance_per_10C": -10 * v.mean(), "sd": 10 * v.std(ddof=1),
                     "shapiro_p": stats.shapiro(v).pvalue, "deposited_test": "Wilcoxon" if NORM_DEP[5 * j + i] == 2 else "t",
                     "p_adj_deposited_test": min(1, 10 * (pw if NORM_DEP[5 * j + i] == 2 else pt)), "p_adj_wilcoxon": min(1, 10 * pw), "p_adj_t": min(1, 10 * pt)})
print("Slopes fitted to the deposited per-experiment phases (SummaryStatistics.mat):")
print(pd.DataFrame(rows).round(4).to_string(index=False))
Slopes fitted to the deposited per-experiment phases (SummaryStatistics.mat):
  cond phase  n  advance_per_10C     sd  shapiro_p deposited_test  p_adj_deposited_test  p_adj_wilcoxon  p_adj_t
saline PDOFF 21           0.0075 0.0472     0.3831              t                1.0000          1.0000   1.0000
saline  LPON 21           0.0260 0.0540     0.1020              t                0.3959          0.2901   0.3959
saline LPOFF 21           0.0736 0.0754     0.0004       Wilcoxon                0.0002          0.0002   0.0023
saline  PYON 11          -0.0455 0.0815     0.8964              t                0.9394          1.0000   0.9394
saline PYOFF 11           0.0116 0.0364     0.0342       Wilcoxon                1.0000          1.0000   1.0000
    Cs PDOFF 21           0.0201 0.0296     0.5138              t                0.0560          0.1135   0.0560
    Cs  LPON 21           0.0540 0.0547     0.0129       Wilcoxon                0.0004          0.0004   0.0021
    Cs LPOFF 21           0.1397 0.0994     0.0383       Wilcoxon                0.0000          0.0000   0.0000
    Cs  PYON 11           0.0148 0.1200     0.3061              t                1.0000          1.0000   1.0000
    Cs PYOFF 11           0.0456 0.1138     0.0918       Wilcoxon                0.6738          0.6738   1.0000

Result: all three reproduced. Under O4 (a), in saline LP OFF advances 0.071 +- 0.065 per 10 C, Wilcoxon adjusted p = 0.0001, with a negative slope (reading (b), every cycle of the window, 0.064, t-test adjusted p = 0.0005). In Cs+, LP ON advances 0.053 +- 0.052 per 10 C (Wilcoxon adjusted p = 0.0003) and LP OFF 0.140 +- 0.096 (t-test, p < 0.0001), both within the tolerances and below 0.01; readings (b) (0.047 and 0.122, t-test adjusted p = 0.0020 and < 0.0001, the test Shapiro-Wilk chooses; Wilcoxon 0.0005 and < 0.0001) and b_hold agree. With the gap cycles kept, as the deposited code, LP ON in Cs+ advances 0.010 +- 0.202 with adjusted p = 0.029: the gap cycles, whose phases are divided by the wrong period, widen the slopes' spread about fourfold, and only under that variant does LP ON miss p < 0.01. The authors' own per-experiment phases (SummaryStatistics.mat), fitted and tested as the deposited script does, give what leaving the gap cycles out gives: LP ON in Cs+ advances 0.054 +- 0.055 per 10 C with Wilcoxon adjusted p = 0.0004, LP OFF in Cs+ 0.140 +- 0.099 (p < 0.0001) and LP OFF in saline 0.074 +- 0.075 (p = 0.0002), with PD OFF, PY ON, PY OFF and saline LP ON at adjusted p >= 0.056. PD OFF, PY ON and PY OFF have adjusted p >= 0.08 in both conditions under every reading here (the test chosen by Shapiro-Wilk), and LP ON in saline 0.35: none is significant. PY slopes use 13 experiments in saline (969_088 has PY in saline only) and 12 in Cs+; the deposited script keeps the 11 experiments with a complete saline PY ON row.**

Summary¶

A failure to reproduce here may be a failure of this attempt, not of the paper: see the reasoning and the differences from the paper's method.

Claim Outcome
figs1-ih-reduced-11c blocked (data missing)
figs1-ih-reduced-21c blocked (data missing)
fig1-cs-lower-frequency-11c reproduced
fig1d-difference-grows-with-temperature reproduced
fig1e-q10-lower-in-cs reproduced
fig1f-two-saline-frequency-change-same reproduced (on the deposited per-experiment values)
fig1e-two-saline-q10-same blocked (data missing)
fig1e-saline-q10-same-across-designs blocked (data missing)
fig2c-decrease-by-depolarizing-phase reproduced (the Cs+ + PTX example, outside the criterion, agrees)
fig3d-freq-decrease-while-warming reproduced
fig3e-freq-increase-when-stable reproduced
fig4c-ptx-restores-frequency-change partially reproduced, resting on an assumption
fig4d-ptx-keeps-decrease-while-warming reproduced
fig4e-stable-increase-ordering reproduced
fig5b-pd-burst-shorter reproduced
table1-pd-off-advanced reproduced
table1-lp-on-advanced reproduced
table1-lp-off-advanced reproduced
table1-py-phase-unchanged reproduced
fig5d-pdoff-lpon-delay-smaller reproduced
lp-duty-cycle-preserved reproduced
matched-period-lp-earlier reproduced
fig6a-lp-off-advances-saline reproduced
fig6a-lp-advances-cs reproduced, resting on an assumption
fig6a-pd-py-phase-constant reproduced

How the analysis differs from the paper's. Everything is computed in Python from the deposited spike and temperature files with a port of the paper's deposited MATLAB code (burst detection, phase, cycle temperature, condition windows, the 1/8 Hz cycle filter, the jag measure); the per-experiment values agree with the deposited summary files to a few thousandths in most cases, not exactly. The cycles that the deposited outlier removal leaves spanning two bursts (1.6%) are left out of the hold means and phases, an assumption that brings the phases much closer to the deposited summaries and that the authors' own per-experiment phases support for the slopes of fig6a (their LP ON slope in Cs+ has adjusted p = 0.0004). Every claim built on hold means or phases prints the variant with them kept (the jag measure of fig3d,e and fig4d,e counts every cycle's frequency, which these cycles keep): it changes no outcome but fig6a-lp-advances-cs, whose LP ON slope then misses p < 0.01; matched-period-lp-earlier then holds under its reading (b) only. The 11 C values are from the first 11 C hold, which is every 11 C cycle of the deposited windows. Repeated-measures ANOVA and Tukey comparisons are computed here (two Tukey readings). The picrotoxin tests use the paper's six, which include the two preparations recorded in 981_035, and take their top hold (20.7 C) as the 21 C value, which the criterion's 0.3 C rule does not allow; the two-saline frequency test uses the deposited per-experiment table. The Cs+ + PTX example of fig2c is analysed on PD spikes detected on its intracellular trace. No step uses random draws.

What was found about the dataset. (1) VoltageClampData.mat holds only the first trial of each experiment, no Cs+ trial, while its ConditionsKey lists all of them: the Ih numbers cannot be recomputed. (2) Five of the six two-saline control experiments have no spike file; ControlTable holds their per-experiment values only, and says three of their second protocols were ramps. (3) 981_035 holds two PD spike trains (PD, PD2, not in the README) that do not burst together: two preparations recorded with one thermocouple, which the picrotoxin summaries enter as two experiments; nothing in the file says so. (4) Thermocouple dropouts (to -46.7 C) in three files, outside the analysis windows. (5) LPAdvanceSamePeriod.mat includes 969_120, which has no spike file, and the code that made it is not deposited. Spike times, temperature and the condition windows otherwise agree with the README, and the raw intracellular trace and temperature of 969_113 share the spike times' clock.

In [36]:
print(f"notebook ran in {(time.time() - started) / 60:.1f} min; peak memory {resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6:.2f} GB")
notebook ran in 1.0 min; peak memory 2.77 GB