Reproducing Simmons et al. (2026) from dandiset 001777¶

Paper. Simmons DV, ..., Surmeier DJ (2026). Astrocytes mediate the dopaminergic modulation of tonic GABAergic signaling in substantia nigra. Science Advances 12, eadq8840. doi:10.1126/sciadv.adq8840. The claims file (claims/simmons-2026.yaml) was written from the version of record and its supplement.

Dandiset. DANDI:001777, version 0.260521.2201 (doi:10.48324/dandi.001777/0.260521.2201). The paper cites no dandiset version; this is the only published version, so it is pinned. The draft has the same 412 assets and size.

What the dandiset holds. 412 NWB files of SNr recordings (Clampex files converted one to one), each sweep a VoltageClampSeries in pA at 20 kHz: cell-attached spiking before and after bath drugs, and whole-cell evoked IPSCs. What each file is (virus, drugs, which file is the control) is written only in the free-text notes of each file, which the helper parses. There are no SNc recordings, no recordings at room temperature, in low glucose, with SCH39166, NPPB, or Gq-DREADD, no gabazine-then-quinpirole recordings, and no imaging, RNAscope or voltammetry.

Claim Tested here
fig1c-quinpirole-reduces-gpe-ipsc tested
fig1b-gabazine-blocks-gpe-ipsc blocked: no evoked IPSCs in gabazine
fig1e-ppr-rises tested
fig2c-quinpirole-attenuates-gpe-inhibition tested
fig2b-inhibition-wanes tested
fig3a-quinpirole-increases-rate tested
fig3b-gabazine-increases-rate tested
fig3d-gabazine-occludes-quinpirole blocked: no such recordings
figs1-gabazine-effect-vs-base-rate tested
fig4a-gpe-gi-dreadd-reduces-ipsc tested
fig4b-gpe-gi-dreadd-no-rate-change tested
figs4b-astrocyte-gq-increases-rate, figs4c-nppb-decreases-rate blocked: no such recordings
figs2a-d1-antagonist-increases-rate, figs2b-quinpirole-larger-than-d1 blocked: no SCH39166 recordings
fig5ab-aldh1a1-dendrites-in-snr blocked: no images
fig5d-shrna-higher-rate blocked: control cells not labelled (stand-ins shown as a variant)
fig5e-shrna-gabazine-no-change tested
fig5f-aldh-inhibitors-higher-rate blocked: control cells not labelled (stand-ins shown as a variant)
fig5g-disulfiram-blocks-gabazine tested
fig5h-deab-blocks-gabazine tested
fig6a-rasagiline-blocks-gabazine tested
figs3-snc-gi-dreadd-slows-snc, fig6c-snc-gi-dreadd-no-snr-change blocked: no SNc recordings (fig6c depends on figs3; its own SNr test is shown)
fig6d-gat1-enriched-aldh1a1, figs5-gat-expression-in-snc blocked: outside data, not tested
fig6e-nnc711-blocks-gabazine tested
figs8-low-glucose-blocks-gabazine blocked: no such recordings
figs9c-vigabatrin-lowers-perceval, figs9de-vigabatrin-lowers-oxphos blocked: no imaging
fig7a-d2r-in-snr-astrocytes blocked: no RNAscope
fig7d-astrocyte-gi-increases-rate tested
fig7e-gabazine-occludes-astrocyte-gi tested
fig7f-snap5114-decreases-rate tested
fig7f-snap5114-occludes-quinpirole tested
fig7h-nnc711-increases-rate tested
figs4d-room-temperature-gabazine-no-change, figs4e-temperature-reduces-gabazine-effect blocked: no room-temperature recordings
figs6-aldh1a1-ko-da-release-unchanged blocked: no voltammetry

Method common to the rate claims (claims file, M1 to M6). Spikes are detected in each sweep by threshold on the high-passed current (snr.detect_spikes; the paper used Clampfit with settings it does not give). A cell's rate in a condition is the median of its per-episode rates under two readings of the stable window: (a) all episodes, (b) for a drug the episodes from 6 min after the start of the drug's file. Percent change is given under the three readings of M2. Tests are two-sided paired t tests unless the claim names another; one-sided P and the Wilcoxon test are shown as variants. Every rate result is also shown at detection thresholds of 6 and 12 noise units, and without the seven recordings whose spikes vanish during the experiment (data check), and for the two Fig. 7F claims without an eighth found by inspection.

In [1]:
import time
import warnings

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

import snr

pd.set_option("display.width", 220)
pd.set_option("display.max_columns", 40)
pd.set_option("display.max_rows", 400)
pd.set_option("display.max_colwidth", 80)
warnings.filterwarnings("ignore", category=RuntimeWarning)

started = time.time()
assets = snr.list_assets()
meta = snr.survey(assets)
files = snr.build_files(meta)
cells = snr.build_cells(files)
F = files.set_index("path")
print(f"{len(assets)} assets in dandiset {snr.DANDISET} version {snr.VERSION}; metadata read in {time.time() - started:.0f} s")
412 assets in dandiset 001777 version 0.260521.2201; metadata read in 66 s

Data check¶

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

In [2]:
print("Files by protocol (session_description):")
print(files.protocol.value_counts().to_string())
print("\nUnits:", files.unit.unique().tolist(), "conversion:", files.conversion.unique().tolist(),
      "sampling rate (Hz):", files.rate_hz.unique().tolist())
print("Electrode location:", files.location.unique().tolist())
print("Sweep length (s) by protocol:")
print(files.assign(sweep_s=files.sweep_len / snr.FS).groupby("protocol").sweep_s.agg(["min", "max"]).to_string())
print("Sweeps per file by protocol:")
print(files.groupby("protocol").n_sweeps.agg(["min", "median", "max"]).to_string())
ep = files[files.n_sweeps > 1].assign(interval=lambda d: np.round(d.last_sweep_t0 / (d.n_sweeps - 1), 3))
print("Episodic files, sweep interval (last sweep start / (n_sweeps - 1), s) by protocol:")
print(ep.groupby("protocol").interval.agg(lambda x: sorted(set(x))).to_string())
print("\nSubjects:", files.subject.nunique(), "(dandiset metadata: 90); genotypes:", files.genotype.value_counts().to_dict())
print("Sex:", files.sex.value_counts().to_dict())
print("Temperature in the notes:", files.temperature.value_counts().to_dict(), "(paper, Methods: 32 to 33 C)")
hold = files.pnotes.str.extract(r"Holding potential (-?\d+)mV")[0]
print("Holding potential in the notes (mV):", hold.value_counts(dropna=False).to_dict())
Files by protocol (session_description):
protocol
Tonict Hold            226
ca_gap-free             69
30 Hz Light Hold        64
20 Hz Light 1 3.5 6     45
Five stim 25Hz D         8

Units: ['amperes'] conversion: [1e-12] sampling rate (Hz): [20000.0]
Electrode location: ['SNr']
Sweep length (s) by protocol:
                         min        max
protocol                               
20 Hz Light 1 3.5 6   15.000    15.0000
30 Hz Light Hold       6.000     6.0000
Five stim 25Hz D       1.000     1.0000
Tonict Hold            6.000     6.0000
ca_gap-free          180.736  1238.3232
Sweeps per file by protocol:
                     min  median  max
protocol                             
20 Hz Light 1 3.5 6    8     8.0    8
30 Hz Light Hold      43   100.0  150
Five stim 25Hz D      90   100.0  100
Tonict Hold           25   100.0  100
ca_gap-free            1     1.0    1
Episodic files, sweep interval (last sweep start / (n_sweeps - 1), s) by protocol:
protocol
20 Hz Light 1 3.5 6         [30.0]
30 Hz Light Hold       [6.0, 12.0]
Five stim 25Hz D             [5.0]
Tonict Hold                 [12.0]

Subjects: 90 (dandiset metadata: 90); genotypes: {'WT': 306, 'Wt': 90, 'DAT-Cre': 16}
Sex: {'M': 256, 'F': 156}
Temperature in the notes: {'30C': 412} (paper, Methods: 32 to 33 C)
Holding potential in the notes (mV): {'-60': 331, '-50': 26, '-55': 17, '-30': 16, '-70': 6, '-40': 6, nan: 6, '-65': 4}

The units and the sampling rate agree with the files' own description, and the 6-s "Tonict Hold" sweeps start every 12 s, as their experiment_description says. The holding potentials and temperatures in the notes are discussed under the claims that use them.

In [3]:
dups = files[files.duplicate_of.notna()]
print(f"Files whose first sweep is identical (first 4000 samples, sweep count and length) to an earlier file: {len(dups)}")
print(dups[["path", "duplicate_of"]].to_string(index=False))
same_sess = files.assign(sess=files.path.str.extract(r"(ses-\d{8}T\d{6})")[0]).groupby(["subject", "sess"]).size()
print("\nSession ids carried by two files ('obj-' suffix):", int((same_sess > 1).sum()))
multi = files.groupby("subject").date.nunique()
print("\nSubjects with recordings on more than one date (slice experiments are terminal):")
print(files[files.subject.isin(multi[multi > 1].index)][["subject", "date", "age", "experiment"]].drop_duplicates().to_string(index=False))
Files whose first sweep is identical (first 4000 samples, sweep count and length) to an earlier file: 16
                                                         path                                                  duplicate_of
 sub-4981/sub-4981_ses-20200914T164450_obj-wvemym_icephys.nwb sub-4981/sub-4981_ses-20200914T164450_obj-1unun70_icephys.nwb
 sub-4981/sub-4981_ses-20200914T165628_obj-onouyc_icephys.nwb sub-4981/sub-4981_ses-20200914T165628_obj-1njfeff_icephys.nwb
sub-4982/sub-4982_ses-20200917T160753_obj-1mlqqiu_icephys.nwb sub-4982/sub-4982_ses-20200917T160753_obj-1d7r99j_icephys.nwb
 sub-4982/sub-4982_ses-20200917T163137_obj-hnyd9a_icephys.nwb sub-4982/sub-4982_ses-20200917T163137_obj-1v4xbx4_icephys.nwb
 sub-4982/sub-4982_ses-20200917T172155_obj-fuw744_icephys.nwb sub-4982/sub-4982_ses-20200917T172155_obj-1xhjopu_icephys.nwb
sub-4982/sub-4982_ses-20200917T174629_obj-1uzay67_icephys.nwb sub-4982/sub-4982_ses-20200917T174629_obj-16wg2yv_icephys.nwb
sub-4983/sub-4983_ses-20200929T154610_obj-1k0hsvl_icephys.nwb sub-4983/sub-4983_ses-20200929T154610_obj-146daqz_icephys.nwb
 sub-4983/sub-4983_ses-20200929T161205_obj-zm90nb_icephys.nwb sub-4983/sub-4983_ses-20200929T161205_obj-1sipqcu_icephys.nwb
sub-4984/sub-4984_ses-20200923T173936_obj-1emugmh_icephys.nwb sub-4984/sub-4984_ses-20200923T173936_obj-135m613_icephys.nwb
 sub-4984/sub-4984_ses-20200923T180622_obj-wwginm_icephys.nwb  sub-4984/sub-4984_ses-20200923T180622_obj-t602ai_icephys.nwb
 sub-5011/sub-5011_ses-20201001T174639_obj-ismkqf_icephys.nwb  sub-5011/sub-5011_ses-20201001T174639_obj-amtwjr_icephys.nwb
sub-5011/sub-5011_ses-20201001T181247_obj-1yix23c_icephys.nwb sub-5011/sub-5011_ses-20201001T181247_obj-1s1w9tr_icephys.nwb
 sub-5012/sub-5012_ses-20201005T142105_obj-wrw2py_icephys.nwb sub-5012/sub-5012_ses-20201005T142105_obj-1t4rpwk_icephys.nwb
 sub-5012/sub-5012_ses-20201005T144444_obj-tzfkyb_icephys.nwb sub-5012/sub-5012_ses-20201005T144444_obj-1bc7pk7_icephys.nwb
 sub-9045/sub-9045_ses-20200909T154628_obj-twh9ci_icephys.nwb  sub-9045/sub-9045_ses-20200909T154628_obj-s5nggr_icephys.nwb
 sub-9045/sub-9045_ses-20200909T160610_obj-qykqr6_icephys.nwb sub-9045/sub-9045_ses-20200909T160610_obj-1r6uodj_icephys.nwb

Session ids carried by two files ('obj-' suffix): 16

Subjects with recordings on more than one date (slice experiments are terminal):
subject       date  age       experiment
   6806 2022-05-30 P36D disulfiram_acute
   6806 2022-06-03 P40D    deab_baseline
   6813 2022-06-10 P44D    deab_baseline
   6813 2022-06-10 P44D    deab_gabazine
   6813 2022-07-12 P76D  gpe_gi_ipsc_cno
   7321 2023-02-21 P78D         gabazine
   7321 2023-02-28 P86D         gabazine

Every pair of files with the same session id and an obj- suffix holds the same data; each is counted once. Three subject ids carry recordings on dates 4 to 32 days apart, with ages that advance with the date. Brain-slice experiments end the animal, so either the ids were reused or the dates are wrong; this is recorded as a finding and does not change the counts, which are of cells.

In [4]:
num = dict(zip(files.path, files.orig))
show = cells.copy()
for k in ["ctrl", "drug1", "drug2", "both", "unlabelled"]:
    show[k] = show[k].map(lambda l: ",".join(f"{num[p]:03d}" for p in l))
show["flags"] = cells["flags"].map(lambda l: f"{len(l)} file(s) not named in their own notes" if l else "")
print("Cells per experiment (the helper's grouping of the notes):")
print(cells.groupby("experiment").agg(cells=("cell", "size"), subjects=("subject", "nunique")).to_string())
print()
print(show[["experiment", "subject", "date", "family", "ctrl", "drug1", "drug2", "both", "unlabelled", "flags"]]
      .sort_values(["experiment", "subject", "date"]).to_string(index=False))
Cells per experiment (the helper's grouping of the notes):
                          cells  subjects
experiment                               
astro_gi_cno                 10         6
astro_gi_gabazine_cno        11         5
deab_baseline                 8         5
deab_gabazine                 5         3
disulfiram_acute              2         1
disulfiram_gabazine           3         1
gabazine                     49        25
gpe_gi_ipsc_cno               4         3
gpe_gi_rate_cno               5         4
gpe_opto_ipsc_quinpirole      6         4
gpe_train_quinpirole          8         7
nnc711                        6         4
nnc711_gabazine               6         3
quinpirole_no_opsin           7         3
rasagiline_gabazine           9         4
shrna_gabazine               15         8
snap5114                      9         4
snap5114_quinpirole          10         4
snc_gi_snr_rate_cno           8         4

              experiment subject       date   family            ctrl           drug1 drug2 both                          unlabelled                                  flags
            astro_gi_cno    8600 2024-12-07 episodic             005             006                                                                                      
            astro_gi_cno    8602 2024-12-17 episodic             000             002                                                                                      
            astro_gi_cno    8602 2024-12-17 episodic             005             006                                                                                      
            astro_gi_cno    8604 2024-12-16 episodic             000             002                                                                                      
            astro_gi_cno    8604 2024-12-16 episodic             006             008                                                                                      
            astro_gi_cno    8684 2025-01-14 episodic             001             003                                                                                      
            astro_gi_cno    8684 2025-01-14 episodic             009             011                                                                                      
            astro_gi_cno    8697 2025-01-28 episodic             000             001                                                                                      
            astro_gi_cno    8699 2025-01-23 episodic             000             001                                                                                      
            astro_gi_cno    8699 2025-01-23 episodic             005             006                                                                                      
   astro_gi_gabazine_cno    8683 2025-01-09 episodic             000             001                                                                                      
   astro_gi_gabazine_cno    8683 2025-01-09 episodic             003             004                                                                                      
   astro_gi_gabazine_cno    8683 2025-01-09 episodic             007             008                                                                                      
   astro_gi_gabazine_cno    8690 2025-01-07 episodic             000             001                                                                                      
   astro_gi_gabazine_cno    8690 2025-01-07 episodic             003             004                                                                                      
   astro_gi_gabazine_cno    8690 2025-01-07 episodic             006             007                                                                                      
   astro_gi_gabazine_cno    8700 2025-02-05 episodic             004             005                                                                                      
   astro_gi_gabazine_cno    8701 2025-02-03 episodic             000             001                                                                                      
   astro_gi_gabazine_cno    8797 2025-03-12 episodic             000             001                                                                                      
   astro_gi_gabazine_cno    8797 2025-03-12 episodic             003             004                                                                                      
   astro_gi_gabazine_cno    8797 2025-03-12 episodic             006             007                                                                                      
           deab_baseline    6805 2022-06-02 episodic             000                                                                                                      
           deab_baseline    6806 2022-06-03 episodic             001                                                                                                      
           deab_baseline    6806 2022-06-03 episodic             004                                                                                                      
           deab_baseline    6808 2022-05-31 episodic             000                                                                                                      
           deab_baseline    6812 2022-06-09 episodic             001                                                                                                      
           deab_baseline    6812 2022-06-09 episodic             003                                                                                                      
           deab_baseline    6813 2022-06-10 episodic             000                                                                                                      
           deab_baseline    6813 2022-06-10 episodic             001                                                                                                      
           deab_gabazine    6804 2022-06-08 episodic             000             001                                                                                      
           deab_gabazine    6804 2022-06-08 episodic             002             004                                                                                      
           deab_gabazine    6804 2022-06-08 episodic             005             006                                                                                      
           deab_gabazine    6812 2022-06-09 episodic             004             005                                                                                      
           deab_gabazine    6813 2022-06-10 episodic             002             004                                                                                      
        disulfiram_acute    6806 2022-05-30 episodic             002             003                                                                                      
        disulfiram_acute    6806 2022-05-30 episodic             004             005                                                                                      
     disulfiram_gabazine    6808 2022-05-31 episodic             001             002                                                                                      
     disulfiram_gabazine    6808 2022-05-31 episodic             005             006                                                                                      
     disulfiram_gabazine    6808 2022-05-31 episodic             008             010                                                                                      
                gabazine    7152 2022-11-04 episodic             002             004                                                                                      
                gabazine    7152 2022-11-04 episodic             006             008                                                                                      
                gabazine    7153 2022-11-15 episodic             000             003                                                                                      
                gabazine    7154 2022-11-03 episodic             001             002                                                                                      
                gabazine    7155 2022-11-02 episodic             001             003                                                                                      
                gabazine    7156 2022-11-08 episodic             005             006                                                                                      
                gabazine    7309 2023-01-09 episodic             000             001                                                                                      
                gabazine    7310 2023-01-06 episodic             001             002                                                                                      
                gabazine    7310 2023-01-06 episodic             004             006                                                                                      
                gabazine    7311 2023-01-10 episodic             001             002                                                                                      
                gabazine    7311 2023-01-10 episodic             003             004                                                                                      
                gabazine    7319 2023-01-30 episodic             000             001                                                                                      
                gabazine    7319 2023-01-30 episodic             003             004                                                                                      
                gabazine    7319 2023-01-30 episodic             005             006                                                                                      
                gabazine    7321 2023-02-21 episodic             000             002                                                                                      
                gabazine    7321 2023-02-28 episodic             000             001                                                                                      
                gabazine    7324 2023-02-22 episodic             004             005                                                                                      
                gabazine    7393 2023-03-17 episodic             001             003                                                                                      
                gabazine    7394 2023-03-14 episodic             000             001                                                                                      
                gabazine    7394 2023-03-14 episodic             003             005                                                                                      
                gabazine    7394 2023-03-14 episodic             006             007                                                                                      
                gabazine    7395 2023-03-23 episodic             001             003                                                                                      
                gabazine    7396 2023-03-15 episodic             000             001                                                                                      
                gabazine    7396 2023-03-15 episodic             006             007                                                                                      
                gabazine    7397 2023-03-21 episodic             004             005                                                                                      
                gabazine    7397 2023-03-21 episodic             008             010                                                                                      
                gabazine    8856 2025-04-22 gap-free             000             001                                                                                      
                gabazine    8856 2025-04-22 gap-free             000             001                                                                                      
                gabazine    8856 2025-04-22 gap-free             000             001                                                                                      
                gabazine    8858 2025-04-24 gap-free             000             001                                                                                      
                gabazine    8858 2025-04-24 gap-free             000             001                                                                                      
                gabazine    8858 2025-04-24 gap-free             000             001                                                                                      
                gabazine    8858 2025-04-24 gap-free                                        003                                                                           
                gabazine    8881 2025-04-09 gap-free             000             001                                                                                      
                gabazine    8881 2025-04-09 gap-free             000             001                                                                                      
                gabazine    8881 2025-04-09 gap-free             000             001                                                                                      
                gabazine    8943 2025-04-15 gap-free             000             001                                                                                      
                gabazine    8943 2025-04-15 gap-free             000             001                                                                                      
                gabazine    8944 2025-04-17 gap-free             000             001                                                                                      
                gabazine    8944 2025-04-17 gap-free             000             001                                                                                      
                gabazine    8944 2025-04-17 gap-free             000             001                                                                                      
                gabazine    8944 2025-04-17 gap-free             000             001                                                                                      
                gabazine    8945 2025-04-16 gap-free             001             002                                                                                      
                gabazine    8945 2025-04-16 gap-free             000             001                                                                                      
                gabazine    8952 2025-06-11 episodic             000             001                                                                                      
                gabazine    8952 2025-06-11 episodic             002             003                                                                                      
                gabazine    8952 2025-06-11 episodic             006             007                                                1 file(s) not named in their own notes
                gabazine    8954 2025-06-09 episodic             000             001                                                                                      
                gabazine    8977 2025-06-04 episodic             003             004                                                                                      
         gpe_gi_ipsc_cno    6813 2022-07-12 episodic             000             002                                                1 file(s) not named in their own notes
         gpe_gi_ipsc_cno    6887 2022-07-14 episodic             005             006                                                                                      
         gpe_gi_ipsc_cno    6921 2022-09-28 episodic             001             003                                                                                      
         gpe_gi_ipsc_cno    6921 2022-09-28 episodic             006             008                                                                                      
         gpe_gi_rate_cno    6835 2022-07-18 episodic             000             001                                                                                      
         gpe_gi_rate_cno    6835 2022-07-18 episodic             003             004                                                                                      
         gpe_gi_rate_cno    6887 2022-07-14 episodic             001             002                                                                                      
         gpe_gi_rate_cno    6917 2022-08-29 episodic             001             003                                                                                      
         gpe_gi_rate_cno    6920 2022-08-30 episodic             003             005                                                                                      
gpe_opto_ipsc_quinpirole    4881 2020-07-29 episodic     002,003,004     005,006,007                                                                                      
gpe_opto_ipsc_quinpirole    4881 2020-07-29 episodic 016,017,018,019     020,021,022                                                                                      
gpe_opto_ipsc_quinpirole    9015 2020-08-14 episodic     004,005,006 007,008,009,010                                                                                      
gpe_opto_ipsc_quinpirole    9019 2020-08-15 episodic 003,004,005,006 007,008,009,010                                                                                      
gpe_opto_ipsc_quinpirole    9019 2020-08-15 episodic                                            015,016,017,018,019,020,021,022,023 9 file(s) not named in their own notes
gpe_opto_ipsc_quinpirole    9044 2020-08-19 episodic 000,001,002,003 004,005,006,007                                                                                      
    gpe_train_quinpirole    4981 2020-09-14 episodic             001             002                                                                                      
    gpe_train_quinpirole    4982 2020-09-17 episodic             001             002                                                                                      
    gpe_train_quinpirole    4982 2020-09-17 episodic             003             004                                                                                      
    gpe_train_quinpirole    4983 2020-09-29 episodic             000             001                                                                                      
    gpe_train_quinpirole    4984 2020-09-23 episodic             000             001                                                                                      
    gpe_train_quinpirole    5011 2020-10-01 episodic             001             002                                                                                      
    gpe_train_quinpirole    5012 2020-10-05 episodic             000             001                                                                                      
    gpe_train_quinpirole    9045 2020-09-09 episodic             002             003                                                                                      
                  nnc711    9460 2026-01-28 episodic             006             007                                                                                      
                  nnc711    9461 2026-01-23 episodic             000             001                                                                                      
                  nnc711    9461 2026-01-23 episodic             007             009                                                                                      
                  nnc711    9465 2026-01-12 episodic             003             004                                                                                      
                  nnc711    9478 2026-01-08 episodic             000             001                                                                                      
                  nnc711    9478 2026-01-08 episodic             004             005                                                                                      
         nnc711_gabazine    6970 2022-09-08 episodic             000             001                                                                                      
         nnc711_gabazine    6970 2022-09-08 episodic             002             004                                                                                      
         nnc711_gabazine    6970 2022-09-08 episodic             006             007                                                                                      
         nnc711_gabazine    6988 2022-09-01 episodic             000             001                                                                                      
         nnc711_gabazine    6988 2022-09-01 episodic             003             005                                                                                      
         nnc711_gabazine    6989 2022-08-31 episodic             000             001                                                                                      
     quinpirole_no_opsin    5103 2020-11-04 episodic             000             001                                                                                      
     quinpirole_no_opsin    5103 2020-11-04 episodic             002             003                                                                                      
     quinpirole_no_opsin    5110 2020-10-20 episodic             000             002                                                                                      
     quinpirole_no_opsin    5110 2020-10-20 episodic             003             004                                                                                      
     quinpirole_no_opsin    5110 2020-10-20 episodic             005             006                                                                                      
     quinpirole_no_opsin    5116 2020-10-14 episodic             001             002                                                                                      
     quinpirole_no_opsin    5116 2020-10-14 episodic             003             004                                                                                      
     rasagiline_gabazine    5870 2021-06-16 episodic             000             001                                                                                      
     rasagiline_gabazine    5870 2021-06-16 episodic             005             006                                                                                      
     rasagiline_gabazine    5874 2021-06-15 episodic             000             001                                                                                      
     rasagiline_gabazine    5892 2021-06-29 episodic             000             001                                                                                      
     rasagiline_gabazine    5892 2021-06-29 episodic             004             006                                                                                      
     rasagiline_gabazine    5892 2021-06-29 episodic             009             010                                                                                      
     rasagiline_gabazine    5892 2021-06-29 episodic             011             012                                                                                      
     rasagiline_gabazine    5894 2021-06-23 episodic             001             002                                                                                      
     rasagiline_gabazine    5894 2021-06-23 episodic             004             005                                                                                      
          shrna_gabazine    5667 2022-10-12 episodic             001             002                                                                                      
          shrna_gabazine    5667 2022-10-12 episodic             003             004                                                                                      
          shrna_gabazine    5668 2022-10-24 episodic             002             003                                                                                      
          shrna_gabazine    5668 2022-10-24 episodic             005             006                                                                                      
          shrna_gabazine    5670 2022-10-11 episodic             001             002                                                                                      
          shrna_gabazine    5670 2022-10-11 episodic             006             007                                                                                      
          shrna_gabazine    7082 2022-11-29 episodic             001             003                                                                                      
          shrna_gabazine    7082 2022-11-29 episodic             005             007                                                                                      
          shrna_gabazine    7083 2022-11-18 episodic             000             001                                                                                      
          shrna_gabazine    7083 2022-11-18 episodic             004             006                                                                                      
          shrna_gabazine    7084 2022-11-28 episodic             002             004                                                                                      
          shrna_gabazine    7084 2022-11-28 episodic             005             007                                                                                      
          shrna_gabazine    7085 2022-12-13 episodic             000             001                                                                                      
          shrna_gabazine    7085 2022-12-13 episodic             003             004                                                                                      
          shrna_gabazine    7086 2022-11-17 episodic             001             002                                                                                      
                snap5114    8973 2025-05-21 gap-free             000             001                                                                                      
                snap5114    8973 2025-05-21 gap-free             000             001                                                                                      
                snap5114    8973 2025-05-21 gap-free             000             001                                                                                      
                snap5114    8974 2025-05-22 gap-free             000             001                                                                                      
                snap5114    8975 2025-05-20 episodic             001             003                                                                                      
                snap5114    8975 2025-05-20 gap-free             000             001                                                                                      
                snap5114    8975 2025-05-20 gap-free             000             001                                                                                      
                snap5114    8975 2025-05-20 gap-free             000             001                                                                                      
                snap5114    8979 2025-05-27 gap-free             000             001                                                                                      
     snap5114_quinpirole    8974 2025-05-22 gap-free             000             001   002                                                                                
     snap5114_quinpirole    8978 2025-05-29 episodic             006             007   008                                                                                
     snap5114_quinpirole    8978 2025-05-29 gap-free             000             001   002                                                                                
     snap5114_quinpirole    8978 2025-05-29 gap-free             000             001   002                                                                                
     snap5114_quinpirole    8979 2025-05-27 episodic             000             001   002                                                                                
     snap5114_quinpirole    8979 2025-05-27 gap-free             000             001   002                                                                                
     snap5114_quinpirole    8979 2025-05-27 gap-free             000             001   002                                                                                
     snap5114_quinpirole    8980 2025-05-28 episodic             001             003   004                                                                                
     snap5114_quinpirole    8980 2025-05-28 episodic             006             007   008                                                                                
     snap5114_quinpirole    8980 2025-05-28 gap-free             000             001   002                                                                                
     snc_gi_snr_rate_cno    0654 2022-10-05 episodic             000             002                                                                                      
     snc_gi_snr_rate_cno    0654 2022-10-05 episodic             005             007                                                                                      
     snc_gi_snr_rate_cno    0655 2022-10-08 episodic             001             003                                                                                      
     snc_gi_snr_rate_cno    0655 2022-10-08 episodic             007             008                                                                                      
     snc_gi_snr_rate_cno    8914 2022-05-19 episodic             000             001                                                                                      
     snc_gi_snr_rate_cno    8914 2022-05-19 episodic             003             005                                                                                      
     snc_gi_snr_rate_cno    8916 2022-05-23 episodic             001             003                                                                                      
     snc_gi_snr_rate_cno    8916 2022-05-23 episodic             005             007                                                                                      

The grouping follows the notes: the control file and the file the drug was applied in, by their original Clampex numbers. Three notes are inconsistent with their files: file 0007 of subject 8952 and file 0000 of subject 6813 (Five stim) are not named in their own notes, and the nine files 0015 to 0023 of subject 9019 carry the notes of files 0003 to 0010 of the same day (a second cell), so which of them were recorded in quinpirole is not stated. That cell is left out of the main IPSC analysis and shown as a variant.

The counts of cells match the paper's n for most experiments: Fig. 2C 8, Fig. 4A 4, Fig. 4B 5, Fig. 5E 15 shRNA, Fig. 5H 5, Fig. 6A 9, Fig. 6C 8, Fig. 6E 6, Fig. 7D 10, Fig. 7E 11, Fig. 7F 19, Fig. 7H 6. Disulfiram with gabazine has 3 cells against the paper's 5, quinpirole without an opsin 7 against 8 (Fig. 3A), and gabazine alone 49 against 45 (Fig. 3B legend).

In [5]:
gf = cells[cells.family == "gap-free"]
rows = []
for _, c in gf.iterrows():
    for role in ["ctrl", "drug1", "drug2", "both"]:
        for p in c[role]:
            rows.append(dict(cell=c["cell"], experiment=c["experiment"], role=role, file=f"{num[p]:04d}",
                             start=F.loc[p, "start"].strftime("%Y-%m-%d %H:%M:%S"),
                             minutes=round(F.loc[p, "sweep_len"] / snr.FS / 60, 1)))
gfr = pd.DataFrame(rows)
end = pd.to_datetime(gfr.start) + pd.to_timedelta(gfr.minutes * 60, unit="s")
gfr["gap_after_previous_file_s"] = np.where(gfr.cell == gfr.cell.shift(), (pd.to_datetime(gfr.start) - end.shift()).dt.total_seconds().round(0), np.nan)
print(f"Gap-free files ({len(gfr)}) grouped by cell, in order of start time; the gap is from the end of the cell's previous file:")
print(gfr.to_string(index=False))
g = gfr.gap_after_previous_file_s.dropna()
print(f"Gaps between the files of one cell: {len(g)}, from {g.min():.0f} to {g.max():.0f} s")
print("\nNotes of each gap-free cell (from its first file), which name its control and drug files:")
for _, c in gf.iterrows():
    p = (c["ctrl"] + c["both"] + c["drug1"])[0]
    print(f"{c['cell']}: {F.loc[p, 'pnotes']}")
Gap-free files (69) grouped by cell, in order of start time; the gap is from the end of the cell's previous file:
               cell          experiment  role file               start  minutes  gap_after_previous_file_s
8856-2025-04-22-124            gabazine  ctrl 0000 2025-04-22 14:49:12     11.5                        NaN
8856-2025-04-22-124            gabazine drug1 0001 2025-04-22 15:00:49     12.1                        7.0
8856-2025-04-22-125            gabazine  ctrl 0000 2025-04-22 16:07:15     12.1                        NaN
8856-2025-04-22-125            gabazine drug1 0001 2025-04-22 16:19:31     12.0                       10.0
8856-2025-04-22-126            gabazine  ctrl 0000 2025-04-22 18:02:45     13.1                        NaN
8856-2025-04-22-126            gabazine drug1 0001 2025-04-22 18:16:41     12.0                       50.0
8858-2025-04-24-127            gabazine  ctrl 0000 2025-04-24 12:10:07     10.1                        NaN
8858-2025-04-24-127            gabazine drug1 0001 2025-04-24 12:21:28     11.1                       75.0
8858-2025-04-24-128            gabazine  ctrl 0000 2025-04-24 14:03:16     11.6                        NaN
8858-2025-04-24-128            gabazine drug1 0001 2025-04-24 14:15:02     12.1                       10.0
8858-2025-04-24-129            gabazine  ctrl 0000 2025-04-24 16:30:10     12.8                        NaN
8858-2025-04-24-129            gabazine drug1 0001 2025-04-24 16:44:18     12.1                       80.0
8858-2025-04-24-130            gabazine  both 0003 2025-04-24 17:57:10     10.0                        NaN
8881-2025-04-09-131            gabazine  ctrl 0000 2025-04-09 14:17:18      5.0                        NaN
8881-2025-04-09-131            gabazine drug1 0001 2025-04-09 14:22:29     10.0                       11.0
8881-2025-04-09-132            gabazine  ctrl 0000 2025-04-09 15:30:54     10.0                        NaN
8881-2025-04-09-132            gabazine drug1 0001 2025-04-09 15:41:11     17.5                       17.0
8881-2025-04-09-133            gabazine  ctrl 0000 2025-04-09 16:47:36     12.5                        NaN
8881-2025-04-09-133            gabazine drug1 0001 2025-04-09 17:00:12     10.9                        6.0
8943-2025-04-15-138            gabazine  ctrl 0000 2025-04-15 14:28:29      9.5                        NaN
8943-2025-04-15-138            gabazine drug1 0001 2025-04-15 14:38:07     16.7                        8.0
8943-2025-04-15-139            gabazine  ctrl 0000 2025-04-15 16:12:00     10.1                        NaN
8943-2025-04-15-139            gabazine drug1 0001 2025-04-15 16:22:16     20.6                       10.0
8944-2025-04-17-140            gabazine  ctrl 0000 2025-04-17 13:43:06     15.5                        NaN
8944-2025-04-17-140            gabazine drug1 0001 2025-04-17 13:59:08     15.0                       32.0
8944-2025-04-17-141            gabazine  ctrl 0000 2025-04-17 16:03:40     15.0                        NaN
8944-2025-04-17-141            gabazine drug1 0001 2025-04-17 16:18:51     16.8                       11.0
8944-2025-04-17-142            gabazine  ctrl 0000 2025-04-17 16:57:31     15.7                        NaN
8944-2025-04-17-142            gabazine drug1 0001 2025-04-17 17:13:18     15.1                        5.0
8944-2025-04-17-143            gabazine  ctrl 0000 2025-04-17 18:01:19     10.2                        NaN
8944-2025-04-17-143            gabazine drug1 0001 2025-04-17 18:11:43     15.0                       12.0
8945-2025-04-16-144            gabazine  ctrl 0001 2025-04-16 16:18:16     12.0                        NaN
8945-2025-04-16-144            gabazine drug1 0002 2025-04-16 16:30:29     14.0                       13.0
8945-2025-04-16-145            gabazine  ctrl 0000 2025-04-16 17:38:40     10.0                        NaN
8945-2025-04-16-145            gabazine drug1 0001 2025-04-16 17:48:52     16.3                       12.0
8973-2025-05-21-150            snap5114  ctrl 0000 2025-05-21 14:32:01     10.2                        NaN
8973-2025-05-21-150            snap5114 drug1 0001 2025-05-21 14:42:44     16.8                       31.0
8973-2025-05-21-151            snap5114  ctrl 0000 2025-05-21 16:17:51     12.6                        NaN
8973-2025-05-21-151            snap5114 drug1 0001 2025-05-21 16:30:36     13.4                        9.0
8973-2025-05-21-152            snap5114  ctrl 0000 2025-05-21 17:29:41     10.7                        NaN
8973-2025-05-21-152            snap5114 drug1 0001 2025-05-21 17:40:32     15.1                        9.0
8974-2025-05-22-153            snap5114  ctrl 0000 2025-05-22 14:54:34     10.4                        NaN
8974-2025-05-22-153            snap5114 drug1 0001 2025-05-22 15:05:05     12.1                        7.0
8974-2025-05-22-154 snap5114_quinpirole  ctrl 0000 2025-05-22 17:26:38     10.1                        NaN
8974-2025-05-22-154 snap5114_quinpirole drug1 0001 2025-05-22 17:36:54     12.1                       10.0
8974-2025-05-22-154 snap5114_quinpirole drug2 0002 2025-05-22 17:49:08     16.1                        8.0
8975-2025-05-20-156            snap5114  ctrl 0000 2025-05-20 15:09:08     10.6                        NaN
8975-2025-05-20-156            snap5114 drug1 0001 2025-05-20 15:20:03     15.1                       19.0
8975-2025-05-20-157            snap5114  ctrl 0000 2025-05-20 16:26:46     10.1                        NaN
8975-2025-05-20-157            snap5114 drug1 0001 2025-05-20 16:37:02     12.3                       10.0
8975-2025-05-20-158            snap5114  ctrl 0000 2025-05-20 17:15:59     10.1                        NaN
8975-2025-05-20-158            snap5114 drug1 0001 2025-05-20 17:26:13     12.5                        8.0
8978-2025-05-29-161 snap5114_quinpirole  ctrl 0000 2025-05-29 15:33:22     10.1                        NaN
8978-2025-05-29-161 snap5114_quinpirole drug1 0001 2025-05-29 15:43:36     12.0                        8.0
8978-2025-05-29-161 snap5114_quinpirole drug2 0002 2025-05-29 15:55:45     15.0                        9.0
8978-2025-05-29-162 snap5114_quinpirole  ctrl 0000 2025-05-29 18:05:29     10.1                        NaN
8978-2025-05-29-162 snap5114_quinpirole drug1 0001 2025-05-29 18:15:44     12.7                        9.0
8978-2025-05-29-162 snap5114_quinpirole drug2 0002 2025-05-29 18:28:33     13.2                        7.0
8979-2025-05-27-163            snap5114  ctrl 0000 2025-05-27 14:23:16      3.0                        NaN
8979-2025-05-27-163            snap5114 drug1 0001 2025-05-27 14:26:23     12.7                        7.0
8979-2025-05-27-165 snap5114_quinpirole  ctrl 0000 2025-05-27 15:10:30     10.1                        NaN
8979-2025-05-27-165 snap5114_quinpirole drug1 0001 2025-05-27 15:20:49     10.2                       13.0
8979-2025-05-27-165 snap5114_quinpirole drug2 0002 2025-05-27 15:31:14     11.0                       13.0
8979-2025-05-27-166 snap5114_quinpirole  ctrl 0000 2025-05-27 16:29:57     10.3                        NaN
8979-2025-05-27-166 snap5114_quinpirole drug1 0001 2025-05-27 16:40:31     13.5                       16.0
8979-2025-05-27-166 snap5114_quinpirole drug2 0002 2025-05-27 16:54:09     12.7                        8.0
8980-2025-05-28-169 snap5114_quinpirole  ctrl 0000 2025-05-28 14:42:22     10.1                        NaN
8980-2025-05-28-169 snap5114_quinpirole drug1 0001 2025-05-28 14:52:34     10.5                        6.0
8980-2025-05-28-169 snap5114_quinpirole drug2 0002 2025-05-28 15:03:10     14.2                        6.0
Gaps between the files of one cell: 37, from 5 to 80 s

Notes of each gap-free cell (from its first file), which name its control and drug files:
8856-2025-04-22-124: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 480s to 600s in File 000. Gabazine bath applied in File 001. Gabazine Rate Measurement from 480s to 600 in File 001. Pipette solution: aCSF. Temperature: 30C.
8856-2025-04-22-125: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 480s to 600s in File 000. Gabazine bath applied in File 001. Gabazine Rate Measurement from 480s to 600 in File 001. Pipette solution: aCSF. Temperature: 30C.
8856-2025-04-22-126: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 480s to 600s in File 000. Gabazine bath applied in File 001. Gabazine Rate Measurement from 480s to 600 in File 001. Pipette solution: aCSF. Temperature: 30C.
8858-2025-04-24-127: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 480s to 600s in File 000. Gabazine bath applied in File 001. Gabazine Rate Measurement from 540s to 660 in File 001. Pipette solution: aCSF. Temperature: 30C.
8858-2025-04-24-128: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 480s to 600s in File 000. Gabazine bath applied in File 001. Gabazine Rate Measurement from 480s to 600 in File 001. Pipette solution: aCSF. Temperature: 30C.
8858-2025-04-24-129: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 480s to 600s in File 000. Gabazine bath applied in File 001. Gabazine Rate Measurement from 600s to 720 in File 001. Pipette solution: aCSF. Temperature: 30C.
8858-2025-04-24-130: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 003. Baseline Rate Measurement from 0s to 60s in File 003. Gabazine bath applied in File 003. Gabazine Rate Measurement from 540s to 600 in File 003. Pipette solution: aCSF. Temperature: 30C.
8881-2025-04-09-131: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CGP55845 in File 000. Gabazine bath applied in Episode 001. Pipette solution: CsMeSO3/CsCl. Temperature: 30C.
8881-2025-04-09-132: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Gabazine bath applied in Episode 001. Pipette solution: CsMeSO3/CsCl. Temperature: 30C.
8881-2025-04-09-133: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Gabazine bath applied in Episode 001. Pipette solution: CsMeSO3/CsCl. Temperature: 30C.
8943-2025-04-15-138: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 420s to 540s in File 000. Gabazine bath applied in File 001. Gabazine Rate Measurement from 720s to 840s in File 001. Pipette solution: aCSF. Temperature: 30C.
8943-2025-04-15-139: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 480s to 600s in File 000. Gabazine bath applied in File 001. Gabazine Rate Measurement from 1080s to 1200s in File 001. Pipette solution: aCSF. Temperature: 30C.
8944-2025-04-17-140: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 480s to 600s in File 000. Gabazine bath applied in File 001. Gabazine Rate Measurement from 600s to 720 in File 001. Pipette solution: aCSF. Temperature: 30C.
8944-2025-04-17-141: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 480s to 600s in File 000. Gabazine bath applied in File 001. Gabazine Rate Measurement from 660s to 780 in File 001. Pipette solution: aCSF. Temperature: 30C.
8944-2025-04-17-142: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 780s to 900s in File 000. Gabazine bath applied in File 001. Gabazine Rate Measurement from 780s to 900 in File 001. Pipette solution: aCSF. Temperature: 30C.
8944-2025-04-17-143: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 480s to 600s in File 000. Gabazine bath applied in File 001. Gabazine Rate Measurement from 780s to 900 in File 001. Pipette solution: aCSF. Temperature: 30C.
8945-2025-04-16-144: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 300s to 420s in File 001. Gabazine bath applied in File 001. Gabazine Rate Measurement from 720s to 840s in File 002. Pipette solution: aCSF. Temperature: 30C.
8945-2025-04-16-145: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 480s to 600s in File 000. Gabazine bath applied in File 001. Gabazine Rate Measurement from 780s to 900 in File 001. Pipette solution: aCSF. Temperature: 30C.
8973-2025-05-21-150: Cell attached voltage clamp. Holding potential -60mV. Bath solution: aCSF (File 000). 20uM SNAP-5114 bath applied (File 001). Pipette solution: aCSF. Temperature: 30C.
8973-2025-05-21-151: Cell attached voltage clamp. Holding potential -60mV. Bath solution: aCSF (File 000). 20uM SNAP-5114 bath applied (File 001). Pipette solution: aCSF. Temperature: 30C.
8973-2025-05-21-152: Cell attached voltage clamp. Holding potential -60mV. Bath solution: aCSF (File 000). 20uM SNAP-5114 bath applied (File 001). Pipette solution: aCSF. Temperature: 30C.
8974-2025-05-22-153: Cell attached voltage clamp. Holding potential -60mV. Bath solution: aCSF (File 000). 20uM SNAP-5114 bath applied (File 001). Pipette solution: aCSF. Temperature: 30C.
8974-2025-05-22-154: Cell attached voltage clamp. Holding potential -60mV. Bath solution: aCSF (File 000). 20uM SNAP-5114 bath applied (File 001). 10 uM Quinpirole bath applied (File 002). Pipette solution: aCSF. Temperature: 30C.
8975-2025-05-20-156: Cell attached voltage clamp. Holding potential -60mV. Bath solution: aCSF (File 000). 20uM SNAP-5114 bath applied (File 001). Pipette solution: aCSF. Temperature: 30C.
8975-2025-05-20-157: Cell attached voltage clamp. Holding potential -60mV. Bath solution: aCSF (File 000). 20uM SNAP-5114 bath applied (File 001). Pipette solution: aCSF. Temperature: 30C.
8975-2025-05-20-158: Cell attached voltage clamp. Holding potential -60mV. Bath solution: aCSF (File 000). 20uM SNAP-5114 bath applied (File 001). Pipette solution: aCSF. Temperature: 30C.
8978-2025-05-29-161: Cell attached voltage clamp. Holding potential -60mV. Bath solution: aCSF (File 000). 20uM SNAP-5114 bath applied (File 001). 10 uM Quinpirole bath applied (File 002). Pipette solution: aCSF. Temperature: 30C.
8978-2025-05-29-162: Cell attached voltage clamp. Holding potential -60mV. Bath solution: aCSF (File 000). 20uM SNAP-5114 bath applied (File 001). 10 uM Quinpirole bath applied (File 002). Pipette solution: aCSF. Temperature: 30C.
8979-2025-05-27-163: Cell attached voltage clamp. Holding potential -60mV. Bath solution: aCSF (File 000). 20uM SNAP-5114 bath applied (File 001). Pipette solution: aCSF. Temperature: 30C.
8979-2025-05-27-165: Cell attached voltage clamp. Holding potential -60mV. Bath solution: aCSF (File 000). 20uM SNAP-5114 bath applied (File 001). 10 uM Quinpirole bath applied (File 002). Pipette solution: aCSF. Temperature: 30C.
8979-2025-05-27-166: Cell attached voltage clamp. Holding potential -60mV. Bath solution: aCSF (File 000). 20uM SNAP-5114 bath applied (File 001). 10 uM Quinpirole bath applied (File 002). Pipette solution: aCSF. Temperature: 30C.
8980-2025-05-28-169: Cell attached voltage clamp. Holding potential -60mV. Bath solution: aCSF (File 000). 20uM SNAP-5114 bath applied (File 001). 10 uM Quinpirole bath applied (File 002). Pipette solution: aCSF. Temperature: 30C.

Spike detection¶

The rate claims rest on spike detection. The next cell detects spikes in every sweep of the cell-attached files (about ten minutes) and shows, on two sweeps of each experiment, the amplitudes of the threshold crossings in noise units: in most files noise events sit below about 8 and action currents above about 10, which is why 8 is the main threshold.

In [6]:
t = time.time()
rate_exps = [e for e in cells.experiment.unique() if not e.startswith(("gpe_opto", "gpe_gi_ipsc"))]
rate_paths = sorted({p for _, r in cells[cells.experiment.isin(rate_exps)].iterrows()
                     for k in ["ctrl", "drug1", "drug2", "both"] for p in r[k]})
spikes = snr.all_spikes([F.loc[p, "asset_id"] for p in rate_paths])
import resource
print(f"spikes detected in {len(rate_paths)} files in {time.time() - t:.0f} s; "
      f"peak memory of workers {resource.getrusage(resource.RUSAGE_CHILDREN).ru_maxrss / 1e6:.2f} GB")
spikes detected in 343 files in 500 s; peak memory of workers 1.40 GB
In [7]:
import h5py, remfile
from scipy import signal as _sig
rows = []
for exp in sorted(rate_exps):
    c = cells[cells.experiment == exp].iloc[0]
    p = (c["ctrl"] or c["both"])[0]
    f = h5py.File(remfile.File(snr.asset_url(F.loc[p, "asset_id"])), "r")
    a = f["acquisition"]
    key = sorted(a)[0]
    x = a[key]["data"][: int(60 * snr.FS)].astype(float)
    y = _sig.sosfiltfilt(snr._SOS, x)
    noise = np.median(np.abs(y)) / 0.6745
    pol = spikes[F.loc[p, "asset_id"]]["polarity"]
    idx, _, _ = snr.detect_spikes(x, 4.0, pol)
    z = np.array([(pol * y[i:i + 40]).max() for i in idx]) / noise
    h = np.histogram(z, bins=[4, 6, 8, 10, 15, 30, 1e9])[0]
    rows.append(dict(experiment=exp, file=p.split("/")[1][:34], noise_pA=round(noise, 2), polarity=pol,
                     **{f"z{a}-{b}": n for a, b, n in zip([4, 6, 8, 10, 15, 30], [6, 8, 10, 15, 30, "inf"], h)}))
print("Crossings of 4 noise units in the first sweep (or first 60 s) of one control file per experiment, by peak amplitude in noise units:")
print(pd.DataFrame(rows).to_string(index=False))
Crossings of 4 noise units in the first sweep (or first 60 s) of one control file per experiment, by peak amplitude in noise units:
           experiment                               file  noise_pA  polarity  z4-6  z6-8  z8-10  z10-15  z15-30  z30-inf
         astro_gi_cno sub-8600_ses-20241207T183206_iceph      5.22        -1     2     0      0       0       0      259
astro_gi_gabazine_cno sub-8683_ses-20250109T143651_iceph      3.97        -1    60     1     11       4       0       85
        deab_baseline sub-6805_ses-20220602T173712_iceph      2.99        -1   111     2      0       0       1      104
        deab_gabazine sub-6804_ses-20220608T141141_iceph      4.48        -1     5     0      0       0       0      211
     disulfiram_acute sub-6806_ses-20220530T165439_iceph      4.87        -1     0     0      0       0       0      343
  disulfiram_gabazine sub-6808_ses-20220531T155528_iceph      2.52        -1   142     6      0       0       1      174
             gabazine sub-7152_ses-20221104T171323_iceph      3.52        -1   119     5      0       0       0       74
      gpe_gi_rate_cno sub-6835_ses-20220718T181510_iceph      4.01        -1    46     0      0       0       0       86
 gpe_train_quinpirole sub-4981_ses-20200914T164450_obj-1      3.83        -1    13     1      0       0       0      230
               nnc711 sub-9460_ses-20260128T193325_iceph      4.65        -1    85     1      0       0       0      102
      nnc711_gabazine sub-6970_ses-20220908T153054_iceph      5.09        -1     5     0      0       0       0      239
  quinpirole_no_opsin sub-5103_ses-20201104T153013_iceph      3.46        -1    25     0      0       0       0       86
  rasagiline_gabazine sub-5870_ses-20210616T182000_iceph      3.81        -1    18     0      0       0       0       91
       shrna_gabazine sub-5667_ses-20221012T182214_iceph      3.69        -1   100    11     34       1       1      122
             snap5114 sub-8973_ses-20250521T143201_iceph      0.51        -1   362    12     19       0       1      969
  snap5114_quinpirole sub-8974_ses-20250522T172638_iceph      0.45        -1    14     0      0       0       0     1212
  snc_gi_snr_rate_cno sub-0654_ses-20221005T160449_iceph      4.01        -1    55     1      0       0       0      207

In most files the crossings split into a group under 8 and a group above 10 to 15 noise units, but not in all: in the shRNA, SNAP-5114 and astrocytic Gi-DREADD with gabazine files above, many crossings lie between 8 and 10, so there is no clean gap at 8 everywhere. The rate results below are repeated at 6 and 12, and every cell's rates at the three thresholds are printed next.

In [8]:
def rates(reading="a", k=snr.K_THRESH, window=None, note_windows=False, exps=None, cl=None):
    cl = cells if cl is None else cl
    if exps is not None:
        cl = cl[cl.experiment.isin(exps)]
    return snr.cell_rates(cl, F, spikes, reading=reading, k=k, window=window, note_windows=note_windows)


def summarize(exps, a="ctrl", b="drug1", window=None, readings=("a", "b"), ks=snr.THRESHOLDS, cl=None, note_windows=False):
    out = []
    for r in readings:
        for k in ks:
            d = rates(r, k, window, note_windows, exps, cl)
            s = snr.paired_summary(d, a, b)
            out.append(dict(reading=r, k=k, **s))
    return pd.DataFrame(out)


def by_subject(d, a="ctrl", b="drug1"):
    g = d.dropna(subset=[a, b]).groupby("subject")
    return pd.DataFrame({"cells": g.size(), f"{a}_mean": g[a].mean(), f"{b}_mean": g[b].mean(),
                         "cells_up": g.apply(lambda x: int((x[b] > x[a]).sum()))})


all_rates = rates("a", exps=rate_exps)
print("Rates (Hz, reading a, threshold 8) by experiment: median and range of control rates")
print(all_rates.groupby("experiment").ctrl.describe()[["count", "min", "50%", "max"]].round(1).to_string())
Rates (Hz, reading a, threshold 8) by experiment: median and range of control rates
                       count   min   50%   max
experiment                                    
astro_gi_cno            10.0   8.0  11.4  28.1
astro_gi_gabazine_cno   11.0  10.5  18.7  33.0
deab_baseline            8.0  13.5  20.4  31.7
deab_gabazine            5.0  11.5  17.0  29.7
disulfiram_acute         2.0  17.3  23.5  29.8
disulfiram_gabazine      3.0  17.2  18.6  20.5
gabazine                49.0   5.0  21.0  50.2
gpe_gi_rate_cno          5.0   8.0  14.9  55.3
gpe_train_quinpirole     8.0   7.3  12.0  47.8
nnc711                   6.0  13.8  26.2  36.5
nnc711_gabazine          6.0  14.2  19.5  23.6
quinpirole_no_opsin      7.0  12.3  23.3  42.8
rasagiline_gabazine      9.0   6.7  15.3  28.2
shrna_gabazine          15.0  12.3  27.2  39.4
snap5114                 9.0  16.5  28.0  51.7
snap5114_quinpirole     10.0  13.6  26.2  50.5
snc_gi_snr_rate_cno      8.0   8.3  15.8  36.8

Detection threshold and failed recordings¶

Every cell's rate in each condition at the three thresholds (reading a), so that the cells whose rate depends on the threshold can be seen. Then the cells whose rate in a condition falls under a quarter of their rate in the condition before (snr.failed_cells, under either reading of M1), with the time course of their rate and of the amplitude of the threshold crossings.

In [9]:
side = {k: rates("a", k, exps=rate_exps) for k in snr.THRESHOLDS}
tab = side[snr.K_THRESH][["cell", "experiment"]].copy()
for cond in ["ctrl", "drug1", "drug2"]:
    for k in snr.THRESHOLDS:
        tab[f"{cond}_k{k:g}"] = side[k][cond].round(2)
tab = tab.dropna(axis=1, how="all")
print("Rate (Hz, reading a) of every cell at thresholds 6, 8 and 12:")
print(tab.sort_values(["experiment", "cell"]).to_string(index=False))
spread = pd.concat([(side[6.0][c] - side[12.0][c]).abs() / side[8.0][c].clip(lower=1) for c in ["ctrl", "drug1", "drug2"]], axis=1).max(1)
print(f"\nCells in which some condition's rate differs by more than 25% between thresholds 6 and 12: "
      f"{int((spread > 0.25).sum())} of {len(spread)}")
print(tab[spread.to_numpy() > 0.25].to_string(index=False))
Rate (Hz, reading a) of every cell at thresholds 6, 8 and 12:
               cell            experiment  ctrl_k6  ctrl_k8  ctrl_k12  drug1_k6  drug1_k8  drug1_k12  drug2_k6  drug2_k8  drug2_k12
8600-2024-12-07-103          astro_gi_cno    26.33    26.33     26.33     33.25     33.25      33.25       NaN       NaN        NaN
8602-2024-12-17-104          astro_gi_cno     8.00     8.00      8.00     12.00     11.00      11.00       NaN       NaN        NaN
8602-2024-12-17-105          astro_gi_cno    11.42     9.83      9.83     15.83     13.00      12.83       NaN       NaN        NaN
8604-2024-12-16-106          astro_gi_cno    12.00    11.92     11.83     38.00     24.25      24.00       NaN       NaN        NaN
8604-2024-12-16-107          astro_gi_cno     9.17     9.00      8.92     11.67     11.50      11.50       NaN       NaN        NaN
8684-2025-01-14-111          astro_gi_cno    10.92    10.83     10.83      9.17      8.33       8.33       NaN       NaN        NaN
8684-2025-01-14-112          astro_gi_cno     9.67     9.33      9.33     12.83     12.67      12.67       NaN       NaN        NaN
8697-2025-01-28-116          astro_gi_cno    29.67    28.08     27.75     38.50     38.33      38.25       NaN       NaN        NaN
8699-2025-01-23-117          astro_gi_cno    16.08    16.00     16.00     13.17     13.17      13.17       NaN       NaN        NaN
8699-2025-01-23-118          astro_gi_cno    14.17    14.17     14.17     13.33     13.17      13.17       NaN       NaN        NaN
8683-2025-01-09-108 astro_gi_gabazine_cno    14.92    14.83     14.83     15.17     15.17      15.17       NaN       NaN        NaN
8683-2025-01-09-109 astro_gi_gabazine_cno    18.17    18.17     18.17     21.17     21.00      21.00       NaN       NaN        NaN
8683-2025-01-09-110 astro_gi_gabazine_cno    21.17    21.00     21.00     22.17     21.75      21.75       NaN       NaN        NaN
8690-2025-01-07-113 astro_gi_gabazine_cno    19.67    19.58     19.58     19.67     18.50      18.50       NaN       NaN        NaN
8690-2025-01-07-114 astro_gi_gabazine_cno    10.67    10.50     10.50     10.50      9.00       9.00       NaN       NaN        NaN
8690-2025-01-07-115 astro_gi_gabazine_cno    16.58    16.33     16.33     20.50     19.42      19.42       NaN       NaN        NaN
8700-2025-02-05-119 astro_gi_gabazine_cno    28.33    28.33     28.33     32.33     32.25      32.25       NaN       NaN        NaN
8701-2025-02-03-120 astro_gi_gabazine_cno    13.17    13.17     13.17     13.00     12.92      12.92       NaN       NaN        NaN
8797-2025-03-12-121 astro_gi_gabazine_cno    33.00    33.00     33.00     36.83     36.67      36.67       NaN       NaN        NaN
8797-2025-03-12-122 astro_gi_gabazine_cno    32.67    29.17     29.00     26.58     25.67      25.67       NaN       NaN        NaN
8797-2025-03-12-123 astro_gi_gabazine_cno    20.17    18.67     18.50     19.67     18.50      18.50       NaN       NaN        NaN
 6805-2022-06-02-38         deab_baseline    17.33    17.17     17.17       NaN       NaN        NaN       NaN       NaN        NaN
 6806-2022-06-03-41         deab_baseline    17.67    17.42     14.92       NaN       NaN        NaN       NaN       NaN        NaN
 6806-2022-06-03-42         deab_baseline    14.58    13.50     12.67       NaN       NaN        NaN       NaN       NaN        NaN
 6808-2022-05-31-43         deab_baseline    31.67    31.67     31.67       NaN       NaN        NaN       NaN       NaN        NaN
 6812-2022-06-09-47         deab_baseline    20.83    20.67     20.67       NaN       NaN        NaN       NaN       NaN        NaN
 6812-2022-06-09-48         deab_baseline    23.17    20.17      0.17       NaN       NaN        NaN       NaN       NaN        NaN
 6813-2022-06-10-50         deab_baseline    21.00    21.00     21.00       NaN       NaN        NaN       NaN       NaN        NaN
 6813-2022-06-10-51         deab_baseline    25.33    25.08     24.92       NaN       NaN        NaN       NaN       NaN        NaN
 6804-2022-06-08-35         deab_gabazine    29.67    29.67     27.50     23.50     23.50      23.42       NaN       NaN        NaN
 6804-2022-06-08-36         deab_gabazine    11.67    11.50     11.33     14.50     14.50      12.83       NaN       NaN        NaN
 6804-2022-06-08-37         deab_gabazine    26.17    25.67     25.67     23.42     22.92      22.92       NaN       NaN        NaN
 6812-2022-06-09-49         deab_gabazine    18.33    17.00     10.83     11.83      0.50       0.00       NaN       NaN        NaN
 6813-2022-06-10-52         deab_gabazine    16.67    16.42     16.17     14.17     13.83       8.58       NaN       NaN        NaN
 6806-2022-05-30-39      disulfiram_acute    29.75    29.75     29.75     28.67     28.50      28.50       NaN       NaN        NaN
 6806-2022-05-30-40      disulfiram_acute    18.75    17.33     17.33     15.33     14.17      14.17       NaN       NaN        NaN
 6808-2022-05-31-44   disulfiram_gabazine    22.17    20.50     19.92     22.33     14.83       0.00       NaN       NaN        NaN
 6808-2022-05-31-45   disulfiram_gabazine    23.83    18.58      0.08      2.67      0.00       0.00       NaN       NaN        NaN
 6808-2022-05-31-46   disulfiram_gabazine    17.42    17.17     17.08     17.00     16.75      16.67       NaN       NaN        NaN
 7152-2022-11-04-77              gabazine    13.83    12.83     12.83     17.00     16.50      16.50       NaN       NaN        NaN
 7152-2022-11-04-78              gabazine    14.00    12.58     12.58     19.83     19.17      19.17       NaN       NaN        NaN
 7153-2022-11-15-79              gabazine    21.25    21.00     20.92     29.58     29.58      29.50       NaN       NaN        NaN
 7154-2022-11-03-80              gabazine    31.42    31.08     31.08     29.83     29.33      29.33       NaN       NaN        NaN
 7155-2022-11-02-81              gabazine    16.75    11.00     10.83     20.17     15.58      15.50       NaN       NaN        NaN
 7156-2022-11-08-82              gabazine    20.83    14.75     14.67     23.67     18.33      18.33       NaN       NaN        NaN
 7309-2023-01-09-83              gabazine    30.33    29.33     29.33     37.33     37.00      37.00       NaN       NaN        NaN
 7310-2023-01-06-84              gabazine     5.83     5.67      5.67      1.33      0.00       0.00       NaN       NaN        NaN
 7310-2023-01-06-85              gabazine    24.00    24.00     24.00     32.25     32.25      32.25       NaN       NaN        NaN
 7311-2023-01-10-86              gabazine     9.25     9.00      8.83     18.33     18.17      17.67       NaN       NaN        NaN
 7311-2023-01-10-87              gabazine    27.75    27.75     27.75     28.50     28.42      28.42       NaN       NaN        NaN
 7319-2023-01-30-88              gabazine    21.50    21.33     21.33     13.25     13.17      13.08       NaN       NaN        NaN
 7319-2023-01-30-89              gabazine    14.50    12.83     12.67     16.08     14.67      14.67       NaN       NaN        NaN
 7319-2023-01-30-90              gabazine    36.33    34.33      0.17     32.17     31.83       0.33       NaN       NaN        NaN
 7321-2023-02-21-91              gabazine    21.00    21.00     20.83     24.83     24.50       4.50       NaN       NaN        NaN
 7321-2023-02-28-92              gabazine    24.75    24.75     24.67     24.50     24.50      24.50       NaN       NaN        NaN
 7324-2023-02-22-93              gabazine    22.17    22.17     22.17      3.50      0.17       0.00       NaN       NaN        NaN
 7393-2023-03-17-94              gabazine    10.42     8.17      8.17     18.50     12.00      11.83       NaN       NaN        NaN
 7394-2023-03-14-95              gabazine    25.25    25.00     25.00     25.17     25.00       6.33       NaN       NaN        NaN
 7394-2023-03-14-96              gabazine    22.33    22.25     22.17     27.17     27.17      27.17       NaN       NaN        NaN
 7394-2023-03-14-97              gabazine    20.50    20.17     20.17     18.33     18.33      18.33       NaN       NaN        NaN
 7395-2023-03-23-98              gabazine     8.00     8.00      8.00      9.50      9.50       9.50       NaN       NaN        NaN
7396-2023-03-15-100              gabazine     8.50     8.50      8.33      9.83      9.67       9.67       NaN       NaN        NaN
 7396-2023-03-15-99              gabazine    30.67    30.67     30.58     32.17     32.00      32.00       NaN       NaN        NaN
7397-2023-03-21-101              gabazine    15.17    13.50     13.50     21.25     13.00      13.00       NaN       NaN        NaN
7397-2023-03-21-102              gabazine    25.42    24.33     24.33     23.67     22.58      22.50       NaN       NaN        NaN
8856-2025-04-22-124              gabazine    38.33    38.33     38.17     42.67     42.67      42.67       NaN       NaN        NaN
8856-2025-04-22-125              gabazine    31.67    31.50     31.50     33.75     32.92      32.92       NaN       NaN        NaN
8856-2025-04-22-126              gabazine    31.50    31.50     31.50     37.17     37.17      37.17       NaN       NaN        NaN
8858-2025-04-24-127              gabazine    37.67    37.67     37.67     41.00     41.00      41.00       NaN       NaN        NaN
8858-2025-04-24-128              gabazine    13.83    13.83     13.83     15.67     15.67      15.67       NaN       NaN        NaN
8858-2025-04-24-129              gabazine    21.33    21.17     21.17     30.17     30.17      30.17       NaN       NaN        NaN
8858-2025-04-24-130              gabazine    14.33    14.33     14.33     15.67     15.42      15.25       NaN       NaN        NaN
8881-2025-04-09-131              gabazine     5.00     5.00      5.00      5.00      5.00       5.00       NaN       NaN        NaN
8881-2025-04-09-132              gabazine    50.17    50.17     48.75     39.92     39.92      39.92       NaN       NaN        NaN
8881-2025-04-09-133              gabazine    13.83    13.83     13.83      5.67      5.67       5.67       NaN       NaN        NaN
8943-2025-04-15-138              gabazine    19.83    19.75     19.75     21.50     21.50      21.33       NaN       NaN        NaN
8943-2025-04-15-139              gabazine    19.50    19.50     19.50     23.58     23.50      23.50       NaN       NaN        NaN
8944-2025-04-17-140              gabazine    19.33    19.33     19.33     19.50     19.08      19.00       NaN       NaN        NaN
8944-2025-04-17-141              gabazine    10.00    10.00     10.00      9.33      9.33       9.33       NaN       NaN        NaN
8944-2025-04-17-142              gabazine    11.50    11.33     11.08     13.17     13.00      13.00       NaN       NaN        NaN
8944-2025-04-17-143              gabazine    44.17    44.17     44.17     52.17     52.00      52.00       NaN       NaN        NaN
8945-2025-04-16-144              gabazine    23.33    23.33     23.33     24.33     24.33      24.33       NaN       NaN        NaN
8945-2025-04-16-145              gabazine    16.33    16.00     16.00     19.33     19.00      19.00       NaN       NaN        NaN
8952-2025-06-11-146              gabazine    24.00    22.33     22.33     25.83     25.42      25.42       NaN       NaN        NaN
8952-2025-06-11-147              gabazine    24.17    24.17     24.17     23.67     23.58      23.58       NaN       NaN        NaN
8952-2025-06-11-148              gabazine    10.67    10.67     10.67      9.00      9.00       9.00       NaN       NaN        NaN
8954-2025-06-09-149              gabazine    35.83    35.33     35.33     31.08     31.00      31.00       NaN       NaN        NaN
8977-2025-06-04-159              gabazine    40.92    40.83     40.83     42.50     42.50      42.50       NaN       NaN        NaN
 6835-2022-07-18-54       gpe_gi_rate_cno    14.83    14.75     14.75     11.92     11.83      11.83       NaN       NaN        NaN
 6835-2022-07-18-55       gpe_gi_rate_cno    15.33    14.92     13.75     10.33     10.17      10.17       NaN       NaN        NaN
 6887-2022-07-14-57       gpe_gi_rate_cno    16.67    16.50      6.50     17.17     16.50       0.42       NaN       NaN        NaN
 6917-2022-08-29-58       gpe_gi_rate_cno    57.17    55.33     28.58     54.00     27.50      27.17       NaN       NaN        NaN
 6920-2022-08-30-59       gpe_gi_rate_cno     8.83     8.00      8.00     10.17      9.33       9.33       NaN       NaN        NaN
  4981-2020-09-14-6  gpe_train_quinpirole    47.83    47.83     47.67     35.83     35.67      35.67       NaN       NaN        NaN
  4982-2020-09-17-7  gpe_train_quinpirole    11.33    11.17     11.17     15.33     15.33      15.33       NaN       NaN        NaN
  4982-2020-09-17-8  gpe_train_quinpirole    14.00    14.00     14.00     13.92     13.83      13.83       NaN       NaN        NaN
  4983-2020-09-29-9  gpe_train_quinpirole     7.67     7.67      7.67      5.50      5.33       5.25       NaN       NaN        NaN
 4984-2020-09-23-10  gpe_train_quinpirole     7.33     7.33      7.33      8.92      8.67       8.67       NaN       NaN        NaN
 5011-2020-10-01-11  gpe_train_quinpirole    12.17    11.92     11.75     28.50     28.50      28.50       NaN       NaN        NaN
 5012-2020-10-05-12  gpe_train_quinpirole    12.17    12.17     12.17     25.75     25.75      25.67       NaN       NaN        NaN
9045-2020-09-09-174  gpe_train_quinpirole    26.50    26.50     26.33     46.17     45.83      45.83       NaN       NaN        NaN
9460-2026-01-28-175                nnc711    25.33    25.33     25.33     37.67     37.67      37.67       NaN       NaN        NaN
9461-2026-01-23-176                nnc711    14.92    14.25     14.25     22.58     22.50      22.50       NaN       NaN        NaN
9461-2026-01-23-177                nnc711    27.17    27.08     27.08     36.67     36.67      36.67       NaN       NaN        NaN
9465-2026-01-12-178                nnc711    35.17    35.17     35.17     38.00     38.00      38.00       NaN       NaN        NaN
9478-2026-01-08-179                nnc711    14.50    13.83     13.83     15.50     15.17      15.17       NaN       NaN        NaN
9478-2026-01-08-180                nnc711    40.17    36.50     36.33     47.50     42.50      42.33       NaN       NaN        NaN
 6970-2022-09-08-62       nnc711_gabazine    23.67    23.58     23.58     20.25     20.08      20.08       NaN       NaN        NaN
 6970-2022-09-08-63       nnc711_gabazine    20.83    20.83     20.83     21.67     21.33      21.33       NaN       NaN        NaN
 6970-2022-09-08-64       nnc711_gabazine    16.17    14.67     14.67     15.83     14.67      14.67       NaN       NaN        NaN
 6988-2022-09-01-65       nnc711_gabazine    14.25    14.17     14.17     10.00      9.67       9.67       NaN       NaN        NaN
 6988-2022-09-01-66       nnc711_gabazine    21.33    21.00     21.00     34.00     34.00      34.00       NaN       NaN        NaN
 6989-2022-08-31-67       nnc711_gabazine    18.17    18.17     18.17      6.92      6.83       6.83       NaN       NaN        NaN
 5103-2020-11-04-13   quinpirole_no_opsin    12.33    12.33     12.33     11.17     11.17      11.17       NaN       NaN        NaN
 5103-2020-11-04-14   quinpirole_no_opsin    13.67    12.67     12.67     13.75     12.67      12.67       NaN       NaN        NaN
 5110-2020-10-20-15   quinpirole_no_opsin    23.33    23.33     23.17      3.92      0.00       0.00       NaN       NaN        NaN
 5110-2020-10-20-16   quinpirole_no_opsin    13.83    13.83     13.83     11.50     11.50      11.50       NaN       NaN        NaN
 5110-2020-10-20-17   quinpirole_no_opsin    42.75    42.75     42.75     45.92     45.92      45.92       NaN       NaN        NaN
 5116-2020-10-14-18   quinpirole_no_opsin    40.00    40.00     40.00     37.75     37.75      37.75       NaN       NaN        NaN
 5116-2020-10-14-19   quinpirole_no_opsin    28.75    28.75     28.75     28.00     28.00      27.67       NaN       NaN        NaN
 5870-2021-06-16-26   rasagiline_gabazine    15.33    15.33     15.33     16.75     16.75      16.75       NaN       NaN        NaN
 5870-2021-06-16-27   rasagiline_gabazine    26.50    26.50     26.50     20.92     20.92      20.92       NaN       NaN        NaN
 5874-2021-06-15-28   rasagiline_gabazine    14.92    14.92     14.92     14.33     14.33      14.33       NaN       NaN        NaN
 5892-2021-06-29-29   rasagiline_gabazine     6.67     6.67      6.67      7.17      7.17       7.17       NaN       NaN        NaN
 5892-2021-06-29-30   rasagiline_gabazine     7.50     7.42      7.42      6.50      6.42       1.25       NaN       NaN        NaN
 5892-2021-06-29-31   rasagiline_gabazine    20.42    20.42     20.42     15.83     15.75      15.50       NaN       NaN        NaN
 5892-2021-06-29-32   rasagiline_gabazine    13.83    13.83     13.83     11.17     11.00      11.00       NaN       NaN        NaN
 5894-2021-06-23-33   rasagiline_gabazine    28.17    28.17     28.17     24.33     24.33      24.17       NaN       NaN        NaN
 5894-2021-06-23-34   rasagiline_gabazine    20.08    20.00     20.00     22.83     22.83      22.83       NaN       NaN        NaN
 5667-2022-10-12-20        shrna_gabazine    28.33    27.67     27.67     34.42     34.17      34.08       NaN       NaN        NaN
 5667-2022-10-12-21        shrna_gabazine    39.83    38.92     38.42     38.50     37.92      37.67       NaN       NaN        NaN
 5668-2022-10-24-22        shrna_gabazine    24.50    23.67     23.67     29.42     28.67      28.67       NaN       NaN        NaN
 5668-2022-10-24-23        shrna_gabazine    32.17    31.33     31.33     33.08     32.67      32.67       NaN       NaN        NaN
 5670-2022-10-11-24        shrna_gabazine    19.33    17.17     14.33     15.33     14.33      14.33       NaN       NaN        NaN
 5670-2022-10-11-25        shrna_gabazine    13.08    12.33      2.33     10.33      9.83       4.42       NaN       NaN        NaN
 7082-2022-11-29-68        shrna_gabazine    16.50    16.50     16.33     16.67     16.67      16.67       NaN       NaN        NaN
 7082-2022-11-29-69        shrna_gabazine    39.42    39.42     39.42     34.67     34.67      34.67       NaN       NaN        NaN
 7083-2022-11-18-70        shrna_gabazine    25.83    25.08     25.08     28.67     28.25      28.25       NaN       NaN        NaN
 7083-2022-11-18-71        shrna_gabazine    32.08    31.00     31.00     44.33     44.33      42.17       NaN       NaN        NaN
 7084-2022-11-28-72        shrna_gabazine    34.00    32.67     32.67     34.33     33.33      32.58       NaN       NaN        NaN
 7084-2022-11-28-73        shrna_gabazine    31.17    31.17     31.17     26.83      3.25       0.00       NaN       NaN        NaN
 7085-2022-12-13-74        shrna_gabazine    18.33    18.33     18.33     16.83     16.83      16.83       NaN       NaN        NaN
 7085-2022-12-13-75        shrna_gabazine    45.00    27.17     22.50     42.67     25.67      21.33       NaN       NaN        NaN
 7086-2022-11-17-76        shrna_gabazine    23.17    23.08     23.08     25.33     25.33      25.33       NaN       NaN        NaN
8973-2025-05-21-150              snap5114    22.92    22.92     22.92     21.33     21.25      21.00       NaN       NaN        NaN
8973-2025-05-21-151              snap5114    19.25    19.17     19.08     22.17     22.00      22.00       NaN       NaN        NaN
8973-2025-05-21-152              snap5114    36.17    36.00     36.00     32.00     32.00      32.00       NaN       NaN        NaN
8974-2025-05-22-153              snap5114    51.67    51.67     51.67     39.17     39.17      39.17       NaN       NaN        NaN
8975-2025-05-20-155              snap5114    28.08    28.00     27.67     20.33     19.83      19.83       NaN       NaN        NaN
8975-2025-05-20-156              snap5114    24.67    24.67     24.67     23.25     22.83      21.50       NaN       NaN        NaN
8975-2025-05-20-157              snap5114    33.83    33.67     33.50     35.50     35.33      35.17       NaN       NaN        NaN
8975-2025-05-20-158              snap5114    44.67    44.67     44.67     43.00     43.00      43.00       NaN       NaN        NaN
8979-2025-05-27-163              snap5114    16.50    16.50     16.50     17.50     17.50      17.50       NaN       NaN        NaN
8974-2025-05-22-154   snap5114_quinpirole    26.17    26.17     26.17     11.33     11.33      11.25     10.83     10.83      10.83
8978-2025-05-29-160   snap5114_quinpirole    50.50    50.50     50.50     46.33     46.33      46.33     53.50     52.83      52.17
8978-2025-05-29-161   snap5114_quinpirole    25.58    24.42     22.25     31.17     27.92      26.42     30.00     29.92      29.67
8978-2025-05-29-162   snap5114_quinpirole    19.75    18.92     18.17     16.83     16.67      16.67     28.33     28.17      28.17
8979-2025-05-27-164   snap5114_quinpirole    22.83    21.50     21.50     18.50     14.33       0.17     10.17      3.75       2.92
8979-2025-05-27-165   snap5114_quinpirole    38.67    38.50     38.50     35.50     33.08      29.08     35.00     34.75      34.67
8979-2025-05-27-166   snap5114_quinpirole    26.33    26.33     26.00     25.42     25.42      25.42     25.17     25.17      25.17
8980-2025-05-28-167   snap5114_quinpirole    35.67    32.00     17.17     27.33     27.08      27.08     32.17     32.08      32.08
8980-2025-05-28-168   snap5114_quinpirole    33.67    33.00     32.67     31.67     31.33      31.33     29.33     29.33      29.33
8980-2025-05-28-169   snap5114_quinpirole    13.92    13.58     13.58     12.17      9.25       9.17      9.58      7.33       7.25
  0654-2022-10-05-0   snc_gi_snr_rate_cno    33.17    32.92     32.92     40.17     40.08      40.08       NaN       NaN        NaN
  0654-2022-10-05-1   snc_gi_snr_rate_cno    26.17    25.92     25.67     21.00     18.83       0.08       NaN       NaN        NaN
  0655-2022-10-08-2   snc_gi_snr_rate_cno    14.33    11.83     11.67     18.17     16.33      16.33       NaN       NaN        NaN
  0655-2022-10-08-3   snc_gi_snr_rate_cno    38.50    36.75     36.42     29.58     28.58      28.42       NaN       NaN        NaN
8914-2022-05-19-134   snc_gi_snr_rate_cno    12.17    12.17     12.17      8.67      8.50       8.50       NaN       NaN        NaN
8914-2022-05-19-135   snc_gi_snr_rate_cno     9.33     8.33      8.33      8.92      7.58       7.50       NaN       NaN        NaN
8916-2022-05-23-136   snc_gi_snr_rate_cno    19.42    19.42     19.42     27.33     27.17      27.17       NaN       NaN        NaN
8916-2022-05-23-137   snc_gi_snr_rate_cno    10.17     9.00      9.00     14.33     13.67      13.67       NaN       NaN        NaN

Cells in which some condition's rate differs by more than 25% between thresholds 6 and 12: 27 of 171
               cell          experiment  ctrl_k6  ctrl_k8  ctrl_k12  drug1_k6  drug1_k8  drug1_k12  drug2_k6  drug2_k8  drug2_k12
  0654-2022-10-05-1 snc_gi_snr_rate_cno    26.17    25.92     25.67     21.00     18.83       0.08       NaN       NaN        NaN
 5110-2020-10-20-15 quinpirole_no_opsin    23.33    23.33     23.17      3.92      0.00       0.00       NaN       NaN        NaN
 5670-2022-10-11-24      shrna_gabazine    19.33    17.17     14.33     15.33     14.33      14.33       NaN       NaN        NaN
 5670-2022-10-11-25      shrna_gabazine    13.08    12.33      2.33     10.33      9.83       4.42       NaN       NaN        NaN
 5892-2021-06-29-30 rasagiline_gabazine     7.50     7.42      7.42      6.50      6.42       1.25       NaN       NaN        NaN
 6808-2022-05-31-44 disulfiram_gabazine    22.17    20.50     19.92     22.33     14.83       0.00       NaN       NaN        NaN
 6808-2022-05-31-45 disulfiram_gabazine    23.83    18.58      0.08      2.67      0.00       0.00       NaN       NaN        NaN
 6812-2022-06-09-48       deab_baseline    23.17    20.17      0.17       NaN       NaN        NaN       NaN       NaN        NaN
 6812-2022-06-09-49       deab_gabazine    18.33    17.00     10.83     11.83      0.50       0.00       NaN       NaN        NaN
 6813-2022-06-10-52       deab_gabazine    16.67    16.42     16.17     14.17     13.83       8.58       NaN       NaN        NaN
 6887-2022-07-14-57     gpe_gi_rate_cno    16.67    16.50      6.50     17.17     16.50       0.42       NaN       NaN        NaN
 6917-2022-08-29-58     gpe_gi_rate_cno    57.17    55.33     28.58     54.00     27.50      27.17       NaN       NaN        NaN
 7084-2022-11-28-73      shrna_gabazine    31.17    31.17     31.17     26.83      3.25       0.00       NaN       NaN        NaN
 7085-2022-12-13-75      shrna_gabazine    45.00    27.17     22.50     42.67     25.67      21.33       NaN       NaN        NaN
 7155-2022-11-02-81            gabazine    16.75    11.00     10.83     20.17     15.58      15.50       NaN       NaN        NaN
 7156-2022-11-08-82            gabazine    20.83    14.75     14.67     23.67     18.33      18.33       NaN       NaN        NaN
 7310-2023-01-06-84            gabazine     5.83     5.67      5.67      1.33      0.00       0.00       NaN       NaN        NaN
 7319-2023-01-30-90            gabazine    36.33    34.33      0.17     32.17     31.83       0.33       NaN       NaN        NaN
 7321-2023-02-21-91            gabazine    21.00    21.00     20.83     24.83     24.50       4.50       NaN       NaN        NaN
 7324-2023-02-22-93            gabazine    22.17    22.17     22.17      3.50      0.17       0.00       NaN       NaN        NaN
 7393-2023-03-17-94            gabazine    10.42     8.17      8.17     18.50     12.00      11.83       NaN       NaN        NaN
 7394-2023-03-14-95            gabazine    25.25    25.00     25.00     25.17     25.00       6.33       NaN       NaN        NaN
7397-2023-03-21-101            gabazine    15.17    13.50     13.50     21.25     13.00      13.00       NaN       NaN        NaN
8604-2024-12-16-106        astro_gi_cno    12.00    11.92     11.83     38.00     24.25      24.00       NaN       NaN        NaN
8979-2025-05-27-164 snap5114_quinpirole    22.83    21.50     21.50     18.50     14.33       0.17     10.17      3.75       2.92
8980-2025-05-28-167 snap5114_quinpirole    35.67    32.00     17.17     27.33     27.08      27.08     32.17     32.08      32.08
8980-2025-05-28-169 snap5114_quinpirole    13.92    13.58     13.58     12.17      9.25       9.17      9.58      7.33       7.25
/tmp/ipykernel_2549/250793191.py:9: Pandas4Warning: Starting with pandas version 4.0 all arguments of max will be keyword-only.
  spread = pd.concat([(side[6.0][c] - side[12.0][c]).abs() / side[8.0][c].clip(lower=1) for c in ["ctrl", "drug1", "drug2"]], axis=1).max(1)
In [10]:
failed = snr.failed_cells([rates(r, snr.K_THRESH, exps=rate_exps) for r in ["a", "b"]])
ok_cells = cells[~cells.cell.isin(list(failed))]
print(f"Cells whose rate falls under a quarter of the condition before: {len(failed)}")
CI = cells.set_index("cell")


def time_courses(which):
    """Plot and print the rate and the crossing amplitude of each cell in `which` (cell: experiment)."""
    rows = []
    fig, axes = plt.subplots(1, len(which), figsize=(3.2 * max(len(which), 2), 3), sharey=True)
    for ax, (cell, exp) in zip(np.atleast_1d(axes), which.items()):
        c = CI.loc[cell]
        paths = c["ctrl"] + c["drug1"] + c["drug2"]
        t00 = min(F.loc[p, "start"] for p in paths)
        for role in ["ctrl", "drug1", "drug2"]:
            for p in c[role]:
                sp = spikes[F.loc[p, "asset_id"]]
                r, t = snr.episode_rates(sp, snr.K_THRESH)
                amp = snr.episode_amplitudes(sp, 6.0) / np.median(sp["noise"])
                tm = (t + (F.loc[p, "start"] - t00).total_seconds()) / 60
                ax.plot(tm, r, "k.", ms=2)
                ax2 = ax.twinx()
                ax2.plot(tm, amp, "r.", ms=2)
                ax2.set_ylim(0, 120)
                for m0 in np.arange(np.floor(tm.min() / 2) * 2, tm.max(), 2):
                    s = (tm >= m0) & (tm < m0 + 2)
                    if s.any():
                        rows.append(dict(cell=cell, experiment=exp, condition=role, file=f"{num[p]:04d}", minute=int(m0),
                                         rate_hz=round(float(r[s].mean()), 2),
                                         amp_noise_units=round(float(np.nanmedian(amp[s])), 1) if np.isfinite(amp[s]).any() else np.nan))
        ax.set_title(f"{cell}\n{exp}", fontsize=8)
        ax.set_xlabel("min from control start")
    np.atleast_1d(axes)[0].set_ylabel("rate (Hz, black)")
    plt.tight_layout()
    plt.show()
    tcf = pd.DataFrame(rows)
    print("Rate (threshold 8) and median amplitude of the threshold-6 crossings (noise units), in 2-min bins:")
    print(tcf.to_string(index=False))
    print("Plotted ranges: rate", round(float(tcf.rate_hz.min()), 1), "to", round(float(tcf.rate_hz.max()), 1),
          "Hz (2-min means; single episodes up to", round(float(max(snr.episode_rates(spikes[F.loc[p, 'asset_id']], snr.K_THRESH)[0].max()
          for cell in which for p in CI.loc[cell, 'ctrl'] + CI.loc[cell, 'drug1'] + CI.loc[cell, 'drug2'])), 1),
          "Hz); amplitude axis 0 to 120 noise units, points above it:",
          int(sum((snr.episode_amplitudes(spikes[F.loc[p, 'asset_id']], 6.0) / np.median(spikes[F.loc[p, 'asset_id']]['noise']) > 120).sum()
              for cell in which for p in CI.loc[cell, 'ctrl'] + CI.loc[cell, 'drug1'] + CI.loc[cell, 'drug2'])))


time_courses(failed)


def without_failed(exps, **kw):
    return summarize(exps, cl=ok_cells, **kw)
Cells whose rate falls under a quarter of the condition before: 7
No description has been provided for this image
Rate (threshold 8) and median amplitude of the threshold-6 crossings (noise units), in 2-min bins:
               cell            experiment condition file  minute  rate_hz  amp_noise_units
 5110-2020-10-20-15   quinpirole_no_opsin      ctrl 0000       0    26.23             18.5
 5110-2020-10-20-15   quinpirole_no_opsin      ctrl 0000       2    24.52             16.1
 5110-2020-10-20-15   quinpirole_no_opsin      ctrl 0000       4    23.83             15.2
 5110-2020-10-20-15   quinpirole_no_opsin      ctrl 0000       6    23.12             14.3
 5110-2020-10-20-15   quinpirole_no_opsin      ctrl 0000       8    21.75             10.5
 5110-2020-10-20-15   quinpirole_no_opsin      ctrl 0000      10    19.87              9.8
 5110-2020-10-20-15   quinpirole_no_opsin     drug1 0002      18     0.17              7.1
 5110-2020-10-20-15   quinpirole_no_opsin     drug1 0002      20     0.53              7.0
 5110-2020-10-20-15   quinpirole_no_opsin     drug1 0002      22     0.23              6.8
 5110-2020-10-20-15   quinpirole_no_opsin     drug1 0002      24     0.03              6.2
 5110-2020-10-20-15   quinpirole_no_opsin     drug1 0002      26     0.02              6.1
 5110-2020-10-20-15   quinpirole_no_opsin     drug1 0002      28     0.02              6.1
 5110-2020-10-20-15   quinpirole_no_opsin     drug1 0002      30     0.00              5.9
 6808-2022-05-31-45   disulfiram_gabazine      ctrl 0005       0    27.88             85.5
 6808-2022-05-31-45   disulfiram_gabazine      ctrl 0005       2    25.40             47.9
 6808-2022-05-31-45   disulfiram_gabazine      ctrl 0005       4    28.55             21.1
 6808-2022-05-31-45   disulfiram_gabazine      ctrl 0005       6    29.02             10.7
 6808-2022-05-31-45   disulfiram_gabazine      ctrl 0005       8    19.25              8.4
 6808-2022-05-31-45   disulfiram_gabazine      ctrl 0005      10    18.15              8.5
 6808-2022-05-31-45   disulfiram_gabazine      ctrl 0005      12     3.58              7.1
 6808-2022-05-31-45   disulfiram_gabazine      ctrl 0005      14     0.57              6.5
 6808-2022-05-31-45   disulfiram_gabazine      ctrl 0005      16     0.38              6.4
 6808-2022-05-31-45   disulfiram_gabazine      ctrl 0005      18     0.23              6.4
 6808-2022-05-31-45   disulfiram_gabazine     drug1 0006      20     0.31              6.4
 6808-2022-05-31-45   disulfiram_gabazine     drug1 0006      22     0.43              6.4
 6808-2022-05-31-45   disulfiram_gabazine     drug1 0006      24     0.15              6.4
 6808-2022-05-31-45   disulfiram_gabazine     drug1 0006      26     0.22              6.2
 6808-2022-05-31-45   disulfiram_gabazine     drug1 0006      28     0.17              6.4
 6808-2022-05-31-45   disulfiram_gabazine     drug1 0006      30     0.20              6.4
 6808-2022-05-31-45   disulfiram_gabazine     drug1 0006      32     0.03              6.4
 6808-2022-05-31-45   disulfiram_gabazine     drug1 0006      34     0.00              6.3
 6808-2022-05-31-45   disulfiram_gabazine     drug1 0006      36     0.00              6.4
 6812-2022-06-09-49         deab_gabazine      ctrl 0004       0    20.93             80.4
 6812-2022-06-09-49         deab_gabazine      ctrl 0004       2    17.65            105.8
 6812-2022-06-09-49         deab_gabazine      ctrl 0004       4    21.90             52.9
 6812-2022-06-09-49         deab_gabazine      ctrl 0004       6    24.25             19.1
 6812-2022-06-09-49         deab_gabazine      ctrl 0004       8    20.03             15.9
 6812-2022-06-09-49         deab_gabazine      ctrl 0004      10     7.03              6.7
 6812-2022-06-09-49         deab_gabazine      ctrl 0004      12     6.50              6.9
 6812-2022-06-09-49         deab_gabazine      ctrl 0004      14     6.85              7.6
 6812-2022-06-09-49         deab_gabazine      ctrl 0004      16     0.25              6.2
 6812-2022-06-09-49         deab_gabazine      ctrl 0004      18     0.35              6.2
 6812-2022-06-09-49         deab_gabazine     drug1 0005      20     0.17              6.3
 6812-2022-06-09-49         deab_gabazine     drug1 0005      22     0.12              6.3
 6812-2022-06-09-49         deab_gabazine     drug1 0005      24     0.08              6.3
 6812-2022-06-09-49         deab_gabazine     drug1 0005      26     0.20              6.3
 6812-2022-06-09-49         deab_gabazine     drug1 0005      28     0.50              6.6
 6812-2022-06-09-49         deab_gabazine     drug1 0005      30     1.22              6.9
 6812-2022-06-09-49         deab_gabazine     drug1 0005      32     0.48              6.7
 6812-2022-06-09-49         deab_gabazine     drug1 0005      34     0.92              6.9
 6812-2022-06-09-49         deab_gabazine     drug1 0005      36     1.32              7.0
 6812-2022-06-09-49         deab_gabazine     drug1 0005      38     3.10              7.4
 6812-2022-06-09-49         deab_gabazine     drug1 0005      40     2.13              7.1
 7084-2022-11-28-73        shrna_gabazine      ctrl 0005       0    34.15             40.8
 7084-2022-11-28-73        shrna_gabazine      ctrl 0005       2    32.70             40.9
 7084-2022-11-28-73        shrna_gabazine      ctrl 0005       4    31.93             39.8
 7084-2022-11-28-73        shrna_gabazine      ctrl 0005       6    31.27             40.0
 7084-2022-11-28-73        shrna_gabazine      ctrl 0005       8    30.75             39.3
 7084-2022-11-28-73        shrna_gabazine      ctrl 0005      10    29.88             39.9
 7084-2022-11-28-73        shrna_gabazine      ctrl 0005      12    30.67             39.6
 7084-2022-11-28-73        shrna_gabazine      ctrl 0005      14    30.65             38.6
 7084-2022-11-28-73        shrna_gabazine      ctrl 0005      16    31.07             37.0
 7084-2022-11-28-73        shrna_gabazine      ctrl 0005      18    31.53             35.5
 7084-2022-11-28-73        shrna_gabazine     drug1 0007      40    26.83              9.3
 7084-2022-11-28-73        shrna_gabazine     drug1 0007      42    24.42              8.8
 7084-2022-11-28-73        shrna_gabazine     drug1 0007      44     8.57              7.5
 7084-2022-11-28-73        shrna_gabazine     drug1 0007      46     2.93              7.0
 7084-2022-11-28-73        shrna_gabazine     drug1 0007      48     0.55              6.9
 7084-2022-11-28-73        shrna_gabazine     drug1 0007      50     0.33              6.6
 7084-2022-11-28-73        shrna_gabazine     drug1 0007      52     0.33              6.2
 7310-2023-01-06-84              gabazine      ctrl 0001       0     5.82              9.0
 7310-2023-01-06-84              gabazine      ctrl 0001       2     4.83              7.5
 7310-2023-01-06-84              gabazine      ctrl 0001       4     2.92             36.3
 7310-2023-01-06-84              gabazine      ctrl 0001       6     3.30             28.2
 7310-2023-01-06-84              gabazine      ctrl 0001       8     5.20             20.0
 7310-2023-01-06-84              gabazine      ctrl 0001      10     5.75             25.1
 7310-2023-01-06-84              gabazine      ctrl 0001      12     5.72             20.5
 7310-2023-01-06-84              gabazine      ctrl 0001      14     5.77             19.0
 7310-2023-01-06-84              gabazine      ctrl 0001      16     5.83             19.0
 7310-2023-01-06-84              gabazine      ctrl 0001      18     5.88             14.1
 7310-2023-01-06-84              gabazine     drug1 0002      20     3.05              8.1
 7310-2023-01-06-84              gabazine     drug1 0002      22     0.05              6.5
 7310-2023-01-06-84              gabazine     drug1 0002      24     0.05              6.5
 7310-2023-01-06-84              gabazine     drug1 0002      26     0.05              6.6
 7310-2023-01-06-84              gabazine     drug1 0002      28     0.00              6.3
 7310-2023-01-06-84              gabazine     drug1 0002      30     0.10              6.3
 7310-2023-01-06-84              gabazine     drug1 0002      32     0.07              6.4
 7310-2023-01-06-84              gabazine     drug1 0002      34     0.05              6.4
 7310-2023-01-06-84              gabazine     drug1 0002      36     0.07              6.4
 7310-2023-01-06-84              gabazine     drug1 0002      38     0.10              6.6
 7310-2023-01-06-84              gabazine     drug1 0002      40     0.06              6.8
 7324-2023-02-22-93              gabazine      ctrl 0004       0    31.00             27.4
 7324-2023-02-22-93              gabazine      ctrl 0004       2    28.38             24.6
 7324-2023-02-22-93              gabazine      ctrl 0004       4    25.17             24.4
 7324-2023-02-22-93              gabazine      ctrl 0004       6    23.37             25.7
 7324-2023-02-22-93              gabazine      ctrl 0004       8    22.33             25.4
 7324-2023-02-22-93              gabazine      ctrl 0004      10    21.50             31.8
 7324-2023-02-22-93              gabazine      ctrl 0004      12    20.95             32.1
 7324-2023-02-22-93              gabazine      ctrl 0004      14    20.75             31.7
 7324-2023-02-22-93              gabazine      ctrl 0004      16    19.77             32.1
 7324-2023-02-22-93              gabazine      ctrl 0004      18    19.55             25.7
 7324-2023-02-22-93              gabazine     drug1 0005      20    18.50             12.0
 7324-2023-02-22-93              gabazine     drug1 0005      22    18.33             11.2
 7324-2023-02-22-93              gabazine     drug1 0005      24    14.28             10.8
 7324-2023-02-22-93              gabazine     drug1 0005      26    15.83              8.9
 7324-2023-02-22-93              gabazine     drug1 0005      28     4.40              7.3
 7324-2023-02-22-93              gabazine     drug1 0005      30     0.17              6.4
 7324-2023-02-22-93              gabazine     drug1 0005      32     0.08              6.0
 7324-2023-02-22-93              gabazine     drug1 0005      34     0.03              6.1
 7324-2023-02-22-93              gabazine     drug1 0005      36     0.02              6.2
 7324-2023-02-22-93              gabazine     drug1 0005      38     0.03              6.0
 7324-2023-02-22-93              gabazine     drug1 0005      40     0.08              5.7
8797-2025-03-12-123 astro_gi_gabazine_cno      ctrl 0006       0    17.52             79.0
8797-2025-03-12-123 astro_gi_gabazine_cno      ctrl 0006       2    17.52             78.5
8797-2025-03-12-123 astro_gi_gabazine_cno      ctrl 0006       4    17.48             78.8
8797-2025-03-12-123 astro_gi_gabazine_cno      ctrl 0006       6    18.77             75.9
8797-2025-03-12-123 astro_gi_gabazine_cno      ctrl 0006       8    19.73             75.9
8797-2025-03-12-123 astro_gi_gabazine_cno      ctrl 0006      10    18.78             79.6
8797-2025-03-12-123 astro_gi_gabazine_cno      ctrl 0006      12    19.18             79.7
8797-2025-03-12-123 astro_gi_gabazine_cno      ctrl 0006      14    18.93             77.8
8797-2025-03-12-123 astro_gi_gabazine_cno      ctrl 0006      16    18.47             76.4
8797-2025-03-12-123 astro_gi_gabazine_cno     drug1 0007      16    18.83             71.0
8797-2025-03-12-123 astro_gi_gabazine_cno     drug1 0007      18    18.93             73.6
8797-2025-03-12-123 astro_gi_gabazine_cno     drug1 0007      20    19.90             69.8
8797-2025-03-12-123 astro_gi_gabazine_cno     drug1 0007      22     4.07              7.5
8797-2025-03-12-123 astro_gi_gabazine_cno     drug1 0007      24     2.15              7.0
8797-2025-03-12-123 astro_gi_gabazine_cno     drug1 0007      26    12.17             24.2
Plotted ranges: rate 0.0 to 34.1 Hz (2-min means; single episodes up to 34.8 Hz); amplitude axis 0 to 120 noise units, points above it: 1

Twenty-seven of 171 cells have a condition whose rate differs by more than 25% between thresholds 6 and 12; the outcomes are given at all three. Seven cells fall to under a quarter of their rate in the condition before: 5110-2020-10-20-15 (quinpirole without opsin), 6808-2022-05-31-45 (disulfiram then gabazine), 6812-2022-06-09-49 (DEAB then gabazine), 7084-2022-11-28-73 (shRNA), 7310-2023-01-06-84 and 7324-2023-02-22-93 (gabazine) and 8797-2025-03-12-123 (astrocytic Gi-DREADD, gabazine then CNO). In each, the amplitude of the crossings falls to about 6 to 7 noise units, the size of noise crossings at a threshold of 6, by the time the rate falls, so the action currents are no longer seen. In 5110-2020-10-20-15 the amplitude halves during the control file, from 18.5 to 9.8 noise units, before quinpirole. No drug in the paper changes SNr rate by more than about 50%, so these are read as recordings that failed (lost seal or cell), not as drug effects. They are kept in the main tests, as the claims file asks for every cell, and each claim that holds one of them is also given without them (ok_cells).

A cell the quarter rule does not catch¶

8979-2025-05-27-164 (SNAP-5114 then quinpirole) is not caught by the quarter rule, but its rate in SNAP-5114 falls to 0.17 Hz at threshold 12 (rates above). Its time course:

In [11]:
faded = {"8979-2025-05-27-164": "snap5114_quinpirole"}
time_courses(faded)
No description has been provided for this image
Rate (threshold 8) and median amplitude of the threshold-6 crossings (noise units), in 2-min bins:
               cell          experiment condition file  minute  rate_hz  amp_noise_units
8979-2025-05-27-164 snap5114_quinpirole      ctrl 0000       0    22.02             36.1
8979-2025-05-27-164 snap5114_quinpirole      ctrl 0000       2    21.38             36.1
8979-2025-05-27-164 snap5114_quinpirole      ctrl 0000       4    20.98             34.9
8979-2025-05-27-164 snap5114_quinpirole      ctrl 0000       6    23.13             33.8
8979-2025-05-27-164 snap5114_quinpirole      ctrl 0000       8    23.38             30.2
8979-2025-05-27-164 snap5114_quinpirole      ctrl 0000      10    21.55             23.1
8979-2025-05-27-164 snap5114_quinpirole      ctrl 0000      12    19.45             18.1
8979-2025-05-27-164 snap5114_quinpirole      ctrl 0000      14    18.45             15.4
8979-2025-05-27-164 snap5114_quinpirole      ctrl 0000      16    16.73             14.5
8979-2025-05-27-164 snap5114_quinpirole     drug1 0001      16    17.13             12.8
8979-2025-05-27-164 snap5114_quinpirole     drug1 0001      18    17.18             11.5
8979-2025-05-27-164 snap5114_quinpirole     drug1 0001      20    16.57             10.7
8979-2025-05-27-164 snap5114_quinpirole     drug1 0001      22    16.48              9.8
8979-2025-05-27-164 snap5114_quinpirole     drug1 0001      24    13.90              8.6
8979-2025-05-27-164 snap5114_quinpirole     drug1 0001      26    12.67              8.2
8979-2025-05-27-164 snap5114_quinpirole     drug1 0001      28     6.67              7.9
8979-2025-05-27-164 snap5114_quinpirole     drug1 0001      30     2.22              7.6
8979-2025-05-27-164 snap5114_quinpirole     drug1 0001      32     2.90              7.1
8979-2025-05-27-164 snap5114_quinpirole     drug2 0002      32     0.50              6.3
8979-2025-05-27-164 snap5114_quinpirole     drug2 0002      34     1.12              5.7
8979-2025-05-27-164 snap5114_quinpirole     drug2 0002      36     0.38              6.3
8979-2025-05-27-164 snap5114_quinpirole     drug2 0002      38     1.57              6.0
8979-2025-05-27-164 snap5114_quinpirole     drug2 0002      40     0.47              6.2
8979-2025-05-27-164 snap5114_quinpirole     drug2 0002      42     8.20             91.4
8979-2025-05-27-164 snap5114_quinpirole     drug2 0002      44    11.23            118.5
8979-2025-05-27-164 snap5114_quinpirole     drug2 0002      46     4.78            148.2
8979-2025-05-27-164 snap5114_quinpirole     drug2 0002      48     3.57              7.9
8979-2025-05-27-164 snap5114_quinpirole     drug2 0002      50     7.38            145.3
8979-2025-05-27-164 snap5114_quinpirole     drug2 0002      52    11.78            138.7
Plotted ranges: rate 0.4 to 23.4 Hz (2-min means; single episodes up to 24.0 Hz); amplitude axis 0 to 120 noise units, points above it: 31

In 8979-2025-05-27-164 the amplitude of the crossings falls during the control file, from 36 to 15 noise units, reaches 7 to 8 noise units, the size of noise crossings, by minute 28 in SNAP-5114, while the rate at threshold 8 falls from 17 to 2 Hz. It stays at about 6 noise units in quinpirole until minute 42, after which crossings of 90 to 150 noise units come and go (a new seal, or another cell). Its SNAP-5114 and quinpirole rates are therefore not measurements of the cell's firing; it is read as a failed recording like the seven above. It is kept in the main tests, and the two fig7f claims are also given without it.

Timing of the light train and of the evoked currents¶

There is no trial or stimulus table: the light and electrical stimuli are not stored (the stimulus series hold only a -10 mV test pulse). The timing is read from the responses. The 30-Hz train of Fig. 2 should silence spiking from 2 to 4 s of each 6-s sweep in the Chronos cells and not in the cells without an opsin; the evoked IPSCs should start at the same time in every cell.

In [12]:
def psth(paths, k=snr.K_THRESH, bins=np.arange(0, 6.0001, 0.1)):
    counts, n = np.zeros(len(bins) - 1), 0
    for p in paths:
        sp = spikes[F.loc[p, "asset_id"]]
        for t in sp["spikes"][k]:
            counts += np.histogram(t, bins)[0]
            n += 1
    return counts / n / np.diff(bins), n


bins = np.arange(0, 6.0001, 0.1)
fig, ax = plt.subplots(1, 2, figsize=(12, 3.5), sharey=True)
for i, exp in enumerate(["gpe_train_quinpirole", "quinpirole_no_opsin"]):
    rows = []
    for _, c in cells[cells.experiment == exp].iterrows():
        h, n = psth(c["ctrl"])
        rows.append(h)
        ax[i].plot(bins[:-1] + 0.05, h, lw=0.7)
    rows = np.array(rows)
    pre = rows[:, (bins[:-1] >= 1) & (bins[:-1] < 2)].mean(1)
    on = rows[:, (bins[:-1] >= 2) & (bins[:-1] < 2.2)].mean(1)
    post = rows[:, (bins[:-1] >= 4) & (bins[:-1] < 5)].mean(1)
    print(f"{exp}: control rate 1-2 s {np.round(pre, 1)} Hz; 2.0-2.2 s {np.round(on, 1)}; 4-5 s {np.round(post, 1)}")
    ax[i].set_title(exp)
    ax[i].axvspan(2, 4, color="0.9")
    ax[i].set_xlabel("time in sweep (s)")
ax[0].set_ylabel("rate (Hz)")
plt.tight_layout()
plt.show()
print("Plotted range:", 0, "to", round(float(max(psth(c["ctrl"])[0].max() for _, c in cells[cells.experiment.isin(["gpe_train_quinpirole", "quinpirole_no_opsin"])].iterrows())), 1), "Hz; no point outside the axes.")
gpe_train_quinpirole: control rate 1-2 s [50.3 14.9 17.5  9.3  7.7 13.2 15.  29.8] Hz; 2.0-2.2 s [24.9  0.6  0.2  0.4  0.2  3.2  0.8  5.2]; 4-5 s [52.2 17.  19.5 10.6  9.7 15.1 17.6 31.1]
quinpirole_no_opsin: control rate 1-2 s [12.5 11.8 23.1 13.7 45.6 41.  29.3] Hz; 2.0-2.2 s [12.2 11.4 23.7 13.5 45.9 41.1 29.2]; 4-5 s [12.5 11.8 23.1 13.6 45.9 41.  29. ]
No description has been provided for this image
Plotted range: 0 to 54.2 Hz; no point outside the axes.

In every Chronos cell the rate falls at 2.0 s and recovers by 4 s, and it does not fall in the cells without an opsin: the train runs from 2 to 4 s, as the Fig. 2 legend implies, and the spike times share the clock of the light. The timing of the evoked IPSCs is shown with their analysis.

fig1c-quinpirole-reduces-gpe-ipsc¶

The D2R agonist quinpirole (2 uM) reduces the amplitude of optogenetically evoked GPe IPSCs in SNr neurons by roughly 30%. (paired t test, P = 0.02, n = 5; expected 30 +/- 3%)

The "20 Hz Light" files hold 8 sweeps of 15 s each; a train of 0.5-ms light pulses at 20 Hz starts at 0.55 s (read from the responses below). Amplitude: peak of the mean evoked current over all sweeps of a condition, from the mean over the 20 ms before the first pulse (claims file). The peak is taken within 0.5 to 20 ms after the pulse. Its sign is fixed per cell by its control: the currents are outward in cells held at -50 to -55 mV and inward in the cell held at -70 mV (notes).

In [13]:
ipsc_cells = cells[cells.experiment == "gpe_opto_ipsc_quinpirole"].copy()
ipsc_paths = sorted({p for _, r in ipsc_cells.iterrows() for k in ["ctrl", "drug1", "unlabelled"] for p in r[k]})
t = time.time()
ipsc_X = snr.all_sweeps([F.loc[p, "asset_id"] for p in ipsc_paths], 0.50, 0.70)
print(f"read {len(ipsc_paths)} files in {time.time() - t:.0f} s")
STIM1, STIM2 = 0.55, 0.60


def cond_X(paths):
    return np.vstack([ipsc_X[F.loc[p, "asset_id"]]["X"] for p in paths])


# the unlabelled second cell of subject 9019: its notes are copies of the first cell's (files 3-6 control,
# 7-10 quinpirole); variant: the same layout shifted to its own files, 15-18 control and 19-22 quinpirole
rows = []
for _, c in ipsc_cells.iterrows():
    if c["unlabelled"]:
        ctrl = [p for p in c["unlabelled"] if 15 <= num[p] <= 18]
        drug = [p for p in c["unlabelled"] if 19 <= num[p] <= 22]
        variant_only = True
    else:
        ctrl, drug, variant_only = c["ctrl"], c["drug1"], False
    Xc, Xd = cond_X(ctrl), cond_X(drug)
    m = Xc.mean(0)
    tt = np.arange(len(m)) / snr.FS + 0.50
    seg = np.abs(m - m[(tt >= 0.53) & (tt < 0.549)].mean())
    onset = tt[(tt > 0.5505) & (seg > 0.2 * seg[(tt > 0.5505) & (tt < 0.57)].max())][0]
    a_c, sign = snr.evoked_amplitudes(Xc, 0.50, STIM1, (-0.02, -0.001), (0.0005, 0.02))
    a_d, _ = snr.evoked_amplitudes(Xd, 0.50, STIM1, (-0.02, -0.001), (0.0005, 0.02), sign)
    # paired-pulse ratio, reading (a): second peak from the baseline before the first pulse
    def second(X, base_ref):
        mm = X.mean(0)
        i = lambda s: int(round((s - 0.50) * snr.FS))
        b = mm[i(base_ref - 0.02 if base_ref == STIM1 else STIM2 - 0.002):i(base_ref - 0.001 if base_ref == STIM1 else STIM2 - 0.0001)].mean()
        seg2 = sign * (mm[i(STIM2 + 0.0005):i(STIM2 + 0.02)] - b)
        return float(seg2.max())
    rows.append(dict(cell=c["cell"], subject=c["subject"], variant_only=variant_only, sign=sign,
                     onset_ms=round(onset * 1000, 2), n_ctrl_sweeps=len(Xc), n_quin_sweeps=len(Xd),
                     amp_ctrl=a_c, amp_quin=a_d, pct_change=(a_d - a_c) / a_c * 100,
                     ppr_a_ctrl=second(Xc, STIM1) / a_c, ppr_a_quin=second(Xd, STIM1) / a_d,
                     ppr_b_ctrl=second(Xc, STIM2) / a_c, ppr_b_quin=second(Xd, STIM2) / a_d,
                     hold=F.loc[(ctrl or drug)[0], "pnotes"].split("Holding potential ")[1][:5]))
ipsc = pd.DataFrame(rows)
print(ipsc.round(3).to_string(index=False))
read 45 files in 7 s
               cell subject  variant_only  sign  onset_ms  n_ctrl_sweeps  n_quin_sweeps  amp_ctrl  amp_quin  pct_change  ppr_a_ctrl  ppr_a_quin  ppr_b_ctrl  ppr_b_quin  hold
  4881-2020-07-29-4    4881         False    -1    551.35             24             24   135.807    61.216     -54.925       0.802       0.810       0.803       0.812 -70mV
  4881-2020-07-29-5    4881         False     1    552.15             32             24   210.880   153.318     -27.296       0.900       0.912       0.882       0.900 -50mV
9015-2020-08-14-170    9015         False     1    551.20             24             32   496.548   444.997     -10.382       0.858       0.894       0.854       0.886 -50mV
9019-2020-08-15-171    9019         False     1    551.65             32             32   304.312   187.261     -38.464       0.864       0.909       0.863       0.901 -50mV
9019-2020-08-15-172    9019          True     1    551.30             32             32   227.974   204.953     -10.098       0.883       0.946       0.871       0.941 -55mV
9044-2020-08-19-173    9044         False     1    551.75             32             32   180.621   145.731     -19.317       0.918       0.962       0.902       0.947 -55mV
In [14]:
def ipsc_test(d, a, b):
    t = stats.ttest_rel(d[b], d[a])
    pc = (d[b] - d[a]) / d[a] * 100
    return dict(n=len(d), mean_a=d[a].mean(), mean_b=d[b].mean(), t=t.statistic, p=t.pvalue,
                p_less=stats.ttest_rel(d[b], d[a], alternative="less").pvalue,
                pct_a_mean_of_cells=pc.mean(), pct_b_of_means=(d[b].mean() - d[a].mean()) / d[a].mean() * 100,
                pct_c_median_of_cells=pc.median())


main = ipsc[~ipsc.variant_only]
res = pd.DataFrame([dict(cells="5 labelled cells", **ipsc_test(main, "amp_ctrl", "amp_quin")),
                    dict(cells="6 cells (variant: 9019 second cell, files 15-18 / 19-22)", **ipsc_test(ipsc, "amp_ctrl", "amp_quin"))])
print("IPSC amplitude (pA), control against quinpirole; paired t test two-sided (p) and one-sided (p_less):")
print(res.round(4).to_string(index=False))
print("\nOnset of the first evoked current, all cells:", ipsc.onset_ms.min(), "to", ipsc.onset_ms.max(), "ms")
IPSC amplitude (pA), control against quinpirole; paired t test two-sided (p) and one-sided (p_less):
                                                   cells  n   mean_a   mean_b       t      p  p_less  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells
                                        5 labelled cells  5 265.6339 198.5045 -4.7941 0.0087  0.0043             -30.0768        -25.2714               -27.2961
6 cells (variant: 9019 second cell, files 15-18 / 19-22)  6 259.3572 199.5792 -4.3979 0.0070  0.0035             -26.7470        -23.0485               -23.3066

Onset of the first evoked current, all cells: 551.2 to 552.15 ms
In [15]:
u = ipsc_cells[ipsc_cells.unlabelled.map(len) > 0].iloc[0]
rows = []
for p in u["unlabelled"]:
    X = ipsc_X[F.loc[p, "asset_id"]]["X"]
    a, s = snr.evoked_amplitudes(X, 0.50, STIM1, (-0.02, -0.001), (0.0005, 0.02), None)
    rows.append(dict(file=f"{num[p]:04d}", start=F.loc[p, "start"].strftime("%H:%M:%S"), sweeps=len(X),
                     amplitude_pA=round(a, 1), sign=s))
print(f"Second cell of subject 9019 ({u['cell']}), each file's evoked current (mean of its sweeps):")
print(pd.DataFrame(rows).to_string(index=False))
Second cell of subject 9019 (9019-2020-08-15-172), each file's evoked current (mean of its sweeps):
file    start  sweeps  amplitude_pA  sign
0015 18:35:28       8         214.3     1
0016 18:40:05       8         229.7     1
0017 18:45:16       8         224.7     1
0018 18:50:45       8         245.8     1
0019 19:00:52       8         206.2     1
0020 19:05:51       8         200.2     1
0021 19:09:51       8         209.6     1
0022 19:15:08       8         209.3     1
0023 19:20:34       8         225.1     1

Result: reproduced. In the 5 labelled cells the evoked IPSC falls from 265.6 to 198.5 pA in quinpirole (paired t test P = 0.0087), a reduction of 30.1% as the mean of the cells' changes (reading a of M2, inside 30 +/- 3), 25.3% of the group means and 27.3% as the median. With the sixth cell under the assumed file layout, P = 0.0070 and the reduction is 26.7%. The evoked currents start 1.2 to 2.2 ms after 0.55 s in every cell. In the second cell of subject 9019 every one of its nine files, 0015 to 0023, holds an evoked current of 200 to 246 pA, so none of them, file 0023 included, was recorded in gabazine. Files 0015 to 0018 are 5 min apart, then 10 min pass before 0019, which fits a drug applied between 0018 and 0019, the layout assumed for the variant.

fig1e-ppr-rises¶

Quinpirole raises the paired-pulse ratio of GPe evoked IPSCs at a 50 ms interval (paired t test, P = 0.02, n = 6).

Second pulse at 0.60 s, 50 ms after the first. Readings (claims file): (a) second peak from the baseline before the first pulse; (b) second peak from the current in the 2 ms before the second pulse. The paper's n = 6 matches the dataset's six cells only with the second cell of 9019, whose files are labelled by the shifted layout (an assumption, shown with the five labelled cells).

In [16]:
rows = []
for name, d in [("5 labelled cells", main), ("6 cells, 9019 second cell as files 15-18 / 19-22", ipsc)]:
    for r in ["a", "b"]:
        a, b = f"ppr_{r}_ctrl", f"ppr_{r}_quin"
        t = stats.ttest_rel(d[b], d[a])
        rows.append(dict(cells=name, reading=r, n=len(d), ppr_ctrl=d[a].mean(), ppr_quin=d[b].mean(),
                         cells_up=int((d[b] > d[a]).sum()), t=t.statistic, p=t.pvalue,
                         p_greater=stats.ttest_rel(d[b], d[a], alternative="greater").pvalue))
print(pd.DataFrame(rows).round(4).to_string(index=False))
                                           cells reading  n  ppr_ctrl  ppr_quin  cells_up      t      p  p_greater
                                5 labelled cells       a  5    0.8684    0.8973         5 3.6478 0.0218     0.0109
                                5 labelled cells       b  5    0.8607    0.8890         5 4.2461 0.0132     0.0066
6 cells, 9019 second cell as files 15-18 / 19-22       a  6    0.8709    0.9054         6 4.0307 0.0100     0.0050
6 cells, 9019 second cell as files 15-18 / 19-22       b  6    0.8623    0.8977         6 3.9689 0.0106     0.0053

Result: reproduced. The paired-pulse ratio rises in all 5 labelled cells, from 0.868 to 0.897 (reading a, P = 0.022) and from 0.861 to 0.889 (reading b, P = 0.013). With the sixth cell (n = 6, the paper's n) it rises in all 6 (P = 0.010 and 0.011).

fig2c-quinpirole-attenuates-gpe-inhibition¶

A 2-s, 30-Hz optogenetic train of GPe inputs inhibits SNr spiking, and quinpirole attenuates this inhibition. (Wilcoxon matched-pairs signed rank test, P = 0.02, n = 8)

Percent inhibition = (basal rate - rate in 2 to 4 s) / basal rate x 100 from each condition's PSTH over all its sweeps (claims file; code part 2). Basal: (a) 0 to 2 s; (b) 0 to 2 s and 4 to 6 s. Variant: the median over sweeps of a per-sweep percent inhibition. Both readings of M1 are run: (a) all sweeps of each condition; (b) the quinpirole sweeps from 6 min after the start of its file.

In [17]:
def inhibition(paths, k, basal, t_from=0.0):
    """Percent inhibition from the PSTH of the sweeps starting at t_from (s) or later after the
    start of the condition's first file, and the median of per-sweep percent inhibition."""
    n_sw, cb, ct, per = 0, 0, 0, []
    t_first = F.loc[paths[0], "start"]
    for p in paths:
        sp = spikes[F.loc[p, "asset_id"]]
        off = (F.loc[p, "start"] - t_first).total_seconds()
        for t, t0 in zip(sp["spikes"][k], sp["t0"]):
            if t0 + off < t_from:
                continue
            b = sum(np.sum((t >= x0) & (t < x1)) for x0, x1 in basal) / sum(x1 - x0 for x0, x1 in basal)
            tr = np.sum((t >= 2) & (t < 4)) / 2.0
            cb += b; ct += tr; n_sw += 1
            if b > 0:
                per.append((b - tr) / b * 100)
    return (cb - ct) / cb * 100, np.median(per), cb / n_sw, ct / n_sw, n_sw


tc = cells[cells.experiment == "gpe_train_quinpirole"]
res, percell = [], []
for m1, t_from in [("a", 0.0), ("b", snr.DRUG_STABLE_S)]:
    for k in snr.THRESHOLDS:
        for rd, basal in [("a", [(0, 2)]), ("b", [(0, 2), (4, 6)])]:
            rows = []
            for _, c in tc.iterrows():
                ic, icm, bc, trc, nc = inhibition(c["ctrl"], k, basal)
                iq, iqm, bq, trq, nq = inhibition(c["drug1"], k, basal, t_from)
                rows.append(dict(cell=c["cell"], subject=c["subject"], inh_ctrl=ic, inh_quin=iq, inh_ctrl_sweepmed=icm,
                                 inh_quin_sweepmed=iqm, basal_ctrl=bc, train_ctrl=trc, basal_quin=bq, train_quin=trq,
                                 sweeps_ctrl=nc, sweeps_quin=nq))
            d = pd.DataFrame(rows)
            if k == snr.K_THRESH:
                percell.append(d.assign(m1=m1, basal=rd))
            for var, a, b in [("PSTH", "inh_ctrl", "inh_quin"), ("per-sweep median", "inh_ctrl_sweepmed", "inh_quin_sweepmed")]:
                w = stats.wilcoxon(d[b], d[a])
                res.append(dict(m1=m1, k=k, basal=rd, measure=var, n=len(d), inh_ctrl=d[a].mean(), inh_quin=d[b].mean(),
                                cells_less_inhibited=int((d[b] < d[a]).sum()), p_wilcoxon=w.pvalue,
                                p_wilcoxon_less=stats.wilcoxon(d[b], d[a], alternative="less").pvalue))
print("Per cell, threshold 8 (m1: reading of M1; a, all quinpirole sweeps; b, quinpirole sweeps from 6 min):")
print(pd.concat(percell).round(1).to_string(index=False))
print()
print(pd.DataFrame(res).round(4).to_string(index=False))
Per cell, threshold 8 (m1: reading of M1; a, all quinpirole sweeps; b, quinpirole sweeps from 6 min):
               cell subject  inh_ctrl  inh_quin  inh_ctrl_sweepmed  inh_quin_sweepmed  basal_ctrl  train_ctrl  basal_quin  train_quin  sweeps_ctrl  sweeps_quin m1 basal
  4981-2020-09-14-6    4981      29.1      36.9               29.7               37.4        50.1        35.5        36.6        23.1           43           83  a     a
  4982-2020-09-17-7    4982      72.4      51.4               73.7               48.6        15.0         4.1        16.8         8.2          100          100  a     a
  4982-2020-09-17-8    4982      67.5      78.3               70.3               78.9        17.5         5.7        17.8         3.9          100          100  a     a
  4983-2020-09-29-9    4983      70.9      78.3               70.3               93.1         9.4         2.7         7.6         1.7          100          100  a     a
 4984-2020-09-23-10    4984      62.3      48.3               64.3               47.4         7.7         2.9         9.4         4.9          100          100  a     a
 5011-2020-10-01-11    5011      43.0      -3.6               48.1                7.1        13.2         7.6        28.5        29.5          100           55  a     a
 5012-2020-10-05-12    5012      73.5      37.2               74.6               38.2        15.0         4.0        28.9        18.2          100          100  a     a
9045-2020-09-09-174    9045      35.5      11.9               36.6               12.1        29.9        19.3        47.1        41.5          150          150  a     a
  4981-2020-09-14-6    4981      30.4      37.9               30.3               39.2        51.0        35.5        37.2        23.1           43           83  a     b
  4982-2020-09-17-7    4982      73.7      53.1               74.8               49.7        15.7         4.1        17.4         8.2          100          100  a     b
  4982-2020-09-17-8    4982      69.1      79.6               71.1               80.6        18.4         5.7        19.0         3.9          100          100  a     b
  4983-2020-09-29-9    4983      72.4      79.4               71.5               93.3         9.9         2.7         8.0         1.7          100          100  a     b
 4984-2020-09-23-10    4984      65.4      51.6               68.8               51.2         8.4         2.9        10.1         4.9          100          100  a     b
 5011-2020-10-01-11    5011      46.1      -2.9               51.8                7.7        14.0         7.6        28.7        29.5          100           55  a     b
 5012-2020-10-05-12    5012      75.3      38.5               76.2               38.2        16.2         4.0        29.5        18.2          100          100  a     b
9045-2020-09-09-174    9045      36.4      12.4               37.1               12.3        30.3        19.3        47.4        41.5          150          150  a     b
  4981-2020-09-14-6    4981      29.1      36.8               29.7               37.3        50.1        35.5        33.2        21.0           43           53  b     a
  4982-2020-09-17-7    4982      72.4      45.5               73.7               45.8        15.0         4.1        18.4        10.0          100           70  b     a
  4982-2020-09-17-8    4982      67.5      77.7               70.3               78.9        17.5         5.7        18.0         4.0          100           70  b     a
  4983-2020-09-29-9    4983      70.9      72.0               70.3               75.7         9.4         2.7         8.5         2.4          100           70  b     a
 4984-2020-09-23-10    4984      62.3      43.3               64.3               44.7         7.7         2.9        10.3         5.8          100           70  b     a
 5011-2020-10-01-11    5011      43.0     -20.3               48.1              -20.8        13.2         7.6        28.7        34.5          100           25  b     a
 5012-2020-10-05-12    5012      73.5      30.5               74.6               29.8        15.0         4.0        32.7        22.7          100           70  b     a
9045-2020-09-09-174    9045      35.5      11.4               36.6               11.4        29.9        19.3        48.1        42.6          150           90  b     a
  4981-2020-09-14-6    4981      30.4      37.6               30.3               38.9        51.0        35.5        33.6        21.0           43           53  b     b
  4982-2020-09-17-7    4982      73.7      47.0               74.8               47.0        15.7         4.1        18.9        10.0          100           70  b     b
  4982-2020-09-17-8    4982      69.1      79.1               71.1               80.1        18.4         5.7        19.2         4.0          100           70  b     b
  4983-2020-09-29-9    4983      72.4      73.2               71.5               76.1         9.9         2.7         8.8         2.4          100           70  b     b
 4984-2020-09-23-10    4984      65.4      46.7               68.8               46.8         8.4         2.9        10.9         5.8          100           70  b     b
 5011-2020-10-01-11    5011      46.1     -19.3               51.8              -16.2        14.0         7.6        28.9        34.5          100           25  b     b
 5012-2020-10-05-12    5012      75.3      31.5               76.2               31.2        16.2         4.0        33.2        22.7          100           70  b     b
9045-2020-09-09-174    9045      36.4      11.7               37.1               11.4        30.3        19.3        48.3        42.6          150           90  b     b

m1    k basal          measure  n  inh_ctrl  inh_quin  cells_less_inhibited  p_wilcoxon  p_wilcoxon_less
 a  6.0     a             PSTH  8   56.5505   41.8254                     5      0.1094           0.0547
 a  6.0     a per-sweep median  8   58.1072   44.3954                     5      0.1094           0.0547
 a  6.0     b             PSTH  8   58.3559   43.2436                     5      0.1094           0.0547
 a  6.0     b per-sweep median  8   59.9456   45.3884                     5      0.1094           0.0547
 a  8.0     a             PSTH  8   56.7777   42.3083                     5      0.1094           0.0547
 a  8.0     a per-sweep median  8   58.4491   45.3611                     5      0.1484           0.0742
 a  8.0     b             PSTH  8   58.6076   43.6863                     5      0.1094           0.0547
 a  8.0     b per-sweep median  8   60.2040   46.5149                     5      0.1484           0.0742
 a 12.0     a             PSTH  8   57.0351   42.2764                     5      0.1094           0.0547
 a 12.0     a per-sweep median  8   58.6337   45.4380                     5      0.1484           0.0742
 a 12.0     b             PSTH  8   58.7287   43.6974                     5      0.1094           0.0547
 a 12.0     b per-sweep median  8   60.4737   46.4788                     5      0.1484           0.0742
 b  6.0     a             PSTH  8   56.5505   36.5621                     6      0.0781           0.0391
 b  6.0     a per-sweep median  8   58.1072   37.1912                     5      0.1094           0.0547
 b  6.0     b             PSTH  8   58.3559   37.9969                     6      0.0781           0.0391
 b  6.0     b per-sweep median  8   59.9456   39.1006                     5      0.1094           0.0547
 b  8.0     a             PSTH  8   56.7777   37.1208                     5      0.1094           0.0547
 b  8.0     a per-sweep median  8   58.4491   37.8621                     5      0.1094           0.0547
 b  8.0     b             PSTH  8   58.6076   38.4392                     5      0.1094           0.0547
 b  8.0     b per-sweep median  8   60.2040   39.4119                     5      0.1094           0.0547
 b 12.0     a             PSTH  8   57.0351   36.8569                     5      0.1094           0.0547
 b 12.0     a per-sweep median  8   58.6337   37.4514                     5      0.1094           0.0547
 b 12.0     b             PSTH  8   58.7287   38.2558                     5      0.1094           0.0547
 b 12.0     b per-sweep median  8   60.4737   39.1807                     5      0.1094           0.0547

Result: not reproduced. The mean percent inhibition falls from 56.8 to 42.3 in quinpirole (PSTH, basal 0 to 2 s, all sweeps), less inhibition in 5 of 8 cells, but the Wilcoxon test gives P = 0.11 under both readings of the basal window, at every threshold, and P = 0.11 to 0.15 for the per-sweep variant. Under reading b of M1 (quinpirole sweeps from 6 min) the inhibition in quinpirole is 37.1 (basal a), and the test gives P = 0.078 to 0.11 at every threshold and basal window (one-sided 0.039 to 0.055). The direction matches the paper; no two-sided test reaches P < 0.05.

fig2b-inhibition-wanes¶

The GPe train initially suppresses SNr spiking strongly, and the inhibition wanes during the 2-s train.

From each cell's control PSTH, the rate in 2.0 to 2.5 s against 3.5 to 4.0 s (claims file).

In [18]:
rows = []
for k in snr.THRESHOLDS:
    pooled_first = pooled_last = 0
    nsw = 0
    up = 0
    per = []
    for _, c in tc.iterrows():
        f1 = l1 = n = 0
        for p in c["ctrl"]:
            for t in spikes[F.loc[p, "asset_id"]]["spikes"][k]:
                f1 += np.sum((t >= 2.0) & (t < 2.5)); l1 += np.sum((t >= 3.5) & (t < 4.0)); n += 1
        per.append((c["cell"], f1 / n / 0.5, l1 / n / 0.5))
        up += l1 > f1
        pooled_first += f1; pooled_last += l1; nsw += n
    rows.append(dict(k=k, cells=len(tc), pooled_rate_first=pooled_first / nsw / 0.5, pooled_rate_last=pooled_last / nsw / 0.5,
                     cells_last_higher=up))
    if k == snr.K_THRESH:
        print(pd.DataFrame(per, columns=["cell", "rate_2.0-2.5", "rate_3.5-4.0"]).round(2).to_string(index=False))
print(pd.DataFrame(rows).round(2).to_string(index=False))
               cell  rate_2.0-2.5  rate_3.5-4.0
  4981-2020-09-14-6         30.09         38.37
  4982-2020-09-17-7          1.96          5.56
  4982-2020-09-17-8          1.38          8.90
  4983-2020-09-29-9          1.18          3.50
 4984-2020-09-23-10          0.96          4.48
 5011-2020-10-01-11          4.10          9.68
 5012-2020-10-05-12          1.80          5.50
9045-2020-09-09-174          6.33         26.57
   k  cells  pooled_rate_first  pooled_rate_last  cells_last_higher
 6.0      8               4.35             11.92                  8
 8.0      8               4.26             11.85                  8
12.0      8               4.17             11.70                  8

Result: reproduced. In the PSTH pooled over the 8 cells the rate in the first 0.5 s of the train is 4.26 Hz and in the last 0.5 s 11.85 Hz (threshold 8), and the last window is higher in 8 of 8 cells, at every threshold.

fig3a-quinpirole-increases-rate¶

Quinpirole alone, with no GPe stimulation, raises the basal spike rate of SNr neurons, by about 50% in cell-attached recordings. (paired t test, P < 0.01, n = 8; expected 50 +/- 5%)

Which cells: the Results say the rise was seen "in these experiments" (the Fig. 2 recordings) "in the absence of GPe axon stimulation". The dataset has two sets that fit: (i) 7 cells recorded with the same 30 Hz light protocol in mice with no opsin (no virus in the notes), rate over the whole sweep; (ii) the 8 Chronos cells of Fig. 2, rate over 0 to 2 s, before the train. Both are run.

In [19]:
for name, exps, window in [("(i) no opsin, whole sweep", ["quinpirole_no_opsin"], None),
                           ("(ii) Fig. 2 Chronos cells, 0-2 s", ["gpe_train_quinpirole"], (0.0, 2.0))]:
    print(name)
    print(summarize(exps, window=window).round(4).to_string(index=False))
    d = rates("a", exps=exps, window=window)
    print(d[["cell", "ctrl", "drug1"]].round(2).to_string(index=False))
    print(by_subject(d).round(2).to_string())
    print("Without the failed recordings:")
    print(without_failed(exps, window=window).round(4).to_string(index=False))
    print()
(i) no opsin, whole sweep
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff       t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0  7           3    24.9524     21.7143    -3.2381 -1.1621      0.2893              0.8553           0.1447      0.2969             -15.6797        -12.9771                -5.6250            0
      a  8.0  7           3    24.8095     21.0000    -3.8095 -1.1445      0.2960              0.8520           0.1480      0.3125             -18.1647        -15.3551                -5.6250            0
      a 12.0  7           3    24.7857     20.9524    -3.8333 -1.1622      0.2893              0.8554           0.1446      0.3125             -18.3304        -15.4659                -5.6250            0
      b  6.0  7           3    24.9524     20.4643    -4.4881 -1.4943      0.1857              0.9071           0.0929      0.0469             -21.3829        -17.9866                -8.1081            0
      b  8.0  7           3    24.8095     20.2024    -4.6071 -1.4521      0.1967              0.9017           0.0983      0.0469             -21.9345        -18.5701                -8.1081            0
      b 12.0  7           3    24.7857     20.2024    -4.5833 -1.4554      0.1958              0.9021           0.0979      0.0469             -21.9345        -18.4918                -8.1081            0
              cell  ctrl  drug1
5103-2020-11-04-13 12.33  11.17
5103-2020-11-04-14 12.67  12.67
5110-2020-10-20-15 23.33   0.00
5110-2020-10-20-16 13.83  11.50
5110-2020-10-20-17 42.75  45.92
5116-2020-10-14-18 40.00  37.75
5116-2020-10-14-19 28.75  28.00
         cells  ctrl_mean  drug1_mean  cells_up
subject                                        
5103         2      12.50       11.92         0
5110         3      26.64       19.14         1
5116         2      34.38       32.88         0
Without the failed recordings:
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff       t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0  6           3    25.2222     24.6806    -0.5417 -0.6520      0.5432              0.7284           0.2716      0.5625              -4.4239         -2.1476                -4.1168            0
      a  8.0  6           3    25.0556     24.5000    -0.5556 -0.6703      0.5324              0.7338           0.2662      0.6250              -4.5255         -2.2173                -4.1168            0
      a 12.0  6           3    25.0556     24.4444    -0.6111 -0.7334      0.4962              0.7519           0.2481      0.6250              -4.7188         -2.4390                -4.6966            0
      b  6.0  6           3    25.2222     23.6806    -1.5417 -2.2361      0.0756              0.9622           0.0378      0.0938              -9.1134         -6.1123                -7.9671            0
      b  8.0  6           3    25.0556     23.5694    -1.4861 -2.2025      0.0788              0.9606           0.0394      0.0938              -8.9235         -5.9313                -7.9671            0
      b 12.0  6           3    25.0556     23.5694    -1.4861 -2.2025      0.0788              0.9606           0.0394      0.0938              -8.9235         -5.9313                -7.9671            0

(ii) Fig. 2 Chronos cells, 0-2 s
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff      t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0  8           7    20.2188     25.0625     4.8438 1.3270      0.2262              0.1131           0.8869      0.1953              32.9020         23.9567                19.1684            0
      a  8.0  8           7    20.2188     24.8750     4.6562 1.2693      0.2449              0.1225           0.8775      0.1953              31.8394         23.0294                16.2272            0
      a 12.0  8           7    20.1562     24.8125     4.6562 1.2560      0.2494              0.1247           0.8753      0.1953              32.2591         23.1008                18.3824            0
      b  6.0  8           7    20.2188     26.3125     6.0938 1.4455      0.1916              0.0958           0.9042      0.1406              43.2854         30.1391                25.5578            0
      b  8.0  8           7    20.2188     26.2500     6.0312 1.4166      0.1995              0.0998           0.9002      0.1406              43.1664         29.8300                25.5578            0
      b 12.0  8           7    20.1562     25.9375     5.7812 1.3077      0.2323              0.1161           0.8839      0.1484              42.7225         28.6822                27.8361            0
               cell  ctrl  drug1
  4981-2020-09-14-6 52.50   40.0
  4982-2020-09-17-7 14.50   17.5
  4982-2020-09-17-8 17.75   18.0
  4983-2020-09-29-9  9.50    7.5
 4984-2020-09-23-10  8.50    9.5
 5011-2020-10-01-11 14.00   29.5
 5012-2020-10-05-12 15.00   29.5
9045-2020-09-09-174 30.00   47.5
         cells  ctrl_mean  drug1_mean  cells_up
subject                                        
4981         1      52.50       40.00         0
4982         2      16.12       17.75         2
4983         1       9.50        7.50         0
4984         1       8.50        9.50         1
5011         1      14.00       29.50         1
5012         1      15.00       29.50         1
9045         1      30.00       47.50         1
Without the failed recordings:
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff      t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0  8           7    20.2188     25.0625     4.8438 1.3270      0.2262              0.1131           0.8869      0.1953              32.9020         23.9567                19.1684            0
      a  8.0  8           7    20.2188     24.8750     4.6562 1.2693      0.2449              0.1225           0.8775      0.1953              31.8394         23.0294                16.2272            0
      a 12.0  8           7    20.1562     24.8125     4.6562 1.2560      0.2494              0.1247           0.8753      0.1953              32.2591         23.1008                18.3824            0
      b  6.0  8           7    20.2188     26.3125     6.0938 1.4455      0.1916              0.0958           0.9042      0.1406              43.2854         30.1391                25.5578            0
      b  8.0  8           7    20.2188     26.2500     6.0312 1.4166      0.1995              0.0998           0.9002      0.1406              43.1664         29.8300                25.5578            0
      b 12.0  8           7    20.1562     25.9375     5.7812 1.3077      0.2323              0.1161           0.8839      0.1484              42.7225         28.6822                27.8361            0

Result: not reproduced. In the 7 cells without an opsin the rate falls in quinpirole (24.8 to 21.0 Hz, P = 0.30; reading b 20.2 Hz, P = 0.20). In the 8 Chronos cells of Fig. 2, before the train, it rises from 20.2 to 24.9 Hz (31.8% as the mean of cells' changes) with P = 0.24 (reading b: 43.2%, P = 0.20). No paired t test gives P < 0.05, under any reading or threshold; the increase of the Chronos cells is near the paper's 50% only under reading b of M1 with reading a of M2 (43.2%). One of the 7 cells without an opsin, 5110-2020-10-20-15, is a failed recording (data check); without it the 6 cells still do not speed up (25.1 to 24.5 Hz, P = 0.53; reading b, -8.9%, P = 0.079).

fig3b-gabazine-increases-rate¶

Gabazine raises the basal spike rate of SNr neurons by roughly 25%. (P < 0.01, n = 10 in the Results; paired t test, n = 45 in the legend; expected 25 +/- 2.5%)

All control cells with gabazine alone (claims file). Variant: for the gap-free files whose notes give the windows of measurement, the rate in those windows.

In [20]:
gz = summarize(["gabazine"])
print(gz.round(4).to_string(index=False))
print("\nVariant: gap-free files measured in the windows their notes give (other cells as reading a):")
print(summarize(["gabazine"], readings=("a",), note_windows=True).round(4).to_string(index=False))
d = rates("a", exps=["gabazine"])
print("\nBy protocol family (reading a, threshold 8):")
for fam, g in d.groupby("family"):
    s = snr.paired_summary(g)
    print(fam, {k: round(v, 4) for k, v in s.items()})
print("\nCells with a higher rate in gabazine:", int((d.drug1 > d.ctrl).sum()), "of", len(d))
print(by_subject(d).round(2).to_string())
print("\nWithout the failed recordings (" + ", ".join(c for c, e in failed.items() if e == "gabazine") + "):")
print(without_failed(["gabazine"]).round(4).to_string(index=False))
c = CI.loc["8945-2025-04-16-144"]
print("\n8945-2025-04-16-144, whose notes say gabazine was applied in its control file 001:", F.loc[c["ctrl"][0], "pnotes"])
for p, wins in [(c["ctrl"][0], [(0, 420), (420, 721)]), (c["drug1"][0], [(0, 360), (360, 842)])]:
    r, t = snr.episode_rates(spikes[F.loc[p, "asset_id"]], snr.K_THRESH)
    print(f"  file {num[p]:04d}, median rate:", ", ".join(f"{a} to {b} s {np.median(r[(t >= a) & (t < b)]):.2f} Hz" for a, b in wins))
print("Without 8945-2025-04-16-144:")
print(summarize(["gabazine"], cl=cells[cells.cell != "8945-2025-04-16-144"]).round(4).to_string(index=False))
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff      t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0 49          25    22.0204     23.2534     1.2330 1.6447      0.1066              0.0533           0.9467      0.0169               7.2964          5.5993                 8.8496            0
      a  8.0 49          25    21.4303     22.4745     1.0442 1.3391      0.1868              0.0934           0.9066      0.0232               6.3029          4.8726                 8.8496            0
      a 12.0 49          25    20.6701     21.0102     0.3401 0.3639      0.7175              0.3587           0.6413      0.0849               5.1244          1.6455                 8.0169            0
      b  6.0 49          25    22.0204     23.8741     1.8537 2.1711      0.0349              0.0174           0.9826      0.0050               9.9286          8.4183                12.6437            0
      b  8.0 49          25    21.4303     23.1888     1.7585 2.0402      0.0469              0.0234           0.9766      0.0044               9.5064          8.2057                12.0482            0
      b 12.0 49          25    20.6701     21.6667     0.9966 0.9539      0.3449              0.1725           0.8275      0.0282               8.0390          4.8215                12.0482            0

Variant: gap-free files measured in the windows their notes give (other cells as reading a):
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff      t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0 49          25    22.1003     23.9133     1.8129 2.1521      0.0364              0.0182           0.9818      0.0100              10.0478          8.2032                10.9195            0
      a  8.0 49          25    21.5221     23.1667     1.6446 1.8872      0.0652              0.0326           0.9674      0.0114               9.1055          7.6412                12.3077            0
      a 12.0 49          25    20.7687     21.6956     0.9269 0.9091      0.3678              0.1839           0.8161      0.0526               7.8425          4.4628                12.3077            0
By protocol family (reading a, threshold 8):
episodic {'n': 31, 'n_subjects': 19, 'mean_ctrl': np.float64(20.3011), 'mean_drug1': np.float64(21.0941), 'mean_diff': np.float64(0.793), 't': np.float64(0.7467), 'p_paired_t': np.float64(0.4611), 'p_paired_t_greater': np.float64(0.2305), 'p_paired_t_less': np.float64(0.7695), 'p_wilcoxon': np.float64(0.147), 'pct_a_mean_of_cells': np.float64(6.6273), 'pct_b_of_means': np.float64(3.9063), 'pct_c_median_of_cells': np.float64(4.3478), 'n_zero_ctrl': 0}
gap-free {'n': 18, 'n_subjects': 6, 'mean_ctrl': np.float64(23.375), 'mean_drug1': np.float64(24.8519), 'mean_diff': np.float64(1.4769), 't': np.float64(1.3328), 'p_paired_t': np.float64(0.2002), 'p_paired_t_greater': np.float64(0.1001), 'p_paired_t_less': np.float64(0.8999), 'p_wilcoxon': np.float64(0.0495), 'pct_a_mean_of_cells': np.float64(5.7442), 'pct_b_of_means': np.float64(6.3181), 'pct_c_median_of_cells': np.float64(8.8552), 'n_zero_ctrl': 0}

Cells with a higher rate in gabazine: 31 of 49
         cells  ctrl_mean  drug1_mean  cells_up
subject                                        
7152         2      12.71       17.83         2
7153         1      21.00       29.58         1
7154         1      31.08       29.33         0
7155         1      11.00       15.58         1
7156         1      14.75       18.33         1
7309         1      29.33       37.00         1
7310         2      14.83       16.12         1
7311         2      18.38       23.29         2
7319         3      22.83       19.89         1
7321         2      22.88       24.50         1
7324         1      22.17        0.17         0
7393         1       8.17       12.00         1
7394         3      22.47       23.50         1
7395         1       8.00        9.50         1
7396         2      19.58       20.83         2
7397         2      18.92       17.79         0
8856         3      33.78       37.58         3
8858         4      21.75       25.56         4
8881         3      23.00       16.86         0
8943         2      19.62       22.50         2
8944         4      21.21       23.35         2
8945         2      19.67       21.67         2
8952         3      19.06       19.33         1
8954         1      35.33       31.00         0
8977         1      40.83       42.50         1

Without the failed recordings (7310-2023-01-06-84, 7324-2023-02-22-93):
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff      t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0 47          24    22.3617     24.1401     1.7784 2.7889      0.0077              0.0038           0.9962      0.0032              11.0399          7.9527                 9.3023            0
      a  8.0 47          24    21.7500     23.4273     1.6773 2.6987      0.0097              0.0049           0.9951      0.0041              10.8104          7.7117                 8.8608            0
      a 12.0 47          24    20.9574     21.9043     0.9468 1.1388      0.2607              0.1303           0.8697      0.0227               9.5978          4.5178                 8.8496            0
      b  6.0 47          24    22.3617     24.8333     2.4716 3.4096      0.0014              0.0007           0.9993      0.0008              13.9473         11.0530                13.1944            0
      b  8.0 47          24    21.7500     24.1755     2.4255 3.4022      0.0014              0.0007           0.9993      0.0006              14.1662         11.1519                13.4783            0
      b 12.0 47          24    20.9574     22.5887     1.6312 1.7099      0.0940              0.0470           0.9530      0.0058              12.6364          7.7834                13.9738            0

8945-2025-04-16-144, whose notes say gabazine was applied in its control file 001: Cell-attached voltage clamp. Holding potential -60mV. Bath solution: aCSF, 5uM NBQX/2.5 uM CPP in File 000. Baseline Rate Measurement from 300s to 420s in File 001. Gabazine bath applied in File 001. Gabazine Rate Measurement from 720s to 840s in File 002. Pipette solution: aCSF. Temperature: 30C.
  file 0001, median rate: 0 to 420 s 23.50 Hz, 420 to 721 s 23.33 Hz
  file 0002, median rate: 0 to 360 s 24.83 Hz, 360 to 842 s 23.92 Hz
Without 8945-2025-04-16-144:
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff      t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0 48          25    21.9931     23.2309     1.2378 1.6171      0.1125              0.0563           0.9437      0.0199               7.3591          5.6284                 9.0759            0
      a  8.0 48          25    21.3906     22.4358     1.0451 1.3127      0.1957              0.0978           0.9022      0.0273               6.3449          4.8860                 8.8552            0
      a 12.0 48          25    20.6146     20.9410     0.3264 0.3421      0.7338              0.3669           0.6331      0.0988               5.1419          1.5833                 8.4332            0
      b  6.0 48          25    21.9931     23.8733     1.8802 2.1577      0.0361              0.0180           0.9820      0.0056              10.0833          8.5491                12.9191            0
      b  8.0 48          25    21.3906     23.1736     1.7830 2.0268      0.0484              0.0242           0.9758      0.0049               9.6523          8.3354                12.7632            0
      b 12.0 48          25    20.6146     21.6198     1.0052 0.9423      0.3509              0.1754           0.8246      0.0317               8.1544          4.8762                13.0110            0

Result: partially reproduced. Over 49 cells gabazine raises the rate from 21.4 to 23.2 Hz under reading b (paired t test P = 0.047, Wilcoxon P = 0.0044), and from 21.4 to 22.5 Hz under reading a (P = 0.19, Wilcoxon P = 0.023); 31 of 49 cells are faster. The increase is 9.5%, 8.2% and 12.0% (readings a, b, c of M2, reading b of M1), against the paper's 25 +/- 2.5%. At a threshold of 12 no paired t test gives P < 0.05. Two of the 49 cells are failed recordings (7310-2023-01-06-84 and 7324-2023-02-22-93, data check); without them the rise is significant under both readings at thresholds 6 and 8 (reading a P = 0.0097, reading b P = 0.0014 at 8), and is 10.8%, 7.7% and 8.9% (reading a of M1) or 14.2%, 11.2% and 13.5% (reading b). Under reading a of M1 at threshold 8 the increase is 6.3%, 4.9% and 8.8% with all 49 cells, a fifth to a third of the paper's size, and 5.1%, 1.6% and 8.0% at threshold 12; under reading b, or without the two failed recordings, it is a third to a half. The P < 0.05 part rests on an assumption: it holds with all 49 cells only at thresholds 6 and 8 under reading b of M1 (or under both readings without the failed recordings), and not at 12. The gap-free files measured in the windows their notes give (the other cells as reading a) give +9.1%, P = 0.065; the gap-free cells on their own, measured as reading a, give P = 0.20. The notes of 8945-2025-04-16-144 say gabazine was applied during its control file 001, after the baseline window of 300 to 420 s; its rate in that file is 23.5 Hz before 420 s and 23.3 Hz after, so the gabazine did not act within the file, and without the cell the tests are unchanged (reading b P = 0.048 at threshold 8, reading a P = 0.20).

figs1-gabazine-effect-vs-base-rate¶

The increase in SNr spike rate with gabazine is weakly and positively correlated with the basal rate. (R2 = 0.11, n = 39; expected 0.11 +/- 0.011)

OLS of the change in rate (Hz) on the basal rate over the cells of fig3b (claims file).

In [21]:
rows = []
for cset, cl in [("all cells", cells), ("without failed recordings", ok_cells)]:
    for r in ["a", "b"]:
        for k in snr.THRESHOLDS:
            d = rates(r, k, exps=["gabazine"], cl=cl).dropna(subset=["ctrl", "drug1"])
            fit = stats.linregress(d.ctrl, d.drug1 - d.ctrl)
            rows.append(dict(cells=cset, reading=r, k=k, n=len(d), slope=fit.slope, intercept=fit.intercept, r2=fit.rvalue ** 2, p=fit.pvalue,
                             base_range=f"{d.ctrl.min():.1f}-{d.ctrl.max():.1f}", delta_range=f"{(d.drug1 - d.ctrl).min():.1f}-{(d.drug1 - d.ctrl).max():.1f}"))
print(pd.DataFrame(rows).round(4).to_string(index=False))
                    cells reading    k  n   slope  intercept     r2      p base_range delta_range
                all cells       a  6.0 49 -0.0485     2.3004 0.0092 0.5126   5.0-50.2   -18.7-9.1
                all cells       a  8.0 49 -0.0331     1.7528 0.0041 0.6622   5.0-50.2   -22.0-9.2
                all cells       a 12.0 49 -0.0251     0.8597 0.0017 0.7780   0.2-48.8   -22.2-9.0
                all cells       b  6.0 49  0.0218     1.3740 0.0014 0.7965   5.0-50.2  -21.0-12.6
                all cells       b  8.0 49  0.0374     0.9565 0.0043 0.6545   5.0-50.2  -22.2-12.7
                all cells       b 12.0 49  0.0453     0.0607 0.0044 0.6495   0.2-48.8  -22.2-12.8
without failed recordings       a  6.0 47 -0.0713     3.3720 0.0283 0.2584   5.0-50.2   -10.2-9.1
without failed recordings       a  8.0 47 -0.0540     2.8511 0.0178 0.3712   5.0-50.2   -10.2-9.2
without failed recordings       a 12.0 47 -0.0384     1.7511 0.0052 0.6286   0.2-48.8   -18.7-9.0
without failed recordings       b  6.0 47  0.0012     2.4452 0.0000 0.9870   5.0-50.2   -9.7-12.6
without failed recordings       b  8.0 47  0.0178     2.0373 0.0015 0.7974   5.0-50.2   -9.7-12.7
without failed recordings       b 12.0 47  0.0334     0.9321 0.0030 0.7142   0.2-48.8  -20.3-12.8

Result: not reproduced. Over 49 cells the change with gabazine is not related to the basal rate: R2 = 0.004 with slope -0.033 (reading a) and R2 = 0.004 with slope 0.037 (reading b), against the paper's R2 = 0.11 and a positive slope; R2 is at most 0.009 at any threshold. Without the two failed recordings R2 is at most 0.028 (47 cells), and the slope is negative under reading a.

fig4a-gpe-gi-dreadd-reduces-ipsc¶

Activating Gi-DREADD in GPe with CNO reduces the amplitude of electrically evoked IPSCs in SNr neurons, similar in size to the quinpirole effect on optogenetically evoked IPSCs. (P = 0.02 in the Results, paired t test P < 0.01 in the legend, n = 4)

The "Five stim" files hold 1-s sweeps with one electrical pulse at 0.40 s (artifact at 0.4002 s). Amplitude as for fig1c: peak of the mean current within 3 to 20 ms after the pulse (after the artifact), from the mean over 0.38 to 0.399 s; sign fixed per cell by its control. Spontaneous action currents (the cells are not fully clamped) fall into some sweeps; the mean is taken over the sweeps without one, and the sign from the clean control sweeps. A sweep holds an action current when its 300 Hz high-passed current exceeds 50 noise units (median absolute deviation / 0.6745 of the high-passed sweep) in 0.38 to 0.45 s outside the artifact (0.3995 to 0.403 s); clean sweeps stay under 50 and action currents are mostly over 100 (printed below), and 100 is shown as a variant. The mean of all sweeps and the median of sweeps are variants.

In [22]:
from scipy import signal as _sig
ec = cells[cells.experiment == "gpe_gi_ipsc_cno"]
paths = sorted({p for _, r in ec.iterrows() for k in ["ctrl", "drug1"] for p in r[k]})
eX = snr.all_sweeps([F.loc[p, "asset_id"] for p in paths], 0.37, 0.45)
keep = np.r_[int(0.010 * snr.FS):int(0.0295 * snr.FS), int(0.033 * snr.FS):int(0.08 * snr.FS)]


def transient(X):
    """Largest high-passed deflection of each sweep outside the artifact, in noise units."""
    hp = _sig.sosfiltfilt(snr._SOS, X, axis=1)
    return np.abs(hp[:, keep]).max(1) / (np.median(np.abs(hp), 1) / 0.6745)


AMP = dict(t0=0.37, stim=0.40, base=(-0.02, -0.001), win=(0.003, 0.02))
rows, hist, traces = [], [], {}
for _, c in ec.iterrows():
    Xc = np.vstack([eX[F.loc[p, "asset_id"]]["X"] for p in c["ctrl"]])
    Xd = np.vstack([eX[F.loc[p, "asset_id"]]["X"] for p in c["drug1"]])
    zc, zd = transient(Xc), transient(Xd)
    bins = [0, 10, 20, 35, 50, 75, 100, 200, np.inf]
    hist.append(dict(cell=c["cell"], condition="control", **{f"{a}-{b}": n for a, b, n in zip(bins[:-1], bins[1:], np.histogram(zc, bins)[0])}))
    hist.append(dict(cell=c["cell"], condition="CNO", **{f"{a}-{b}": n for a, b, n in zip(bins[:-1], bins[1:], np.histogram(zd, bins)[0])}))
    row = dict(cell=c["cell"], subject=c["subject"], sweeps_ctrl=len(Xc), sweeps_cno=len(Xd),
               hold=F.loc[c["ctrl"][0], "pnotes"].split("Holding potential ")[1][:5])
    for lim in (50, 100):
        Cc, Cd = Xc[zc <= lim], Xd[zd <= lim]
        a_c, sign = snr.evoked_amplitudes(Cc, AMP["t0"], AMP["stim"], AMP["base"], AMP["win"])
        a_d, _ = snr.evoked_amplitudes(Cd, AMP["t0"], AMP["stim"], AMP["base"], AMP["win"], sign)
        row.update({f"dropped_ctrl_{lim}": int((zc > lim).sum()), f"dropped_cno_{lim}": int((zd > lim).sum()),
                    f"sign_{lim}": sign, f"amp_ctrl_{lim}": a_c, f"amp_cno_{lim}": a_d})
        if lim == 50:
            traces[c["cell"]] = (Cc.mean(0), Cd.mean(0))
    a_c, sign = snr.evoked_amplitudes(Xc, AMP["t0"], AMP["stim"], AMP["base"], AMP["win"])
    a_d, _ = snr.evoked_amplitudes(Xd, AMP["t0"], AMP["stim"], AMP["base"], AMP["win"], sign)
    m_c, _ = snr.evoked_amplitudes(np.median(Xc, 0)[None, :], AMP["t0"], AMP["stim"], AMP["base"], AMP["win"], sign)
    m_d, _ = snr.evoked_amplitudes(np.median(Xd, 0)[None, :], AMP["t0"], AMP["stim"], AMP["base"], AMP["win"], sign)
    row.update(sign_all=sign, amp_ctrl_all=a_c, amp_cno_all=a_d, amp_ctrl_median=m_c, amp_cno_median=m_d)
    rows.append(row)
e4 = pd.DataFrame(rows)
print("Sweeps by largest high-passed deflection outside the artifact (noise units), control and CNO:")
print(pd.DataFrame(hist).fillna(0).to_string(index=False))
print()
print(e4.round(2).T.to_string())
r1 = ipsc_test(main, "amp_ctrl", "amp_quin")
res4 = []
for name, a, b in [("mean of clean sweeps (50)", "amp_ctrl_50", "amp_cno_50"), ("mean of clean sweeps (100)", "amp_ctrl_100", "amp_cno_100"),
                   ("mean of all sweeps", "amp_ctrl_all", "amp_cno_all"), ("median of sweeps", "amp_ctrl_median", "amp_cno_median")]:
    r = ipsc_test(e4, a, b)
    res4.append(dict(measure=name, cells_lower=int((e4[b] < e4[a]).sum()), **r))
res4 = pd.DataFrame(res4)
print()
print(res4.round(4).to_string(index=False))
print("\nQuinpirole reduction (fig1c, 5 cells), readings a, b, c of M2:",
      [round(-r1[k], 1) for k in ["pct_a_mean_of_cells", "pct_b_of_means", "pct_c_median_of_cells"]])
tt = np.arange(int(0.08 * snr.FS)) / snr.FS + 0.37
fig, ax = plt.subplots(1, len(traces), figsize=(4 * len(traces), 3))
lo = hi = 0
for a_, (cell, (mc, md_)) in zip(ax, traces.items()):
    for m, col, lab in [(mc, "k", "control"), (md_, "r", "CNO")]:
        y = m - m[(tt >= 0.38) & (tt < 0.399)].mean()
        a_.plot(tt * 1000 - 400, y, col, lw=1, label=lab)
        w = (tt > 0.403) & (tt < 0.43)
        lo, hi = min(lo, y[w].min()), max(hi, y[w].max())
    a_.set_xlim(-5, 30); a_.set_ylim(-200, 100); a_.set_title(cell, fontsize=9); a_.set_xlabel("ms from pulse")
ax[0].set_ylabel("current (pA), clean sweeps"); ax[0].legend()
plt.tight_layout()
plt.show()
print(f"Mean clean traces 3 to 30 ms after the pulse range from {lo:.1f} to {hi:.1f} pA; the stimulus artifact (0 to 3 ms) runs off the axes.")
Sweeps by largest high-passed deflection outside the artifact (noise units), control and CNO:
              cell condition  0-10  10-20  20-35  35-50  50-75  75-100  100-200  200-inf
6813-2022-07-12-53   control    90      0      0      0      0       0        0        0
6813-2022-07-12-53       CNO    77      0      0      0      1       0        0       22
6887-2022-07-14-56   control     0      0     94      2      0       0        0        4
6887-2022-07-14-56       CNO     0      0     82      0      0       0        0       18
6921-2022-09-28-60   control     5      4      1      1      0       1       17       71
6921-2022-09-28-60       CNO    94      0      0      0      0       0        1        5
6921-2022-09-28-61   control    98      1      1      0      0       0        0        0
6921-2022-09-28-61       CNO   100      0      0      0      0       0        0        0

                                   0                   1                   2                   3
cell              6813-2022-07-12-53  6887-2022-07-14-56  6921-2022-09-28-60  6921-2022-09-28-61
subject                         6813                6887                6921                6921
sweeps_ctrl                       90                 100                 100                 100
sweeps_cno                       100                 100                 100                 100
hold                           -60mV               -60mV               -60mV               -60mV
dropped_ctrl_50                    0                   4                  89                   0
dropped_cno_50                    23                  18                   6                   0
sign_50                           -1                  -1                   1                  -1
amp_ctrl_50                    45.04               47.39               35.01              165.12
amp_cno_50                     18.48               34.81               14.26               82.64
dropped_ctrl_100                   0                   4                  88                   0
dropped_cno_100                   22                  18                   6                   0
sign_100                          -1                  -1                   1                  -1
amp_ctrl_100                   45.04               47.39               35.73              165.12
amp_cno_100                    22.88               34.81               14.26               82.64
sign_all                          -1                  -1                   1                  -1
amp_ctrl_all                   45.04               84.01               33.76              165.12
amp_cno_all                   304.17              205.21               19.95               82.64
amp_ctrl_median                34.93                46.7               27.75              152.24
amp_cno_median                 23.07               28.23               13.59                83.0

                   measure  cells_lower  n  mean_a   mean_b       t      p  p_less  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells
 mean of clean sweeps (50)            4  4 73.1398  37.5480 -2.2401 0.1110  0.0555             -48.6848        -48.6626               -54.4576
mean of clean sweeps (100)            4  4 73.3196  38.6474 -2.1559 0.1200  0.0600             -46.4490        -47.2892               -49.5760
        mean of all sweeps            2  4 81.9837 152.9931  0.9388 0.4171  0.7914             157.1792         86.6142                51.6762
          median of sweeps            4  4 65.4080  36.9724 -2.0797 0.1290  0.0645             -42.5060        -43.4741               -42.5152

Quinpirole reduction (fig1c, 5 cells), readings a, b, c of M2: [np.float64(30.1), np.float64(25.3), np.float64(27.3)]
No description has been provided for this image
Mean clean traces 3 to 30 ms after the pulse range from -165.1 to 35.0 pA; the stimulus artifact (0 to 3 ms) runs off the axes.

Result: not reproduced. Spontaneous action currents fall into 23 and 18 CNO sweeps of two cells and into 89 of the 100 control sweeps of 6921-2022-09-28-60; the high-passed deflections separate them from the clean sweeps (clean sweeps under 50 noise units, action currents mostly over 100). On the mean of the clean sweeps, the claims file's measure, the amplitude falls in all 4 cells, from 73.1 to 37.5 pA, a reduction of 48.7% (mean of cells), 48.7% (of means) and 54.5% (median), but the paired t test gives P = 0.11 (one-sided 0.056); with the limit at 100 noise units, P = 0.12 and 46.4 to 49.6%. The reductions are 16 points or more from the 30.1% of fig1c, outside the 10-point margin. On the mean of all sweeps the amplitude rises in 2 of 4 cells (P = 0.42), and on the median of sweeps it falls by 42.5% (P = 0.13). In 6921-2022-09-28-60 the current is outward in the 11 clean control sweeps, where the other three cells at -60 mV are inward.

fig4b-gpe-gi-dreadd-no-rate-change¶

Inhibiting GPe terminals with Gi-DREADD does not change the basal spike rate of SNr neurons. (P = 0.19, n = 5; legend paired t test P = 0.16)

A claim of absence (claims file, M6): rate before and after (CNO in slices with GPe hM4D(Gi)), two-sided paired t test at P < 0.05; the Wilcoxon signed-rank test and one-sided P are variants.

In [23]:
print(summarize(['gpe_gi_rate_cno']).round(4).to_string(index=False))
d = rates("a", exps=['gpe_gi_rate_cno'])
print(d[["cell", "ctrl", "drug1"]].round(2).to_string(index=False))
print(by_subject(d).round(2).to_string())
print("\nPer cell at thresholds 6, 8 and 12, both readings of M1:")
print(pd.concat([rates(r, k, exps=['gpe_gi_rate_cno'])[["cell", "ctrl", "drug1"]].assign(reading=r, k=k)
                 for r in ["a", "b"] for k in snr.THRESHOLDS]).pivot(index="cell", columns=["reading", "k"]).round(2).to_string())
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff       t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0  5           4    22.5667     20.7167    -1.8500 -1.5511      0.1958              0.9021           0.0979      0.3125              -7.9433         -8.1979                -5.5394            0
      a  8.0  5           4    21.9000     15.0667    -6.8333 -1.2755      0.2712              0.8644           0.1356      0.2500             -17.0504        -31.2024               -19.7740            0
      a 12.0  5           4    14.3167     11.7833    -2.5333 -2.0667      0.1076              0.9462           0.0538      0.1250             -25.5428        -17.6950               -19.7740            0
      b  6.0  5           4    22.5667     20.2167    -2.3500 -1.9909      0.1173              0.9413           0.0587      0.3125             -10.9173        -10.4136                -7.5802            0
      b  8.0  5           4    21.9000     14.3833    -7.5167 -1.4241      0.2275              0.8862           0.1138      0.0625             -23.0581        -34.3227               -17.5141            0
      b 12.0  5           4    14.3167     11.1833    -3.1333 -3.1122      0.0358              0.9821           0.0179      0.0625             -31.6712        -21.8859               -17.5141            0
              cell  ctrl  drug1
6835-2022-07-18-54 14.75  11.83
6835-2022-07-18-55 14.92  10.17
6887-2022-07-14-57 16.50  16.50
6917-2022-08-29-58 55.33  27.50
6920-2022-08-30-59  8.00   9.33
         cells  ctrl_mean  drug1_mean  cells_up
subject                                        
6835         2      14.83       11.00         0
6887         1      16.50       16.50         0
6917         1      55.33       27.50         0
6920         1       8.00        9.33         1

Per cell at thresholds 6, 8 and 12, both readings of M1:
                     ctrl                                     drug1                                   
reading                 a                    b                    a                    b              
k                    6.0    8.0    12.0   6.0    8.0    12.0   6.0    8.0    12.0   6.0    8.0    12.0
cell                                                                                                  
6835-2022-07-18-54  14.83  14.75  14.75  14.83  14.75  14.75  11.92  11.83  11.83  12.33  12.17  12.17
6835-2022-07-18-55  15.33  14.92  13.75  15.33  14.92  13.75  10.33  10.17  10.17   9.83   9.50   9.50
6887-2022-07-14-57  16.67  16.50   6.50  16.67  16.50   6.50  17.17  16.50   0.42  16.83  15.67   0.17
6917-2022-08-29-58  57.17  55.33  28.58  57.17  55.33  28.58  54.00  27.50  27.17  52.83  27.00  26.50
6920-2022-08-30-59   8.83   8.00   8.00   8.83   8.00   8.00  10.17   9.33   9.33   9.25   7.58   7.58

Result: reproduced (resting on an assumption). In the 5 cells CNO does not change the rate significantly: 21.9 to 15.1 Hz, paired t test P = 0.27 (reading b P = 0.23), and P >= 0.12 under both readings at thresholds 6 and 8. At a threshold of 12, reading b gives P = 0.036 (a decrease, reading a P = 0.11). Two cells depend on the threshold: 6917-2022-08-29-58 fires at 55 to 57 Hz in control at thresholds 6 and 8 but 28.6 Hz at 12, and at 27.5 Hz in CNO at 8, so at threshold 8 its control and CNO rates are not counted alike; 6887-2022-07-14-57 fires at 16.5 Hz at 6 and 8 in both conditions, but at threshold 12 its spikes are mostly missed (6.5 and 0.42 Hz). Under reading a, P is 0.11 to 0.27 at every threshold, so the absence holds at all three thresholds (M1: a claim holds under either reading); the one significant result, reading b at threshold 12, comes from the spikes of 6887-2022-07-14-57 missed at that threshold.

fig5d-shrna-higher-rate¶

SNr neurons from mice with ALDH1A1 knocked down in the SNc by shRNA fire faster than control SNr neurons. (Welch's t test, P < 0.001, n = 18 control / 15 shRNA)

shRNA: the control-condition rate of the 15 shRNA cells. Control: the dataset labels no cell as the control of the shRNA or Fig. 5F experiments, so neither reading of the criterion, (a) the control cells as the dataset labels them or (b) the 18 control cells of Fig. 5F, can be identified. The comparison below uses stand-ins that the criterion does not name and is shown only as a variant; sets (ii) and (iii) were chosen after the data had been looked at. The untreated cells it holds are the 49 gabazine-alone cells, which are run as: (i) all 49; (ii) the 31 recorded with the same episodic protocol as the shRNA cells; (iii) the 6 recorded in November 2022, the months of the shRNA recordings.

In [24]:
def control_sets(r):
    g = rates(r, exps=["gabazine"])
    g = g.dropna(subset=["ctrl"])
    return {"(i) all gabazine-alone cells": g,
            "(ii) episodic gabazine-alone cells": g[g.family == "episodic"],
            "(iii) gabazine-alone cells, Nov 2022": g[g.date.str.startswith("2022-11")]}


def group_test(treated, label):
    rows = []
    for r in ["a", "b"]:
        for k in snr.THRESHOLDS:
            tr = rates(r, k, exps=treated)
            sets = control_sets(r) if k == snr.K_THRESH else {kk: v for kk, v in
                   {"(i) all gabazine-alone cells": rates(r, k, exps=["gabazine"]).dropna(subset=["ctrl"])}.items()}
            for name, g in sets.items():
                x = treated_rates(tr)
                y = g.ctrl.to_numpy()
                w = stats.ttest_ind(x, y, equal_var=False)
                rows.append(dict(reading=r, k=k, control=name, n_treated=len(x), n_control=len(y), mean_treated=x.mean(),
                                 mean_control=y.mean(), t=w.statistic, p_welch=w.pvalue,
                                 p_welch_greater=stats.ttest_ind(x, y, equal_var=False, alternative="greater").pvalue))
    return pd.DataFrame(rows)


def treated_rates(tr):
    # the cell's rate in the treatment: the control condition of cells pretreated with the drug, the
    # drug condition of cells to which it was applied during the recording (disulfiram_acute)
    return np.concatenate([tr[tr.experiment != "disulfiram_acute"].ctrl.dropna().to_numpy(),
                           tr[tr.experiment == "disulfiram_acute"].drug1.dropna().to_numpy()])


print(group_test(["shrna_gabazine"], "shRNA").round(5).to_string(index=False))
reading    k                              control  n_treated  n_control  mean_treated  mean_control       t  p_welch  p_welch_greater
      a  6.0         (i) all gabazine-alone cells         15         49      28.18333      22.02041 2.18959  0.03784          0.01892
      a  8.0         (i) all gabazine-alone cells         15         49      26.36667      21.43027 1.92517  0.06364          0.03182
      a  8.0   (ii) episodic gabazine-alone cells         15         31      26.36667      20.30108 2.29293  0.02871          0.01436
      a  8.0 (iii) gabazine-alone cells, Nov 2022         15          6      26.36667      17.20833 2.44507  0.03521          0.01761
      a 12.0         (i) all gabazine-alone cells         15         49      25.15556      20.67007 1.52283  0.14016          0.07008
      b  6.0         (i) all gabazine-alone cells         15         49      28.18333      22.02041 2.18959  0.03784          0.01892
      b  8.0         (i) all gabazine-alone cells         15         49      26.36667      21.43027 1.92517  0.06364          0.03182
      b  8.0   (ii) episodic gabazine-alone cells         15         31      26.36667      20.30108 2.29293  0.02871          0.01436
      b  8.0 (iii) gabazine-alone cells, Nov 2022         15          6      26.36667      17.20833 2.44507  0.03521          0.01761
      b 12.0         (i) all gabazine-alone cells         15         49      25.15556      20.67007 1.52283  0.14016          0.07008

Result: blocked (metadata insufficient). The dataset labels no cell as a control of the shRNA experiments, and neither reading of the criterion can be identified. As a variant only, with untreated gabazine-alone cells as stand-ins, the 15 shRNA cells (26.4 Hz) are faster than the 31 episodic cells (20.3 Hz, Welch P = 0.029), the 6 of November 2022 (17.2 Hz, P = 0.035) and all 49 (21.4 Hz, P = 0.064; P = 0.038 at threshold 6 and 0.14 at 12). The paper's P < 0.001 is not approached by any of them.

fig5e-shrna-gabazine-no-change¶

In SNr neurons from ALDH1A1 shRNA mice, gabazine does not significantly change the basal spike rate. (paired t test, P = 0.05, n = 15)

A claim of absence (claims file, M6): rate before and after (gabazine in shRNA mice), two-sided paired t test at P < 0.05; the Wilcoxon signed-rank test and one-sided P are variants. The paper's own P (0.05) sits at the threshold.

In [25]:
print(summarize(['shrna_gabazine']).round(4).to_string(index=False))
d = rates("a", exps=['shrna_gabazine'])
print(d[["cell", "ctrl", "drug1"]].round(2).to_string(index=False))
print(by_subject(d).round(2).to_string())
print("Without the failed recordings:")
print(without_failed(['shrna_gabazine']).round(4).to_string(index=False))
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff       t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0 15           8    28.1833     28.7611     0.5778  0.4881      0.6331              0.3165           0.6835      0.8904               1.3669          2.0501                 0.9804            0
      a  8.0 15           8    26.3667     25.7278    -0.6389 -0.2820      0.7821              0.6090           0.3910      0.8647              -2.4908         -2.4231                 1.0101            0
      a 12.0 15           8    25.1556     24.6444    -0.5111 -0.2132      0.8342              0.5829           0.4171      0.3627               4.7113         -2.0318                 2.0408            0
      b  6.0 15           8    28.1833     28.2556     0.0722  0.0489      0.9617              0.4809           0.5191      0.7982              -0.4325          0.2563                 2.5105            0
      b  8.0 15           8    26.3667     25.6722    -0.6944 -0.2862      0.7789              0.6105           0.3895      0.6700              -2.9090         -2.6338                 3.8544            0
      b 12.0 15           8    25.1556     24.8611    -0.2944 -0.1226      0.9041              0.5479           0.4521      0.2209               8.4129         -1.1705                 3.6876            0
              cell  ctrl  drug1
5667-2022-10-12-20 27.67  34.17
5667-2022-10-12-21 38.92  37.92
5668-2022-10-24-22 23.67  28.67
5668-2022-10-24-23 31.33  32.67
5670-2022-10-11-24 17.17  14.33
5670-2022-10-11-25 12.33   9.83
7082-2022-11-29-68 16.50  16.67
7082-2022-11-29-69 39.42  34.67
7083-2022-11-18-70 25.08  28.25
7083-2022-11-18-71 31.00  44.33
7084-2022-11-28-72 32.67  33.33
7084-2022-11-28-73 31.17   3.25
7085-2022-12-13-74 18.33  16.83
7085-2022-12-13-75 27.17  25.67
7086-2022-11-17-76 23.08  25.33
         cells  ctrl_mean  drug1_mean  cells_up
subject                                        
5667         2      33.29       36.04         1
5668         2      27.50       30.67         2
5670         2      14.75       12.08         0
7082         2      27.96       25.67         1
7083         2      28.04       36.29         2
7084         2      31.92       18.29         1
7085         2      22.75       21.25         0
7086         1      23.08       25.33         1
Without the failed recordings:
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff      t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0 14           8    27.9702     28.8988     0.9286 0.7645      0.4582              0.2291           0.7709      0.6698               2.4577          3.3199                 0.9952            0
      a  8.0 14           8    26.0238     27.3333     1.3095 1.0545      0.3109              0.1554           0.8446      0.5097               3.7293          5.0320                 1.5255            0
      a 12.0 14           8    24.7262     26.4048     1.6786 1.6033      0.1329              0.0664           0.9336      0.1330              12.1907          6.7886                 3.1481            0
      b  6.0 14           8    27.9702     29.0536     1.0833 0.9352      0.3667              0.1834           0.8166      0.4511               2.7643          3.8732                 3.0687            0
      b  8.0 14           8    26.0238     27.4821     1.4583 1.2132      0.2466              0.1233           0.8767      0.3461               3.9497          5.6038                 4.7197            0
      b 12.0 14           8    24.7262     26.6369     1.9107 1.8742      0.0835              0.0418           0.9582      0.0640              16.1566          7.7275                 4.6364            0

Result: reproduced. In the 15 shRNA cells gabazine leaves the rate unchanged: 26.4 to 25.7 Hz, paired t test P = 0.78 (reading b P = 0.78), a change of -2.5% (mean of cells), and P >= 0.63 at every threshold. Without the failed recording 7084-2022-11-28-73 the 14 cells give P >= 0.084 (+3.7% at threshold 8, reading a).

fig5f-aldh-inhibitors-higher-rate¶

SNr neurons in slices pretreated with the aldehyde dehydrogenase inhibitors DEAB or disulfiram fire faster than control neurons. (Welch's t test, P < 0.01, n = 18 control / 18 inhibitor-treated)

Treated: every cell recorded in DEAB or disulfiram (claims file): the baseline of the DEAB-only cells (8), of the DEAB-then-gabazine cells (5) and of the disulfiram-then-gabazine cells (3), and the rate after disulfiram of the two cells where it was applied during the recording (reading b of M1 for those two takes the episodes from 6 min). That is 18 cells, the paper's n. Control: as for fig5d, stand-ins that the criterion does not name, shown only as a variant.

In [26]:
print(group_test(["deab_baseline", "deab_gabazine", "disulfiram_gabazine", "disulfiram_acute"], "inhibitor").round(5).to_string(index=False))
tr = rates("a", exps=["deab_baseline", "deab_gabazine", "disulfiram_gabazine", "disulfiram_acute"])
print("\nTreated cells by experiment (reading a):")
print(tr.assign(rate=np.where(tr.experiment == "disulfiram_acute", tr.drug1, tr.ctrl)).groupby("experiment").rate.describe()[["count", "mean", "min", "max"]].round(2).to_string())
reading    k                              control  n_treated  n_control  mean_treated  mean_control        t  p_welch  p_welch_greater
      a  6.0         (i) all gabazine-alone cells         18         49      21.19444      22.02041 -0.41674  0.67847          0.66077
      a  8.0         (i) all gabazine-alone cells         18         49      20.32407      21.43027 -0.54688  0.58665          0.70668
      a  8.0   (ii) episodic gabazine-alone cells         18         31      20.32407      20.30108  0.01082  0.99141          0.49570
      a  8.0 (iii) gabazine-alone cells, Nov 2022         18          6      20.32407      17.20833  0.91693  0.38982          0.19491
      a 12.0         (i) all gabazine-alone cells         18         49      17.46759      20.67007 -1.24547  0.22078          0.88961
      b  6.0         (i) all gabazine-alone cells         18         49      21.22685      22.02041 -0.39532  0.69415          0.65292
      b  8.0         (i) all gabazine-alone cells         18         49      20.36111      21.43027 -0.52135  0.60425          0.69788
      b  8.0   (ii) episodic gabazine-alone cells         18         31      20.36111      20.30108  0.02790  0.97786          0.48893
      b  8.0 (iii) gabazine-alone cells, Nov 2022         18          6      20.36111      17.20833  0.92328  0.38619          0.19309
      b 12.0         (i) all gabazine-alone cells         18         49      17.50463      20.67007 -1.21944  0.23050          0.88475

Treated cells by experiment (reading a):
                     count   mean    min    max
experiment                                     
deab_baseline          8.0  20.83  13.50  31.67
deab_gabazine          5.0  20.05  11.50  29.67
disulfiram_acute       2.0  21.33  14.17  28.50
disulfiram_gabazine    3.0  18.75  17.17  20.50

Result: blocked (metadata insufficient). As for fig5d, the control cells are not labelled. As a variant only, the 18 cells in DEAB or disulfiram fire at 20.3 Hz, no faster than the untreated stand-ins: 21.4 Hz for all 49 (Welch P = 0.59), 20.3 Hz for the 31 episodic ones (P = 0.99) and 17.2 Hz for the 6 of November 2022 (P = 0.39); no reading or threshold gives a faster treated group with P < 0.05.

fig5g-disulfiram-blocks-gabazine¶

In slices treated with disulfiram (10 uM), gabazine no longer changes SNr spike rate. (paired t test, P = 0.40, n = 5)

A claim of absence (claims file, M6): rate before and after (gabazine in disulfiram), two-sided paired t test at P < 0.05; the Wilcoxon signed-rank test and one-sided P are variants. The dataset holds 3 such cells against the paper's 5.

In [27]:
print(summarize(['disulfiram_gabazine']).round(4).to_string(index=False))
d = rates("a", exps=['disulfiram_gabazine'])
print(d[["cell", "ctrl", "drug1"]].round(2).to_string(index=False))
print(by_subject(d).round(2).to_string())
print("Without the failed recordings:")
print(without_failed(['disulfiram_gabazine']).round(4).to_string(index=False))
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff       t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0  3           1    21.1389     14.0000    -7.1389 -1.0175      0.4160              0.7920           0.2080        0.50             -30.1506        -33.7714                -2.3923            0
      a  8.0  3           1    18.7500     10.5278    -8.2222 -1.5233      0.2671              0.8664           0.1336        0.25             -43.3565        -43.8519               -27.6423            0
      a 12.0  3           1    12.3611      5.5556    -6.8056 -1.0380      0.4083              0.7959           0.2041        0.25             -67.4797        -55.0562              -100.0000            0
      b  6.0  3           1    21.1389     13.9444    -7.1944 -1.0115      0.4182              0.7909           0.2091        0.50             -30.3407        -34.0342                -1.9139            0
      b  8.0  3           1    18.7500      8.3889   -10.3611 -1.9384      0.1921              0.9039           0.0961        0.25             -53.7638        -55.2593               -59.3496            0
      b 12.0  3           1    12.3611      5.6111    -6.7500 -1.0253      0.4130              0.7935           0.2065        0.25             -67.1545        -54.6067              -100.0000            0
              cell  ctrl  drug1
6808-2022-05-31-44 20.50  14.83
6808-2022-05-31-45 18.58   0.00
6808-2022-05-31-46 17.17  16.75
         cells  ctrl_mean  drug1_mean  cells_up
subject                                        
6808         3      18.75       10.53         0
Without the failed recordings:
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff       t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0  2           1    19.7917     19.6667    -0.1250 -0.4286      0.7422              0.6289           0.3711         1.0              -0.8202         -0.6316                -0.8202            0
      a  8.0  2           1    18.8333     15.7917    -3.0417 -1.1587      0.4533              0.7734           0.2266         0.5             -15.0347        -16.1504               -15.0347            0
      a 12.0  2           1    18.5000      8.3333   -10.1667 -1.0427      0.4867              0.7567           0.2433         0.5             -51.2195        -54.9550               -51.2195            0
      b  6.0  2           1    19.7917     19.7083    -0.0833 -0.3333      0.7952              0.6024           0.3976         1.0              -0.5810         -0.4211                -0.5810            0
      b  8.0  2           1    18.8333     12.5833    -6.2500 -1.0563      0.4826              0.7587           0.2413         0.5             -30.6457        -33.1858               -30.6457            0
      b 12.0  2           1    18.5000      8.4167   -10.0833 -1.0254      0.4920              0.7540           0.2460         0.5             -50.7317        -54.5045               -50.7317            0
In [28]:
# power of the paired t test at n = 3 and 5 for a rise of the paper's size (25%, fig3b) at the
# mean basal rate, with the SD of the change in the gabazine-alone cells (without failed recordings)
g = rates("a", exps=["gabazine"], cl=ok_cells).dropna(subset=["ctrl", "drug1"])
sd = (g.drug1 - g.ctrl).std(ddof=1)
for rise in (0.25, 0.10):
    d_eff = rise * g.ctrl.mean() / sd
    for n in (3, 5):
        df = n - 1
        tc_ = stats.t.ppf(0.975, df)
        power = 1 - stats.nct.cdf(tc_, df, d_eff * np.sqrt(n)) + stats.nct.cdf(-tc_, df, d_eff * np.sqrt(n))
        print(f"rise {rise:.0%} of {g.ctrl.mean():.1f} Hz, SD of change {sd:.2f} Hz (n = {len(g)} gabazine-alone cells): "
              f"effect size {d_eff:.2f}, power of a two-sided paired t test with n = {n}: {power:.2f}")
rise 25% of 21.8 Hz, SD of change 4.26 Hz (n = 47 gabazine-alone cells): effect size 1.28, power of a two-sided paired t test with n = 3: 0.25
rise 25% of 21.8 Hz, SD of change 4.26 Hz (n = 47 gabazine-alone cells): effect size 1.28, power of a two-sided paired t test with n = 5: 0.58
rise 10% of 21.8 Hz, SD of change 4.26 Hz (n = 47 gabazine-alone cells): effect size 0.51, power of a two-sided paired t test with n = 3: 0.09
rise 10% of 21.8 Hz, SD of change 4.26 Hz (n = 47 gabazine-alone cells): effect size 0.51, power of a two-sided paired t test with n = 5: 0.14

Result: reproduced. In the 3 disulfiram cells the dataset holds (the paper has 5), all from one mouse, gabazine gives no significant change: 18.8 to 10.5 Hz, paired t test P = 0.27 (reading b P = 0.19), P >= 0.19 at every threshold. The rate falls in all 3, by 43% on average. One of them, 6808-2022-05-31-45, is a failed recording (data check); without it the 2 cells give P >= 0.45. The test has little power: for a rise of the paper's gabazine size (25%, with the spread of the gabazine-alone cells) a paired t test with 3 cells finds it with probability 0.25 (0.58 with 5), so the absence here says little.

fig5h-deab-blocks-gabazine¶

In slices treated with DEAB (10 uM), gabazine does not change SNr spike rate. (paired t test, P = 0.10, n = 5)

A claim of absence (claims file, M6): rate before and after (gabazine in DEAB), two-sided paired t test at P < 0.05; the Wilcoxon signed-rank test and one-sided P are variants.

In [29]:
print(summarize(['deab_gabazine']).round(4).to_string(index=False))
d = rates("a", exps=['deab_gabazine'])
print(d[["cell", "ctrl", "drug1"]].round(2).to_string(index=False))
print(by_subject(d).round(2).to_string())
print("Without the failed recordings:")
print(without_failed(['deab_gabazine']).round(4).to_string(index=False))
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff       t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0  5           3      20.50     17.4833    -3.0167 -1.7930      0.1474              0.9263           0.0737      0.3125             -11.4930        -14.7154               -15.0000            0
      a  8.0  5           3      20.05     15.0500    -5.0000 -1.5485      0.1964              0.9018           0.0982      0.3125             -23.6417        -24.9377               -15.7360            0
      a 12.0  5           3      18.30     13.5500    -4.7500 -2.2575      0.0869              0.9565           0.0435      0.1250             -31.8469        -25.9563               -14.8485            0
      b  6.0  5           3      20.50     17.1333    -3.3667 -1.9534      0.1225              0.9388           0.0612      0.1875             -12.3657        -16.4228               -17.0000            0
      b  8.0  5           3      20.05     14.6000    -5.4500 -1.7375      0.1573              0.9214           0.0786      0.1875             -25.0563        -27.1820               -16.2338            0
      b 12.0  5           3      18.30     12.9000    -5.4000 -2.6485      0.0571              0.9715           0.0285      0.1250             -34.6695        -29.5082               -19.3939            0
              cell  ctrl  drug1
6804-2022-06-08-35 29.67  23.50
6804-2022-06-08-36 11.50  14.50
6804-2022-06-08-37 25.67  22.92
6812-2022-06-09-49 17.00   0.50
6813-2022-06-10-52 16.42  13.83
         cells  ctrl_mean  drug1_mean  cells_up
subject                                        
6804         3      22.28       20.31         1
6812         1      17.00        0.50         0
6813         1      16.42       13.83         0
Without the failed recordings:
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff       t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0  4           2    21.0417     18.8958    -2.1458 -1.1546      0.3319              0.8341           0.1659       0.625              -5.5026        -10.1980               -12.7548            0
      a  8.0  4           2    20.8125     18.6875    -2.1250 -1.1200      0.3443              0.8278           0.1722       0.625              -5.2875        -10.2102               -13.2252            0
      a 12.0  4           2    20.1667     16.9375    -3.2292 -1.7203      0.1839              0.9081           0.0919       0.250             -14.8087        -16.0124               -12.7814            0
      b  6.0  4           2    21.0417     18.0833    -2.9583 -1.3685      0.2646              0.8677           0.1323       0.375              -8.6389        -14.0594               -16.7803            0
      b  8.0  4           2    20.8125     18.0000    -2.8125 -1.2832      0.2896              0.8552           0.1448       0.375              -7.7909        -13.5135               -15.9849            0
      b 12.0  4           2    20.1667     16.1250    -4.0417 -2.0589      0.1316              0.9342           0.0658       0.250             -18.3369        -20.0413               -17.8139            0

Result: reproduced. In the 5 DEAB cells gabazine gives no significant change: 20.1 to 15.1 Hz, paired t test P = 0.20 (reading b P = 0.16); P >= 0.057 at every threshold. The rate falls by 23.6% on average, driven by one cell that drops to 0.5 Hz. That cell, 6812-2022-06-09-49, is a failed recording (data check); without it the 4 cells give P >= 0.13 and the rate falls by 5 to 20%.

fig6a-rasagiline-blocks-gabazine¶

In slices incubated in the MAO-B inhibitor rasagiline (10 uM), gabazine has no discernible effect on SNr spike rate. (paired t test, P = 0.23, n = 9)

A claim of absence (claims file, M6): rate before and after (gabazine in rasagiline), two-sided paired t test at P < 0.05; the Wilcoxon signed-rank test and one-sided P are variants. These files use the '30 Hz Light' protocol in mice with no opsin; the rate is taken over the whole sweep.

In [30]:
print(summarize(['rasagiline_gabazine']).round(4).to_string(index=False))
d = rates("a", exps=['rasagiline_gabazine'])
print(d[["cell", "ctrl", "drug1"]].round(2).to_string(index=False))
print(by_subject(d).round(2).to_string())
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff       t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0  9           4    17.0463     15.5370    -1.5093 -1.5928      0.1499              0.9251           0.0749      0.2031              -7.0241         -8.8539               -13.3333            0
      a  8.0  9           4    17.0278     15.5000    -1.5278 -1.5922      0.1500              0.9250           0.0750      0.1641              -7.1673         -8.9723               -13.4831            0
      a 12.0  9           4    17.0278     14.8796    -2.1481 -1.9599      0.0857              0.9572           0.0428      0.0977             -15.1094        -12.6156               -14.2012            0
      b  6.0  9           4    17.0463     16.2870    -0.7593 -0.7920      0.4512              0.7744           0.2256      0.4961              -3.1733         -4.4541                -7.8616            0
      b  8.0  9           4    17.0278     16.2593    -0.7685 -0.7903      0.4522              0.7739           0.2261      0.4258              -3.1466         -4.5133                -7.8616            0
      b 12.0  9           4    17.0278     15.6481    -1.3796 -1.1912      0.2677              0.8661           0.1339      0.3008             -11.0850         -8.1022                -7.8616            0
              cell  ctrl  drug1
5870-2021-06-16-26 15.33  16.75
5870-2021-06-16-27 26.50  20.92
5874-2021-06-15-28 14.92  14.33
5892-2021-06-29-29  6.67   7.17
5892-2021-06-29-30  7.42   6.42
5892-2021-06-29-31 20.42  15.75
5892-2021-06-29-32 13.83  11.00
5894-2021-06-23-33 28.17  24.33
5894-2021-06-23-34 20.00  22.83
         cells  ctrl_mean  drug1_mean  cells_up
subject                                        
5870         2      20.92       18.83         1
5874         1      14.92       14.33         0
5892         4      12.08       10.08         1
5894         2      24.08       23.58         1

Result: reproduced. In the 9 rasagiline cells gabazine gives no significant change: 17.0 to 15.5 Hz, paired t test P = 0.15 (reading b P = 0.45); P >= 0.086 at every threshold.

fig6c-snc-gi-dreadd-no-snr-change (blocked by its dependency; test shown)¶

Slowing SNc dopaminergic neurons with Gi-DREADD does not increase SNr spike rate. (P = 0.29, n = 8)

The claims file makes this claim depend on figs3-snc-gi-dreadd-slows-snc (that CNO slows the SNc neurons), whose SNc recordings are not in the dataset, so the claim is blocked (protocol, author step 1.5). Its own SNr recordings are in the dataset (8 cells, DAT-Cre mice with DIO-hM4Di, 10 uM CNO), and the test of the criterion is run on them here: a claim of absence (M6), two-sided paired t test, Wilcoxon as a variant.

In [31]:
print(summarize(['snc_gi_snr_rate_cno']).round(4).to_string(index=False))
d = rates("a", exps=['snc_gi_snr_rate_cno'])
print(d[["cell", "ctrl", "drug1"]].round(2).to_string(index=False))
print("cells up:", int((d['drug1'] > d['ctrl']).sum()), "of", int(d[['ctrl', 'drug1']].dropna().shape[0]))
print(by_subject(d).round(2).to_string())
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff       t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0  8           4    20.4062     21.0208     0.6146  0.2856      0.7835              0.3917           0.6083      0.8438               6.6836          3.0117                 8.3206            0
      a  8.0  8           4    19.5417     20.0938     0.5521  0.2461      0.8127              0.4063           0.5937      0.8438               7.8595          2.8252                 6.3861            0
      a 12.0  8           4    19.4479     17.7188    -1.7292 -0.4403      0.6730              0.6635           0.3365      1.0000              -1.0303         -8.8913                 5.8861            0
      b  6.0  8           4    20.4062     21.2708     0.8646  0.3675      0.7241              0.3621           0.6379      0.8438               7.4921          4.2369                 9.3542            0
      b  8.0  8           4    19.5417     19.7083     0.1667  0.0587      0.9548              0.4774           0.5226      0.8438               6.2842          0.8529                 7.9241            0
      b 12.0  8           4    19.4479     18.0208    -1.4271 -0.3497      0.7369              0.6316           0.3684      0.8125               0.1565         -7.3380                 7.9241            0
               cell  ctrl  drug1
  0654-2022-10-05-0 32.92  40.08
  0654-2022-10-05-1 25.92  18.83
  0655-2022-10-08-2 11.83  16.33
  0655-2022-10-08-3 36.75  28.58
8914-2022-05-19-134 12.17   8.50
8914-2022-05-19-135  8.33   7.58
8916-2022-05-23-136 19.42  27.17
8916-2022-05-23-137  9.00  13.67
cells up: 4 of 8
         cells  ctrl_mean  drug1_mean  cells_up
subject                                        
0654         2      29.42       29.46         1
0655         2      24.29       22.46         1
8914         2      10.25        8.04         0
8916         2      14.21       20.42         2

Result: blocked (data missing, through its dependency on figs3-snc-gi-dreadd-slows-snc). On its own SNr recordings the test of the criterion finds no change: 8 cells from 4 mice, 19.5 to 20.1 Hz, paired t test P = 0.81 (reading b P = 0.95), P >= 0.67 at every threshold and Wilcoxon P >= 0.81; the rate rises in 4 of 8. The paper gives P = 0.29, n = 8.

fig6e-nnc711-blocks-gabazine¶

In slices incubated in the GAT-1 antagonist NNC-711, gabazine fails to increase SNr spike rate. (paired t test, P = 0.32, n = 6)

A claim of absence (claims file, M6): rate before and after (gabazine in NNC-711), two-sided paired t test at P < 0.05; the Wilcoxon signed-rank test and one-sided P are variants.

In [32]:
print(summarize(['nnc711_gabazine']).round(4).to_string(index=False))
d = rates("a", exps=['nnc711_gabazine'])
print(d[["cell", "ctrl", "drug1"]].round(2).to_string(index=False))
print(by_subject(d).round(2).to_string())
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff       t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0  6           3    19.0694     18.1111    -0.9583 -0.2971      0.7783              0.6108           0.3892      0.6875              -7.4791         -5.0255                -8.2492            0
      a  8.0  6           3    18.7361     17.7639    -0.9722 -0.2956      0.7794              0.6103           0.3897      0.8125              -7.4477         -5.1890                -7.4205            0
      a 12.0  6           3    18.7361     17.7639    -0.9722 -0.2956      0.7794              0.6103           0.3897      0.8125              -7.4477         -5.1890                -7.4205            0
      b  6.0  6           3    19.0694     18.0278    -1.0417 -0.2970      0.7784              0.6108           0.3892      0.6875              -8.1373         -5.4625                -7.5577            0
      b  8.0  6           3    18.7361     17.6389    -1.0972 -0.3046      0.7729              0.6135           0.3865      0.8438              -8.3296         -5.8562                -6.4905            0
      b 12.0  6           3    18.7361     17.6389    -1.0972 -0.3046      0.7729              0.6135           0.3865      0.8438              -8.3296         -5.8562                -6.4905            0
              cell  ctrl  drug1
6970-2022-09-08-62 23.58  20.08
6970-2022-09-08-63 20.83  21.33
6970-2022-09-08-64 14.67  14.67
6988-2022-09-01-65 14.17   9.67
6988-2022-09-01-66 21.00  34.00
6989-2022-08-31-67 18.17   6.83
         cells  ctrl_mean  drug1_mean  cells_up
subject                                        
6970         3      19.69       18.69         1
6988         2      17.58       21.83         1
6989         1      18.17        6.83         0

Result: reproduced. In the 6 NNC-711 cells gabazine gives no significant change: 18.7 to 17.8 Hz, paired t test P = 0.78 under both readings and every threshold.

fig7d-astrocyte-gi-increases-rate¶

Activating Gi-DREADD in SNr astrocytes with CNO raises SNr spike rate, by 28% on average. (P < 0.01, n = 10; expected 28 +/- 2.8%, readings a or b of M2)

Rate before and after (CNO, GFAP-hM4Di), claims file M1, M4; two-sided paired t test (the main reading where the test is not named), Wilcoxon and one-sided P as variants; percent change under the readings of M2.

In [33]:
print(summarize(['astro_gi_cno'], a='ctrl', b='drug1').round(4).to_string(index=False))
d = rates("a", exps=['astro_gi_cno'])
print(d[["cell", 'ctrl', 'drug1']].round(2).to_string(index=False))
print("cells up:", int((d['drug1'] > d['ctrl']).sum()), "of", int(d[['ctrl', 'drug1']].dropna().shape[0]))
print(by_subject(d, 'ctrl', 'drug1').round(2).to_string())
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff      t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0 10           6    14.7417     19.7750     5.0333 1.9293      0.0858              0.0429           0.9571      0.0371              38.1378         34.1436                28.5240            0
      a  8.0 10           6    14.3500     17.8667     3.5167 2.1856      0.0567              0.0283           0.9717      0.0410              25.1612         24.5064                29.9906            0
      a 12.0 10           6    14.3000     17.8167     3.5167 2.1832      0.0569              0.0284           0.9716      0.0352              25.1771         24.5921                29.7402            0
      b  6.0 10           6    14.7417     20.8583     6.1167 2.1834      0.0569              0.0284           0.9716      0.0273              46.1596         41.4924                34.4671            0
      b  8.0 10           6    14.3500     18.5583     4.2083 2.6052      0.0285              0.0142           0.9858      0.0273              30.1757         29.3264                35.5651            0
      b 12.0 10           6    14.3000     18.5333     4.2333 2.6091      0.0283              0.0142           0.9858      0.0273              30.3830         29.6037                36.3724            0
               cell  ctrl  drug1
8600-2024-12-07-103 26.33  33.25
8602-2024-12-17-104  8.00  11.00
8602-2024-12-17-105  9.83  13.00
8604-2024-12-16-106 11.92  24.25
8604-2024-12-16-107  9.00  11.50
8684-2025-01-14-111 10.83   8.33
8684-2025-01-14-112  9.33  12.67
8697-2025-01-28-116 28.08  38.33
8699-2025-01-23-117 16.00  13.17
8699-2025-01-23-118 14.17  13.17
cells up: 7 of 10
         cells  ctrl_mean  drug1_mean  cells_up
subject                                        
8600         1      26.33       33.25         1
8602         2       8.92       12.00         2
8604         2      10.46       17.88         2
8684         2      10.08       10.50         1
8697         1      28.08       38.33         1
8699         2      15.08       13.17         0

Result: reproduced (resting on an assumption). In the 10 GFAP-hM4Di cells CNO raises the rate in 7: under reading b of M1, 14.4 to 18.6 Hz, paired t test P = 0.029, a mean increase of 30.2% (mean of cells) and 29.3% (of means), inside 28 +/- 2.8. Under reading a the increase is 25.2% and 24.5%, just under the tolerance (25.2 to 30.8), and P = 0.057. At a threshold of 6, reading b gives P = 0.057 and 46.2%, so the outcome rests on the threshold and the window.

fig7e-gabazine-occludes-astrocyte-gi¶

When gabazine is applied first, CNO activation of astrocytic Gi-DREADD no longer increases SNr spike rate. (P = 0.10, n = 11)

A claim of absence (claims file, M6): rate before and after (CNO in gabazine, GFAP-hM4Di), two-sided paired t test at P < 0.05; the Wilcoxon signed-rank test and one-sided P are variants.

In [34]:
print(summarize(['astro_gi_gabazine_cno']).round(4).to_string(index=False))
d = rates("a", exps=['astro_gi_gabazine_cno'])
print(d[["cell", "ctrl", "drug1"]].round(2).to_string(index=False))
print(by_subject(d).round(2).to_string())
print("Without the failed recordings:")
print(without_failed(['astro_gi_gabazine_cno']).round(4).to_string(index=False))
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff       t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0 11           5    20.7727     21.5985     0.8258  0.9344      0.3721              0.1861           0.8139      0.3105               4.3942          3.9752                 1.6760            0
      a  8.0 11           5    20.2500     20.9848     0.7348  1.0225      0.3307              0.1653           0.8347      0.4131               2.7834          3.6289                 2.2472            0
      a 12.0 11           5    20.2197     20.9848     0.7652  1.0806      0.3052              0.1526           0.8474      0.3750               2.9106          3.7842                 2.2472            0
      b  6.0 11           5    20.7727     20.6288    -0.1439 -0.0664      0.9484              0.5258           0.4742      0.2686              -0.3600         -0.6929                 6.2500            0
      b  8.0 11           5    20.2500     19.8333    -0.4167 -0.2020      0.8440              0.5780           0.4220      0.6377              -4.1501         -2.0576                 5.0562            0
      b 12.0 11           5    20.2197     19.8258    -0.3939 -0.1923      0.8514              0.5743           0.4257      0.6377              -4.1298         -1.9483                 5.0562            0
               cell  ctrl  drug1
8683-2025-01-09-108 14.83  15.17
8683-2025-01-09-109 18.17  21.00
8683-2025-01-09-110 21.00  21.75
8690-2025-01-07-113 19.58  18.50
8690-2025-01-07-114 10.50   9.00
8690-2025-01-07-115 16.33  19.42
8700-2025-02-05-119 28.33  32.25
8701-2025-02-03-120 13.17  12.92
8797-2025-03-12-121 33.00  36.67
8797-2025-03-12-122 29.17  25.67
8797-2025-03-12-123 18.67  18.50
         cells  ctrl_mean  drug1_mean  cells_up
subject                                        
8683         3      18.00       19.31         3
8690         3      15.47       15.64         1
8700         1      28.33       32.25         1
8701         1      13.17       12.92         0
8797         3      26.94       26.94         1
Without the failed recordings:
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff      t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0 10           5    20.8333     21.7917     0.9583 0.9921      0.3471              0.1735           0.8265      0.2383               5.0815          4.6000                 3.2002            0
      a  8.0 10           5    20.4083     21.2333     0.8250 1.0466      0.3226              0.1613           0.8387      0.3750               3.1511          4.0425                 2.9093            0
      a 12.0 10           5    20.3917     21.2333     0.8417 1.0815      0.3076              0.1538           0.8462      0.3750               3.2017          4.1275                 2.9093            0
      b  6.0 10           5    20.8333     22.5917     1.7583 1.5267      0.1612              0.0806           0.9194      0.0605               9.1081          8.4400                 6.2896            0
      b  8.0 10           5    20.4083     21.8167     1.4083 1.3245      0.2180              0.1090           0.8910      0.2754               5.4349          6.9008                 5.3762            0
      b 12.0 10           5    20.3917     21.8083     1.4167 1.3374      0.2139              0.1070           0.8930      0.2754               5.4572          6.9473                 5.3762            0

Result: reproduced. In the 11 cells in gabazine CNO gives no significant change: 20.3 to 21.0 Hz, paired t test P = 0.33 (reading b P = 0.84), and P >= 0.27 for the Wilcoxon variant. Without the failed recording 8797-2025-03-12-123 the 10 cells give P >= 0.16.

fig7f-snap5114-decreases-rate¶

The GAT-3 antagonist SNAP-5114 (20 uM) lowers SNr spike rate, by 23%. (paired t test, P = 0.02, n = 19; expected 23 +/- 2.3%)

Rate before and after (SNAP-5114; 14 gap-free and 5 episodic cells), claims file M1, M4; two-sided paired t test (the main reading where the test is not named), Wilcoxon and one-sided P as variants; percent change under the readings of M2. Most of these recordings are gap-free; they are cut into 6-s episodes.

In [35]:
print(summarize(['snap5114', 'snap5114_quinpirole'], a='ctrl', b='drug1').round(4).to_string(index=False))
d = rates("a", exps=['snap5114', 'snap5114_quinpirole'])
print(d[["cell", 'ctrl', 'drug1']].round(2).to_string(index=False))
print("cells down:", int((d['drug1'] < d['ctrl']).sum()), "of", int(d[['ctrl', 'drug1']].dropna().shape[0]))
print(by_subject(d, 'ctrl', 'drug1').round(2).to_string())
print("Cells by protocol family:", d.family.value_counts().to_dict())
print("Without", ", ".join(faded), "(data check):")
print(summarize(['snap5114', 'snap5114_quinpirole'], a='ctrl', b='drug1', cl=cells[~cells.cell.isin(list(faded))]).round(4).to_string(index=False))
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff       t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0 19           6    30.0439     26.8684    -3.1754 -2.7841      0.0122              0.9939           0.0061      0.0112              -9.6825        -10.5693                -8.1897            0
      a  8.0 19           6    29.5877     26.0877    -3.5000 -3.2009      0.0050              0.9975           0.0025      0.0062             -11.7270        -11.8292                -8.2508            0
      a 12.0 19           6    28.5877     24.9518    -3.6360 -2.1997      0.0411              0.9794           0.0206      0.0363             -11.6724        -12.7186                -8.2569            0
      b  6.0 19           6    30.0439     26.5789    -3.4649 -3.0387      0.0071              0.9965           0.0035      0.0033             -10.7562        -11.5328                -9.9010            0
      b  8.0 19           6    29.5877     25.5570    -4.0307 -3.3087      0.0039              0.9980           0.0020      0.0043             -13.9001        -13.6229               -11.7089            0
      b 12.0 19           6    28.5877     24.7281    -3.8596 -2.2606      0.0364              0.9818           0.0182      0.0546             -12.4501        -13.5011               -10.5769            0
               cell  ctrl  drug1
8973-2025-05-21-150 22.92  21.25
8973-2025-05-21-151 19.17  22.00
8973-2025-05-21-152 36.00  32.00
8974-2025-05-22-153 51.67  39.17
8974-2025-05-22-154 26.17  11.33
8975-2025-05-20-155 28.00  19.83
8975-2025-05-20-156 24.67  22.83
8975-2025-05-20-157 33.67  35.33
8975-2025-05-20-158 44.67  43.00
8978-2025-05-29-160 50.50  46.33
8978-2025-05-29-161 24.42  27.92
8978-2025-05-29-162 18.92  16.67
8979-2025-05-27-163 16.50  17.50
8979-2025-05-27-164 21.50  14.33
8979-2025-05-27-165 38.50  33.08
8979-2025-05-27-166 26.33  25.42
8980-2025-05-28-167 32.00  27.08
8980-2025-05-28-168 33.00  31.33
8980-2025-05-28-169 13.58   9.25
cells down: 15 of 19
         cells  ctrl_mean  drug1_mean  cells_up
subject                                        
8973         3      26.03       25.08         1
8974         2      38.92       25.25         0
8975         4      32.75       30.25         1
8978         3      31.28       30.31         1
8979         4      25.71       22.58         1
8980         3      26.19       22.56         0
Cells by protocol family: {'gap-free': 14, 'episodic': 5}
Without 8979-2025-05-27-164 (data check):
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff       t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0 18           6    30.4444     27.3333    -3.1111 -2.5843      0.0193              0.9904           0.0096      0.0176              -9.1661        -10.2190                -7.5494            0
      a  8.0 18           6    30.0370     26.7407    -3.2963 -2.9024      0.0099              0.9950           0.0050      0.0108             -10.5267        -10.9741                -7.8416            0
      a 12.0 18           6    28.9815     26.3287    -2.6528 -1.8885      0.0762              0.9619           0.0381      0.0641              -6.8084         -9.1534                -8.2539            0
      b  6.0 18           6    30.4444     27.0278    -3.4167 -2.8368      0.0114              0.9943           0.0057      0.0066             -10.2994        -11.2226                -9.4764            0
      b  8.0 18           6    30.0370     26.4583    -3.5787 -2.9923      0.0082              0.9959           0.0041      0.0074             -11.5285        -11.9143               -10.8049            0
      b 12.0 18           6    28.9815     26.1019    -2.8796 -1.9483      0.0681              0.9660           0.0340      0.0987              -7.5862         -9.9361               -10.2390            0

Result: partially reproduced. SNAP-5114 lowers the rate in 15 of 19 cells, from 29.6 to 26.1 Hz (paired t test P = 0.0050; reading b P = 0.0039). The decrease is 11.7%, 11.8% and 8.3% (readings a, b, c of M2; 13.9%, 13.6% and 11.7% under reading b of M1), about half the paper's 23 +/- 2.3%, at every threshold. Without 8979-2025-05-27-164, a failed recording (data check), the 18 cells give P = 0.0099 (reading b P = 0.0082) and a decrease of 10.5%, 11.0% and 7.8%; at a threshold of 12, P = 0.076 and 0.068.

fig7f-snap5114-occludes-quinpirole¶

In the presence of SNAP-5114, quinpirole has no effect on SNr spike rate. (Welch's t test, P = 0.27)

The cells of fig7f-snap5114-decreases-rate that received quinpirole after SNAP-5114 (10). Rates in SNAP-5114 and in SNAP-5114 with quinpirole, compared as unpaired groups by a two-sided Welch's t test (the paper's test as written); a paired t test is a variant (claims file).

In [36]:
rows = []
for cset, cl in [("all", cells), ("without " + ", ".join(faded), cells[~cells.cell.isin(list(faded))])]:
  for r in ["a", "b"]:
    for k in snr.THRESHOLDS:
        d = rates(r, k, exps=["snap5114_quinpirole"], cl=cl).dropna(subset=["drug1", "drug2"])
        w = stats.ttest_ind(d.drug2, d.drug1, equal_var=False)
        p = stats.ttest_rel(d.drug2, d.drug1)
        rows.append(dict(cells=cset, reading=r, k=k, n=len(d), mean_snap=d.drug1.mean(), mean_snap_quin=d.drug2.mean(),
                         pct_of_means=(d.drug2.mean() - d.drug1.mean()) / d.drug1.mean() * 100,
                         cells_up=int((d.drug2 > d.drug1).sum()), p_welch=w.pvalue, p_paired=p.pvalue))
print(pd.DataFrame(rows).round(4).to_string(index=False))
d = rates("a", exps=["snap5114_quinpirole"])
print(d[["cell", "ctrl", "drug1", "drug2"]].round(2).to_string(index=False))
                      cells reading    k  n  mean_snap  mean_snap_quin  pct_of_means  cells_up  p_welch  p_paired
                        all       a  6.0 10    25.6250         26.4083        3.0569         3   0.8893    0.6698
                        all       a  8.0 10    24.2750         25.4167        4.7031         5   0.8486    0.5557
                        all       a 12.0 10    22.2917         25.2250       13.1589         6   0.6441    0.0569
                        all       b  6.0 10    25.0250         26.3417        5.2614         5   0.8177    0.4802
                        all       b  8.0 10    23.4000         25.3750        8.4402         6   0.7417    0.1724
                        all       b 12.0 10    22.0083         25.1833       14.4264         8   0.6076    0.0101
without 8979-2025-05-27-164       a  6.0  9    26.4167         28.2130        6.7999         3   0.7606    0.3033
without 8979-2025-05-27-164       a  8.0  9    25.3796         27.8241        9.6315         5   0.6833    0.1402
without 8979-2025-05-27-164       a 12.0  9    24.7500         27.7037       11.9342         5   0.6167    0.0848
without 8979-2025-05-27-164       b  6.0  9    25.7500         28.2037        9.5289         5   0.6820    0.1503
without 8979-2025-05-27-164       b  8.0  9    24.9630         27.5648       10.4228         6   0.6635    0.0831
without 8979-2025-05-27-164       b 12.0  9    24.4537         27.3519       11.8516         7   0.6198    0.0247
               cell  ctrl  drug1  drug2
8974-2025-05-22-154 26.17  11.33  10.83
8978-2025-05-29-160 50.50  46.33  52.83
8978-2025-05-29-161 24.42  27.92  29.92
8978-2025-05-29-162 18.92  16.67  28.17
8979-2025-05-27-164 21.50  14.33   3.75
8979-2025-05-27-165 38.50  33.08  34.75
8979-2025-05-27-166 26.33  25.42  25.17
8980-2025-05-28-167 32.00  27.08  32.08
8980-2025-05-28-168 33.00  31.33  29.33
8980-2025-05-28-169 13.58   9.25   7.33

Result: reproduced. In the 10 cells that received quinpirole after SNAP-5114 the rate moves from 24.3 to 25.4 Hz, Welch's t test P = 0.85 (reading b P = 0.74), P >= 0.61 at every threshold. The paired variant is P = 0.56 here and P = 0.010 at a threshold of 12 under reading b, an increase of 14.4%. Without 8979-2025-05-27-164, a failed recording whose quinpirole rate (3.75 Hz) is not a measurement of the cell (data check), the 9 cells give Welch's P >= 0.62 at every threshold, and the paired variant P = 0.083 to 0.30 at thresholds 6 and 8 and 0.025 at 12 under reading b.

fig7h-nnc711-increases-rate¶

The GAT-1 antagonist NNC-711 alone raises SNr spike rate, by 36%. (P < 0.01, n = 6; expected 36 +/- 3.6%, readings a or b of M2)

Rate before and after (NNC-711 10 uM), claims file M1, M4; two-sided paired t test (the main reading where the test is not named), Wilcoxon and one-sided P as variants; percent change under the readings of M2.

In [37]:
print(summarize(['nnc711'], a='ctrl', b='drug1').round(4).to_string(index=False))
d = rates("a", exps=['nnc711'])
print(d[["cell", 'ctrl', 'drug1']].round(2).to_string(index=False))
print("cells up:", int((d['drug1'] > d['ctrl']).sum()), "of", int(d[['ctrl', 'drug1']].dropna().shape[0]))
print(by_subject(d, 'ctrl', 'drug1').round(2).to_string())
reading    k  n  n_subjects  mean_ctrl  mean_drug1  mean_diff      t  p_paired_t  p_paired_t_greater  p_paired_t_less  p_wilcoxon  pct_a_mean_of_cells  pct_b_of_means  pct_c_median_of_cells  n_zero_ctrl
      a  6.0  6           4    26.2083     32.9861     6.7778 3.9503      0.0108              0.0054           0.9946      0.0312              28.0435         25.8612                26.6133            0
      a  8.0  6           4    25.3611     32.0833     6.7222 3.9545      0.0108              0.0054           0.9946      0.0312              29.3496         26.5060                25.9115            0
      a 12.0  6           4    25.3333     32.0556     6.7222 3.9545      0.0108              0.0054           0.9946      0.0312              29.3621         26.5351                25.9492            0
      b  6.0  6           4    26.2083     34.4167     8.2083 4.9990      0.0041              0.0021           0.9979      0.0312              34.3948         31.3196                28.6702            0
      b  8.0  6           4    25.3611     33.6111     8.2500 5.0152      0.0041              0.0020           0.9980      0.0312              36.0445         32.5301                29.1970            0
      b 12.0  6           4    25.3333     33.5833     8.2500 5.0152      0.0041              0.0020           0.9980      0.0312              36.0603         32.5658                29.2442            0
               cell  ctrl  drug1
9460-2026-01-28-175 25.33  37.67
9461-2026-01-23-176 14.25  22.50
9461-2026-01-23-177 27.08  36.67
9465-2026-01-12-178 35.17  38.00
9478-2026-01-08-179 13.83  15.17
9478-2026-01-08-180 36.50  42.50
cells up: 6 of 6
         cells  ctrl_mean  drug1_mean  cells_up
subject                                        
9460         1      25.33       37.67         1
9461         2      20.67       29.58         2
9465         1      35.17       38.00         1
9478         2      25.17       28.83         2

Result: reproduced. NNC-711 raises the rate in 6 of 6 cells, from 25.4 to 33.6 Hz under reading b of M1 (paired t test P = 0.0041), a mean increase of 36.0% (mean of cells), inside 36 +/- 3.6. Under reading a it is 29.3% (P = 0.011). The P values are the same at every threshold.

Summary¶

Claim Outcome
fig1c-quinpirole-reduces-gpe-ipsc reproduced
fig1b-gabazine-blocks-gpe-ipsc blocked (data missing)
fig1e-ppr-rises reproduced
fig2c-quinpirole-attenuates-gpe-inhibition not reproduced
fig2b-inhibition-wanes reproduced
fig3a-quinpirole-increases-rate not reproduced
fig3b-gabazine-increases-rate partially reproduced (assumed)
fig3d-gabazine-occludes-quinpirole blocked (data missing)
figs1-gabazine-effect-vs-base-rate not reproduced
fig4a-gpe-gi-dreadd-reduces-ipsc not reproduced
fig4b-gpe-gi-dreadd-no-rate-change reproduced
figs4b, figs4c, figs2a, figs2b, fig5ab blocked (data missing)
fig5d-shrna-higher-rate blocked (control cells not labelled)
fig5e-shrna-gabazine-no-change reproduced
fig5f-aldh-inhibitors-higher-rate blocked (control cells not labelled)
fig5g-disulfiram-blocks-gabazine reproduced
fig5h-deab-blocks-gabazine reproduced
fig6a-rasagiline-blocks-gabazine reproduced
figs3, fig6c blocked (data missing; fig6c depends on figs3, and its own SNr test gives P = 0.81)
fig6d, figs5 blocked (outside data, not tested)
fig6e-nnc711-blocks-gabazine reproduced
figs8, figs9c, figs9de, fig7a, figs4d, figs4e, figs6 blocked (data missing)
fig7d-astrocyte-gi-increases-rate reproduced (assumed)
fig7e-gabazine-occludes-astrocyte-gi reproduced
fig7f-snap5114-decreases-rate partially reproduced
fig7f-snap5114-occludes-quinpirole reproduced
fig7h-nnc711-increases-rate 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. Spikes are detected by a fixed threshold on the high-passed current, not in Clampfit with the paper's (unstated) settings; every rate result is shown at three thresholds, and the significance of some results changes with it, and two outcomes rest on the threshold (marked assumed). The stable window of each condition is taken by the two readings of the claims file, with the drug's application time read as the start of the file the notes name. IPSC amplitudes are measured on the mean of the sweeps of a condition; for Fig. 4A, on the sweeps without spontaneous action currents. The control cells of Fig. 5D and 5F are not labelled in the dataset, so those claims are blocked; untreated gabazine-alone cells are compared as a variant. Seven cell-attached recordings fail during the experiment (the spikes shrink into the noise); they are kept, as the claims file asks, and each affected claim is also given without them, with the same outcome. An eighth such recording, in the SNAP-5114 experiments, is found by inspection, and the two Fig. 7F claims are also given without it.

What was found about the dataset. The condition of each file (virus, drugs, control or drug file) is given only in free-text notes; there is no table of conditions and no record of the light or electrical stimuli. Sixteen files are deposited twice. Three sets of notes do not match their files, among them the nine files of one IPSC cell that carry another cell's notes. The notes give 30 C for every file (the paper: 32 to 33 C) and holding potentials of -50 to -70 mV for the optogenetic IPSCs (the paper: -60 mV). Three subject ids have recordings on dates 4 to 32 days apart. The dataset holds no SNc recordings and no recordings with SCH39166, NPPB, Gq-DREADD, gabazine then quinpirole, low glucose or room temperature, and none of the imaging, RNAscope or voltammetry.

In [38]:
print(f"notebook ran in {(time.time() - started) / 60:.1f} min")
notebook ran in 10.4 min