Reproducing Andrews, Geng, Voitiuk et al. (2024) from dandiset 001132¶

Paper. Andrews JP, Geng J, Voitiuk K, et al. (2024). Multimodal evaluation of network activity and optogenetic interventions in human hippocampal slices. Nature Neuroscience 27, 2487-2499. doi:10.1038/s41593-024-01782-5.

Dataset. DANDI:001132, version 0.241130.1903 (doi:10.48324/dandi.001132/0.241130.1903), streamed from the archive. The paper names the dandiset without a version. There are two published versions, 0.241119.1801 and 0.241130.1903; the data check below shows that they hold the same 69 assets (same asset identifiers and sizes), so the most recent one is pinned.

Claims. claims/andrews-2024.yaml, written from the NIH author manuscript in PubMed Central (PMC11881784) with its Methods, legends and supplement, and checked by a second reader.

What the dandiset holds. Each of the 69 files holds one HD-MEA recording as raw voltage only: no sorted units, no light (GPIO) events, no stimulation log, no condition or medium labels and no session description. Almost every claim rests on the paper's curated units and on which recording and which trials make each condition, so they are blocked. The notebook surveys every recording, recovers what it can of the light events from the voltage, tests the one claim about the cohort, and runs the paper's network model.

Claim Status
table1-cohort tested
units-per-recording blocked: data_missing (no sorted units)
transduction-range, reporter-gcl-pyramidal blocked: data_missing (histology)
patch-hckcr1-hyperpolarizing blocked: data_missing (patch clamp)
simulation-dampening tested: the published model is built and run with NEST 3.4 from conda-forge
fig3a-spontaneous-reduction, physio-bic-reduction-all-slices, physio-bic-amplitude-unchanged, table2-fr-decrease-physio-bic, table2-fr-decrease-0mg, zero-mg-reduction, ka-light-reduction, chr2-increase, closed-loop-bicuculline, intensity-threshold, s3-reduction-by-condition blocked: data_missing (units; light events are recoverable in 3C, 4C and 7D, and in no file of 5C, 8D, 10F or 11G)
zero-mg-isolated-bursts, ka-rhythmic-bursts, ka-bursts-during-light, ka-theta-coherence, fig4-firing-propagation, fig4-theta-propagation blocked: data_missing (units; conditions not labelled)
transduction-not-explaining-response blocked: data_missing (depends on the two Table 2 claims, which are blocked; its transduction values are an input from Table 2)
waveform-clusters, waveform-gcl-association, opto-response-clusters, opto-waveform-association, opto-cluster3-profile blocked: data_missing (units)

A variant on multi-unit threshold crossings for slice 3C, whose light steps reach the first channel group, is shown below; it decides no outcome.

In [1]:
import resource
import time
from concurrent.futures import ThreadPoolExecutor

import numpy as np
import pandas as pd
import requests
from scipy import stats
from statsmodels.stats.multitest import multipletests

import hdmea

pd.set_option("display.width", 220)
pd.set_option("display.max_rows", 200)
T0 = time.time()
print("dandiset", hdmea.DANDISET, "version", hdmea.VERSION)
dandiset 001132 version 0.241130.1903

Data check¶

The files and versions, then the metadata of every file. Each check of the metadata against the values is stated under its output.

In [2]:
versions = requests.get(f"{hdmea.API}/dandisets/{hdmea.DANDISET}/versions/", timeout=60).json()["results"]
print("versions:", [(v["version"], v["status"], v["asset_count"], v["size"]) for v in versions])
published = [v["version"] for v in versions if v["version"] != "draft"]
listing = {v: {(a["asset_id"], a["path"], a["size"]) for a in hdmea.assets(v)} for v in published}
print("published versions hold the same assets:", len({frozenset(s) for s in listing.values()}) == 1)
meta = requests.get(f"{hdmea.API}/dandisets/{hdmea.DANDISET}/versions/{hdmea.VERSION}/", timeout=60).json()
summ = meta["assetsSummary"]
print("assetsSummary: files", summ["numberOfFiles"], "subjects", summ["numberOfSubjects"],
      "bytes", summ["numberOfBytes"], "variables", summ["variableMeasured"])
versions: [('draft', 'Published', 69, 192373252150), ('0.241119.1801', 'Valid', 69, 192373252150), ('0.241130.1903', 'Valid', 69, 192373252150)]
published versions hold the same assets: True
assetsSummary: files 69 subjects 69 bytes 192373252150 variables ['ElectricalSeries', 'ElectrodeGroup']
In [3]:
ASSETS = hdmea.assets()
def load_meta(a):
    url = hdmea.s3_url(a["asset_id"])
    return dict(recording=hdmea.recording_name(a["path"]), path=a["path"], size_gb=a["size"] / 1e9, url=url,
                **hdmea.metadata(url))
with ThreadPoolExecutor(8) as ex:
    M = list(ex.map(load_meta, ASSETS))
info = pd.DataFrame([{k: v for k, v in m.items() if k not in ("x", "y", "electrode")} for m in M])
info["slice"] = info.recording.str.split("-").str[0]
info["patient"] = info.slice.str[-1]
info["duration_s"] = info.n_samples / info.rate
order = info.slice.str[:-1].astype(int) * 100 + info.recording.str.split("-").str[1].astype(int)
info = info.assign(o=order).sort_values("o").drop(columns="o").reset_index(drop=True)
print(info[["recording", "subject_id", "age", "sex", "species", "session_start", "n_channels", "duration_s",
            "size_gb"]].to_string())
   recording subject_id   age sex       species                     session_start  n_channels  duration_s   size_gb
0       1A-0       1A-0  P20Y   M  Homo sapiens  2024-09-28T16:52:45.206604-07:00         995      418.42  5.262621
1       2B-0       2B-0  P44Y   F  Homo sapiens  2024-09-28T16:50:49.180537-07:00         793      199.26  2.179440
2       2B-1       2B-1  P44Y   F  Homo sapiens  2024-09-28T16:54:27.270046-07:00         793      302.66  3.250860
3       2B-2       2B-2  P44Y   F  Homo sapiens  2024-09-28T16:54:24.178247-07:00         793      243.05  2.578410
4       3C-0       3C-0  P40Y   F  Homo sapiens  2024-09-28T16:54:22.856464-07:00         972       54.82  1.042223
5       3C-1       3C-1  P40Y   F  Homo sapiens  2024-09-28T16:52:41.260270-07:00         972       40.04  0.756842
6       3C-2       3C-2  P40Y   F  Homo sapiens  2024-09-28T19:20:08.724848-07:00         972       40.03  0.751396
7       3C-3       3C-3  P40Y   F  Homo sapiens  2024-09-28T16:54:21.131932-07:00         972       40.04  0.757350
8       3C-4       3C-4  P40Y   F  Homo sapiens  2024-09-28T16:54:22.116621-07:00         972       40.05  0.759159
9       3C-5       3C-5  P40Y   F  Homo sapiens  2024-09-28T16:54:22.800296-07:00         972       70.08  1.329282
10      3C-6       3C-6  P40Y   F  Homo sapiens  2024-09-28T16:54:23.396454-07:00         972      120.01  2.235650
11      3C-7       3C-7  P40Y   F  Homo sapiens  2024-09-28T16:54:25.922661-07:00         972      190.25  3.502122
12      4C-0       4C-0  P40Y   F  Homo sapiens  2024-09-28T16:52:42.764239-07:00         745      190.23  1.861371
13      4C-1       4C-1  P40Y   F  Homo sapiens  2024-09-28T16:54:26.095052-07:00         745      190.27  1.888027
14      4C-2       4C-2  P40Y   F  Homo sapiens  2024-09-28T16:49:59.794401-07:00         745      190.24  1.879800
15      4C-3       4C-3  P40Y   F  Homo sapiens  2024-09-28T16:54:23.307357-07:00         745       84.78  0.814226
16      4C-4       4C-4  P40Y   F  Homo sapiens  2024-09-28T16:54:27.818048-07:00         745      462.09  4.580971
17      4C-5       4C-5  P40Y   F  Homo sapiens  2024-09-28T19:20:16.380429-07:00         745      242.91  2.259636
18      5C-0       5C-0  P40Y   F  Homo sapiens  2024-09-28T16:54:24.119279-07:00         942      220.29  2.531736
19      5C-1       5C-1  P40Y   F  Homo sapiens  2024-09-28T16:51:06.958522-07:00         942       50.07  0.571985
20      5C-2       5C-2  P40Y   F  Homo sapiens  2024-09-28T16:52:41.146129-07:00         942      173.09  1.697678
21      5C-3       5C-3  P40Y   F  Homo sapiens  2024-09-28T16:52:43.145683-07:00         942      300.18  3.519715
22      5C-4       5C-4  P40Y   F  Homo sapiens  2024-09-28T16:50:50.842606-07:00         942      362.68  4.378846
23      5C-5       5C-5  P40Y   F  Homo sapiens  2024-09-28T16:54:26.533669-07:00         942      427.90  4.934092
24      6C-0       6C-0  P40Y   F  Homo sapiens  2024-09-28T16:54:25.025510-07:00         947      220.28  2.559372
25      6C-1       6C-1  P40Y   F  Homo sapiens  2024-09-28T16:54:20.845956-07:00         947      100.12  1.151288
26      6C-2       6C-2  P40Y   F  Homo sapiens  2024-09-28T16:52:41.212206-07:00         947      100.10  1.144478
27      6C-3       6C-3  P40Y   F  Homo sapiens  2024-09-28T16:54:22.583887-07:00         947      100.08  1.132976
28      6C-4       6C-4  P40Y   F  Homo sapiens  2024-09-28T19:20:14.119746-07:00         947       90.47  1.037331
29      7D-0       7D-0  P46Y   F  Homo sapiens  2024-09-28T16:54:25.788586-07:00         907      310.38  3.638298
30      7D-1       7D-1  P46Y   F  Homo sapiens  2024-09-28T16:54:25.471542-07:00         907      310.36  3.638053
31      7D-2       7D-2  P46Y   F  Homo sapiens  2024-09-28T16:54:26.242222-07:00         907      310.39  3.602993
32      7D-3       7D-3  P46Y   F  Homo sapiens  2024-09-28T16:54:24.292915-07:00         907      210.15  2.377700
33      7D-4       7D-4  P46Y   F  Homo sapiens  2024-09-28T16:52:41.865445-07:00         907      210.13  2.389075
34      7D-5       7D-5  P46Y   F  Homo sapiens  2024-09-28T16:50:48.133994-07:00         907      240.10  2.794462
35      7D-6       7D-6  P46Y   F  Homo sapiens  2024-09-28T16:54:21.775280-07:00         907       80.10  0.932557
36      7D-7       7D-7  P46Y   F  Homo sapiens  2024-09-28T16:52:41.978000-07:00         907       80.08  0.924441
37      8D-0       8D-0  P46Y   F  Homo sapiens  2024-09-28T16:54:24.724897-07:00        1017      310.38  3.896004
38      8D-1       8D-1  P46Y   F  Homo sapiens  2024-09-28T16:54:23.825729-07:00        1017      210.49  2.666068
39      8D-2       8D-2  P46Y   F  Homo sapiens  2024-09-28T16:50:45.815356-07:00        1017      210.22  2.607930
40      8D-3       8D-3  P46Y   F  Homo sapiens  2024-09-28T16:54:22.233543-07:00        1017      210.15  2.592066
41      8D-4       8D-4  P46Y   F  Homo sapiens  2024-09-28T16:52:42.660239-07:00        1017      240.11  2.971461
42      9E-0       9E-0  P46Y   F  Homo sapiens  2024-09-28T16:50:47.400246-07:00         936      200.24  2.365440
43      9E-1       9E-1  P46Y   F  Homo sapiens  2024-09-28T16:54:22.889408-07:00         936      160.05  1.891062
44      9E-2       9E-2  P46Y   F  Homo sapiens  2024-09-28T16:54:23.502348-07:00         936      160.05  1.916363
45      9E-3       9E-3  P46Y   F  Homo sapiens  2024-09-28T16:54:23.712491-07:00         936      200.08  2.421673
46      9E-4       9E-4  P46Y   F  Homo sapiens  2024-09-28T16:54:22.866169-07:00         936      160.05  1.927701
47      9E-5       9E-5  P46Y   F  Homo sapiens  2024-09-28T16:54:23.641121-07:00         936      200.08  2.406372
48      9E-6       9E-6  P46Y   F  Homo sapiens  2024-09-28T16:54:22.497278-07:00         936      160.05  1.971742
49      9E-7       9E-7  P46Y   F  Homo sapiens  2024-09-28T16:54:25.678829-07:00         936      308.48  3.874669
50      9E-8       9E-8  P46Y   F  Homo sapiens  2024-09-28T16:54:24.871544-07:00         936      322.74  3.872845
51     10F-0      10F-0  P52Y   F  Homo sapiens  2024-09-28T16:54:27.120889-07:00         887      313.15  3.779863
52     10F-1      10F-1  P52Y   F  Homo sapiens  2024-09-28T16:50:18.364072-07:00        1009      126.57  1.768928
53     10F-2      10F-2  P52Y   F  Homo sapiens  2024-09-28T16:50:08.518124-07:00        1009      212.94  2.757406
54     10F-3      10F-3  P52Y   F  Homo sapiens  2024-09-28T16:54:23.664056-07:00        1009      200.25  2.625777
55     10F-4      10F-4  P52Y   F  Homo sapiens  2024-09-28T16:52:29.104232-07:00        1009      310.05  4.068167
56     10F-5      10F-5  P52Y   F  Homo sapiens  2024-09-28T16:54:24.737478-07:00        1009      320.06  4.208890
57     10F-6      10F-6  P52Y   F  Homo sapiens  2024-09-28T16:54:27.785667-07:00        1009      360.10  4.835161
58     10F-7      10F-7  P52Y   F  Homo sapiens  2024-09-28T16:54:26.773191-07:00        1009      390.13  5.039495
59     10F-8      10F-8  P52Y   F  Homo sapiens  2024-09-28T16:54:25.784231-07:00        1009      390.13  5.084470
60     11G-0      11G-0  P35Y   M  Homo sapiens  2024-09-28T19:20:15.873613-07:00         894      200.24  2.284245
61     11G-1      11G-1  P35Y   M  Homo sapiens  2024-09-28T16:54:30.701829-07:00         894      390.15  4.475037
62     11G-2      11G-2  P35Y   M  Homo sapiens  2024-09-28T16:54:27.823392-07:00         894      510.23  5.910296
63     11G-3      11G-3  P35Y   M  Homo sapiens  2024-09-28T16:54:27.494836-07:00         894      360.14  4.186034
64     11G-4      11G-4  P35Y   M  Homo sapiens  2024-09-28T16:54:26.873947-07:00         894      300.88  3.614635
65     12G-0      12G-0  P35Y   M  Homo sapiens  2024-09-28T16:54:25.580800-07:00         997      200.24  2.508136
66     12G-1      12G-1  P35Y   M  Homo sapiens  2024-09-28T16:52:45.043713-07:00         997      390.12  4.877721
67     12G-2      12G-2  P35Y   M  Homo sapiens  2024-09-28T16:54:29.808563-07:00         997      510.16  6.308588
68     12G-3      12G-3  P35Y   M  Homo sapiens  2024-09-28T16:52:43.098988-07:00         997      301.59  4.012543
In [4]:
print("files:", len(info), " slices:", info.slice.nunique(), " patients:", info.patient.nunique())
print("recordings per slice:", info.groupby("slice", sort=False).size().to_dict())
print("subject_id equals the recording name in every file:", (info.subject_id == info.recording).all())
print("age and sex constant within each patient:",
      info.groupby("patient").apply(lambda g: g[["age", "sex"]].drop_duplicates().shape[0] == 1, include_groups=False).all())
print("channels constant within each slice:", info.groupby("slice").n_channels.nunique().eq(1).all())
print("dtype", info.dtype.unique(), " sampling rate (Hz)", info.rate.unique(), " conversion (V/count)", info.conversion.unique(),
      " offset", info.offset.unique(), " unit", info.unit.unique())
print("chunks", info.chunks.astype(str).unique(), " filters", info.filters.astype(str).unique())
print("duration (s): min %.1f, median %.1f, max %.1f, total %.0f" % (info.duration_s.min(), info.duration_s.median(),
      info.duration_s.max(), info.duration_s.sum()))
print("session_start values:", sorted(info.session_start.str[:10].unique()))
print("session_description non-empty:", (info.session_description != "").sum())
print("electrode locations:", sorted({l for m in M for l in m["location"]}), " device:", info.device.unique())
print("files with a units table:", info.has_units.sum(), " with intervals:", info.intervals.sum(),
      " with processing modules:", sum(len(p) > 0 for p in info.processing),
      " with stimulus series:", sum(len(s) > 0 for s in info.stimulus),
      " acquisition objects per file:", info.n_acquisition.unique())
print("objects outside the ElectricalSeries and general/:", sorted({p for ps in info.paths for p in ps}))
xs = np.concatenate([m["x"] for m in M]); ys = np.concatenate([m["y"] for m in M]); el = np.concatenate([m["electrode"] for m in M])
print("electrode x (um): %.1f to %.1f; y: %.1f to %.1f; all on a 17.5 um grid: %s; electrode ids %d to %d" % (
      xs.min(), xs.max(), ys.min(), ys.max(), bool(np.allclose(np.r_[xs, ys] / 17.5, np.round(np.r_[xs, ys] / 17.5))),
      el.min(), el.max()))
files: 69  slices: 12  patients: 7
recordings per slice: {'1A': 1, '2B': 3, '3C': 8, '4C': 6, '5C': 6, '6C': 5, '7D': 8, '8D': 5, '9E': 9, '10F': 9, '11G': 5, '12G': 4}
subject_id equals the recording name in every file: True
age and sex constant within each patient: True
channels constant within each slice: False
dtype <StringArray>
['uint16']
Length: 1, dtype: str  sampling rate (Hz) [20000.]  conversion (V/count) [6.2942504e-06 1.5735626e-06]  offset [0.]  unit <StringArray>
['volts']
Length: 1, dtype: str
chunks <StringArray>
['(78125, 64)']
Length: 1, dtype: str  filters <StringArray>
['['deflate']']
Length: 1, dtype: str
duration (s): min 40.0, median 210.2, max 510.2, total 15856
session_start values: ['2024-09-28']
session_description non-empty: 0
electrode locations: ['unknown']  device: <StringArray>
['Recorded using Maxwell version '20160704'.']
Length: 1, dtype: str
files with a units table: 0  with intervals: 0  with processing modules: 0  with stimulus series: 0  acquisition objects per file: [1]
objects outside the ElectricalSeries and general/: ['acquisition', 'analysis', 'file_create_date', 'identifier', 'processing', 'session_description', 'session_start_time', 'stimulus', 'stimulus/presentation', 'stimulus/templates', 'timestamps_reference_time']
electrode x (um): 17.5 to 3832.5; y: 0.0 to 2082.5; all on a 17.5 um grid: True; electrode ids 116 to 26362
In [5]:
# Every field under general/ in every file (where NWB keeps virus, pharmacology, protocol, notes,
# optogenetics, experiment_description and the like), and the ElectricalSeries' own description and comments
gen = pd.DataFrame([{**m["general"], **{f"ElectricalSeries {k}": v for k, v in m["series_text"].items()}} for m in M],
                   index=[m["recording"] for m in M])
print("fields under general/ in any file:")
for col in gen.columns:
    vals = gen[col].dropna().astype(str).unique()
    shown = (": " + " | ".join(v.replace("\n", " ") for v in vals)) if len(vals) <= 2 else ""
    print(f"  {col}: in {gen[col].notna().sum()} files, {len(vals)} distinct value(s){shown}")
nwb_fields = ("virus", "pharmacology", "protocol", "notes", "optogenetics", "slices", "surgery", "stimulus",
              "data_collection", "subject/genotype", "subject/strain", "subject/description")
print("NWB fields present in any file:", {k: any(c == k or c.startswith(k + "/") for c in gen.columns) for k in nwb_fields})
words = ("hckcr1", "chr2", "kcr", "opsin", "virus", "aav", "camk", "eyfp", "bicuc", "kainic", "magnesium", "0-mg",
         "0mg", "led", "light", "stim", "pharmacolog", "medium", "media", "baseline", "closed")
hits = sorted({(col, w) for col in gen.columns for w in words
               if any(w in (col + " " + v).lower() for v in gen[col].dropna().astype(str))})
print("opsin, virus, drug, medium or light words in any of these fields or their names:", hits)
fields under general/ in any file:
  devices/: in 69 files, 1 distinct value(s): {}
  devices/DeviceEcephys/: in 69 files, 1 distinct value(s): {'description': "Recorded using Maxwell version '20160704'.", 'neurodata_type': 'Device'}
  experiment_description: in 69 files, 1 distinct value(s): Multimodal evaluation of network activity and optogenetic interventions in human hippocampal slices
  extracellular_ephys/: in 69 files, 1 distinct value(s): {}
  extracellular_ephys/0/: in 69 files, 1 distinct value(s): {'description': 'no description', 'location': 'unknown', 'neurodata_type': 'ElectrodeGroup'}
  extracellular_ephys/electrodes/: in 69 files, 6 distinct value(s)
  extracellular_ephys/electrodes/channel_name: in 69 files, 13 distinct value(s)
  extracellular_ephys/electrodes/electrode: in 69 files, 13 distinct value(s)
  extracellular_ephys/electrodes/group: in 69 files, 13 distinct value(s)
  extracellular_ephys/electrodes/group_name: in 69 files, 13 distinct value(s)
  extracellular_ephys/electrodes/id: in 69 files, 13 distinct value(s)
  extracellular_ephys/electrodes/location: in 69 files, 13 distinct value(s)
  extracellular_ephys/electrodes/rel_x: in 69 files, 13 distinct value(s)
  extracellular_ephys/electrodes/rel_y: in 69 files, 13 distinct value(s)
  institution: in 69 files, 1 distinct value(s): UCSF, UCSC
  lab: in 69 files, 1 distinct value(s): NOW Lab, UCSF
  source_script: in 69 files, 1 distinct value(s): Created using NeuroConv v0.6.4
  subject/: in 69 files, 1 distinct value(s): {'neurodata_type': 'Subject'}
  subject/age: in 69 files, 6 distinct value(s)
  subject/sex: in 69 files, 2 distinct value(s): F | M
  subject/species: in 69 files, 1 distinct value(s): Homo sapiens
  subject/subject_id: in 69 files, 69 distinct value(s)
  ElectricalSeries description: in 69 files, 1 distinct value(s): Acquisition traces for the ElectricalSeries.
  ElectricalSeries comments: in 69 files, 1 distinct value(s): no comments
NWB fields present in any file: {'virus': False, 'pharmacology': False, 'protocol': False, 'notes': False, 'optogenetics': False, 'slices': False, 'surgery': False, 'stimulus': False, 'data_collection': False, 'subject/genotype': False, 'subject/strain': False, 'subject/description': False}
opsin, virus, drug, medium or light words in any of these fields or their names: []

The files are named by slice (1A to 12G, the slice IDs of Table 1) and a recording index; the letter is the patient. Each file's subject_id is the recording (3C-0), so the archive counts 69 subjects where there are 7 patients and 12 slices. Every session_start_time is 2024-09-28, the conversion date, not the recording date (the paper's code names recordings from 2023). The sampling rate (20 kHz), the channel counts (up to 1,024) and the electrode positions on the 17.5 µm grid of a 26,400-electrode MaxWell array are consistent with the Methods. Nothing in the files says which medium, drug or light protocol a recording belongs to, which opsin a slice carries, or which of the paper's recordings a file is. Under general/ every file holds only the devices, the electrode table and group, experiment_description (the paper's title, the same in all 69), institution, lab, source_script and the subject's age, sex, species and subject_id; there is no virus, pharmacology, protocol, notes, optogenetics, stimulus, slices or surgery field, no subject genotype, strain or description, and no opsin, virus, drug, medium or light word in any field. The ElectricalSeries' description and comments are the converter's defaults.

Survey of every recording¶

One pass over the first 64-channel group of every file gives the channel-mean voltage in 10 ms bins (to find light steps) and multi-unit threshold crossings per channel in 100 ms bins (helper hdmea.scan; parameters and their sources are in its docstring). It reads about 13 GB and takes about 12 minutes. It was timed on two recordings while preparing (11 s for a 190 s recording, 1.3 GB peak memory).

In [6]:
t = time.time()
SCAN = {}
for m in M:
    SCAN[m["recording"]] = hdmea.scan(m["url"])
print("scanned %d recordings in %.1f min; %.1f GB compressed read; peak memory %.2f GB" % (
      len(SCAN), (time.time() - t) / 60, sum(s["compressed"] for s in SCAN.values()) / 1e9,
      resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6))
rng = pd.DataFrame([{"slice": r.split("-")[0], "vmin": s["vmin"], "vmax": s["vmax"],
                     "rail_frac_max": float(s["rail"].max()), "rail_frac_median": float(np.median(s["rail"]))}
                    for r, s in SCAN.items()])
rng = rng.groupby("slice", sort=False).agg(vmin=("vmin", "min"), vmax=("vmax", "max"),
                                           rail_frac_max=("rail_frac_max", "max"), rail_frac_median=("rail_frac_median", "max"))
rng["conversion_uV"] = info.groupby("slice").conversion.agg(lambda c: sorted(set(np.round(c * 1e6, 3)))).reindex(rng.index)
print("values (counts) of the first channel group per slice, the largest fraction of its channels at 0 or 1023 in any")
print("100 ms bin, and the conversion to volts:")
print(rng.round(3).to_string())
scanned 69 recordings in 11.0 min; 13.1 GB compressed read; peak memory 1.71 GB
values (counts) of the first channel group per slice, the largest fraction of its channels at 0 or 1023 in any
100 ms bin, and the conversion to volts:
       vmin  vmax  rail_frac_max  rail_frac_median conversion_uV
slice                                                           
10F       0   630          0.018             0.000       [1.574]
11G     155   584          0.000             0.000       [1.574]
12G     204   603          0.000             0.000       [1.574]
1A      387   792          0.000             0.000       [6.294]
2B       76  1023          1.000             0.000       [6.294]
3C        0  1023          1.000             0.016       [6.294]
4C      355   693          0.000             0.000       [6.294]
5C        0  1023          0.344             0.344       [6.294]
6C        0  1023          0.031             0.000       [6.294]
7D      134   763          0.000             0.000       [6.294]
8D      462   572          0.000             0.000       [6.294]
9E      151   784          0.000             0.000       [1.574]

Recordings deposited twice¶

The compressed bytes of the first and the last chunk of the first channel group, compared across files; files of equal length are listed too.

In [7]:
dig = pd.DataFrame([{"recording": r, "first": s["digest_first"], "last": s["digest_last"], "n": s["n"]} for r, s in SCAN.items()])
print("files sharing a first chunk:", dig[dig.duplicated("first", keep=False)].recording.tolist())
print("files sharing a last chunk:", dig[dig.duplicated("last", keep=False)].recording.tolist())
same_len = dig[dig.duplicated("n", keep=False)].groupby("n").recording.apply(list)
print("files of identical length (samples):", same_len.tolist())
files sharing a first chunk: []
files sharing a last chunk: []
files of identical length (samples): [['3C-1', '3C-3'], ['9E-1', '9E-2', '9E-4', '9E-6'], ['9E-3', '9E-5'], ['11G-0', '12G-0', '9E-0'], ['7D-3', '8D-3'], ['7D-0', '8D-0'], ['10F-7', '10F-8']]

No two files share a chunk, so no recording is deposited twice; files of equal length differ in their data.

Light events¶

The Methods say the light ON and OFF times were stored in the MaxWell file's GPIO bit and in a stimulation log (Methods, Design of optogenetic system). Neither is in the NWB files. In slice 3C the LED leaves a step in the voltage of every channel at onset and the opposite step at offset; these steps are counted here at several thresholds against the bin-to-bin noise, between consecutive 10 ms bins (lag 1) and between bins 20 ms apart (lag 2, which also finds a step split across two bins).

In [8]:
rows = []
for r, s in SCAN.items():
    row = {"recording": r, "duration_s": round(s["n"] / hdmea.FS, 1)}
    for th in (20, 40, 60, 100):
        L = hdmea.light_steps(s["dc"], th)
        row[f"trials@{th}"] = len(L["on"])
        row[f"up/down@{th}"] = f"{L['n_up']}/{L['n_down']}"
    for th in (40, 60):
        row[f"trials@{th}_lag2"] = len(hdmea.light_steps(s["dc"], th, lag=2)["on"])
    row["noise"] = round(L["noise"], 2)
    row["max_step"] = round(float(np.abs(np.diff(s["dc"])).max()), 1)
    row["max_step_lag2"] = round(float(np.abs(s["dc"][2:] - s["dc"][:-2]).max()), 1)
    rows.append(row)
steps = pd.DataFrame(rows)
print(steps.to_string())
LIGHT = {r: hdmea.light_steps(SCAN[r]["dc"]) for r in steps.recording}
with_light = [r for r, L in LIGHT.items() if len(L["on"])]
print("\nrecordings with light trials at the main threshold (%g counts):" % hdmea.STEP_MIN, with_light)
for r in with_light:
    L = LIGHT[r]
    print(r, "onsets (s):", np.round(L["on"], 2).tolist(), " ON durations (s):", np.round(L["off"] - L["on"], 2).tolist(),
          " onset steps:", np.round(L["up"]).astype(int).tolist(), " offset steps:", np.round(L["down"]).astype(int).tolist())
print("recordings with light trials at 60 counts, lag 2:", steps[steps["trials@60_lag2"] > 0].recording.tolist(),
      "; at 40 counts, lag 2:", steps[steps["trials@40_lag2"] > 0].recording.tolist())
   recording  duration_s  trials@20 up/down@20  trials@40 up/down@40  trials@60 up/down@60  trials@100 up/down@100  trials@40_lag2  trials@60_lag2  noise  max_step  max_step_lag2
0      10F-0       313.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.18       0.7            1.2
1      10F-1       126.6          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.21       0.9            1.0
2      10F-2       212.9          0        0/1          0        0/0          0        0/0           0         0/0               0               0   0.17      30.3           36.4
3      10F-3       200.2          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.20       2.3            3.8
4      10F-4       310.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.20       2.0            3.2
5      10F-5       320.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.20       2.1            3.2
6      10F-6       360.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.23       6.8            9.4
7      10F-7       390.1          0        0/1          0        0/1          0        0/0           0         0/0               0               0   0.19      57.2           85.2
8      10F-8       390.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       1.8            2.9
9      11G-0       200.2          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.18       2.5            4.0
10     11G-1       390.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.18       1.9            2.9
11     11G-2       510.2          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.19      15.1           20.4
12     11G-3       360.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.18       3.9            6.6
13     11G-4       300.9          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.18       0.9            1.6
14     12G-0       200.2          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.16       1.0            1.8
15     12G-1       390.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.16       0.9            1.5
16     12G-2       510.2          0        0/1          0        0/0          0        0/0           0         0/0               0               0   0.16      25.5           40.2
17     12G-3       301.6          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       0.7            1.1
18      1A-0       418.4          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.19       6.5           12.1
19      2B-0       199.3          0        5/0          0        0/0          0        0/0           0         0/0               0               0   3.57      24.4           46.9
20      2B-1       302.7          1        6/1          0        1/0          0        1/0           0         0/0               1               0   2.53      72.9          139.6
21      2B-2       243.1          0        5/0          0        0/0          0        0/0           0         0/0               0               0   1.89      35.7           60.3
22      3C-0        54.8          1        1/1          1        1/1          1        1/1           0         1/0               1               1   0.53     132.5          223.9
23      3C-1        40.0          1        1/2          1        1/1          1        1/1           0         1/0               1               1   0.59     132.5          222.7
24      3C-2        40.0          1        1/1          1        1/1          1        1/1           0         1/0               1               1   0.59     123.1          243.5
25      3C-3        40.0          1        1/1          1        1/1          1        1/1           0         1/0               1               1   1.09     153.2          252.5
26      3C-4        40.0          1        1/1          1        1/1          1        1/1           0         1/0               1               1   1.24     149.8          261.0
27      3C-5        70.1          1        1/1          1        1/1          1        1/1           0         1/0               1               1   0.86     138.4          253.2
28      3C-6       120.0          6       6/10          6        6/7          6        6/6           0         6/0               6               6   1.59     164.5          279.9
29      3C-7       190.2          6        6/9          6        6/6          6        6/6           0         6/0               6               6   0.65     168.1          282.8
30      4C-0       190.2          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       4.4            7.6
31      4C-1       190.3          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.18      14.2           24.6
32      4C-2       190.2          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.18       6.0           11.1
33      4C-3        84.8          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.18      14.2           24.8
34      4C-4       462.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.16       0.7            0.9
35      4C-5       242.9          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       7.7           11.0
36      5C-0       220.3          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.16       2.2            4.1
37      5C-1        50.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.16       1.7            3.2
38      5C-2       173.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.13       1.4            2.2
39      5C-3       300.2          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       2.2            3.9
40      5C-4       362.7          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.16       0.7            1.2
41      5C-5       427.9          0        1/0          0        0/0          0        0/0           0         0/0               0               0   0.17      33.4           43.3
42      6C-0       220.3          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.16      16.1           29.1
43      6C-1       100.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.16      19.8           37.4
44      6C-2       100.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.16      19.4           35.8
45      6C-3       100.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.15       5.8           10.4
46      6C-4        90.5          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17      19.4           33.7
47      7D-0       310.4          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       5.3            9.6
48      7D-1       310.4          0        5/0          0        0/0          0        0/0           0         0/0               0               0   0.19      21.6           39.3
49      7D-2       310.4          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.18      19.6           35.5
50      7D-3       210.2          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       2.5            4.4
51      7D-4       210.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       5.8           10.6
52      7D-5       240.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       6.4           11.1
53      7D-6        80.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.18      19.9           38.4
54      7D-7        80.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17      19.8           36.0
55      8D-0       310.4          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.16       2.9            5.0
56      8D-1       210.5          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.18       5.6           10.8
57      8D-2       210.2          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.16       3.1            5.3
58      8D-3       210.2          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       3.0            5.4
59      8D-4       240.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       3.4            5.7
60      9E-0       200.2          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       5.0            8.9
61      9E-1       160.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       4.0            6.2
62      9E-2       160.1          0        1/0          0        0/0          0        0/0           0         0/0               0               0   0.18      21.8           41.8
63      9E-3       200.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.19       3.4            5.0
64      9E-4       160.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.18       3.3            5.6
65      9E-5       200.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       3.1            5.2
66      9E-6       160.1          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.20       7.4            8.8
67      9E-7       308.5          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.18       0.7            1.1
68      9E-8       322.7          0        0/0          0        0/0          0        0/0           0         0/0               0               0   0.17       6.4           10.3

recordings with light trials at the main threshold (60 counts): ['3C-0', '3C-1', '3C-2', '3C-3', '3C-4', '3C-5', '3C-6', '3C-7']
3C-0 onsets (s): [3.02]  ON durations (s): [5.01]  onset steps: [67]  offset steps: [-81]
3C-1 onsets (s): [10.02]  ON durations (s): [10.01]  onset steps: [90]  offset steps: [-75]
3C-2 onsets (s): [10.02]  ON durations (s): [10.0]  onset steps: [123]  offset steps: [-69]
3C-3 onsets (s): [10.03]  ON durations (s): [10.0]  onset steps: [153]  offset steps: [-83]
3C-4 onsets (s): [10.03]  ON durations (s): [10.0]  onset steps: [150]  offset steps: [-82]
3C-5 onsets (s): [10.04]  ON durations (s): [10.0]  onset steps: [138]  offset steps: [-75]
3C-6 onsets (s): [1.01, 19.1, 38.17, 58.76, 80.35, 99.95]  ON durations (s): [10.0, 10.0, 10.01, 10.0, 10.01, 10.01]  onset steps: [148, 131, 109, 164, 97, 72]  offset steps: [-88, -67, -80, -75, -77, -80]
3C-7 onsets (s): [70.12, 90.15, 110.18, 130.21, 150.25, 170.28]  ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 10.01]  onset steps: [131, 140, 153, 139, 168, 85]  offset steps: [-73, -71, -76, -74, -83, -77]
recordings with light trials at 60 counts, lag 2: ['3C-0', '3C-1', '3C-2', '3C-3', '3C-4', '3C-5', '3C-6', '3C-7'] ; at 40 counts, lag 2: ['2B-1', '3C-0', '3C-1', '3C-2', '3C-3', '3C-4', '3C-5', '3C-6', '3C-7']

Paired light steps (onset +67 to +168 counts, offset -67 to -88 counts, in 10 ms bins against a bin-to-bin noise of 0.5 to 1.6 counts) occur in the eight 3C recordings. In the first channel group no other file has one at the main threshold of 60 counts, at lag 1 or lag 2: outside 3C, one file (2B-1, noise 2.5) has a single unpaired upward jump of 73 counts, and the largest jump in any other file is 57 counts (10F-7), unpaired. At 20 and 40 counts the extra steps at lag 1 are also unpaired; at 40 counts and lag 2, 2B-1 has one paired step (largest lag-2 change 139.6 counts, against a noise of 2.5). The first group alone does not settle the other slices; every group is read in the next section. The 3C light steps are in the voltage itself, so they share its clock by construction; there is no trial table to compare with.

Each light period lasts 10.0 s (3C-0: 5.0 s). 3C-6 and 3C-7 hold six light periods each, about 20 s apart (onset to onset); in 3C-6 the first starts 1 s into the file, so 5 of its 6 have a full 10 s pre window. 3C-1 to 3C-5 hold one 10 s period each, starting 10 s into a 40 to 70 s file, which fits the intensity sweeps of Extended Data Fig. 7, but the files do not say so. The claims file has five trials for 3C (Fig. 3a, Extended Data Fig. 4 legend); 3C-6 has five whose three windows lie in the file. Its onsets are 18 to 21 s apart, so some of these windows hold part of a neighbouring light period (printed in the variant below).

Light steps on every channel group¶

The scan above reads the first 64-channel group only. A light artifact confined to another part of the array would be missed there, so every group of every file of the slices the paper illuminated outside 3C in 10-trial, ChR2 or closed-loop protocols (4C, 5C, 7D, 8D, 10F, 11G) is read here for its channel-mean trace (helper hdmea.group_means), with 3C as a positive control. Steps are counted at lag 1 and at lag 2 (a step split across two 10 ms bins), at 60 and 40 counts. This reads about 130 GB; one 1.9 GB file took 14 s while preparing (0.8 GB peak memory), so the whole was estimated at 16 minutes.

In [9]:
t = time.time()
ALLG = {m["recording"]: hdmea.group_means(m["url"], workers=12) for m in M
        if m["recording"].split("-")[0] in ("3C", "4C", "5C", "7D", "8D", "10F", "11G")}
print("read every channel group of %d recordings in %.1f min (%.0f GB); peak memory %.2f GB" % (
      len(ALLG), (time.time() - t) / 60, info.set_index("recording").size_gb.reindex(list(ALLG)).sum(),
      resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6))
rows = []
for r, D in ALLG.items():
    row = {"recording": r, "groups": len(D)}
    for th, lag in ((60, 1), (60, 2), (40, 2)):
        n = [len(hdmea.light_steps(d, th, lag=lag)["on"]) for d in D]
        row[f"groups_with_trials@{th}_lag{lag}"] = sum(k > 0 for k in n)
        row[f"most_trials@{th}_lag{lag}"] = max(n)
    row["max_step"] = round(float(max(np.abs(np.diff(d)).max() for d in D)), 1)
    row["max_step_lag2"] = round(float(max(np.abs(d[2:] - d[:-2]).max() for d in D)), 1)
    row["noise_median"] = round(float(np.median([hdmea.light_steps(d)["noise"] for d in D])), 2)
    rows.append(row)
allg = pd.DataFrame(rows)
print(allg.to_string())
out3c = allg[~allg.recording.str.startswith("3C")]
print("\noutside 3C, recordings with a light trial in any group: at 60 counts, lag 1:",
      out3c[out3c["groups_with_trials@60_lag1"] > 0].recording.tolist(), "; lag 2:",
      out3c[out3c["groups_with_trials@60_lag2"] > 0].recording.tolist(), "; at 40 counts, lag 2:",
      out3c[out3c["groups_with_trials@40_lag2"] > 0].recording.tolist())
print("outside 3C, largest step in any group: lag 1 %.1f, lag 2 %.1f counts" % (out3c.max_step.max(), out3c.max_step_lag2.max()))
for r in out3c[out3c["groups_with_trials@40_lag2"] > 0].recording:
    for g, d in enumerate(ALLG[r]):
        L = hdmea.light_steps(d, 40, lag=2)
        if len(L["on"]):
            print(r, "group", g, "onsets (s):", np.round(L["on"], 2).tolist(), "ON durations (s):",
                  np.round(L["off"] - L["on"], 2).tolist(), "steps:", np.round(L["up"]).astype(int).tolist(),
                  np.round(L["down"]).astype(int).tolist())
read every channel group of 47 recordings in 13.4 min (132 GB); peak memory 1.71 GB
   recording  groups  groups_with_trials@60_lag1  most_trials@60_lag1  groups_with_trials@60_lag2  most_trials@60_lag2  groups_with_trials@40_lag2  most_trials@40_lag2  max_step  max_step_lag2  noise_median
0      10F-0      14                           0                    0                           0                    0                           0                    0       1.5            2.1          0.19
1      10F-1      16                           0                    0                           0                    0                           0                    0       1.0            1.3          0.19
2      10F-2      16                           0                    0                           0                    0                           0                    0      38.8           47.1          0.18
3      10F-3      16                           0                    0                           0                    0                           0                    0       5.6            9.8          0.19
4      10F-4      16                           0                    0                           0                    0                           0                    0       5.0            7.8          0.20
5      10F-5      16                           0                    0                           0                    0                           0                    0       4.9            7.6          0.19
6      10F-6      16                           0                    0                           0                    0                           0                    0       7.9           10.0          0.22
7      10F-7      16                           0                    0                           0                    0                           0                    0      57.2           85.2          0.19
8      10F-8      16                           0                    0                           0                    0                           0                    0       5.7            9.5          0.17
9      11G-0      14                           0                    0                           0                    0                           0                    0       5.5            9.3          0.18
10     11G-1      14                           0                    0                           0                    0                           0                    0       4.2            6.9          0.18
11     11G-2      14                           0                    0                           0                    0                           0                    0      30.5           58.9          0.19
12     11G-3      14                           0                    0                           0                    0                           0                    0       4.6            8.4          0.18
13     11G-4      14                           0                    0                           0                    0                           0                    0       1.3            1.8          0.18
14      3C-0      16                          16                    1                          16                    1                          16                    1     181.3          301.9          0.54
15      3C-1      16                          16                    1                          16                    1                          16                    1     182.4          333.2          0.60
16      3C-2      16                          16                    1                          16                    1                          16                    1     217.0          369.5          0.61
17      3C-3      16                          16                    1                          16                    1                          16                    1     223.0          357.9          1.02
18      3C-4      16                          16                    1                          16                    1                          16                    1     225.3          370.9          1.20
19      3C-5      16                          16                    1                          16                    1                          16                    1     224.4          372.4          0.86
20      3C-6      16                          16                    6                          16                    6                          16                    6     265.6          427.2          1.49
21      3C-7      16                          16                    6                          16                    6                          16                    6     277.3          424.8          0.66
22      4C-0      12                           0                    0                           0                    0                           0                    0      27.1           35.7          0.19
23      4C-1      12                           0                    0                           1                    3                           7                    6      37.6           63.1          0.23
24      4C-2      12                           0                    0                           0                    0                           0                    0      26.7           29.2          0.20
25      4C-3      12                           0                    0                           1                    1                           7                    1      35.7           63.6          0.21
26      4C-4      12                           0                    0                           0                    0                           0                    0       1.0            1.4          0.18
27      4C-5      12                           0                    0                           0                    0                           0                    0       7.7           11.0          0.18
28      5C-0      15                           0                    0                           0                    0                           0                    0       6.3           11.3          0.16
29      5C-1      15                           0                    0                           0                    0                           0                    0       5.9           11.2          0.16
30      5C-2      15                           0                    0                           0                    0                           0                    0       4.2            7.6          0.13
31      5C-3      15                           0                    0                           0                    0                           0                    0       8.7           15.5          0.18
32      5C-4      15                           0                    0                           0                    0                           0                    0       1.0            1.5          0.16
33      5C-5      15                           0                    0                           0                    0                           2                    1      83.8          130.8          0.17
34      7D-0      15                           0                    0                           0                    0                           2                    3      26.2           45.9          0.19
35      7D-1      15                           0                    0                           0                    0                           0                    0      21.6           39.3          0.19
36      7D-2      15                           0                    0                           8                    6                          10                    6      59.6          108.3          0.22
37      7D-3      15                           0                    0                           0                    0                           0                    0       2.6            4.8          0.17
38      7D-4      15                           0                    0                           0                    0                           0                    0      24.1           44.3          0.17
39      7D-5      15                           0                    0                           0                    0                           2                    4      25.3           46.4          0.19
40      7D-6      15                           0                    0                           0                    0                           0                    0      19.9           38.4          0.18
41      7D-7      15                           0                    0                           8                    1                          10                    1      59.7          110.4          0.20
42      8D-0      16                           0                    0                           0                    0                           0                    0      11.6           20.7          0.18
43      8D-1      16                           0                    0                           0                    0                           0                    0      11.3           19.8          0.20
44      8D-2      16                           0                    0                           0                    0                           0                    0      11.5           20.4          0.18
45      8D-3      16                           0                    0                           0                    0                           0                    0      11.5           20.2          0.18
46      8D-4      16                           0                    0                           0                    0                           0                    0      11.5           20.5          0.18

outside 3C, recordings with a light trial in any group: at 60 counts, lag 1: [] ; lag 2: ['4C-1', '4C-3', '7D-2', '7D-7'] ; at 40 counts, lag 2: ['4C-1', '4C-3', '5C-5', '7D-0', '7D-2', '7D-5', '7D-7']
outside 3C, largest step in any group: lag 1 83.8, lag 2 130.8 counts
4C-1 group 5 onsets (s): [70.12, 110.17, 150.23, 170.26] ON durations (s): [10.0, 30.04, 10.01, 10.0] steps: [49, 42, 41, 43] [-43, -43, -41, -41]
4C-1 group 6 onsets (s): [70.12, 90.15, 110.17, 130.21, 150.23, 170.26] ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 10.0] steps: [50, 50, 44, 50, 42, 47] [-48, -48, -43, -47, -41, -45]
4C-1 group 7 onsets (s): [70.12, 90.15, 110.17, 130.21, 150.23, 170.26] ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 10.0] steps: [48, 48, 43, 48, 42, 46] [-46, -46, -42, -46, -40, -45]
4C-1 group 8 onsets (s): [70.12, 90.15, 110.17, 130.21, 150.23, 170.26] ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 10.0] steps: [53, 52, 47, 53, 45, 50] [-51, -50, -45, -50, -43, -48]
4C-1 group 9 onsets (s): [70.11, 90.14, 110.17, 130.2, 150.23, 170.26] ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 10.0] steps: [41, 44, 53, 44, 52, 57] [-40, -42, -51, -42, -50, -56]
4C-1 group 10 onsets (s): [70.11, 90.14, 110.17, 130.2, 150.23, 170.26] ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 10.0] steps: [42, 45, 56, 44, 53, 58] [-42, -44, -53, -44, -52, -57]
4C-1 group 11 onsets (s): [70.12, 90.14, 110.17, 130.21, 150.23, 170.26] ON durations (s): [10.0, 10.0, 10.0, 9.99, 10.0, 10.0] steps: [57, 42, 50, 56, 47, 52] [-55, -41, -48, -40, -47, -52]
4C-3 group 5 onsets (s): [30.05] ON durations (s): [10.0] steps: [52] [-44]
4C-3 group 6 onsets (s): [30.05] ON durations (s): [10.0] steps: [51] [-48]
4C-3 group 7 onsets (s): [30.05] ON durations (s): [10.0] steps: [50] [-47]
4C-3 group 8 onsets (s): [30.05] ON durations (s): [10.0] steps: [53] [-50]
4C-3 group 9 onsets (s): [30.04] ON durations (s): [10.0] steps: [43] [-42]
4C-3 group 10 onsets (s): [30.04] ON durations (s): [10.0] steps: [44] [-42]
4C-3 group 11 onsets (s): [30.05] ON durations (s): [10.0] steps: [57] [-55]
5C-5 group 10 onsets (s): [120.9] ON durations (s): [0.76] steps: [84] [-42]
5C-5 group 14 onsets (s): [120.9] ON durations (s): [0.76] steps: [49] [-43]
7D-0 group 12 onsets (s): [200.26, 230.31, 260.35] ON durations (s): [10.0, 10.0, 10.0] steps: [45, 43, 45] [-41, -40, -41]
7D-0 group 13 onsets (s): [200.26, 260.35] ON durations (s): [10.0, 10.0] steps: [46, 46] [-41, -41]
7D-2 group 5 onsets (s): [110.17, 140.2, 170.24, 200.28, 230.32, 260.35] ON durations (s): [10.0, 10.01, 10.0, 10.0, 10.0, 10.0] steps: [51, 42, 51, 49, 51, 51] [-46, -45, -46, -45, -46, -46]
7D-2 group 6 onsets (s): [110.17, 140.2, 170.24, 200.28, 230.32, 260.35] ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 10.0] steps: [53, 44, 53, 51, 54, 53] [-49, -40, -48, -47, -48, -49]
7D-2 group 7 onsets (s): [110.16, 140.2, 170.23, 200.28, 230.31, 260.35] ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 9.99] steps: [50, 57, 45, 66, 48, 69] [-47, -54, -43, -63, -46, -41]
7D-2 group 8 onsets (s): [110.16, 140.2, 170.23, 200.27, 230.31, 260.34] ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 10.0] steps: [63, 73, 58, 41, 62, 52] [-62, -69, -55, -42, -59, -52]
7D-2 group 9 onsets (s): [110.16, 140.2, 170.23, 200.28, 230.31, 260.34] ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 10.0] steps: [58, 66, 52, 76, 56, 47] [-55, -62, -50, -72, -53, -47]
7D-2 group 10 onsets (s): [110.16, 140.2, 170.23, 200.27, 230.31, 260.34] ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 10.0] steps: [64, 73, 57, 41, 61, 51] [-60, -67, -54, -42, -57, -51]
7D-2 group 11 onsets (s): [110.16, 140.2, 170.23, 200.27, 230.31, 260.34] ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 10.0] steps: [70, 80, 63, 45, 68, 57] [-66, -75, -59, -46, -64, -56]
7D-2 group 12 onsets (s): [110.16, 140.2, 170.23, 200.27, 230.31, 260.34] ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 10.0] steps: [76, 85, 68, 48, 73, 60] [-71, -81, -64, -50, -69, -60]
7D-2 group 13 onsets (s): [110.16, 140.2, 170.23, 200.27, 230.31, 260.34] ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 10.0] steps: [77, 88, 70, 49, 75, 62] [-74, -83, -66, -51, -70, -62]
7D-2 group 14 onsets (s): [110.16, 140.2, 170.23, 200.27, 230.31, 260.34] ON durations (s): [10.0, 10.0, 10.0, 10.0, 10.0, 10.0] steps: [75, 85, 68, 48, 73, 61] [-71, -79, -64, -49, -68, -60]
7D-5 group 12 onsets (s): [20.04, 60.05, 100.05, 140.05] ON durations (s): [10.0, 10.0, 10.0, 10.0] steps: [44, 43, 46, 43] [-41, -40, -42, -40]
7D-5 group 13 onsets (s): [20.04, 100.05] ON durations (s): [10.0, 10.0] steps: [45, 46] [-41, -41]
7D-7 group 5 onsets (s): [20.04] ON durations (s): [10.0] steps: [52] [-47]
7D-7 group 6 onsets (s): [20.04] ON durations (s): [10.0] steps: [55] [-49]
7D-7 group 7 onsets (s): [20.03] ON durations (s): [10.0] steps: [46] [-44]
7D-7 group 8 onsets (s): [20.03] ON durations (s): [10.0] steps: [59] [-56]
7D-7 group 9 onsets (s): [20.03] ON durations (s): [10.0] steps: [54] [-51]
7D-7 group 10 onsets (s): [20.03] ON durations (s): [10.0] steps: [58] [-56]
7D-7 group 11 onsets (s): [20.03] ON durations (s): [10.0] steps: [65] [-61]
7D-7 group 12 onsets (s): [20.03] ON durations (s): [10.0] steps: [69] [-66]
7D-7 group 13 onsets (s): [20.03] ON durations (s): [10.0] steps: [72] [-67]
7D-7 group 14 onsets (s): [20.03] ON durations (s): [10.0] steps: [71] [-66]

Every channel group of every 3C recording shows the light steps (16 of 16 groups, at every threshold and lag), so the control works. Outside 3C no group of any file has a paired light trial at 60 counts (the largest step between consecutive bins is 83.8 counts, in 5C-5). At lag 2, paired steps of 40 to 88 counts, 10.0 s apart (in 4C-1 group 5 two steps fall below the threshold and one onset pairs with an offset 30 s later), appear in groups 5 to 14 of six files: 4C-1 (six periods 20 s apart, from 70.1 s), 4C-3 (one, at 30.0 s), 7D-2 (six, 30 s apart, from 110.2 s), 7D-7 (one, at 20.0 s), and, at 40 counts only and in groups 12 and 13, 7D-0 (three) and 7D-5 (four). Their length, 10 s, matches the 3C light periods, though their spacing (20 s in 4C-1, 30 s in 7D-2 and 7D-0, 40 s in 7D-5) is not always the 20 s of 3C-6 and 3C-7; they are read as light events, and the files do not say so. 5C-5 has one pair 0.76 s long in two groups, which does not fit a 10 s light period. No group of any 5C, 8D, 10F or 11G recording shows a 10 s step, including 10F, which the paper illuminated for 10 trials, and the closed-loop slices 5C and 8D. Light events can therefore be recovered for 3C, 4C (ChR2) and 7D, and for no file of 5C, 8D, 10F or 11G; 9E and 12G were read on their first channel group only, where they show none.

table1-cohort¶

Recordings came from 12 hippocampal slices from 7 adult patients with refractory temporal lobe epilepsy (5 female, 2 male, aged 20 to 52), 8 slices transduced with HcKCR1, 2 with ChR2 and 2 with no opsin.

Criterion: reproduced when the dandiset's subjects and sessions resolve to 12 slices from 7 patients with the opsins, ages and sexes of Table 1; partially reproduced when the HcKCR1 slices of Table 2 (3C, 5C, 7D, 8D, 9E, 10F, 11G, 12G) are all present and identifiable but others are not. Table 1 is read from the paper (paper/); its ages and sexes per patient are A 20 M, B 44 F, C 40 F, D 46 F, E 46 F, F 52 F, G 35 M.

In [10]:
pat = info.groupby("patient").agg(age=("age", "first"), sex=("sex", "first"), slices=("slice", lambda s: sorted(set(s))),
                                  recordings=("recording", "size"))
pat["age_years"] = pat.age.str.extract(r"P(\d+)Y").astype(int)
print(pat.to_string())
print("\nslices:", info.slice.nunique(), " patients:", info.patient.nunique())
print("female patients:", (pat.sex == "F").sum(), " male:", (pat.sex == "M").sum(),
      " ages %d to %d" % (pat.age_years.min(), pat.age_years.max()))
# Table 1 of the paper (paper/): the slices, and each patient's age and sex
TABLE1_SLICES = ["1A", "2B", "3C", "4C", "5C", "6C", "7D", "8D", "9E", "10F", "11G", "12G"]
TABLE1_PATIENTS = {"A": (20, "M"), "B": (44, "F"), "C": (40, "F"), "D": (46, "F"), "E": (46, "F"), "F": (52, "F"), "G": (35, "M")}
print("slices as in Table 1:", sorted(set(info.slice)) == sorted(TABLE1_SLICES))
print("patients as in Table 1:", sorted(pat.index) == sorted(TABLE1_PATIENTS))
print("each patient's age and sex as in Table 1:",
      {p: (int(pat.loc[p, "age_years"]), pat.loc[p, "sex"]) == v for p, v in TABLE1_PATIENTS.items()})
hckcr1 = ["3C", "5C", "7D", "8D", "9E", "10F", "11G", "12G"]
print("HcKCR1 slices of Table 2 present by name:", all(s in set(info.slice) for s in hckcr1))
opsin_words = ("hckcr1", "chr2", "opsin", "virus", "aav", "camk", "eyfp", "genotype", "strain")
in_files = sorted({k for m in M for k, v in {**m["general"], **m["series_text"]}.items()
                   if any(w in (k + " " + str(v)).lower() for w in opsin_words)}
                  | {p for ps in info.paths for p in ps if any(w in p.lower() for w in opsin_words)})
print("fields naming an opsin, virus or genotype anywhere in the files (general/ included):", in_files,
      "; in the dandiset metadata:", any(w in str(meta).lower() for w in ("hckcr1", "chr2", "aav9")))
          age sex            slices  recordings  age_years
patient                                                   
A        P20Y   M              [1A]           1         20
B        P44Y   F              [2B]           3         44
C        P40Y   F  [3C, 4C, 5C, 6C]          25         40
D        P46Y   F          [7D, 8D]          13         46
E        P46Y   F              [9E]           9         46
F        P52Y   F             [10F]           9         52
G        P35Y   M        [11G, 12G]           9         35

slices: 12  patients: 7
female patients: 5  male: 2  ages 20 to 52
slices as in Table 1: True
patients as in Table 1: True
each patient's age and sex as in Table 1: {'A': True, 'B': True, 'C': True, 'D': True, 'E': True, 'F': True, 'G': True}
HcKCR1 slices of Table 2 present by name: True
fields naming an opsin, virus or genotype anywhere in the files (general/ included): [] ; in the dandiset metadata: False

Result: partially reproduced. The 69 files resolve to 12 slices named as in Table 1 (1A to 12G), from 7 patients (A to G), 5 female and 2 male, aged 20 to 52, with each patient's age and sex as in Table 1; the 8 HcKCR1 slices of Table 2 are present by name. The opsin of each slice is not recorded in the files (no field under general/ or elsewhere names an opsin, virus or genotype) or in the dandiset's metadata, so the count of 8 HcKCR1, 2 ChR2 and 2 no-opsin slices can be had only by reading the slice names against the paper's Table 1, not from the dandiset.

Claims that need sorted units or light events¶

units-per-recording and every claim on firing rates, amplitudes, bursts, propagation, waveform or opto-response clusters rests on the paper's curated units (Kilosort2, then manual and automatic curation). The files hold no units table, so these claims are blocked as data_missing. The claims file makes a re-sort a variant that decides nothing, and the manual curation cannot be repeated. The light-trial claims also need the light events, which are recoverable from the voltage in slices 3C, 4C and 7D and in no file of 5C, 8D, 10F or 11G (above), and the claims on 0-mg, 0-mg+KA and bicuculline recordings need to know which file is which condition, which no file says.

Variant: the 3C light trials in the raw voltage¶

This is not the paper's method and decides no outcome. It shows what the dataset holds around the 3C light trials, the ones whose steps reach the first channel group that the scan reads. Per 100 ms bin of the first 64-channel group, it gives the fraction of channels at 0 or 1023 (the ends of the range the values take) and the multi-unit threshold crossings (300 to 6000 Hz, 5 MAD per channel and chunk). Crossings are counted in the claims file's windows, pre (10 s before onset), ON (10 s from onset) and OFF (onset + 10 to

  • 20 s), averaged over the recording's trials, and compared by two-tailed paired t-tests over channels with crossings, Holm-adjusted over the three comparisons, as the claims file's opening comment does for units. Light onset and offset leave transients in these windows, so the comparison is also run with the first second of each window left out (skip_s 1); the crossing threshold is still estimated per 3.9 s chunk, transients included. A channel is not a unit: one channel can carry several units and one unit can reach several channels.
In [11]:
def compare(rec, rates):
    keep = (rates["pre"] + rates["on"] + rates["off"]) > 0
    pre, on, off = rates["pre"][keep], rates["on"][keep], rates["off"][keep]
    p = [stats.ttest_rel(a, b).pvalue for a, b in ((pre, on), (on, off), (pre, off))]
    padj = multipletests(p, method="holm")[1]
    return {"recording": rec, "trials": rates["n_trials"], "channels": int(keep.sum()),
            "pre_Hz": pre.mean(), "on_Hz": on.mean(), "off_Hz": off.mean(),
            "change_on_vs_pre_%": 100 * (on.mean() - pre.mean()) / pre.mean(),
            "p_pre_on": padj[0], "p_on_off": padj[1], "p_pre_off": padj[2],
            "channels_lower_on": int((on < pre).sum())}

def saturation(rec, skip):
    rail, on, ns = SCAN[rec]["rail"], LIGHT[rec]["on"], int(round(skip * 10))
    out = {"pre": [], "on": [], "off": [], "on_first_0.5s": []}
    for t in on:
        b = int(round(t * 10))
        if b - 100 < 0 or b + 200 > len(rail):
            continue
        out["pre"].append(rail[b - 100 + ns:b].mean()); out["on"].append(rail[b + ns:b + 100].mean())
        out["off"].append(rail[b + 100 + ns:b + 200].mean()); out["on_first_0.5s"].append(rail[b + ns:b + ns + 5].mean())
    return {f"rail_{k}": (np.mean(v) if v else np.nan) for k, v in out.items()}

# skip_s 0: the claims file's windows; skip_s 1: the first second of each window left out, which
# removes the onset and offset transients (the crossing threshold is still estimated per chunk)
res = []
for skip in (0.0, 1.0):
    for r in with_light:
        w = hdmea.window_rates(SCAN[r]["counts"], LIGHT[r]["on"], skip=skip)
        row = compare(r, w) if w["n_trials"] else {"recording": r, "trials": 0}
        res.append({"skip_s": skip, **row, **saturation(r, skip)})
var = pd.DataFrame(res)
print(var.round(4).to_string())

# window_rates keeps a trial when its three windows lie in the file, but does not check them against the
# neighbouring light periods; print, per trial of 3C-6 and 3C-7, the seconds of light each window holds
def light_in(a, b, periods):
    return sum(max(0.0, min(b, off) - max(a, on)) for on, off in periods)
for r in ("3C-6", "3C-7"):
    L = LIGHT[r]
    for k, t in enumerate(L["on"]):
        if t - 10 < 0 or (int(round(t * 10)) + 200) > len(SCAN[r]["counts"]):
            continue
        others = [(a, b) for j, (a, b) in enumerate(zip(L["on"], L["off"])) if j != k]
        print(r, "trial at %.2f s:" % t, ", ".join("%s %s %.2f s" % (w, s, light_in(t + a, t + b, others))
              for s in (0.0, 1.0) for w, (a, b) in (("pre", (-10 + s, 0)), ("ON", (s, 10)), ("OFF", (10 + s, 20)))
              ), "of light from other periods (skip_s 0, then 1)")
    skip_s recording  trials  rail_pre  rail_on  rail_off  rail_on_first_0.5s  channels   pre_Hz    on_Hz   off_Hz  change_on_vs_pre_%  p_pre_on  p_on_off  p_pre_off  channels_lower_on
0      0.0      3C-0       0       NaN      NaN       NaN                 NaN       NaN      NaN      NaN      NaN                 NaN       NaN       NaN        NaN                NaN
1      0.0      3C-1       1    0.0000   0.1615    0.0929              0.8496      63.0  38.6651   4.7492  11.6683            -87.7171    0.0001    0.4323     0.0059               56.0
2      0.0      3C-2       1    0.0000   0.1604    0.0878              0.8158      64.0  48.1891   4.9578   4.5813            -89.7117    0.0000    0.7851     0.0000               59.0
3      0.0      3C-3       1    0.0000   0.1637    0.0675              0.8323      63.0  54.4175   5.2254   2.2921            -90.3976    0.0000    0.0000     0.0000               56.0
4      0.0      3C-4       1    0.0000   0.1552    0.0700              0.8194      64.0  34.9500   5.0234   2.7359            -85.6268    0.0001    0.0005     0.0001               57.0
5      0.0      3C-5       1    0.0000   0.1641    0.0736              0.8077      64.0  50.4516   5.2719   3.8484            -89.5506    0.0000    0.0002     0.0000               56.0
6      0.0      3C-6       5    0.0555   0.1083    0.0982              0.9354      64.0  16.1034  13.5312  11.5184            -15.9729    0.8194    0.8194     0.0264               58.0
7      0.0      3C-7       6    0.0573   0.1241    0.0709              0.8742      64.0  16.2539  17.2414  16.1143              6.0755    0.8711    0.8711     0.0008               15.0
8      1.0      3C-0       0       NaN      NaN       NaN                 NaN       NaN      NaN      NaN      NaN                 NaN       NaN       NaN        NaN                NaN
9      1.0      3C-1       1    0.0000   0.0855    0.0260              0.4613      63.0  42.9030   4.1429  12.3880            -90.3437    0.0001    0.3830     0.0040               57.0
10     1.0      3C-2       1    0.0000   0.0899    0.0215              0.4912      64.0  53.4323   4.1823   4.8993            -92.1727    0.0000    0.6438     0.0000               59.0
11     1.0      3C-3       1    0.0000   0.0907    0.0023              0.5171      63.0  60.3245   4.0529   2.4339            -93.2815    0.0000    0.0000     0.0000               57.0
12     1.0      3C-4       1    0.0000   0.0833    0.0036              0.4302      64.0  38.7170   4.3993   2.9062            -88.6373    0.0001    0.0119     0.0001               58.0
13     1.0      3C-5       1    0.0000   0.0918    0.0088              0.5171      64.0  55.9601   3.9132   4.1094            -93.0072    0.0000    0.4853     0.0000               60.0
14     1.0      3C-6       5    0.0448   0.0266    0.0367              0.2555      64.0  17.5135  14.3052  12.6799            -18.3192    0.7674    0.7674     0.0386               59.0
15     1.0      3C-7       6    0.0035   0.0436    0.0047              0.3654      64.0  15.4968  18.1707  15.4062             17.2545    0.0599    0.0599     0.0599               15.0
3C-6 trial at 19.10 s: pre 0.0 1.91 s, ON 0.0 0.00 s, OFF 0.0 0.93 s, pre 1.0 0.91 s, ON 1.0 0.00 s, OFF 1.0 0.93 s of light from other periods (skip_s 0, then 1)
3C-6 trial at 38.17 s: pre 0.0 0.93 s, ON 0.0 0.00 s, OFF 0.0 0.00 s, pre 1.0 0.00 s, ON 1.0 0.00 s, OFF 1.0 0.00 s of light from other periods (skip_s 0, then 1)
3C-6 trial at 58.76 s: pre 0.0 0.00 s, ON 0.0 0.00 s, OFF 0.0 0.00 s, pre 1.0 0.00 s, ON 1.0 0.00 s, OFF 1.0 0.00 s of light from other periods (skip_s 0, then 1)
3C-6 trial at 80.35 s: pre 0.0 0.00 s, ON 0.0 0.00 s, OFF 0.0 0.40 s, pre 1.0 0.00 s, ON 1.0 0.00 s, OFF 1.0 0.40 s of light from other periods (skip_s 0, then 1)
3C-6 trial at 99.95 s: pre 0.0 0.41 s, ON 0.0 0.00 s, OFF 0.0 0.00 s, pre 1.0 0.00 s, ON 1.0 0.00 s, OFF 1.0 0.00 s of light from other periods (skip_s 0, then 1)
3C-7 trial at 70.12 s: pre 0.0 0.00 s, ON 0.0 0.00 s, OFF 0.0 0.00 s, pre 1.0 0.00 s, ON 1.0 0.00 s, OFF 1.0 0.00 s of light from other periods (skip_s 0, then 1)
3C-7 trial at 90.15 s: pre 0.0 0.00 s, ON 0.0 0.00 s, OFF 0.0 0.00 s, pre 1.0 0.00 s, ON 1.0 0.00 s, OFF 1.0 0.00 s of light from other periods (skip_s 0, then 1)
3C-7 trial at 110.18 s: pre 0.0 0.00 s, ON 0.0 0.00 s, OFF 0.0 0.00 s, pre 1.0 0.00 s, ON 1.0 0.00 s, OFF 1.0 0.00 s of light from other periods (skip_s 0, then 1)
3C-7 trial at 130.21 s: pre 0.0 0.00 s, ON 0.0 0.00 s, OFF 0.0 0.00 s, pre 1.0 0.00 s, ON 1.0 0.00 s, OFF 1.0 0.00 s of light from other periods (skip_s 0, then 1)
3C-7 trial at 150.25 s: pre 0.0 0.00 s, ON 0.0 0.00 s, OFF 0.0 0.00 s, pre 1.0 0.00 s, ON 1.0 0.00 s, OFF 1.0 0.00 s of light from other periods (skip_s 0, then 1)
3C-7 trial at 170.28 s: pre 0.0 0.00 s, ON 0.0 0.00 s, OFF 0.0 0.00 s, pre 1.0 0.00 s, ON 1.0 0.00 s, OFF 1.0 0.00 s of light from other periods (skip_s 0, then 1)
In [12]:
# Crossings per second (summed over the 64 channels) and the fraction of channels at the rails,
# through the six light periods of 3C-7. A second is ON when it lies wholly inside a light period,
# "transition" when it holds an onset or an offset, and pre/off otherwise.
r = "3C-7"
c = SCAN[r]["counts"].sum(1)
per_s = c[: len(c) // 10 * 10].reshape(-1, 10).sum(1)
rail_s = SCAN[r]["rail"][: len(SCAN[r]["rail"]) // 10 * 10].reshape(-1, 10).max(1)
L = LIGHT[r]
state = np.full(len(per_s), "pre/off", dtype=object)
for a, b in zip(L["on"], L["off"]):
    state[int(np.ceil(a)):int(np.floor(b))] = "ON"
    state[int(np.floor(a))] = "transition"
    if int(np.floor(b)) < len(state):
        state[int(np.floor(b))] = "transition"
tab = pd.DataFrame({"crossings_per_s": per_s[: len(rail_s)], "max_rail_frac": rail_s, "state": state[: len(rail_s)]})
print(tab.groupby("state").agg(seconds=("crossings_per_s", "size"), median=("crossings_per_s", "median"),
                               min=("crossings_per_s", "min"), max=("crossings_per_s", "max"),
                               seconds_over_1000=("crossings_per_s", lambda v: int((v > 1000).sum())),
                               max_rail=("max_rail_frac", "max")).to_string())
first = int(np.floor(L["on"][0]))
print("seconds %d to %d around the first onset (%.2f s):" % (first - 3, first + 25, L["on"][0]))
print(tab.iloc[first - 3:first + 25].T.to_string())
            seconds  median  min   max  seconds_over_1000  max_rail
state                                                              
ON               54   593.0   41  6757                 22  0.826242
pre/off         124    96.0   44  9068                  8  0.531023
transition       12   599.5   24  7466                  6  0.989711
seconds 67 to 95 around the first onset (70.12 s):
                      67       68       69          70        71      72      73        74      75      76      77      78      79          80        81       82       83       84       85       86        87       88       89          90        91      92      93      94
crossings_per_s      109      100      137          24      1170    2797    2634       636      62      74      54     469     525        7466      9068      347       70       63       79       80        67       62     2115        3446      2225    4390    3306      69
max_rail_frac        0.0      0.0      0.0    0.984375  0.668172  0.0625  0.0625  0.068023  0.0625  0.0625  0.0625  0.0625  0.0625     0.92157  0.407063      0.0      0.0      0.0      0.0      0.0  0.000102      0.0      0.0      0.9855  0.693219  0.0625  0.0625  0.0625
state            pre/off  pre/off  pre/off  transition        ON      ON      ON        ON      ON      ON      ON      ON      ON  transition   pre/off  pre/off  pre/off  pre/off  pre/off  pre/off   pre/off  pre/off  pre/off  transition        ON      ON      ON      ON

Result: blocked (data_missing); variant only. fig3a-spontaneous-reduction needs the curated units of 3C, which are not in the dandiset. In the raw voltage, light onset drives 81 to 94% of the channels to the ends of their range in the first 0.5 s (4 of 64 channels, 6%, stay there through the light in 3C-7), and seconds with over 1,000 crossings occur in 22 of the 54 seconds wholly inside light in 3C-7, in 6 of the 12 seconds that hold an onset or offset, and in 8 of the other 124. With the claims file's windows, crossings fall by 86 to 90% from pre to ON in the five single-trial files 3C-1 to 3C-5 (Holm-adjusted p 0.0001 or less), and not in the multi-trial files 3C-6 (5 trials, -16%, adjusted p 0.82) and 3C-7 (6 trials, +6%, adjusted p 0.87), whose onsets are 18 to 21 s apart, so that some pre and OFF windows hold part of a neighbouring light period (printed above). With the first second of each window left out, 26 to 52% of the channels are still at the ends of their range in the next 0.5 s; crossings fall by 89 to 93% in 3C-1 to 3C-5 (adjusted p 0.0001 or less), by 18% in 3C-6 (adjusted p 0.77), and rise by 17% in 3C-7 (adjusted p 0.06). Saturation and these transients confound the crossings, so the variant cannot say how light changes firing.

simulation-dampening¶

The claim is tested by running Simulation/simulation.py as published, at commit 6865bf6 of the paper's repository. Its environment file and the versions on PyPI are printed below. The first attempt runs the script's first step, NESTML's generation and build of the neuron model, in a throwaway environment with the NEST that PyPI has and the NESTML the environment file pins. The second, asked for by the round-2 verifier, takes NEST 3.4 from conda-forge, as the environment file does, in a throwaway environment made with micromamba, and runs the whole script.

In [13]:
import os, shutil, subprocess, tempfile
REPO = "https://raw.githubusercontent.com/braingeneers/AndrewsGengVoitiukEtAl_SourceCode/6865bf68cc3c8ea36a9b4f853b9248288fa1e52b"
env_yml = requests.get(f"{REPO}/Simulation/environment.yml", timeout=60)
env_yml.raise_for_status()
print("Simulation/environment.yml at 6865bf6:\n" + env_yml.text)
for pkg in ("nest-simulator", "nestml"):
    rel = requests.get(f"https://pypi.org/pypi/{pkg}/json", timeout=60).json()["releases"]
    print(f"{pkg} releases on PyPI:", sorted(rel))
model = requests.get(f"{REPO}/Simulation/models/izh_cond_exp2syn.nestml", timeout=60)
model.raise_for_status()
uv = shutil.which("uv")
print("uv:", uv)
with tempfile.TemporaryDirectory() as d:
    os.makedirs(f"{d}/models")
    open(f"{d}/models/izh_cond_exp2syn.nestml", "w").write(model.text)
    py = f"{d}/venv/bin/python"
    # the kernel's matplotlib backend is not one the throwaway environment knows, and NEST imports matplotlib
    env = {**{k: v for k, v in os.environ.items() if k != "MPLBACKEND"}, "PYNEST_QUIET": "1"}
    for cmd in ([uv, "venv", "-q", "--python", "3.10", f"{d}/venv"],
                [uv, "pip", "install", "-q", "--python", py, "nest-simulator==3.10.0", "nestml==5.*"]):
        out = subprocess.run(cmd, capture_output=True, text=True, timeout=900)
        print(" ".join(cmd[1:3] + cmd[-2:]), "-> exit", out.returncode, out.stderr[-500:])
    ver = subprocess.run([py, "-c", "import nest, pynestml; print(nest.__version__, pynestml.__version__)"],
                         capture_output=True, text=True, env=env)
    print("import nest, pynestml -> exit", ver.returncode, "; versions:", ver.stdout.strip()[-40:], ver.stderr[-300:] if ver.returncode else "")
    gen = subprocess.run([py, "-c", "from pynestml.frontend.pynestml_frontend import generate_nest_target; "
                          f"generate_nest_target('{d}/models/', '{d}/build', module_name='hippocampusmodule', logging_level='WARNING')"],
                         capture_output=True, text=True, timeout=900, env=env)
    print("generate_nest_target exit", gen.returncode)
    print("\n".join(gen.stderr.strip().splitlines()[-3:]))
Simulation/environment.yml at 6865bf6:
name: AndrewsGengVoitiukEtAl
channels:
  - conda-forge
dependencies:
  - python=3.10.*
  - nest-simulator=3.4.*
  - tqdm
  - pip
  - pip:
    - braingeneers
    - nestml==5.*

nest-simulator releases on PyPI: ['3.10.0', '3.10.0rc1', '3.10.0rc2', '3.9.0.post0.dev14']
nestml releases on PyPI: ['3.0.post0.dev5', '3.1', '4.0.0', '5.0.0', '5.0.0rc1', '5.0.0rc2', '5.1.0', '5.2.0', '5.3.0', '6.0.0', '7.0.0', '7.0.1', '7.0.1rc1', '7.0.2', '8.0.0', '8.0.0rc1', '8.0.0rc2', '8.0.0rc3', '8.0.1', '8.0.2', '8.1.0', '8.2.0', '8.3.0', '8.3.0rc1', '8.3.0rc2', '8.3.0rc3', '9.0.0', '9.0.1']
uv: /opt/hostedtoolcache/Python/3.13.18/x64/bin/uv
venv -q 3.10 /tmp/tmptsnbdcta/venv -> exit 0 
pip install nest-simulator==3.10.0 nestml==5.* -> exit 0 
import nest, pynestml -> exit 0 ; versions: 3.10.0 5.3.0 
generate_nest_target exit 1
  File "/tmp/tmptsnbdcta/venv/lib/python3.10/site-packages/pynestml/codegeneration/nest_builder.py", line 93, in __init__
    nest_path = nest.ll_api.sli_func("statusdict/prefix ::")
AttributeError: module 'nest.ll_api' has no attribute 'sli_func'
In [14]:
# NEST 3.4 from conda-forge, as Simulation/environment.yml pins it, in a throwaway environment made with
# micromamba (2.10.0, from conda-forge), with the packages the file lists. The model is then built and
# Simulation/simulation.py run as published; each step's exit code and error are printed.
import io, json, tarfile
MM = "https://conda.anaconda.org/conda-forge/linux-64/micromamba-2.10.0-0.tar.bz2"
SIMDIR = tempfile.mkdtemp()
E = f"{SIMDIR}/env"
mm_tar = requests.get(MM, timeout=300)
mm_tar.raise_for_status()
with tarfile.open(fileobj=io.BytesIO(mm_tar.content), mode="r:bz2") as t:
    t.extract("bin/micromamba", SIMDIR, filter="data")
os.makedirs(f"{SIMDIR}/run/models")
for f in ("simulation.py", "models/izh_cond_exp2syn.nestml"):
    src = requests.get(f"{REPO}/Simulation/{f}", timeout=60)
    src.raise_for_status()
    open(f"{SIMDIR}/run/{f}", "w").write(src.text)
simenv = {**{k: v for k, v in os.environ.items() if k != "MPLBACKEND"}, "MPLBACKEND": "Agg", "PYNEST_QUIET": "1",
          "PATH": f"{E}/bin:" + os.environ["PATH"]}

def step(label, cmd, **kw):
    out = subprocess.run(cmd, capture_output=True, text=True, env=simenv, **kw)
    print(f"{label} -> exit {out.returncode}")
    if out.returncode:
        print("   ", "\n    ".join([l for l in out.stderr.strip().splitlines() if "WARNING" not in l][-3:]))
    return out

GEN = ("from pynestml.frontend.pynestml_frontend import generate_nest_target; "
       f"generate_nest_target('models/', '{SIMDIR}/build', module_name='hippocampusmodule', logging_level='WARNING')")
# cmake 3 and a compiler are what NESTML 5 needs to build the module; the file does not list them
step("micromamba create python=3.10 nest-simulator=3.4 tqdm pip cmake=3 cxx-compiler make",
     [f"{SIMDIR}/bin/micromamba", "create", "-y", "-q", "-r", f"{SIMDIR}/mmroot", "-p", E, "-c", "conda-forge",
      "--override-channels", "python=3.10", "nest-simulator=3.4", "tqdm", "pip", "cmake=3", "cxx-compiler", "make"], timeout=1200)
step("pip install nestml==5.3.0 braingeneers==0.3.1.16 matplotlib",
     [f"{E}/bin/python", "-m", "pip", "install", "-q", "nestml==5.3.0", "braingeneers==0.3.1.16", "matplotlib"], timeout=1200)
# 1. as the environment file resolves today: odetoolbox is not pinned, and its newest release is taken
step("generate_nest_target, odetoolbox as resolved", [f"{E}/bin/python", "-c", GEN], cwd=f"{SIMDIR}/run", timeout=900)
# 2. odetoolbox 2.5, the release current when NESTML 5.2 and 5.3 came out (October 2022)
step("pip install odetoolbox==2.5", [f"{E}/bin/python", "-m", "pip", "install", "-q", "odetoolbox==2.5"], timeout=600)
shutil.rmtree(f"{SIMDIR}/build", ignore_errors=True)
step("generate_nest_target, odetoolbox 2.5", [f"{E}/bin/python", "-c", GEN], cwd=f"{SIMDIR}/run", timeout=900)
# 3. the conda-forge nest-config prints an empty --compiler, so the generated CMakeLists sets no C++
#    compiler; make it print the environment's compiler (the model is not changed)
cfg = open(f"{E}/bin/nest-config").read()
print("nest-config --compiler was:", repr(cfg.split("--compiler)")[1].split(";;")[0].strip()))
open(f"{E}/bin/nest-config", "w").write(cfg.replace('--compiler)\n        echo ""', f'--compiler)\n        echo "{E}/bin/x86_64-conda-linux-gnu-c++"', 1))
shutil.rmtree(f"{SIMDIR}/build", ignore_errors=True)
step("generate_nest_target, odetoolbox 2.5, nest-config compiler set", [f"{E}/bin/python", "-c", GEN], cwd=f"{SIMDIR}/run", timeout=900)
ver = step("versions", [f"{E}/bin/python", "-c", "import nest; from importlib.metadata import version as v; "
            "print('NEST', nest.__version__, '| ' + ' | '.join(p + ' ' + v(p) for p in ('nestml', 'odetoolbox', 'braingeneers', 'numpy')))"])
print(ver.stdout.strip())
micromamba create python=3.10 nest-simulator=3.4 tqdm pip cmake=3 cxx-compiler make -> exit 0
pip install nestml==5.3.0 braingeneers==0.3.1.16 matplotlib -> exit 0
generate_nest_target, odetoolbox as resolved -> exit 1
      File "/tmp/tmp_gfr376t/env/lib/python3.10/site-packages/pynestml/codegeneration/nest_code_generator.py", line 764, in ode_toolbox_analysis
        solver_result = odetoolbox.analysis(odetoolbox_indict,
    TypeError: analysis() got an unexpected keyword argument 'simplify_expression'
pip install odetoolbox==2.5 -> exit 0
generate_nest_target, odetoolbox 2.5 -> exit 1
      File "/tmp/tmp_gfr376t/env/lib/python3.10/site-packages/pynestml/codegeneration/nest_builder.py", line 183, in build
        raise GeneratedCodeBuildException(stages_exception[current_stage])
    pynestml.exceptions.generated_code_build_exception.GeneratedCodeBuildException: Error occurred during cmake! More detailed error messages can be found in stderr.
nest-config --compiler was: 'echo ""'
generate_nest_target, odetoolbox 2.5, nest-config compiler set -> exit 0
versions -> exit 0
NEST 3.4 | nestml 5.3.0 | odetoolbox 2.5 | braingeneers 0.3.1.16 | numpy 1.26.4
In [15]:
# Run Simulation/simulation.py unchanged (it builds the model again, then simulates opsin fractions 0, 0.10,
# 0.25 and 0.50 with its seed, 20) and keep each run's spike counts per 1 ms. As a check of the seed, the
# script's sim() is then run again with the same arguments and seeds 21 to 24 (a choice; the script has one).
DRIVER = '''
import json, runpy
import numpy as np
g = runpy.run_path("simulation.py", run_name="__main__")
def keep(sd, seed):
    return dict(seed=seed, p_opto=sd.metadata["p_opto"], n_cells=sd.N, length_ms=sd.length,
                threshold=sd.metadata["opto_threshold"], opto_times=[int(t) for t in sd.metadata["opto_times"]],
                counts=np.asarray(sd.binned(1)).astype(int).tolist())
runs = [keep(sd, 20) for sd in g["sds_fraction"]]
for seed in (21, 22, 23, 24):
    for p in (0.0, 0.1, 0.25, 0.5):
        runs.append(keep(g["sim"](N_granule=1000, N_basket=12, N_perforant=0, p_opto=p, seed=seed, use_tqdm=False), seed))
json.dump(runs, open("sim_runs.json", "w"))
'''
open(f"{SIMDIR}/run/drive.py", "w").write(DRIVER)
t0 = time.time()
out = step("python simulation.py (with the seed check)", [f"{E}/bin/python", "drive.py"], cwd=f"{SIMDIR}/run", timeout=1800)
print("ran in %.1f min" % ((time.time() - t0) / 60))
print("the script's output:\n" + "\n".join(l for l in out.stdout.splitlines() if l.startswith("With p_opto")))
SIM = json.load(open(f"{SIMDIR}/run/sim_runs.json"))
python simulation.py (with the seed check) -> exit 0
ran in 4.4 min
the script's output:
With p_opto = 0%, FR was 80.65 Hz. Did opto 0 times.
With p_opto = 10%, FR was 60.06 Hz. Did opto 16 times.
With p_opto = 25%, FR was 52.49 Hz. Did opto 11 times.
With p_opto = 50%, FR was 49.65 Hz. Did opto 9 times.
In [16]:
# The claims file's readings. An event is a run of 1 ms bins whose spike count (all 1012 cells) is above the
# script's closed-loop threshold x_opto (opto_threshold, 100 spikes in a 1 ms step): (a) their total duration,
# (b) their number, (c) the spikes they hold. The criterion is read at the script's seed, 20.
rows = []
for r in SIM:
    c = np.asarray(r["counts"])
    above = c > r["threshold"]
    edges = np.diff(np.r_[0, above.astype(int), 0])
    rows.append({"seed": r["seed"], "p_opto": r["p_opto"], "cells": r["n_cells"], "ms": len(c),
                 "spikes": int(c.sum()), "max_per_ms": int(c.max()), "opto_events": len(r["opto_times"]),
                 "a_duration_ms": int(above.sum()), "b_events": int((edges == 1).sum()), "c_spikes_in_events": int(c[above].sum())})
sim = pd.DataFrame(rows)
print(sim.to_string(index=False))
main = sim[sim.seed == 20].set_index("p_opto")
for m in ("a_duration_ms", "b_events", "c_spikes_in_events"):
    v = main[m]
    low = bool((v.loc[[0.1, 0.25]] < v.loc[0.0]).any())
    print(f"seed 20, {m}: {v.tolist()} at p_opto 0, 0.10, 0.25, 0.50; lower at 0.25 or less than at 0: {low}; "
          f"lower at 0.50 than at 0: {bool(v.loc[0.5] < v.loc[0.0])}; criterion met: {low and bool(v.loc[0.5] < v.loc[0.0])}")
print("\nper seed, value at 0.10, 0.25, 0.50 as a fraction of the value at 0:")
for m in ("a_duration_ms", "b_events", "c_spikes_in_events"):
    w = sim.pivot(index="seed", columns="p_opto", values=m)
    print(m); print((w[[0.1, 0.25, 0.5]].div(w[0.0], axis=0)).round(3).to_string())
 seed  p_opto  cells   ms  spikes  max_per_ms  opto_events  a_duration_ms  b_events  c_spikes_in_events
   20    0.00   1012 1000   81621         330            0            278        10               52366
   20    0.10   1012 1000   60784         198           16            124        10               17594
   20    0.25   1012 1000   53118         133           11             37        10                4086
   20    0.50   1012 1000   50249         114            9              4         4                 441
   21    0.00   1012 1000   67530         329            0            112         4               23815
   21    0.10   1012 1000   57801         252           10             52         2                9083
   21    0.25   1012 1000   54344         146           12             54        12                6306
   21    0.50   1012 1000   49579         107           10              5         5                 517
   22    0.00   1012 1000   51579         101            0              1         1                 101
   22    0.10   1012 1000   50837          97            2              0         0                   0
   22    0.25   1012 1000   50409          87            2              0         0                   0
   22    0.50   1012 1000   48979         103            3              1         1                 103
   23    0.00   1012 1000   55652         228            0             43         6                7144
   23    0.10   1012 1000   52946         128            4             30        11                3278
   23    0.25   1012 1000   52017         144            4             21         6                2440
   23    0.50   1012 1000   48285         108            5              3         3                 323
   24    0.00   1012 1000   73982         267            0            192         6               33432
   24    0.10   1012 1000   63712         228           19            119        27               16048
   24    0.25   1012 1000   56500         131           12             70        24                7778
   24    0.50   1012 1000   51104         106            8              3         3                 311
seed 20, a_duration_ms: [278, 124, 37, 4] at p_opto 0, 0.10, 0.25, 0.50; lower at 0.25 or less than at 0: True; lower at 0.50 than at 0: True; criterion met: True
seed 20, b_events: [10, 10, 10, 4] at p_opto 0, 0.10, 0.25, 0.50; lower at 0.25 or less than at 0: False; lower at 0.50 than at 0: True; criterion met: False
seed 20, c_spikes_in_events: [52366, 17594, 4086, 441] at p_opto 0, 0.10, 0.25, 0.50; lower at 0.25 or less than at 0: True; lower at 0.50 than at 0: True; criterion met: True

per seed, value at 0.10, 0.25, 0.50 as a fraction of the value at 0:
a_duration_ms
p_opto   0.10   0.25   0.50
seed                       
20      0.446  0.133  0.014
21      0.464  0.482  0.045
22      0.000  0.000  1.000
23      0.698  0.488  0.070
24      0.620  0.365  0.016
b_events
p_opto   0.10  0.25  0.50
seed                     
20      1.000   1.0  0.40
21      0.500   3.0  1.25
22      0.000   0.0  1.00
23      1.833   1.0  0.50
24      4.500   4.0  0.50
c_spikes_in_events
p_opto   0.10   0.25   0.50
seed                       
20      0.336  0.078  0.008
21      0.381  0.265  0.022
22      0.000  0.000  1.020
23      0.459  0.342  0.045
24      0.480  0.233  0.009

Result: reproduced. The published environment pins NEST 3.4 from conda-forge and NESTML 5. PyPI has no NEST 3.4 (its releases are 3.9.0.post0.dev14 and 3.10.0), and with NEST 3.10.0 and NESTML 5.3.0, the newest 5.x, the script's first step, generate_nest_target, fails (nest.ll_api has no attribute sli_func). With NEST 3.4 from conda-forge and NESTML 5.3.0, the model builds after two changes to the environment, neither to the model: odetoolbox, which the environment file leaves unpinned and which now resolves to a release NESTML 5.3.0 cannot call (simplify_expression), is set to 2.5, and the conda-forge nest-config, which prints no compiler, is made to print the environment's. The script then runs as published, and gives the four lines it prints (mean rate 80.65 Hz at fraction 0, 60.06, 52.49 and 49.65 Hz at 0.10, 0.25 and 0.50). At its seed, 20, with events as runs of 1 ms bins above the closed-loop threshold of 100 spikes, the total event duration is 278 ms at fraction 0 and 124, 37 and 4 ms at 0.10, 0.25 and 0.50, and the spikes in events 52,366 against 17,594, 4,086 and 441, so readings (a) and (c) meet the criterion; the number of events, (b), is 10, 10, 10 and 4, lower only at 0.50. With seeds 21, 23 and 24, readings (a) and (c) are lower at every fraction than at 0 (at most 0.70 of the value at 0). Seed 22 meets the criterion under no reading: the network has 1 ms above threshold at fraction 0, and at 0.50 the event duration is the same and the spikes in events 103 at 0.50 against 101 at 0. The verdict uses the script's own seed, fixed before any analysis. The outcome verified in round 2 was blocked (not_runnable), before the model was run; the round-3 verifier agreed with the change to reproduced.

Summary¶

Claim Outcome
table1-cohort partially reproduced
units-per-recording blocked: data_missing
transduction-range blocked: data_missing
reporter-gcl-pyramidal blocked: data_missing
patch-hckcr1-hyperpolarizing blocked: data_missing
simulation-dampening reproduced
fig3a-spontaneous-reduction blocked: data_missing
physio-bic-reduction-all-slices blocked: data_missing
physio-bic-amplitude-unchanged blocked: data_missing
table2-fr-decrease-physio-bic blocked: data_missing
table2-fr-decrease-0mg blocked: data_missing
zero-mg-reduction blocked: data_missing
zero-mg-isolated-bursts blocked: data_missing
ka-rhythmic-bursts blocked: data_missing
ka-light-reduction blocked: data_missing
ka-bursts-during-light blocked: data_missing
ka-theta-coherence blocked: data_missing
fig4-firing-propagation blocked: data_missing
fig4-theta-propagation blocked: data_missing
closed-loop-bicuculline blocked: data_missing
intensity-threshold blocked: data_missing
chr2-increase blocked: data_missing
transduction-not-explaining-response blocked: data_missing
s3-reduction-by-condition blocked: data_missing
waveform-clusters blocked: data_missing
waveform-gcl-association blocked: data_missing
opto-response-clusters blocked: data_missing
opto-waveform-association blocked: data_missing
opto-cluster3-profile blocked: data_missing

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. Only the cohort claim is tested on the dandiset, and it is tested on the file names and subject metadata. The network model is run as published, with odetoolbox set to 2.5 and the compiler given to nest-config, and reproduces the claim at the script's seed. The variant on 3C uses threshold crossings on 64 channels in place of curated units, and is confounded by amplifier saturation at light onset, with or without the first second of each window.

What was found about the dataset. The 69 files hold raw HD-MEA voltage only: no sorted units, no light events (the GPIO bit and the stimulation log the Methods describe), no condition, medium or opsin labels, no session description, and no link from a file to the paper's recording names. Light periods can be recovered from a voltage step in the 3C recordings (every channel group), where light onset drives most channels to the ends of their range, and in 4C-1, 4C-3, 7D-0, 7D-2, 7D-5 and 7D-7 (part of the array only, steps of 40 to 88 counts); no file of 5C, 8D, 10F or 11G shows one. In at least one 5C recording, 34% of the first channel group sits at the ends of the range in the median 100 ms bin. subject_id is the recording, so the archive counts 69 subjects for 7 patients, and every session start time is the conversion date. No recording is deposited twice.

In [17]:
print("notebook ran in %.1f min; peak memory %.2f GB" % ((time.time() - T0) / 60,
      resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e6))
notebook ran in 35.3 min; peak memory 1.71 GB