Reproducing Park, Wong-Campos et al. (2025) from dandiset 001266¶

Paper. Park P, Wong-Campos JD, Itkis DG, Lee BH, Qi Y, Davis HC, Antin B, Pasarkar A, Grimm JB, Plutkis SE, Holland KL, Paninski L, Lavis LD, Cohen AE (2025). Dendritic excitations govern back-propagation via a spike-rate accelerometer. Nature Communications 16, 1333. doi:10.1038/s41467-025-55819-9

Dataset. DANDI:001266, version 0.250710.0758, streamed from the archive. The paper cites the dandiset without a version. Two versions are published, 0.250106.0948 and 0.250710.0758; their 84 assets have the same asset identifiers, paths and sizes, so they hold the same files, and the most recent one is pinned (protocol, author step 1.3).

Claims. claims/001266/10.1038-s41467-025-55819-9.yaml, written from the version of record (PMC11794848) with its Supplementary Information, Peer Review File and Source Data. The Source Data file (41467_2025_55819_MOESM10_ESM.xlsx, sha256 142a0621...0044774d), the outside input the claims file names, maps each dandiset file to a figure panel; it is read here for that index only.

What the dandiset holds. 84 NWB files, each one raw camera movie (Voltron2 fluorescence, uint16 counts) with the DAQ channels recorded with it (laser modulation, EFS trigger, and for the patch clamp files the amplifier outputs). The Source Data index names 83 of them, one per figure panel example. The pooled samples behind most of the paper's statistics (17 neurons for Fig. 3, 28 cells for Fig. 5b, the drug series of Figs. 6 and S16 to S18) are not in it, and it holds no structural images, stimulus masks, regions of interest or pixel size.

Claim Tested here
source-data-index tested
fig2a-dspike-dichotomy, fig2b-bimodal-distal-amplitudes, fig2e-f-dspike-maps, fig2h-length-constant tested (Fig. 2 neuron)
fig3-subthreshold-no-dendritic-initiation, fig3-two-motifs-location-independent, fig3e-soma-third-bap, fig3d-distal-first-bap, fig3f-soma-plus-distal, fig3-predepolarization-rule tested (the one neuron of Figs. 2, 3 and S8 in the dandiset)
fig1-denoising-variance tested
fig5b-supralinear-auc blocked (28 cells needed); the 10 cells in the dandiset are shown beside the Source Data
fig4a-step-example, fig4d-example-alternation, figs15-stochastic tested
figs17e-ttx-high-dose, figs18g-ba-increases-calcium-spikes tested
fig5a-plateau-collision, fig5d-single-bap-no-plateau, figs23-dendrite-drives-soma tested (fig5d on 1 of 5 cells)
figs2-imaging-fidelity, figs2d-frame-rate-same-sensitivity tested
fig3h, fig3g, figs12, fig3i, figs13, fig4b (two), fig4ce, figs14 (two), figs16 (two), figs17-ttx, figs18e, figs18-ni, fig5d-timing, fig5ef, fig5gh, fig6 (three), figs24, figs25, figs1, figs3, figs4, figs5, fig3-cheriff blocked, data missing (pooled samples not deposited)
fig4f-g, figs20ab (simulations) tested in simulations_park_2025.ipynb
figs20 (parameter sweeps), figs21 (Izhikevich model, ported to Python) tested in simulations_park_2025.ipynb
In [1]:
import time
import warnings

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

import dendrite as D

warnings.filterwarnings("ignore", category=RuntimeWarning)
pd.set_option("display.width", 200)
pd.set_option("display.max_columns", 30)
print("dandiset", D.DANDISET, "version", D.VERSION)
dandiset 001266 version 0.250710.0758

Loading¶

Each movie is streamed once, in slabs of 668 frames read by parallel processes, and reduced as it loads to a few traces: the soma (a disk of 7 pixels radius), 10-pixel segments along the apical trunk, and the whole frame. The soma and trunk are found on the mean of the first 334 frames (dendrite.find_soma, dendrite.trace_trunk); for files where the brightest blob in the lower 45% of the frame is a dendrite, the search is limited to a lower part of the frame (the SOMA_LOWER fractions below, chosen by looking at the mean images, as the paper's regions were drawn by hand). For the cell of Fig. 5c, whose trunk curves, the tracer searches a wider window (TRACE).

In [2]:
FIG23_CELL = ["230713", "230014", "230335", "230952", "231405", "231620"]  # Figs. 2, 3, S8
FILE_LABEL = {"230713": "D3 (index: Fig. 2)", "230014": "D1", "230335": "D2", "230952": "D4",
              "231405": "D4+soma", "231620": "soma"}
OTHER = ["180146", "174900", "001459", "181900", "184232", "185419", "145100", "152954", "154649",
         "174622", "200953", "201133", "201912", "202041"]
S22 = ["165407", "215424", "002658", "204403", "170657", "162842", "230744", "160204", "153417"]
TRACE = {k: (6, 2.0) for k in ["200953", "201133", "201912", "202041", "204403"]}  # curved trunk
SOMA_LOWER = {"174900": .7, "001459": .75, "181900": .7, "184232": .7, "185419": .7, "145100": .7,
              "152954": .7, "154649": .7, "153417": .75, "165407": .7}

cells = {}
t_load = time.time()
for key in FIG23_CELL + OTHER + S22:
    sta = None
    if key in ("230335", "230952"):  # stimulus-triggered movie for fig1-denoising-variance
        h = D.read_header(key)
        on, _ = D.stim_onsets(h)
        sta = (D.frame_of(h["cam_t"], on), 20, 170)
    cells[key] = D.cell_traces(key, soma_lower=SOMA_LOWER.get(key, .55), sta=sta, trace=TRACE.get(key, (4, 1.5)))
    print(key, cells[key]["X"].shape, f"{time.time() - t_load:.0f} s", flush=True)
230713 (10679, 87) 38 s
230014 (10679, 87) 75 s
230335 (10679, 88) 122 s
230952 (10679, 91) 169 s
231405 (10679, 90) 206 s
231620 (10679, 88) 244 s
180146 (11650, 85) 283 s
174900 (11650, 85) 323 s
001459 (9708, 88) 338 s
181900 (11650, 90) 376 s
184232 (11650, 76) 416 s
185419 (11650, 92) 456 s
145100 (11650, 82) 495 s
152954 (11650, 77) 536 s
154649 (11650, 76) 575 s
174622 (3883, 103) 599 s
200953 (3883, 68) 623 s
201133 (3883, 68) 648 s
201912 (3883, 67) 672 s
202041 (3883, 67) 697 s
165407 (11650, 90) 736 s
215424 (3883, 57) 763 s
002658 (3846, 50) 787 s
204403 (3883, 67) 811 s
170657 (3883, 86) 836 s
162842 (3883, 91) 860 s
230744 (3883, 85) 884 s
160204 (3883, 87) 908 s
153417 (3883, 92) 932 s

Data check¶

In [3]:
rows = []
for key, o in cells.items():
    h = o["hdr"]
    on, off = D.stim_onsets(h)
    t = o["t"]
    dur = len(h["daq"]["mod488"]["x"]) / h["daq"]["mod488"]["rate"]
    rows.append(dict(file=key, experiment=h["experiment"], frames=h["shape"][0],
                     frame_px=f"{h['shape'][1]}x{h['shape'][2]}", frame_ms=round(1000 / o["fs"], 3),
                     movie_s=round(t[-1] - t[0] + 1 / o["fs"], 3), daq_s=round(dur, 3),
                     n_stim=len(on), stim_ms=round(float(np.median(off - on)) * 1000, 1),
                     first_stim_s=round(on[0], 3), soma=o["soma"],
                     trunk_um=round(o["dist"][-1] + 3.25, 0), counts_min=int(o["X"].min()),
                     counts_max=int(o["X"].max())))
info = pd.DataFrame(rows)
print(info.to_string())
print("frame interval (ms):", sorted(info.frame_ms.unique()), "-> rate", sorted((1000 / info.frame_ms).round(1).unique()), "Hz")
print("movie length minus DAQ length (s):", (info.movie_s - info.daq_s).round(3).unique())
      file                       experiment  frames frame_px  frame_ms  movie_s  daq_s  n_stim  stim_ms  first_stim_s        soma  trunk_um  counts_min  counts_max
0   230713              branch_stim (Fig.2)   10679  904x184      1.03   10.999   11.0      54     20.0          0.20   (674, 89)     552.0         112         678
1   230014              branch_stim (Fig.3)   10679  904x184      1.03   10.999   11.0      54     20.0          0.20   (672, 89)     552.0         113         734
2   230335              branch_stim (Fig.3)   10679  904x184      1.03   10.999   11.0      54     20.0          0.20   (673, 89)     559.0         113         703
3   230952              branch_stim (Fig.3)   10679  904x184      1.03   10.999   11.0      54     20.0          0.20   (675, 88)     578.0         111         688
4   231405              branch_stim (Fig.3)   10679  904x184      1.03   10.999   11.0      54     20.0          0.20   (677, 88)     572.0         111         702
5   231620              branch_stim (Fig.3)   10679  904x184      1.03   10.999   11.0      54     20.0          0.20   (677, 88)     559.0         111         675
6   180146        branch_adaptation (Fig.4)   11650  800x184      1.03   12.000   12.0       4    500.0          3.75   (614, 68)     540.0         144         609
7   174900       branch_bifurcation (Fig.4)   11650  800x184      1.03   12.000   12.0       5    600.0          2.25   (611, 80)     540.0         155         640
8   001459       period_doubling (Fig. S15)    9708  704x192      1.03    9.999   10.0      20    100.0          2.95  (618, 119)     559.0         122         339
9   181900          baseline_TTX (Fig.S17e)   11650  904x184      1.03   12.000   12.0       4   1000.0          1.50   (632, 84)     572.0         128         388
10  184232      after_TTX (100nM; Fig.S17e)   11650  904x184      1.03   12.000   12.0       4   1000.0          1.50   (632, 79)     481.0         122         484
11  185419      after_TTX (500nM; Fig.S17e)   11650  904x184      1.03   12.000   12.0       4   1000.0          1.50   (632, 78)     585.0         124         350
12  145100              baseline (Fig.S18g)   11650  800x184      1.03   12.000   12.0       4    500.0          3.75  (560, 136)     520.0         144         531
13  152954            after_Ba2+ (Fig.S18g)   11650  800x184      1.03   12.000   12.0       4    500.0          3.75  (564, 142)     488.0         135         444
14  154649       after_Ba2+_NiCl (Fig.S18g)   11650  800x184      1.03   12.000   12.0       4    500.0          3.75  (576, 152)     481.0         111         359
15  174622       Plateau_induction (Fig.5a)    3883  904x184      1.03    3.999    4.0       2     30.0          1.00   (763, 81)     656.0         117         330
16  200953  Plateau_varying_timing (Fig.5c)    3883  904x184      1.03    3.999    4.0       2     10.0          1.03   (508, 63)     429.0         122         367
17  201133  Plateau_varying_timing (Fig.5c)    3883  904x184      1.03    3.999    4.0       2     10.0          1.10   (509, 63)     429.0         119         365
18  201912  Plateau_varying_timing (Fig.5c)    3883  904x184      1.03    3.999    4.0       2     10.0          0.90   (507, 62)     422.0         120         361
19  202041  Plateau_varying_timing (Fig.5c)    3883  904x184      1.03    3.999    4.0       2     10.0          0.97   (508, 63)     422.0         117         346
20  165407              Plateau (Fig.S22-1)   11650  904x184      1.03   12.000   12.0       8     30.0          0.50   (723, 84)     572.0         114         268
21  215424              Plateau (Fig.S22-2)    3883  600x184      1.03    3.999    4.0       2     30.0          1.00   (473, 92)     358.0         134         508
22  002658              Plateau (Fig.S22-3)    3846  704x184      1.04    4.000    4.0       2     30.0          1.00  (394, 100)     312.0         114         359
23  204403            plateau_drugs (Fig.6)    3883  904x184      1.03    3.999    4.0       2     30.0          1.00   (509, 62)     422.0         115         324
24  170657              Plateau (Fig.S22-5)    3883  800x184      1.03    3.999    4.0       2     30.0          1.00  (647, 114)     546.0         132         538
25  162842              Plateau (Fig.S22-6)    3883  904x184      1.03    3.999    4.0       2     30.0          1.00   (696, 97)     578.0         127         299
26  230744              Plateau (Fig.S22-7)    3883  704x184      1.03    3.999    4.0       2     30.0          1.00   (641, 91)     540.0         137        1080
27  160204              Plateau (Fig.S22-8)    3883  800x184      1.03    3.999    4.0       2     30.0          1.00   (667, 94)     552.0         118         569
28  153417            plateau_drugs (Fig.6)    3883  800x184      1.03    3.999    4.0       2     30.0          1.00  (670, 100)     585.0         125         310
frame interval (ms): [np.float64(1.03), np.float64(1.04)] -> rate [np.float64(961.5), np.float64(970.9)] Hz
movie length minus DAQ length (s): [-0.001  0.   ]

Every movie is sampled every 1.03 ms (971 Hz), where the paper states 1 kHz; the movie spans the same time as the DAQ record (to the frame). Fluorescence is in raw camera counts. Pixel size is not in the files; 0.65 µm per pixel is the Methods' (10 pixels = 6.5 µm with the 10x objective). With it the traced lines from the soma run 310 to 660 µm, which is consistent with the apical dendrites of CA1 pyramidal cells, not a proof of the scale.

Clock check: the fluorescence at the soma must respond to the optogenetic stimulus at the DAQ's onset times and not at times shifted away from them. The response is the mean somatic -dF/F over the stimulus (at most 1 s) after each onset minus the 10 ms before, at the true onsets and at onsets shifted by half the period (trains of 10 or more stimuli) or to before the stimulus and after its end (single stimuli).

In [4]:
rows = []
for key, o in cells.items():
    on, off = D.stim_onsets(o["hdr"])
    Y = D.bleach_correct(o["X"][:, 0], o["t"])
    fr = D.frame_of(o["t"], on)
    win = min(1000.0, float(np.median(off - on)) * 1000 + 10)  # the stimulus, at most 1 s
    if len(on) >= 10:  # trains: shift by half the period, into the gaps
        sh_before, sh_after = -np.median(np.diff(on)) * 500, np.median(np.diff(on)) * 500
    else:
        sh_before, sh_after = -(win + 100), win + 200
    true, before = D.stim_contrast(Y, fr, o["fs"], shift_ms=sh_before, win_ms=(0, win))
    _, after = D.stim_contrast(Y, fr, o["fs"], shift_ms=sh_after, win_ms=(0, win))
    rows.append(dict(file=key, window_ms=round(win), response_true=round(true * 100, 2),
                     shifted_before=round(before * 100, 2), shifted_after=round(after * 100, 2)))
clock = pd.DataFrame(rows)
print("somatic -dF/F response (%) in the stimulus window at the onsets and at onsets shifted away")
print(clock.to_string())
print("files where the true response is the largest:",
      int((clock.response_true > clock[["shifted_before", "shifted_after"]].max(1)).sum()), "of", len(clock))
somatic -dF/F response (%) in the stimulus window at the onsets and at onsets shifted away
      file  window_ms  response_true  shifted_before  shifted_after
0   230713         30           2.08           -0.06          -0.07
1   230014         30           1.85           -0.02          -0.03
2   230335         30           1.70           -0.08          -0.09
3   230952         30           1.40           -0.09          -0.09
4   231405         30           3.05           -0.07          -0.07
5   231620         30           2.98           -0.06          -0.06
6   180146        510           1.39           -0.03           0.11
7   174900        610           2.77            0.66           0.05
8   001459        110           3.16           -2.45          -2.57
9   181900       1000           1.21            1.08          -0.22
10  184232       1000           0.64            1.09           0.20
11  185419       1000           0.63            0.41           0.12
12  145100        510           2.75            0.19          -0.11
13  152954        510           4.28            0.10           0.26
14  154649        510           2.80            0.20           0.27
15  174622         40           3.77            0.12          -0.35
16  200953         20           1.77            0.03          -0.11
17  201133         20           1.36            0.06           0.09
18  201912         20           1.34           -0.13           0.12
19  202041         20           1.08            0.17           0.40
20  165407         40           1.62            0.01           0.00
21  215424         40           1.83            0.02          -0.00
22  002658         40           2.34           -0.01           0.05
23  204403         40           3.88           -0.06           0.01
24  170657         40           2.69            0.02           0.15
25  162842         40           3.48           -0.17           0.14
26  230744         40           2.37            0.42           0.07
27  160204         40           2.65           -0.31           0.62
28  153417         40           2.97           -0.02           0.10
files where the true response is the largest: 28 of 29
/tmp/ipykernel_2272/4104251721.py:19: Pandas4Warning: Starting with pandas version 4.0 all arguments of max will be keyword-only.
  int((clock.response_true > clock[["shifted_before", "shifted_after"]].max(1)).sum()), "of", len(clock))

In 28 of 29 files the somatic response is larger at the true onsets than at the shifted ones.¶

In the TTX 100 nM ramp file (184232), where TTX leaves few somatic spikes, the response before the ramp is as large as during it, so the clock could not be established there by this check.

Recordings deposited twice¶

Three subjects have two files each. Their first 50 frames are compared.

In [5]:
dups = {}
for a in D.assets():
    dups.setdefault(a["path"].split("/")[0], []).append(a)
for subj, lst in dups.items():
    if len(lst) > 1:
        frames = []
        for a in lst:
            f = D.open_nwb(D.s3_url(a))
            frames.append((a["path"].split("/")[1], a["size"], f["acquisition/camera_1/data"].shape,
                           f["acquisition/camera_1/data"][:50].astype(np.int64)))
            f.close()
        same = np.array_equal(frames[0][3], frames[1][3])
        print(subj)
        for name, size, shape, _ in frames:
            print("   ", name, size, shape)
        print("    first 50 frames identical:", same)
sub-153924PP070-P27-Cell1-soma-step-5ms
    sub-153924PP070-P27-Cell1-soma-step-5ms_ses-20221119T153924_image.nwb 2370371329 (11650, 1000, 200)
    sub-153924PP070-P27-Cell1-soma-step-5ms_image.nwb 2370371329 (11650, 1000, 200)
    first 50 frames identical: True
sub-000919PP070-P17-V2-11-freq-opto
    sub-000919PP070-P17-V2-11-freq-opto_ses-20230831T000919_obj-1sog10a_image.nwb 485367799 (27183, 104, 104)
    sub-000919PP070-P17-V2-11-freq-opto_ses-20230831T000919_obj-10sv7e8_image.nwb 485367799 (27183, 104, 104)
    first 50 frames identical: True
sub-000820PP070-P17-V2-11-freq-opto-2khz
    sub-000820PP070-P17-V2-11-freq-opto-2khz_ses-20230831T000820_obj-1qtxzf9_image.nwb 341789629 (53845, 56, 56)
    sub-000820PP070-P17-V2-11-freq-opto-2khz_ses-20230831T000820_obj-1hgbkts_image.nwb 341789629 (53845, 56, 56)
    first 50 frames identical: True

source-data-index¶

The dandiset's files are the recordings the paper's Source Data index assigns to figure panels, so that example panels can be found by file name.

The index is the sheet "Raw data in Dandi_Archive" of the Source Data file. Names are matched after the index's spelling (underscores, spaces, stray quotes) is put into DANDI's (hyphens). The experiment label the index gives each file is compared with the file's own experiment_description.

In [6]:
SOURCE_DATA = ("https://static-content.springer.com/esm/art%3A10.1038%2Fs41467-025-55819-9/"
               "MediaObjects/41467_2025_55819_MOESM10_ESM.xlsx")
SOURCE_DATA_SHA256 = "142a0621e8581da59891f5a9e0b9f86983b5c2f080d6fba617eb02130044774d"
import hashlib
import io

import requests

blob = requests.get(SOURCE_DATA, timeout=60).content
print("sha256 matches the claims file:", hashlib.sha256(blob).hexdigest() == SOURCE_DATA_SHA256)
index = pd.read_excel(io.BytesIO(blob), sheet_name="Raw data in Dandi_Archive", header=1)
index = index.dropna(subset=["File name on DandiArchive"])
folders = {a["path"].split("/")[0][4:] for a in D.assets()}
index["dandi_name"] = index["File name on DandiArchive"].map(D.norm_name)
index["found"] = index.dandi_name.isin(folders)
print("index rows:", len(index), "found:", int(index.found.sum()), "dandiset subject folders:", len(folders),
      "files:", len(D.assets()))
print("not found:", index.loc[~index.found, "File name on DandiArchive"].tolist())
print("folders not in the index:", sorted(folders - set(index.dandi_name)))
# experiment labels: the file's experiment_description against the index's Experiment column
desc = {}
for key, o in cells.items():
    desc[D.norm_name(o["hdr"]["path"].split("/")[0])] = o["hdr"]["experiment"]
lab = index[index.dandi_name.isin(desc)].copy()
lab["file_experiment"] = lab.dandi_name.map(desc)
lab["same_label"] = [a.replace(" ", "") [:12] == b.replace(" ", "")[:12] for a, b in zip(lab.Experiment, lab.file_experiment)]
print(lab[["Experiment", "file_experiment", "same_label"]].to_string())
sha256 matches the claims file: True
index rows: 83 found: 83 dandiset subject folders: 81 files: 84
not found: []
folders not in the index: []
                         Experiment                  file_experiment  same_label
3               branch_stim (Fig.2)              branch_stim (Fig.2)        True
4               branch_stim (Fig.3)              branch_stim (Fig.3)        True
5               branch_stim (Fig.3)              branch_stim (Fig.3)        True
6               branch_stim (Fig.3)              branch_stim (Fig.3)        True
7               branch_stim (Fig.3)              branch_stim (Fig.3)        True
8               branch_stim (Fig.3)              branch_stim (Fig.3)        True
9        branch_adaptation (Fig.4a)        branch_adaptation (Fig.4)        True
10    branch_bifurcation (Fig.4c,d)       branch_bifurcation (Fig.4)        True
11       Plateau_induction (Fig.5a)       Plateau_induction (Fig.5a)        True
16  Plateau_varying_timing (Fig.5c)  Plateau_varying_timing (Fig.5c)        True
17  Plateau_varying_timing (Fig.5c)  Plateau_varying_timing (Fig.5c)        True
18  Plateau_varying_timing (Fig.5c)  Plateau_varying_timing (Fig.5c)        True
19  Plateau_varying_timing (Fig.5c)  Plateau_varying_timing (Fig.5c)        True
23           plateau_drugs (Fig.6a)            plateau_drugs (Fig.6)        True
26           plateau_drugs (Fig.6a)            plateau_drugs (Fig.6)        True
52       period_doubling (Fig. S15)       period_doubling (Fig. S15)        True
59          baseline_TTX (Fig.S17e)          baseline_TTX (Fig.S17e)        True
60      after_TTX (100nM; Fig.S17e)      after_TTX (100nM; Fig.S17e)        True
61      after_TTX (500nM; Fig.S17e)      after_TTX (500nM; Fig.S17e)        True
67              baseline (Fig.S18g)              baseline (Fig.S18g)        True
68            after_Ba2+ (Fig.S18g)            after_Ba2+ (Fig.S18g)        True
69       after_Ba2+_NiCl (Fig.S18g)       after_Ba2+_NiCl (Fig.S18g)        True
70                Plateau (Fig.S22)              Plateau (Fig.S22-1)        True
71                Plateau (Fig.S22)              Plateau (Fig.S22-2)        True
72                Plateau (Fig.S22)              Plateau (Fig.S22-3)        True
73                Plateau (Fig.S22)            plateau_drugs (Fig.6)       False
74                Plateau (Fig.S22)              Plateau (Fig.S22-5)        True
75                Plateau (Fig.S22)              Plateau (Fig.S22-6)        True
76                Plateau (Fig.S22)              Plateau (Fig.S22-7)        True
77                Plateau (Fig.S22)              Plateau (Fig.S22-8)        True
78                Plateau (Fig.S22)            plateau_drugs (Fig.6)       False

The criterion also identifies the files of Fig. 2 and Fig. 3 by their counts (54 trials each; Fig. 2, 8 dSpikes; Fig. 3 D2, 49 -dSpikes and 35 +dSpikes; soma, 161 and 6; Soma + D2, 116 and 54; Fig. S8a, 80 and 12; Fig. S8c-d D4, 85 and 11). bAPs and dSpikes are counted in every file of the neuron as in the claims file's shared method: somatic spikes within 60 ms of each stimulus onset, high-pass reading "median" or "butter", somatic threshold 5 robust s.d. (the claims file's standard choice) or 4 (a variant, see below), dSpike threshold at the first density minimum above the failure mode of the distal amplitudes with FWHM < 5 ms, distal region the traced trunk beyond 300 µm (claims file) or 300 to 400 µm (variant; beyond about 400 µm the traced line leaves the trunk, see the profile below).

In [7]:
calls = {}
for key in FIG23_CELL:
    o = cells[key]
    on, _ = D.stim_onsets(o["hdr"])
    for rd in D.READINGS:
        calls[(key,) + rd] = D.calls(o, on, *rd)
rows = []
for (key, r, k, hi), df in calls.items():
    per = df.groupby("trial").size().reindex(range(54), fill_value=0)
    rows.append(dict(file=key, label=FILE_LABEL[key], reading=D.reading_name(r, k, hi), trials=54,
                     bAPs=len(df), minus_dS=int((~df.dspike).sum()), plus_dS=int(df.dspike.sum()),
                     trials_with_dS=df[df.dspike].trial.nunique(),
                     bAPs_per_trial=dict(per.value_counts().sort_index()),
                     threshold=round(df.attrs["dspike_threshold"] * 100, 3)))
counts = pd.DataFrame(rows)
print(counts.to_string())
legend = {"Fig. 3 D2": (49, 35), "Fig. 3 soma": (161, 6), "Fig. 3 Soma + D2": (116, 54),
          "Fig. S8a": (80, 12), "Fig. S8c-d D4": (85, 11)}
print("legend totals (bAPs):", {k: sum(v) for k, v in legend.items()})
      file               label                         reading  trials  bAPs  minus_dS  plus_dS  trials_with_dS                    bAPs_per_trial  threshold
0   230713  D3 (index: Fig. 2)     median, k=5, distal >300 um      54   117       109        8               8                     {2: 45, 3: 9}      0.755
1   230713  D3 (index: Fig. 2)  median, k=5, distal 300-400 um      54   117       109        8               8                     {2: 45, 3: 9}      1.613
2   230713  D3 (index: Fig. 2)     median, k=4, distal >300 um      54   119       110        9               8               {2: 44, 3: 9, 4: 1}      0.735
3   230713  D3 (index: Fig. 2)  median, k=4, distal 300-400 um      54   119       110        9               8               {2: 44, 3: 9, 4: 1}      1.565
4   230713  D3 (index: Fig. 2)     butter, k=5, distal >300 um      54   114       106        8               8               {1: 1, 2: 46, 3: 7}      0.799
5   230713  D3 (index: Fig. 2)  butter, k=5, distal 300-400 um      54   114       108        6               6               {1: 1, 2: 46, 3: 7}      2.131
6   230713  D3 (index: Fig. 2)     butter, k=4, distal >300 um      54   118       110        8               8                    {2: 44, 3: 10}      0.792
7   230713  D3 (index: Fig. 2)  butter, k=4, distal 300-400 um      54   118       112        6               6                    {2: 44, 3: 10}      2.135
8   230014                  D1     median, k=5, distal >300 um      54   112       102       10              10         {1: 1, 2: 49, 3: 3, 4: 1}      0.820
9   230014                  D1  median, k=5, distal 300-400 um      54   112       101       11              11         {1: 1, 2: 49, 3: 3, 4: 1}      1.677
10  230014                  D1     median, k=4, distal >300 um      54   113       103       10              10               {2: 50, 3: 3, 4: 1}      0.820
11  230014                  D1  median, k=4, distal 300-400 um      54   113       102       11              11               {2: 50, 3: 3, 4: 1}      1.674
12  230014                  D1     butter, k=5, distal >300 um      54   108        98       10              10         {1: 4, 2: 47, 3: 2, 4: 1}      0.872
13  230014                  D1  butter, k=5, distal 300-400 um      54   108        97       11              11         {1: 4, 2: 47, 3: 2, 4: 1}      1.724
14  230014                  D1     butter, k=4, distal >300 um      54   113       103       10              10               {2: 50, 3: 3, 4: 1}      0.871
15  230014                  D1  butter, k=4, distal 300-400 um      54   113       102       11              11               {2: 50, 3: 3, 4: 1}      1.718
16  230335                  D2     median, k=5, distal >300 um      54   107        98        9               9               {1: 3, 2: 50, 4: 1}      0.811
17  230335                  D2  median, k=5, distal 300-400 um      54   107        96       11              11               {1: 3, 2: 50, 4: 1}      1.707
18  230335                  D2     median, k=4, distal >300 um      54   110       101        9               9         {1: 2, 2: 50, 3: 1, 5: 1}      0.811
19  230335                  D2  median, k=4, distal 300-400 um      54   110        99       11              11         {1: 2, 2: 50, 3: 1, 5: 1}      1.707
20  230335                  D2     butter, k=5, distal >300 um      54   105        96        9               9               {1: 6, 2: 47, 5: 1}      0.829
21  230335                  D2  butter, k=5, distal 300-400 um      54   105        94       11              11               {1: 6, 2: 47, 5: 1}      1.823
22  230335                  D2     butter, k=4, distal >300 um      54   110       101        9               9         {1: 2, 2: 50, 3: 1, 5: 1}      0.829
23  230335                  D2  butter, k=4, distal 300-400 um      54   110        99       11              11         {1: 2, 2: 50, 3: 1, 5: 1}      1.820
24  230952                  D4     median, k=5, distal >300 um      54    84        50       34              33                    {1: 24, 2: 30}      0.626
25  230952                  D4  median, k=5, distal 300-400 um      54    84        50       34              34                    {1: 24, 2: 30}      1.517
26  230952                  D4     median, k=4, distal >300 um      54    88        53       35              34        {1: 23, 2: 29, 3: 1, 4: 1}      0.625
27  230952                  D4  median, k=4, distal 300-400 um      54    88        53       35              35        {1: 23, 2: 29, 3: 1, 4: 1}      1.509
28  230952                  D4     butter, k=5, distal >300 um      54    84        52       32              32                    {1: 24, 2: 30}      0.676
29  230952                  D4  butter, k=5, distal 300-400 um      54    84        50       34              34                    {1: 24, 2: 30}      1.582
30  230952                  D4     butter, k=4, distal >300 um      54    85        52       33              33                    {1: 23, 2: 31}      0.668
31  230952                  D4  butter, k=4, distal 300-400 um      54    85        50       35              35                    {1: 23, 2: 31}      1.574
32  231405             D4+soma     median, k=5, distal >300 um      54   150       105       45              45        {1: 1, 2: 14, 3: 35, 4: 4}      0.574
33  231405             D4+soma  median, k=5, distal 300-400 um      54   150       100       50              50        {1: 1, 2: 14, 3: 35, 4: 4}      1.324
34  231405             D4+soma     median, k=4, distal >300 um      54   167       119       48              48               {2: 3, 3: 43, 4: 8}      0.580
35  231405             D4+soma  median, k=4, distal 300-400 um      54   167       114       53              53               {2: 3, 3: 43, 4: 8}      1.338
36  231405             D4+soma     butter, k=5, distal >300 um      54   148       103       45              45              {2: 18, 3: 32, 4: 4}      0.631
37  231405             D4+soma  butter, k=5, distal 300-400 um      54   148       100       48              48              {2: 18, 3: 32, 4: 4}      1.465
38  231405             D4+soma     butter, k=4, distal >300 um      54   167       119       48              48               {2: 2, 3: 45, 4: 7}      0.631
39  231405             D4+soma  butter, k=4, distal 300-400 um      54   167       116       51              51               {2: 2, 3: 45, 4: 7}      1.462
40  231620                soma     median, k=5, distal >300 um      54   150       145        5               5  {1: 3, 2: 10, 3: 38, 4: 2, 5: 1}      0.900
41  231620                soma  median, k=5, distal 300-400 um      54   150       144        6               6  {1: 3, 2: 10, 3: 38, 4: 2, 5: 1}      1.648
42  231620                soma     median, k=4, distal >300 um      54   165       160        5               5         {2: 3, 3: 46, 4: 4, 5: 1}      0.901
43  231620                soma  median, k=4, distal 300-400 um      54   165       159        6               6         {2: 3, 3: 46, 4: 4, 5: 1}      1.648
44  231620                soma     butter, k=5, distal >300 um      54   139       135        4               4        {1: 2, 2: 20, 3: 31, 4: 1}      0.978
45  231620                soma  butter, k=5, distal 300-400 um      54   139       134        5               5        {1: 2, 2: 20, 3: 31, 4: 1}      1.813
46  231620                soma     butter, k=4, distal >300 um      54   161       156        5               5         {2: 5, 3: 46, 4: 2, 5: 1}      0.964
47  231620                soma  butter, k=4, distal 300-400 um      54   161       155        6               6         {2: 5, 3: 46, 4: 2, 5: 1}      1.816
legend totals (bAPs): {'Fig. 3 D2': 84, 'Fig. 3 soma': 167, 'Fig. 3 Soma + D2': 170, 'Fig. S8a': 92, 'Fig. S8c-d D4': 96}

Result: reproduced. All 83 rows of the index name a file in the dandiset (81 distinct names, which are the 81 subject folders; two files are listed for two panels each). The experiment label of each file opened matches the index. The legend's counts identify the Fig. 3 files: the legend's D2 (49 + 35 = 84 bAPs) is the file named D4 (84 bAPs under the claims file's settings, 85 to 88 with the 4 s.d. threshold), and the Fig. 2 entry (file D3) gives the legend's 8 dSpikes. Three recordings are deposited twice (identical sizes and first frames).

The counts above identify the files. The legend's D2 of Fig. 3 (49 + 35 = 84 bAPs) is the file named D4 (84 bAPs under the claims file's settings, in both filter readings); the legend's soma and Soma + D2 are the files named soma and D4+soma (161 to 165 and 167 bAPs with the 4 s.d. variant, 139 to 150 with 5 s.d.). The somatic threshold matters in these two burst files: at 5 robust s.d. some closely spaced spikes fall below it, and 4 s.d. comes closer to the legend's totals (167 and 170) without reaching them. The index entry for Fig. 2 (file D3) gives 8 dSpikes, as its legend does.

Where the distal signal is¶

Mean peak -dF/F per trunk segment for bAPs with and without dSpikes (claims file settings), in three files. The difference between the classes is largest from 300 to about 370 µm; beyond about 400 µm the traced line runs into dim tuft and background, so the variant region stops at 400 µm.

In [8]:
def class_profiles(key, reading=("median", 5.0, np.inf)):
    o = cells[key]
    on, _ = D.stim_onsets(o["hdr"])
    df = calls[(key,) + reading]
    Y = D.bleach_correct(o["X"], o["t"])
    amp, ref = D.segment_amplitudes(Y[:, 1:-1], df, D.frame_of(o["t"], on), o["fs"])
    soma_amp, soma_ref = D.segment_amplitudes(Y[:, :1], df, D.frame_of(o["t"], on), o["fs"])
    return df, amp, ref, soma_amp[:, 0], soma_ref[:, 0]

fig, axes = plt.subplots(1, 3, figsize=(13, 3.2), sharey=True)
for ax, key in zip(axes, ["230713", "230952", "231405"]):
    df, amp, ref, _, _ = class_profiles(key)
    d = cells[key]["dist"]
    for flag, c in [(False, "C0"), (True, "C3")]:
        ax.plot(d, amp[df.dspike.values == flag].mean(0) * 100, c, label=f"{'+' if flag else '-'}dSpike (n={int((df.dspike == flag).sum())})")
    ax.axvspan(300, 400, color="0.9")
    ax.set_title(f"{key} {FILE_LABEL[key]}")
    ax.set_xlabel("distance along traced trunk (µm)")
    print(key, "range of plotted -dF/F (%):", round(float(amp.mean(0).min() * 100), 2), "to",
          round(float(max(amp[df.dspike.values].mean(0).max(), amp[~df.dspike.values].mean(0).max()) * 100), 2))
axes[0].set_ylabel("peak -dF/F (%)")
axes[0].legend()
plt.tight_layout()
plt.show()
230713 range of plotted -dF/F (%): 0.66 to 9.65
230952 range of plotted -dF/F (%): 0.69 to 8.66
231405 range of plotted -dF/F (%): 0.71 to 10.31
No description has been provided for this image

Where the regions lie¶

The regions are found on the mean image (see Loading). The figure and table below show them for the files the claims use, so that the soma, the traced line and the distance marks can be checked against the image.

In [9]:
# Where the regions lie: the mean image of each file with the traced line (cyan), the soma (yellow
# dot) and the points 200 (green), 300 (yellow) and 400 µm (red) along the line. The table gives
# their pixel coordinates (row, column) and the mean-image brightness along the line in 100 µm
# bins over the image's median (background is about 1; the trunk is brighter).
roi_keys = ["230713", "230952", "231405", "180146", "174900", "001459", "181900", "145100", "174622", "160204"]
fig, axes = plt.subplots(1, len(roi_keys), figsize=(2.0 * len(roi_keys), 4))
rows = []
for ax, key in zip(axes, roi_keys):
    o = cells[key]
    p = o["path"]
    dpath = np.r_[0, np.cumsum(np.hypot(*np.diff(p, axis=0).T))] * D.UM_PER_PX
    ax.imshow(o["mean"], cmap="gray", vmax=np.percentile(o["mean"], 99.5))
    ax.plot(p[:, 1], p[:, 0], "c-", lw=0.6)
    ax.plot(o["soma"][1], o["soma"][0], "yo", ms=4)
    row = dict(file=key, soma_rc=o["soma"], line_um=round(float(dpath[-1])))
    for um, c in [(200, "g"), (300, "y"), (400, "r")]:
        if dpath[-1] >= um:
            r_, c_ = p[np.searchsorted(dpath, um)]
            ax.plot(c_, r_, c + "x", ms=6)
            row[f"at_{um}um"] = (int(r_), int(c_))
    bright = o["mean"][p[:, 0], p[:, 1]] / np.median(o["mean"])
    for lo in range(0, 700, 100):
        sel = (dpath >= lo) & (dpath < lo + 100)
        if sel.any():
            row[f"F/bg_{lo}-{lo + 100}"] = round(float(bright[sel].mean()), 2)
    ax.set_title(key, fontsize=8)
    ax.axis("off")
    rows.append(row)
plt.tight_layout()
plt.show()
print(pd.DataFrame(rows).to_string())
No description has been provided for this image
     file     soma_rc  line_um    at_200um    at_300um    at_400um  F/bg_0-100  F/bg_100-200  F/bg_200-300  F/bg_300-400  F/bg_400-500  F/bg_500-600  F/bg_600-700
0  230713   (674, 89)      557   (392, 92)   (271, 96)   (156, 52)        2.01          1.83          1.30          1.36          0.88          0.73           NaN
1  230952   (675, 88)      582   (393, 92)   (272, 93)   (156, 60)        2.01          1.83          1.30          1.35          0.89          0.74           NaN
2  231405   (677, 88)      572   (394, 92)   (273, 92)   (158, 70)        2.00          1.85          1.29          1.36          0.89          0.75           NaN
3  180146   (614, 68)      542   (367, 33)   (245, 18)   (145, 22)        2.25          1.60          1.55          1.15          1.04          0.92           NaN
4  174900   (611, 80)      543   (371, 39)   (265, 26)   (145, 28)        2.15          1.51          1.62          1.19          1.04          0.91           NaN
5  001459  (618, 119)      561  (364, 102)   (225, 71)   (141, 21)        1.40          1.88          1.67          1.15          1.05          0.86           NaN
6  181900   (632, 84)      578    (416, 9)   (329, 44)   (233, 60)        1.97          1.14          0.94          1.40          1.14          0.92           NaN
7  145100  (560, 136)      522  (352, 111)  (228, 104)   (140, 39)        1.20          1.87          2.22          1.47          1.14          0.77           NaN
8  174622   (763, 81)      660   (532, 30)   (425, 33)  (307, 103)        1.44          1.54          1.34          1.86          1.67          1.15          0.88
9  160204   (667, 94)      556   (399, 63)   (261, 79)  (160, 146)        2.03          1.79          1.58          1.23          1.07          0.99           NaN

The traced line runs along the bright trunk to about 400 µm: in the Fig. 2 and 3 files the mean image along it is 1.3 to 2.0 times the image median up to 400 µm and 0.73 to 0.89 beyond, darker than the median, where the line has left the dendrite. In the other files shown the ratio beyond 500 µm is 0.77 to 1.15. The region "beyond 300 µm" therefore averages trunk (300 to 400 µm) with background beyond it, which dilutes distal amplitudes; the 300 to 400 µm variant keeps only the part on the trunk.

fig2a-dspike-dichotomy¶

In the Fig. 2 neuron, stimulation of proximal oblique dendrites evoked two somatic spikes per trial; in most trials the distal dendrites showed only an attenuated copy, and in 8 of 54 trials a single rapid dSpike, always on the second somatic spike.

File D3 (index entry "branch_stim (Fig.2)"). The criterion: the count of trials with a dSpike within 8 ± 0.8 under both filter readings, and no dSpike on the first somatic spike of a trial.

In [10]:
rows = []
for rd in D.READINGS:
    df = calls[("230713",) + rd]
    per = df.groupby("trial").size().reindex(range(54), fill_value=0)
    rows.append(dict(reading=D.reading_name(*rd), trials_with_dS=df[df.dspike].trial.nunique(),
                     dS_on_first=int(df[df.dspike & (df.order == 0)].shape[0]),
                     dS_by_order=dict(df[df.dspike].order.value_counts().sort_index()),
                     trials_2_spikes=int((per == 2).sum()), trials_3_spikes=int((per == 3).sum()),
                     dS_on_last_spike=int(sum(r.order == per[r.trial] - 1 for r in df[df.dspike].itertuples()))))
fig2a = pd.DataFrame(rows)
print(fig2a.to_string())
main = fig2a[fig2a.reading.str.contains("k=5, distal >300")]
print("claims file readings (median and butter, k=5, >300 µm): trials with a dSpike",
      main.trials_with_dS.tolist(), "; dSpikes on a first spike", main.dS_on_first.tolist())
                          reading  trials_with_dS  dS_on_first         dS_by_order  trials_2_spikes  trials_3_spikes  dS_on_last_spike
0     median, k=5, distal >300 um               8            0        {1: 2, 2: 6}               45                9                 8
1  median, k=5, distal 300-400 um               8            0        {1: 2, 2: 6}               45                9                 8
2     median, k=4, distal >300 um               8            0  {1: 1, 2: 7, 3: 1}               44                9                 8
3  median, k=4, distal 300-400 um               8            0  {1: 1, 2: 7, 3: 1}               44                9                 8
4     butter, k=5, distal >300 um               8            0        {1: 3, 2: 5}               46                7                 8
5  butter, k=5, distal 300-400 um               6            0        {1: 3, 2: 3}               46                7                 6
6     butter, k=4, distal >300 um               8            0        {1: 1, 2: 7}               44               10                 8
7  butter, k=4, distal 300-400 um               6            0        {1: 1, 2: 5}               44               10                 6
claims file readings (median and butter, k=5, >300 µm): trials with a dSpike [8, 8] ; dSpikes on a first spike [0, 0]

Result: reproduced. With the claims file's settings and with the 4 s.d. somatic threshold, 8 of 54 trials carry a dSpike under both filter readings, and no dSpike follows the first somatic spike of a trial. The statement says more than the criterion tests: 7 to 10 of the 54 trials have three somatic spikes, not two, and most dSpikes (5 to 7 of 8) ride on the third spike; every dSpike is on the last spike of its trial. With the distal region cut at 400 µm the Butterworth reading gives 6.

fig2b-bimodal-distal-amplitudes¶

Spike amplitudes have a unimodal distribution at the soma and a bimodal one in the distal dendrite.

Amplitudes are the high-passed -dF/F at each bAP's peak, at the soma and in the distal region, for the Fig. 2 file. Reading (a): Hartigan's dip test, p < 0.05 distal and p >= 0.05 soma. Reading (b): a two-component Gaussian mixture preferred by BIC distally and not at the soma.

In [11]:
import diptest
from sklearn.mixture import GaussianMixture

def bic_gain(x, seed=0):
    x = np.asarray(x, float).reshape(-1, 1)
    b1 = GaussianMixture(1, random_state=seed).fit(x).bic(x)
    b2 = GaussianMixture(2, random_state=seed, n_init=5).fit(x).bic(x)
    return b1 - b2  # > 0: two components preferred

rows = []
for rd in D.READINGS:
    df = calls[("230713",) + rd]
    for site in ["soma", "distal"]:
        x = df[site].values
        dip, p = diptest.diptest(x)
        rows.append(dict(reading=D.reading_name(*rd), site=site, n=len(x), dip=round(dip, 4), dip_p=round(p, 4),
                         bic1_minus_bic2=round(bic_gain(x), 1)))
fig2b = pd.DataFrame(rows)
print(fig2b.to_string())
fig, axes = plt.subplots(1, 2, figsize=(9, 2.8))
df = calls[("230713", "median", 5.0, np.inf)]
for ax, site in zip(axes, ["soma", "distal"]):
    ax.hist(df[site] * 100, 30)
    ax.set_title(f"{site} (range {df[site].min() * 100:.2f} to {df[site].max() * 100:.2f}%)")
    ax.set_xlabel("high-passed -dF/F at the bAP (%)")
axes[1].axvline(df.attrs["dspike_threshold"] * 100, color="k", ls=":")
plt.tight_layout()
plt.show()
                           reading    site    n     dip   dip_p  bic1_minus_bic2
0      median, k=5, distal >300 um    soma  117  0.0246  0.9267            -10.9
1      median, k=5, distal >300 um  distal  117  0.0203  0.9914             78.7
2   median, k=5, distal 300-400 um    soma  117  0.0246  0.9267            -10.9
3   median, k=5, distal 300-400 um  distal  117  0.0306  0.6346            125.4
4      median, k=4, distal >300 um    soma  119  0.0241  0.9334            -11.4
5      median, k=4, distal >300 um  distal  119  0.0200  0.9917             77.6
6   median, k=4, distal 300-400 um    soma  119  0.0241  0.9334            -11.4
7   median, k=4, distal 300-400 um  distal  119  0.0301  0.6505            125.5
8      butter, k=5, distal >300 um    soma  114  0.0298  0.7039            -11.0
9      butter, k=5, distal >300 um  distal  114  0.0233  0.9646             55.1
10  butter, k=5, distal 300-400 um    soma  114  0.0298  0.7039            -11.0
11  butter, k=5, distal 300-400 um  distal  114  0.0220  0.9841             89.6
12     butter, k=4, distal >300 um    soma  118  0.0288  0.7328            -12.4
13     butter, k=4, distal >300 um  distal  118  0.0215  0.9854             58.4
14  butter, k=4, distal 300-400 um    soma  118  0.0288  0.7328            -12.4
15  butter, k=4, distal 300-400 um  distal  118  0.0213  0.9880             92.3
No description has been provided for this image

Result: blocked (methods underspecified). The two readings disagree. The Gaussian mixture prefers two components for the distal amplitudes (BIC lower by 55 to 125) and one at the soma (BIC higher by 11 to 12), as the claim says; the dip test finds no bimodality anywhere (distal p 0.63 to 0.99, soma p 0.70 to 0.93), as 8 large events among about 115 are too few for it. The criterion makes this methods_underspecified.

fig2e-f-dspike-maps¶

bAPs without a dSpike are confined to the soma and proximal dendrites, while bAPs with a dSpike are amplified in the distal dendrites.

Per trunk segment, the mean peak -dF over bAPs of each class is divided by the segment's reference amplitude (mean -dF from 10 to 20 ms after the spike, Fig. 1d legend; the reference is averaged over all bAPs of the file, as it describes the segment, not the class). The soma value is the same ratio in the somatic disk; the distal value treats the distal segments as one region (mean peak over mean reference). Amplitudes are relative to the trial's pre-stimulus baseline. Criterion: the -dSpike average beyond 300 µm below half its soma value, and the +dSpike average beyond 300 µm at least its soma value. The reference, measured 10 to 20 ms after each spike, includes the depolarization the stimulus drives near the stimulated branch, so the ratio without it (raw) is shown as a variant.

In [12]:
rows = []
for rd in D.READINGS:
    df, amp, ref, samp, sref = class_profiles("230713", rd)
    d = cells["230713"]["dist"]
    region = (d > 300) & (d < rd[2])
    out = dict(reading=D.reading_name(*rd))
    for flag, name in [(False, "minus"), (True, "plus")]:
        sel = df.dspike.values == flag
        soma = samp[sel].mean() / sref.mean()
        distal = amp[sel][:, region].mean() / ref[:, region].mean()  # the region as one ROI
        out[f"{name}_soma"] = round(soma, 2)
        out[f"{name}_distal"] = round(float(distal), 2)
        out[f"{name}_ratio"] = round(float(distal / soma), 2)
        out[f"{name}_raw_ratio"] = round(float(amp[sel][:, region].mean() / samp[sel].mean()), 2)
    rows.append(out)
fig2ef = pd.DataFrame(rows)
print("dF/F_ref at the soma and over the distal region (one ROI); ratio = distal / soma;")
print("raw_ratio: the same without the reference (peak -dF/F, a variant)")
print(fig2ef.to_string())
dF/F_ref at the soma and over the distal region (one ROI); ratio = distal / soma;
raw_ratio: the same without the reference (peak -dF/F, a variant)
                          reading  minus_soma  minus_distal  minus_ratio  minus_raw_ratio  plus_soma  plus_distal  plus_ratio  plus_raw_ratio
0     median, k=5, distal >300 um        2.97          2.14         0.72             0.27       3.26         3.31        1.02            0.38
1  median, k=5, distal 300-400 um        2.97          1.49         0.50             0.43       3.26         2.64        0.81            0.70
2     median, k=4, distal >300 um        2.98          2.14         0.72             0.27       3.13         3.33        1.06            0.40
3  median, k=4, distal 300-400 um        2.98          1.49         0.50             0.43       3.13         2.68        0.85            0.74
4     butter, k=5, distal >300 um        3.01          2.16         0.72             0.27       3.28         3.34        1.02            0.38
5  butter, k=5, distal 300-400 um        3.01          1.53         0.51             0.43       3.25         2.78        0.86            0.74
6     butter, k=4, distal >300 um        2.96          2.13         0.72             0.27       3.25         3.30        1.01            0.38
7  butter, k=4, distal 300-400 um        2.97          1.50         0.51             0.44       3.23         2.75        0.85            0.74

Result: not reproduced. bAPs with a dSpike are larger in the distal region than bAPs without (dF/F_ref 3.3 against 2.1 beyond 300 µm; 2.6 to 2.8 against 1.5 between 300 and 400 µm), but no reading meets both of the criterion's thresholds. With dF/F_ref, the -dSpike distal value is 0.72 of the soma's beyond 300 µm, not below half (0.50 to 0.51 between 300 and 400 µm, where the +dSpike value is then 0.81 to 0.86, below the soma's); beyond 300 µm the +dSpike value is 1.01 to 1.06 of the soma's. With raw -dF/F the -dSpike ratio is 0.27 to 0.44 (confined) and the +dSpike ratio 0.38 to 0.74 (below the soma).

fig2h-length-constant¶

The peak amplitude of bAPs without a dSpike decays exponentially along the apical trunk with a length constant of 255 ± 10 µm (mean ± s.e.m., 93 spikes).

One fit per -dSpike bAP of -dF/F_ref along the segments, then the mean of the length constants. Readings: spikes (a) of the Fig. 2 file, (b) of all six files of the neuron; fit (a) A exp(-x/λ), (b) A exp(-x/λ) + c. The fit runs over the traced trunk up to 400 µm (beyond it the line leaves the trunk, see the profile above). Fits that fail or give λ above 5000 µm (no decay) are counted and left out. Raw -dF/F (without the reference) is a variant.

In [13]:
def length_constants(keys, reading=("median", 5.0, np.inf), max_um=400.0, normalized=True):
    out = {False: [], True: []}
    for key in keys:
        df, amp, ref, _, _ = class_profiles(key, reading)
        d = cells[key]["dist"]
        r = ref.mean(0) if normalized else np.ones(len(d))
        sel = d < max_um
        for a in amp[~df.dspike.values]:
            y = a[sel] / r[sel]
            for off in (False, True):
                out[off].append(D.exp_fit(d[sel], y, offset=off))
    return {k: np.array(v) for k, v in out.items()}

rows = []
for spikes, keys in [("(a) Fig. 2 file", ["230713"]), ("(b) all six files", FIG23_CELL)]:
    for max_um, normalized in [(400.0, True), (400.0, False)]:
        for rd in [("median", 5.0, np.inf), ("butter", 5.0, np.inf), ("median", 4.0, np.inf)]:
            lam = length_constants(keys, rd, max_um, normalized)
            for off, form in [(False, "A exp(-x/lam)"), (True, "A exp(-x/lam) + c")]:
                v = lam[off]
                ok = np.isfinite(v) & (v < 5000)
                rows.append(dict(spikes=spikes, amplitude="dF/F_ref" if normalized else "raw -dF/F",
                                 fit_range="<=400 um" if np.isfinite(max_um) else "whole line",
                                 reading=D.reading_name(*rd), form=form, n_spikes=len(v), n_used=int(ok.sum()),
                                 mean_um=round(float(v[ok].mean()), 1) if ok.any() else np.nan,
                                 sem_um=round(float(stats.sem(v[ok])), 1) if ok.sum() > 1 else np.nan,
                                 median_um=round(float(np.median(v[ok])), 1) if ok.any() else np.nan))
fig2h = pd.DataFrame(rows)
print(fig2h.to_string())
               spikes  amplitude fit_range                      reading               form  n_spikes  n_used  mean_um  sem_um  median_um
0     (a) Fig. 2 file   dF/F_ref  <=400 um  median, k=5, distal >300 um      A exp(-x/lam)       109      64   1457.0   130.1     1140.0
1     (a) Fig. 2 file   dF/F_ref  <=400 um  median, k=5, distal >300 um  A exp(-x/lam) + c       109      70     53.8     2.1       49.8
2     (a) Fig. 2 file   dF/F_ref  <=400 um  butter, k=5, distal >300 um      A exp(-x/lam)       106      61   1482.5   132.9     1204.1
3     (a) Fig. 2 file   dF/F_ref  <=400 um  butter, k=5, distal >300 um  A exp(-x/lam) + c       106      68     54.4     2.2       50.0
4     (a) Fig. 2 file   dF/F_ref  <=400 um  median, k=4, distal >300 um      A exp(-x/lam)       110      68   1488.2   130.1     1181.0
5     (a) Fig. 2 file   dF/F_ref  <=400 um  median, k=4, distal >300 um  A exp(-x/lam) + c       110      73     54.0     2.1       49.9
6     (a) Fig. 2 file  raw -dF/F  <=400 um  median, k=5, distal >300 um      A exp(-x/lam)       109     109    356.4     3.7      356.7
7     (a) Fig. 2 file  raw -dF/F  <=400 um  median, k=5, distal >300 um  A exp(-x/lam) + c       109       0      NaN     NaN        NaN
8     (a) Fig. 2 file  raw -dF/F  <=400 um  butter, k=5, distal >300 um      A exp(-x/lam)       106     106    355.5     3.6      357.3
9     (a) Fig. 2 file  raw -dF/F  <=400 um  butter, k=5, distal >300 um  A exp(-x/lam) + c       106       0      NaN     NaN        NaN
10    (a) Fig. 2 file  raw -dF/F  <=400 um  median, k=4, distal >300 um      A exp(-x/lam)       110     110    356.8     3.7      357.3
11    (a) Fig. 2 file  raw -dF/F  <=400 um  median, k=4, distal >300 um  A exp(-x/lam) + c       110       0      NaN     NaN        NaN
12  (b) all six files   dF/F_ref  <=400 um  median, k=5, distal >300 um      A exp(-x/lam)       609     419   1438.6    47.8     1125.9
13  (b) all six files   dF/F_ref  <=400 um  median, k=5, distal >300 um  A exp(-x/lam) + c       609     470     57.7     1.0       52.9
14  (b) all six files   dF/F_ref  <=400 um  butter, k=5, distal >300 um      A exp(-x/lam)       590     415   1406.6    46.4     1088.7
15  (b) all six files   dF/F_ref  <=400 um  butter, k=5, distal >300 um  A exp(-x/lam) + c       590     464     58.4     1.1       53.4
16  (b) all six files   dF/F_ref  <=400 um  median, k=4, distal >300 um      A exp(-x/lam)       646     443   1433.5    47.1     1097.0
17  (b) all six files   dF/F_ref  <=400 um  median, k=4, distal >300 um  A exp(-x/lam) + c       646     498     57.8     1.0       53.2
18  (b) all six files  raw -dF/F  <=400 um  median, k=5, distal >300 um      A exp(-x/lam)       609     609    402.1     3.9      392.2
19  (b) all six files  raw -dF/F  <=400 um  median, k=5, distal >300 um  A exp(-x/lam) + c       609      44   1026.1   151.9      574.4
20  (b) all six files  raw -dF/F  <=400 um  butter, k=5, distal >300 um      A exp(-x/lam)       590     590    404.4     4.1      394.0
21  (b) all six files  raw -dF/F  <=400 um  butter, k=5, distal >300 um  A exp(-x/lam) + c       590      40    893.6   148.6      557.1
22  (b) all six files  raw -dF/F  <=400 um  median, k=4, distal >300 um      A exp(-x/lam)       646     646    403.0     3.8      393.0
23  (b) all six files  raw -dF/F  <=400 um  median, k=4, distal >300 um  A exp(-x/lam) + c       646      47    996.2   145.4      562.9

Result: not reproduced. No reading gives 255 ± 10 µm. Per-spike fits of dF/F_ref along the trunk fail or exceed 5000 µm for 23 to 42% of spikes and give a mean λ of 1407 to 1488 µm without an offset and 54 to 58 µm with one. Fits of raw -dF/F without an offset give 356 ± 4 µm (Fig. 2 file, mean ± s.e.m.) and 402 to 404 ± 4 µm (all six files); with an offset they mostly fail. The reference amplitude rises near the stimulated branch, which distorts the normalized profile.

fig3-subthreshold-no-dendritic-initiation¶

Subthreshold depolarization follows the stimulus location and decays smoothly outside it; dSpikes never initiated in the dendrites.

Distal events are found here without reference to the soma: peaks of the high-passed distal trace above the file's dSpike threshold with FWHM < 5 ms. Each is checked for a somatic spike whose peak precedes it by 0 to 5 ms. The dandiset holds one neuron of the 17; its six stimulus locations are used.

In [14]:
rows = []
for key in FIG23_CELL:
    o = cells[key]
    for rd in D.READINGS:
        df = calls[(key,) + rd]
        Y, H = D.corrected(o, rd[0])
        ev = D.independent_distal_events(H, o["dist"], df.attrs["dspike_threshold"], o["fs"], hi_um=rd[2])
        pk, _ = D.detect_spikes(H[:, 0], o["fs"], k=rd[1])
        lag = [(e - pk[pk <= e].max()) / o["fs"] * 1000 if (pk <= e).any() else np.inf for e in ev]
        lag = np.array(lag)
        on, _ = D.stim_onsets(o["hdr"])
        after_onset = [(o["t"][e] - on[on <= o["t"][e]].max()) * 1000 if (on <= o["t"][e]).any() else np.nan for e in ev]
        after_onset = np.array(after_onset)
        rows.append(dict(file=key, label=FILE_LABEL[key], reading=D.reading_name(*rd), distal_events=len(ev),
                         soma_spike_0_5ms_before=int((lag <= 5).sum()), soma_spike_5_15ms_before=int(((lag > 5) & (lag <= 15)).sum()),
                         none_within_15ms=int((lag > 15).sum()),
                         those_ms_after_onset=np.round(after_onset[lag > 15], 1).tolist()))
fig3sub = pd.DataFrame(rows)
print(fig3sub.to_string())
      file               label                         reading  distal_events  soma_spike_0_5ms_before  soma_spike_5_15ms_before  none_within_15ms those_ms_after_onset
0   230713  D3 (index: Fig. 2)     median, k=5, distal >300 um              8                        6                         2                 0                   []
1   230713  D3 (index: Fig. 2)  median, k=5, distal 300-400 um              8                        6                         2                 0                   []
2   230713  D3 (index: Fig. 2)     median, k=4, distal >300 um              8                        6                         2                 0                   []
3   230713  D3 (index: Fig. 2)  median, k=4, distal 300-400 um              8                        6                         2                 0                   []
4   230713  D3 (index: Fig. 2)     butter, k=5, distal >300 um              8                        6                         2                 0                   []
5   230713  D3 (index: Fig. 2)  butter, k=5, distal 300-400 um              7                        5                         2                 0                   []
6   230713  D3 (index: Fig. 2)     butter, k=4, distal >300 um              8                        6                         2                 0                   []
7   230713  D3 (index: Fig. 2)  butter, k=4, distal 300-400 um              7                        5                         2                 0                   []
8   230014                  D1     median, k=5, distal >300 um             11                       10                         1                 0                   []
9   230014                  D1  median, k=5, distal 300-400 um             12                       11                         1                 0                   []
10  230014                  D1     median, k=4, distal >300 um             11                       10                         1                 0                   []
11  230014                  D1  median, k=4, distal 300-400 um             12                       11                         1                 0                   []
12  230014                  D1     butter, k=5, distal >300 um             11                       10                         1                 0                   []
13  230014                  D1  butter, k=5, distal 300-400 um             12                       11                         1                 0                   []
14  230014                  D1     butter, k=4, distal >300 um             11                       10                         1                 0                   []
15  230014                  D1  butter, k=4, distal 300-400 um             12                       11                         1                 0                   []
16  230335                  D2     median, k=5, distal >300 um              9                        9                         0                 0                   []
17  230335                  D2  median, k=5, distal 300-400 um             11                       11                         0                 0                   []
18  230335                  D2     median, k=4, distal >300 um              9                        9                         0                 0                   []
19  230335                  D2  median, k=4, distal 300-400 um             11                       11                         0                 0                   []
20  230335                  D2     butter, k=5, distal >300 um              9                        9                         0                 0                   []
21  230335                  D2  butter, k=5, distal 300-400 um             11                       11                         0                 0                   []
22  230335                  D2     butter, k=4, distal >300 um              9                        9                         0                 0                   []
23  230335                  D2  butter, k=4, distal 300-400 um             11                       11                         0                 0                   []
24  230952                  D4     median, k=5, distal >300 um             36                       35                         0                 1               [20.7]
25  230952                  D4  median, k=5, distal 300-400 um             35                       32                         2                 1               [20.7]
26  230952                  D4     median, k=4, distal >300 um             36                       36                         0                 0                   []
27  230952                  D4  median, k=4, distal 300-400 um             35                       33                         2                 0                   []
28  230952                  D4     butter, k=5, distal >300 um             34                       33                         0                 1               [21.4]
29  230952                  D4  butter, k=5, distal 300-400 um             35                       32                         2                 1               [21.4]
30  230952                  D4     butter, k=4, distal >300 um             34                       34                         0                 0                   []
31  230952                  D4  butter, k=4, distal 300-400 um             35                       33                         2                 0                   []
32  231405             D4+soma     median, k=5, distal >300 um             56                       46                         9                 1              [170.3]
33  231405             D4+soma  median, k=5, distal 300-400 um             57                       51                         6                 0                   []
34  231405             D4+soma     median, k=4, distal >300 um             56                       49                         6                 1              [170.3]
35  231405             D4+soma  median, k=4, distal 300-400 um             57                       54                         3                 0                   []
36  231405             D4+soma     butter, k=5, distal >300 um             56                       44                        10                 2       [126.3, 170.3]
37  231405             D4+soma  butter, k=5, distal 300-400 um             56                       49                         5                 2       [126.3, 170.3]
38  231405             D4+soma     butter, k=4, distal >300 um             56                       47                         7                 2       [126.3, 170.3]
39  231405             D4+soma  butter, k=4, distal 300-400 um             56                       52                         2                 2       [126.3, 170.3]
40  231620                soma     median, k=5, distal >300 um              6                        6                         0                 0                   []
41  231620                soma  median, k=5, distal 300-400 um              7                        7                         0                 0                   []
42  231620                soma     median, k=4, distal >300 um              6                        6                         0                 0                   []
43  231620                soma  median, k=4, distal 300-400 um              7                        7                         0                 0                   []
44  231620                soma     butter, k=5, distal >300 um              5                        4                         1                 0                   []
45  231620                soma  butter, k=5, distal 300-400 um              7                        5                         1                 1                [nan]
46  231620                soma     butter, k=4, distal >300 um              5                        5                         0                 0                   []
47  231620                soma  butter, k=4, distal 300-400 um              7                        7                         0                 0                   []
In [15]:
# The distal events above with no somatic spike within 15 ms before them: the largest high-passed
# somatic value in the 15 ms before each (in robust s.d. of the somatic trace, against the
# threshold k), and the traces around the first six.
orph = []
for key in FIG23_CELL:
    o = cells[key]
    on, _ = D.stim_onsets(o["hdr"])
    for rd in [r for r in D.READINGS if not np.isfinite(r[2])]:
        df = calls[(key,) + rd]
        Y, H = D.corrected(o, rd[0])
        ev = D.independent_distal_events(H, o["dist"], df.attrs["dspike_threshold"], o["fs"])
        pk, thr = D.detect_spikes(H[:, 0], o["fs"], k=rd[1])
        xd, _ = D.distal_trace(H, o["dist"], 300)
        w = int(0.015 * o["fs"])
        for e in ev:
            prev = pk[pk <= e]
            if len(prev) and (e - prev.max()) / o["fs"] * 1000 <= 15:
                continue
            j = max(0, e - w) + int(np.argmax(H[max(0, e - w):e + 1, 0]))
            before = on[on <= o["t"][e]]
            orph.append(dict(file=key, reading=D.reading_name(*rd), frame=int(e),
                             ms_after_onset=round(float((o["t"][e] - before.max()) * 1000), 1) if len(before) else np.nan,
                             distal_pct=round(float(xd[e] * 100), 2), dspike_thr_pct=round(float(df.attrs["dspike_threshold"] * 100), 2),
                             soma_max_15ms_before_sd=round(float(H[j, 0] / (thr / rd[1])), 1), k=rd[1],
                             soma_max_ms_before=round((e - j) / o["fs"] * 1000, 1)))
orph = pd.DataFrame(orph)
print(orph.to_string() if len(orph) else "no such events")
uniq = orph.drop_duplicates(["file", "frame"]).head(6) if len(orph) else orph
if len(uniq):
    fig, axes = plt.subplots(1, len(uniq), figsize=(3 * len(uniq), 2.6), squeeze=False)
    for ax, r in zip(axes[0], uniq.itertuples()):
        o = cells[r.file]
        Y, H = D.corrected(o, "median")
        xd, _ = D.distal_trace(H, o["dist"], 300)
        w = int(0.04 * o["fs"])
        s = slice(max(0, r.frame - w), r.frame + w)
        tt = (np.arange(len(o["t"]))[s] - r.frame) / o["fs"] * 1000
        ax.plot(tt, H[s, 0] * 100, label="soma")
        ax.plot(tt, xd[s] * 100, label="distal >300 µm")
        ax.set_title(f"{r.file} frame {r.frame}", fontsize=8)
        ax.set_xlabel("ms from distal event")
        print(r.file, r.frame, "plotted range (%):", round(float(min(H[s, 0].min(), xd[s].min()) * 100), 2), "to",
              round(float(max(H[s, 0].max(), xd[s].max()) * 100), 2))
    axes[0][0].set_ylabel("high-passed -dF/F (%), median filter")
    axes[0][0].legend(fontsize=7)
    plt.tight_layout()
    plt.show()
     file                      reading  frame  ms_after_onset  distal_pct  dspike_thr_pct  soma_max_15ms_before_sd    k  soma_max_ms_before
0  230952  median, k=5, distal >300 um   1184            20.7        0.93            0.63                      4.7  5.0                 4.1
1  230952  butter, k=5, distal >300 um   3709            21.4        0.81            0.68                      4.9  5.0                 2.1
2  231405  median, k=5, distal >300 um   6572           170.3        0.74            0.57                      2.1  5.0                 3.1
3  231405  median, k=4, distal >300 um   6572           170.3        0.74            0.58                      2.1  4.0                 3.1
4  231405  butter, k=5, distal >300 um   4005           126.3        1.03            0.63                      2.4  5.0                11.3
5  231405  butter, k=5, distal >300 um   6572           170.3        0.80            0.63                      2.0  5.0                 3.1
6  231405  butter, k=4, distal >300 um   4005           126.3        1.03            0.63                      2.4  4.0                11.3
7  231405  butter, k=4, distal >300 um   6572           170.3        0.80            0.63                      2.0  4.0                 3.1
230952 1184 plotted range (%): -1.53 to 4.37
230952 3709 plotted range (%): -1.2 to 4.44
231405 6572 plotted range (%): -3.15 to 3.53
231405 4005 plotted range (%): -4.34 to 1.69
No description has been provided for this image

Result: not reproduced. Most distal events found without reference to the soma follow a somatic spike, but not all. With the claims file's settings (5 s.d., beyond 300 µm), file D4 has 1 event (20.7 and 21.4 ms after onset) and the D4+soma file 1 (median filter, 170 ms after onset) or 2 (Butterworth, 126 and 170 ms) with no somatic spike within 15 ms before them. The table above shows why: before the D4 event the somatic trace peaks at 4.7 to 4.9 robust s.d., a spike just under the 5 s.d. threshold (the 4 s.d. threshold finds it). Before the two D4+soma events the somatic trace stays at 2.0 to 2.4 s.d., so no somatic spike precedes them; they fall 126 and 170 ms after onset, between stimuli, with distal amplitudes of 0.74 to 1.03% against thresholds of 0.57 to 0.63%. By the criterion (no dSpike without a preceding somatic spike) the claim fails on one or two small isolated distal events; whether they are dendrite-initiated spikes or noise is not settled by the outputs. The subthreshold part of the statement is not tested. Only one of the 17 neurons is in the dandiset.

fig3-two-motifs-location-independent¶

Neurons produced only two kinds of excitation, perisomatic bAPs and distal dSpikes, and neither spatial profile depended on which dendrite was stimulated.

Profiles of -dF/F_ref along the traced trunk (to 400 µm, see above) for each class and each of the six stimulus locations; raw -dF/F is a variant. Criterion: within each class every pair of locations has Pearson r >= 0.9, and the +dSpike profile exceeds the -dSpike profile beyond 300 µm in every location.

In [16]:
for rd in [("median", 5.0, np.inf), ("butter", 5.0, np.inf), ("median", 4.0, np.inf), ("butter", 4.0, np.inf)]:
  for normalized in (True, False):
    prof = {False: {}, True: {}}
    exceed = {}
    nmin = min(int((cells[k]["dist"] < 400).sum()) for k in FIG23_CELL)  # the traced trunk
    for key in FIG23_CELL:
        df, amp, ref, _, _ = class_profiles(key, rd)
        r = ref.mean(0) if normalized else np.ones(amp.shape[1])
        d = cells[key]["dist"]
        for flag in (False, True):
            if (df.dspike == flag).sum():
                prof[flag][key] = (amp[df.dspike.values == flag].mean(0) / r)[:nmin]
        region = d[:nmin] > 300
        exceed[key] = round(float(np.mean(prof[True][key][region] > prof[False][key][region])), 2) if key in prof[True] else None
    print("reading:", D.reading_name(*rd), "| amplitude:", "dF/F_ref" if normalized else "raw -dF/F", "| segments to", round(float(cells[FIG23_CELL[0]]["dist"][nmin - 1]), 1), "µm")
    for flag in (False, True):
        keys = list(prof[flag])
        M = np.array([prof[flag][k] for k in keys])
        R = np.corrcoef(M)
        iu = np.triu_indices(len(keys), 1)
        print(f"  {'+' if flag else '-'}dSpike profiles: {len(keys)} locations, pairwise r min {R[iu].min():.3f}, median {np.median(R[iu]):.3f}, pairs >= 0.9: {int((R[iu] >= 0.9).sum())} of {len(iu[0])}")
    print("  fraction of segments beyond 300 µm where +dSpike exceeds -dSpike, by file:", exceed)
d = cells["230713"]["dist"][:nmin]
fig, axes = plt.subplots(1, 2, figsize=(10, 3), sharey=True)
for ax, flag in zip(axes, (False, True)):
    for key in prof[flag]:
        ax.plot(d, prof[flag][key], label=FILE_LABEL[key])
    ax.set_title(f"{'+' if flag else '-'}dSpike bAPs (last reading above)")
    ax.set_xlabel("distance (µm)")
axes[0].set_ylabel("-dF/F_ref")
axes[1].legend(fontsize=7)
plt.tight_layout()
plt.show()
print("plotted range:", round(min(v.min() for p in prof.values() for v in p.values()), 2), "to",
      round(max(v.max() for p in prof.values() for v in p.values()), 2))
reading: median, k=5, distal >300 um | amplitude: dF/F_ref | segments to 399.8 µm
  -dSpike profiles: 6 locations, pairwise r min 0.811, median 0.914, pairs >= 0.9: 9 of 15
  +dSpike profiles: 6 locations, pairwise r min 0.307, median 0.763, pairs >= 0.9: 0 of 15
  fraction of segments beyond 300 µm where +dSpike exceeds -dSpike, by file: {'230713': 0.94, '230014': 1.0, '230335': 1.0, '230952': 1.0, '231405': 1.0, '231620': 0.88}
reading: median, k=5, distal >300 um | amplitude: raw -dF/F | segments to 399.8 µm
  -dSpike profiles: 6 locations, pairwise r min 0.908, median 0.967, pairs >= 0.9: 15 of 15
  +dSpike profiles: 6 locations, pairwise r min 0.888, median 0.964, pairs >= 0.9: 12 of 15
  fraction of segments beyond 300 µm where +dSpike exceeds -dSpike, by file: {'230713': 0.94, '230014': 1.0, '230335': 1.0, '230952': 1.0, '231405': 1.0, '231620': 0.88}
reading: butter, k=5, distal >300 um | amplitude: dF/F_ref | segments to 399.8 µm
  -dSpike profiles: 6 locations, pairwise r min 0.832, median 0.895, pairs >= 0.9: 7 of 15
  +dSpike profiles: 6 locations, pairwise r min 0.441, median 0.756, pairs >= 0.9: 0 of 15
  fraction of segments beyond 300 µm where +dSpike exceeds -dSpike, by file: {'230713': 0.94, '230014': 1.0, '230335': 1.0, '230952': 1.0, '231405': 1.0, '231620': 1.0}
reading: butter, k=5, distal >300 um | amplitude: raw -dF/F | segments to 399.8 µm
  -dSpike profiles: 6 locations, pairwise r min 0.904, median 0.965, pairs >= 0.9: 15 of 15
  +dSpike profiles: 6 locations, pairwise r min 0.881, median 0.964, pairs >= 0.9: 12 of 15
  fraction of segments beyond 300 µm where +dSpike exceeds -dSpike, by file: {'230713': 0.94, '230014': 1.0, '230335': 1.0, '230952': 1.0, '231405': 1.0, '231620': 1.0}
reading: median, k=4, distal >300 um | amplitude: dF/F_ref | segments to 399.8 µm
  -dSpike profiles: 6 locations, pairwise r min 0.826, median 0.913, pairs >= 0.9: 9 of 15
  +dSpike profiles: 6 locations, pairwise r min 0.349, median 0.775, pairs >= 0.9: 0 of 15
  fraction of segments beyond 300 µm where +dSpike exceeds -dSpike, by file: {'230713': 0.94, '230014': 1.0, '230335': 1.0, '230952': 1.0, '231405': 1.0, '231620': 0.88}
reading: median, k=4, distal >300 um | amplitude: raw -dF/F | segments to 399.8 µm
  -dSpike profiles: 6 locations, pairwise r min 0.907, median 0.967, pairs >= 0.9: 15 of 15
  +dSpike profiles: 6 locations, pairwise r min 0.891, median 0.964, pairs >= 0.9: 13 of 15
  fraction of segments beyond 300 µm where +dSpike exceeds -dSpike, by file: {'230713': 0.94, '230014': 1.0, '230335': 1.0, '230952': 1.0, '231405': 1.0, '231620': 0.88}
reading: butter, k=4, distal >300 um | amplitude: dF/F_ref | segments to 399.8 µm
  -dSpike profiles: 6 locations, pairwise r min 0.819, median 0.907, pairs >= 0.9: 9 of 15
  +dSpike profiles: 6 locations, pairwise r min 0.323, median 0.758, pairs >= 0.9: 0 of 15
  fraction of segments beyond 300 µm where +dSpike exceeds -dSpike, by file: {'230713': 0.94, '230014': 1.0, '230335': 1.0, '230952': 1.0, '231405': 1.0, '231620': 0.88}
reading: butter, k=4, distal >300 um | amplitude: raw -dF/F | segments to 399.8 µm
  -dSpike profiles: 6 locations, pairwise r min 0.904, median 0.966, pairs >= 0.9: 15 of 15
  +dSpike profiles: 6 locations, pairwise r min 0.881, median 0.965, pairs >= 0.9: 12 of 15
  fraction of segments beyond 300 µm where +dSpike exceeds -dSpike, by file: {'230713': 0.94, '230014': 1.0, '230335': 1.0, '230952': 1.0, '231405': 1.0, '231620': 0.88}
No description has been provided for this image
plotted range: 0.01 to 0.1

Result: not reproduced. With dF/F_ref along the traced trunk, the lowest pairwise r between the six stimulus locations is 0.81 to 0.83 for the -dSpike profiles (7 to 9 of 15 pairs at 0.9 or more) and 0.31 to 0.44 for the +dSpike profiles (0 of 15 pairs). With raw -dF/F, 15 of 15 -dSpike pairs and 12 to 13 of 15 +dSpike pairs reach 0.9 (lowest r 0.88 to 0.89). The +dSpike profile exceeds the -dSpike profile in 88 to 100% of segments beyond 300 µm, not in all. The two motifs are similar across locations, but not to the criterion's thresholds.

fig3e-soma-third-bap, fig3d-distal-first-bap, fig3f-soma-plus-distal¶

fig3e: In the Fig. 3 neuron, soma stimulation never evoked dSpikes on the first two bAPs and evoked one on the third bAP in 6 of 54 trials.

fig3d: stimulation of distal dendrite D2 evoked a dSpike on the first bAP in 35 of 54 trials (65%).

fig3f: simultaneous soma and D2 stimulation gave two quick bAPs without dSpikes and then a third bAP that evoked a dSpike in all 54 trials.

dSpikes per bAP position within the trial, for the soma file, the files D2 and D4 (the readings for the legend's D2), and the D4+soma file.

In [17]:
rows = []
for key in ["231620", "230335", "230952", "231405"]:
    for rd in D.READINGS:
        df = calls[(key,) + rd]
        by = df.groupby("order").agg(n=("dspike", "size"), dS=("dspike", "sum"))
        rows.append(dict(file=key, label=FILE_LABEL[key], reading=D.reading_name(*rd), bAPs=len(df),
                         **{f"bAP{i + 1}_dS/n": f"{int(by.dS.get(i, 0))}/{int(by.n.get(i, 0))}" for i in range(4)}))
fig3 = pd.DataFrame(rows)
print(fig3.to_string())
      file    label                         reading  bAPs bAP1_dS/n bAP2_dS/n bAP3_dS/n bAP4_dS/n
0   231620     soma     median, k=5, distal >300 um   150      0/54      3/51      2/41       0/3
1   231620     soma  median, k=5, distal 300-400 um   150      0/54      3/51      3/41       0/3
2   231620     soma     median, k=4, distal >300 um   165      0/54      0/54      5/51       0/5
3   231620     soma  median, k=4, distal 300-400 um   165      0/54      0/54      6/51       0/5
4   231620     soma     butter, k=5, distal >300 um   139      0/54      2/52      2/32       0/1
5   231620     soma  butter, k=5, distal 300-400 um   139      0/54      2/52      3/32       0/1
6   231620     soma     butter, k=4, distal >300 um   161      0/54      2/54      3/49       0/3
7   231620     soma  butter, k=4, distal 300-400 um   161      0/54      2/54      4/49       0/3
8   230335       D2     median, k=5, distal >300 um   107      2/54      7/51       0/1       0/1
9   230335       D2  median, k=5, distal 300-400 um   107      3/54      8/51       0/1       0/1
10  230335       D2     median, k=4, distal >300 um   110      0/54      9/52       0/2       0/1
11  230335       D2  median, k=4, distal 300-400 um   110      1/54     10/52       0/2       0/1
12  230335       D2     butter, k=5, distal >300 um   105      2/54      7/48       0/1       0/1
13  230335       D2  butter, k=5, distal 300-400 um   105      3/54      8/48       0/1       0/1
14  230335       D2     butter, k=4, distal >300 um   110      0/54      9/52       0/2       0/1
15  230335       D2  butter, k=4, distal 300-400 um   110      1/54     10/52       0/2       0/1
16  230952       D4     median, k=5, distal >300 um    84     32/54      2/30       0/0       0/0
17  230952       D4  median, k=5, distal 300-400 um    84     33/54      1/30       0/0       0/0
18  230952       D4     median, k=4, distal >300 um    88     33/54      2/31       0/2       0/1
19  230952       D4  median, k=4, distal 300-400 um    88     34/54      1/31       0/2       0/1
20  230952       D4     butter, k=5, distal >300 um    84     31/54      1/30       0/0       0/0
21  230952       D4  butter, k=5, distal 300-400 um    84     33/54      1/30       0/0       0/0
22  230952       D4     butter, k=4, distal >300 um    85     32/54      1/31       0/0       0/0
23  230952       D4  butter, k=4, distal 300-400 um    85     34/54      1/31       0/0       0/0
24  231405  D4+soma     median, k=5, distal >300 um   150      0/54     14/53     31/39       0/4
25  231405  D4+soma  median, k=5, distal 300-400 um   150      0/54     15/53     35/39       0/4
26  231405  D4+soma     median, k=4, distal >300 um   167      0/54      2/54     46/51       0/8
27  231405  D4+soma  median, k=4, distal 300-400 um   167      0/54      2/54     51/51       0/8
28  231405  D4+soma     butter, k=5, distal >300 um   148      1/54     14/54     30/36       0/4
29  231405  D4+soma  butter, k=5, distal 300-400 um   148      1/54     15/54     32/36       0/4
30  231405  D4+soma     butter, k=4, distal >300 um   167      0/54      2/54     46/52       0/7
31  231405  D4+soma  butter, k=4, distal 300-400 um   167      0/54      2/54     49/52       0/7
In [18]:
# fig3d: which reading's totals match the legend's D2 (49 + 35 = 84 bAPs), and the first-bAP
# count under each reading (criterion: within 35 +- 3.5 under the reading whose totals match)
rows = []
for key in ["230952", "230335"]:
    for rd in D.READINGS:
        df = calls[(key,) + rd]
        rows.append(dict(file=key, label=FILE_LABEL[key], reading=D.reading_name(*rd), bAPs=len(df), legend_bAPs=84,
                         total_matches=len(df) == 84, first_bAP_dS=int(df[df.order == 0].dspike.sum()),
                         within_35_pm_3p5=abs(int(df[df.order == 0].dspike.sum()) - 35) <= 3.5))
sel = pd.DataFrame(rows)
print(sel.to_string())
m = sel[sel.total_matches]
print("readings whose total matches the legend:", m.reading.tolist(), "; first-bAP dSpikes there:", m.first_bAP_dS.tolist(),
      "; all within tolerance:", bool(m.within_35_pm_3p5.all()) if len(m) else None)
      file label                         reading  bAPs  legend_bAPs  total_matches  first_bAP_dS  within_35_pm_3p5
0   230952    D4     median, k=5, distal >300 um    84           84           True            32              True
1   230952    D4  median, k=5, distal 300-400 um    84           84           True            33              True
2   230952    D4     median, k=4, distal >300 um    88           84          False            33              True
3   230952    D4  median, k=4, distal 300-400 um    88           84          False            34              True
4   230952    D4     butter, k=5, distal >300 um    84           84           True            31             False
5   230952    D4  butter, k=5, distal 300-400 um    84           84           True            33              True
6   230952    D4     butter, k=4, distal >300 um    85           84          False            32              True
7   230952    D4  butter, k=4, distal 300-400 um    85           84          False            34              True
8   230335    D2     median, k=5, distal >300 um   107           84          False             2             False
9   230335    D2  median, k=5, distal 300-400 um   107           84          False             3             False
10  230335    D2     median, k=4, distal >300 um   110           84          False             0             False
11  230335    D2  median, k=4, distal 300-400 um   110           84          False             1             False
12  230335    D2     butter, k=5, distal >300 um   105           84          False             2             False
13  230335    D2  butter, k=5, distal 300-400 um   105           84          False             3             False
14  230335    D2     butter, k=4, distal >300 um   110           84          False             0             False
15  230335    D2  butter, k=4, distal 300-400 um   110           84          False             1             False
readings whose total matches the legend: ['median, k=5, distal >300 um', 'median, k=5, distal 300-400 um', 'butter, k=5, distal >300 um', 'butter, k=5, distal 300-400 um'] ; first-bAP dSpikes there: [32, 33, 31, 33] ; all within tolerance: False

Result: not reproduced. In the D4+soma file with the 4 s.d. threshold (167 bAPs against the legend's 170) and the claims file's region beyond 300 µm, 46 third bAPs carry a dSpike (of 51 with the median filter and 52 with the Butterworth), short of 54 ± 5.4, and 2 of 108 first and second bAPs carry one (within the criterion's 10%). With the region cut at 400 µm, where the traced line is still on the trunk, the count is 51 (median) and 49 (Butterworth), within tolerance; with 5 s.d., spikes are missed and only 30 to 35 third bAPs carry one.

Result: blocked (methods underspecified). The criterion counts under the reading whose totals match the legend. The file named D4 has exactly the legend's 84 bAPs only with the claims file's 5 s.d. threshold (in both filter readings and both regions; 85 to 88 with 4 s.d.), so the criterion points to 5 s.d. There, beyond 300 µm, the median filter gives 32 of 54 first bAPs with a dSpike, within 35 ± 3.5, and the Butterworth filter 31, one trial outside; the filter readings disagree, so the claim is methods_underspecified under its own criterion. The Butterworth count rests on the trough rule for the dSpike threshold, so a slightly different trough could move it by one, and the result lies close to the tolerance either way. Readings not used for the outcome: between 300 and 400 µm both filters give 33, and with 4 s.d. 33 and 32, but 4 s.d. does not give the legend's totals in this file, nor in the soma and D4+soma files (161 to 165 against 167, and 167 against 170). The file named D2 gives 0 to 3.

Result: not reproduced. No reading gives 6 third-bAP dSpikes with none on the first two bAPs under both filters. With the 4 s.d. threshold (161 to 165 bAPs against the legend's 167, closer than the 139 to 150 at 5 s.d.), the median filter gives 5 of 51 third bAPs (6 with the region cut at 400 µm) and none on the first two; the Butterworth filter gives 3 (4) on the third and 2 on the second. With 5 s.d., dSpikes fall on second bAPs in both filters (3 and 2).

fig3-predepolarization-rule¶

dSpikes arise if and only if the distal dendrites have been depolarized for at least 15 ms before the bAP arrives.

Per file, the onset of distal depolarization is the first frame after stimulus onset at which the stimulus-triggered average distal -dF/F exceeds its pre-stimulus mean by 2 s.d. Each bAP's time after that onset is compared with 15 ms. Criterion: at least 90% of dSpikes follow 15 ms or more of distal depolarization, and at least 90% of bAPs that follow less than 15 ms fail.

In [19]:
for rd in D.READINGS:
    tabs = []
    for key in FIG23_CELL:
        o = cells[key]
        on, _ = D.stim_onsets(o["hdr"])
        Y = D.bleach_correct(o["X"], o["t"])
        yd, _ = D.distal_trace(Y, o["dist"], 300, rd[2])
        onset_ms, _ = D.depolarization_onset(yd, D.frame_of(o["t"], on), o["fs"])
        df = calls[(key,) + rd].copy()
        df["depolarized_ms"] = df.t_ms - onset_ms
        df["file"] = key
        df["onset_ms"] = onset_ms
        tabs.append(df)
    allb = pd.concat(tabs)
    long_ = allb.depolarized_ms >= 15
    print("reading:", D.reading_name(*rd))
    print("  distal depolarization onset (ms after stimulus) by file:",
          {k: round(float(v), 1) for k, v in allb.groupby("file").onset_ms.first().items()})
    print("  dSpikes after >= 15 ms:", int((allb.dspike & long_).sum()), "of", int(allb.dspike.sum()),
          f"({100 * (allb.dspike & long_).sum() / max(1, allb.dspike.sum()):.0f}%)")
    print("  bAPs after < 15 ms that fail:", int((~allb.dspike & ~long_).sum()), "of", int((~long_).sum()),
          f"({100 * (~allb.dspike & ~long_).sum() / max(1, (~long_).sum()):.0f}%)")
    print("  bAPs after >= 15 ms with a dSpike:", int((allb.dspike & long_).sum()), "of", int(long_.sum()))
    print(pd.crosstab([allb.file, long_.rename(">=15ms")], allb.dspike).to_string())
reading: median, k=5, distal >300 um
  distal depolarization onset (ms after stimulus) by file: {'230014': 3.1, '230335': 3.1, '230713': 5.2, '230952': 2.1, '231405': 2.1, '231620': 3.1}
  dSpikes after >= 15 ms: 53 of 111 (48%)
  bAPs after < 15 ms that fail: 455 of 513 (89%)
  bAPs after >= 15 ms with a dSpike: 53 of 207
dspike         False  True 
file   >=15ms              
230014 False      58      0
       True       44     10
230335 False      54      0
       True       44      9
230713 False     106      1
       True        3      7
230952 False       1      7
       True       49     27
231405 False      97     45
       True        8      0
231620 False     139      5
       True        6      0
reading: median, k=5, distal 300-400 um
  distal depolarization onset (ms after stimulus) by file: {'230014': 3.1, '230335': 2.1, '230713': 4.1, '230952': 2.1, '231405': 2.1, '231620': 3.1}
  dSpikes after >= 15 ms: 55 of 120 (46%)
  bAPs after < 15 ms that fail: 437 of 502 (87%)
  bAPs after >= 15 ms with a dSpike: 55 of 218
dspike         False  True 
file   >=15ms              
230014 False      58      0
       True       43     11
230335 False      43      1
       True       53     10
230713 False     105      1
       True        4      7
230952 False       1      7
       True       49     27
231405 False      92     50
       True        8      0
231620 False     138      6
       True        6      0
reading: median, k=4, distal >300 um
  distal depolarization onset (ms after stimulus) by file: {'230014': 3.1, '230335': 3.1, '230713': 5.2, '230952': 2.1, '231405': 2.1, '231620': 3.1}
  dSpikes after >= 15 ms: 54 of 116 (47%)
  bAPs after < 15 ms that fail: 488 of 550 (89%)
  bAPs after >= 15 ms with a dSpike: 54 of 212
dspike         False  True 
file   >=15ms              
230014 False      59      0
       True       44     10
230335 False      56      0
       True       45      9
230713 False     107      1
       True        3      8
230952 False       1      8
       True       52     27
231405 False     111     48
       True        8      0
231620 False     154      5
       True        6      0
reading: median, k=4, distal 300-400 um
  distal depolarization onset (ms after stimulus) by file: {'230014': 3.1, '230335': 2.1, '230713': 4.1, '230952': 2.1, '231405': 2.1, '231620': 3.1}
  dSpikes after >= 15 ms: 56 of 125 (45%)
  bAPs after < 15 ms that fail: 470 of 539 (87%)
  bAPs after >= 15 ms with a dSpike: 56 of 223
dspike         False  True 
file   >=15ms              
230014 False      59      0
       True       43     11
230335 False      45      1
       True       54     10
230713 False     106      1
       True        4      8
230952 False       1      8
       True       52     27
231405 False     106     53
       True        8      0
231620 False     153      6
       True        6      0
reading: butter, k=5, distal >300 um
  distal depolarization onset (ms after stimulus) by file: {'230014': 3.1, '230335': 3.1, '230713': 5.2, '230952': 2.1, '231405': 2.1, '231620': 3.1}
  dSpikes after >= 15 ms: 50 of 108 (46%)
  bAPs after < 15 ms that fail: 437 of 495 (88%)
  bAPs after >= 15 ms with a dSpike: 50 of 203
dspike         False  True 
file   >=15ms              
230014 False      55      0
       True       43     10
230335 False      51      0
       True       45      9
230713 False     103      1
       True        3      7
230952 False       1      8
       True       51     24
231405 False      96     45
       True        7      0
231620 False     131      4
       True        4      0
reading: butter, k=5, distal 300-400 um
  distal depolarization onset (ms after stimulus) by file: {'230014': 3.1, '230335': 2.1, '230713': 4.1, '230952': 2.1, '231405': 2.1, '231620': 3.1}
  dSpikes after >= 15 ms: 52 of 115 (45%)
  bAPs after < 15 ms that fail: 421 of 484 (87%)
  bAPs after >= 15 ms with a dSpike: 52 of 214
dspike         False  True 
file   >=15ms              
230014 False      55      0
       True       42     11
230335 False      40      1
       True       54     10
230713 False     102      1
       True        6      5
230952 False       1      8
       True       49     26
231405 False      93     48
       True        7      0
231620 False     130      5
       True        4      0
reading: butter, k=4, distal >300 um
  distal depolarization onset (ms after stimulus) by file: {'230014': 3.1, '230335': 3.1, '230713': 5.2, '230952': 2.1, '231405': 2.1, '231620': 3.1}
  dSpikes after >= 15 ms: 51 of 113 (45%)
  bAPs after < 15 ms that fail: 484 of 546 (89%)
  bAPs after >= 15 ms with a dSpike: 51 of 208
dspike         False  True 
file   >=15ms              
230014 False      59      0
       True       44     10
230335 False      56      0
       True       45      9
230713 False     107      1
       True        3      7
230952 False       1      8
       True       51     25
231405 False     111     48
       True        8      0
231620 False     150      5
       True        6      0
reading: butter, k=4, distal 300-400 um
  distal depolarization onset (ms after stimulus) by file: {'230014': 3.1, '230335': 2.1, '230713': 4.1, '230952': 2.1, '231405': 2.1, '231620': 3.1}
  dSpikes after >= 15 ms: 53 of 120 (44%)
  bAPs after < 15 ms that fail: 468 of 535 (87%)
  bAPs after >= 15 ms with a dSpike: 53 of 219
dspike         False  True 
file   >=15ms              
230014 False      59      0
       True       43     11
230335 False      45      1
       True       54     10
230713 False     106      1
       True        6      5
230952 False       1      8
       True       49     27
231405 False     108     51
       True        8      0
231620 False     149      6
       True        6      0

Result: not reproduced. The distal region depolarizes 2 to 5 ms after stimulus onset in every file, and only 44 to 48% of dSpikes come after 15 ms or more of distal depolarization (criterion 90%), while 87 to 89% of bAPs that come earlier fail. Of the 58 to 69 dSpikes that come earlier, 45 to 53 are in the D4+soma file, where they fall mostly on the third bAP (46 to 51 on the third and 2 on the second at 4 s.d.; 30 to 35 and 14 to 15 at 5 s.d.); 7 to 8 are in file D4. The onset measure (2 s.d. above the stimulus-triggered baseline) is the claims file's standard choice; a different onset could move these numbers.

fig1-denoising-variance¶

The first principal components of the pixel waveforms hold more than 96% of their variance (the first five, Fig. S7b; the first three, Methods).

PCA of the stimulus-triggered average movie of the Fig. 3a recording (the legend's D2; readings file D4 and file D2), pixel waveforms from 20 frames before to 170 after onset, each pixel's pre-stimulus mean subtracted. Pixels: those of the cell (mean image above its 75th percentile) and, as a variant, all pixels. Trials: all 54, and the first 11 (Fig. S7a legend's number).

In [20]:
def pca_share(movie, mask, pre=20, how="centred"):
    """Share of variance in the first 3 and 5 components of the pixel waveforms. how: 'centred'
    (each pixel's pre-stimulus mean and the across-pixel mean waveform removed), 'baseline' (only
    each pixel's pre-stimulus mean removed, uncentred SVD), 'uncentred' (raw counts, uncentred SVD)."""
    M = movie[:, mask.ravel()].T.astype(np.float64)  # pixels x lags
    if how in ("centred", "baseline"):
        M = M - M[:, :pre].mean(1, keepdims=True)
    if how == "centred":
        M = M - M.mean(0, keepdims=True)
    s = np.linalg.svd(M, compute_uv=False) ** 2
    return s[:3].sum() / s.sum(), s[:5].sum() / s.sum()

rows = []
for key in ["230952", "230335"]:
    o = cells[key]
    on, _ = D.stim_onsets(o["hdr"])
    fr = D.frame_of(o["t"], on)
    h11 = dict(o["hdr"], shape=(int(fr[10] + 170),) + tuple(o["hdr"]["shape"][1:]))
    h11["url"] = D.s3_url(D.asset_for(key))
    _, movie11 = D.extract(h11, D.weights([np.ones(o["mean"].shape, bool)]), sta=(fr[:11], 20, 170))
    for trials, movie in [("54", o["sta_movie"]), ("first 11", movie11)]:
        for pix, mask in [("cell (top 25%)", o["mean"] > np.percentile(o["mean"], 75)), ("all", np.ones(o["mean"].shape, bool))]:
            for how in ("centred", "baseline", "uncentred"):
                s3, s5 = pca_share(movie, mask, how=how)
                rows.append(dict(file=key, label=FILE_LABEL[key], trials=trials, pixels=pix, n_pixels=int(mask.sum()),
                                 preprocessing=how, first3_pct=round(100 * s3, 1), first5_pct=round(100 * s5, 1)))
fig1 = pd.DataFrame(rows)
print(fig1.to_string())
      file label    trials          pixels  n_pixels preprocessing  first3_pct  first5_pct
0   230952    D4        54  cell (top 25%)     41584       centred        21.2        22.2
1   230952    D4        54  cell (top 25%)     41584      baseline        53.6        54.2
2   230952    D4        54  cell (top 25%)     41584     uncentred       100.0       100.0
3   230952    D4        54             all    166336       centred        26.7        27.5
4   230952    D4        54             all    166336      baseline        38.4        39.2
5   230952    D4        54             all    166336     uncentred       100.0       100.0
6   230952    D4  first 11  cell (top 25%)     41584       centred         9.4        10.5
7   230952    D4  first 11  cell (top 25%)     41584      baseline        22.5        23.5
8   230952    D4  first 11  cell (top 25%)     41584     uncentred       100.0       100.0
9   230952    D4  first 11             all    166336       centred        11.1        12.2
10  230952    D4  first 11             all    166336      baseline        15.3        16.4
11  230952    D4  first 11             all    166336     uncentred       100.0       100.0
12  230335    D2        54  cell (top 25%)     41581       centred        22.4        23.4
13  230335    D2        54  cell (top 25%)     41581      baseline        57.2        57.7
14  230335    D2        54  cell (top 25%)     41581     uncentred       100.0       100.0
15  230335    D2        54             all    166336       centred        28.9        29.8
16  230335    D2        54             all    166336      baseline        41.3        42.0
17  230335    D2        54             all    166336     uncentred       100.0       100.0
18  230335    D2  first 11  cell (top 25%)     41581       centred         9.5        10.6
19  230335    D2  first 11  cell (top 25%)     41581      baseline        23.3        24.2
20  230335    D2  first 11  cell (top 25%)     41581     uncentred       100.0       100.0
21  230335    D2  first 11             all    166336       centred        11.3        12.3
22  230335    D2  first 11             all    166336      baseline        15.6        16.6
23  230335    D2  first 11             all    166336     uncentred       100.0       100.0

Result: blocked (methods underspecified). The share depends entirely on how the pixel waveforms are prepared, which the paper does not say. With each pixel's pre-stimulus mean and the across-pixel mean waveform removed (centred), the first five components hold 22 to 30% of the variance over 54 trials and 10 to 12% over the first 11; with only each pixel's baseline removed (uncentred SVD), 39 to 58% and 16 to 24%; on raw counts (uncentred SVD of the waveforms with their resting fluorescence), 100.0% in every case, because the first component is the resting image. The bound (86.4%) is met only by the raw-count reading, which measures the resting brightness of the pixels, not their voltage waveforms. The readings give opposite outcomes and the paper gives no basis to choose one.

Other example recordings: dSpike calls¶

For the step, wide-field and drug examples the bAPs are the somatic spikes within each stimulus epoch, and dSpikes are called as above (both filters; somatic threshold 5 or 4 robust s.d.; distal region beyond 300 µm on the traced line, or 300 to 400 µm).

In [21]:
def seq(df, n=None):
    out = {}
    for tr, g in df.groupby("trial"):
        s = "".join("D" if x else "F" for x in g.sort_values("order").dspike)
        out[tr] = s[:n] if n else s
    return out

ocalls = {}
for key in ["180146", "174900", "001459", "181900", "184232", "185419", "145100", "152954", "154649"]:
    o = cells[key]
    on, off = D.stim_onsets(o["hdr"])
    dur = float(np.median(off - on))
    for rd in D.READINGS:
        ocalls[(key,) + rd] = D.calls(o, on, *rd, window_s=(0.0, dur))
rows = []
for (key, r, k, hi), df in ocalls.items():
    rows.append(dict(file=key, experiment=cells[key]["hdr"]["experiment"], reading=D.reading_name(r, k, hi),
                     epochs=df.trial.nunique(), bAPs=len(df), dSpikes=int(df.dspike.sum()),
                     threshold=round(df.attrs["dspike_threshold"] * 100, 3),
                     trough_found=bool(np.isfinite(df.attrs["dspike_threshold"])),
                     n_above_trough=D.trough_support(df.distal.values, df.attrs["dspike_threshold"])[1],
                     bump_above_trough=round(D.trough_support(df.distal.values, df.attrs["dspike_threshold"])[0], 3),
                     above_thr_but_fwhm_ge_5ms=int(((df.distal > df.attrs["dspike_threshold"]) & (df.fwhm_ms >= 5)).sum()),
                     distal_max=round(df.distal.max() * 100, 3) if len(df) else np.nan))
print(pd.DataFrame(rows).to_string())
print("trough_found: whether the amplitude density has a minimum above its failure mode (D.first_min_threshold). Where it is")
print("False the density falls monotonically from the failure mode, no threshold separates dSpikes from failures, and the")
print("dSpike count of that reading is undefined (shown as 0 above, and read as undefined in the conclusions).")
print("n_above_trough: amplitudes above the trough; bump_above_trough: the highest density peak above the trough as a fraction")
print("of the highest peak. A trough with few amplitudes and a low bump beyond it rests on a few outlying amplitudes.")
fig, axes = plt.subplots(1, 4, figsize=(13, 2.6))
for ax, key in zip(axes, ["174900", "001459", "181900", "184232"]):
    df = ocalls[(key, "median", 5.0, np.inf)]
    x = df.distal.values * 100
    ax.hist(x, 40, density=True, color="0.7")
    if len(x) > 4 and np.ptp(x) > 0:
        g = np.linspace(x.min(), x.max(), 300)
        ax.plot(g, stats.gaussian_kde(x)(g), "k")
    thr = df.attrs["dspike_threshold"]
    if np.isfinite(thr):
        ax.axvline(thr * 100, color="r", ls=":")
    ax.set_title(f"{key} (median, k=5, >300 µm)", fontsize=8)
    ax.set_xlabel("distal amplitude (%)")
    print(key, "distal amplitude range (%):", round(float(x.min()), 2) if len(x) else None, "to", round(float(x.max()), 2) if len(x) else None,
          "; threshold:", round(float(thr * 100), 3) if np.isfinite(thr) else "none (no trough)")
plt.tight_layout()
plt.show()
      file                   experiment                         reading  epochs  bAPs  dSpikes  threshold  trough_found  n_above_trough  bump_above_trough  above_thr_but_fwhm_ge_5ms  distal_max
0   180146    branch_adaptation (Fig.4)     median, k=5, distal >300 um       4    53        9      0.835          True               9              0.187                          0       1.434
1   180146    branch_adaptation (Fig.4)  median, k=5, distal 300-400 um       4    53        9      1.347          True               9              0.162                          0       2.582
2   180146    branch_adaptation (Fig.4)     median, k=4, distal >300 um       4    54        9      0.834          True               9              0.186                          0       1.434
3   180146    branch_adaptation (Fig.4)  median, k=4, distal 300-400 um       4    54        9      1.345          True               9              0.160                          0       2.582
4   180146    branch_adaptation (Fig.4)     butter, k=5, distal >300 um       4    53        9      0.797          True               9              0.187                          0       1.327
5   180146    branch_adaptation (Fig.4)  butter, k=5, distal 300-400 um       4    53        8      1.353          True               8              0.137                          0       2.501
6   180146    branch_adaptation (Fig.4)     butter, k=4, distal >300 um       4    53        9      0.797          True               9              0.187                          0       1.327
7   180146    branch_adaptation (Fig.4)  butter, k=4, distal 300-400 um       4    53        8      1.353          True               8              0.137                          0       2.501
8   174900   branch_bifurcation (Fig.4)     median, k=5, distal >300 um       5   118        3      0.729          True               4              0.053                          1       0.980
9   174900   branch_bifurcation (Fig.4)  median, k=5, distal 300-400 um       5   118        1      1.637          True               1              0.017                          0       1.874
10  174900   branch_bifurcation (Fig.4)     median, k=4, distal >300 um       5   160        3      0.733          True               4              0.041                          1       0.980
11  174900   branch_bifurcation (Fig.4)  median, k=4, distal 300-400 um       5   160        2      1.318          True               2              0.015                          0       1.874
12  174900   branch_bifurcation (Fig.4)     butter, k=5, distal >300 um       5    58        0      0.737          True               1              0.035                          1       0.987
13  174900   branch_bifurcation (Fig.4)  butter, k=5, distal 300-400 um       5    58        1      1.010          True               3              0.078                          2       1.341
14  174900   branch_bifurcation (Fig.4)     butter, k=4, distal >300 um       5   123        2      0.790          True               3              0.036                          1       1.139
15  174900   branch_bifurcation (Fig.4)  butter, k=4, distal 300-400 um       5   123        3      1.024          True               6              0.059                          3       2.049
16  001459   period_doubling (Fig. S15)     median, k=5, distal >300 um      20   114        0        NaN         False               0                NaN                          0       0.569
17  001459   period_doubling (Fig. S15)  median, k=5, distal 300-400 um      20   114        5      0.971          True               5              0.106                          0       1.135
18  001459   period_doubling (Fig. S15)     median, k=4, distal >300 um      20   132        0        NaN         False               0                NaN                          0       0.569
19  001459   period_doubling (Fig. S15)  median, k=4, distal 300-400 um      20   132        6      0.952          True               6              0.085                          0       1.135
20  001459   period_doubling (Fig. S15)     butter, k=5, distal >300 um      20    71        0        NaN         False               0                NaN                          0       0.517
21  001459   period_doubling (Fig. S15)  butter, k=5, distal 300-400 um      20    71        3      0.927          True               3              0.070                          0       1.126
22  001459   period_doubling (Fig. S15)     butter, k=4, distal >300 um      20   119        0        NaN         False               0                NaN                          0       0.543
23  001459   period_doubling (Fig. S15)  butter, k=4, distal 300-400 um      20   119        0        NaN         False               0                NaN                          0       1.126
24  181900      baseline_TTX (Fig.S17e)     median, k=5, distal >300 um       4    29        0        NaN         False               0                NaN                          0       1.493
25  181900      baseline_TTX (Fig.S17e)  median, k=5, distal 300-400 um       4    29        0        NaN         False               0                NaN                          0       2.057
26  181900      baseline_TTX (Fig.S17e)     median, k=4, distal >300 um       4    54        0        NaN         False               0                NaN                          0       1.625
27  181900      baseline_TTX (Fig.S17e)  median, k=4, distal 300-400 um       4    54        0        NaN         False               0                NaN                          0       2.616
28  181900      baseline_TTX (Fig.S17e)     butter, k=5, distal >300 um       4    18        6      1.023          True               9              0.892                          3       1.709
29  181900      baseline_TTX (Fig.S17e)  butter, k=5, distal 300-400 um       4    18        2      1.614          True               9              1.000                          7       2.555
30  181900      baseline_TTX (Fig.S17e)     butter, k=4, distal >300 um       4    62       22      0.960          True              36              1.000                         14       1.768
31  181900      baseline_TTX (Fig.S17e)  butter, k=4, distal 300-400 um       4    62        0        NaN         False               0                NaN                          0       2.972
32  184232  after_TTX (100nM; Fig.S17e)     median, k=5, distal >300 um       1     1        0        NaN         False               0                NaN                          0       0.095
33  184232  after_TTX (100nM; Fig.S17e)  median, k=5, distal 300-400 um       1     1        0        NaN         False               0                NaN                          0       0.219
34  184232  after_TTX (100nM; Fig.S17e)     median, k=4, distal >300 um       4    12        0        NaN         False               0                NaN                          0       0.506
35  184232  after_TTX (100nM; Fig.S17e)  median, k=4, distal 300-400 um       4    12        0        NaN         False               0                NaN                          0       0.787
36  184232  after_TTX (100nM; Fig.S17e)     butter, k=5, distal >300 um       1     1        0        NaN         False               0                NaN                          0       0.107
37  184232  after_TTX (100nM; Fig.S17e)  butter, k=5, distal 300-400 um       1     1        0        NaN         False               0                NaN                          0       0.253
38  184232  after_TTX (100nM; Fig.S17e)     butter, k=4, distal >300 um       3     8        4      0.339          True               4              0.899                          0       0.519
39  184232  after_TTX (100nM; Fig.S17e)  butter, k=4, distal 300-400 um       3     8        0        NaN         False               0                NaN                          0       0.612
40  185419  after_TTX (500nM; Fig.S17e)     median, k=5, distal >300 um       0     0        0        NaN         False               0                NaN                          0         NaN
41  185419  after_TTX (500nM; Fig.S17e)  median, k=5, distal 300-400 um       0     0        0        NaN         False               0                NaN                          0         NaN
42  185419  after_TTX (500nM; Fig.S17e)     median, k=4, distal >300 um       0     0        0        NaN         False               0                NaN                          0         NaN
43  185419  after_TTX (500nM; Fig.S17e)  median, k=4, distal 300-400 um       0     0        0        NaN         False               0                NaN                          0         NaN
44  185419  after_TTX (500nM; Fig.S17e)     butter, k=5, distal >300 um       0     0        0        NaN         False               0                NaN                          0         NaN
45  185419  after_TTX (500nM; Fig.S17e)  butter, k=5, distal 300-400 um       0     0        0        NaN         False               0                NaN                          0         NaN
46  185419  after_TTX (500nM; Fig.S17e)     butter, k=4, distal >300 um       0     0        0        NaN         False               0                NaN                          0         NaN
47  185419  after_TTX (500nM; Fig.S17e)  butter, k=4, distal 300-400 um       0     0        0        NaN         False               0                NaN                          0         NaN
48  145100          baseline (Fig.S18g)     median, k=5, distal >300 um       4    25        3      1.602          True               3              0.137                          0       2.705
49  145100          baseline (Fig.S18g)  median, k=5, distal 300-400 um       4    25        3      2.479          True               3              0.132                          0       4.242
50  145100          baseline (Fig.S18g)     median, k=4, distal >300 um       4    55        3      1.535          True               3              0.059                          0       2.705
51  145100          baseline (Fig.S18g)  median, k=4, distal 300-400 um       4    55        3      2.346          True               3              0.054                          0       4.242
52  145100          baseline (Fig.S18g)     butter, k=5, distal >300 um       4    14        2      1.631          True               2              0.168                          0       2.529
53  145100          baseline (Fig.S18g)  butter, k=5, distal 300-400 um       4    14        2      2.522          True               2              0.166                          0       3.942
54  145100          baseline (Fig.S18g)     butter, k=4, distal >300 um       4    45        4      1.507          True               4              0.103                          0       2.529
55  145100          baseline (Fig.S18g)  butter, k=4, distal 300-400 um       4    45        4      2.276          True               4              0.100                          0       3.942
56  152954        after_Ba2+ (Fig.S18g)     median, k=5, distal >300 um       4    22        1      0.743          True               1              0.083                          0       0.861
57  152954        after_Ba2+ (Fig.S18g)  median, k=5, distal 300-400 um       4    22        0        NaN         False               0                NaN                          0       0.758
58  152954        after_Ba2+ (Fig.S18g)     median, k=4, distal >300 um       4    48        1      0.723          True               1              0.042                          0       0.861
59  152954        after_Ba2+ (Fig.S18g)  median, k=4, distal 300-400 um       4    48        0        NaN         False               0                NaN                          0       0.758
60  152954        after_Ba2+ (Fig.S18g)     butter, k=5, distal >300 um       4     5        0      1.164          True               1              0.275                          1       1.305
61  152954        after_Ba2+ (Fig.S18g)  butter, k=5, distal 300-400 um       4     5        0      1.188          True               1              0.266                          1       1.358
62  152954        after_Ba2+ (Fig.S18g)     butter, k=4, distal >300 um       4    28        0      0.873          True               2              0.059                          2       1.305
63  152954        after_Ba2+ (Fig.S18g)  butter, k=4, distal 300-400 um       4    28        0      1.116          True               2              0.096                          2       1.358
64  154649   after_Ba2+_NiCl (Fig.S18g)     median, k=5, distal >300 um       4    20        0        NaN         False               0                NaN                          0       1.330
65  154649   after_Ba2+_NiCl (Fig.S18g)  median, k=5, distal 300-400 um       4    20        0        NaN         False               0                NaN                          0       1.579
66  154649   after_Ba2+_NiCl (Fig.S18g)     median, k=4, distal >300 um       4    50        0        NaN         False               0                NaN                          0       1.330
67  154649   after_Ba2+_NiCl (Fig.S18g)  median, k=4, distal 300-400 um       4    50        0        NaN         False               0                NaN                          0       1.579
68  154649   after_Ba2+_NiCl (Fig.S18g)     butter, k=5, distal >300 um       4    13        1      1.457          True               1              0.125                          0       1.521
69  154649   after_Ba2+_NiCl (Fig.S18g)  butter, k=5, distal 300-400 um       4    13        0        NaN         False               0                NaN                          0       1.756
70  154649   after_Ba2+_NiCl (Fig.S18g)     butter, k=4, distal >300 um       4    41        0        NaN         False               0                NaN                          0       1.521
71  154649   after_Ba2+_NiCl (Fig.S18g)  butter, k=4, distal 300-400 um       4    41        0        NaN         False               0                NaN                          0       1.756
trough_found: whether the amplitude density has a minimum above its failure mode (D.first_min_threshold). Where it is
False the density falls monotonically from the failure mode, no threshold separates dSpikes from failures, and the
dSpike count of that reading is undefined (shown as 0 above, and read as undefined in the conclusions).
n_above_trough: amplitudes above the trough; bump_above_trough: the highest density peak above the trough as a fraction
of the highest peak. A trough with few amplitudes and a low bump beyond it rests on a few outlying amplitudes.
174900 distal amplitude range (%): 0.02 to 0.98 ; threshold: 0.729
001459 distal amplitude range (%): 0.05 to 0.57 ; threshold: none (no trough)
181900 distal amplitude range (%): 0.11 to 1.49 ; threshold: none (no trough)
184232 distal amplitude range (%): 0.09 to 0.09 ; threshold: none (no trough)
No description has been provided for this image

fig4a-step-example¶

In the Fig. 4a neuron, a step stimulus to a proximal apical dendrite evoked a bAP without a dSpike, then two bAPs with dSpikes, then a series of bAPs without dSpikes.

File of index entry "branch_adaptation (Fig.4a)": four 500 ms steps. Each epoch's sequence of failures (F) and dSpikes (D). Criterion: in at least one epoch the sequence is F, D, D, then only F; the most common sequence is reported.

In [22]:
import re as _re
rows = []
for rd in D.READINGS:
    s = seq(ocalls[("180146",) + rd])
    rows.append(dict(reading=D.reading_name(*rd), sequences=list(s.values()),
                     epochs_FDD_then_F=sum(bool(_re.fullmatch("FDDF*", x)) for x in s.values()),
                     most_common=pd.Series(list(s.values())).value_counts().index[0]))
print(pd.DataFrame(rows).to_string())
                          reading                                                       sequences  epochs_FDD_then_F   most_common
0     median, k=5, distal >300 um   [FDDFFFFFFFFF, FDDDFFFFFFFFFFFF, FDDDDFFFFFFFFFFFFF, FFFFFFF]                  1  FDDFFFFFFFFF
1  median, k=5, distal 300-400 um   [FDDFFFFFFFFF, FDDDFFFFFFFFFFFF, FDDDDFFFFFFFFFFFFF, FFFFFFF]                  1  FDDFFFFFFFFF
2     median, k=4, distal >300 um  [FDDFFFFFFFFF, FDDDFFFFFFFFFFFF, FDDDDFFFFFFFFFFFFF, FFFFFFFF]                  1  FDDFFFFFFFFF
3  median, k=4, distal 300-400 um  [FDDFFFFFFFFF, FDDDFFFFFFFFFFFF, FDDDDFFFFFFFFFFFFF, FFFFFFFF]                  1  FDDFFFFFFFFF
4     butter, k=5, distal >300 um   [FDDFFFFFFFFF, FDDDFFFFFFFFFFFF, FDDDDFFFFFFFFFFFFF, FFFFFFF]                  1  FDDFFFFFFFFF
5  butter, k=5, distal 300-400 um   [FDDFFFFFFFFF, FDFDFFFFFFFFFFFF, FDDDDFFFFFFFFFFFFF, FFFFFFF]                  1  FDDFFFFFFFFF
6     butter, k=4, distal >300 um   [FDDFFFFFFFFF, FDDDFFFFFFFFFFFF, FDDDDFFFFFFFFFFFFF, FFFFFFF]                  1  FDDFFFFFFFFF
7  butter, k=4, distal 300-400 um   [FDDFFFFFFFFF, FDFDFFFFFFFFFFFF, FDDDDFFFFFFFFFFFFF, FFFFFFF]                  1  FDDFFFFFFFFF

Result: reproduced. In all eight readings one of the four step epochs reads failure, dSpike, dSpike, then only failures (FDDFFFFFFFFF), and that is the most common sequence; two other epochs have three or four dSpikes after the first failure and one has none.

fig4d-example-alternation¶

In the Fig. 4c-d neuron, the first 12 bAPs under wide-field stimulation showed two bAP failures followed by alternating dSpikes and failures.

File of index entry "branch_bifurcation (Fig.4c,d)": five 600 ms wide-field epochs. Criterion: the first 12 bAPs read F, F, then D and F alternating, in at least one epoch.

In [23]:
target = "FF" + "DF" * 5
rows = []
for rd in D.READINGS:
    s = seq(ocalls[("174900",) + rd], 12)
    best = max(s.values(), key=lambda x: sum(a == b for a, b in zip(x, target)))
    rows.append(dict(reading=D.reading_name(*rd), first12=list(s.values()), epochs_matching=sum(x == target for x in s.values()),
                     best_positions_matching=f"{sum(a == b for a, b in zip(best, target))}/12"))
print(pd.DataFrame(rows).to_string())
df = ocalls[("174900", "median", 5.0, np.inf)]
print("bAPs per epoch:", df.groupby("trial").size().tolist(), "; last dSpike (ms after onset) per epoch:",
      df[df.dspike].groupby("trial").t_ms.max().round(0).tolist())
                          reading                                                                 first12  epochs_matching best_positions_matching
0     median, k=5, distal >300 um  [FFDFFFFFFFFF, FFDFFFFFFFFF, FDFFFFFFFFFF, FFFFFFFFFFFF, FFFFFFFFFFFF]                0                    8/12
1  median, k=5, distal 300-400 um  [FFFFFFFFFFFF, FFDFFFFFFFFF, FFFFFFFFFFFF, FFFFFFFFFFFF, FFFFFFFFFFFF]                0                    8/12
2     median, k=4, distal >300 um  [FFDFFFFFFFFF, FFDFFFFFFFFF, FDFFFFFFFFFF, FFFFFFFFFFFF, FFFFFFFFFFFF]                0                    8/12
3  median, k=4, distal 300-400 um  [FFDFFFFFFFFF, FFDFFFFFFFFF, FFFFFFFFFFFF, FFFFFFFFFFFF, FFFFFFFFFFFF]                0                    8/12
4     butter, k=5, distal >300 um                    [FFFFFFFFFFFF, FFFFFFFFFFFF, FFFFFFFF, FFFFFF, FFFF]                0                    7/12
5  butter, k=5, distal 300-400 um                    [FFFFFFFFFFFF, FFFFFFFFFFFF, FFFFFFFF, FFFFFF, FFFF]                0                    7/12
6     butter, k=4, distal >300 um  [FFFFFFFFFFFF, FDFFFFFFFFFF, FFDFFFFFFFFF, FFFFFFFFFFFF, FFFFFFFFFFFF]                0                    8/12
7  butter, k=4, distal 300-400 um  [FFFFFFFFFFFF, FDFFFFFFFFFF, FFDFFFFFFFFF, FFFFFFFFFFFF, FFFFFFFFFFFF]                0                    8/12
bAPs per epoch: [33, 30, 23, 18, 14] ; last dSpike (ms after onset) per epoch: [18.0, 16.0, 14.0]

Result: not reproduced. Only 0 to 3 bAPs of the 58 to 160 in the five wide-field epochs carry a dSpike, so no epoch shows the alternation; the best epoch matches the target sequence at 7 (Butterworth, 5 s.d.) or 8 of 12 positions, mostly through its failures. dSpikes here are called with the same rule as elsewhere; the outputs do not show whether the alternation of Fig. 4d is missed by the rule or absent.

figs15-stochastic¶

Even stronger wide-field stimuli evoked an epoch of seemingly random interplay of bAPs and dSpikes, varying from trial to trial while somatic spiking stayed regular, followed by sustained dSpike failures.

File of index entry "period_doubling (Fig. S15)": twenty 100 ms stimuli at 5 Hz, each taken as a trial. Criterion: the dSpike sequence differs between at least two trials, somatic spike times stay within 2 ms of each other across trials for the same bAP position, and later bAPs fail.

In [24]:
rows = []
for rd in D.READINGS:
    df = ocalls[("001459",) + rd]
    s = seq(df)
    sp = df.pivot_table(index="trial", columns="order", values="t_ms")
    n_all = sp.columns[sp.notna().all()]
    spread = (sp[n_all].max() - sp[n_all].min()).round(1)
    last = df.groupby("trial").order.transform("max") == df.order
    # Variant (Fig. S15 legend, "The spike train in the soma was regular"): regularity within each
    # trial's train, the coefficient of variation of its somatic inter-spike intervals
    cv = df.sort_values("t_ms").groupby("trial").t_ms.apply(lambda x: np.diff(x.values).std() / np.diff(x.values).mean()
                                                          if len(x) > 2 else np.nan)
    rows.append(dict(reading=D.reading_name(*rd), distinct_sequences=len(set(s.values())), sequences=list(s.values())[:20],
                     bAPs_per_trial=df.groupby("trial").size().value_counts().sort_index().to_dict(),
                     spike_time_range_ms_by_position=spread.tolist(), sd_ms=sp[n_all].std().round(2).tolist(),
                     isi_cv_median=round(float(cv.median()), 2), isi_cv_range=[round(float(cv.min()), 2), round(float(cv.max()), 2)],
                     last_bAP_fails=f"{int((~df[last].dspike).sum())}/{int(last.sum())}"))
print(pd.DataFrame(rows).to_string())
h = cells["001459"]["hdr"]
ch = h["daq"]["mod488"]
on, off = D.stim_onsets(h)
tt = ch["t0"] + np.arange(len(ch["x"])) / ch["rate"]
drive = np.array([ch["x"][(tt >= a) & (tt < b)].mean() for a, b in zip(on, off)])
print("488 nm modulation per stimulus (mean DAQ value during the stimulus, V):", np.round(drive, 3).tolist())
print(f"  range {drive.min():.3f} to {drive.max():.3f}; s.d. over mean {drive.std() / drive.mean():.3f};"
      f" stimulus durations {np.round((off - on) * 1000, 1).tolist()} ms")
                          reading  distinct_sequences                                                                                                                                                                     sequences                        bAPs_per_trial spike_time_range_ms_by_position                            sd_ms  isi_cv_median  isi_cv_range last_bAP_fails
0     median, k=5, distal >300 um                   6                    [FFFFFFFFF, FFFFFFF, FFFF, FFFFF, FFFFFFF, FFFFFFF, FFFFFF, FFFFFFF, FFFFFFF, FFFFFF, FFFFFF, FFFF, FFFFF, FFFFF, FFFF, FFF, FFFFF, FFFFF, FFFFFF, FFFFFF]  {3: 1, 4: 3, 5: 5, 6: 5, 7: 5, 9: 1}              [38.8, 51.9, 64.2]             [8.19, 14.47, 17.05]           0.30   [0.0, 0.58]          20/20
1  median, k=5, distal 300-400 um                   8                    [DFDFFFFDF, FFFFFFF, FDFF, FFFFF, FFFFFFF, FFFFFFF, FFFFFF, FFFFFFF, FFFFFFF, FFFFFF, FFFFFF, FFFF, FFFFF, FFFFF, FFFF, FFF, FFFFF, FFDFF, FFFFFF, FFFFFF]  {3: 1, 4: 3, 5: 5, 6: 5, 7: 5, 9: 1}              [38.8, 51.9, 64.2]             [8.19, 14.47, 17.05]           0.30   [0.0, 0.58]          20/20
2     median, k=4, distal >300 um                   5  [FFFFFFFFF, FFFFFFFF, FFFFFF, FFFFFFF, FFFFFFF, FFFFFFF, FFFFFFF, FFFFFFF, FFFFFFF, FFFFFFF, FFFFFFF, FFFFFF, FFFFF, FFFFFF, FFFFFF, FFFFF, FFFFFF, FFFFFF, FFFFFFF, FFFFFF]        {5: 2, 6: 7, 7: 9, 8: 1, 9: 1}  [13.8, 20.2, 26.1, 34.4, 43.2]  [2.82, 5.53, 7.25, 9.39, 11.78]           0.32  [0.13, 0.48]          20/20
3  median, k=4, distal 300-400 um                   7  [DFDFFFFDF, FFFFFFFF, FFFDFF, FFFFFFF, FFFFFFF, FFFFFFF, FFFFFFF, FFFFFFF, FFFFFFF, FFFFFFF, FFFFFFF, FFFFFF, FFFFF, FFFFFF, FFFFFF, FFFFF, FFFFDF, FFFDFF, FFFFFFF, FFFFFF]        {5: 2, 6: 7, 7: 9, 8: 1, 9: 1}  [13.8, 20.2, 26.1, 34.4, 43.2]  [2.82, 5.53, 7.25, 9.39, 11.78]           0.32  [0.13, 0.48]          20/20
4     butter, k=5, distal >300 um                   5                                                               [FFFFFF, FFFFF, FF, FFFF, FFF, FFFFFF, FFFF, FFF, FFFFFF, FFF, FF, FF, FFFFF, FF, FFF, FF, FF, FFFF, FFFF, FFF]        {2: 6, 3: 5, 4: 4, 5: 2, 6: 3}                    [73.8, 85.1]                   [19.82, 24.29]           0.34   [0.0, 0.72]          20/20
5  butter, k=5, distal 300-400 um                   7                                                               [DFDFFF, FFFFF, FF, FFFF, FFF, FFFFFF, FFFF, FFF, FFFFFF, FFF, FF, FF, FFFFF, FF, FFF, FF, FF, FDFF, FFFF, FFF]        {2: 6, 3: 5, 4: 4, 5: 2, 6: 3}                    [73.8, 85.1]                   [19.82, 24.29]           0.34   [0.0, 0.72]          20/20
6     butter, k=4, distal >300 um                   5               [FFFFFFFFF, FFFFFFF, FFFFF, FFFFF, FFFFFFF, FFFFFFF, FFFFFF, FFFFFFF, FFFFFFF, FFFFFFF, FFFFFF, FFFFF, FFFFF, FFFFF, FFFFFF, FFF, FFFFF, FFFFFF, FFFFF, FFFFFF]        {3: 1, 5: 7, 6: 5, 7: 6, 9: 1}              [13.8, 51.9, 64.2]             [2.78, 11.88, 14.77]           0.29  [0.17, 0.37]          20/20
7  butter, k=4, distal 300-400 um                   5               [FFFFFFFFF, FFFFFFF, FFFFF, FFFFF, FFFFFFF, FFFFFFF, FFFFFF, FFFFFFF, FFFFFFF, FFFFFFF, FFFFFF, FFFFF, FFFFF, FFFFF, FFFFFF, FFF, FFFFF, FFFFFF, FFFFF, FFFFFF]        {3: 1, 5: 7, 6: 5, 7: 6, 9: 1}              [13.8, 51.9, 64.2]             [2.78, 11.88, 14.77]           0.29  [0.17, 0.37]          20/20
488 nm modulation per stimulus (mean DAQ value during the stimulus, V): [0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224, 0.20000000298023224]
  range 0.200 to 0.200; s.d. over mean 0.000; stimulus durations [100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0] ms

Result: not reproduced. The 488 nm drive is the same in all twenty stimuli (0.200 V, 100 ms each), so they are repeats. Somatic spike times at the same bAP position span 14 to 85 ms across trials (s.d. 2.8 to 24 ms), not within 2 ms as the criterion asks, and the number of bAPs per trial varies (2 to 9). The number of somatic spikes found also depends strongly on the reading (71 to 132 bAPs in all), so part of this spread may come from missed or extra spikes that shift the positions. Beyond 300 µm the distal amplitudes have no density trough in any reading (no dSpike threshold); between 300 and 400 µm, 3 to 6 dSpikes are found in three readings, giving 7 or 8 distinct sequences, and every trial ends in failures. The Fig. S15 legend may mean regularity within a train ("The spike train in the soma was regular"); that reading is asked of a reader in questions/001266.yaml. As a variant, the coefficient of variation of the somatic inter-spike intervals within a trial has a median of 0.29 to 0.34 over trials (range 0 to 0.72); the paper gives no bound for "regular", so this variant does not decide the claim.

figs17e-ttx-high-dose¶

At 100 nM, TTX eliminated distal dSpikes while somatic spiking continued.

Files of index entries "baseline_TTX (Fig.S17e)" and "after_TTX (100nM; Fig.S17e)" (and 500 nM), four 1 s ramps each. dSpikes are called with each recording's own trough, and, as a variant, with the baseline's threshold applied to the TTX recordings (same cell and region). Criterion: the 100 nM recording has somatic spikes and no distal dSpike; the baseline has dSpikes.

In [25]:
rows = []
for rd in D.READINGS:
    base = ocalls[("181900",) + rd]
    for key in ["181900", "184232", "185419"]:
        o = cells[key]
        on, off = D.stim_onsets(o["hdr"])
        own = ocalls[(key,) + rd]
        fixed = D.calls(o, on, *rd, window_s=(0.0, float(np.median(off - on))), threshold=base.attrs["dspike_threshold"])
        rows.append(dict(file=key, experiment=o["hdr"]["experiment"], reading=D.reading_name(*rd), bAPs=len(own),
                         dS_own_threshold=int(own.dspike.sum()), dS_baseline_threshold=int(fixed.dspike.sum()),
                         own_thr=round(own.attrs["dspike_threshold"] * 100, 3), base_thr=round(base.attrs["dspike_threshold"] * 100, 3),
                         max_distal=round(own.distal.max() * 100, 3)))
print(pd.DataFrame(rows).to_string())
      file                   experiment                         reading  bAPs  dS_own_threshold  dS_baseline_threshold  own_thr  base_thr  max_distal
0   181900      baseline_TTX (Fig.S17e)     median, k=5, distal >300 um    29                 0                      0      NaN       NaN       1.493
1   184232  after_TTX (100nM; Fig.S17e)     median, k=5, distal >300 um     1                 0                      0      NaN       NaN       0.095
2   185419  after_TTX (500nM; Fig.S17e)     median, k=5, distal >300 um     0                 0                      0      NaN       NaN         NaN
3   181900      baseline_TTX (Fig.S17e)  median, k=5, distal 300-400 um    29                 0                      0      NaN       NaN       2.057
4   184232  after_TTX (100nM; Fig.S17e)  median, k=5, distal 300-400 um     1                 0                      0      NaN       NaN       0.219
5   185419  after_TTX (500nM; Fig.S17e)  median, k=5, distal 300-400 um     0                 0                      0      NaN       NaN         NaN
6   181900      baseline_TTX (Fig.S17e)     median, k=4, distal >300 um    54                 0                      0      NaN       NaN       1.625
7   184232  after_TTX (100nM; Fig.S17e)     median, k=4, distal >300 um    12                 0                      0      NaN       NaN       0.506
8   185419  after_TTX (500nM; Fig.S17e)     median, k=4, distal >300 um     0                 0                      0      NaN       NaN         NaN
9   181900      baseline_TTX (Fig.S17e)  median, k=4, distal 300-400 um    54                 0                      0      NaN       NaN       2.616
10  184232  after_TTX (100nM; Fig.S17e)  median, k=4, distal 300-400 um    12                 0                      0      NaN       NaN       0.787
11  185419  after_TTX (500nM; Fig.S17e)  median, k=4, distal 300-400 um     0                 0                      0      NaN       NaN         NaN
12  181900      baseline_TTX (Fig.S17e)     butter, k=5, distal >300 um    18                 6                      6    1.023     1.023       1.709
13  184232  after_TTX (100nM; Fig.S17e)     butter, k=5, distal >300 um     1                 0                      0      NaN     1.023       0.107
14  185419  after_TTX (500nM; Fig.S17e)     butter, k=5, distal >300 um     0                 0                      0      NaN     1.023         NaN
15  181900      baseline_TTX (Fig.S17e)  butter, k=5, distal 300-400 um    18                 2                      2    1.614     1.614       2.555
16  184232  after_TTX (100nM; Fig.S17e)  butter, k=5, distal 300-400 um     1                 0                      0      NaN     1.614       0.253
17  185419  after_TTX (500nM; Fig.S17e)  butter, k=5, distal 300-400 um     0                 0                      0      NaN     1.614         NaN
18  181900      baseline_TTX (Fig.S17e)     butter, k=4, distal >300 um    62                22                     22    0.960     0.960       1.768
19  184232  after_TTX (100nM; Fig.S17e)     butter, k=4, distal >300 um     8                 4                      0    0.339     0.960       0.519
20  185419  after_TTX (500nM; Fig.S17e)     butter, k=4, distal >300 um     0                 0                      0      NaN     0.960         NaN
21  181900      baseline_TTX (Fig.S17e)  butter, k=4, distal 300-400 um    62                 0                      0      NaN       NaN       2.972
22  184232  after_TTX (100nM; Fig.S17e)  butter, k=4, distal 300-400 um     8                 0                      0      NaN       NaN       0.612
23  185419  after_TTX (500nM; Fig.S17e)  butter, k=4, distal 300-400 um     0                 0                      0      NaN       NaN         NaN

Result: blocked (methods underspecified). The filter readings differ on whether the baseline's dSpikes can be counted at all. With the median filter, and with the Butterworth filter at 4 s.d. between 300 and 400 µm, the baseline's distal amplitudes have no density trough, so the dSpike count is undefined (5 of 8 readings). In the other 3 readings (Butterworth) the baseline has 6, 2 and 22 dSpikes, and the 100 nM recording has somatic spikes (1, 1 and 8 bAPs) and no dSpike under the baseline's threshold, as the claim says. Under its own threshold, the 100 nM file has 4 dSpikes in the Butterworth reading at 4 s.d. beyond 300 µm (threshold 0.34%, below the baseline's 0.96%). Under every reading somatic bAPs fall from 18 to 62 to 1 to 12 at 100 nM and the largest distal amplitude from 1.5 to 3.0% to 0.1 to 0.8%; at 500 nM no somatic spike is found. The somatic counts themselves vary threefold with the reading (18 to 62 at baseline).

figs18g-ba-increases-calcium-spikes¶

Adding Ba2+ (150 µM) increased the incidence of putative dendritic Ca2+ spikes under soma-targeted ramp stimulation.

Files of index entries "baseline (Fig.S18g)", "after_Ba2+ (Fig.S18g)" and "after_Ba2+_NiCl (Fig.S18g)", four 500 ms stimuli each. Putative Ca2+ spikes are distal depolarizations lasting more than 20 ms (Fig. S18f legend). The distal trace (beyond 300 µm, or 300 to 400 µm) minus a 151 ms moving median is searched for peaks above the file's dSpike threshold; readings of duration (a) FWHM, (b) time above the dSpike threshold. Counts per stimulus, mean over the four. Criterion: more after Ba2+ than at baseline, fewer again after Ni2+.

In [26]:
from scipy import ndimage, signal

def ca_spikes(key, rd, how, thr=None):
    o = cells[key]
    on, off = D.stim_onsets(o["hdr"])
    thr = ocalls[(key,) + rd].attrs["dspike_threshold"] if thr is None else thr
    if not np.isfinite(thr):
        return [np.nan] * len(on)
    Y = D.bleach_correct(o["X"], o["t"])
    yd, _ = D.distal_trace(Y, o["dist"], 300, rd[2])
    k = int(0.151 * o["fs"]) | 1
    z = yd - ndimage.median_filter(yd, size=k, mode="nearest")
    z = ndimage.uniform_filter1d(z, 3)
    counts = []
    for s, e in zip(on, off):
        i0, i1 = np.searchsorted(o["t"], [s, e + 0.1])
        pk, _ = signal.find_peaks(z[i0:i1], height=thr, distance=int(0.02 * o["fs"]))
        n = 0
        for p in pk:
            if how == "fwhm":
                w = D.fwhm_ms(z[i0:i1], p, o["fs"], max_ms=200)
            else:
                lo = p
                while lo > 0 and z[i0 + lo] > thr:
                    lo -= 1
                hi = p
                while i0 + hi < len(z) - 1 and z[i0 + hi] > thr:
                    hi += 1
                w = (hi - lo) / o["fs"] * 1000
            n += w > 20
        counts.append(n)
    return counts

rows = []
for rd in D.READINGS:
    for how in ("fwhm", "above threshold"):
        c = {key: ca_spikes(key, rd, how) for key in ["145100", "152954", "154649"]}
        m = {key: np.mean(v) for key, v in c.items()}
        rows.append(dict(reading=D.reading_name(*rd), duration=how, baseline=c["145100"], Ba=c["152954"], Ba_Ni=c["154649"],
                         means=[round(v, 2) for v in m.values()],
                         Ba_above_baseline=m["152954"] > m["145100"], Ni_below_Ba=m["154649"] < m["152954"]))
print(pd.DataFrame(rows).to_string())
# One threshold for the three files of the cell: the baseline's, or the Ba2+ file's (as the TTX
# claim uses the baseline's for its drug files).
rows = []
for rd in D.READINGS:
    for src in ("145100", "152954"):
        thr = ocalls[(src,) + rd].attrs["dspike_threshold"]
        for how in ("fwhm", "above threshold"):
            c = {key: ca_spikes(key, rd, how, thr) for key in ["145100", "152954", "154649"]}
            m = {key: np.mean(v) for key, v in c.items()}
            rows.append(dict(reading=D.reading_name(*rd), shared_threshold_of=src, thr_pct=round(thr * 100, 3), duration=how,
                             means=[round(v, 2) for v in m.values()],
                             Ba_above_baseline=m["152954"] > m["145100"], Ni_below_Ba=m["154649"] < m["152954"]))
shared = pd.DataFrame(rows)
print(shared.to_string())
print("readings with a shared threshold where both comparisons hold:", int((shared.Ba_above_baseline & shared.Ni_below_Ba).sum()), "of", len(shared),
      "; with the threshold undefined:", int(shared.thr_pct.isna().sum()))
                           reading         duration      baseline                    Ba                 Ba_Ni             means  Ba_above_baseline  Ni_below_Ba
0      median, k=5, distal >300 um             fwhm  [0, 0, 0, 0]          [2, 0, 0, 6]  [nan, nan, nan, nan]   [0.0, 2.0, nan]               True        False
1      median, k=5, distal >300 um  above threshold  [0, 0, 0, 0]          [3, 3, 1, 8]  [nan, nan, nan, nan]  [0.0, 3.75, nan]               True        False
2   median, k=5, distal 300-400 um             fwhm  [0, 0, 0, 0]  [nan, nan, nan, nan]  [nan, nan, nan, nan]   [0.0, nan, nan]              False        False
3   median, k=5, distal 300-400 um  above threshold  [0, 0, 0, 0]  [nan, nan, nan, nan]  [nan, nan, nan, nan]   [0.0, nan, nan]              False        False
4      median, k=4, distal >300 um             fwhm  [0, 0, 0, 0]          [2, 0, 0, 6]  [nan, nan, nan, nan]   [0.0, 2.0, nan]               True        False
5      median, k=4, distal >300 um  above threshold  [0, 0, 0, 0]          [3, 3, 1, 8]  [nan, nan, nan, nan]  [0.0, 3.75, nan]               True        False
6   median, k=4, distal 300-400 um             fwhm  [0, 0, 0, 0]  [nan, nan, nan, nan]  [nan, nan, nan, nan]   [0.0, nan, nan]              False        False
7   median, k=4, distal 300-400 um  above threshold  [0, 0, 0, 0]  [nan, nan, nan, nan]  [nan, nan, nan, nan]   [0.0, nan, nan]              False        False
8      butter, k=5, distal >300 um             fwhm  [0, 0, 0, 0]          [2, 0, 0, 6]          [0, 0, 0, 0]   [0.0, 2.0, 0.0]               True         True
9      butter, k=5, distal >300 um  above threshold  [0, 0, 0, 0]          [2, 0, 0, 8]          [0, 0, 0, 0]   [0.0, 2.5, 0.0]               True         True
10  butter, k=5, distal 300-400 um             fwhm  [0, 0, 0, 0]          [3, 0, 0, 8]  [nan, nan, nan, nan]  [0.0, 2.75, nan]               True        False
11  butter, k=5, distal 300-400 um  above threshold  [0, 0, 0, 0]          [4, 2, 0, 9]  [nan, nan, nan, nan]  [0.0, 3.75, nan]               True        False
12     butter, k=4, distal >300 um             fwhm  [0, 0, 0, 0]          [2, 0, 0, 6]  [nan, nan, nan, nan]   [0.0, 2.0, nan]               True        False
13     butter, k=4, distal >300 um  above threshold  [0, 0, 0, 0]          [3, 2, 1, 8]  [nan, nan, nan, nan]   [0.0, 3.5, nan]               True        False
14  butter, k=4, distal 300-400 um             fwhm  [0, 0, 0, 0]          [3, 0, 0, 8]  [nan, nan, nan, nan]  [0.0, 2.75, nan]               True        False
15  butter, k=4, distal 300-400 um  above threshold  [0, 0, 0, 0]          [4, 2, 0, 9]  [nan, nan, nan, nan]  [0.0, 3.75, nan]               True        False
                           reading shared_threshold_of  thr_pct         duration             means  Ba_above_baseline  Ni_below_Ba
0      median, k=5, distal >300 um              145100    1.602             fwhm   [0.0, 2.0, 0.0]               True         True
1      median, k=5, distal >300 um              145100    1.602  above threshold  [0.0, 1.75, 0.0]               True         True
2      median, k=5, distal >300 um              152954    0.743             fwhm   [0.0, 2.0, 0.0]               True         True
3      median, k=5, distal >300 um              152954    0.743  above threshold  [0.0, 3.75, 0.0]               True         True
4   median, k=5, distal 300-400 um              145100    2.479             fwhm   [0.0, 2.5, 0.0]               True         True
5   median, k=5, distal 300-400 um              145100    2.479  above threshold  [0.0, 1.25, 0.0]               True         True
6   median, k=5, distal 300-400 um              152954      NaN             fwhm   [nan, nan, nan]              False        False
7   median, k=5, distal 300-400 um              152954      NaN  above threshold   [nan, nan, nan]              False        False
8      median, k=4, distal >300 um              145100    1.535             fwhm   [0.0, 2.0, 0.0]               True         True
9      median, k=4, distal >300 um              145100    1.535  above threshold  [0.0, 1.75, 0.0]               True         True
10     median, k=4, distal >300 um              152954    0.723             fwhm   [0.0, 2.0, 0.0]               True         True
11     median, k=4, distal >300 um              152954    0.723  above threshold  [0.0, 3.75, 0.0]               True         True
12  median, k=4, distal 300-400 um              145100    2.346             fwhm   [0.0, 2.5, 0.0]               True         True
13  median, k=4, distal 300-400 um              145100    2.346  above threshold   [0.0, 1.5, 0.0]               True         True
14  median, k=4, distal 300-400 um              152954      NaN             fwhm   [nan, nan, nan]              False        False
15  median, k=4, distal 300-400 um              152954      NaN  above threshold   [nan, nan, nan]              False        False
16     butter, k=5, distal >300 um              145100    1.631             fwhm   [0.0, 2.0, 0.0]               True         True
17     butter, k=5, distal >300 um              145100    1.631  above threshold  [0.0, 1.75, 0.0]               True         True
18     butter, k=5, distal >300 um              152954    1.164             fwhm   [0.0, 2.0, 0.0]               True         True
19     butter, k=5, distal >300 um              152954    1.164  above threshold   [0.0, 2.5, 0.0]               True         True
20  butter, k=5, distal 300-400 um              145100    2.522             fwhm  [0.0, 2.25, 0.0]               True         True
21  butter, k=5, distal 300-400 um              145100    2.522  above threshold   [0.0, 1.0, 0.0]               True         True
22  butter, k=5, distal 300-400 um              152954    1.188             fwhm  [0.0, 2.75, 0.0]               True         True
23  butter, k=5, distal 300-400 um              152954    1.188  above threshold  [0.0, 3.75, 0.0]               True         True
24     butter, k=4, distal >300 um              145100    1.507             fwhm   [0.0, 2.0, 0.0]               True         True
25     butter, k=4, distal >300 um              145100    1.507  above threshold  [0.0, 1.75, 0.0]               True         True
26     butter, k=4, distal >300 um              152954    0.873             fwhm   [0.0, 2.0, 0.0]               True         True
27     butter, k=4, distal >300 um              152954    0.873  above threshold   [0.0, 3.5, 0.0]               True         True
28  butter, k=4, distal 300-400 um              145100    2.276             fwhm   [0.0, 2.5, 0.0]               True         True
29  butter, k=4, distal 300-400 um              145100    2.276  above threshold   [0.0, 1.5, 0.0]               True         True
30  butter, k=4, distal 300-400 um              152954    1.116             fwhm  [0.0, 2.75, 0.0]               True         True
31  butter, k=4, distal 300-400 um              152954    1.116  above threshold  [0.0, 3.75, 0.0]               True         True
readings with a shared threshold where both comparisons hold: 28 of 32 ; with the threshold undefined: 4

Result: reproduced. With one threshold for the three files of the cell, the baseline's (defined in all 8 readings), every reading and both duration readings give no putative Ca2+ spike at baseline, 1.0 to 2.5 per stimulus after Ba2+, and none after Ba2+ with Ni2+ (16 of 16). With the Ba2+ file's threshold the same holds in all 12 cases where it is defined (4 undefined), so 28 of the 32 shared-threshold cases hold and none fails. With each file's own threshold, the Ni2+ file has no trough in 7 of 8 readings and the Ba2+ file in 2, so that comparison is defined in one reading only (Butterworth, 5 s.d., beyond 300 µm), where it holds (0, 2.0 or 2.5, 0).

Plateau recordings¶

Each 4 s plateau file holds three epochs, one trial each: optogenetic stimulation of the soma alone (30 ms, or 10 ms in the Fig. 5c bottom series), the optogenetic stimulus with EFS (combined), and EFS alone. The epochs are read from the 488 nm and EFS channels. The distal trace is the traced trunk beyond 200 µm (Fig. 5c legend); the bleach fit leaves out the 800 ms after each stimulus.

In [27]:
def efs_channel(h):
    return [c for c in h["daq"] if c not in ("mod488", "mod594") and h["daq"][c]["x"].max() > h["daq"][c]["x"].min()
            and "enable" not in c.lower() and "shutter" not in c.lower()][0]

def plateau_epochs(key):
    o = cells[key]
    h = o["hdr"]
    opto, opto_off = D.stim_onsets(h)
    efs, _ = D.onsets(h, efs_channel(h))
    ep = []
    used = set()
    for s, e in zip(opto, opto_off):
        near = [x for x in efs if abs(x - s) < 0.3]
        if near:
            ep.append(dict(kind="combined", start=min(s, near[0]), opto=s, opto_end=e, efs=near[0]))
            used.add(near[0])
        else:
            ep.append(dict(kind="optical", start=s, opto=s, opto_end=e, efs=np.nan))
    for x in efs:
        if x not in used:
            ep.append(dict(kind="electrical", start=x, opto=np.nan, opto_end=np.nan, efs=x))
    ep = pd.DataFrame(ep).sort_values("start").reset_index(drop=True)
    starts = ep.start.values
    ep["end"] = [min([v for v in starts if v > s] + [o["t"][-1]]) - 0.05 for s in starts]
    return ep

def plateau_traces(key, lo_um=200.0):
    o = cells[key]
    ep = plateau_epochs(key)
    excl = np.zeros(len(o["t"]), bool)
    for s in ep.start:
        excl |= (o["t"] >= s) & (o["t"] < s + 0.8)
    Y = D.bleach_correct(o["X"], o["t"], exclude=excl)
    yd, n = D.distal_trace(Y, o["dist"], lo_um)
    return Y, yd, ep

for key in ["174622"] + S22 + ["200953", "201133", "201912", "202041"]:
    ep = plateau_epochs(key)
    print(key, cells[key]["hdr"]["experiment"], [(r.kind, round(r.start, 3), round(r.end - r.start, 2)) for r in ep.itertuples()])
174622 Plateau_induction (Fig.5a) [('optical', 1.0, 0.95), ('combined', 2.0, 0.95), ('electrical', 3.0, 0.95)]
165407 Plateau (Fig.S22-1) [('optical', 0.5, 0.95), ('combined', 1.5, 0.95), ('electrical', 2.5, 0.95), ('optical', 3.5, 0.95), ('combined', 4.5, 0.95), ('electrical', 5.5, 0.95), ('optical', 6.5, 0.95), ('combined', 7.5, 0.95), ('electrical', 8.5, 0.95), ('optical', 9.5, 0.95), ('combined', 10.5, 0.95), ('electrical', 11.5, 0.45)]
215424 Plateau (Fig.S22-2) [('optical', 1.0, 0.95), ('combined', 2.0, 0.95), ('electrical', 3.0, 0.95)]
002658 Plateau (Fig.S22-3) [('optical', 1.0, 0.95), ('combined', 2.0, 0.95), ('electrical', 3.0, 0.95)]
204403 plateau_drugs (Fig.6) [('optical', 1.0, 0.95), ('combined', 2.0, 0.95), ('electrical', 3.0, 0.95)]
170657 Plateau (Fig.S22-5) [('optical', 1.0, 0.95), ('combined', 2.0, 0.95), ('electrical', 3.0, 0.95)]
162842 Plateau (Fig.S22-6) [('optical', 1.0, 0.95), ('combined', 2.0, 0.95), ('electrical', 3.0, 0.95)]
230744 Plateau (Fig.S22-7) [('optical', 1.0, 0.95), ('combined', 2.0, 0.95), ('electrical', 3.0, 0.95)]
160204 Plateau (Fig.S22-8) [('optical', 1.0, 0.95), ('combined', 2.0, 0.95), ('electrical', 3.0, 0.95)]
153417 plateau_drugs (Fig.6) [('optical', 1.0, 0.95), ('combined', 2.0, 0.95), ('electrical', 3.0, 0.95)]
200953 Plateau_varying_timing (Fig.5c) [('optical', 1.03, 0.92), ('combined', 2.0, 0.95), ('electrical', 3.0, 0.95)]
201133 Plateau_varying_timing (Fig.5c) [('optical', 1.1, 0.85), ('combined', 2.0, 0.95), ('electrical', 3.0, 0.95)]
201912 Plateau_varying_timing (Fig.5c) [('optical', 0.9, 0.95), ('combined', 1.9, 1.05), ('electrical', 3.0, 0.95)]
202041 Plateau_varying_timing (Fig.5c) [('optical', 0.97, 0.95), ('combined', 1.97, 0.98), ('electrical', 3.0, 0.95)]

fig5a-plateau-collision¶

Combining soma optogenetic stimulation with EFS of distal synaptic inputs evoked a long-lasting (about 120 ms) dendritic plateau potential and a burst of somatic spikes, unlike either stimulus alone.

File of index entry "Plateau_induction (Fig.5a)". Duration: the time the distal (> 200 µm) -dF/F, smoothed over 5 ms, stays above half its peak (claims file's standard measure). Somatic spikes: high-passed somatic trace above 5 (or 4) robust s.d. within 300 ms of the epoch start. Criterion: combined duration 120 ± 12 ms, more somatic spikes than optical alone, and neither single stimulus gives a distal event over 60 ms.

In [28]:
o = cells["174622"]
Y, yd, ep = plateau_traces("174622")
rows = []
for r in ep.itertuples():
    dur, peak = D.above_half_duration_ms(yd, o["t"], r.start, r.end)
    rd_rows = {}
    for rd in ("median", "butter"):
        H = D.highpass(Y[:, 0], o["fs"], rd)
        for k in (5.0, 4.0):
            pk, _ = D.detect_spikes(H, o["fs"], k=k)
            rd_rows[f"spikes_{rd}_k{k:g}"] = int(((o["t"][pk] >= r.start) & (o["t"][pk] < r.start + 0.3)).sum())
    rows.append(dict(epoch=r.kind, start_s=round(r.start, 3), distal_peak_pct=round(peak * 100, 2), duration_ms=round(dur, 1), **rd_rows))
fig5a = pd.DataFrame(rows)
print(fig5a.to_string())
fig, ax = plt.subplots(figsize=(9, 2.8))
for r in ep.itertuples():
    i0, i1 = np.searchsorted(o["t"], [r.start - 0.1, r.start + 0.6])
    ax.plot((o["t"][i0:i1] - r.start) * 1000, yd[i0:i1] * 100, label=r.kind)
ax.set_xlabel("ms after epoch start")
ax.set_ylabel("distal -dF/F (%)")
ax.legend()
plt.show()
print("plotted range (%):", round(float(yd.min() * 100), 2), "to", round(float(yd.max() * 100), 2))
        epoch  start_s  distal_peak_pct  duration_ms  spikes_median_k5  spikes_median_k4  spikes_butter_k5  spikes_butter_k4
0     optical      1.0             3.85          9.3                 3                 3                 3                 3
1    combined      2.0             4.97        146.3                10                14                 9                11
2  electrical      3.0             1.81         33.0                 0                 0                 0                 0
No description has been provided for this image
plotted range (%): -0.66 to 5.24

Result: not reproduced. The combined stimulus gives a distal (beyond 200 µm) depolarization lasting 146 ms above half its peak, outside 120 ± 12 ms. The other parts of the criterion hold: 9 to 14 somatic spikes in 300 ms against 3 for the optogenetic stimulus alone, and distal events of 9 ms (optical) and 33 ms (EFS) for the single stimuli, under 60 ms.

fig5d-single-bap-no-plateau¶

A single bAP (10 ms soma stimulus) did not evoke a nonlinear dendritic response at any timing relative to EFS (5 cells).

The dandiset holds one of the five cells: the four 10 ms files of index entry "Plateau_varying_timing (Fig.5c)". Per file, AUC combined over AUC optical plus AUC electrical, distal region beyond 200 µm, window readings (a) until the cumulative area stops rising and (b) to the end of the epoch. Criterion: no ratio above 2.

In [29]:
def auc_ratio(key, reading, lo_um=200.0):
    o = cells[key]
    Y, yd, ep = plateau_traces(key, lo_um)
    a = {r.kind: D.auc(yd, o["t"], r.start, r.end, reading) for r in ep.itertuples()}
    return a, a["combined"] / (a["optical"] + a["electrical"])

rows = []
for key in ["200953", "201133", "201912", "202041"]:
    name = D.asset_for(key)["path"].split("/")[0]
    ep = plateau_epochs(key)
    c = ep[ep.kind == "combined"].iloc[0]
    for reading in ("a", "b"):
        a, ratio = auc_ratio(key, reading)
        rows.append(dict(file=name[4:], opto_minus_efs_ms=round((c.opto - c.efs) * 1000), window=reading,
                         auc_opt=round(a["optical"], 3), auc_efs=round(a["electrical"], 3), auc_comb=round(a["combined"], 3),
                         ratio=round(ratio, 2)))
fig5dsb = pd.DataFrame(rows)
print(fig5dsb.to_string())
print("largest ratio by window reading:", fig5dsb.groupby("window").ratio.max().to_dict())
                                                      file  opto_minus_efs_ms window  auc_opt  auc_efs  auc_comb  ratio
0   200953PP071-P15-Cell2-soma-10ms+EC-30V-interval-+30-ms                 30      a    0.015    0.028     0.111   2.58
1   200953PP071-P15-Cell2-soma-10ms+EC-30V-interval-+30-ms                 30      b   -0.041   -0.014     0.111  -2.03
2  201133PP071-P15-Cell2-soma-10ms+EC-30V-interval-+100-ms                100      a    0.007    0.096     0.140   1.35
3  201133PP071-P15-Cell2-soma-10ms+EC-30V-interval-+100-ms                100      b   -0.002    0.090     0.140   1.59
4  201912PP071-P15-Cell2-soma-10ms+EC-30V-interval--100-ms               -100      a    0.011    0.030     0.154   3.77
5  201912PP071-P15-Cell2-soma-10ms+EC-30V-interval--100-ms               -100      b   -0.013   -0.002     0.154  -9.90
6   202041PP071-P15-Cell2-soma-10ms+EC-30V-interval--30-ms                -30      a    0.055    0.043     0.104   1.06
7   202041PP071-P15-Cell2-soma-10ms+EC-30V-interval--30-ms                -30      b    0.055    0.027     0.104   1.28
largest ratio by window reading: {'a': 3.77, 'b': 1.59}

Result: blocked (methods underspecified). The two window readings disagree on the one cell of five in the dandiset. Up to the end of the cumulative rise (a), the combined AUC exceeds twice the sum of the single AUCs at +30 ms (2.58) and -100 ms (3.77), so the claim fails. To the end of the epoch (b), the single-stimulus AUCs sum to a negative value at +30 and -100 ms, so the ratio is undefined there (printed as -2.03 and -9.90), and at +100 and -30 ms it is 1.59 and 1.28, below 2. Reading (a) fails the claim and reading (b) leaves it undecided at the two intervals where (a) fails; the criterion makes disagreeing window readings methods_underspecified.

fig5b-supralinear-auc (blocked: 28 cells, about 10 here)¶

The distal AUC for combined stimulation was on average 3.1 ± 0.7-fold the sum of the AUCs for optical and EFS stimuli alone, and more than twice that sum in 15 of 28 cells.

The claim needs 28 cells; the dandiset holds the combined-stimulus files of the Fig. 5a and Fig. S22 examples, and nothing links them to rows of the Source Data. The ratio is computed for them (both window readings, as fig5d-single-bap-no-plateau) and set beside the Source Data's 28 per-cell values, for comparison only; the claim stays blocked.

In [30]:
sd5 = pd.read_excel(io.BytesIO(blob), sheet_name="Figure 5", header=None).iloc[3:, :3].dropna().astype(float)
sd5.columns = ["opto_pct", "efs_pct", "comb_pct"]
print(f"Source Data Fig. 5b: {len(sd5)} cells, ratio mean {sd5.comb_pct.mean() / 100:.2f} ± {stats.sem(sd5.comb_pct) / 100:.2f} (s.e.m.),"
      f" above 2 in {int((sd5.comb_pct > 200).sum())}, range {sd5.comb_pct.min() / 100:.2f} to {sd5.comb_pct.max() / 100:.2f};"
      f" optical share of the single-stimulus sum {sd5.opto_pct.min():.0f} to {sd5.opto_pct.max():.0f}%")
rows = []
for key in ["174622"] + S22:
    ep = plateau_epochs(key)
    if not {"optical", "electrical", "combined"} <= set(ep.kind):
        rows.append(dict(file=key, window="-", note="an epoch kind is missing"))
        continue
    c = ep[ep.kind == "combined"].iloc[0]
    for reading in ("a", "b"):
        a, ratio = auc_ratio(key, reading)
        tot = a["optical"] + a["electrical"]
        rows.append(dict(file=key, window=reading, opto_ms=round((c.opto_end - c.opto) * 1000), auc_opt=round(a["optical"], 3),
                         auc_efs=round(a["electrical"], 3), auc_comb=round(a["combined"], 3), ratio=round(ratio, 2),
                         opto_share_pct=round(100 * a["optical"] / tot, 1) if tot else np.nan))
fig5b = pd.DataFrame(rows)
print(fig5b.to_string())
for reading, g in fig5b[fig5b.window.isin(["a", "b"])].groupby("window"):
    ok = g[(g.auc_opt > 0) & (g.auc_efs > 0)]
    print(f"window ({reading}): {len(g)} cells, {len(ok)} with both single-stimulus areas positive; over those, ratio mean"
          f" {ok.ratio.mean():.2f} ± {stats.sem(ok.ratio):.2f} (s.e.m.), above 2 in {int((ok.ratio > 2).sum())},"
          f" inside the Source Data range in {int(ok.ratio.between(sd5.comb_pct.min() / 100, sd5.comb_pct.max() / 100).sum())}")
Source Data Fig. 5b: 28 cells, ratio mean 3.12 ± 0.66 (s.e.m.), above 2 in 15, range 0.86 to 16.29; optical share of the single-stimulus sum 12 to 76%

      file window  opto_ms  auc_opt  auc_efs  auc_comb   ratio  opto_share_pct
0   174622      a       30    0.080    0.063     0.816    5.69            55.8
1   174622      b       30   -0.015   -0.081     0.816   -8.57            15.4
2   165407      a       30    0.023    0.024     0.206    4.44            48.8
3   165407      b       30   -0.034   -0.016     0.170   -3.36            67.3
4   215424      a       30    0.044    0.109     0.911    5.96            28.8
5   215424      b       30   -0.225    0.032     0.911   -4.72           116.4
6   002658      a       30    0.408    0.036     0.191    0.43            91.8
7   002658      b       30    0.408    0.036    -0.202   -0.45            91.8
8   204403      a       30    0.027    0.117     0.159    1.11            18.6
9   204403      b       30   -0.027    0.105     0.159    2.04           -34.6
10  170657      a       30    0.022    0.133     0.399    2.58            14.1
11  170657      b       30   -0.154    0.094     0.399   -6.75           259.6
12  162842      a       30    0.042    0.082     0.423    3.42            33.9
13  162842      b       30   -0.120    0.039     0.423   -5.22           148.3
14  230744      a       30    0.067    0.232     0.527    1.76            22.4
15  230744      b       30   -0.195    0.190     0.527 -114.43          4230.4
16  160204      a       30    0.022    0.037     0.633   10.75            37.2
17  160204      b       30    0.009    0.025     0.631   18.43            26.0
18  153417      a       30    0.074    0.136     0.480    2.29            35.1
19  153417      b       30    0.065    0.107     0.426    2.48            37.7
window (a): 10 cells, 10 with both single-stimulus areas positive; over those, ratio mean 3.84 ± 0.96 (s.e.m.), above 2 in 7, inside the Source Data range in 9
window (b): 10 cells, 3 with both single-stimulus areas positive; over those, ratio mean 6.82 ± 5.87 (s.e.m.), above 2 in 2, inside the Source Data range in 1

Result: blocked (data missing). The claim needs the 28 cells of Fig. 5b; the dandiset holds 10 combined-stimulus cells with 30 ms soma stimulation, and nothing links them to rows of the Source Data. Over these 10, with the window ending when the cumulative area stops rising (a), the ratio is 3.84 ± 0.96 (mean ± s.e.m.) and above 2 in 7 of 10, against 3.12 ± 0.66 and 15 of 28 in the Source Data; 9 of the 10 fall inside the Source Data's range (0.86 to 16.29). With the window to the end of the epoch (b) one or both single-stimulus areas are negative in 7 of 10 cells, so the ratio is undefined there.

figs23-dendrite-drives-soma¶

Subtracting the somatic signal from the dendritic signal reveals a slowly rising and falling dendritic depolarization lasting up to about 300 ms after the optogenetic stimulus, which drives the high-frequency somatic firing.

The nine files of index entry "Plateau (Fig.S22)" (the gallery of Fig. S23 shows 9 neurons). In the combined epoch (the first one where a file has several), the dendritic region is the 5 trunk segments (about 33 µm, the Methods' example width) with the largest mean -dF/F from 30 to 300 ms after the start; the somatic -dF/F is subtracted from it. Persistence: the time after the 30 ms optogenetic stimulus ends until the difference, smoothed over 5 ms, returns within 2 s.d. of its 200 ms pre-stimulus baseline. Criterion: the longest persistence over cells is 300 ± 30 ms and the difference is positive in most cells (mean over 30 to 300 ms).

In [31]:
def figs23_row(key, lo_um=0.0, smooth_ms=5.0, signed=False):
    o = cells[key]
    ep = plateau_epochs(key)
    excl = np.zeros(len(o["t"]), bool)
    for s in ep.start:
        excl |= (o["t"] >= s) & (o["t"] < s + 0.8)
    Y = D.bleach_correct(o["X"], o["t"], exclude=excl)
    c = ep[ep.kind == "combined"].iloc[0]
    t = o["t"]
    i0, i30, i300 = np.searchsorted(t, [c.start, c.start + 0.03, c.start + 0.3])
    seg = Y[:, 1:-1]
    sm = ndimage.uniform_filter1d(seg, 5, axis=1)  # mean of 5 neighbouring segments around each
    cand = [i for i in range(2, seg.shape[1] - 2) if o["dist"][i - 2] > lo_um]
    best = cand[int(np.argmax(sm[i30:i300][:, cand].mean(0)))]
    dend = seg[:, best - 2:best + 3].mean(1)
    diff = ndimage.uniform_filter1d(dend - Y[:, 0], max(1, int(smooth_ms / 1000 * o["fs"])))
    b0 = np.searchsorted(t, c.start - 0.2)
    base = diff[b0:i0]
    j = np.searchsorted(t, c.opto_end)
    jend = np.searchsorted(t, c.end)
    dev = diff[j:jend] - base.mean()
    # signed variant: only a positive difference (dendrite above soma) counts as persisting
    inside = (dev <= 2 * base.std()) if signed else (np.abs(dev) <= 2 * base.std())
    ret = int(np.argmax(inside)) if inside.any() else jend - j
    row = dict(file=key, region=f">{lo_um:g} um", smooth_ms=smooth_ms, signed=signed, dendrite_um=round(float(o["dist"][best]), 0),
               mean_diff_30_300ms_pct=round(float((diff[i30:i300] - base.mean()).mean() * 100), 2),
               persistence_ms=round(ret / o["fs"] * 1000, 1), epoch_left_ms=round((jend - j) / o["fs"] * 1000))
    return row, (t[b0:jend] - c.opto_end, (diff[b0:jend] - base.mean()) * 100, 2 * base.std() * 100)

rows, traces = [], {}
for lo_um in (0.0, 200.0):
    for smooth_ms in (5.0, 20.0):
        for signed in (False, True):
            for key in S22:
                row, tr = figs23_row(key, lo_um, smooth_ms, signed)
                rows.append(row)
                if not signed:
                    traces[(key, lo_um, smooth_ms)] = tr
figs23 = pd.DataFrame(rows)
print(figs23.to_string())
for (region, sm_, sg), g in figs23.groupby(["region", "smooth_ms", "signed"]):
    print(f"region {region}, smoothing {sm_:g} ms, {'signed' if sg else 'either sign'}: longest persistence {g.persistence_ms.max()} ms, median {g.persistence_ms.median()} ms;"
          f" cells with a positive difference {int((g.mean_diff_30_300ms_pct > 0).sum())} of {len(g)}")
fig, axes = plt.subplots(1, len(S22), figsize=(2.2 * len(S22), 2.6), sharex=True)
for ax, key in zip(axes, S22):
    x, y, band = traces[(key, 200.0, 20.0)]
    ax.plot(x * 1000, y, lw=0.7)
    ax.axhspan(-band, band, color="0.85")
    ax.axvline(0, color="k", lw=0.5)
    ax.set_title(key, fontsize=8)
    ax.set_xlabel("ms after stimulus end")
axes[0].set_ylabel("dendrite - soma -dF/F (%)")
plt.tight_layout()
plt.show()
print("plotted range (%):", round(min(float(traces[(k, 200.0, 20.0)][1].min()) for k in S22), 2), "to",
      round(max(float(traces[(k, 200.0, 20.0)][1].max()) for k in S22), 2))
      file   region  smooth_ms  signed  dendrite_um  mean_diff_30_300ms_pct  persistence_ms  epoch_left_ms
0   165407    >0 um        5.0   False        205.0                    2.92           206.0            920
1   215424    >0 um        5.0   False         88.0                    1.87             5.2            920
2   002658    >0 um        5.0   False        283.0                   -1.14            18.7            920
3   204403    >0 um        5.0   False        133.0                    0.42            57.7            920
4   170657    >0 um        5.0   False         94.0                    0.80            94.8            920
5   162842    >0 um        5.0   False        101.0                    0.88             6.2            920
6   230744    >0 um        5.0   False         88.0                    1.51            62.8            920
7   160204    >0 um        5.0   False        146.0                    2.70             0.0            920
8   153417    >0 um        5.0   False        120.0                    2.18            90.6            920
9   165407    >0 um        5.0    True        205.0                    2.92           206.0            920
10  215424    >0 um        5.0    True         88.0                    1.87             5.2            920
11  002658    >0 um        5.0    True        283.0                   -1.14             0.0            920
12  204403    >0 um        5.0    True        133.0                    0.42            57.7            920
13  170657    >0 um        5.0    True         94.0                    0.80            94.8            920
14  162842    >0 um        5.0    True        101.0                    0.88             6.2            920
15  230744    >0 um        5.0    True         88.0                    1.51            62.8            920
16  160204    >0 um        5.0    True        146.0                    2.70             0.0            920
17  153417    >0 um        5.0    True        120.0                    2.18            90.6            920
18  165407    >0 um       20.0   False        205.0                    2.90           221.5            920
19  215424    >0 um       20.0   False         88.0                    1.85            10.3            920
20  002658    >0 um       20.0   False        283.0                   -1.13           134.2            920
21  204403    >0 um       20.0   False        133.0                    0.42            86.5            920
22  170657    >0 um       20.0   False         94.0                    0.78            98.9            920
23  162842    >0 um       20.0   False        101.0                    0.87           153.5            920
24  230744    >0 um       20.0   False         88.0                    1.46            96.8            920
25  160204    >0 um       20.0   False        146.0                    2.69             0.0            920
26  153417    >0 um       20.0   False        120.0                    2.14           167.9            920
27  165407    >0 um       20.0    True        205.0                    2.90           221.5            920
28  215424    >0 um       20.0    True         88.0                    1.85            10.3            920
29  002658    >0 um       20.0    True        283.0                   -1.13             0.0            920
30  204403    >0 um       20.0    True        133.0                    0.42            86.5            920
31  170657    >0 um       20.0    True         94.0                    0.78            98.9            920
32  162842    >0 um       20.0    True        101.0                    0.87           153.5            920
33  230744    >0 um       20.0    True         88.0                    1.46            96.8            920
34  160204    >0 um       20.0    True        146.0                    2.69             0.0            920
35  153417    >0 um       20.0    True        120.0                    2.14           167.9            920
36  165407  >200 um        5.0   False        218.0                    2.53           170.0            920
37  215424  >200 um        5.0   False        244.0                    1.41             2.1            920
38  002658  >200 um        5.0   False        283.0                   -1.14            18.7            920
39  204403  >200 um        5.0   False        224.0                    0.14             3.1            920
40  170657  >200 um        5.0   False        224.0                    0.61            25.8            920
41  162842  >200 um        5.0   False        218.0                   -0.17            13.4            920
42  230744  >200 um        5.0   False        218.0                    0.40            18.5            920
43  160204  >200 um        5.0   False        218.0                    1.32             0.0            920
44  153417  >200 um        5.0   False        335.0                    1.04            68.0            920
45  165407  >200 um        5.0    True        218.0                    2.53           170.0            920
46  215424  >200 um        5.0    True        244.0                    1.41             2.1            920
47  002658  >200 um        5.0    True        283.0                   -1.14             0.0            920
48  204403  >200 um        5.0    True        224.0                    0.14             0.0            920
49  170657  >200 um        5.0    True        224.0                    0.61            25.8            920
50  162842  >200 um        5.0    True        218.0                   -0.17            13.4            920
51  230744  >200 um        5.0    True        218.0                    0.40            18.5            920
52  160204  >200 um        5.0    True        218.0                    1.32             0.0            920
53  153417  >200 um        5.0    True        335.0                    1.04            68.0            920
54  165407  >200 um       20.0   False        218.0                    2.51           220.4            920
55  215424  >200 um       20.0   False        244.0                    1.40             0.0            920
56  002658  >200 um       20.0   False        283.0                   -1.13           134.2            920
57  204403  >200 um       20.0   False        224.0                    0.14             0.0            920
58  170657  >200 um       20.0   False        224.0                    0.60           103.0            920
59  162842  >200 um       20.0   False        218.0                   -0.20            84.5            920
60  230744  >200 um       20.0   False        218.0                    0.37            51.5            920
61  160204  >200 um       20.0   False        218.0                    1.30             6.2            920
62  153417  >200 um       20.0   False        335.0                    1.00            90.6            920
63  165407  >200 um       20.0    True        218.0                    2.51           220.4            920
64  215424  >200 um       20.0    True        244.0                    1.40             0.0            920
65  002658  >200 um       20.0    True        283.0                   -1.13             0.0            920
66  204403  >200 um       20.0    True        224.0                    0.14             0.0            920
67  170657  >200 um       20.0    True        224.0                    0.60           103.0            920
68  162842  >200 um       20.0    True        218.0                   -0.20            84.5            920
69  230744  >200 um       20.0    True        218.0                    0.37            51.5            920
70  160204  >200 um       20.0    True        218.0                    1.30             0.0            920
71  153417  >200 um       20.0    True        335.0                    1.00            90.6            920
region >0 um, smoothing 5 ms, either sign: longest persistence 206.0 ms, median 57.7 ms; cells with a positive difference 8 of 9
region >0 um, smoothing 5 ms, signed: longest persistence 206.0 ms, median 57.7 ms; cells with a positive difference 8 of 9
region >0 um, smoothing 20 ms, either sign: longest persistence 221.5 ms, median 98.9 ms; cells with a positive difference 8 of 9
region >0 um, smoothing 20 ms, signed: longest persistence 221.5 ms, median 96.8 ms; cells with a positive difference 8 of 9
region >200 um, smoothing 5 ms, either sign: longest persistence 170.0 ms, median 18.5 ms; cells with a positive difference 7 of 9
region >200 um, smoothing 5 ms, signed: longest persistence 170.0 ms, median 13.4 ms; cells with a positive difference 7 of 9
region >200 um, smoothing 20 ms, either sign: longest persistence 220.4 ms, median 84.5 ms; cells with a positive difference 7 of 9
region >200 um, smoothing 20 ms, signed: longest persistence 220.4 ms, median 51.5 ms; cells with a positive difference 7 of 9
No description has been provided for this image
plotted range (%): -3.28 to 4.4

Result: not reproduced. The dendrite-minus-soma -dF/F is positive from 30 to 300 ms in 8 of 9 cells (7 of 9 with the region beyond 200 µm), but the longest persistence after the stimulus ends is 206 ms (5 ms smoothing) or 222 ms (20 ms smoothing) with the region chosen anywhere on the trunk, and 170 or 220 ms beyond 200 µm, short of 270 to 330 ms in every reading. The 20 ms smoothing lengthens the median persistence over the trunk (58 to 99 ms) and beyond 200 µm (19 to 85 ms), but it does not remove all early returns: beyond 200 µm it turns two cells into 0 ms returns (215424 from 2.1 to 0.0 ms, 204403 from 3.1 to 0.0 ms), and cell 160204, whose mean difference is +1.3 to +2.7%, returns within 2 s.d. at once in every reading (0 to 6 ms). The measure counts a deviation of either sign as persisting: cell 002658, whose mean difference is negative, gets 134 ms with 20 ms smoothing. Counting only a positive difference (signed variant) gives 002658 0 ms and leaves the longest persistence unchanged (206, 222, 170 and 220 ms), so the outcome holds under both.

Patch clamp with imaging (Fig. S2)¶

The 14 files of index entries "Patch clamp (Fig. S2a/b)", "Patch clamp_1kHz (Fig. S2d)" and "Patch clamp_2kHz (Fig. S2d)": seven cells, each imaged at 1 kHz and at 2 kHz (pairs matched by the slice and cell in the file name) with simultaneous current clamp. The files hold the amplifier's primary output; the dandiset description gives its gain (50 mV/V, so -1.5 V is -75 mV). Fluorescence is the mean of the cell's pixels (the brightest 20% of the mean image), as in the Methods' unweighted region. Each frame's voltage is the mean of the 10 kHz samples within the frame. The bleach fit uses frames at rest (below -60 mV).

In [32]:
PATCH = {"V2-11": ("000919", "000820"), "V2-14": ("150706", "150945"), "Cel3": ("205240", "205908"),
         "V2-10": ("232204", "233122"), "Cell1-ctx": ("215254", "215422"), "V2-12": ("004720", "004921"),
         "Cell4": ("212457", "212620")}
MV_PER_V = 50.0  # dandiset description

def patch_record(key):
    h = D.read_header(key)
    m = D.mean_image(h)
    W = D.weights([m > np.percentile(m, 80), np.ones(m.shape, bool)])
    X = D.extract(h, W)
    F = X[:, 0]
    # Variant: the Methods' maximum-likelihood pixel weighting, with the whole-field mean as reference
    F_ml = D.extract(h, D.ml_weights(h, X[:, 1]))[:, 0]
    t = h["cam_t"]
    v = h["daq"]["Primary_out"]
    vt = v["t0"] + np.arange(len(v["x"])) / v["rate"]
    dt = np.median(np.diff(t))
    idx = np.searchsorted(vt, t)
    step = int(round(dt * v["rate"]))
    cs = np.r_[0, np.cumsum(v["x"].astype(np.float64))]
    hi = np.minimum(idx + step, len(v["x"]))
    vf = (cs[hi] - cs[idx]) / np.maximum(hi - idx, 1) * MV_PER_V
    return dict(key=key, t=t, F=F, F_ml=F_ml, vf=vf, vt=vt, v=v["x"] * MV_PER_V, fs=1 / dt, path=h["path"])

t0 = time.time()
precs = {key: patch_record(key) for pair in PATCH.values() for key in pair}
print(f"loaded {len(precs)} patch files in {time.time() - t0:.0f} s")
loaded 14 patch files in 575 s
In [33]:
rows = []
for cell, (k1, k2) in PATCH.items():
    for rate, key in (("1 kHz", k1), ("2 kHz", k2)):
        r = precs[key]
        rows.append(dict(cell=cell, rate=rate, file=key, frames=len(r["t"]), frame_ms=round(1000 / r["fs"], 3),
                         vm_min=round(float(r["v"].min()), 1), vm_max=round(float(r["v"].max()), 1),
                         vm_rest_median=round(float(np.median(r["v"][:5000])), 1), F_min=int(r["F"].min()), F_max=int(r["F"].max())))
print(pd.DataFrame(rows).to_string())
         cell   rate    file  frames  frame_ms  vm_min  vm_max  vm_rest_median  F_min  F_max
0       V2-11  1 kHz  000919   27183      1.03   -74.6    47.0           -66.7    334    372
1       V2-11  2 kHz  000820   53845      0.52   -74.7    47.6           -66.5    227    262
2       V2-14  1 kHz  150706   27183      1.03   -68.2    46.4           -63.1    222    245
3       V2-14  2 kHz  150945   53845      0.52   -69.9    47.0           -64.0    303    334
4        Cel3  1 kHz  205240   27183      1.03   -74.0    39.8           -72.5    258    301
5        Cel3  2 kHz  205908   53845      0.52   -72.4    42.7           -70.5    539    616
6       V2-10  1 kHz  232204   27183      1.03   -76.4    44.8           -73.6    181    196
7       V2-10  2 kHz  233122   53845      0.52   -70.9    46.1           -67.2    221    238
8   Cell1-ctx  1 kHz  215254   27183      1.03   -78.0    36.9           -70.5    555    624
9   Cell1-ctx  2 kHz  215422   53845      0.52   -77.3    36.2           -70.0    370    437
10      V2-12  1 kHz  004720   27183      1.03   -75.3    41.4           -68.9    216    246
11      V2-12  2 kHz  004921   53845      0.52   -74.4    40.1           -70.5    266    308
12      Cell4  1 kHz  212457   27183      1.03   -72.1    50.3           -70.0    273    383
13      Cell4  2 kHz  212620   53845      0.52   -70.7    49.4           -69.0    615    775

Membrane potential spans about -75 to +45 mV with the stated gain, which fits a CA1 neuron at rest and at spike peaks; the gain is consistent with the data. Clock check: optical and electrical spikes are matched below; the median lag between them shows whether the camera and DAQ clocks agree.

figs2-imaging-fidelity¶

Optical recording at 1 kHz detected every spike up to 90 Hz with no false positives or negatives (7 cells, 2212 spikes), with a single-trial noise-equivalent voltage of 1.2 ± 0.5 mV (2.5 ± 0.8 mV at 2 kHz) and sensitivity of about 12% dF/F per 100 mV.

Sensitivity: slope of -dF/F against the frame voltage, over subthreshold frames (below -40 mV and more than 5 ms from any spike), times 100 mV. Noise-equivalent voltage, readings (a) the s.d. of -dF/F over the first second (at rest, no current) divided by the slope, (b) the s.d. of the optical trace scaled to mV minus the frame voltage, over subthreshold frames. Electrical spikes: upward crossings of 0 mV, at least 3 ms apart. Optical spikes: high-passed (20 ms median) -dF/F above 5 robust s.d., peaks at least 3 ms apart. A pair matches when the optical peak falls within one frame of the electrical spike, after the median lag is removed.

In [34]:
def patch_measures(r, k=5.0, repol_mV=None, trace="F"):
    t, F, vf = r["t"], r[trace], r["vf"]
    rest = vf < -60
    y = D.bleach_correct(F, t, exclude=~rest)
    vx = r["v"]
    up = np.flatnonzero((vx[1:] >= 0) & (vx[:-1] < 0)) + 1
    keep = []
    for u in up:  # one spike per crossing; crossings within 3 ms of the last kept one are noise
        if keep and r["vt"][u] - r["vt"][keep[-1]] <= 0.003:
            continue
        if repol_mV is not None and keep and vx[keep[-1]:u].min() > repol_mV:
            continue  # variant: a new spike only after the membrane repolarized below repol_mV
        keep.append(u)
    espk = r["vt"][np.array(keep, int)]
    near = np.zeros(len(t), bool)
    for s in espk:
        near |= np.abs(t - s) < 0.005
    sub = (vf < -40) & ~near
    slope, icpt = np.polyfit(vf[sub], y[sub], 1)
    q = t < 1.0
    nev_a = y[q].std() / slope
    # Variant of reading (a) away from the first second: the 1 s window (after the first second)
    # in which the membrane potential varies least
    n1 = int(round(r["fs"]))
    starts = range(n1, len(t) - n1 + 1, n1)
    w0 = min(starts, key=lambda s: vf[s:s + n1].std()) if len(starts) else 0
    nev_a_quiet = y[w0:w0 + n1].std() / slope
    pred = (y - icpt) / slope
    nev_b = (pred[sub] - vf[sub]).std()
    H = D.highpass(y, r["fs"], "median")
    pk, _ = D.detect_spikes(H, r["fs"], k=k)
    ospk = t[pk]
    lags = np.array([ospk[np.argmin(np.abs(ospk - s))] - s for s in espk]) if len(ospk) else np.array([])
    lag = float(np.median(lags)) if len(lags) else 0.0
    frame = 1 / r["fs"]
    used = np.zeros(len(ospk), bool)
    hits = 0
    for s in espk:
        d = np.abs(ospk - lag - s)
        j = int(np.argmin(d)) if len(d) else -1
        if j >= 0 and d[j] <= frame and not used[j]:
            used[j] = True
            hits += 1
    isi = np.diff(espk)
    return dict(sens_pct_per_100mV=round(slope * 100 * 100, 2), dFF_at_20mV_pct=round(slope * 90 * 100, 2),
                nev_a_mV=round(nev_a, 2), nev_a_quiet_mV=round(nev_a_quiet, 2), quiet_vm_sd_mV=round(float(vf[w0:w0 + n1].std()), 2),
                nev_b_mV=round(nev_b, 2), e_spikes=len(espk), o_spikes=len(ospk),
                matched=hits, false_neg=len(espk) - hits, false_pos=int((~used).sum()), lag_ms=round(lag * 1000, 2),
                max_rate_Hz=round(1 / isi.min(), 1) if len(isi) else np.nan)

rows = []
for cell, (k1, k2) in PATCH.items():
    for rate, key in (("1 kHz", k1), ("2 kHz", k2)):
        for trace, k, repol in (("F", 5.0, np.nan), ("F", 4.0, np.nan), ("F", 5.0, -30.0), ("F_ml", 5.0, np.nan)):
            rows.append(dict(cell=cell, rate=rate, pixels="brightest 20%" if trace == "F" else "ML weights", k=k, repol_mV=repol,
                             **patch_measures(precs[key], k, None if np.isnan(repol) else repol, trace)))
s2 = pd.DataFrame(rows)
print(s2.to_string())
for (pix, k, repol), g0 in s2.groupby(["pixels", "k", "repol_mV"], dropna=False):
    g = g0.groupby("rate")
    print(f"pixels {pix}, k={k:g}, electrical spikes {'after repolarization below ' + str(repol) + ' mV' if np.isfinite(repol) else '3 ms apart'}:",
          g[["sens_pct_per_100mV", "nev_a_mV", "nev_a_quiet_mV", "nev_b_mV", "max_rate_Hz"]].agg(["mean", "std"]).round(2).to_string())
    print("   spikes (electrical), false negatives, false positives by rate:",
          g[["e_spikes", "false_neg", "false_pos"]].sum().to_dict("index"))
         cell   rate         pixels    k  repol_mV  sens_pct_per_100mV  dFF_at_20mV_pct  nev_a_mV  nev_a_quiet_mV  quiet_vm_sd_mV  nev_b_mV  e_spikes  o_spikes  matched  false_neg  false_pos  lag_ms  max_rate_Hz
0       V2-11  1 kHz  brightest 20%  5.0       NaN               10.98             9.89      3.72            1.79            0.90      3.49       226       230      222          4          8    1.52        333.3
1       V2-11  1 kHz  brightest 20%  4.0       NaN               10.98             9.89      3.72            1.79            0.90      3.49       226       233      222          4         11    1.52        333.3
2       V2-11  1 kHz  brightest 20%  5.0     -30.0               10.99             9.89      3.72            1.79            0.90      3.49       225       230      222          3          8    1.53         56.8
3       V2-11  1 kHz     ML weights  5.0       NaN                7.50             6.75      4.27            1.81            0.90      3.83       226       228      223          3          5    1.45        333.3
4       V2-11  2 kHz  brightest 20%  5.0       NaN                9.67             8.70     15.96            3.41            0.28      6.25       233       307      168         65        139    1.06         61.7
5       V2-11  2 kHz  brightest 20%  4.0       NaN                9.67             8.70     15.96            3.41            0.28      6.25       233       331      168         65        163    1.06         61.7
6       V2-11  2 kHz  brightest 20%  5.0     -30.0                9.67             8.70     15.96            3.41            0.28      6.25       233       307      168         65        139    1.06         61.7
7       V2-11  2 kHz     ML weights  5.0       NaN                6.98             6.28      6.58            2.59            0.28      4.84       233       301      193         40        108    1.02         61.7
8       V2-14  1 kHz  brightest 20%  5.0       NaN               11.45            10.31      3.05            1.75            0.38      2.53       171       171      170          1          1    1.30         58.8
9       V2-14  1 kHz  brightest 20%  4.0       NaN               11.45            10.31      3.05            1.75            0.38      2.53       171       177      170          1          7    1.30         58.8
10      V2-14  1 kHz  brightest 20%  5.0     -30.0               11.45            10.31      3.05            1.75            0.38      2.53       171       171      170          1          1    1.30         58.8
11      V2-14  1 kHz     ML weights  5.0       NaN                7.63             6.87      2.78            1.40            0.38      2.20       171       171      171          0          0    1.20         58.8
12      V2-14  2 kHz  brightest 20%  5.0       NaN                8.73             7.86      5.00            4.02            0.21      4.60       160       164      145         15         19    0.90         46.5
13      V2-14  2 kHz  brightest 20%  4.0       NaN                8.73             7.86      5.00            4.02            0.21      4.60       160       167      145         15         22    0.90         46.5
14      V2-14  2 kHz  brightest 20%  5.0     -30.0                8.73             7.86      5.00            4.02            0.21      4.60       160       164      145         15         19    0.90         46.5
15      V2-14  2 kHz     ML weights  5.0       NaN                7.69             6.92      3.71            2.67            0.21      3.57       160       161      150         10         11    0.82         46.5
16       Cel3  1 kHz  brightest 20%  5.0       NaN               14.00            12.60      3.89            1.91            0.49      2.50        77        79       77          0          2    1.35         41.5
17       Cel3  1 kHz  brightest 20%  4.0       NaN               14.00            12.60      3.89            1.91            0.49      2.50        77        86       77          0          9    1.35         41.5
18       Cel3  1 kHz  brightest 20%  5.0     -30.0               14.00            12.60      3.89            1.91            0.49      2.50        77        79       77          0          2    1.35         41.5
19       Cel3  1 kHz     ML weights  5.0       NaN                9.49             8.54      4.25            1.88            0.49      2.41        77        79       77          0          2    1.27         41.5
20       Cel3  2 kHz  brightest 20%  5.0       NaN               11.92            10.73     17.60            3.04            0.18      5.56        81        91       76          5         15    0.95         42.0
21       Cel3  2 kHz  brightest 20%  4.0       NaN               11.92            10.73     17.60            3.04            0.18      5.56        81        96       76          5         20    0.95         42.0
22       Cel3  2 kHz  brightest 20%  5.0     -30.0               11.92            10.73     17.60            3.04            0.18      5.56        81        91       76          5         15    0.95         42.0
23       Cel3  2 kHz     ML weights  5.0       NaN               10.25             9.22     15.15            2.69            0.18      5.07        81        84       79          2          5    0.97         42.0
24      V2-10  1 kHz  brightest 20%  5.0       NaN                6.75             6.08      4.02            3.00            0.51      3.55       225       229      224          1          5    1.14         82.6
25      V2-10  1 kHz  brightest 20%  4.0       NaN                6.75             6.08      4.02            3.00            0.51      3.55       225       233      224          1          9    1.14         82.6
26      V2-10  1 kHz  brightest 20%  5.0     -30.0                6.75             6.08      4.02            3.00            0.51      3.55       225       229      224          1          5    1.14         82.6
27      V2-10  1 kHz     ML weights  5.0       NaN                3.99             3.59      3.36            2.73            0.51      3.20       225       227      223          2          4    1.07         82.6
28      V2-10  2 kHz  brightest 20%  5.0       NaN                6.81             6.12      9.97            5.16            0.14      6.08       272       265      228         44         37    0.82         90.9
29      V2-10  2 kHz  brightest 20%  4.0       NaN                6.81             6.12      9.97            5.16            0.14      6.08       272       278      232         40         46    0.82         90.9
30      V2-10  2 kHz  brightest 20%  5.0     -30.0                6.81             6.12      9.97            5.16            0.14      6.08       272       265      228         44         37    0.82         90.9
31      V2-10  2 kHz     ML weights  5.0       NaN                6.14             5.53      7.15            3.13            0.14      4.90       272       285      245         27         40    0.75         90.9
32  Cell1-ctx  1 kHz  brightest 20%  5.0       NaN               10.87             9.78      3.75            1.81            1.04      3.20        87        87       87          0          0    1.51         46.7
33  Cell1-ctx  1 kHz  brightest 20%  4.0       NaN               10.87             9.78      3.75            1.81            1.04      3.20        87        92       87          0          5    1.51         46.7
34  Cell1-ctx  1 kHz  brightest 20%  5.0     -30.0               10.87             9.78      3.75            1.81            1.04      3.20        87        87       87          0          0    1.51         46.7
35  Cell1-ctx  1 kHz     ML weights  5.0       NaN                9.70             8.73      3.57            1.60            1.04      2.91        87        88       87          0          1    1.40         46.7
36  Cell1-ctx  2 kHz  brightest 20%  5.0       NaN                9.23             8.31     14.11            3.82            0.22      6.05        88       104       73         15         31    1.19         43.7
37  Cell1-ctx  2 kHz  brightest 20%  4.0       NaN                9.23             8.31     14.11            3.82            0.22      6.05        88       112       73         15         39    1.19         43.7
38  Cell1-ctx  2 kHz  brightest 20%  5.0     -30.0                9.23             8.31     14.11            3.82            0.22      6.05        88       104       73         15         31    1.19         43.7
39  Cell1-ctx  2 kHz     ML weights  5.0       NaN                8.31             7.48      7.09            2.59            0.22      4.16        88        96       78         10         18    1.12         43.7
40      V2-12  1 kHz  brightest 20%  5.0       NaN               11.53            10.38      3.36            2.89            1.42      2.87       176       176      176          0          0    1.46         74.6
41      V2-12  1 kHz  brightest 20%  4.0       NaN               11.53            10.38      3.36            2.89            1.42      2.87       176       176      176          0          0    1.46         74.6
42      V2-12  1 kHz  brightest 20%  5.0     -30.0               11.53            10.38      3.36            2.89            1.42      2.87       176       176      176          0          0    1.46         74.6
43      V2-12  1 kHz     ML weights  5.0       NaN                7.40             6.66      3.37            2.78            1.42      2.72       176       178      173          3          5    1.39         74.6
44      V2-12  2 kHz  brightest 20%  5.0       NaN               11.18            10.06      4.37            2.81            0.28      3.61       160       173      131         29         42    1.05         63.7
45      V2-12  2 kHz  brightest 20%  4.0       NaN               11.18            10.06      4.37            2.81            0.28      3.61       160       190      131         29         59    1.05         63.7
46      V2-12  2 kHz  brightest 20%  5.0     -30.0               11.18            10.06      4.37            2.81            0.28      3.61       160       173      131         29         42    1.05         63.7
47      V2-12  2 kHz     ML weights  5.0       NaN                8.90             8.01      4.26            2.03            0.28      3.46       160       175      138         22         37    0.90         63.7
48      Cell4  1 kHz  brightest 20%  5.0       NaN               16.25            14.62      2.74            1.36            0.37      5.14       144       147      144          0          3    1.35         90.9
49      Cell4  1 kHz  brightest 20%  4.0       NaN               16.25            14.62      2.74            1.36            0.37      5.14       144       149      144          0          5    1.34         90.9
50      Cell4  1 kHz  brightest 20%  5.0     -30.0               16.25            14.62      2.74            1.36            0.37      5.14       144       147      144          0          3    1.35         90.9
51      Cell4  1 kHz     ML weights  5.0       NaN               10.74             9.67      2.56            1.18            0.37      4.80       144       147      144          0          3    1.30         90.9
52      Cell4  2 kHz  brightest 20%  5.0       NaN               17.79            16.01     13.06            1.80            0.12      4.54       165       186       84         81        102    0.86        263.2
53      Cell4  2 kHz  brightest 20%  4.0       NaN               17.79            16.01     13.06            1.80            0.12      4.54       165       199       86         79        113    0.88        263.2
54      Cell4  2 kHz  brightest 20%  5.0     -30.0               17.82            16.04     13.04            1.80            0.12      4.54       113       186       97         16         89    1.08         64.9
55      Cell4  2 kHz     ML weights  5.0       NaN               16.92            15.23      9.01            1.50            0.12      3.89       165       173       95         70         78    0.90        263.2
pixels ML weights, k=5, electrical spikes 3 ms apart:       sens_pct_per_100mV       nev_a_mV       nev_a_quiet_mV       nev_b_mV       max_rate_Hz        
                    mean   std     mean   std           mean   std     mean   std        mean     std
rate                                                                                                 
1 kHz               8.06  2.21     3.45  0.66           1.91  0.62     3.15  0.90      104.06  102.72
2 kHz               9.31  3.61     7.56  3.80           2.46  0.53     4.27  0.67       87.39   79.36
   spikes (electrical), false negatives, false positives by rate: {'1 kHz': {'e_spikes': 1106, 'false_neg': 8, 'false_pos': 20}, '2 kHz': {'e_spikes': 1159, 'false_neg': 181, 'false_pos': 297}}
pixels brightest 20%, k=4, electrical spikes 3 ms apart:       sens_pct_per_100mV       nev_a_mV       nev_a_quiet_mV       nev_b_mV      max_rate_Hz        
                    mean   std     mean   std           mean   std     mean  std        mean     std
rate                                                                                                
1 kHz              11.69  2.94     3.50  0.47           2.07  0.62     3.33  0.9      104.06  102.72
2 kHz              10.76  3.52    11.44  5.19           3.44  1.06     5.24  1.0       87.39   79.36
   spikes (electrical), false negatives, false positives by rate: {'1 kHz': {'e_spikes': 1106, 'false_neg': 6, 'false_pos': 46}, '2 kHz': {'e_spikes': 1159, 'false_neg': 248, 'false_pos': 462}}
pixels brightest 20%, k=5, electrical spikes after repolarization below -30.0 mV:       sens_pct_per_100mV       nev_a_mV       nev_a_quiet_mV       nev_b_mV      max_rate_Hz       
                    mean   std     mean   std           mean   std     mean  std        mean    std
rate                                                                                               
1 kHz              11.69  2.94     3.50  0.47           2.07  0.62     3.33  0.9       64.56  18.55
2 kHz              10.77  3.53    11.44  5.19           3.44  1.06     5.24  1.0       59.06  17.13
   spikes (electrical), false negatives, false positives by rate: {'1 kHz': {'e_spikes': 1105, 'false_neg': 5, 'false_pos': 19}, '2 kHz': {'e_spikes': 1107, 'false_neg': 189, 'false_pos': 372}}
pixels brightest 20%, k=5, electrical spikes 3 ms apart:       sens_pct_per_100mV       nev_a_mV       nev_a_quiet_mV       nev_b_mV      max_rate_Hz        
                    mean   std     mean   std           mean   std     mean  std        mean     std
rate                                                                                                
1 kHz              11.69  2.94     3.50  0.47           2.07  0.62     3.33  0.9      104.06  102.72
2 kHz              10.76  3.52    11.44  5.19           3.44  1.06     5.24  1.0       87.39   79.36
   spikes (electrical), false negatives, false positives by rate: {'1 kHz': {'e_spikes': 1106, 'false_neg': 6, 'false_pos': 19}, '2 kHz': {'e_spikes': 1159, 'false_neg': 254, 'false_pos': 385}}

Result: not reproduced. Sensitivity is 11.7 ± 2.9% per 100 mV at 1 kHz (10.8 ± 3.5% at 2 kHz), within 12 ± 1.2 on average. The noise-equivalent voltage is 3.5 ± 0.5 mV (reading a) and 3.3 ± 0.9 mV (b) at 1 kHz, against 1.2 ± 0.5, and 11.4 and 5.2 mV at 2 kHz, against 2.5 ± 0.8. At 1 kHz, 6 of 1106 electrical spikes have no optical match and 19 optical spikes have no electrical one (5 s.d.; 46 with 4 s.d.). Counting an electrical spike only after the membrane repolarized below -30 mV removes the impossible rates (largest 91 Hz; 333 and 263 Hz before) and the extra electrical spikes, and gives 1105 spikes with 5 missed and 19 added at 1 kHz, and 1107 with 189 missed and 372 added at 2 kHz, so the false detections are not an artefact of the electrical count. Two variants of the NEV were added. Reading (a) in the quietest 1 s window after the first second gives 2.1 ± 0.6 mV at 1 kHz and 3.4 ± 1.1 mV at 2 kHz with the brightest 20% of pixels, so the first second is noisier than the quietest window. The Methods' maximum-likelihood pixel weighting lowers it further, to 1.9 ± 0.6 and 2.5 ± 0.5 mV in the quiet window (3.5 ± 0.7 and 7.6 ± 3.8 mV in the first second; reading b 3.2 ± 0.9 and 4.3 ± 0.7 mV): the 2 kHz value then falls within 2.5 ± 0.8, the 1 kHz value stays above 1.2 ± 0.5. These weights also lower the sensitivity (8.1 ± 2.2% per 100 mV at 1 kHz, 9.3 ± 3.6% at 2 kHz). With them 8 spikes are missed and 20 added at 1 kHz (181 and 297 at 2 kHz). The false detections fail the criterion's zero under every reading, so the outcome does not depend on the NEV.

figs2d-frame-rate-same-sensitivity¶

Fluorescence changes for a step from -70 to +20 mV were the same at 1 kHz and 2 kHz.

The files hold current-clamp steps and ramps, not a voltage step, so the change for -70 to +20 mV is read from each cell's fluorescence-voltage relation (Fig. S2d left): the subthreshold slope times 90 mV. Two-sided paired t-test over the seven cells at 0.05. The Source Data's per-cell values (sheet Supplementary Fig 2) are printed beside, for comparison only.

In [35]:
w = s2[(s2.pixels == "brightest 20%") & (s2.k == 5.0) & s2.repol_mV.isna()].pivot(index="cell", columns="rate", values="dFF_at_20mV_pct")
print(w.round(2).to_string())
tt = stats.ttest_rel(w["1 kHz"], w["2 kHz"])
print(f"paired t-test: t = {tt.statistic:.2f}, p = {tt.pvalue:.3f}; mean difference (1 - 2 kHz) = {(w['1 kHz'] - w['2 kHz']).mean():.2f} percentage points")
sd2 = pd.read_excel(io.BytesIO(blob), sheet_name="Supplementary Fig 2", header=None).iloc[3:10, :2].astype(float)
sd2.columns = ["1 kHz", "2 kHz"]
print("Source Data, -dF/F at 20 mV (%): 1 kHz mean", round(sd2["1 kHz"].mean(), 2), "2 kHz mean", round(sd2["2 kHz"].mean(), 2),
      "; paired t-test p =", round(stats.ttest_rel(sd2["1 kHz"], sd2["2 kHz"]).pvalue, 3))
rate       1 kHz  2 kHz
cell                   
Cel3       12.60  10.73
Cell1-ctx   9.78   8.31
Cell4      14.62  16.01
V2-10       6.08   6.12
V2-11       9.89   8.70
V2-12      10.38  10.06
V2-14      10.31   7.86
paired t-test: t = 1.70, p = 0.140; mean difference (1 - 2 kHz) = 0.84 percentage points
Source Data, -dF/F at 20 mV (%): 1 kHz mean 10.85 2 kHz mean 10.93 ; paired t-test p = 0.87

Result: reproduced. The -dF/F change from -70 to +20 mV, read from each cell's subthreshold fluorescence-voltage slope, does not differ between 1 kHz and 2 kHz (paired t-test p = 0.14, mean difference 0.84 percentage points, 7 cells). Per-cell values here range from 6.1 to 16.0%; the Source Data's means are 10.85% (1 kHz) and 10.93% (2 kHz).

Summary¶

Claim Outcome
source-data-index reproduced
fig2a-dspike-dichotomy reproduced
fig2b-bimodal-distal-amplitudes blocked, methods underspecified (the two modality readings disagree)
fig2e-f-dspike-maps not reproduced
fig2h-length-constant not reproduced
fig3-subthreshold-no-dendritic-initiation not reproduced (one or two small isolated distal events)
fig3-two-motifs-location-independent not reproduced
fig3e-soma-third-bap not reproduced
fig3d-distal-first-bap blocked, methods underspecified (at the 5 s.d. that gives the legend's 84 bAPs the filter readings disagree, 32 and 31)
fig3f-soma-plus-distal not reproduced (46 of 54 beyond 300 µm; 49 to 51 between 300 and 400 µm)
fig3-predepolarization-rule not reproduced
fig1-denoising-variance blocked, methods underspecified (the share depends on the preprocessing)
fig4a-step-example reproduced
fig4d-example-alternation not reproduced
figs15-stochastic not reproduced
figs17e-ttx-high-dose blocked, methods underspecified (the filter readings disagree on baseline dSpikes)
figs18g-ba-increases-calcium-spikes reproduced
fig5a-plateau-collision not reproduced (duration 146 ms)
fig5b-supralinear-auc blocked, data missing (10 of 28 cells, shown beside the Source Data)
fig5d-single-bap-no-plateau blocked, methods underspecified (the window readings disagree; 1 of 5 cells)
figs23-dendrite-drives-soma not reproduced
figs2-imaging-fidelity not reproduced
figs2d-frame-rate-same-sensitivity reproduced
28 other claims on pooled samples blocked, data missing
fig4f-g-model-accelerometer (simulations notebook) not reproduced
figs20ab-model-patch-vs-opto (simulations notebook) reproduced
figs20-model-robustness (simulations notebook) not reproduced
figs21-izhikevich (simulations notebook, Python port) reproduced

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.

How the analysis differs from the paper's. The dandiset holds raw movies only, so every region is found here: the soma and a line along the trunk traced on the mean image (the paper drew them by hand on a structural image), with the Methods' 0.65 µm per pixel. The figure under "Where the regions lie" shows that the traced line leaves the trunk beyond about 400 µm (the mean image along it falls below the image median). Spikes are found with the claims file's rules (high-pass filter readings, a robust-s.d. somatic threshold, a trough threshold for dSpikes with FWHM < 5 ms), where the paper set its thresholds by hand. The trough is the first density minimum above the failure mode, whatever the size of the bump beyond it, so a few outlying large amplitudes also get a threshold (the table under "Other example recordings" shows how many amplitudes lie above each trough). Where the density has no minimum above the failure mode no dSpike threshold exists, and the dSpike count of that recording is treated as undefined, not as zero. The claims file's somatic threshold of 5 robust s.d. misses closely spaced spikes in the burst files (139 to 150 bAPs where the legend counts 167 and 170); 4 s.d. comes closer (161 to 167) without reaching the totals, and is adopted for the claims it changes in those files, with 5 s.d. shown. In the file of the legend's D2, 5 s.d. gives the legend's 84 bAPs exactly, and fig3d is counted there at 5 s.d. The traced line runs off the trunk beyond about 400 µm, so a distal region of 300 to 400 µm is shown beside the claims file's "beyond 300 µm". The dF/F_ref reference (10 to 20 ms after a spike) carries the stimulus-driven depolarization when bAPs come in bursts, so raw -dF/F is shown beside it. The Fig. S2 results use 7 cells, figs23 9 cells and the fig5b comparison 10 cells; every other result rests on one neuron or one example recording per claim. The number of somatic spikes found in the wide-field and drug recordings changes up to threefold with the reading (58 to 160, 71 to 132 and 18 to 62 bAPs), and no patch recording checks it there.

What was found about the dataset. The 84 files are the example recordings of the Source Data index; the pooled samples behind most statistics are not deposited. Three recordings are deposited twice. The files carry no pixel size, regions, structural images or stimulus masks; the subject of every file is the file itself (81 subjects, date of birth 1900-01-01, sex unknown), so animals and cells cannot be told apart except through file names. Frames are 1.03 ms apart (971 Hz) where the paper states 1 kHz, and 0.52 ms (1923 Hz) where it states 2 kHz. The Fig. 3 legend's D2 is the file named D4, and the Fig. 2 legend's "D1 stim" is the file named D3.