Reproducing Watson et al. (2016) on DANDI:000041 and CRCNS:fcx-1¶
Paper. Watson BO, Levenstein D, Greene JP, Gelinas JN, Buzsáki G (2016). Network homeostasis and state dynamics of neocortical sleep. Neuron 90, 839-852. doi:10.1016/j.neuron.2016.03.036.
Claims. claims/watson-2016.yaml, written from the accepted author manuscript in PubMed Central (PMC4873379) with
its supplement 1 (Table S1, Figures S1 to S5 legends, Supplemental Experimental Procedures) and supplement 2. Every claim
lists both datasets, and each is tested on each, except fig5c-wake-movement, tested on CRCNS only as DANDI holds no
motion or EMG signal.
Datasets.
- DANDI:000041, version 0.261104.0300 (doi:10.48324/dandi.000041/0.261104.0300), 22 NWB files, streamed with remfile and h5py. The paper cites no version. This is the most recent published version; its release notes say that all files were re-converted from the lab's source files, correcting the unit table and its cell-type labels, the spike times of Dino-072114 and the LFP gain, all of which the analysis uses, so no earlier version describes the paper's data better. The draft (modified 2026-11-06) is not used, as it can change.
- CRCNS:fcx-1 (doi:10.6080/K02N506Q), not versioned: the 27 session tar.gz files under
fcx-1/live/data/of the public bucket, each streamed once over parallel range requests and decompressed as it arrives; the MD5 sums from the data set'schecksums.md5of the files read are printed below.
How the two datasets differ. CRCNS:fcx-1 holds the lab's own state intervals (WAKE, SLEEP, WAKE-SLEEP cycles, packets, MAs, REM, WAKE interruptions), its UP/DOWN and spindle detections, and motion; those are used as deposited (reading a of the claims). DANDI:000041 holds Awake, Non-REM and REM epochs only, so the paper's intervals are built from them by the rules of Table S1, and UP/DOWN states and spindles are detected here (reading b). Both hold the LFP; band powers are computed here for both from the lab's spindle/good channel.
Outcome per claim. One outcome is given per claim, judged on CRCNS:fcx-1, which holds all 27 sessions, the lab's own cell classification (_CellIDs, which gives the paper's 995 pE and 126 pI) and the lab's own state intervals, UP/DOWN states and spindles, so it holds the data the paper's tests used. DANDI:000041 holds 22 of the sessions, cell-type labels that differ from the lab's in 7 of them, and Awake, Non-REM and REM epochs only, from which the paper's intervals are rebuilt here; its result is stated beside each CRCNS result, and where it differs the section says so. This is a choice of this attempt (the protocol gives one outcome per claim and the claims file sets no rule for two datasets). In round 1 a claim was reproduced only when it held on both datasets; the verifier pointed out that the claims file has no such rule and that DANDI's differences come from what it lacks.
| Claim | Tested |
|---|---|
table1-dataset-counts |
tested on both datasets |
wake-sleep-cycles |
tested on both datasets |
tables1-state-durations |
tested on both datasets |
ma-statistics |
tested on both datasets |
ma-fraction-over-nrem-episodes |
tested on both datasets |
packet-duration |
tested on both datasets |
fig2a-median-rates |
tested on both datasets |
fig2a-skewed-wide-distribution |
tested on both datasets |
fig2a-fraction-above-2hz |
tested on both datasets |
fig2b-wake-nrem-slope |
tested on both datasets |
burst-index-by-state |
tested on both datasets |
fig2c-acg-peaks |
tested on both datasets |
fig2c-acg-decay |
tested on both datasets |
synchrony-skew |
tested on both datasets |
updown-durations |
tested on both datasets |
fig1e-up-state-dynamics |
tested on both datasets |
fig2de-fast-before-slow |
tested on both datasets |
fig2f-rate-group-correlations |
tested on both datasets |
fig3ab-population-rate-declines |
tested on both datasets |
first-last-packet-mean-rate |
tested on both datasets |
post-sleep-wake-lower |
tested on both datasets |
fig3d-first-last-packet-slope |
tested on both datasets |
fig3b-sextile-changes |
tested on both datasets |
cv-decreases-over-sleep |
tested on both datasets |
fig3c-spindles-over-sleep |
tested on both datasets |
fig3c-updown-over-sleep |
tested on both datasets |
fig3f-within-up-changes |
tested on both datasets |
figs3a-first-last-rem-ma-slopes |
tested on both datasets |
fig3e-wake-before-after-sextiles |
tested on both datasets |
fig4i-band-power-within-nrem |
tested on both datasets |
fig4-delta-packet-length |
tested on both datasets |
fig4-late-packet-sigma-delta |
tested on both datasets |
fig4-updown-within-packets |
tested on both datasets |
fig4-spindles-within-nrem |
tested on both datasets |
fig4e-late-packet-sigma |
tested on both datasets |
fig4iv-sextiles-within-nrem |
tested on both datasets |
fig4v-cv-within-nrem |
tested on both datasets |
fig4vi-burst-within-nrem |
tested on both datasets |
fig4cd-packet-rate-lfp-correlations |
tested on both datasets |
fig4e-within-up-sextiles |
tested on both datasets |
figs5-within-wake-rem |
tested on both datasets |
fig5b-ma-nrem-ma |
tested on both datasets |
figs5d-rem-nrem-rem |
tested on both datasets |
fig5c-sigma-ma-change |
tested on both datasets |
fig5b-wake-between-packets |
tested on both datasets |
fig5c-wake-movement |
tested on CRCNS; DANDI holds no motion or EMG signal |
fig5b-ma-between-packets |
tested on both datasets |
fig5b-rem-between-packets |
tested on both datasets |
fig5c-rem-duration |
tested on both datasets |
fig5c-rem-theta |
tested on both datasets |
fig5c-delta-change-slow-cells |
tested on both datasets |
figs2d-interneurons-unchanged |
tested on both datasets |
sleep-homogenizes-rates |
tested on both datasets |
import time, resource
import numpy as np
import watson as W
t_load = time.time()
D = {}
D["000041"] = W.load_dataset("000041", workers=2)
t_dandi = time.time() - t_load
D["crcns-fcx-1"] = W.load_dataset("crcns-fcx-1", workers=3)
print(f"loaded DANDI in {t_dandi/60:.1f} min, CRCNS in {(time.time()-t_load-t_dandi)/60:.1f} min; peak memory of this process "
f"{resource.getrusage(resource.RUSAGE_SELF).ru_maxrss/1e6:.2f} GB")
print("DANDI assets read (version", W.DANDI_VERSION + "):")
for p, a, sz in W.dandi_assets():
print(f" {p} {sz/1e9:.2f} GB asset {a}")
md5 = W.crcns_checksums()
print("CRCNS files read, with their MD5 from checksums.md5:")
for n in W.CRCNS_SESSIONS:
print(f" data/{n}.tar.gz {md5.get('data/' + n + '.tar.gz')}")
loaded DANDI in 10.1 min, CRCNS in 13.3 min; peak memory of this process 1.96 GB DANDI assets read (version 0.261104.0300):
sub-BWRat17/sub-BWRat17_ses-BWRat17-121712_ecephys.nwb 1.52 GB asset d90132bb-f4cb-49b4-8824-e4f504446991 sub-BWRat17/sub-BWRat17_ses-BWRat17-121912_ecephys.nwb 1.49 GB asset d89041a6-42b7-4c7f-8da0-d2c65061e04a sub-BWRat18/sub-BWRat18_ses-BWRat18-020513_ecephys.nwb 2.54 GB asset 8f434f2c-c586-408c-80f3-9e0548f24125 sub-BWRat19/sub-BWRat19_ses-BWRat19-032413_ecephys.nwb 3.05 GB asset 6ccbfdd3-2cc0-4055-adba-ab4527082ebf sub-BWRat19/sub-BWRat19_ses-BWRat19-032513_ecephys.nwb 2.27 GB asset 3f82e999-8b0a-4c46-91aa-b27ea3aefd4f sub-BWRat20/sub-BWRat20_ses-BWRat20-101013_ecephys.nwb 5.20 GB asset 66503017-c350-4b7a-9e86-018bf72b7bf0 sub-BWRat20/sub-BWRat20_ses-BWRat20-101513_ecephys.nwb 5.38 GB asset 93de9552-9f1e-46b8-acb2-926164697d79 sub-BWRat21/sub-BWRat21_ses-BWRat21-121113_ecephys.nwb 7.60 GB asset 0cc966a4-d56a-444e-83bd-b7619d4d0626 sub-BWRat21/sub-BWRat21_ses-BWRat21-121613_ecephys.nwb 4.44 GB asset 36f460a3-687b-4dee-a5f4-a43cda8d5f93 sub-BWRat21/sub-BWRat21_ses-BWRat21-121813_ecephys.nwb 4.42 GB asset 377ad232-a1ce-4489-8f28-3b69462773af sub-Bogey/sub-Bogey_ses-Bogey-012615_ecephys.nwb 9.19 GB asset 130f1cf4-2484-4bf3-b555-2a1a42813d8a sub-Dino/sub-Dino_ses-Dino-061814_ecephys.nwb 8.71 GB asset 7bfa9a69-f77e-4f32-97e4-acbd7c5d098e sub-Dino/sub-Dino_ses-Dino-061914_ecephys.nwb 6.52 GB asset 3998beff-9b72-4d63-a1d7-14680f11b4f6 sub-Dino/sub-Dino_ses-Dino-062014_ecephys.nwb 14.65 GB asset d04eb92d-1564-4abe-95db-1d5f1457c2e1 sub-Dino/sub-Dino_ses-Dino-072114_ecephys.nwb 9.59 GB asset c29894bc-7791-4886-96d0-7afcfd3ba12a sub-Dino/sub-Dino_ses-Dino-072314_ecephys.nwb 7.00 GB asset ff844357-1af4-4393-8582-b4addc5e914a sub-Dino/sub-Dino_ses-Dino-072414_ecephys.nwb 8.24 GB asset 51bfb6de-777d-4f3d-b676-fef7dbf15ed7 sub-Rizzo/sub-Rizzo_ses-Rizzo-022615_ecephys.nwb 11.11 GB asset b998fe22-727a-4931-a454-2fabf50cabb6 sub-Rizzo/sub-Rizzo_ses-Rizzo-022715_ecephys.nwb 10.43 GB asset 67d6bc20-47d8-4bec-bd99-3accd591eda2 sub-Splinter/sub-Splinter_ses-Splinter-020515_ecephys.nwb 9.28 GB asset 5e7d4ecd-8c99-4c9c-a06e-064f197b3b10 sub-Splinter/sub-Splinter_ses-Splinter-020915_ecephys.nwb 6.37 GB asset 472ffae6-6f89-4c15-8a36-5b986c6fac29 sub-Templeton/sub-Templeton_ses-Templeton-032415_ecephys.nwb 10.50 GB asset 0113b24c-6497-4bb7-8deb-699fdd5be53b CRCNS files read, with their MD5 from checksums.md5: data/20140526_277um.tar.gz 76a3a51748d22a4b8f822b59c5367c62 data/20140527_421um.tar.gz c9ad3be105258bc5e70b34d50c7964cd data/20140528_565um.tar.gz 0342fc85311c394b52a8d29a1290a39f data/BWRat17_121712.tar.gz 5bae671bcfd9f76524b08b9dcbcf3d0e data/BWRat17_121912.tar.gz c744f4a16327b474563f0f615b05e343 data/BWRat18_020513.tar.gz f2c6a9a725eb929f1482c48ca0f816ab data/BWRat19_032413.tar.gz 908398356c84000b7dce814c3c408dd2 data/BWRat19_032513.tar.gz 4169ce26875aaaec4ef42c3ab8de402c data/BWRat20_101013.tar.gz 65e3bc3f961c6a9b3725e96a2682ed1d data/BWRat20_101513.tar.gz 5f1dcb5cc0d2972b6bff9b020a4f26aa data/BWRat21_121113.tar.gz 0fc5726ba2ce996996c085f37b02597e data/BWRat21_121613.tar.gz 8e2c5d14ee822aaf876cff3b8dff5510 data/BWRat21_121813.tar.gz 021b1a96327fcc82c8b81d31cd086873 data/Bogey_012615.tar.gz 9a65bdc269ec5df500236b4e4b3e79d4 data/Dino_061814_mPFC.tar.gz 4ac889b2421e4c32ccd80c67d96df793 data/Dino_061914_ACC.tar.gz b916aef6b88f570cf91533e4d70c29ed data/Dino_061914_mPFC.tar.gz 098ce2e0340ef414fad7d56a75fbc946 data/Dino_062014_ACC.tar.gz 9225d5b807be4c2b7a0634dab53cc64f data/Dino_062014_mPFC.tar.gz 3f6d06564687a5be5f53be4f8ec8dbff data/Dino_072114_mPFC.tar.gz 9d1bf8b88852e2e7f1e8ea749d2b9199 data/Dino_072314_mPFC.tar.gz 3bccdfe803cd415593ce8519b6e000dd data/Dino_072414_mPFC.tar.gz d0b8faaa90589c10bebe47492b66b676 data/Rizzo_022615.tar.gz 4deca5619586d6f7b21110005894e125 data/Rizzo_022715.tar.gz acc3d4a3bc2f40172d11aa0f4c344df7 data/Splinter_020515.tar.gz b6b5c4629f528edd74f14af178b32ca8 data/Splinter_020915.tar.gz e62faa965caadabedebd6af8beda6b0e data/Templeton_032415.tar.gz 9c1e4255a4437a9fe68c3b9e44b221a8
Data check¶
Counts by subject and session, units, state intervals, events, ranges of times, the channel count of each CRCNS LFP stream against its .xml, and a check that spikes, states and UP states share a clock: population spikes rise sharply at UP onsets and not when the onsets are shifted by 30 minutes.
import warnings
warnings.filterwarnings("ignore")
import numpy as np
from scipy import stats
import watson as W
DS = ["000041", "crcns-fcx-1"]
STATES = ["wake", "nrem", "rem"]
def pr(*a):
print(*a)
def fmt(x, n=3):
return "nan" if x is None or not np.isfinite(x) else f"{x:.{n}g}"
def rp(res):
return "; ".join(f"{k}: R={fmt(v[0])}, p={fmt(v[1])}, n={v[2]}" for k, v in res.items())
def nancorr(a, b):
ok = np.isfinite(a) & np.isfinite(b)
return np.corrcoef(a[ok], b[ok])[0, 1] if ok.sum() > 2 else np.nan
def cells_of(s, kind):
return s["E"] if kind == "E" else s["I"]
for ds in DS:
ss = D[ds]
pr(f"== {ds}: {len(ss)} sessions, rats {sorted(set(s['rat'] for s in ss))}")
for s in ss:
I = s["ints"]
sp = s.get("spindles")
pr(f"{s['name']:18s} rat={s['rat']:9s} units={len(s['spikes']):3d} pE={len(s['E']):3d} pI={len(s['I']):2d} "
f"cycles={len(s['cycles'])} packets={len(I['SWSPacket'])} MA={len(I['MA'])} REM={len(I['REM'])} "
f"UP={len(s.get('up', []))} DOWN={len(s.get('dn', []))} spindles={0 if sp is None else len(sp['start'])} "
f"LFP={'yes' if 'bp_delta' in s['G'] else 'no'} last spike={max(x.max() for x in s['spikes'] if len(x)):.0f} s "
f"LFP length={s.get('lfp_seconds', 0):.0f} s")
allsp = np.concatenate([np.concatenate(s['spikes']) for s in ss])
pr("spike times: min", allsp.min(), "max", allsp.max(), "s; fraction of times that are whole seconds",
np.mean(allsp == np.round(allsp)))
lab = [s["ctype"] for s in ss]
pr("cell types:", {k: int(sum((l == k).sum() for l in lab)) for k in ["E", "I", "?"]})
if ds == "crcns-fcx-1":
pr("channels: .xml against the count found from the .eeg stream where the .xml came later:",
[(s["name"], s["nch_xml"], s["nch_guess"]) for s in ss if s["nch_guess"]])
pr("LFP sampling rate in _BasicMetaData:", sorted(set(s["lfp_rate_xml"] for s in ss)))
pr("LFP length against last state interval end (s):",
[(s["name"], round(s["lfp_seconds"]), round(max(np.max(np.asarray(c['sleep'])) for c in s['cycles']))) for s in ss][:5], "...")
pr("spindle amplitude range (uV):", np.percentile(np.concatenate([s['spindles']['amp_uV'] for s in ss]), [0, 50, 100]))
else:
pr("LFP rate:", sorted(set(s.get("lfp_rate", np.nan) for s in ss)), "sessions without LFP:", [s["name"] for s in ss if not s.get("have_lfp")])
pr("regions of units:", {k: int(sum((s['region'] == k).sum() for s in ss)) for k in sorted(set(np.concatenate([s['region'] for s in ss])))})
pr("electrode locations:", sorted(set(np.concatenate([s['electrode_location'] for s in ss]))))
pr("LFP starting_time (s), distinct values over files with LFP:", sorted(set(s.get("lfp_starting_time", np.nan) for s in ss if s.get("have_lfp"))),
"(added to the LFP window times and LFP detections)")
pr("acquisition series per file (name, shape, rate):", sorted(set(str(s.get("acquisition")) for s in ss)),
"; the only ElectricalSeries with data is the 1250 Hz LFP (rate above), so no wideband signal for an EMG")
# clock check: rate of pE cells is higher in WAKE than nonREM? and UP-state onsets align with
# population spiking, labels shifted by 30 min break the alignment
on, off = [], []
for s in ss:
up = np.asarray(s.get('up', np.zeros((0, 2))))
if len(up) < 50:
continue
mua = np.sort(np.concatenate([s['spikes'][i] for i in s['E']]))
for shift, lst in [(0.0, on), (1800.0, off)]:
st = up[:, 0] + shift
c1 = np.searchsorted(mua, st + 0.1) - np.searchsorted(mua, st)
c0 = np.searchsorted(mua, st) - np.searchsorted(mua, st - 0.1)
lst.append((c1.sum() + 1) / (c0.sum() + 1))
pr("population spikes 0-100 ms after over 100-0 ms before UP onsets, median over sessions:",
fmt(np.median(on)), "; with UP onsets shifted by 1800 s:", fmt(np.median(off)))
# LFP clock: delta power in nonREM packets against WAKE, with the state intervals as scored and
# shifted by 1800 s (a contrast a clock offset between the LFP and the state table would remove)
on, off = [], []
for s in ss:
if "bp_delta" not in s["G"] or not s["cycles"]: continue
lp = np.log(s["G"]["bp_delta"])
for shift, lst in [(0, on), (1800, off)]:
kn = W.secs(W.state_pieces(s, "nrem") + shift); kw = W.secs(W.state_pieces(s, "wake") + shift)
kn, kw = kn[kn < len(lp)], kw[kw < len(lp)]
lst.append(np.nanmean(lp[kn]) - np.nanmean(lp[kw]))
pr("log delta power, nonREM packets minus WAKE, median over sessions:", fmt(np.median(on)), "; with the intervals shifted by 1800 s:",
fmt(np.median(off)), f"; sessions {len(on)}, with a positive difference {int(np.sum(np.array(on) > 0))}")
== 000041: 22 sessions, rats ['BWRat17', 'BWRat18', 'BWRat19', 'BWRat20', 'BWRat21', 'Bogey', 'Dino', 'Rizzo', 'Splinter', 'Templeton'] BWRat17-121712 rat=BWRat17 units= 50 pE= 44 pI= 6 cycles=1 packets=10 MA=6 REM=3 UP=737 DOWN=1309 spindles=152 LFP=yes last spike=6059 s LFP length=6059 s BWRat17-121912 rat=BWRat17 units= 35 pE= 34 pI= 1 cycles=1 packets=27 MA=16 REM=5 UP=1006 DOWN=2756 spindles=459 LFP=yes last spike=6535 s LFP length=6535 s BWRat18-020513 rat=BWRat18 units= 40 pE= 35 pI= 5 cycles=2 packets=19 MA=2 REM=13 UP=665 DOWN=2700 spindles=451 LFP=yes last spike=7590 s LFP length=7591 s BWRat19-032413 rat=BWRat19 units= 50 pE= 38 pI=12 cycles=1 packets=12 MA=9 REM=1 UP=1185 DOWN=1497 spindles=226 LFP=yes last spike=5013 s LFP length=5013 s BWRat19-032513 rat=BWRat19 units= 61 pE= 52 pI= 9 cycles=1 packets=15 MA=9 REM=5 UP=1225 DOWN=1511 spindles=225 LFP=yes last spike=3929 s LFP length=3929 s BWRat20-101013 rat=BWRat20 units= 22 pE= 17 pI= 5 cycles=1 packets=22 MA=9 REM=10 UP=2252 DOWN=3322 spindles=432 LFP=yes last spike=13364 s LFP length=13364 s BWRat20-101513 rat=BWRat20 units= 66 pE= 63 pI= 3 cycles=3 packets=86 MA=47 REM=58 UP=7023 DOWN=10450 spindles=1399 LFP=yes last spike=23012 s LFP length=23012 s BWRat21-121113 rat=BWRat21 units= 32 pE= 28 pI= 4 cycles=2 packets=64 MA=17 REM=57 UP=1602 DOWN=4129 spindles=1012 LFP=yes last spike=21883 s LFP length=21883 s BWRat21-121613 rat=BWRat21 units= 21 pE= 20 pI= 1 cycles=2 packets=56 MA=20 REM=45 UP=22 DOWN=2919 spindles=867 LFP=yes last spike=21542 s LFP length=21542 s BWRat21-121813 rat=BWRat21 units= 12 pE= 11 pI= 1 cycles=3 packets=47 MA=11 REM=45 UP=116 DOWN=7006 spindles=909 LFP=yes last spike=21706 s LFP length=21706 s Bogey-012615 rat=Bogey units= 36 pE= 32 pI= 4 cycles=3 packets=86 MA=42 REM=22 UP=7255 DOWN=11252 spindles=1317 LFP=yes last spike=24263 s LFP length=24263 s Dino-061814 rat=Dino units=114 pE=105 pI= 9 cycles=2 packets=51 MA=23 REM=31 UP=3856 DOWN=4588 spindles=992 LFP=yes last spike=19646 s LFP length=19646 s Dino-061914 rat=Dino units= 60 pE= 55 pI= 5 cycles=1 packets=37 MA=13 REM=19 UP=0 DOWN=0 spindles=0 LFP=no last spike=17520 s LFP length=0 s Dino-062014 rat=Dino units= 36 pE= 32 pI= 4 cycles=2 packets=52 MA=20 REM=26 UP=4530 DOWN=6600 spindles=1099 LFP=yes last spike=22363 s LFP length=22363 s Dino-072114 rat=Dino units= 16 pE= 11 pI= 5 cycles=0 packets=12 MA=4 REM=4 UP=204 DOWN=1286 spindles=257 LFP=yes last spike=7959 s LFP length=7959 s Dino-072314 rat=Dino units= 26 pE= 26 pI= 0 cycles=3 packets=22 MA=7 REM=15 UP=985 DOWN=2287 spindles=561 LFP=yes last spike=10321 s LFP length=10321 s Dino-072414 rat=Dino units= 61 pE= 55 pI= 6 cycles=3 packets=23 MA=6 REM=23 UP=2519 DOWN=3033 spindles=724 LFP=yes last spike=13209 s LFP length=13209 s Rizzo-022615 rat=Rizzo units= 26 pE= 25 pI= 1 cycles=6 packets=104 MA=37 REM=41 UP=8834 DOWN=15428 spindles=2668 LFP=yes last spike=40555 s LFP length=40555 s Rizzo-022715 rat=Rizzo units= 93 pE= 89 pI= 4 cycles=2 packets=55 MA=20 REM=28 UP=7311 DOWN=9664 spindles=1249 LFP=yes last spike=25932 s LFP length=25932 s Splinter-020515 rat=Splinter units= 27 pE= 26 pI= 1 cycles=3 packets=48 MA=17 REM=35 UP=2331 DOWN=5786 spindles=1311 LFP=yes last spike=23837 s LFP length=23837 s Splinter-020915 rat=Splinter units= 51 pE= 42 pI= 9 cycles=2 packets=44 MA=22 REM=21 UP=5764 DOWN=11672 spindles=1262 LFP=yes last spike=23487 s LFP length=23488 s Templeton-032415 rat=Templeton units= 10 pE= 10 pI= 0 cycles=3 packets=72 MA=38 REM=31 UP=28 DOWN=4145 spindles=1045 LFP=yes last spike=19058 s LFP length=19058 s
spike times: min 0.0011 max 40555.09645 s; fraction of times that are whole seconds 5.046151028804514e-05
cell types: {'E': 850, 'I': 95, '?': 0}
LFP rate: [1250.0, nan] sessions without LFP: ['Dino-061914']
regions of units: {'CTX': 945}
electrode locations: [np.str_('ACC'), np.str_('MotorCtx'), np.str_('OFC'), np.str_('mPFC')]
LFP starting_time (s), distinct values over files with LFP: [0.0] (added to the LFP window times and LFP detections)
acquisition series per file (name, shape, rate): ['[]'] ; the only ElectricalSeries with data is the 1250 Hz LFP (rate above), so no wideband signal for an EMG
population spikes 0-100 ms after over 100-0 ms before UP onsets, median over sessions: 50.1 ; with UP onsets shifted by 1800 s: 0.988
log delta power, nonREM packets minus WAKE, median over sessions: 1.5 ; with the intervals shifted by 1800 s: -0.0967 ; sessions 20, with a positive difference 20
== crcns-fcx-1: 27 sessions, rats ['B22', 'BWRat17', 'BWRat18', 'BWRat19', 'BWRat20', 'BWRat21', 'Bogey', 'Dino', 'Rizzo', 'Splinter', 'Templeton']
20140526_277um rat=B22 units= 62 pE= 51 pI=11 cycles=2 packets=26 MA=55 REM=6 UP=982 DOWN=1190 spindles=157 LFP=yes last spike=13572 s LFP length=13572 s
20140527_421um rat=B22 units= 29 pE= 24 pI= 5 cycles=1 packets=8 MA=33 REM=5 UP=913 DOWN=1550 spindles=92 LFP=yes last spike=17615 s LFP length=17615 s
20140528_565um rat=B22 units= 33 pE= 27 pI= 6 cycles=1 packets=15 MA=29 REM=14 UP=1237 DOWN=1664 spindles=158 LFP=yes last spike=12396 s LFP length=12396 s
BWRat17_121712 rat=BWRat17 units= 50 pE= 43 pI= 7 cycles=1 packets=9 MA=10 REM=1 UP=579 DOWN=995 spindles=46 LFP=yes last spike=6059 s LFP length=6059 s
BWRat17_121912 rat=BWRat17 units= 35 pE= 34 pI= 1 cycles=1 packets=33 MA=70 REM=5 UP=885 DOWN=2269 spindles=136 LFP=yes last spike=6535 s LFP length=6535 s
BWRat18_020513 rat=BWRat18 units= 40 pE= 34 pI= 6 cycles=2 packets=17 MA=33 REM=13 UP=1037 DOWN=3886 spindles=172 LFP=yes last spike=7590 s LFP length=7591 s
BWRat19_032413 rat=BWRat19 units= 50 pE= 37 pI=13 cycles=1 packets=19 MA=57 REM=0 UP=1246 DOWN=1592 spindles=73 LFP=yes last spike=5013 s LFP length=5013 s
BWRat19_032513 rat=BWRat19 units= 61 pE= 51 pI=10 cycles=1 packets=6 MA=40 REM=9 UP=654 DOWN=822 spindles=56 LFP=yes last spike=3929 s LFP length=3929 s
BWRat20_101013 rat=BWRat20 units= 22 pE= 17 pI= 5 cycles=1 packets=18 MA=44 REM=9 UP=1380 DOWN=2050 spindles=89 LFP=yes last spike=13364 s LFP length=13364 s
BWRat20_101513 rat=BWRat20 units= 66 pE= 60 pI= 6 cycles=2 packets=35 MA=332 REM=27 UP=2917 DOWN=4282 spindles=243 LFP=yes last spike=23012 s LFP length=23012 s
BWRat21_121113 rat=BWRat21 units= 32 pE= 28 pI= 4 cycles=2 packets=28 MA=130 REM=21 UP=1194 DOWN=2894 spindles=124 LFP=yes last spike=21883 s LFP length=21883 s
BWRat21_121613 rat=BWRat21 units= 21 pE= 20 pI= 1 cycles=1 packets=6 MA=350 REM=2 UP=71 DOWN=1679 spindles=66 LFP=yes last spike=21542 s LFP length=21542 s
BWRat21_121813 rat=BWRat21 units= 12 pE= 11 pI= 1 cycles=3 packets=49 MA=176 REM=67 UP=54 DOWN=2549 spindles=147 LFP=yes last spike=21706 s LFP length=21706 s
Bogey_012615 rat=Bogey units= 36 pE= 33 pI= 3 cycles=3 packets=60 MA=73 REM=18 UP=4022 DOWN=6364 spindles=298 LFP=yes last spike=24263 s LFP length=24263 s
Dino_061814_mPFC rat=Dino units=113 pE=104 pI= 9 cycles=2 packets=29 MA=65 REM=17 UP=1003 DOWN=1178 spindles=144 LFP=yes last spike=19646 s LFP length=19646 s
Dino_061914_ACC rat=Dino units= 52 pE= 46 pI= 6 cycles=1 packets=11 MA=36 REM=5 UP=1030 DOWN=1376 spindles=82 LFP=yes last spike=17520 s LFP length=17520 s
Dino_061914_mPFC rat=Dino units= 60 pE= 55 pI= 5 cycles=1 packets=12 MA=43 REM=5 UP=842 DOWN=1096 spindles=62 LFP=yes last spike=17520 s LFP length=17520 s
Dino_062014_ACC rat=Dino units= 24 pE= 23 pI= 1 cycles=3 packets=41 MA=49 REM=21 UP=3417 DOWN=7364 spindles=379 LFP=yes last spike=22363 s LFP length=22363 s
Dino_062014_mPFC rat=Dino units= 36 pE= 32 pI= 4 cycles=3 packets=17 MA=57 REM=10 UP=1874 DOWN=2656 spindles=159 LFP=yes last spike=22363 s LFP length=22363 s
Dino_072114_mPFC rat=Dino units= 18 pE= 18 pI= 0 cycles=1 packets=3 MA=80 REM=5 UP=121 DOWN=651 spindles=57 LFP=yes last spike=7959 s LFP length=7959 s
Dino_072314_mPFC rat=Dino units= 16 pE= 16 pI= 0 cycles=2 packets=16 MA=75 REM=11 UP=320 DOWN=1167 spindles=100 LFP=yes last spike=10321 s LFP length=10321 s
Dino_072414_mPFC rat=Dino units= 46 pE= 40 pI= 6 cycles=1 packets=6 MA=71 REM=1 UP=348 DOWN=446 spindles=50 LFP=yes last spike=13209 s LFP length=13209 s
Rizzo_022615 rat=Rizzo units= 26 pE= 25 pI= 1 cycles=5 packets=66 MA=16 REM=52 UP=6449 DOWN=10322 spindles=879 LFP=yes last spike=40555 s LFP length=40555 s
Rizzo_022715 rat=Rizzo units= 93 pE= 89 pI= 4 cycles=2 packets=44 MA=35 REM=25 UP=4404 DOWN=5769 spindles=306 LFP=yes last spike=25932 s LFP length=25932 s
Splinter_020515 rat=Splinter units= 27 pE= 25 pI= 2 cycles=3 packets=33 MA=67 REM=13 UP=2046 DOWN=4691 spindles=326 LFP=yes last spike=23837 s LFP length=23837 s
Splinter_020915 rat=Splinter units= 51 pE= 42 pI= 9 cycles=2 packets=31 MA=44 REM=27 UP=4161 DOWN=7803 spindles=349 LFP=yes last spike=23487 s LFP length=23488 s
Templeton_032415 rat=Templeton units= 10 pE= 10 pI= 0 cycles=3 packets=63 MA=60 REM=28 UP=44 DOWN=8534 spindles=453 LFP=yes last spike=19058 s LFP length=19058 s
spike times: min 0.0011 max 40555.09645 s; fraction of times that are whole seconds 4.988432738032376e-05
cell types: {'E': 995, 'I': 126, '?': 0}
channels: .xml against the count found from the .eeg stream where the .xml came later: [('BWRat19_032413', 135, 135), ('BWRat19_032513', 135, 135), ('BWRat21_121113', 62, 62), ('BWRat21_121813', 62, 62), ('Dino_061814_mPFC', 142, 142), ('Dino_061914_mPFC', 142, 142), ('Dino_062014_ACC', 142, 142), ('Dino_072114_mPFC', 142, 142), ('Dino_072414_mPFC', 142, 142), ('Splinter_020515', 70, 70)]
LFP sampling rate in _BasicMetaData: [1250.0]
LFP length against last state interval end (s): [('20140526_277um', 13572, 9268), ('20140527_421um', 17615, 10946), ('20140528_565um', 12396, 8769), ('BWRat17_121712', 6059, 4009), ('BWRat17_121912', 6535, 5428)] ...
spindle amplitude range (uV): [ 3.68835612 203.28462515 572.04030797]
population spikes 0-100 ms after over 100-0 ms before UP onsets, median over sessions: 71.2 ; with UP onsets shifted by 1800 s: 0.992 log delta power, nonREM packets minus WAKE, median over sessions: 1.71 ; with the intervals shifted by 1800 s: -0.157 ; sessions 27, with a positive difference 27
Recordings deposited more than once, within and across the datasets.
# Recordings deposited more than once: sessions of the same rat and date, within each dataset, and the
# same session across the two datasets (identical spike trains, LFP length).
def same_trains(a, b):
ka = {(len(x), round(float(x[0]), 5), round(float(x[-1]), 5)) for x in a["spikes"] if len(x)}
return sum(1 for x in b["spikes"] if len(x) and (len(x), round(float(x[0]), 5), round(float(x[-1]), 5)) in ka)
def key(s):
n = s["name"].replace("-", "_")
return "_".join(n.split("_")[:2])
for ds in DS:
ss = D[ds]
for i in range(len(ss)):
for j in range(i + 1, len(ss)):
if key(ss[i]) == key(ss[j]):
a, b = ss[i], ss[j]
c = np.nan
if "bp_delta" in a["G"] and "bp_delta" in b["G"] and a["G"]["T"] == b["G"]["T"]:
c = nancorr(np.log(a["G"]["bp_delta"]), np.log(b["G"]["bp_delta"]))
pr(f"{ds}: {a['name']} and {b['name']}: identical spike trains {same_trains(a, b)} of {len(a['spikes'])}/{len(b['spikes'])}; "
f"LFP bytes {a.get('eeg_bytes')} / {b.get('eeg_bytes')}; good channels {a.get('goodeegchannel')} / {b.get('goodeegchannel')}; "
f"correlation of their delta power {fmt(c)}")
pr(ds, "pairs of sessions with any identical spike train across different dates:",
sum(1 for i in range(len(ss)) for j in range(i + 1, len(ss)) if key(ss[i]) != key(ss[j]) and same_trains(ss[i], ss[j]) > 0))
cr = {key(s) + ("_ACC" if s["name"].endswith("ACC") else ""): s for s in D["crcns-fcx-1"]}
rows = []
for s in D["000041"]:
c = cr.get(key(s))
if c is None:
rows.append(f"{s['name']}: no CRCNS session"); continue
st = same_trains(c, s)
tt = [x for x in cr if x.startswith(key(s)) and x != key(s)]
extra = "; " + ", ".join(f"{x}: {same_trains(cr[x], s)} identical" for x in tt) if tt else ""
rows.append(f"{s['name']}: units {len(s['spikes'])} against {len(c['spikes'])} ({c['name']}), identical trains {st}, pE {len(s['E'])}/{len(c['E'])}, pI {len(s['I'])}/{len(c['I'])}{extra}")
pr("DANDI file against the CRCNS session of the same name:\n " + "\n ".join(rows))
pr("CRCNS sessions with no DANDI file:", sorted(set(cr) - {key(s) for s in D["000041"]}))
000041 pairs of sessions with any identical spike train across different dates: 0 crcns-fcx-1: Dino_061914_ACC and Dino_061914_mPFC: identical spike trains 0 of 52/60; LFP bytes 6219440250 / 6219440250; good channels 19 / 83; correlation of their delta power 0.834 crcns-fcx-1: Dino_062014_ACC and Dino_062014_mPFC: identical spike trains 0 of 24/36; LFP bytes 7938936000 / 7938936000; good channels 18 / 83; correlation of their delta power 0.556 crcns-fcx-1 pairs of sessions with any identical spike train across different dates: 0 DANDI file against the CRCNS session of the same name: BWRat17-121712: units 50 against 50 (BWRat17_121712), identical trains 50, pE 44/43, pI 6/7 BWRat17-121912: units 35 against 35 (BWRat17_121912), identical trains 35, pE 34/34, pI 1/1 BWRat18-020513: units 40 against 40 (BWRat18_020513), identical trains 40, pE 35/34, pI 5/6 BWRat19-032413: units 50 against 50 (BWRat19_032413), identical trains 50, pE 38/37, pI 12/13 BWRat19-032513: units 61 against 61 (BWRat19_032513), identical trains 61, pE 52/51, pI 9/10 BWRat20-101013: units 22 against 22 (BWRat20_101013), identical trains 22, pE 17/17, pI 5/5 BWRat20-101513: units 66 against 66 (BWRat20_101513), identical trains 66, pE 63/60, pI 3/6 BWRat21-121113: units 32 against 32 (BWRat21_121113), identical trains 32, pE 28/28, pI 4/4 BWRat21-121613: units 21 against 21 (BWRat21_121613), identical trains 21, pE 20/20, pI 1/1 BWRat21-121813: units 12 against 12 (BWRat21_121813), identical trains 12, pE 11/11, pI 1/1 Bogey-012615: units 36 against 36 (Bogey_012615), identical trains 36, pE 32/33, pI 4/3 Dino-061814: units 114 against 113 (Dino_061814_mPFC), identical trains 113, pE 105/104, pI 9/9 Dino-061914: units 60 against 60 (Dino_061914_mPFC), identical trains 60, pE 55/55, pI 5/5; Dino_061914_ACC: 0 identical Dino-062014: units 36 against 36 (Dino_062014_mPFC), identical trains 36, pE 32/32, pI 4/4; Dino_062014_ACC: 0 identical Dino-072114: units 16 against 18 (Dino_072114_mPFC), identical trains 13, pE 11/18, pI 5/0 Dino-072314: units 26 against 16 (Dino_072314_mPFC), identical trains 16, pE 26/16, pI 0/0 Dino-072414: units 61 against 46 (Dino_072414_mPFC), identical trains 46, pE 55/40, pI 6/6 Rizzo-022615: units 26 against 26 (Rizzo_022615), identical trains 26, pE 25/25, pI 1/1 Rizzo-022715: units 93 against 93 (Rizzo_022715), identical trains 93, pE 89/89, pI 4/4 Splinter-020515: units 27 against 27 (Splinter_020515), identical trains 27, pE 26/25, pI 1/2 Splinter-020915: units 51 against 51 (Splinter_020915), identical trains 51, pE 42/42, pI 9/9 Templeton-032415: units 10 against 10 (Templeton_032415), identical trains 10, pE 10/10, pI 0/0 CRCNS sessions with no DANDI file: ['20140526_277um', '20140527_421um', '20140528_565um', 'Dino_061914_ACC', 'Dino_062014_ACC']
Data check, stated. The CRCNS files match the paper's description: 11 rats, 27 sessions, 1121 stable units (995 pE, 126 pI) of 1360 clustered, LFP at 1250 Hz, and, as printed below under the claims, Table S1's state durations, UP/DOWN counts and spindle values exactly. Each channel count found from a CRCNS .eeg stream equals its .xml. DANDI:000041 holds 22 of the 27 sessions: rat B22 (the three 2014052x sessions) and the ACC probes of Dino 061914 and 062014 are not in it, and Dino-061914 has no LFP. Its spike trains are those of CRCNS, train for train, except in Dino-072114 (13 of 16 identical), Dino-072314 and Dino-072414 (10 and 15 units more than CRCNS) and Dino-061814 (one more); in 7 sessions whose spike trains are all identical to CRCNS the pE and pI counts still differ (for example BWRat20-101513, 63 pE and 3 pI against 60 and 6), so its cell-type labels do not all follow _CellIDs. The Dino 061914 and 062014 ACC and mPFC folders of CRCNS hold LFP files of the same size with different good channels and no shared spike trains: two probes of one recording, counted as two sessions as Table S1 does. UP onsets are followed by a 50- to 70-fold rise of population spiking, which vanishes when the onsets are shifted by 1800 s, so spikes and the UP/DOWN intervals share a clock; state intervals and rates are consistent with that (WAKE and nonREM rates differ by state as below).
Sextiles of pE cells by WAKE rate, used by later claims.
# Sextiles of pE cells by WAKE rate, over each whole dataset ([claim] M2, reading a)
for ds in DS:
W.sextiles(D[ds], 'a')
pr(ds, 'pE cells per sextile:', np.bincount(np.concatenate([s['sextile'] for s in D[ds]])[np.concatenate([s['sextile'] for s in D[ds]]) >= 0]).tolist(),
'cells without a WAKE rate:', int(sum((s['sextile'] < 0).sum() for s in D[ds])))
000041 pE cells per sextile: [142, 142, 141, 142, 142, 141] cells without a WAKE rate: 0 crcns-fcx-1 pE cells per sextile: [166, 166, 166, 166, 166, 165] cells without a WAKE rate: 0
table1-dataset-counts¶
The data comprise 11 rats and 27 sessions, with 1360 clustered units of which 1121 are stable, 995 putative pyramidal cells (mean 36.9 per session, range 10 to 104) and 126 putative interneurons (4.67 per session, range 0 to 13).
Source: Results, Identification of brain states, sentence 1; Results, Assessment of firing patterns in different brain states, paragraph 1; Table S1, top. The criterion and its readings are in the claims file; the code below runs each reading it names.
TS1 = {"BWRat17": (2, 38.5, 4), "BWRat18": (1, 34, 6), "BWRat19": (2, 44, 11.5), "BWRat20": (2, 38.5, 5.5),
"BWRat21": (3, 19.7, 2), "Dino": (8, 41.8, 3.9), "B22": (3, 34, 7.3), "Bogey": (1, 33, 3),
"Splinter": (2, 33.5, 5.5), "Rizzo": (2, 57, 2.5), "Templeton": (1, 10, 0)}
for ds in DS:
ss = D[ds]
nE = sum(len(s["E"]) for s in ss); nI = sum(len(s["I"]) for s in ss)
nst = sum(len(s["spikes"]) for s in ss)
pr(f"== {ds}: rats {len(set(s['rat'] for s in ss))}, sessions {len(ss)}, units {nst}, pE {nE}, pI {nI}, "
f"mean pE/session {nE/len(ss):.2f} (range {min(len(s['E']) for s in ss)}-{max(len(s['E']) for s in ss)}), "
f"mean pI/session {nI/len(ss):.2f} (range {min(len(s['I']) for s in ss)}-{max(len(s['I']) for s in ss)})")
if ds == "crcns-fcx-1":
pr("clustered units in _SAll (stable and unstable):", sum(s.get("n_all_units", 0) for s in ss))
pr("rat: sessions, pE/session, pI/session (Table S1 in brackets)")
for r in TS1:
x = [s for s in ss if s["rat"] == r]
if not x:
pr(f" {r}: absent {TS1[r]}"); continue
pr(f" {r}: {len(x)}, {np.mean([len(s['E']) for s in x]):.1f}, {np.mean([len(s['I']) for s in x]):.1f} {TS1[r]}")
== 000041: rats 10, sessions 22, units 945, pE 850, pI 95, mean pE/session 38.64 (range 10-105), mean pI/session 4.32 (range 0-12) rat: sessions, pE/session, pI/session (Table S1 in brackets) BWRat17: 2, 39.0, 3.5 (2, 38.5, 4) BWRat18: 1, 35.0, 5.0 (1, 34, 6) BWRat19: 2, 45.0, 10.5 (2, 44, 11.5) BWRat20: 2, 40.0, 4.0 (2, 38.5, 5.5) BWRat21: 3, 19.7, 2.0 (3, 19.7, 2) Dino: 6, 47.3, 4.8 (8, 41.8, 3.9) B22: absent (3, 34, 7.3) Bogey: 1, 32.0, 4.0 (1, 33, 3) Splinter: 2, 34.0, 5.0 (2, 33.5, 5.5) Rizzo: 2, 57.0, 2.5 (2, 57, 2.5) Templeton: 1, 10.0, 0.0 (1, 10, 0) == crcns-fcx-1: rats 11, sessions 27, units 1121, pE 995, pI 126, mean pE/session 36.85 (range 10-104), mean pI/session 4.67 (range 0-13) clustered units in _SAll (stable and unstable): 1360 rat: sessions, pE/session, pI/session (Table S1 in brackets) BWRat17: 2, 38.5, 4.0 (2, 38.5, 4) BWRat18: 1, 34.0, 6.0 (1, 34, 6) BWRat19: 2, 44.0, 11.5 (2, 44, 11.5) BWRat20: 2, 38.5, 5.5 (2, 38.5, 5.5) BWRat21: 3, 19.7, 2.0 (3, 19.7, 2) Dino: 8, 41.8, 3.9 (8, 41.8, 3.9) B22: 3, 34.0, 7.3 (3, 34, 7.3) Bogey: 1, 33.0, 3.0 (1, 33, 3) Splinter: 2, 33.5, 5.5 (2, 33.5, 5.5) Rizzo: 2, 57.0, 2.5 (2, 57, 2.5) Templeton: 1, 10.0, 0.0 (1, 10, 0)
Result: reproduced. On CRCNS:fcx-1 every count matches: 11 rats, 27 sessions, 1121 stable units, 995 pE (36.85 per session, range 10 to 104), 126 pI (4.67, range 0 to 13), and 1360 clustered units in _SAll; the per-rat sessions and units equal Table S1. On DANDI:000041 there are 10 rats, 22 sessions, 945 units, 850 pE and 95 pI: rat B22 (3 sessions) and the two Dino ACC sessions are absent, so DANDI holds part of the data set.
wake-sleep-cycles¶
The data hold 54 WAKE-SLEEP episodes (WAKE of at least 7 min followed by SLEEP of at least 20 min), an average of 2.0 per session, and sessions without one were discarded.
Source: Results, Identification of brain states, paragraph 1; Results, Firing pattern and LFP changes across the course of sleep, sentence 1; Table S1. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
ss = D[ds]
n = [len(s["cycles"]) for s in ss]
pr(f"== {ds} reading {'a (deposited WakeSleep intervals)' if ds=='crcns-fcx-1' else 'b (built from sleep_states)'}: "
f"{sum(n)} cycles, {sum(n)/len(ss):.2f} per session, sessions without a cycle: {[s['name'] for s,k in zip(ss,n) if k==0]}")
if ds == "crcns-fcx-1":
nb = []
for s in ss:
I = s["ints"]
ep = [("Non-REM", a, b) for a, b in I["SWSPacket"]] + [("REM", a, b) for a, b in I["REM"]]
ep.sort(key=lambda e: e[1])
seq, t = [], 0.0
for l, a, b in ep:
if a > t + 0.5:
seq.append(("Awake", t, a))
seq.append((l, a, b)); t = b
seq.append(("Awake", t, max(x.max() for x in s["spikes"] if len(x))))
lab, a, b = zip(*seq)
nb.append(len(W.derive_states(np.array(lab), np.array(a), np.array(b))["WakeSleep"]))
pr(f" reading b (built from the deposited packets and REM, all else awake): {sum(nb)} cycles, {sum(nb)/len(ss):.2f} per session, "
f"sessions without: {sum(k==0 for k in nb)}")
== 000041 reading b (built from sleep_states): 47 cycles, 2.14 per session, sessions without a cycle: ['Dino-072114'] == crcns-fcx-1 reading a (deposited WakeSleep intervals): 51 cycles, 1.89 per session, sessions without a cycle: [] reading b (built from the deposited packets and REM, all else awake): 47 cycles, 1.74 per session, sessions without: 1
Result: reproduced. CRCNS, reading a (deposited cycles): 51 cycles, 1.89 per session, every session has one; both within tolerance (54 +- 5.4, 2.0 +- 0.2). DANDI, reading b (cycles built from sleep_states): 47 cycles, 2.14 per session, and Dino-072114 has none. On CRCNS, cycles built by the same rules from the deposited packets and REM give 47, so the DANDI shortfall comes from rebuilding the intervals.
tables1-state-durations¶
Median durations are 1192 s for WAKE episodes, 2421 s for SLEEP episodes, 297 s for nonREM episodes, 98 s for REM episodes, and REM latency from SLEEP start is 647 s.
Source: Table S1, top. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
ss = D[ds]
wk = [c["wake"][1]-c["wake"][0] for s in ss for c in s["cycles"]]
sl = [c["sleep"][1]-c["sleep"][0] for s in ss for c in s["cycles"]]
ep = [e[1]-e[0] for s in ss for c in s["cycles"] for e in c["episodes"]]
re_ = [e[1]-e[0] for s in ss for c in s["cycles"] for e in c["remep"]]
re2 = [e[1]-e[0] for s in ss for c in s["cycles"] for e in c["rem"]]
lat = [c["remep"][0][0]-c["sleep"][0] for s in ss for c in s["cycles"] if len(c["remep"])]
lat2 = [c["rem"][0][0]-c["sleep"][0] for s in ss for c in s["cycles"] if len(c["rem"])]
ws = [c["sleep"][1]-c["wake"][0] for s in ss for c in s["cycles"]]
pr(f"== {ds}: medians (s): WAKE {np.median(wk):.0f} (n={len(wk)}), SLEEP {np.median(sl):.0f}, nonREM episode {np.median(ep):.0f} (n={len(ep)}), "
f"REM episode {np.median(re_):.0f} (n={len(re_)}; REM intervals {np.median(re2):.0f}, n={len(re2)}), REM latency {np.median(lat):.0f} "
f"(from REM intervals {np.median(lat2):.0f}; n={len(lat)} SLEEPs with REM), WAKE-SLEEP {np.median(ws):.0f}")
== 000041: medians (s): WAKE 1281 (n=47), SLEEP 2396, nonREM episode 277 (n=312), REM episode 64 (n=219; REM intervals 43, n=287), REM latency 616 (from REM intervals 616; n=47 SLEEPs with REM), WAKE-SLEEP 4206 == crcns-fcx-1: medians (s): WAKE 1192 (n=51), SLEEP 2421, nonREM episode 297 (n=365), REM episode 98 (n=252; REM intervals 40, n=417), REM latency 647 (from REM intervals 647; n=50 SLEEPs with REM), WAKE-SLEEP 4214
Result: reproduced. CRCNS: WAKE 1192 s, SLEEP 2421 s, nonREM episode 297 s, REM episode 98 s, REM latency 647 s, each equal to Table S1. DANDI: 1281, 2396, 277, 64 and 616 s, four of five within tolerance (REM episode 64 s against 98 +- 9.8). The median WAKE-SLEEP duration is 4214 s on CRCNS (Table S1 prints 5918 s), not one of the values judged.
ma-statistics¶
There are 790 microarousals, with median duration 15.9 s, 0.32 per minute, taking 9.1% of SLEEP time.
Source: Results, Identification of brain states, paragraph 2; Table S1. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
ss = D[ds]
allm, med_s, inc_s, pct_s = [], [], [], []
for s in ss:
d = [m[1]-m[0] for c in s["cycles"] for m in c["ma"]]
slt = sum(c["sleep"][1]-c["sleep"][0] for c in s["cycles"])
if slt == 0:
continue
allm += d
if d: med_s.append(np.median(d))
inc_s.append(len(d) / (slt / 60)); pct_s.append(100 * sum(d) / slt)
pr(f"== {ds}: MAs in SLEEP of cycles {len(allm)}; median duration (a) all MAs {np.median(allm):.1f} s, (b) median of session medians "
f"{np.median(med_s):.1f} s; incidence median over sessions {np.median(inc_s):.3f}/min (mean {np.mean(inc_s):.3f}); "
f"percent of SLEEP median {np.median(pct_s):.1f}% (mean {np.mean(pct_s):.1f}%); sessions {len(inc_s)}")
tot = sum(len(s["ints"]["MA"]) for s in ss)
pr(f" all MAs of the sessions, in or out of cycles: {tot}")
for ds in DS:
ss = D[ds]
allm = [m[1]-m[0] for s in ss for sl in np.asarray(s["ints"]["Sleep"]).reshape(-1, 2) for m in np.asarray(s["ints"]["MA"]).reshape(-1, 2) if m[0] >= sl[0] and m[1] <= sl[1]]
pr(f"== {ds} (ma-statistics variant) MAs within any scored SLEEP: {len(allm)}, median {np.median(allm):.1f} s")
# Where the deposited MAs lie (verifier round 1, problem 4): per session, MAs inside the SLEEP of a
# WAKE-SLEEP cycle, inside another scored SLEEP, inside a scored WAKE, or in neither; and how many
# lie between two packets (a packet ending within 2 s before the MA and another starting within
# 2 s after it).
for ds in DS:
pr(f"== {ds}: deposited MAs by where they lie (session: in cycle SLEEP / other SLEEP / WAKE / neither; between two packets)")
tot = {"cycle SLEEP": [], "other SLEEP": [], "WAKE": [], "neither": []}; nbetween = 0
for s in D[ds]:
I = s["ints"]; M = np.asarray(I["MA"]).reshape(-1, 2)
cs = np.array([c["sleep"] for c in s["cycles"]]).reshape(-1, 2)
Sl = np.asarray(I["Sleep"]).reshape(-1, 2); Wk = np.asarray(I["Wake"]).reshape(-1, 2)
pk = np.asarray(I["SWSPacket"]).reshape(-1, 2)
def inside(m, X): return bool(((X[:, 0] <= m[0]) & (X[:, 1] >= m[1])).any()) if len(X) else False
row = {k: 0 for k in tot}; nb_ = 0
for m in M:
k = "cycle SLEEP" if inside(m, cs) else "other SLEEP" if inside(m, Sl) else "WAKE" if inside(m, Wk) else "neither"
row[k] += 1; tot[k].append(m[1] - m[0])
if len(pk) and (np.abs(pk[:, 1] - m[0]) <= 2).any() and (np.abs(pk[:, 0] - m[1]) <= 2).any(): nb_ += 1
nbetween += nb_
pr(f" {s['name']:18s} MAs {len(M):4d}: {row['cycle SLEEP']:3d} / {row['other SLEEP']:3d} / {row['WAKE']:4d} / {row['neither']:3d}; between packets {nb_:4d}; "
f"packets {len(pk)}, cycles {len(s['cycles'])}")
pr(" totals: " + "; ".join(f"{k} {len(v)} (median {np.median(v) if v else np.nan:.1f} s)" for k, v in tot.items()) + f"; between two packets {nbetween}")
== 000041: MAs in SLEEP of cycles 181; median duration (a) all MAs 19.0 s, (b) median of session medians 19.0 s; incidence median over sessions 0.072/min (mean 0.090); percent of SLEEP median 2.6% (mean 3.1%); sessions 21 all MAs of the sessions, in or out of cycles: 395 == crcns-fcx-1: MAs in SLEEP of cycles 434; median duration (a) all MAs 11.0 s, (b) median of session medians 11.5 s; incidence median over sessions 0.184/min (mean 0.185); percent of SLEEP median 3.7% (mean 4.7%); sessions 27 all MAs of the sessions, in or out of cycles: 2130 == 000041 (ma-statistics variant) MAs within any scored SLEEP: 289, median 19.0 s == crcns-fcx-1 (ma-statistics variant) MAs within any scored SLEEP: 434, median 11.0 s == 000041: deposited MAs by where they lie (session: in cycle SLEEP / other SLEEP / WAKE / neither; between two packets) BWRat17-121712 MAs 6: 3 / 0 / 0 / 3; between packets 5; packets 10, cycles 1 BWRat17-121912 MAs 16: 12 / 0 / 1 / 3; between packets 16; packets 27, cycles 1 BWRat18-020513 MAs 2: 2 / 0 / 0 / 0; between packets 2; packets 19, cycles 2 BWRat19-032413 MAs 9: 8 / 0 / 1 / 0; between packets 7; packets 12, cycles 1 BWRat19-032513 MAs 9: 4 / 0 / 2 / 3; between packets 8; packets 15, cycles 1 BWRat20-101013 MAs 9: 5 / 0 / 0 / 4; between packets 9; packets 22, cycles 1 BWRat20-101513 MAs 47: 18 / 17 / 12 / 0; between packets 35; packets 86, cycles 3 BWRat21-121113 MAs 17: 2 / 9 / 0 / 6; between packets 16; packets 64, cycles 2 BWRat21-121613 MAs 20: 7 / 4 / 4 / 5; between packets 16; packets 56, cycles 2 BWRat21-121813 MAs 11: 9 / 1 / 1 / 0; between packets 11; packets 47, cycles 3 Bogey-012615 MAs 42: 25 / 13 / 3 / 1; between packets 40; packets 86, cycles 3 Dino-061814 MAs 23: 7 / 8 / 0 / 8; between packets 14; packets 51, cycles 2 Dino-061914 MAs 13: 5 / 1 / 6 / 1; between packets 10; packets 37, cycles 1 Dino-062014 MAs 20: 1 / 13 / 6 / 0; between packets 13; packets 52, cycles 2
Dino-072114 MAs 4: 0 / 2 / 2 / 0; between packets 3; packets 12, cycles 0 Dino-072314 MAs 7: 4 / 0 / 1 / 2; between packets 4; packets 22, cycles 3 Dino-072414 MAs 6: 6 / 0 / 0 / 0; between packets 6; packets 23, cycles 3 Rizzo-022615 MAs 37: 18 / 7 / 5 / 7; between packets 35; packets 104, cycles 6 Rizzo-022715 MAs 20: 9 / 5 / 5 / 1; between packets 16; packets 55, cycles 2 Splinter-020515 MAs 17: 5 / 12 / 0 / 0; between packets 13; packets 48, cycles 3 Splinter-020915 MAs 22: 8 / 9 / 3 / 2; between packets 16; packets 44, cycles 2 Templeton-032415 MAs 38: 23 / 7 / 2 / 6; between packets 31; packets 72, cycles 3 totals: cycle SLEEP 181 (median 19.0 s); other SLEEP 108 (median 19.0 s); WAKE 54 (median 21.0 s); neither 52 (median 17.0 s); between two packets 326 == crcns-fcx-1: deposited MAs by where they lie (session: in cycle SLEEP / other SLEEP / WAKE / neither; between two packets) 20140526_277um MAs 55: 22 / 0 / 0 / 33; between packets 16; packets 26, cycles 2 20140527_421um MAs 33: 4 / 0 / 2 / 27; between packets 4; packets 8, cycles 1 20140528_565um MAs 29: 8 / 0 / 0 / 21; between packets 5; packets 15, cycles 1 BWRat17_121712 MAs 10: 6 / 0 / 0 / 4; between packets 5; packets 9, cycles 1 BWRat17_121912 MAs 70: 27 / 0 / 0 / 43; between packets 15; packets 33, cycles 1 BWRat18_020513 MAs 33: 2 / 0 / 1 / 30; between packets 2; packets 17, cycles 2 BWRat19_032413 MAs 57: 20 / 0 / 3 / 34; between packets 12; packets 19, cycles 1 BWRat19_032513 MAs 40: 3 / 0 / 0 / 37; between packets 2; packets 6, cycles 1 BWRat20_101013 MAs 44: 13 / 0 / 0 / 31; between packets 9; packets 18, cycles 1 BWRat20_101513 MAs 332: 28 / 0 / 0 / 304; between packets 16; packets 35, cycles 2 BWRat21_121113 MAs 130: 22 / 0 / 0 / 108; between packets 7; packets 28, cycles 2 BWRat21_121613 MAs 350: 1 / 0 / 0 / 349; between packets 1; packets 6, cycles 1 BWRat21_121813 MAs 176: 17 / 0 / 0 / 159; between packets 12; packets 49, cycles 3 Bogey_012615 MAs 73: 34 / 0 / 2 / 37; between packets 28; packets 60, cycles 3 Dino_061814_mPFC MAs 65: 23 / 0 / 1 / 41; between packets 11; packets 29, cycles 2 Dino_061914_ACC MAs 36: 5 / 0 / 0 / 31; between packets 4; packets 11, cycles 1 Dino_061914_mPFC MAs 43: 5 / 0 / 0 / 38; between packets 4; packets 12, cycles 1 Dino_062014_ACC MAs 49: 20 / 0 / 1 / 28; between packets 13; packets 41, cycles 3 Dino_062014_mPFC MAs 57: 8 / 0 / 4 / 45; between packets 4; packets 17, cycles 3 Dino_072114_mPFC MAs 80: 4 / 0 / 0 / 76; between packets 0; packets 3, cycles 1 Dino_072314_mPFC MAs 75: 9 / 0 / 4 / 62; between packets 6; packets 16, cycles 2 Dino_072414_mPFC MAs 71: 9 / 0 / 7 / 55; between packets 2; packets 6, cycles 1 Rizzo_022615 MAs 16: 14 / 0 / 0 / 2; between packets 11; packets 66, cycles 5 Rizzo_022715 MAs 35: 31 / 0 / 0 / 4; between packets 19; packets 44, cycles 2 Splinter_020515 MAs 67: 28 / 0 / 0 / 39; between packets 16; packets 33, cycles 3 Splinter_020915 MAs 44: 19 / 0 / 1 / 24; between packets 11; packets 31, cycles 2 Templeton_032415 MAs 60: 52 / 0 / 0 / 8; between packets 29; packets 63, cycles 3 totals: cycle SLEEP 434 (median 11.0 s); other SLEEP 0 (median nan s); WAKE 26 (median 10.5 s); neither 1670 (median 11.0 s); between two packets 264
Result: not reproduced. CRCNS: 434 MAs in the SLEEP of cycles (790 expected), median 11.0 s (reading a) or 11.5 s (reading b), 0.184 per minute, 3.7% of SLEEP; none of the four within tolerance. Of the 2130 deposited MAs, 434 lie in the SLEEP of a cycle, none in another scored SLEEP, 26 in a scored WAKE and 1670 in neither (medians 11.0, 10.5 and 11.0 s); 264 lie between two packets. No subset gives 790, and every group has a median near 11 s against 15.9 s. DANDI: 181 MAs, 19.0 s, 0.072 per minute, 2.6%; none within tolerance.
ma-fraction-over-nrem-episodes¶
The fraction of time occupied by MAs decreases over the course of nonREM episodes (R = -0.85), with no statistical change over the course of SLEEP.
Source: Results, Identification of brain states, paragraph 2. The criterion and its readings are in the claims file; the code below runs each reading it names.
def ma_frac(s, sub):
k = W.secs(sub)
if len(k) == 0: return None
m = W.secs(np.concatenate([c["ma"] for c in s["cycles"]]) if s["cycles"] else np.zeros((0, 2)))
return np.isin(k, m).mean()
for ds in DS:
ss = D[ds]
pr(f"== {ds} episodes:", rp(W.norm_corr(ss, "episode", ma_frac, readings=("c", "b"), normalize=False)))
pr(f" SLEEP (whole SLEEP time):", rp(W.norm_corr(ss, "sleep_all", ma_frac, readings=("c", "b"), normalize=False)))
== 000041 episodes: c: R=-0.482, p=0.000393, n=50; b: R=-0.0452, p=8.53e-06, n=9673
SLEEP (whole SLEEP time): c: R=-0.16, p=0.266, n=50; b: R=-0.0213, p=0.0151, n=13003
== crcns-fcx-1 episodes: c: R=-0.84, p=2.35e-14, n=50; b: R=-0.0836, p=1.01e-19, n=11782
SLEEP (whole SLEEP time): c: R=-0.332, p=0.0184, n=50; b: R=-0.0414, p=1.68e-07, n=15966
Result: partially reproduced. CRCNS, reading c (50 bins averaged over episodes): R = -0.840, p = 2.4e-14, within the paper's sign and bound; over SLEEP the same correlation is R = -0.332, p = 0.018, a significant change, so the absence fails. DANDI: R = -0.482, p = 3.9e-4 over episodes and R = -0.160, p = 0.27 over SLEEP.
packet-duration¶
nonREM packet durations span two orders of magnitude with a median of 111 s.
Source: Results, Identification of brain states, paragraph 3; Table S1. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
ss = D[ds]
a = np.array([p[1]-p[0] for s in ss for c in s["cycles"] for p in c["packets"]])
b = np.array([p[1]-p[0] for s in ss for p in np.asarray(s["ints"]["SWSPacket"]).reshape(-1, 2)])
pr(f"== {ds}: packets in cycles {len(a)}, median {np.median(a):.0f} s, range {a.min():.0f}-{a.max():.0f} s (ratio {a.max()/a.min():.0f}); "
f"(b) all packets {len(b)}, median {np.median(b):.0f} s, range {b.min():.0f}-{b.max():.0f}")
== 000041: packets in cycles 466, median 144 s, range 20-1199 s (ratio 60); (b) all packets 964, median 127 s, range 20-1199 == crcns-fcx-1: packets in cycles 701, median 111 s, range 14-735 s (ratio 52); (b) all packets 701, median 111 s, range 14-735
Result: reproduced. CRCNS: median packet 111 s over 701 packets in cycles, within 111 +- 11.1; range 14 to 735 s (ratio 52, about 1.7 orders of magnitude), and the shortest packet is below Table S1's 20 s minimum. DANDI: median 144 s in cycles (127 s over all 964 packets), outside the tolerance.
fig2a-median-rates¶
Median firing rates of pE cells are 0.76 Hz in WAKE, 0.69 Hz in nonREM and 0.88 Hz in REM; of pI cells 5.59, 4.69 and 4.25 Hz.
Source: Results, Assessment of firing patterns in different brain states, paragraph 2; Figure 2A; Figure S2C. The criterion and its readings are in the claims file; the code below runs each reading it names.
STATES = ["wake", "nrem", "rem"]
def rates_table(s, kind, reading):
"""Per-cell rates in each state: reading a, one row per cell and cycle; b, one row per cell over
all its cycles; c, over the whole session's scored states."""
cells = cells_of(s, kind)
rows = []
if reading == "a":
for c in s["cycles"]:
rows.append(np.stack([W.cell_rates(s, W.state_pieces(s, st, [c]), cells)[0] for st in STATES], 1))
elif reading == "b":
rows.append(np.stack([W.cell_rates(s, W.state_pieces(s, st), cells)[0] for st in STATES], 1))
else:
I = s["ints"]
rows.append(np.stack([W.cell_rates(s, p, cells)[0] for p in [I["Wake"], I["SWSPacket"], I["REM"]]], 1))
return np.concatenate(rows) if rows else np.zeros((0, 3))
RT = {}
for ds in DS:
for kind in ["E", "I"]:
for r in "abc":
RT[ds, kind, r] = np.concatenate([rates_table(s, kind, r) for s in D[ds] if (s["cycles"] or r == "c")])
for r in "abc":
mE = np.nanmedian(RT[ds, "E", r], 0); mI = np.nanmedian(RT[ds, "I", r], 0)
pr(f"== {ds} reading {r}: pE n={len(RT[ds,'E',r])} WAKE {mE[0]:.2f} nonREM {mE[1]:.2f} REM {mE[2]:.2f} Hz; "
f"pI n={len(RT[ds,'I',r])} WAKE {mI[0]:.2f} nonREM {mI[1]:.2f} REM {mI[2]:.2f} Hz")
rats = sorted(set(s["rat"] for s in D[ds]))
byrat = []
for rt in rats:
X = [rates_table(s, "E", "b") for s in D[ds] if s["rat"] == rt and s["cycles"]]
if X:
m = np.nanmedian(np.concatenate(X), 0); byrat.append(f"{rt} {m[0]:.2f}/{m[1]:.2f}/{m[2]:.2f} (n={len(np.concatenate(X))})")
pr(f" by rat, pE medians WAKE/nonREM/REM, reading b: " + "; ".join(byrat))
== 000041 reading a: pE n=1761 WAKE 0.70 nonREM 0.68 REM 0.86 Hz; pI n=161 WAKE 6.47 nonREM 4.39 REM 5.98 Hz == 000041 reading b: pE n=839 WAKE 0.71 nonREM 0.66 REM 0.82 Hz; pI n=90 WAKE 6.28 nonREM 4.63 REM 5.99 Hz == 000041 reading c: pE n=850 WAKE 0.72 nonREM 0.66 REM 0.82 Hz; pI n=95 WAKE 5.23 nonREM 4.78 REM 6.00 Hz by rat, pE medians WAKE/nonREM/REM, reading b: BWRat17 0.59/0.45/0.55 (n=78); BWRat18 0.68/0.45/0.21 (n=35); BWRat19 1.11/0.78/0.81 (n=90); BWRat20 0.46/0.42/0.54 (n=80); BWRat21 0.42/0.52/0.77 (n=59); Bogey 0.77/0.70/0.85 (n=32); Dino 0.69/0.75/0.98 (n=273); Rizzo 1.19/1.00/1.30 (n=114); Splinter 0.56/0.35/0.58 (n=68); Templeton 0.46/0.48/0.96 (n=10)
== crcns-fcx-1 reading a: pE n=1787 WAKE 0.75 nonREM 0.71 REM 0.94 Hz; pI n=201 WAKE 6.00 nonREM 4.57 REM 5.72 Hz == crcns-fcx-1 reading b: pE n=995 WAKE 0.76 nonREM 0.69 REM 0.91 Hz; pI n=126 WAKE 5.59 nonREM 4.69 REM 5.80 Hz == crcns-fcx-1 reading c: pE n=995 WAKE 0.76 nonREM 0.69 REM 0.91 Hz; pI n=126 WAKE 5.59 nonREM 4.69 REM 5.80 Hz by rat, pE medians WAKE/nonREM/REM, reading b: B22 1.21/0.96/1.42 (n=102); BWRat17 0.60/0.45/0.61 (n=77); BWRat18 0.69/0.44/0.25 (n=34); BWRat19 1.04/0.74/1.03 (n=88); BWRat20 0.48/0.43/0.62 (n=77); BWRat21 0.40/0.61/0.80 (n=59); Bogey 0.83/0.75/0.91 (n=33); Dino 0.70/0.76/1.04 (n=334); Rizzo 1.23/0.96/1.34 (n=114); Splinter 0.53/0.33/0.56 (n=67); Templeton 0.47/0.49/1.23 (n=10)
Result: partially reproduced. CRCNS, reading b: pE 0.76, 0.69 and 0.91 Hz and pI 5.59, 4.69 and 5.80 Hz (WAKE, nonREM, REM); five of six within tolerance, the pI REM median (4.25 expected) is not. No reading puts all six within tolerance on either dataset (DANDI, best reading c, five of six, pI REM 6.00 Hz misses; readings a and b, four of six). Per-rat medians vary about threefold (pE WAKE 0.40 to 1.23 Hz on CRCNS).
fig2a-skewed-wide-distribution¶
The distribution of pE firing rates is strongly positively skewed, with a lognormal tail toward high rates and a supra-lognormal tail toward low rates, and spans three orders of magnitude, from 0.05 to 5 Hz.
Source: Results, Assessment of firing patterns in different brain states, paragraph 2; Figure 2A; Figure S2C. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
for r in "ab":
x = []
for s in D[ds]:
if not s["cycles"]: continue
cyc = s["cycles"] if r == "b" else None
groups = [[c] for c in s["cycles"]] if r == "a" else [s["cycles"]]
for g in groups:
p = np.concatenate([W.state_pieces(s, st, g) for st in STATES])
x.append(W.cell_rates(s, p, s["E"])[0])
x = np.concatenate(x); x = x[np.isfinite(x)]
lx = np.log10(x[x > 0])
pc = {q: np.percentile(x, q) for q in [1, 2.5, 5, 95, 97.5, 99]}
pr(f"== {ds} reading {r} (all states pooled): n={len(x)}, skewness {stats.skew(x):.2f}, skewness of log10 rate {stats.skew(lx):.2f}, "
f"5-95% {pc[5]:.3f}-{pc[95]:.2f} Hz, 1-99% {pc[1]:.3f}-{pc[99]:.2f}, 2.5-97.5% {pc[2.5]:.3f}-{pc[97.5]:.2f}, range {x.min():.4f}-{x.max():.1f}")
for i, st in enumerate(STATES):
x = RT[ds, "E", "b"][:, i]; x = x[np.isfinite(x)]
pr(f" state {st}: skew {stats.skew(x):.2f}, 5-95% {np.percentile(x,5):.3f}-{np.percentile(x,95):.2f}")
== 000041 reading a (all states pooled): n=1761, skewness 2.19, skewness of log10 rate -1.30, 5-95% 0.045-3.31 Hz, 1-99% 0.005-4.91, 2.5-97.5% 0.020-4.07, range 0.0000-8.3 == 000041 reading b (all states pooled): n=839, skewness 2.29, skewness of log10 rate -1.31, 5-95% 0.057-3.07 Hz, 1-99% 0.010-5.32, 2.5-97.5% 0.029-4.01, range 0.0003-8.0 state wake: skew 2.68, 5-95% 0.037-4.21 state nrem: skew 2.11, 5-95% 0.045-2.43 state rem: skew 4.24, 5-95% 0.047-3.67 == crcns-fcx-1 reading a (all states pooled): n=1787, skewness 2.37, skewness of log10 rate -1.06, 5-95% 0.069-3.22 Hz, 1-99% 0.016-4.79, 2.5-97.5% 0.033-4.13, range 0.0000-9.7 == crcns-fcx-1 reading b (all states pooled): n=995, skewness 2.57, skewness of log10 rate -1.10, 5-95% 0.070-3.26 Hz, 1-99% 0.013-5.69, 2.5-97.5% 0.032-4.17, range 0.0000-9.7 state wake: skew 2.81, 5-95% 0.041-4.29 state nrem: skew 2.39, 5-95% 0.052-2.49 state rem: skew 2.79, 5-95% 0.052-3.86
Result: partially reproduced. Rates over all states pooled are positively skewed (skewness 2.57 on CRCNS and 2.29 on DANDI, reading b), with a negative skewness of log10 rate (-1.10 and -1.31), a longer low tail than a lognormal. No percentile range matches 0.05 to 5 Hz within 10% at both ends: CRCNS 5-95% 0.070 to 3.26 Hz, 1-99% 0.013 to 5.69, 2.5-97.5% 0.032 to 4.17. The shape holds and the range does not.
fig2a-fraction-above-2hz¶
The right tail of the rate distribution is longer in WAKE and REM than in nonREM; the fraction of pE cells above 2 Hz is 19.2% in WAKE and in REM and 8.8% in nonREM.
Source: Results, Assessment of firing patterns in different brain states, paragraph 2; Figure 2A. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
for r in "abc":
X = RT[ds, "E", r]
f = [np.nanmean(X[np.isfinite(X[:, i]), i] > 2) * 100 for i in range(3)]
out = []
for i in (0, 2):
a = X[np.isfinite(X[:, 1]), 1]; b = X[np.isfinite(X[:, i]), i]
tab = [[(a > 2).sum(), (a <= 2).sum()], [(b > 2).sum(), (b <= 2).sum()]]
out.append(stats.chi2_contingency(tab)[1])
pr(f"== {ds} reading {r}: >2 Hz WAKE {f[0]:.1f}% REM {f[2]:.1f}% nonREM {f[1]:.1f}%; chi2 nonREM vs WAKE p={fmt(out[0])}, vs REM p={fmt(out[1])}")
== 000041 reading a: >2 Hz WAKE 18.5% REM 20.3% nonREM 10.0%; chi2 nonREM vs WAKE p=6.89e-13, vs REM p=2.6e-17 == 000041 reading b: >2 Hz WAKE 17.5% REM 18.1% nonREM 8.6%; chi2 nonREM vs WAKE p=8.2e-08, vs REM p=1.42e-08 == 000041 reading c: >2 Hz WAKE 16.8% REM 18.0% nonREM 7.9%; chi2 nonREM vs WAKE p=3.24e-08, vs REM p=8.16e-10 == crcns-fcx-1 reading a: >2 Hz WAKE 18.8% REM 20.6% nonREM 9.3%; chi2 nonREM vs WAKE p=4.09e-16, vs REM p=4.44e-21 == crcns-fcx-1 reading b: >2 Hz WAKE 19.2% REM 19.7% nonREM 8.7%; chi2 nonREM vs WAKE p=2.73e-11, vs REM p=5.14e-12 == crcns-fcx-1 reading c: >2 Hz WAKE 19.2% REM 19.7% nonREM 8.7%; chi2 nonREM vs WAKE p=2.73e-11, vs REM p=5.14e-12
Result: reproduced. CRCNS, reading b: 19.2% (WAKE), 19.7% (REM) and 8.7% (nonREM) above 2 Hz, chi-square p = 2.7e-11 (nonREM against WAKE) and 5.1e-12 (against REM), all within the claim. DANDI, reading b: 17.5%, 18.1% and 8.6%, within tolerance, with p = 8.2e-8 and 1.4e-8, above the 1e-10 bound.
fig2b-wake-nrem-slope¶
Per-cell nonREM and WAKE rates are highly correlated (R = 0.82), but the slope of their relation is below 1 (95% interval 0.66 to 0.71); in nonREM fast cells decrease and slow cells increase their rates relative to WAKE.
Source: Results, Assessment of firing patterns in different brain states, paragraph 2; Figure 2B and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
for r in "ab":
X = RT[ds, "E", r]
lw, ln, drop = W.log_pairs(X[:, 0], X[:, 1])
o = W.ols_slope(lw, ln); rv = W.ols_slope(ln, lw)
li = W.ols_slope(X[:, 0], X[:, 1])
pr(f"== {ds} M1 reading {r}: log10 slope {o['slope']:.3f} [{o['lo']:.3f}, {o['hi']:.3f}], R={o['R']:.3f}, p={fmt(o['p'])}, n={o['n']} "
f"(dropped {drop} with a zero rate); linear slope {li['slope']:.3f} [{li['lo']:.3f}, {li['hi']:.3f}] R={li['R']:.3f}; "
f"reverse (WAKE on nonREM, log) slope {rv['slope']:.3f}")
== 000041 M1 reading a: log10 slope 0.718 [0.695, 0.741], R=0.827, p=0, n=1746 (dropped 15 with a zero rate); linear slope 0.462 [0.445, 0.479] R=0.789; reverse (WAKE on nonREM, log) slope 0.953 == 000041 M1 reading b: log10 slope 0.711 [0.679, 0.744], R=0.832, p=6.45e-216, n=836 (dropped 3 with a zero rate); linear slope 0.430 [0.407, 0.453] R=0.787; reverse (WAKE on nonREM, log) slope 0.974 == crcns-fcx-1 M1 reading a: log10 slope 0.684 [0.661, 0.708], R=0.803, p=0, n=1780 (dropped 7 with a zero rate); linear slope 0.454 [0.437, 0.471] R=0.781; reverse (WAKE on nonREM, log) slope 0.943 == crcns-fcx-1 M1 reading b: log10 slope 0.685 [0.655, 0.715], R=0.820, p=2.77e-242, n=991 (dropped 4 with a zero rate); linear slope 0.448 [0.426, 0.469] R=0.797; reverse (WAKE on nonREM, log) slope 0.982
Result: reproduced. CRCNS, log10 rates: slope 0.685 [0.655, 0.715] (reading b) and 0.684 (reading a), R = 0.820, p < 1e-10, all within tolerance. DANDI: slope 0.711 [0.679, 0.744] (b) and 0.718 (a), just outside 0.685 +- 0.025, R = 0.832. The reverse slopes (WAKE on nonREM) are 0.94 to 0.98, so the slope below 1 is partly the regression of one noisy rate on another.
burst-index-by-state¶
The burst index (fraction of spikes with ISIs below 15 ms) is highest in nonREM (median 11.8%), lowest in WAKE (4.0%), with REM (5.5%) slightly above WAKE.
Source: Results, Assessment of firing patterns in different brain states, paragraph 3. The criterion and its readings are in the claims file; the code below runs each reading it names.
def burst_cell(s, pieces, cells, reading):
"""Burst index per cell over `pieces`, from spike times; an ISI counts only when both spikes lie
in one interval of the state (round 1 also dropped every ISI that crossed a second of the grid)."""
P = np.asarray(pieces, float).reshape(-1, 2)
if reading == "a":
n, sh = W.isi_counts(s, cells, P)
return np.where(n > 0, sh / np.maximum(n, 1), np.nan)
if reading == "b":
bins = np.array([[t0, t0 + 10] for a, b in P for t0 in np.arange(np.ceil(a), np.floor(b) - 9, 10)]).reshape(-1, 2)
if len(bins) == 0: return np.full(len(cells), np.nan)
n, sh = W.isi_counts(s, cells, bins, per_piece=True)
with np.errstate(invalid="ignore"):
return np.nanmean(np.where(n > 0, sh / np.maximum(n, 1), np.nan), 1)
if len(P) == 0: return np.full(len(cells), np.nan)
out = []
for i in cells:
t = s["sorted_spikes"][i]
iv = np.searchsorted(P[:, 0], t, "right") - 1
ok = (iv >= 0) & (t < P[np.maximum(iv, 0), 1]); t, iv = t[ok], iv[ok]
if len(t) < 2: out.append(np.nan); continue
sh = (np.diff(t) < 0.015) & (iv[1:] == iv[:-1])
short = np.zeros(len(t), bool); short[1:] |= sh; short[:-1] |= sh
out.append(short.mean())
return np.array(out)
def burst_grid_round1(s, pieces, cells):
"""Round 1's reading a, for comparison: ISIs kept only when both spikes fall in the same second."""
k = W.secs(pieces); out = []
for i in cells:
t = s["sorted_spikes"][i]; ki = t.astype(int)
same = (ki[1:] == ki[:-1]) & np.isin(ki[1:], k)
isi = np.diff(t)[same]
out.append((isi <= 0.015).mean() if len(isi) else np.nan)
return np.array(out)
BI = {}
for ds in DS:
for r in "abc":
X = []
for s in D[ds]:
if not s["cycles"]: continue
X.append(np.stack([burst_cell(s, W.state_pieces(s, st), s["E"], r) for st in STATES], 1))
X = np.concatenate(X) * 100; BI[ds, r] = X
m = np.nanmedian(X, 0)
cols = [X[np.isfinite(X[:, i]), i] for i in range(3)]
kw = stats.kruskal(*cols)
rs = stats.mannwhitneyu(cols[2], cols[0])
allv = np.concatenate(cols); rk = stats.rankdata(allv); N = len(allv)
n_ = [len(c) for c in cols]; mr = [rk[sum(n_[:i]):sum(n_[:i+1])].mean() for i in range(3)]
z = (mr[2] - mr[0]) / np.sqrt(N * (N + 1) / 12 * (1 / n_[2] + 1 / n_[0])); pd = 2 * stats.norm.sf(abs(z))
pr(f"== {ds} reading {r}: median burst index WAKE {m[0]:.1f}% nonREM {m[1]:.1f}% REM {m[2]:.1f}%; Kruskal-Wallis p={fmt(kw.pvalue)}; "
f"REM vs WAKE rank-sum p={fmt(rs.pvalue)}, Dunn z={z:.2f} p={fmt(pd)}; cells with a value {n_}")
X = np.concatenate([np.stack([burst_grid_round1(s, W.state_pieces(s, st), s["E"]) for st in STATES], 1) for s in D[ds] if s["cycles"]]) * 100
m = np.nanmedian(X, 0)
pr(f" {ds} round 1 grid reading a (ISIs within one second only), for comparison: WAKE {m[0]:.1f}% nonREM {m[1]:.1f}% REM {m[2]:.1f}%")
== 000041 reading a: median burst index WAKE 2.4% nonREM 6.1% REM 3.3%; Kruskal-Wallis p=1.07e-38; REM vs WAKE rank-sum p=0.00105, Dunn z=3.43 p=0.000612; cells with a value [833, 838, 820]
== 000041 reading b: median burst index WAKE 2.1% nonREM 6.0% REM 2.7%; Kruskal-Wallis p=7.77e-54; REM vs WAKE rank-sum p=0.0452, Dunn z=2.31 p=0.0206; cells with a value [826, 835, 814]
== 000041 reading c: median burst index WAKE 4.6% nonREM 11.1% REM 6.1%; Kruskal-Wallis p=1.28e-40; REM vs WAKE rank-sum p=0.00189, Dunn z=3.22 p=0.00129; cells with a value [834, 838, 820]
000041 round 1 grid reading a (ISIs within one second only), for comparison: WAKE 5.1% nonREM 14.3% REM 6.7% == crcns-fcx-1 reading a: median burst index WAKE 2.4% nonREM 6.3% REM 3.6%; Kruskal-Wallis p=3.41e-46; REM vs WAKE rank-sum p=2.44e-06, Dunn z=4.84 p=1.31e-06; cells with a value [988, 994, 948]
== crcns-fcx-1 reading b: median burst index WAKE 2.2% nonREM 6.0% REM 3.0%; Kruskal-Wallis p=4.82e-62; REM vs WAKE rank-sum p=1.41e-05, Dunn z=4.47 p=7.7e-06; cells with a value [982, 991, 941]
== crcns-fcx-1 reading c: median burst index WAKE 4.6% nonREM 11.5% REM 6.5%; Kruskal-Wallis p=4.88e-48; REM vs WAKE rank-sum p=6.54e-06, Dunn z=4.57 p=4.85e-06; cells with a value [988, 994, 948]
crcns-fcx-1 round 1 grid reading a (ISIs within one second only), for comparison: WAKE 5.2% nonREM 14.3% REM 6.7%
Result: partially reproduced. ISIs are now counted from spike times. On both datasets and every reading nonREM > REM > WAKE, the Kruskal-Wallis p is below 1e-37 and REM exceeds WAKE (CRCNS Dunn p = 1.3e-6, 7.7e-6 and 4.9e-6 under readings a, b and c). No reading puts the three medians within tolerance: CRCNS (a) 2.4/6.3/3.6%, (b) 2.2/6.0/3.0%, (c) 4.6/11.5/6.5% (WAKE/nonREM/REM, against 4.0/11.8/5.5); reading c has nonREM within tolerance and WAKE and REM above it. Round 1's grid, which kept only ISIs within one second, gave 5.2/14.3/6.7% on CRCNS, so it inflated the index.
fig2c-acg-peaks¶
The average spike autocorrelogram of pE cells peaks near 8 ms in nonREM, with smaller peaks near 125 ms (theta) in REM and WAKE.
Source: Results, Assessment of firing patterns in different brain states, paragraph 3; Figure 2C and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
MAXLAG = 0.5
def acg_cells(s, pieces, cells, maxlag=MAXLAG):
"""Autocorrelogram counts in 1 ms bins to maxlag, spike pairs within the same interval: bins
[k, k+1) ms, and bins centred on whole ms, [k-0.5, k+0.5) (the convention of CCG-type code)."""
pieces = np.asarray(pieces).reshape(-1, 2)
nb = int(round(maxlag * 1000))
out = np.zeros((len(cells), nb)); outc = np.zeros((len(cells), nb))
if len(pieces) == 0:
return out, outc
for j, i in enumerate(cells):
t = s["spikes"][i]
iv = np.searchsorted(pieces[:, 0], t, "right") - 1
ok = (iv >= 0) & (t < pieces[np.maximum(iv, 0), 1])
t, iv = t[ok], iv[ok]
for k in range(1, 400):
if k >= len(t): break
d = t[k:] - t[:-k]; same = iv[k:] == iv[:-k]
m = same & (d < maxlag)
if not m.any() and (d >= maxlag).all(): break
np.add.at(out[j], np.minimum((d[m] * 1000).astype(int), nb - 1), 1)
np.add.at(outc[j], np.minimum(np.rint(d[m] * 1000).astype(int), nb - 1), 1)
return out, outc
ACG, ACGC = {}, {}
for ds in DS:
for st in STATES:
R_ = [acg_cells(s, W.state_pieces(s, st), s["E"]) for s in D[ds] if s["cycles"]]
ACG[ds, st] = np.concatenate([a for a, _ in R_]); ACGC[ds, st] = np.concatenate([b for _, b in R_])
for st in STATES:
A = ACG[ds, st][:, :300]
ok = A.max(1) > 0
mean = (A[ok] / A[ok].max(1, keepdims=True)).mean(0)
lag = np.arange(300) + 0.5
pk = int(np.argmax(mean))
loc = [i for i in range(60, 250) if mean[i] >= mean[i - 1] and mean[i] >= mean[i + 1]]
loc_best = max(loc, key=lambda i: mean[i]) if loc else None
sm = np.convolve(mean, np.ones(9) / 9, "same")
loc_s = [i for i in range(60, 250) if sm[i] >= sm[i - 1] and sm[i] >= sm[i + 1]]
lb = max(loc_s, key=lambda i: sm[i]) if loc_s else None
pr(f"== {ds} {st}: cells {ok.sum()}, peak of mean ACG at {lag[pk]:.1f} ms; largest local max 60-250 ms at "
f"{'none' if loc_best is None else lag[loc_best]} ms (9 ms smoothed: {'none' if lb is None else lag[lb]} ms, "
f"height {sm[lb] if lb else np.nan:.3f} against {sm[60:250].min():.3f} minimum in the window)")
for st in STATES:
A = ACGC[ds, st][:, :300]; ok = A.max(1) > 0
mean = (A[ok] / A[ok].max(1, keepdims=True)).mean(0); mean[0] = 0 # bin 0 holds only half a bin
pk = int(np.argmax(mean))
loc = [i for i in range(60, 250) if mean[i] >= mean[i - 1] and mean[i] >= mean[i + 1]]
lb = max(loc, key=lambda i: mean[i]) if loc else None
pr(f" {ds} {st}, bins centred on whole ms: peak of mean ACG at {pk} ms (values at 7-11 ms: "
f"{', '.join(f'{mean[i]:.3f}' for i in range(7, 12))}); largest local max 60-250 ms at {lb} ms")
== 000041 wake: cells 820, peak of mean ACG at 16.5 ms; largest local max 60-250 ms at 134.5 ms (9 ms smoothed: 119.5 ms, height 0.344 against 0.288 minimum in the window) == 000041 nrem: cells 823, peak of mean ACG at 9.5 ms; largest local max 60-250 ms at 64.5 ms (9 ms smoothed: 80.5 ms, height 0.209 against 0.137 minimum in the window) == 000041 rem: cells 791, peak of mean ACG at 12.5 ms; largest local max 60-250 ms at 113.5 ms (9 ms smoothed: 124.5 ms, height 0.240 against 0.196 minimum in the window) 000041 wake, bins centred on whole ms: peak of mean ACG at 14 ms (values at 7-11 ms: 0.291, 0.310, 0.314, 0.350, 0.363); largest local max 60-250 ms at 99 ms 000041 nrem, bins centred on whole ms: peak of mean ACG at 10 ms (values at 7-11 ms: 0.489, 0.511, 0.502, 0.537, 0.523); largest local max 60-250 ms at 62 ms 000041 rem, bins centred on whole ms: peak of mean ACG at 14 ms (values at 7-11 ms: 0.236, 0.262, 0.278, 0.301, 0.302); largest local max 60-250 ms at 113 ms
== crcns-fcx-1 wake: cells 964, peak of mean ACG at 14.5 ms; largest local max 60-250 ms at 134.5 ms (9 ms smoothed: 125.5 ms, height 0.342 against 0.285 minimum in the window) == crcns-fcx-1 nrem: cells 972, peak of mean ACG at 9.5 ms; largest local max 60-250 ms at 61.5 ms (9 ms smoothed: 64.5 ms, height 0.218 against 0.133 minimum in the window) == crcns-fcx-1 rem: cells 918, peak of mean ACG at 13.5 ms; largest local max 60-250 ms at 113.5 ms (9 ms smoothed: 109.5 ms, height 0.248 against 0.200 minimum in the window) crcns-fcx-1 wake, bins centred on whole ms: peak of mean ACG at 14 ms (values at 7-11 ms: 0.276, 0.301, 0.308, 0.335, 0.337); largest local max 60-250 ms at 99 ms crcns-fcx-1 nrem, bins centred on whole ms: peak of mean ACG at 10 ms (values at 7-11 ms: 0.482, 0.504, 0.497, 0.530, 0.515); largest local max 60-250 ms at 62 ms crcns-fcx-1 rem, bins centred on whole ms: peak of mean ACG at 12 ms (values at 7-11 ms: 0.246, 0.268, 0.285, 0.314, 0.312); largest local max 60-250 ms at 114 ms
Result: partially reproduced. The mean normalized autocorrelogram of pE cells in nonREM peaks in the bin [9, 10) ms on both datasets, whose centre, 9.5 ms, is outside 8 +- 0.8 ms; with bins centred on whole milliseconds the peak is at 10 ms on both. Only labelling the bin by its start (9 ms) puts it inside. The largest local maximum between 60 and 250 ms is at 113.5 ms in REM and 134.5 ms in WAKE on both, within 125 +- 12.5 ms; with bins centred on whole ms it is at 114 ms in REM and 99 ms in WAKE on CRCNS (113 and 99 ms on DANDI). Taking the bin centre, the theta part holds and the nonREM part does not.
fig2c-acg-decay¶
The autocorrelogram of pE cells decays faster in nonREM than in WAKE and REM (decay fit exponent medians -1.35, -0.83 and -0.80).
Source: Results, Assessment of firing patterns in different brain states, paragraph 3; Figure 2C. The criterion and its readings are in the claims file; the code below runs each reading it names.
def decay(A, reading):
out = []
for a in A:
if a.max() <= 0: out.append(np.nan); continue
a = a / a.max(); pk = int(np.argmax(a))
end = 100 if reading == "a" else 500
lag = (np.arange(len(a)) + 0.5)
sl = slice(pk, end)
y, x = a[sl], lag[sl]; ok = y > 0
if ok.sum() < 5: out.append(np.nan); continue
if reading in ("a", "b"):
out.append(np.polyfit(np.log(x[ok]), np.log(y[ok]), 1)[0])
else:
out.append(np.polyfit(x[ok] / 1000, np.log(y[ok]), 1)[0])
return np.array(out)
for ds in DS:
for r in "abc":
ex = [decay(ACG[ds, st], r) for st in STATES]
cols = [e[np.isfinite(e)] for e in ex]
kw = stats.kruskal(*cols)
pr(f"== {ds} reading {r}: median exponent WAKE {np.median(cols[0]):.2f} nonREM {np.median(cols[1]):.2f} REM {np.median(cols[2]):.2f} "
f"(n {[len(c) for c in cols]}); Kruskal-Wallis p={fmt(kw.pvalue)}")
== 000041 reading a: median exponent WAKE -0.38 nonREM -0.58 REM -0.33 (n [489, 715, 487]); Kruskal-Wallis p=3.16e-25
== 000041 reading b: median exponent WAKE -0.17 nonREM -0.33 REM -0.14 (n [795, 802, 758]); Kruskal-Wallis p=4.33e-56
== 000041 reading c: median exponent WAKE -0.64 nonREM -1.54 REM -0.60 (n [795, 802, 758]); Kruskal-Wallis p=5.61e-64 == crcns-fcx-1 reading a: median exponent WAKE -0.37 nonREM -0.58 REM -0.34 (n [575, 862, 555]); Kruskal-Wallis p=9.53e-31
== crcns-fcx-1 reading b: median exponent WAKE -0.19 nonREM -0.33 REM -0.14 (n [936, 954, 879]); Kruskal-Wallis p=2.09e-62
== crcns-fcx-1 reading c: median exponent WAKE -0.67 nonREM -1.52 REM -0.58 (n [936, 954, 879]); Kruskal-Wallis p=3.82e-73
Result: partially reproduced. Under every reading the nonREM exponent is the most negative and Kruskal-Wallis p < 1e-24 on both datasets. The medians do not match under any reading: the exponential fit (c) gives -0.67, -1.52 and -0.58 on CRCNS (WAKE, nonREM, REM; -0.83, -1.35, -0.80 expected), the power laws (a, b) give -0.37/-0.58/-0.34 and -0.19/-0.33/-0.14.
synchrony-skew¶
Population synchrony (fraction of pE cells firing in 50 ms windows) has a skewed distribution; more than 15% of pE cells rarely fire synchronously with others (in 4% of windows) while fewer than 4.2% fire synchronously in at least half of the windows.
Source: Results, Assessment of firing patterns in different brain states, paragraph 4; Figure S2F. The criterion and its readings are in the claims file; the code below runs each reading it names.
def sync_session(s, pieces):
E = s["E"]
if len(E) < 2 or len(np.asarray(pieces).reshape(-1, 2)) == 0: return None
k25 = []
for a, b in np.asarray(pieces).reshape(-1, 2):
k25.append(np.arange(int(np.ceil(a / 0.025)), int(b / 0.025) - 1))
k25 = np.concatenate(k25)
T = int(k25.max()) + 3
act = np.zeros((len(E), T), bool)
for j, i in enumerate(E):
b = (s["spikes"][i] / 0.025).astype(int); act[j, b[b < T]] = True
win = act[:, k25] | act[:, k25 + 1] # 50 ms windows every 25 ms
n = win.sum(0)
fa = (win & (n >= 2)[None, :]).mean(1) # fires with at least one other pE cell
fb = win.mean(1)
return fa, fb
for ds in DS:
for nm, sel in [("all cycle time", None), ("wake", "wake"), ("nrem", "nrem"), ("rem", "rem")]:
FA, FB = [], []
for s in D[ds]:
if not s["cycles"]: continue
p = np.array([c["wake"][0:1].tolist() + [c["sleep"][1]] for c in s["cycles"]]) if sel is None else W.state_pieces(s, sel)
r = sync_session(s, p)
if r is None: continue
FA.append(r[0]); FB.append(r[1])
FA, FB = np.concatenate(FA), np.concatenate(FB)
pr(f"== {ds} {nm}: n={len(FA)}; (a) with another pE cell: <=4% of windows {100*np.mean(FA<=0.04):.1f}%, >=50% {100*np.mean(FA>=0.5):.1f}%; "
f"(b) any spike: <=4% {100*np.mean(FB<=0.04):.1f}%, >=50% {100*np.mean(FB>=0.5):.1f}%; skew (a) {stats.skew(FA):.2f}")
== 000041 all cycle time: n=839; (a) with another pE cell: <=4% of windows 64.7%, >=50% 0.0%; (b) any spike: <=4% 56.4%, >=50% 0.0%; skew (a) 2.25
== 000041 wake: n=839; (a) with another pE cell: <=4% of windows 61.3%, >=50% 0.0%; (b) any spike: <=4% 56.9%, >=50% 0.0%; skew (a) 2.59
== 000041 nrem: n=839; (a) with another pE cell: <=4% of windows 71.6%, >=50% 0.0%; (b) any spike: <=4% 64.6%, >=50% 0.0%; skew (a) 1.84
== 000041 rem: n=839; (a) with another pE cell: <=4% of windows 59.4%, >=50% 0.2%; (b) any spike: <=4% 52.3%, >=50% 0.2%; skew (a) 3.20
== crcns-fcx-1 all cycle time: n=995; (a) with another pE cell: <=4% of windows 62.9%, >=50% 0.0%; (b) any spike: <=4% 54.3%, >=50% 0.0%; skew (a) 2.31
== crcns-fcx-1 wake: n=995; (a) with another pE cell: <=4% of windows 58.7%, >=50% 0.0%; (b) any spike: <=4% 53.8%, >=50% 0.1%; skew (a) 2.60
== crcns-fcx-1 nrem: n=995; (a) with another pE cell: <=4% of windows 70.6%, >=50% 0.0%; (b) any spike: <=4% 62.0%, >=50% 0.0%; skew (a) 1.92
== crcns-fcx-1 rem: n=958; (a) with another pE cell: <=4% of windows 55.5%, >=50% 0.0%; (b) any spike: <=4% 47.2%, >=50% 0.0%; skew (a) 2.29
Result: reproduced. Over all cycle time, 62.9% (CRCNS) and 64.7% (DANDI) of pE cells fire with another pE cell in at most 4% of the 50 ms windows, and 0.0% in at least half; the per-cell measure is right-skewed (2.31 and 2.25). Both are beyond the paper's bounds in the stated direction, as the criterion asks, under readings a and b and in each state; the share of rarely synchronous cells is four times the paper's 15%, so the measure is unlikely to be the paper's (a question to a reader is filed).
updown-durations¶
DOWN state durations are skewed with a median of 0.19 s and UP state durations with a median of 0.47 s.
Source: Results, Assessment of firing patterns in different brain states, paragraph 4; Figure S4A; Table S1. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
ss = D[ds]
up = np.concatenate([np.asarray(s.get("up", np.zeros((0, 2)))).reshape(-1, 2) for s in ss])
dn = np.concatenate([np.asarray(s.get("dn", np.zeros((0, 2)))).reshape(-1, 2) for s in ss])
du, dd = up[:, 1] - up[:, 0], dn[:, 1] - dn[:, 0]
inc = lambda v: sum(((v[:, 0] >= c["sleep"][0]) & (v[:, 1] <= c["sleep"][1])).sum() for c in [])
upc = sum(((np.asarray(s['up']).reshape(-1,2)[:, 0][:, None] >= np.array([c['sleep'][0] for c in s['cycles']])[None]) &
(np.asarray(s['up']).reshape(-1,2)[:, 0][:, None] <= np.array([c['sleep'][1] for c in s['cycles']])[None])).any(1).sum() for s in ss if s['cycles'] and len(s.get('up', [])))
pr(f"== {ds} ({'deposited _UPDOWNINtervals, reading a' if ds!='000041' else 'detected here, reading b'}): UP n={len(du)} median {np.median(du):.3f} s "
f"skew {stats.skew(du):.2f}; DOWN n={len(dd)} median {np.median(dd):.3f} s skew {stats.skew(dd):.2f}; UP states in SLEEP of cycles {upc}; "
f"DOWN range {dd.min():.3f}-{dd.max():.3f} s, UP range {du.min():.3f}-{du.max():.3f} s")
== 000041 (detected here, reading b): UP n=59450 median 0.471 s skew 2.58; DOWN n=113340 median 0.193 s skew 3.37; UP states in SLEEP of cycles 33051; DOWN range 0.075-3.757 s, UP range 0.200-3.997 s == crcns-fcx-1 (deposited _UPDOWNINtervals, reading a): UP n=43230 median 0.473 s skew 2.56; DOWN n=86839 median 0.188 s skew 2.15; UP states in SLEEP of cycles 43230; DOWN range 0.076-1.247 s, UP range 0.201-3.998 s
Result: reproduced. CRCNS, deposited detections (reading a): 43230 UP and 86839 DOWN states, medians 0.473 s and 0.188 s, both right-skewed (2.56 and 2.15): Table S1 exactly. DANDI, new detection (reading b): medians 0.471 s and 0.193 s, skewness 2.58 and 3.37, within tolerance; the counts (59450 and 113340) are outside it.
fig1e-up-state-dynamics¶
Within UP states, firing rates of pyramidal cells and interneurons decrease over the course of the UP state, with decreasing E/(E+I) ratio and decreasing pE population synchrony; UP states begin with a surge of gamma power followed by increased sigma power.
Source: Results, Assessment of firing patterns in different brain states, paragraph 4; Figure 1E and legend; Figure S4C. The criterion and its readings are in the claims file; the code below runs each reading it names.
NB = 10
def up_bins(s, ups):
"""Per UP state and normalized-time bin: pE rate, pI rate, fraction of pE and of pI cells spiking."""
E, I = s["E"], s["I"]
edges = ups[:, :1] + (ups[:, 1:] - ups[:, :1]) * np.linspace(0, 1, NB + 1)[None, :]
dur = (ups[:, 1] - ups[:, 0]) / NB
def cnts(cells):
C = np.zeros((len(cells), len(ups), NB))
for j, i in enumerate(cells):
t = s["spikes"][i]
for b in range(NB):
C[j, :, b] = np.searchsorted(t, edges[:, b + 1]) - np.searchsorted(t, edges[:, b])
return C
CE = cnts(E); CI = cnts(I) if len(I) else None
rE = CE.sum(0) / len(E) / dur[:, None]
fE = (CE > 0).mean(0)
rI = CI.sum(0) / len(I) / dur[:, None] if CI is not None else None
fI = (CI > 0).mean(0) if CI is not None else None
return rE, rI, fE, fI
for ds in DS:
RE, RI, FE, EI = [], [], [], []
for s in D[ds]:
if not s["cycles"] or len(s["E"]) < 2: continue
up = np.asarray(s.get("up", np.zeros((0, 2)))).reshape(-1, 2)
sl = np.array([c["sleep"] for c in s["cycles"]])
up = up[((up[:, 0][:, None] >= sl[:, 0]) & (up[:, 1][:, None] <= sl[:, 1])).any(1)]
if len(up) == 0: continue
rE, rI, fE, fI = up_bins(s, up)
RE.append(rE); FE.append(fE)
if rI is not None:
RI.append(rI); EI.append(fE / np.where(fE + fI > 0, fE + fI, np.nan))
out = {}
for nm, X in [("pE rate", RE), ("pI rate", RI), ("pE synchrony", FE), ("E/(E+I)", EI)]:
m = np.nanmean(np.concatenate(X), 0)
R, p = stats.pearsonr(np.arange(NB), m)
out[nm] = (R, p, m[0], m[-1])
pr(f"== {ds} {nm}: R={R:.3f} p={fmt(p)}, first bin {m[0]:.3f}, last bin {m[-1]:.3f}, bins {np.round(m, 3).tolist()}")
# UP-onset-triggered sigma and gamma power (short windows, 100 ms steps), UP states >= 1 s
trig = {"sigma": [], "gamma": []}
lags = np.arange(-5, 16)
for s in D[ds]:
if "short" not in s or not s["cycles"]: continue
ts = s["short_t"]; pk = np.concatenate([c["packets"] for c in s["cycles"]])
inn = np.zeros(len(ts), bool)
for a, b in pk: inn |= (ts >= a) & (ts < b)
up = np.asarray(s.get("up", np.zeros((0, 2)))).reshape(-1, 2)
up = up[(up[:, 1] - up[:, 0]) >= 1.0]
for band in trig:
v = np.log(s["short"][band] + 1e-12); v = (v - v[inn].mean()) / v[inn].std()
j = np.round((up[:, 0] - 0.1) / 0.1).astype(int)
ok = (j + lags.min() >= 0) & (j + lags.max() < len(v))
if ok.any(): trig[band].append(v[j[ok][:, None] + lags[None, :]])
if trig["sigma"]:
mg = np.concatenate(trig["gamma"]).mean(0); ms = np.concatenate(trig["sigma"]).mean(0)
post = lags >= 0
pg = lags[post][np.argmax(mg[post])] * 0.1; ps = lags[post][np.argmax(ms[post])] * 0.1
pr(f" UP-onset-triggered (UP >= 1 s, n={len(np.concatenate(trig['sigma']))}): gamma peak at {pg:.1f} s, sigma peak at {ps:.1f} s after onset; "
f"gamma z {np.round(mg, 2).tolist()}; sigma z {np.round(ms, 2).tolist()} (lags -0.5 to 1.5 s)")
== 000041 pE rate: R=-0.719 p=0.019, first bin 1.806, last bin 1.117, bins [1.806, 1.301, 1.315, 1.322, 1.315, 1.301, 1.284, 1.268, 1.236, 1.117] == 000041 pI rate: R=-0.971 p=2.94e-06, first bin 14.691, last bin 8.420, bins [14.691, 13.949, 13.812, 13.474, 12.751, 12.23, 11.604, 11.014, 10.367, 8.42] == 000041 pE synchrony: R=-0.794 p=0.0061, first bin 0.078, last bin 0.055, bins [0.078, 0.063, 0.064, 0.064, 0.063, 0.062, 0.062, 0.061, 0.06, 0.055] == 000041 E/(E+I): R=0.375 p=0.285, first bin 0.382, last bin 0.384, bins [0.382, 0.301, 0.294, 0.299, 0.31, 0.316, 0.325, 0.338, 0.351, 0.384] UP-onset-triggered (UP >= 1 s, n=7492): gamma peak at 0.1 s, sigma peak at 0.0 s after onset; gamma z [-0.05000000074505806, -0.07999999821186066, -0.20999999344348907, -0.5699999928474426, -0.9800000190734863, -0.009999999776482582, 0.3700000047683716, 0.3499999940395355, 0.30000001192092896, 0.2800000011920929, 0.23999999463558197, 0.25, 0.2199999988079071, 0.23000000417232513, 0.18000000715255737, 0.14000000059604645, -0.029999999329447746, -0.07999999821186066, -0.10000000149011612, -0.07999999821186066, -0.07999999821186066]; sigma z [-0.1899999976158142, -0.20000000298023224, -0.15000000596046448, 0.0, 0.05000000074505806, 0.800000011920929, 0.30000001192092896, 0.15000000596046448, 0.1899999976158142, 0.20000000298023224, 0.14000000059604645, 0.09000000357627869, 0.029999999329447746, 0.009999999776482582, -0.05999999865889549, -0.05999999865889549, -0.03999999910593033, -0.03999999910593033, -0.019999999552965164, -0.03999999910593033, -0.029999999329447746] (lags -0.5 to 1.5 s)
== crcns-fcx-1 pE rate: R=-0.293 p=0.411, first bin 1.823, last bin 1.619, bins [1.823, 1.359, 1.396, 1.4, 1.389, 1.381, 1.366, 1.348, 1.31, 1.619] == crcns-fcx-1 pI rate: R=-0.983 p=3.63e-07, first bin 15.881, last bin 11.631, bins [15.881, 15.267, 15.041, 14.758, 14.045, 13.527, 12.734, 12.048, 11.155, 11.631] == crcns-fcx-1 pE synchrony: R=-0.447 p=0.196, first bin 0.079, last bin 0.071, bins [0.079, 0.066, 0.067, 0.067, 0.066, 0.066, 0.065, 0.064, 0.063, 0.071] == crcns-fcx-1 E/(E+I): R=0.470 p=0.17, first bin 0.373, last bin 0.396, bins [0.373, 0.294, 0.292, 0.295, 0.303, 0.311, 0.325, 0.337, 0.351, 0.396] UP-onset-triggered (UP >= 1 s, n=5201): gamma peak at 0.1 s, sigma peak at 0.0 s after onset; gamma z [0.10000000149011612, 0.07000000029802322, -0.05000000074505806, -0.4300000071525574, -0.9599999785423279, 0.019999999552965164, 0.4099999964237213, 0.3799999952316284, 0.38999998569488525, 0.33000001311302185, 0.3100000023841858, 0.3199999928474426, 0.28999999165534973, 0.30000001192092896, 0.28999999165534973, 0.25, 0.07000000029802322, 0.009999999776482582, -0.019999999552965164, -0.019999999552965164, 0.009999999776482582]; sigma z [-0.1599999964237213, -0.17000000178813934, -0.17000000178813934, -0.029999999329447746, 0.09000000357627869, 0.7799999713897705, 0.1899999976158142, 0.05000000074505806, 0.09000000357627869, 0.09000000357627869, 0.03999999910593033, 0.009999999776482582, -0.05000000074505806, -0.10000000149011612, -0.14000000059604645, -0.15000000596046448, -0.07999999821186066, -0.05999999865889549, -0.05999999865889549, -0.07000000029802322, -0.05000000074505806] (lags -0.5 to 1.5 s)
Result: partially reproduced. On CRCNS, across 10 bins of normalized UP time, the pI rate (R = -0.983), the pE rate (R = -0.293) and pE synchrony (R = -0.447) have negative R and are lower in the last bin than in the first; E/(E+I) has positive R (0.470). In the UP-onset-triggered power (UP states of at least 1 s), sigma peaks in the 0.0 s window and gamma in the 0.1 s window, so gamma does not precede sigma at this resolution. Three of four measures decrease. DANDI gives the same pattern (R = -0.971, -0.719, -0.794 and +0.375).
fig2de-fast-before-slow¶
In the early UP state pE cells fire in sequences stable across the first and second halves of SLEEP, and a cell's onset latency is negatively correlated with its firing rate.
Source: Results, Assessment of firing patterns in different brain states, paragraph 5; Figure 2D and 2E and legends. The criterion and its readings are in the claims file; the code below runs each reading it names.
def first_latency(s, ups, cells, win=0.2):
L = np.full((len(cells), len(ups)), np.nan)
for j, i in enumerate(cells):
t = s["spikes"][i]
k = np.searchsorted(t, ups[:, 0])
ok = k < len(t)
lat = np.full(len(ups), np.nan); lat[ok] = t[k[ok]] - ups[ok, 0]
lat[(lat > win) | (lat > (ups[:, 1] - ups[:, 0]))] = np.nan
L[j] = lat
return L
for ds in DS:
for half in ["a", "b"]:
X1, X2, RW, RN = [], [], [], []
for s in D[ds]:
if not s["cycles"] or len(s["E"]) < 3: continue
up = np.asarray(s.get("up", np.zeros((0, 2)))).reshape(-1, 2)
if len(up) < 20: continue
if half == "a":
m1 = np.zeros(len(up), bool); m2 = m1.copy()
for c in s["cycles"]:
mid = (c["sleep"][0] + c["sleep"][1]) / 2
m1 |= (up[:, 0] >= c["sleep"][0]) & (up[:, 0] < mid); m2 |= (up[:, 0] >= mid) & (up[:, 0] < c["sleep"][1])
else:
mid = (up[0, 0] + up[-1, 1]) / 2; m1 = up[:, 0] < mid; m2 = ~m1
L = first_latency(s, up, s["E"])
X1.append(np.nanmean(L[:, m1], 1)); X2.append(np.nanmean(L[:, m2], 1))
RW.append(W.wake_rate(s, s["E"])); RN.append(W.cell_rates(s, W.state_pieces(s, "nrem"), s["E"])[0])
X1, X2, RW, RN = map(np.concatenate, (X1, X2, RW, RN))
ok = np.isfinite(X1) & np.isfinite(X2)
r12 = stats.pearsonr(X1[ok], X2[ok])
lat = np.nanmean(np.c_[X1, X2], 1)
res = []
for nm, rr in [("WAKE", RW), ("nonREM", RN)]:
k = np.isfinite(lat) & (rr > 0)
res.append((nm, stats.pearsonr(np.log10(rr[k]), lat[k])))
pr(f"== {ds} halves {half}: first vs second half latency R={r12[0]:.3f} p={fmt(r12[1])} n={ok.sum()}; latency vs log10 rate: "
+ "; ".join(f"{nm} R={r[0]:.3f} p={fmt(r[1])}" for nm, r in res))
== 000041 halves a: first vs second half latency R=0.597 p=3.58e-74 n=756; latency vs log10 rate: WAKE R=-0.081 p=0.0252; nonREM R=-0.199 p=2.29e-08
== 000041 halves b: first vs second half latency R=0.681 p=1.47e-104 n=758; latency vs log10 rate: WAKE R=-0.073 p=0.0422; nonREM R=-0.188 p=1.23e-07 == crcns-fcx-1 halves a: first vs second half latency R=0.616 p=1.2e-102 n=973; latency vs log10 rate: WAKE R=-0.129 p=4.83e-05; nonREM R=-0.226 p=6.04e-13
== crcns-fcx-1 halves b: first vs second half latency R=0.559 p=5.63e-81 n=972; latency vs log10 rate: WAKE R=-0.130 p=4.24e-05; nonREM R=-0.229 p=2.95e-13
Result: reproduced. Per-cell first-spike latencies in the first and second halves of SLEEP correlate (CRCNS R = 0.616, reading a; 0.559 with session halves), and latency correlates negatively with log10 rate (WAKE rate R = -0.129, nonREM rate R = -0.226, both p < 1e-4). DANDI agrees (R = 0.597, -0.081, -0.199).
fig2f-rate-group-correlations¶
In nonREM, pairwise spike-count correlations depend on firing rate group; pairs within the fastest group and within the slowest group are positively correlated, fast-firing pairs most highly, and fast and slow cells are negatively correlated with each other.
Source: Results, Assessment of firing patterns in different brain states, paragraph 5; Figure 2F and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
def pair_corrs(s, cells, pieces, bin_=0.1):
pieces = np.asarray(pieces).reshape(-1, 2)
edges = np.concatenate([np.arange(a, b - bin_ / 2, bin_) for a, b in pieces]) if len(pieces) else np.zeros(0)
if len(edges) < 10: return None
C = np.zeros((len(cells), len(edges)))
for j, i in enumerate(cells):
t = s["spikes"][i]
C[j] = np.searchsorted(t, edges + bin_) - np.searchsorted(t, edges)
with np.errstate(invalid="ignore", divide="ignore"):
R = np.corrcoef(C)
return R
for ds in DS:
for rd in ["wake sextiles", "nonREM-rate sextiles"]:
if rd == "wake sextiles":
W.sextiles(D[ds]); grp = [s["sextile"] for s in D[ds]]
else:
rn = [W.cell_rates(s, W.state_pieces(s, "nrem"), s["E"])[0] if s["cycles"] else np.full(len(s["E"]), np.nan) for s in D[ds]]
flat = np.concatenate(rn); ok = np.isfinite(flat); rk = np.full(len(flat), -1)
o = np.argsort(flat[ok], kind="stable"); q = np.zeros(ok.sum(), int); q[o] = (np.arange(ok.sum()) * 6) // ok.sum(); rk[ok] = q
grp, i0 = [], 0
for r in rn: grp.append(rk[i0:i0 + len(r)]); i0 += len(r)
M = {(a, b): [] for a in range(6) for b in range(a, 6)}
for s, g in zip(D[ds], grp):
if not s["cycles"] or len(s["E"]) < 2: continue
R = pair_corrs(s, s["E"], W.state_pieces(s, "nrem"))
if R is None: continue
n = len(s["E"])
for i in range(n):
for j in range(i + 1, n):
if g[i] < 0 or g[j] < 0 or not np.isfinite(R[i, j]): continue
a, b = sorted((g[i], g[j])); M[a, b].append(R[i, j])
mean = {k: np.mean(v) if v else np.nan for k, v in M.items()}
pv = {k: stats.wilcoxon(v).pvalue if len(v) > 5 else np.nan for k, v in M.items()}
top = max(mean, key=lambda k: mean[k])
pr(f"== {ds} {rd}: fastest-fastest {mean[5,5]:.4f} (p={fmt(pv[5,5])}, n={len(M[5,5])}), fastest-slowest {mean[0,5]:.4f} (p={fmt(pv[0,5])}, n={len(M[0,5])}), "
f"slowest-slowest {mean[0,0]:.4f} (p={fmt(pv[0,0])}, n={len(M[0,0])}); largest mean at groups {top}")
pr(" matrix (rows/cols lowest to highest):", np.array([[mean[tuple(sorted((a, b)))] for b in range(6)] for a in range(6)]).round(4).tolist())
== 000041 wake sextiles: fastest-fastest 0.0323 (p=3.9e-77, n=840), fastest-slowest 0.0049 (p=1.28e-08, n=876), slowest-slowest 0.0072 (p=2.09e-22, n=698); largest mean at groups (5, 5) matrix (rows/cols lowest to highest): [[0.0072, 0.0075, 0.0069, 0.0069, 0.0069, 0.0049], [0.0075, 0.0103, 0.0129, 0.0118, 0.012, 0.0118], [0.0069, 0.0129, 0.0148, 0.0142, 0.015, 0.0168], [0.0069, 0.0118, 0.0142, 0.019, 0.0186, 0.0183], [0.0069, 0.012, 0.015, 0.0186, 0.0215, 0.0218], [0.0049, 0.0118, 0.0168, 0.0183, 0.0218, 0.0323]]
== 000041 nonREM-rate sextiles: fastest-fastest 0.0290 (p=8.68e-69, n=866), fastest-slowest 0.0077 (p=8.76e-59, n=1137), slowest-slowest 0.0040 (p=4.92e-20, n=838); largest mean at groups (5, 5) matrix (rows/cols lowest to highest): [[0.004, 0.0079, 0.0072, 0.0067, 0.0084, 0.0077], [0.0079, 0.0145, 0.0112, 0.0124, 0.0118, 0.0121], [0.0072, 0.0112, 0.0161, 0.0155, 0.0146, 0.0146], [0.0067, 0.0124, 0.0155, 0.018, 0.0193, 0.0195], [0.0084, 0.0118, 0.0146, 0.0193, 0.0231, 0.0242], [0.0077, 0.0121, 0.0146, 0.0195, 0.0242, 0.029]]
== crcns-fcx-1 wake sextiles: fastest-fastest 0.0329 (p=2.2e-70, n=811), fastest-slowest 0.0064 (p=1.66e-12, n=1035), slowest-slowest 0.0063 (p=1.21e-20, n=816); largest mean at groups (5, 5) matrix (rows/cols lowest to highest): [[0.0063, 0.008, 0.0068, 0.0086, 0.0086, 0.0064], [0.008, 0.0114, 0.0133, 0.014, 0.0149, 0.0147], [0.0068, 0.0133, 0.0135, 0.0161, 0.0172, 0.0192], [0.0086, 0.014, 0.0161, 0.02, 0.0206, 0.02], [0.0086, 0.0149, 0.0172, 0.0206, 0.0237, 0.027], [0.0064, 0.0147, 0.0192, 0.02, 0.027, 0.0329]]
== crcns-fcx-1 nonREM-rate sextiles: fastest-fastest 0.0313 (p=1.66e-69, n=808), fastest-slowest 0.0093 (p=7.15e-72, n=1111), slowest-slowest 0.0042 (p=1.48e-28, n=1076); largest mean at groups (5, 5) matrix (rows/cols lowest to highest): [[0.0042, 0.0084, 0.0071, 0.0077, 0.0093, 0.0093], [0.0084, 0.0167, 0.012, 0.0146, 0.0132, 0.0154], [0.0071, 0.012, 0.0149, 0.0162, 0.0161, 0.0201], [0.0077, 0.0146, 0.0162, 0.0192, 0.021, 0.0227], [0.0093, 0.0132, 0.0161, 0.021, 0.0235, 0.0268], [0.0093, 0.0154, 0.0201, 0.0227, 0.0268, 0.0313]]
Result: not reproduced. Fastest-fastest pairs have the largest mean correlation of the 21 group pairs (0.0329 CRCNS, 0.0323 DANDI) and slowest-slowest pairs are positive (0.0063, 0.0072), but fastest-slowest pairs are positive too (0.0064, p = 1.7e-12, on CRCNS; 0.0049 on DANDI), not negative; the same with nonREM-rate groups.
fig3ab-population-rate-declines¶
The mean population firing rate of pE cells declines over SLEEP (nonREM time only).
Source: Results, Firing pattern and LFP changes across the course of sleep, paragraph 1; Figure 3A and 3B and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
def pop_rate(s, sub):
r, n = W.cell_rates(s, sub, s["E"])
return np.nanmean(r) if n else None
for ds in DS:
pr(f"== {ds}:", rp(W.norm_corr([s for s in D[ds] if len(s['E'])], "sleep", pop_rate)))
out = []
for rt in sorted(set(s["rat"] for s in D[ds])):
ss = [s for s in D[ds] if s["rat"] == rt and len(s["E"]) and s["cycles"]]
if ss:
v = W.norm_corr(ss, "sleep", pop_rate, readings=("a",))["a"]; out.append(f"{rt} R={fmt(v[0])} p={fmt(v[1])} n={v[2]}")
pr(" by rat, per packet (reading a): " + "; ".join(out))
== 000041: a: R=-0.178, p=0.000114, n=466; b: R=-0.146, p=7.27e-45, n=9167; c: R=-0.652, p=2.95e-07, n=50 by rat, per packet (reading a): BWRat17 R=-0.834 p=1.95e-08 n=29; BWRat18 R=-0.38 p=0.12 n=18; BWRat19 R=-0.746 p=0.00058 n=17; BWRat20 R=-0.194 p=0.165 n=53; BWRat21 R=-0.0312 p=0.799 n=69; Bogey R=-0.332 p=0.0228 n=47; Dino R=-0.127 p=0.27 n=78; Rizzo R=0.0595 p=0.63 n=68; Splinter R=0.0167 p=0.917 n=41; Templeton R=-0.0713 p=0.638 n=46
== crcns-fcx-1: a: R=-0.283, p=2.44e-14, n=701; b: R=-0.163, p=1.65e-64, n=10649; c: R=-0.8, p=3.23e-12, n=50 by rat, per packet (reading a): B22 R=-0.176 p=0.227 n=49; BWRat17 R=-0.805 p=1.27e-10 n=42; BWRat18 R=-0.446 p=0.0729 n=17; BWRat19 R=-0.834 p=2.3e-07 n=25; BWRat20 R=-0.238 p=0.0859 n=53; BWRat21 R=-0.324 p=0.00283 n=83; Bogey R=-0.45 p=0.000305 n=60; Dino R=-0.21 p=0.0147 n=135; Rizzo R=-0.0674 p=0.484 n=110; Splinter R=-0.118 p=0.353 n=64; Templeton R=-0.0213 p=0.868 n=63
Result: reproduced. The mean pE rate over normalized SLEEP (nonREM only) declines under every reading: per packet R = -0.283, p = 2.4e-14 on CRCNS (paper R = -0.11, p < 1e-3), R = -0.178, p = 1.1e-4 on DANDI. By rat (per packet), R is negative in 11 of 11 rats on CRCNS (p < 0.05 in 5).
first-last-packet-mean-rate¶
The mean pE rate is lower in the last than in the first nonREM packet of SLEEP (1.04 against 0.88 Hz).
Source: Results, Firing pattern and LFP changes across the course of sleep, paragraph 1. The criterion and its readings are in the claims file; the code below runs each reading it names.
FL = {}
for ds in DS:
A, B, Ab, Bb = [], [], [], []
for s in D[ds]:
fa, la = [], []
for c in s["cycles"]:
if len(c["packets"]) < 2: continue
f = W.cell_rates(s, c["packets"][:1], s["E"])[0]; l = W.cell_rates(s, c["packets"][-1:], s["E"])[0]
A.append(f); B.append(l); fa.append(f); la.append(l)
if fa:
Ab.append(np.mean(fa, 0)); Bb.append(np.mean(la, 0))
for r, (x, y) in {"a": (A, B), "b": (Ab, Bb)}.items():
x, y = np.concatenate(x), np.concatenate(y)
FL[ds, r] = (x, y)
sr2 = stats.wilcoxon(x, y).pvalue; sr1 = stats.wilcoxon(x, y, alternative="greater").pvalue
rs2 = stats.mannwhitneyu(x, y).pvalue; rs1 = stats.mannwhitneyu(x, y, alternative="greater").pvalue
pr(f"== {ds} reading {r}: n={len(x)}, first {x.mean():.2f}+-{x.std():.2f} Hz, last {y.mean():.2f}+-{y.std():.2f} Hz; signed-rank p two-sided {fmt(sr2)}, "
f"one-sided {fmt(sr1)}; rank-sum two-sided {fmt(rs2)}, one-sided {fmt(rs1)}")
rat_of = np.concatenate([[s["rat"]] * len(s["E"]) for s in D[ds] for c in s["cycles"] if len(c["packets"]) >= 2])
x, y = FL[ds, "a"]
pr(" by rat, mean first and last packet rate (reading a): " + "; ".join(
f"{rt} {x[rat_of==rt].mean():.2f} to {y[rat_of==rt].mean():.2f} (n={(rat_of==rt).sum()})" for rt in sorted(set(rat_of))))
== 000041 reading a: n=1761, first 0.99+-1.09 Hz, last 0.91+-0.93 Hz; signed-rank p two-sided 2.76e-07, one-sided 1.38e-07; rank-sum two-sided 0.257, one-sided 0.129 == 000041 reading b: n=839, first 0.98+-1.08 Hz, last 0.86+-0.86 Hz; signed-rank p two-sided 1.67e-08, one-sided 8.36e-09; rank-sum two-sided 0.121, one-sided 0.0605 by rat, mean first and last packet rate (reading a): BWRat17 0.70 to 0.51 (n=78); BWRat18 0.62 to 0.54 (n=70); BWRat19 1.52 to 0.93 (n=90); BWRat20 0.71 to 0.69 (n=206); BWRat21 0.64 to 0.63 (n=129); Bogey 0.84 to 0.80 (n=96); Dino 1.06 to 1.01 (n=572); Rizzo 1.40 to 1.33 (n=328); Splinter 0.69 to 0.66 (n=162); Templeton 0.58 to 0.60 (n=30) == crcns-fcx-1 reading a: n=1787, first 1.03+-1.09 Hz, last 0.90+-0.94 Hz; signed-rank p two-sided 1.03e-18, one-sided 5.13e-19; rank-sum two-sided 0.00247, one-sided 0.00123 == crcns-fcx-1 reading b: n=995, first 1.05+-1.12 Hz, last 0.88+-0.92 Hz; signed-rank p two-sided 1.87e-20, one-sided 9.33e-21; rank-sum two-sided 0.00116, one-sided 0.000581 by rat, mean first and last packet rate (reading a): B22 1.35 to 1.24 (n=153); BWRat17 0.80 to 0.47 (n=77); BWRat18 0.64 to 0.51 (n=68); BWRat19 1.53 to 0.85 (n=88); BWRat20 0.72 to 0.73 (n=137); BWRat21 0.74 to 0.63 (n=109); Bogey 0.87 to 0.81 (n=99); Dino 1.04 to 0.92 (n=564); Rizzo 1.36 to 1.31 (n=303); Splinter 0.66 to 0.62 (n=159); Templeton 0.59 to 0.52 (n=30)
Result: reproduced. CRCNS, reading a: 1.03 +- 1.09 Hz in the first and 0.90 +- 0.94 Hz in the last packet, signed-rank p = 1.0e-18 (reading b 1.05 and 0.88 Hz, p = 1.9e-20), within tolerance. The rank-sum test gives p = 0.0025. By rat, the last-packet mean is lower in 10 of 11 rats on CRCNS (not BWRat20). DANDI agrees (0.99 to 0.91 Hz, p = 2.8e-7).
post-sleep-wake-lower¶
pE rates in the 5 min of WAKE after SLEEP are lower than in the 5 min of WAKE before.
Source: Results, Firing pattern and LFP changes across the course of sleep, paragraph 1. The criterion and its readings are in the claims file; the code below runs each reading it names.
def wake_windows(s, c, reading):
"""Last 5 min of the cycle's WAKE, and the first 5 min of WAKE after its SLEEP: (i) the next scored
WAKE interval; (ii) the arousal of more than 120 s that ends the SLEEP."""
pre = np.array([[max(c["wake"][0], c["wake"][1] - 300), c["wake"][1]]])
Wk = np.asarray(s["ints"]["Wake"]).reshape(-1, 2)
if reading == "i":
nxt = Wk[Wk[:, 0] >= c["sleep"][1] - 2]
if not len(nxt): return pre, None
a = nxt[0, 0]
return pre, np.array([[a, min(a + 300, nxt[0, 1])]])
a = c["sleep"][1]
# arousal after SLEEP: time until the next sleep state
nxt_sleep = np.concatenate([np.asarray(s["ints"][k]).reshape(-1, 2) for k in ["SWSPacket", "REM"]])
nxt_sleep = nxt_sleep[nxt_sleep[:, 0] > a + 1]
end = nxt_sleep[:, 0].min() if len(nxt_sleep) else max(x.max() for x in s["spikes"] if len(x))
if end - a <= 120: return pre, None
return pre, np.array([[a, min(a + 300, end)]])
PW = {}
for ds in DS:
for rr in ["i", "ii"]:
for m1 in "ab":
X, Y = [], []
for s in D[ds]:
xs, ys = [], []
for c in s["cycles"]:
pre, post = wake_windows(s, c, rr)
if post is None: continue
xs.append(W.cell_rates(s, pre, s["E"])[0]); ys.append(W.cell_rates(s, post, s["E"])[0])
if not xs: continue
if m1 == "a": X += xs; Y += ys
else: X.append(np.mean(xs, 0)); Y.append(np.mean(ys, 0))
X, Y = np.concatenate(X), np.concatenate(Y)
PW[ds, rr, m1] = (X, Y)
pr(f"== {ds} WAKE-after {rr}, M1 {m1}: n={len(X)} pre mean {X.mean():.3f} median {np.median(X):.3f}, post mean {Y.mean():.3f} median {np.median(Y):.3f} Hz; "
f"signed-rank p two {fmt(stats.wilcoxon(X, Y).pvalue)} one {fmt(stats.wilcoxon(X, Y, alternative='greater').pvalue)}; "
f"rank-sum two {fmt(stats.mannwhitneyu(X, Y).pvalue)} one {fmt(stats.mannwhitneyu(X, Y, alternative='greater').pvalue)}")
== 000041 WAKE-after i, M1 a: n=1442 pre mean 1.246 median 0.737, post mean 1.149 median 0.658 Hz; signed-rank p two 0.000107 one 5.37e-05; rank-sum two 0.238 one 0.119 == 000041 WAKE-after i, M1 b: n=822 pre mean 1.193 median 0.689, post mean 1.105 median 0.642 Hz; signed-rank p two 0.0011 one 0.000551; rank-sum two 0.427 one 0.214 == 000041 WAKE-after ii, M1 a: n=1688 pre mean 1.222 median 0.712, post mean 1.134 median 0.621 Hz; signed-rank p two 2.42e-05 one 1.21e-05; rank-sum two 0.11 one 0.0548 == 000041 WAKE-after ii, M1 b: n=822 pre mean 1.192 median 0.719, post mean 1.096 median 0.625 Hz; signed-rank p two 2.67e-05 one 1.34e-05; rank-sum two 0.191 one 0.0954 == crcns-fcx-1 WAKE-after i, M1 a: n=703 pre mean 1.145 median 0.713, post mean 1.082 median 0.703 Hz; signed-rank p two 0.0179 one 0.00895; rank-sum two 0.954 one 0.477 == crcns-fcx-1 WAKE-after i, M1 b: n=494 pre mean 1.069 median 0.660, post mean 1.005 median 0.679 Hz; signed-rank p two 0.0482 one 0.0241; rank-sum two 0.975 one 0.513 == crcns-fcx-1 WAKE-after ii, M1 a: n=1732 pre mean 1.261 median 0.767, post mean 1.135 median 0.673 Hz; signed-rank p two 3.12e-11 one 1.56e-11; rank-sum two 0.0539 one 0.027
== crcns-fcx-1 WAKE-after ii, M1 b: n=995 pre mean 1.263 median 0.768, post mean 1.141 median 0.677 Hz; signed-rank p two 1.65e-06 one 8.27e-07; rank-sum two 0.142 one 0.0711
Result: reproduced. CRCNS, with the arousal that ends SLEEP as the WAKE after (reading ii), pE rates fall from 1.261 to 1.135 Hz (signed-rank p = 3.1e-11 by cell and cycle; 1.7e-6 two-sided, 8.3e-7 one-sided by cell), below the 1e-6 bound by cell and cycle; with the next scored WAKE (reading i) p = 0.018. DANDI: the decrease holds under every reading with two-sided signed-rank p between 2.4e-5 and 1.1e-3, not below 1e-6. Rank-sum tests are weaker: the one-sided rank-sum p is 0.027 on CRCNS under reading ii with one entry per cell and cycle, and 0.055 to 0.51 under the other readings on both datasets.
fig3d-first-last-packet-slope¶
Comparing the same cells in the first and last nonREM packets of SLEEP, the slope of last on first rate is below 1 (95% interval 0.827 to 0.880); fast cells decrease and slow cells increase their rates over sleep.
Source: Results, Firing pattern and LFP changes across the course of sleep, paragraph 2; Figure 3D and legend; Figure S3B. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
for r in "ab":
x, y = FL[ds, r]
lx, ly, drop = W.log_pairs(x, y); o = W.ols_slope(lx, ly); rv = W.ols_slope(ly, lx)
pr(f"== {ds} reading {r}: log10 slope last on first {o['slope']:.3f} [{o['lo']:.3f}, {o['hi']:.3f}] R={o['R']:.3f} n={o['n']} (dropped {drop}); "
f"reverse {rv['slope']:.3f} [{rv['lo']:.3f}, {rv['hi']:.3f}]; linear {W.ols_slope(x, y)['slope']:.3f}")
== 000041 reading a: log10 slope last on first 0.811 [0.784, 0.837] R=0.821 n=1695 (dropped 66); reverse 0.831 [0.804, 0.859]; linear 0.666 == 000041 reading b: log10 slope last on first 0.825 [0.791, 0.858] R=0.861 n=825 (dropped 14); reverse 0.899 [0.863, 0.935]; linear 0.621 == crcns-fcx-1 reading a: log10 slope last on first 0.788 [0.760, 0.817] R=0.797 n=1717 (dropped 70); reverse 0.807 [0.778, 0.836]; linear 0.673 == crcns-fcx-1 reading b: log10 slope last on first 0.872 [0.840, 0.904] R=0.866 n=972 (dropped 23); reverse 0.860 [0.829, 0.891]; linear 0.647
Result: reproduced. CRCNS, reading b: log slope 0.872 [0.840, 0.904], within 0.8535 +- 0.0265 (reading a 0.788). DANDI: 0.825 [0.791, 0.858] (b), just outside. The reverse regressions, first on last packet, are also below 1 (CRCNS 0.860 and 0.807), as regression to the mean alone would make them, so the slope below 1 does not by itself show that the rate distribution narrowed.
fig3b-sextile-changes¶
Over SLEEP (nonREM only), the mean rate of the highest-rate sextiles decreases while the lowest sextile shows a marginal increase.
Source: Results, Firing pattern and LFP changes across the course of sleep, paragraph 2; Figure 3B, bottom, and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
def sext_rate(q):
def f(s, sub):
cells = s["E"][s["sextile"] == q]
if len(cells) == 0: return None
r, n = W.cell_rates(s, sub, cells)
return np.nanmean(r) if n else None
return f
for ds in DS:
for m2 in "ab":
W.sextiles(D[ds], m2)
ss = [s for s in D[ds] if s["cycles"]]
for q in [5, 4, 0]:
pr(f"== {ds} M2 {m2} sextile {q+1} of 6 ({'top' if q==5 else 'bottom' if q==0 else 'second'}):", rp(W.norm_corr(ss, "sleep", sext_rate(q))))
W.sextiles(D[ds], "a")
== 000041 M2 a sextile 6 of 6 (top): a: R=-0.275, p=1.58e-07, n=351; b: R=-0.173, p=3.85e-50, n=7292; c: R=-0.703, p=1.22e-08, n=50
== 000041 M2 a sextile 5 of 6 (second): a: R=-0.219, p=1.74e-06, n=466; b: R=-0.121, p=4.03e-31, n=9167; c: R=-0.617, p=1.83e-06, n=50
== 000041 M2 a sextile 1 of 6 (bottom): a: R=0.185, p=7.67e-05, n=451; b: R=0.106, p=1.03e-23, n=8891; c: R=0.743, p=6.26e-10, n=50
== 000041 M2 b sextile 6 of 6 (top): a: R=-0.265, p=4.51e-07, n=351; b: R=-0.236, p=1.09e-92, n=7292; c: R=-0.77, p=6.17e-11, n=50
== 000041 M2 b sextile 5 of 6 (second): a: R=-0.207, p=1.43e-05, n=434; b: R=-0.129, p=4.81e-33, n=8547; c: R=-0.687, p=3.67e-08, n=50
== 000041 M2 b sextile 1 of 6 (bottom): a: R=0.177, p=0.000164, n=451; b: R=0.111, p=1.13e-25, n=8891; c: R=0.737, p=1.01e-09, n=50
== crcns-fcx-1 M2 a sextile 6 of 6 (top): a: R=-0.368, p=1.27e-19, n=566; b: R=-0.206, p=1.06e-81, n=8458; c: R=-0.813, p=7.14e-13, n=50
== crcns-fcx-1 M2 a sextile 5 of 6 (second): a: R=-0.228, p=3.95e-09, n=652; b: R=-0.154, p=8.14e-54, n=9906; c: R=-0.798, p=3.98e-12, n=50
== crcns-fcx-1 M2 a sextile 1 of 6 (bottom): a: R=0.102, p=0.0118, n=611; b: R=0.0455, p=1.17e-05, n=9275; c: R=0.375, p=0.00731, n=50
== crcns-fcx-1 M2 b sextile 6 of 6 (top): a: R=-0.308, p=1.08e-13, n=555; b: R=-0.229, p=4.76e-102, n=8540; c: R=-0.804, p=2.13e-12, n=50
== crcns-fcx-1 M2 b sextile 5 of 6 (second): a: R=-0.239, p=6.52e-10, n=652; b: R=-0.145, p=1.18e-47, n=9906; c: R=-0.77, p=6.15e-11, n=50
== crcns-fcx-1 M2 b sextile 1 of 6 (bottom): a: R=0.0962, p=0.0199, n=585; b: R=0.0444, p=2.47e-05, n=9009; c: R=0.379, p=0.00668, n=50
Result: reproduced. Over normalized SLEEP the top sextile declines (CRCNS per packet R = -0.368, p = 1.3e-19) and the bottom sextile increases (R = 0.102, p = 0.012), under both sextile readings and all three time readings. DANDI agrees (R = -0.275 and 0.185).
cv-decreases-over-sleep¶
The coefficient of variation of pE firing rates decreases over SLEEP.
Source: Results, Firing pattern and LFP changes across the course of sleep, paragraph 2. The criterion and its readings are in the claims file; the code below runs each reading it names.
def cv_fn(s, sub):
if len(s["E"]) < 3: return None
r, n = W.cell_rates(s, sub, s["E"])
if n == 0 or np.nanmean(r) == 0: return None
return np.nanstd(r) / np.nanmean(r)
for ds in DS:
pr(f"== {ds}:", rp(W.norm_corr([s for s in D[ds] if s['cycles']], "sleep", cv_fn, readings=("b", "a", "c"))))
== 000041: b: R=-0.0222, p=0.0338, n=9167; a: R=-0.166, p=0.000309, n=466; c: R=-0.476, p=0.000475, n=50
== crcns-fcx-1: b: R=-0.0128, p=0.186, n=10649; a: R=-0.116, p=0.00216, n=701; c: R=-0.485, p=0.000357, n=50
Result: reproduced. The CV of pE rates over normalized SLEEP decreases under reading a (per packet, CRCNS R = -0.116, p = 0.0022), below p < 0.01, and under reading c (R = -0.485, p = 3.6e-4); under reading b (10 s bins) R is negative but p = 0.19. DANDI: a R = -0.166, p = 3.1e-4; b p = 0.034; c R = -0.476.
fig3c-spindles-over-sleep¶
Over SLEEP spindle incidence (1.94/min) decreases while spindle duration (0.52 s), frequency (13.93 Hz) and amplitude (203.3 uV) do not change.
Source: Results, Firing pattern and LFP changes across the course of sleep, paragraph 3; Figure 3C, bottom; Table S1. The criterion and its readings are in the claims file; the code below runs each reading it names.
def gratio(num, den=None, per_min=False):
def f(s, sub):
if num not in s["G"]: return None
a, n = W.gsum(s, num, sub)
if den is None:
return a / n * (60 if per_min else 1) if n else None
b, _ = W.gsum(s, den, sub)
return a / b if b > 0 else None
return f
for ds in DS:
ss = [s for s in D[ds] if s["cycles"] and "sp_n" in s["G"]]
sp_n = sum(W.gsum(s, "sp_n", W.state_pieces(s, "nrem"))[0] for s in ss)
t_n = sum(W.gsum(s, "sp_n", W.state_pieces(s, "nrem"))[1] for s in ss)
inc_s = [W.gsum(s, "sp_n", W.state_pieces(s, "nrem"))[0] / W.gsum(s, "sp_n", W.state_pieces(s, "nrem"))[1] * 60 for s in ss]
sp = [s["spindles"] for s in ss]
allsp = {k: np.concatenate([x[k] for x in sp]) for k in ["dur", "freq", "amp_uV"]}
pr(f"== {ds} ({'deposited _Spindles, reading a' if ds!='000041' else 'detected here, reading b'}): {sum(len(x['start']) for x in sp)} spindles in the sessions, "
f"{sp_n:.0f} in nonREM of cycles; incidence {sp_n/t_n*60:.2f}/min pooled, median over sessions {np.median(inc_s):.2f}/min; "
f"median duration {np.nanmedian(allsp['dur']):.3f} s, frequency {np.nanmedian(allsp['freq']):.2f} Hz, amplitude {np.nanmedian(allsp['amp_uV']):.1f} uV; "
f"means {np.nanmean(allsp['dur']):.3f} s, {np.nanmean(allsp['freq']):.2f} Hz, {np.nanmean(allsp['amp_uV']):.1f} uV")
for nm, fn in [("incidence", gratio("sp_n", per_min=True)), ("duration", gratio("sp_dur", "sp_n")),
("frequency", gratio("sp_freq", "sp_nf")), ("amplitude", gratio("sp_amp", "sp_n"))]:
pr(f" {nm} over SLEEP:", rp(W.norm_corr(ss, "sleep", fn)))
== 000041 (detected here, reading b): 18360 spindles in the sessions, 10134 in nonREM of cycles; incidence 6.61/min pooled, median over sessions 6.73/min; median duration 0.381 s, frequency 13.30 Hz, amplitude 203.0 uV; means 0.460 s, 13.45 Hz, 225.0 uV
incidence over SLEEP: a: R=-0.0418, p=0.373, n=456; b: R=-0.0264, p=0.0121, n=9002; c: R=-0.289, p=0.0419, n=50
duration over SLEEP: a: R=0.0771, p=0.102, n=450; b: R=0.0255, p=0.0534, n=5744; c: R=0.237, p=0.0972, n=50
frequency over SLEEP: a: R=-0.0661, p=0.162, n=450; b: R=-0.0207, p=0.117, n=5744; c: R=-0.266, p=0.0619, n=50
amplitude over SLEEP: a: R=0.105, p=0.0266, n=450; b: R=0.0321, p=0.0149, n=5744; c: R=0.304, p=0.0317, n=50 == crcns-fcx-1 (deposited _Spindles, reading a): 5203 spindles in the sessions, 5203 in nonREM of cycles; incidence 2.85/min pooled, median over sessions 2.95/min; median duration 0.524 s, frequency 13.93 Hz, amplitude 203.3 uV; means 0.614 s, 13.94 Hz, 226.6 uV
incidence over SLEEP: a: R=-0.0219, p=0.562, n=701; b: R=-0.0128, p=0.187, n=10649; c: R=-0.0815, p=0.574, n=50
duration over SLEEP: a: R=0.0259, p=0.506, n=663; b: R=0.0371, p=0.0245, n=3666; c: R=0.117, p=0.42, n=50
frequency over SLEEP: a: R=-0.0566, p=0.146, n=663; b: R=-0.0423, p=0.0105, n=3666; c: R=-0.224, p=0.118, n=50
amplitude over SLEEP: a: R=0.0766, p=0.0487, n=663; b: R=0.0308, p=0.0621, n=3666; c: R=0.252, p=0.0772, n=50
Result: not reproduced. CRCNS, deposited spindles: duration 0.524 s, frequency 13.93 Hz and amplitude 203.3 uV (medians) match; incidence is 2.85 per minute of nonREM (2.95 median over sessions), which matches Table S1 (2.94) and not the Results value of 1.94 the claim is judged on. Spindle incidence does not decrease significantly over SLEEP under any reading (per packet R = -0.022, p = 0.56; p = 0.19 and 0.57 under b and c), so the main part fails. DANDI, new detection: 6.6 per minute, 0.381 s, 13.3 Hz, 203 uV, incidence change R = -0.026, p = 0.012 (10 s bins).
fig3c-updown-over-sleep¶
Over SLEEP the incidence of UP and DOWN states decreases, DOWN state duration increases, UP state duration does not change, and the fraction of time in neither UP nor DOWN increases.
Source: Results, Firing pattern and LFP changes across the course of sleep, paragraph 3; Figure 3C and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
def other_frac(s, sub):
a, n = W.gsum(s, "up_occ", sub); b, _ = W.gsum(s, "dn_occ", sub)
return 1 - (a + b) / n if n else None
UDF = [("UP incidence", gratio("up_n", per_min=True)), ("DOWN incidence", gratio("dn_n", per_min=True)),
("DOWN duration", gratio("dn_dur", "dn_n")), ("UP duration", gratio("up_dur", "up_n")), ("other fraction", other_frac)]
for ds in DS:
ss = [s for s in D[ds] if s["cycles"] and len(s.get("up", []))]
for nm, fn in UDF:
pr(f"== {ds} {nm} over SLEEP:", rp(W.norm_corr(ss, "sleep", fn)))
== 000041 UP incidence over SLEEP: a: R=-0.0666, p=0.156, n=456; b: R=-0.0268, p=0.0111, n=9002; c: R=-0.191, p=0.183, n=50
== 000041 DOWN incidence over SLEEP: a: R=0.0482, p=0.304, n=456; b: R=0.0487, p=3.83e-06, n=9002; c: R=0.415, p=0.00271, n=50
== 000041 DOWN duration over SLEEP: a: R=0.0678, p=0.151, n=451; b: R=0.0813, p=6.29e-14, n=8494; c: R=0.536, p=6e-05, n=50
== 000041 UP duration over SLEEP: a: R=0.0177, p=0.727, n=392; b: R=-0.00502, p=0.681, n=6696; c: R=-0.128, p=0.376, n=50
== 000041 other fraction over SLEEP: a: R=-0.136, p=0.00351, n=456; b: R=-0.0664, p=2.88e-10, n=9002; c: R=-0.478, p=0.000447, n=50
== crcns-fcx-1 UP incidence over SLEEP: a: R=-0.0569, p=0.132, n=701; b: R=-0.0104, p=0.282, n=10649; c: R=-0.0129, p=0.929, n=50
== crcns-fcx-1 DOWN incidence over SLEEP: a: R=0.00834, p=0.826, n=701; b: R=-0.0186, p=0.0547, n=10649; c: R=0.192, p=0.183, n=50
== crcns-fcx-1 DOWN duration over SLEEP: a: R=0.165, p=1.29e-05, n=690; b: R=0.128, p=1.67e-38, n=10121; c: R=0.723, p=3.01e-09, n=50
== crcns-fcx-1 UP duration over SLEEP: a: R=0.0812, p=0.0409, n=635; b: R=0.0142, p=0.189, n=8538; c: R=-0.148, p=0.306, n=50
== crcns-fcx-1 other fraction over SLEEP: a: R=-0.00123, p=0.974, n=701; b: R=-0.0173, p=0.0746, n=10649; c: R=-0.228, p=0.112, n=50
Result: not reproduced. CRCNS: DOWN duration increases over SLEEP (R = 0.165, p = 1.3e-5 per packet) and UP duration does not change under readings b and c (p = 0.19 and 0.31), but UP and DOWN incidence do not decrease (p >= 0.05) and the fraction of 'other' time does not increase (R <= 0). Two of five parts hold. DANDI also has two of five.
fig3f-within-up-changes¶
Within UP states, pE rates decrease over SLEEP, and from first to last packet the fastest sextile and interneurons decrease while the slowest sextile increases.
Source: Results, Firing pattern and LFP changes across the course of sleep, paragraph 3; Figure 3F and legend; Figure S3C. The criterion and its readings are in the claims file; the code below runs each reading it names.
def up_rate(cells_fn):
def f(s, sub):
if "upcnt" not in s["G"]: return None
cells = cells_fn(s)
if len(cells) == 0: return None
a, n = W.gsum(s, "upcnt", sub); t, _ = W.gsum(s, "up_occ", sub)
return a[cells].sum() / len(cells) / t if t > 0 else None
return f
for ds in DS:
ss = [s for s in D[ds] if s["cycles"] and len(s.get("up", []))]
pr(f"== {ds} within-UP pE rate over SLEEP:", rp(W.norm_corr(ss, "sleep", up_rate(lambda s: s["E"]))))
out = {}
for nm, sel in [("top sextile", lambda s: s["E"][s["sextile"] == 5]), ("bottom sextile", lambda s: s["E"][s["sextile"] == 0]), ("pI", lambda s: s["I"])]:
ch = []
for s in ss:
cells = sel(s)
if len(cells) == 0: continue
for c in s["cycles"]:
if len(c["packets"]) < 2: continue
r = []
for p in (c["packets"][:1], c["packets"][-1:]):
a, n = W.gsum(s, "upcnt", p); t, _ = W.gsum(s, "up_occ", p)
r.append(a[cells] / t if t > 0 else np.full(len(cells), np.nan))
ch.append(r[1] - r[0])
ch = np.concatenate(ch); ch = ch[np.isfinite(ch)]
pr(f" {nm}: last minus first packet within-UP rate, mean {ch.mean():.3f} Hz, median {np.median(ch):.3f}, n={len(ch)}, signed-rank p={fmt(stats.wilcoxon(ch).pvalue)}")
== 000041 within-UP pE rate over SLEEP: a: R=-0.143, p=0.00458, n=392; b: R=-0.0921, p=3.5e-14, n=6743; c: R=-0.583, p=9.01e-06, n=50 top sextile: last minus first packet within-UP rate, mean -0.268 Hz, median -0.168, n=278, signed-rank p=0.00653 bottom sextile: last minus first packet within-UP rate, mean 0.086 Hz, median 0.020, n=254, signed-rank p=0.00303 pI: last minus first packet within-UP rate, mean -1.155 Hz, median -0.165, n=150, signed-rank p=0.00241
== crcns-fcx-1 within-UP pE rate over SLEEP: a: R=-0.159, p=5.57e-05, n=635; b: R=-0.089, p=1.56e-16, n=8563; c: R=-0.694, p=2.35e-08, n=50 top sextile: last minus first packet within-UP rate, mean -0.430 Hz, median -0.370, n=276, signed-rank p=1.87e-07 bottom sextile: last minus first packet within-UP rate, mean 0.077 Hz, median 0.000, n=244, signed-rank p=0.482 pI: last minus first packet within-UP rate, mean -0.672 Hz, median -0.051, n=182, signed-rank p=0.0466
Result: reproduced. The within-UP pE rate declines over SLEEP (10 s bins, CRCNS R = -0.089, p = 1.6e-16), below the 1e-8 bound. From first to last packet, the top sextile (-0.430 Hz) and pI (-0.672 Hz) decrease and the bottom sextile increases (+0.077 Hz; signed-rank p = 0.48, the claim is judged by sign). DANDI agrees (R = -0.092; -0.268, -1.155 and +0.086 Hz).
figs3a-first-last-rem-ma-slopes¶
Rates change differentially across the spectrum also from the first to last REM and first to last MA of SLEEP and from WAKE before to WAKE after sleep, with slopes below 1 (REM 0.76 to 0.83, MA 0.58 to 0.68, WAKE 0.80 to 0.86).
Source: Results, Firing pattern and LFP changes across the course of sleep, last paragraph, and Sleep sub-states induce differential lasting firing rate changes, paragraph 1; Figure S3A legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
for m1 in "ab":
res = {}
for nm, key in [("REM", "rem"), ("MA", "ma")]:
X, Y = [], []
for s in D[ds]:
xs, ys = [], []
for c in s["cycles"]:
if len(c[key]) < 2: continue
xs.append(W.cell_rates(s, c[key][:1], s["E"])[0]); ys.append(W.cell_rates(s, c[key][-1:], s["E"])[0])
if not xs: continue
if m1 == "a": X += xs; Y += ys
else: X.append(np.mean(xs, 0)); Y.append(np.mean(ys, 0))
lx, ly, drop = W.log_pairs(np.concatenate(X), np.concatenate(Y)); res[nm] = (W.ols_slope(lx, ly), drop, W.ols_slope(ly, lx))
for rr in ["i", "ii"]:
X, Y = PW[ds, rr, m1]; lx, ly, drop = W.log_pairs(X, Y); res["WAKE " + rr] = (W.ols_slope(lx, ly), drop, W.ols_slope(ly, lx))
pr(f"== {ds} M1 {m1}: " + "; ".join(f"{k} slope {o['slope']:.3f} [{o['lo']:.3f}, {o['hi']:.3f}] R={o['R']:.3f} p={fmt(o['p'])} n={o['n']} (dropped {d}; "
f"reverse, first on last, {rv['slope']:.3f} [{rv['lo']:.3f}, {rv['hi']:.3f}])" for k, (o, d, rv) in res.items()))
== 000041 M1 a: REM slope 0.724 [0.689, 0.759] R=0.730 p=4.77e-243 n=1456 (dropped 168; reverse, first on last, 0.737 [0.702, 0.773]); MA slope 0.593 [0.546, 0.641] R=0.597 p=7.11e-105 n=1076 (dropped 295; reverse, first on last, 0.601 [0.552, 0.649]); WAKE i slope 0.771 [0.740, 0.802] R=0.792 p=1.76e-304 n=1413 (dropped 29; reverse, first on last, 0.813 [0.780, 0.846]); WAKE ii slope 0.796 [0.767, 0.824] R=0.804 p=0 n=1650 (dropped 38; reverse, first on last, 0.813 [0.784, 0.842]) == 000041 M1 b: REM slope 0.791 [0.750, 0.832] R=0.817 p=1.69e-173 n=718 (dropped 39; reverse, first on last, 0.844 [0.801, 0.888]); MA slope 0.651 [0.594, 0.708] R=0.661 p=1.13e-82 n=648 (dropped 124; reverse, first on last, 0.671 [0.612, 0.730]); WAKE i slope 0.753 [0.713, 0.792] R=0.797 p=1.04e-178 n=808 (dropped 14; reverse, first on last, 0.844 [0.800, 0.888]); WAKE ii slope 0.822 [0.783, 0.861] R=0.823 p=1.09e-200 n=810 (dropped 12; reverse, first on last, 0.824 [0.785, 0.864]) == crcns-fcx-1 M1 a: REM slope 0.742 [0.708, 0.776] R=0.751 p=1.61e-260 n=1435 (dropped 149; reverse, first on last, 0.760 [0.726, 0.795]); MA slope 0.530 [0.483, 0.577] R=0.539 p=3.32e-92 n=1210 (dropped 457; reverse, first on last, 0.548 [0.500, 0.597]); WAKE i slope 0.713 [0.663, 0.762] R=0.730 p=5.32e-117 n=697 (dropped 6; reverse, first on last, 0.748 [0.696, 0.800]); WAKE ii slope 0.794 [0.766, 0.822] R=0.803 p=0 n=1713 (dropped 19; reverse, first on last, 0.812 [0.784, 0.841]) == crcns-fcx-1 M1 b: REM slope 0.807 [0.769, 0.845] R=0.823 p=5.72e-203 n=819 (dropped 56; reverse, first on last, 0.840 [0.800, 0.880]); MA slope 0.656 [0.601, 0.710] R=0.641 p=3.22e-94 n=803 (dropped 172; reverse, first on last, 0.627 [0.575, 0.679]); WAKE i slope 0.687 [0.627, 0.746] R=0.718 p=8.57e-79 n=489 (dropped 5; reverse, first on last, 0.752 [0.687, 0.816]); WAKE ii slope 0.820 [0.785, 0.854] R=0.829 p=1.32e-249 n=984 (dropped 11; reverse, first on last, 0.838 [0.802, 0.873])
Result: reproduced. With one point per cell (M1 b) and the arousal that ends SLEEP as WAKE after, CRCNS slopes REM 0.807, MA 0.656, WAKE 0.820; DANDI 0.791, 0.651, 0.822; all within tolerance. With one point per cell and cycle (M1 a), REM and the WAKE slopes fall below tolerance on both. The reverse slopes are also below 1 and close to the forward ones (CRCNS M1 b: REM 0.840, MA 0.627, WAKE 0.838), so these slopes measure how well first and last rates agree as much as any change.
fig3e-wake-before-after-sextiles¶
From 5 min of WAKE before to 5 min of WAKE after SLEEP, the top three sextiles decrease their rates and the lowest sextile increases.
Source: Results, Sleep sub-states induce differential lasting firing rate changes, paragraph 1; Figure 3E and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
def fig3e_tests(ds, rr, m1, key):
X, Y = PW[ds, rr, m1]
sx = []
for s in D[ds]:
nv = sum(1 for c in s["cycles"] if wake_windows(s, c, rr)[1] is not None)
if nv == 0: continue
sx.append(np.tile(s[key], nv) if m1 == "a" else s[key])
sx = np.concatenate(sx); out = []
for q in range(6):
m = sx == q; d = Y[m] - X[m]
alt = "less" if q >= 3 else "greater"
p = stats.wilcoxon(Y[m], X[m], alternative=alt).pvalue if (d != 0).sum() > 5 else np.nan
out.append(f"S{q+1}: mean change {d.mean():+.3f} Hz, one-sided ({'decrease' if q>=3 else 'increase'}) p={fmt(p)}, n={m.sum()}")
return "; ".join(out)
def test_windows(rr):
def f(s):
w = [x for c in s["cycles"] for x in wake_windows(s, c, rr) if x is not None]
return np.concatenate(w) if w else np.zeros((0, 2))
return f
for ds in DS:
for rr in ["i", "ii"]:
for m1 in "ab":
pr(f"== {ds} WAKE-after {rr} (M1 {m1}, sextile 1 lowest): " + fig3e_tests(ds, rr, m1, "sextile"))
# held-out variant: cells ranked on WAKE without the two windows the test compares
W.sextiles(D[ds], exclude=test_windows(rr), key="sext_ho")
for m1 in "ab":
pr(f" variant, sextiles ranked on WAKE without the test windows (M1 {m1}): " + fig3e_tests(ds, rr, m1, "sext_ho"))
== 000041 WAKE-after i (M1 a, sextile 1 lowest): S1: mean change +0.014 Hz, one-sided (increase) p=0.0379, n=228; S2: mean change -0.012 Hz, one-sided (increase) p=0.94, n=225; S3: mean change +0.008 Hz, one-sided (increase) p=0.438, n=235; S4: mean change -0.039 Hz, one-sided (decrease) p=0.0687, n=247; S5: mean change -0.085 Hz, one-sided (decrease) p=0.0181, n=247; S6: mean change -0.429 Hz, one-sided (decrease) p=3.96e-05, n=260
== 000041 WAKE-after i (M1 b, sextile 1 lowest): S1: mean change +0.019 Hz, one-sided (increase) p=0.00721, n=139; S2: mean change -0.006 Hz, one-sided (increase) p=0.865, n=135; S3: mean change +0.015 Hz, one-sided (increase) p=0.672, n=137; S4: mean change -0.034 Hz, one-sided (decrease) p=0.125, n=141; S5: mean change -0.043 Hz, one-sided (decrease) p=0.0798, n=140; S6: mean change -0.505 Hz, one-sided (decrease) p=8.27e-05, n=130 variant, sextiles ranked on WAKE without the test windows (M1 a): S1: mean change +0.045 Hz, one-sided (increase) p=0.0036, n=227; S2: mean change +0.038 Hz, one-sided (increase) p=0.586, n=228; S3: mean change +0.011 Hz, one-sided (increase) p=0.807, n=227; S4: mean change -0.020 Hz, one-sided (decrease) p=0.246, n=256; S5: mean change -0.117 Hz, one-sided (decrease) p=0.00431, n=246; S6: mean change -0.492 Hz, one-sided (decrease) p=1.3e-06, n=258 variant, sextiles ranked on WAKE without the test windows (M1 b): S1: mean change +0.057 Hz, one-sided (increase) p=0.000695, n=140; S2: mean change +0.063 Hz, one-sided (increase) p=0.511, n=135; S3: mean change +0.036 Hz, one-sided (increase) p=0.785, n=136; S4: mean change -0.002 Hz, one-sided (decrease) p=0.387, n=141; S5: mean change -0.143 Hz, one-sided (decrease) p=0.0073, n=140; S6: mean change -0.567 Hz, one-sided (decrease) p=4.94e-06, n=130 == 000041 WAKE-after ii (M1 a, sextile 1 lowest): S1: mean change +0.033 Hz, one-sided (increase) p=0.0187, n=285; S2: mean change +0.001 Hz, one-sided (increase) p=0.967, n=264; S3: mean change +0.035 Hz, one-sided (increase) p=0.522, n=273; S4: mean change -0.061 Hz, one-sided (decrease) p=0.0167, n=285; S5: mean change -0.079 Hz, one-sided (decrease) p=0.0172, n=292; S6: mean change -0.439 Hz, one-sided (decrease) p=1.06e-05, n=289 == 000041 WAKE-after ii (M1 b, sextile 1 lowest): S1: mean change +0.031 Hz, one-sided (increase) p=0.00729, n=139; S2: mean change -0.004 Hz, one-sided (increase) p=0.906, n=135; S3: mean change +0.033 Hz, one-sided (increase) p=0.686, n=137; S4: mean change -0.074 Hz, one-sided (decrease) p=0.0153, n=141; S5: mean change -0.044 Hz, one-sided (decrease) p=0.073, n=140; S6: mean change -0.544 Hz, one-sided (decrease) p=9.19e-06, n=130
variant, sextiles ranked on WAKE without the test windows (M1 a): S1: mean change +0.055 Hz, one-sided (increase) p=0.00208, n=284; S2: mean change +0.030 Hz, one-sided (increase) p=0.967, n=258; S3: mean change +0.008 Hz, one-sided (increase) p=0.685, n=272; S4: mean change -0.054 Hz, one-sided (decrease) p=0.0664, n=297; S5: mean change -0.091 Hz, one-sided (decrease) p=0.011, n=287; S6: mean change -0.454 Hz, one-sided (decrease) p=1.89e-06, n=290 variant, sextiles ranked on WAKE without the test windows (M1 b): S1: mean change +0.060 Hz, one-sided (increase) p=0.00341, n=140; S2: mean change +0.076 Hz, one-sided (increase) p=0.818, n=135; S3: mean change +0.001 Hz, one-sided (increase) p=0.83, n=136; S4: mean change -0.048 Hz, one-sided (decrease) p=0.0468, n=141; S5: mean change -0.130 Hz, one-sided (decrease) p=0.0145, n=140; S6: mean change -0.560 Hz, one-sided (decrease) p=3.59e-06, n=130 == crcns-fcx-1 WAKE-after i (M1 a, sextile 1 lowest): S1: mean change +0.021 Hz, one-sided (increase) p=0.151, n=113; S2: mean change -0.031 Hz, one-sided (increase) p=0.827, n=117; S3: mean change +0.086 Hz, one-sided (increase) p=0.262, n=136; S4: mean change +0.032 Hz, one-sided (decrease) p=0.429, n=129; S5: mean change -0.089 Hz, one-sided (decrease) p=0.0435, n=98; S6: mean change -0.457 Hz, one-sided (decrease) p=0.00161, n=110 == crcns-fcx-1 WAKE-after i (M1 b, sextile 1 lowest): S1: mean change +0.025 Hz, one-sided (increase) p=0.102, n=86; S2: mean change -0.039 Hz, one-sided (increase) p=0.784, n=82; S3: mean change +0.096 Hz, one-sided (increase) p=0.169, n=94; S4: mean change +0.071 Hz, one-sided (decrease) p=0.558, n=94; S5: mean change -0.070 Hz, one-sided (decrease) p=0.0926, n=73; S6: mean change -0.633 Hz, one-sided (decrease) p=0.000297, n=65 variant, sextiles ranked on WAKE without the test windows (M1 a): S1: mean change +0.033 Hz, one-sided (increase) p=0.097, n=108; S2: mean change +0.061 Hz, one-sided (increase) p=0.406, n=130; S3: mean change +0.118 Hz, one-sided (increase) p=0.297, n=121; S4: mean change -0.004 Hz, one-sided (decrease) p=0.295, n=137; S5: mean change -0.117 Hz, one-sided (decrease) p=0.02, n=100; S6: mean change -0.542 Hz, one-sided (decrease) p=0.000276, n=107 variant, sextiles ranked on WAKE without the test windows (M1 b): S1: mean change +0.036 Hz, one-sided (increase) p=0.0254, n=82; S2: mean change +0.080 Hz, one-sided (increase) p=0.269, n=90; S3: mean change +0.163 Hz, one-sided (increase) p=0.155, n=87; S4: mean change +0.008 Hz, one-sided (decrease) p=0.351, n=95; S5: mean change -0.156 Hz, one-sided (decrease) p=0.0315, n=74; S6: mean change -0.684 Hz, one-sided (decrease) p=5.49e-05, n=66 == crcns-fcx-1 WAKE-after ii (M1 a, sextile 1 lowest): S1: mean change +0.049 Hz, one-sided (increase) p=0.00246, n=271; S2: mean change -0.019 Hz, one-sided (increase) p=0.995, n=283; S3: mean change +0.090 Hz, one-sided (increase) p=0.0857, n=304; S4: mean change -0.028 Hz, one-sided (decrease) p=0.0392, n=300; S5: mean change -0.176 Hz, one-sided (decrease) p=3.31e-06, n=278; S6: mean change -0.658 Hz, one-sided (decrease) p=2.72e-13, n=296 == crcns-fcx-1 WAKE-after ii (M1 b, sextile 1 lowest): S1: mean change +0.050 Hz, one-sided (increase) p=0.00069, n=166; S2: mean change -0.006 Hz, one-sided (increase) p=0.972, n=166; S3: mean change +0.115 Hz, one-sided (increase) p=0.074, n=166; S4: mean change -0.014 Hz, one-sided (decrease) p=0.0769, n=166; S5: mean change -0.170 Hz, one-sided (decrease) p=0.000459, n=166; S6: mean change -0.711 Hz, one-sided (decrease) p=1.24e-09, n=165 variant, sextiles ranked on WAKE without the test windows (M1 a): S1: mean change +0.038 Hz, one-sided (increase) p=0.0108, n=266; S2: mean change -0.027 Hz, one-sided (increase) p=0.998, n=288; S3: mean change +0.067 Hz, one-sided (increase) p=0.164, n=299; S4: mean change -0.030 Hz, one-sided (decrease) p=0.0209, n=307; S5: mean change -0.171 Hz, one-sided (decrease) p=1e-05, n=279; S6: mean change -0.622 Hz, one-sided (decrease) p=7.24e-12, n=293
variant, sextiles ranked on WAKE without the test windows (M1 b): S1: mean change +0.034 Hz, one-sided (increase) p=0.0122, n=166; S2: mean change -0.015 Hz, one-sided (increase) p=0.986, n=166; S3: mean change +0.086 Hz, one-sided (increase) p=0.147, n=166; S4: mean change -0.022 Hz, one-sided (decrease) p=0.0546, n=166; S5: mean change -0.159 Hz, one-sided (decrease) p=0.00076, n=166; S6: mean change -0.660 Hz, one-sided (decrease) p=2.76e-08, n=165
Result: reproduced. With the arousal that ends SLEEP as WAKE after (reading ii) and one entry per cell and cycle (M1 a), on CRCNS the top three sextiles decrease (one-sided p = 2.7e-13, 3.3e-6, 0.039) and the lowest increases (p = 0.0025). With sextiles ranked on WAKE without the two test windows the same four hold (p = 7.2e-12, 1.0e-5, 0.021, 0.011), so the result does not come from ranking on the windows tested. With one entry per cell (M1 b) the fourth sextile misses (p = 0.077). With the next scored WAKE (reading i) the fourth sextile fails. DANDI, reading ii, M1 a: all four hold (1.1e-5, 0.017, 0.017; 0.019).
Band powers z-scored per session, used by the LFP claims.
# Band powers z-scored per session ([claim] fig4i, "z-scored per session (a standard choice)"): log
# power, mean and SD over the nonREM packets of the session's cycles.
for ds in DS:
for s in D[ds]:
G = s["G"]
if "bp_delta" not in G or not s["cycles"]: continue
k = W.secs(W.state_pieces(s, "nrem")); k = k[k < G["T"]]
for b in ["delta", "delta14", "sigma", "gamma", "theta", "broad"]:
v = np.log(G["bp_" + b]); m = np.nanmean(v[k]); sd = np.nanstd(v[k])
G["bpz_" + b] = (v - m) / sd
G["bpn_" + b] = G["bp_" + b] / np.nanmean(G["bp_" + b][k])
if "bt_theta" in G:
G["thetaratio"] = G["bt_theta"] / G["bt_broad"]
else:
G["thetaratio"] = G["bp_theta"] / G["bp_broad"]
v = np.log(G["bp_theta"]); G["thetaz"] = (v - np.nanmean(v[k])) / np.nanstd(v[k])
pr(ds, "sessions with band power:", sum("bpz_delta" in s["G"] for s in D[ds]), "of", len(D[ds]))
000041 sessions with band power: 20 of 22
crcns-fcx-1 sessions with band power: 27 of 27
fig4i-band-power-within-nrem¶
Within nonREM episodes and packets delta and sigma power increase, while gamma power decreases over episodes but not over packets.
Source: Results, Firing rate and LFP changes within nonREM episodes and packets, paragraph 2; Figure 4A-B i and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
def bp(key):
def f(s, sub):
if key not in s["G"]: return None
return W.gmean(s, key, sub)
return f
for ds in DS:
ss = [s for s in D[ds] if "bpz_delta" in s["G"]]
for b in ["delta", "delta14", "sigma", "gamma"]:
for kind in ["episode", "packet"]:
pr(f"== {ds} {b} over {kind}s:", rp(W.norm_corr(ss, kind, bp("bpz_" + b), normalize=False)))
== 000041 delta over episodes: a: R=0.152, p=0.0011, n=456; b: R=0.121, p=1.96e-32, n=9492; c: R=0.189, p=0.188, n=50
== 000041 delta over packets: b: R=0.112, p=2.4e-26, n=9002; c: R=-0.0391, p=0.788, n=50
== 000041 delta14 over episodes: a: R=0.175, p=0.000167, n=456; b: R=0.123, p=1.82e-33, n=9492; c: R=0.17, p=0.237, n=50
== 000041 delta14 over packets: b: R=0.114, p=1.38e-27, n=9002; c: R=-0.0473, p=0.744, n=50
== 000041 sigma over episodes: a: R=0.269, p=5.2e-09, n=456; b: R=0.156, p=1.53e-52, n=9492; c: R=0.663, p=1.6e-07, n=50
== 000041 sigma over packets: b: R=0.168, p=4.76e-58, n=9002; c: R=0.467, p=0.000631, n=50
== 000041 gamma over episodes: a: R=-0.143, p=0.00216, n=456; b: R=-0.0709, p=4.51e-12, n=9492; c: R=0.1, p=0.489, n=50
== 000041 gamma over packets: b: R=-0.00794, p=0.451, n=9002; c: R=0.374, p=0.00738, n=50
== crcns-fcx-1 delta over episodes: a: R=0.213, p=1.29e-08, n=701; b: R=0.195, p=3.91e-101, n=11782; c: R=0.622, p=1.46e-06, n=50
== crcns-fcx-1 delta over packets: b: R=0.222, p=1.98e-119, n=10649; c: R=0.37, p=0.00813, n=50
== crcns-fcx-1 delta14 over episodes: a: R=0.242, p=9.21e-11, n=701; b: R=0.201, p=1.06e-107, n=11782; c: R=0.619, p=1.66e-06, n=50
== crcns-fcx-1 delta14 over packets: b: R=0.241, p=2.07e-140, n=10649; c: R=0.354, p=0.0117, n=50
== crcns-fcx-1 sigma over episodes: a: R=0.222, p=2.6e-09, n=701; b: R=0.191, p=5.72e-97, n=11782; c: R=0.893, p=2.75e-18, n=50
== crcns-fcx-1 sigma over packets: b: R=0.265, p=7.45e-171, n=10649; c: R=0.859, p=1.36e-15, n=50
== crcns-fcx-1 gamma over episodes: a: R=-0.191, p=3.32e-07, n=701; b: R=-0.119, p=3.64e-38, n=11782; c: R=-0.308, p=0.0298, n=50
== crcns-fcx-1 gamma over packets: b: R=-0.0316, p=0.00109, n=10649; c: R=0.241, p=0.0924, n=50
Result: reproduced. CRCNS, reading c: over episodes delta (R = 0.622) and sigma (0.893) rise and gamma falls (R = -0.308, p = 0.030); over packets delta (0.370, p = 0.0081) and sigma (0.859) rise and gamma does not change (R = 0.241, p = 0.092). Under reading b gamma over packets changes (p = 0.0011). DANDI, reading b, the same six hold (gamma over packets R = -0.008, p = 0.45). With delta 1 to 4 Hz the results are the same.
fig4-delta-packet-length¶
Mean delta power within whole packets, normalized by nonREM delta power, is positively correlated with packet length (R = 0.31).
Source: Results, Firing rate and LFP changes within nonREM episodes and packets, paragraph 2. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
for b in ["delta", "delta14"]:
x, y = [], []
for s in D[ds]:
if "bpn_" + b not in s["G"]: continue
for p in W.state_pieces(s, "nrem"):
x.append(p[1] - p[0]); y.append(W.gmean(s, "bpn_" + b, [p]))
x, y = np.array(x), np.array(y); ok = np.isfinite(y)
r = stats.pearsonr(x[ok], y[ok])
pr(f"== {ds} {b}: packet mean power / session nonREM mean against packet duration R={r[0]:.3f} p={fmt(r[1])} n={ok.sum()}")
== 000041 delta: packet mean power / session nonREM mean against packet duration R=0.253 p=4.37e-08 n=456 == 000041 delta14: packet mean power / session nonREM mean against packet duration R=0.426 p=1.68e-21 n=456 == crcns-fcx-1 delta: packet mean power / session nonREM mean against packet duration R=0.166 p=1e-05 n=701 == crcns-fcx-1 delta14: packet mean power / session nonREM mean against packet duration R=0.405 p=5.2e-29 n=701
Result: reproduced. Normalized packet delta power correlates with packet duration: CRCNS R = 0.166, p = 1e-5; DANDI R = 0.253, p = 4.4e-8 (delta 1 to 4 Hz: 0.405 and 0.426). Paper R = 0.31.
fig4-late-packet-sigma-delta¶
In the final portion of nonREM packets, the positive correlation between delta and sigma power gives way to a sudden increase of sigma power with a concurrent decrease of delta power.
Source: Results, Firing rate and LFP changes within nonREM episodes and packets, paragraph 3; Figure 4A-B i. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
for rd in ["a", "b"]:
ds_, dd_, cf, cr = [], [], [], []
for s in D[ds]:
if "bpz_sigma" not in s["G"]: continue
G = s["G"]
for p in W.state_pieces(s, "nrem"):
a, b = int(np.ceil(p[0])), int(np.floor(p[1]))
L = 20 if rd == "a" else max(2, (b - a) // 10)
if b - a < 2 * L + 2: continue
fin = np.arange(b - L, b); pre = np.arange(b - 2 * L, b - L); rest = np.arange(a, b - L)
sg, dl = G["bpz_sigma"], G["bpz_delta"]
ds_.append(np.nanmean(sg[fin]) - np.nanmean(sg[pre])); dd_.append(np.nanmean(dl[fin]) - np.nanmean(dl[pre]))
if L >= 5 and len(rest) >= 5:
cf.append(nancorr(sg[fin], dl[fin])); cr.append(nancorr(sg[rest], dl[rest]))
ds_, dd_ = np.array(ds_), np.array(dd_)
cf, cr = np.array(cf), np.array(cr); ok = np.isfinite(cf) & np.isfinite(cr)
pr(f"== {ds} reading {rd}: packets {len(ds_)}; sigma final minus preceding {np.nanmean(ds_):+.3f} SD (signed-rank p={fmt(stats.wilcoxon(ds_).pvalue)}), "
f"delta {np.nanmean(dd_):+.3f} SD (p={fmt(stats.wilcoxon(dd_).pvalue)}); delta-sigma correlation in the rest {np.mean(cr[ok]):.3f}, in the final portion "
f"{np.mean(cf[ok]):.3f} (n={ok.sum()}, signed-rank p={fmt(stats.wilcoxon(cf[ok], cr[ok]).pvalue)})")
== 000041 reading a: packets 407; sigma final minus preceding -0.163 SD (signed-rank p=2.2e-06), delta -0.602 SD (p=5.82e-39); delta-sigma correlation in the rest 0.135, in the final portion 0.313 (n=407, signed-rank p=2.54e-20)
== 000041 reading b: packets 456; sigma final minus preceding -0.216 SD (signed-rank p=2.65e-07), delta -0.568 SD (p=1.2e-36); delta-sigma correlation in the rest 0.134, in the final portion 0.282 (n=379, signed-rank p=4.07e-12)
== crcns-fcx-1 reading a: packets 606; sigma final minus preceding +0.148 SD (signed-rank p=6.45e-13), delta -0.338 SD (p=1.81e-34); delta-sigma correlation in the rest 0.129, in the final portion 0.162 (n=606, signed-rank p=0.0181)
== crcns-fcx-1 reading b: packets 701; sigma final minus preceding -0.038 SD (signed-rank p=0.605), delta -0.366 SD (p=7.88e-34); delta-sigma correlation in the rest 0.120, in the final portion 0.179 (n=552, signed-rank p=0.000813)
Result: partially reproduced. CRCNS, reading a (last 20 s): sigma rises (+0.148 SD, p = 6.5e-13) and delta falls (-0.338 SD, p = 1.8e-34) against the preceding 20 s, but the delta-sigma correlation is higher in the final portion (0.162) than in the rest (0.129). Reading b gives no sigma rise. On DANDI sigma falls under both readings (-0.163 and -0.216 SD).
fig4-updown-within-packets¶
Within packets UP and DOWN incidence increase, UP duration decreases and DOWN duration increases, so the UP/DOWN ratio falls.
Source: Results, Firing rate and LFP changes within nonREM episodes and packets, paragraph 2; Figure 4A-B ii. The criterion and its readings are in the claims file; the code below runs each reading it names.
def ud_ratio_a(s, sub):
a, n = W.gsum(s, "up_dur", sub); b, m = W.gsum(s, "dn_dur", sub)
nu, _ = W.gsum(s, "up_n", sub); nd, _ = W.gsum(s, "dn_n", sub)
return (a / nu) / (b / nd) if nu > 0 and nd > 0 and b > 0 else None
def ud_ratio_b(s, sub):
a, _ = W.gsum(s, "up_occ", sub); b, _ = W.gsum(s, "dn_occ", sub)
return a / b if b > 0 else None
for ds in DS:
ss = [s for s in D[ds] if s["cycles"] and len(s.get("up", []))]
for nm, fn in UDF + [("UP/DOWN ratio a (durations)", ud_ratio_a), ("UP/DOWN ratio b (time)", ud_ratio_b)]:
pr(f"== {ds} {nm} over packets:", rp(W.norm_corr(ss, "packet", fn, readings=("b", "c"))))
== 000041 UP incidence over packets: b: R=0.0309, p=0.00336, n=9002; c: R=0.15, p=0.299, n=50
== 000041 DOWN incidence over packets: b: R=0.174, p=2.74e-62, n=9002; c: R=0.257, p=0.0712, n=50
== 000041 DOWN duration over packets: b: R=0.143, p=3.32e-40, n=8494; c: R=0.508, p=0.000166, n=50
== 000041 UP duration over packets: b: R=-0.0944, p=1.01e-14, n=6696; c: R=-0.49, p=0.000305, n=50
== 000041 other fraction over packets: b: R=-0.132, p=2.73e-36, n=9002; c: R=-0.103, p=0.476, n=50
== 000041 UP/DOWN ratio a (durations) over packets: b: R=-0.13, p=9.34e-27, n=6693; c: R=-0.496, p=0.00025, n=50
== 000041 UP/DOWN ratio b (time) over packets: b: R=-0.0134, p=0.217, n=8506; c: R=0.27, p=0.0579, n=50
== crcns-fcx-1 UP incidence over packets: b: R=0.0423, p=1.29e-05, n=10649; c: R=0.449, p=0.00107, n=50
== crcns-fcx-1 DOWN incidence over packets: b: R=0.168, p=3.78e-68, n=10649; c: R=0.473, p=0.000529, n=50
== crcns-fcx-1 DOWN duration over packets: b: R=0.19, p=5.77e-83, n=10121; c: R=0.565, p=1.89e-05, n=50
== crcns-fcx-1 UP duration over packets: b: R=-0.101, p=5.66e-21, n=8538; c: R=-0.311, p=0.0278, n=50
== crcns-fcx-1 other fraction over packets: b: R=-0.176, p=1.49e-74, n=10649; c: R=-0.527, p=8.51e-05, n=50
== crcns-fcx-1 UP/DOWN ratio a (durations) over packets: b: R=-0.157, p=4.51e-48, n=8533; c: R=-0.371, p=0.00802, n=50
== crcns-fcx-1 UP/DOWN ratio b (time) over packets: b: R=-0.0345, p=0.000517, n=10126; c: R=0.205, p=0.153, n=50
Result: reproduced. CRCNS, reading b: UP incidence (R = 0.042, p = 1.3e-5) and DOWN incidence (0.168) increase, UP duration decreases (-0.101) and DOWN duration increases (0.190), and the UP/DOWN duration ratio falls (-0.157): all five hold at their bounds. DANDI: four hold; UP incidence rises with p = 0.0034, above its 1e-3 bound.
fig4-spindles-within-nrem¶
Spindle incidence and duration increase within nonREM episodes and packets (duration 0.61 to 0.67 s in episodes, 0.58 to 0.67 s in packets), while spindle frequency and amplitude do not change.
Source: Results, Firing rate and LFP changes within nonREM episodes and packets, paragraph 2; Figure 4A-B iii. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
ss = [s for s in D[ds] if s["cycles"] and "sp_n" in s["G"]]
for kind in ["episode", "packet"]:
for nm, fn in [("incidence", gratio("sp_n", per_min=True)), ("duration", gratio("sp_dur", "sp_n")),
("frequency", gratio("sp_freq", "sp_nf")), ("amplitude", gratio("sp_amp", "sp_n"))]:
pr(f"== {ds} spindle {nm} over {kind}s:", rp(W.norm_corr(ss, kind, fn, readings=("b", "c"))))
for frac in [0.1, 1 / 3]:
early, late = [], []
for s in ss:
sp = s["spindles"]; st = np.asarray(sp["start"]); du = np.asarray(sp["dur"])
for seg in W.segments(s, kind):
a, b = seg[0, 0], seg[0, 1]; L = (b - a) * frac
early += list(du[(st >= a) & (st < a + L)]); late += list(du[(st >= b - L) & (st < b)])
pr(f" duration in first and last {'tenth' if frac == 0.1 else 'third'} of {kind}s: {np.mean(early):.3f} +- {np.std(early):.3f} s (n={len(early)}) "
f"to {np.mean(late):.3f} +- {np.std(late):.3f} s (n={len(late)})")
== 000041 spindle incidence over episodes: b: R=0.095, p=1.78e-20, n=9492; c: R=0.483, p=0.00038, n=50
== 000041 spindle duration over episodes: b: R=0.0487, p=0.000203, n=5804; c: R=0.375, p=0.0073, n=50
== 000041 spindle frequency over episodes: b: R=-0.0354, p=0.007, n=5804; c: R=-0.419, p=0.00243, n=50
== 000041 spindle amplitude over episodes: b: R=0.0354, p=0.00694, n=5804; c: R=0.298, p=0.0357, n=50 duration in first and last tenth of episodes: 0.460 +- 0.251 s (n=1002) to 0.519 +- 0.324 s (n=1451) duration in first and last third of episodes: 0.452 +- 0.236 s (n=3133) to 0.478 +- 0.287 s (n=3787)
== 000041 spindle incidence over packets: b: R=0.12, p=2.18e-30, n=9002; c: R=0.558, p=2.56e-05, n=50
== 000041 spindle duration over packets: b: R=0.07, p=1.07e-07, n=5744; c: R=0.463, p=0.000714, n=50
== 000041 spindle frequency over packets: b: R=-0.0194, p=0.142, n=5744; c: R=-0.253, p=0.0767, n=50
== 000041 spindle amplitude over packets: b: R=0.0581, p=1.07e-05, n=5744; c: R=0.492, p=0.000286, n=50 duration in first and last tenth of packets: 0.456 +- 0.253 s (n=958) to 0.530 +- 0.331 s (n=1355) duration in first and last third of packets: 0.450 +- 0.239 s (n=3092) to 0.482 +- 0.287 s (n=3869)
== crcns-fcx-1 spindle incidence over episodes: b: R=0.0962, p=1.29e-25, n=11782; c: R=0.77, p=6.05e-11, n=50
== crcns-fcx-1 spindle duration over episodes: b: R=0.0794, p=1.06e-06, n=3767; c: R=0.468, p=0.000616, n=50
== crcns-fcx-1 spindle frequency over episodes: b: R=-0.0255, p=0.117, n=3767; c: R=-0.231, p=0.106, n=50
== crcns-fcx-1 spindle amplitude over episodes: b: R=0.0131, p=0.423, n=3767; c: R=0.0408, p=0.778, n=50 duration in first and last tenth of episodes: 0.597 +- 0.304 s (n=420) to 0.650 +- 0.359 s (n=889) duration in first and last third of episodes: 0.587 +- 0.286 s (n=1508) to 0.632 +- 0.339 s (n=2100)
== crcns-fcx-1 spindle incidence over packets: b: R=0.142, p=2.7e-49, n=10649; c: R=0.786, p=1.42e-11, n=50
== crcns-fcx-1 spindle duration over packets: b: R=0.0903, p=4.27e-08, n=3666; c: R=0.568, p=1.69e-05, n=50
== crcns-fcx-1 spindle frequency over packets: b: R=-0.0422, p=0.0106, n=3666; c: R=-0.315, p=0.0259, n=50
== crcns-fcx-1 spindle amplitude over packets: b: R=0.0234, p=0.157, n=3666; c: R=0.195, p=0.176, n=50 duration in first and last tenth of packets: 0.603 +- 0.294 s (n=372) to 0.651 +- 0.334 s (n=922) duration in first and last third of packets: 0.593 +- 0.299 s (n=1348) to 0.636 +- 0.337 s (n=2263)
Result: partially reproduced. Spindle incidence and duration increase within episodes and packets (CRCNS reading b: incidence R = 0.096 and 0.142, duration 0.079 and 0.090, each below its bound), and the durations in the first and last tenth (0.597 to 0.650 s in episodes, 0.603 to 0.651 s in packets) are within tolerance. Frequency changes over packets (CRCNS p = 0.011 under b, 0.026 under c), so that absence fails under every reading.
fig4e-late-packet-sigma¶
UP states late in nonREM packets have more sigma power than UP states early in packets.
Source: Results, Firing rate and LFP changes within nonREM episodes and packets, paragraphs 3 and 6; Figure 4E; Figure S4B and S4D and legends. The criterion and its readings are in the claims file; the code below runs each reading it names.
def up_sigma(s, up, reading):
ts = s["short_t"]; v = np.log(s["short"]["sigma"] + 1e-12)
k = W.secs(W.state_pieces(s, "nrem")); inn = np.isin(ts.astype(int), k)
v = (v - v[inn].mean()) / v[inn].std()
out = []
for a, b in up:
if reading == "a":
m = (ts >= a) & (ts < b)
else:
m = (ts >= a) & (ts < a + 1.0)
out.append(v[m].mean() if m.any() else np.nan)
return np.array(out)
for ds in DS:
for rd in ["a", "b"]:
E_, L_ = [], []
for s in D[ds]:
if "short" not in s or not s["cycles"]: continue
up = np.asarray(s.get("up", np.zeros((0, 2)))).reshape(-1, 2)
up = up[(up[:, 1] - up[:, 0]) > (0.5 if rd == "a" else 0.999)]
for p in W.state_pieces(s, "nrem"):
L = (p[1] - p[0]) / 3
e = up[(up[:, 0] >= p[0]) & (up[:, 1] <= p[0] + L)]; l = up[(up[:, 0] >= p[1] - L) & (up[:, 1] <= p[1])]
if len(e): E_.append(up_sigma(s, e, rd))
if len(l): L_.append(up_sigma(s, l, rd))
E_, L_ = np.concatenate(E_), np.concatenate(L_)
E_, L_ = E_[np.isfinite(E_)], L_[np.isfinite(L_)]
r = stats.mannwhitneyu(L_, E_)
pr(f"== {ds} reading {rd}: UP-state sigma (z) first third {np.mean(E_):.3f} (n={len(E_)}), last third {np.mean(L_):.3f} (n={len(L_)}); rank-sum p={fmt(r.pvalue)}")
# S4B per-pixel map, coarse: UP states over 500 ms, 5 bins of normalized UP time x the two short-window
# bands (z-scored log power over nonREM); Welch t-test of last-third against first-third UP states
# per pixel. The 200 ms windows give 5 Hz resolution, so the map has two bands, not a spectrum.
def up_map(s, up, nb=5):
ts = s["short_t"]; k = W.secs(W.state_pieces(s, "nrem")); inn = np.isin(ts.astype(int), k)
Z = []
for b_ in ["sigma", "gamma"]:
v = np.log(s["short"][b_] + 1e-12); Z.append((v - v[inn].mean()) / v[inn].std())
out = np.full((len(up), 2, nb), np.nan)
i0 = np.searchsorted(ts, up[:, 0]); i1 = np.searchsorted(ts, up[:, 1])
for u, (a, b) in enumerate(up):
idx = np.arange(i0[u], i1[u])
if len(idx) == 0: continue
bi = np.minimum(((ts[idx] - a) / (b - a) * nb).astype(int), nb - 1)
for j in range(2):
out[u, j] = [Z[j][idx[bi == q]].mean() if (bi == q).any() else np.nan for q in range(nb)]
return out
for ds in DS:
E_, L_ = [], []
for s in D[ds]:
if "short" not in s or not s["cycles"]: continue
up = np.asarray(s.get("up", np.zeros((0, 2)))).reshape(-1, 2); up = up[(up[:, 1] - up[:, 0]) > 0.5]
for p in W.state_pieces(s, "nrem"):
L = (p[1] - p[0]) / 3
e = up[(up[:, 0] >= p[0]) & (up[:, 1] <= p[0] + L)]; l = up[(up[:, 0] >= p[1] - L) & (up[:, 1] <= p[1])]
if len(e): E_.append(up_map(s, e))
if len(l): L_.append(up_map(s, l))
E_, L_ = np.concatenate(E_), np.concatenate(L_)
for j, b_ in enumerate(["sigma 9-25 Hz", "gamma 40-100 Hz"]):
cells_ = []
for q in range(5):
x, y = L_[:, j, q], E_[:, j, q]; x, y = x[np.isfinite(x)], y[np.isfinite(y)]
t = stats.ttest_ind(x, y, equal_var=False)
cells_.append(f"t={t.statistic:.1f} p={fmt(t.pvalue)}")
pr(f"== {ds} S4B map, {b_}, late minus early by fifth of UP time: " + " | ".join(cells_))
== 000041 reading a: UP-state sigma (z) first third 0.007 (n=4771), last third 0.130 (n=4938); rank-sum p=1.26e-33
== 000041 reading b: UP-state sigma (z) first third 0.052 (n=1442), last third 0.211 (n=1310); rank-sum p=1.92e-15
== crcns-fcx-1 reading a: UP-state sigma (z) first third -0.095 (n=6311), last third 0.086 (n=6816); rank-sum p=0
== crcns-fcx-1 reading b: UP-state sigma (z) first third -0.066 (n=1811), last third 0.161 (n=1709); rank-sum p=3.19e-33
== 000041 S4B map, sigma 9-25 Hz, late minus early by fifth of UP time: t=4.3 p=2.05e-05 | t=6.3 p=3.32e-10 | t=8.8 p=1.36e-18 | t=9.0 p=3.17e-19 | t=8.2 p=3.25e-16 == 000041 S4B map, gamma 40-100 Hz, late minus early by fifth of UP time: t=0.2 p=0.813 | t=2.0 p=0.048 | t=2.1 p=0.0348 | t=2.3 p=0.021 | t=1.8 p=0.0654
== crcns-fcx-1 S4B map, sigma 9-25 Hz, late minus early by fifth of UP time: t=9.3 p=1.02e-20 | t=13.3 p=7.84e-40 | t=14.2 p=2.81e-45 | t=13.5 p=2.83e-41 | t=12.0 p=3.66e-33 == crcns-fcx-1 S4B map, gamma 40-100 Hz, late minus early by fifth of UP time: t=-1.0 p=0.32 | t=5.3 p=1.17e-07 | t=4.0 p=6.03e-05 | t=5.0 p=5.81e-07 | t=5.0 p=7.47e-07
Result: reproduced. UP states in the last third of packets have more sigma power than in the first third: CRCNS mean z 0.086 against -0.095 (reading a, rank-sum p below 1e-300), and 0.161 against -0.066 under reading b (p = 3.2e-33). In the coarse S4B map (5 bins of UP time, two bands), sigma is higher late in every bin (t = 9.3 to 14.2) and gamma in four of five. DANDI agrees (p = 1.3e-33 and 1.9e-15).
fig4iv-sextiles-within-nrem¶
Within both nonREM episodes and nonREM packets, the fastest sextiles decrease their rates while the slowest increase.
Source: Results, Firing rate and LFP changes within nonREM episodes and packets, paragraph 4; Figure 4A-B iv. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
ss = [s for s in D[ds] if s["cycles"]]
for kind in ["episode", "packet"]:
for q in [5, 0]:
pr(f"== {ds} {kind}s, {'top' if q==5 else 'bottom'} sextile:", rp(W.norm_corr(ss, kind, sext_rate(q), readings=("a", "b", "c"))))
== 000041 episodes, top sextile: a: R=-0.121, p=0.0234, n=351; b: R=-0.107, p=4.6e-21, n=7677; c: R=-0.506, p=0.000176, n=50
== 000041 episodes, bottom sextile: a: R=0.0931, p=0.0481, n=451; b: R=0.0687, p=2.71e-11, n=9380; c: R=0.559, p=2.46e-05, n=50
== 000041 packets, top sextile: b: R=-0.109, p=1.18e-20, n=7292; c: R=-0.439, p=0.00144, n=50
== 000041 packets, bottom sextile: b: R=0.079, p=8.49e-14, n=8891; c: R=0.703, p=1.26e-08, n=50
== crcns-fcx-1 episodes, top sextile: a: R=-0.174, p=3.21e-05, n=566; b: R=-0.136, p=6.47e-40, n=9410; c: R=-0.785, p=1.55e-11, n=50
== crcns-fcx-1 episodes, bottom sextile: a: R=0.0663, p=0.102, n=611; b: R=0.0381, p=0.000111, n=10279; c: R=0.494, p=0.000262, n=50
== crcns-fcx-1 packets, top sextile: b: R=-0.146, p=1.28e-41, n=8458; c: R=-0.643, p=4.85e-07, n=50
== crcns-fcx-1 packets, bottom sextile: b: R=0.0443, p=1.97e-05, n=9275; c: R=0.703, p=1.26e-08, n=50
Result: reproduced. Reading b (10 s bins): the top sextile decreases and the bottom increases within episodes (CRCNS R = -0.136 and 0.038) and within packets (-0.146 and 0.044), all p < 1e-3. DANDI agrees (-0.107 and 0.069; -0.109 and 0.079).
fig4v-cv-within-nrem¶
The coefficient of variation of binned population firing rates decreases within nonREM episodes (R = -0.13) and packets (R = -0.12).
Source: Results, Firing rate and LFP changes within nonREM episodes and packets, paragraph 4; Figure 4A-B v and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
ss = [s for s in D[ds] if s["cycles"]]
for kind in ["episode", "packet"]:
pr(f"== {ds} CV over {kind}s:", rp(W.norm_corr(ss, kind, cv_fn, readings=("b", "c"))))
== 000041 CV over episodes: b: R=-0.0794, p=5.2e-15, n=9673; c: R=-0.478, p=0.000446, n=50
== 000041 CV over packets: b: R=-0.0805, p=1.2e-14, n=9167; c: R=-0.238, p=0.0962, n=50
== crcns-fcx-1 CV over episodes: b: R=-0.113, p=6.84e-35, n=11782; c: R=-0.792, p=7.28e-12, n=50
== crcns-fcx-1 CV over packets: b: R=-0.139, p=6.63e-47, n=10649; c: R=-0.702, p=1.37e-08, n=50
Result: reproduced. The normalized CV decreases within episodes (CRCNS R = -0.113, p = 6.8e-35) and packets (R = -0.139, p = 6.6e-47), below 1e-10. DANDI agrees (R = -0.079 and -0.081, p < 1e-13).
fig4vi-burst-within-nrem¶
The 15 ms burst index of pE cells increases within nonREM episodes (R = 0.09) and packets (R = 0.08).
Source: Results, Firing rate and LFP changes within nonREM episodes and packets, paragraph 4; Figure 4A-B vi and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
def burst_a(s, sub):
if len(s["E"]) == 0: return None
n, sh = W.isi_counts(s, s["E"], sub)
v = sh[n > 0] / n[n > 0]
return v.mean() if len(v) else None
def burst_pooled(s, sub):
n, sh = W.isi_counts(s, s["E"], sub)
return sh.sum() / n.sum() if n.sum() > 0 else None
for ds in DS:
ss = [s for s in D[ds] if s["cycles"] and len(s["E"])]
for kind in ["episode", "packet"]:
pr(f"== {ds} burst ratio over {kind}s, mean over cells per bin:", rp(W.norm_corr(ss, kind, burst_a, readings=("b", "c"))))
pr(f" variant, spikes of all pE cells pooled per bin:", rp(W.norm_corr(ss, kind, burst_pooled, readings=("b",))))
== 000041 burst ratio over episodes, mean over cells per bin: b: R=0.0601, p=3.41e-09, n=9673; c: R=0.391, p=0.005, n=50
variant, spikes of all pE cells pooled per bin: b: R=0.0703, p=4.6e-12, n=9673
== 000041 burst ratio over packets, mean over cells per bin: b: R=0.0465, p=8.31e-06, n=9167; c: R=0.249, p=0.0812, n=50
variant, spikes of all pE cells pooled per bin: b: R=0.071, p=9.85e-12, n=9167
== crcns-fcx-1 burst ratio over episodes, mean over cells per bin: b: R=0.0807, p=1.72e-18, n=11782; c: R=0.792, p=7.61e-12, n=50
variant, spikes of all pE cells pooled per bin: b: R=0.1, p=8.29e-28, n=11782
== crcns-fcx-1 burst ratio over packets, mean over cells per bin: b: R=0.0785, p=5.07e-16, n=10649; c: R=0.613, p=2.25e-06, n=50
variant, spikes of all pE cells pooled per bin: b: R=0.104, p=5.43e-27, n=10649
Result: reproduced. With ISIs counted from spike times, the normalized burst ratio (mean over pE cells per 10 s bin) increases within episodes (CRCNS R = 0.081, p = 1.7e-18) and packets (R = 0.079, p = 5.1e-16), below 1e-10; pooling the spikes of all cells gives R = 0.100 and 0.104. DANDI: R = 0.060 (p = 3.4e-9) and 0.047 (p = 8.3e-6), positive but above the bound.
fig4cd-packet-rate-lfp-correlations¶
Across packets, the top sextile's rate correlates negatively with delta power, DOWN duration and DOWN incidence and positively with UP duration and gamma power, and the bottom sextile's rate correlates positively with sigma power in the last 20 s of the packet; other combinations are not significant.
Source: Results, Firing rate and LFP changes within nonREM episodes and packets, paragraph 5; Figure 4C and 4D and legends. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
rows = []
for s in D[ds]:
if not s["cycles"] or "bpz_delta" not in s["G"] or not len(s.get("up", [])): continue
recs = []
for c in s["cycles"]:
pk = c["packets"]
if len(pk) == 0: continue
rt = {q: np.array([np.nanmean(W.cell_rates(s, [p], s["E"][s["sextile"] == q])[0]) if (s["sextile"] == q).any() else np.nan for p in pk]) for q in (0, 5)}
for q in rt: rt[q] = rt[q] / np.nanmean(rt[q]) if np.nanmean(rt[q]) > 0 else rt[q] * np.nan
for j, p in enumerate(pk):
nu, n = W.gsum(s, "up_n", [p]); nd, _ = W.gsum(s, "dn_n", [p])
du, _ = W.gsum(s, "up_dur", [p]); dd, _ = W.gsum(s, "dn_dur", [p])
last = [[max(p[0], p[1] - 20), p[1]]]
recs.append([rt[5][j], rt[0][j], W.gmean(s, "bpz_delta", [p]), dd / nd if nd else np.nan, nd / n * 60 if n else np.nan,
du / nu if nu else np.nan, W.gmean(s, "bpz_gamma", [p]), W.gmean(s, "bpz_sigma", last)])
recs = np.array(recs)
for col in [3, 4, 5]: # z-score the per-packet slow-wave metrics within session
v = recs[:, col]; recs[:, col] = (v - np.nanmean(v)) / np.nanstd(v)
rows.append(recs)
R = np.concatenate(rows)
names = ["delta power", "DOWN duration", "DOWN incidence", "UP duration", "gamma power", "sigma last 20 s"]
out = []
for gi, g in [(0, "top"), (1, "bottom")]:
for j, nm in enumerate(names):
x, y = R[:, gi], R[:, 2 + j]; ok = np.isfinite(x) & np.isfinite(y)
r = stats.pearsonr(x[ok], y[ok]); out.append(f"{g}~{nm}: R={r[0]:.3f} p={fmt(r[1])} n={ok.sum()}")
pr(f"== {ds} ({len(rows)} sessions): " + "; ".join(out))
== 000041 (20 sessions): top~delta power: R=-0.328 p=5.15e-10 n=341; top~DOWN duration: R=-0.343 p=7.63e-11 n=341; top~DOWN incidence: R=-0.368 p=2.1e-12 n=341; top~UP duration: R=0.233 p=1.54e-05 n=338; top~gamma power: R=0.288 p=5.85e-08 n=341; top~sigma last 20 s: R=-0.110 p=0.0425 n=341; bottom~delta power: R=0.016 p=0.737 n=441; bottom~DOWN duration: R=0.050 p=0.299 n=436; bottom~DOWN incidence: R=0.179 p=0.000157 n=441; bottom~UP duration: R=0.043 p=0.41 n=377; bottom~gamma power: R=-0.047 p=0.321 n=441; bottom~sigma last 20 s: R=0.155 p=0.00106 n=441
== crcns-fcx-1 (27 sessions): top~delta power: R=-0.144 p=0.000605 n=566; top~DOWN duration: R=-0.365 p=4.45e-19 n=560; top~DOWN incidence: R=-0.316 p=1.5e-14 n=566; top~UP duration: R=0.203 p=1.29e-06 n=560; top~gamma power: R=0.257 p=5.71e-10 n=566; top~sigma last 20 s: R=-0.178 p=2.07e-05 n=566; bottom~delta power: R=0.016 p=0.699 n=611; bottom~DOWN duration: R=0.054 p=0.188 n=601; bottom~DOWN incidence: R=0.061 p=0.13 n=611; bottom~UP duration: R=0.056 p=0.188 n=546; bottom~gamma power: R=-0.022 p=0.587 n=611; bottom~sigma last 20 s: R=0.183 p=5.6e-06 n=611
Result: not reproduced. On CRCNS all six correlations have the paper's sign at p < 0.05, but only DOWN duration (R = -0.365, p = 4.5e-19), DOWN incidence (-0.316, 1.5e-14) and UP duration (0.203, 1.3e-6) meet their bounds; delta (R = -0.144, p = 6e-4 against 1e-10), gamma (0.257, 5.7e-10 against 1e-10) and bottom-sextile late sigma (0.183, 5.6e-6 against 1e-10) do not. A correlation holds when it meets M4's reproduced level (sign and bound), so three of six hold, fewer than the four needed for partial. The four absences hold. Counting a correlation at p < 0.05 as holding, all six would hold and the claim would be reproduced.
fig4e-within-up-sextiles¶
Within UP states, from early to later parts of packets, the fastest sextile's rate drops, interneuron rate increases, and the slowest sextile decreases slightly.
Source: Results, Firing rate and LFP changes within nonREM episodes and packets, paragraph 6; Figure 4E, bottom, and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
for rd in ["a", "b"]:
res = {}
for nm, sel in [("top sextile", lambda s: s["E"][s["sextile"] == 5]), ("pI", lambda s: s["I"]), ("bottom sextile", lambda s: s["E"][s["sextile"] == 0])]:
ue, ul, ce, cl = [], [], [], []
for s in D[ds]:
cells = sel(s)
if not s["cycles"] or len(cells) == 0 or not len(s.get("up", [])): continue
up = np.asarray(s["up"]).reshape(-1, 2)
sp = [s["spikes"][i] for i in cells]
for p in W.state_pieces(s, "nrem"):
L = (p[1] - p[0]) / 3
e = up[(up[:, 0] >= p[0]) & (up[:, 1] <= p[0] + L)]
l = up[(up[:, 0] >= p[0] + L) & (up[:, 1] <= p[0] + 2 * L)] if rd == "a" else up[(up[:, 0] >= p[1] - L) & (up[:, 1] <= p[1])]
for U, lst, cl_ in [(e, ue, ce), (l, ul, cl)]:
if len(U) == 0: cl_.append(np.full(len(cells), np.nan)); continue
n = np.array([np.searchsorted(t, U[:, 1]) - np.searchsorted(t, U[:, 0]) for t in sp]) # cells x UPs
d = U[:, 1] - U[:, 0]
lst += list(n.mean(0) / d)
cl_.append(n.sum(1) / d.sum())
ce, cl = np.nanmean(np.array(ce), 0) if False else np.concatenate(ce), np.concatenate(cl)
ui = stats.mannwhitneyu(ul, ue)
ok_e, ok_l = np.isfinite(ce), np.isfinite(cl)
ci = stats.mannwhitneyu(cl[ok_l], ce[ok_e])
res[nm] = f"(i) per UP mean {np.mean(ue):.3f} to {np.mean(ul):.3f} Hz, rank-sum p={fmt(ui.pvalue)} (n {len(ue)}, {len(ul)}); (ii) per cell and packet {np.nanmean(ce):.3f} to {np.nanmean(cl):.3f}, p={fmt(ci.pvalue)}"
pr(f"== {ds} reading {rd} ({'first vs second third' if rd=='a' else 'first vs last third'}): " + " | ".join(f"{k}: {v}" for k, v in res.items()))
== 000041 reading a (first vs second third): top sextile: (i) per UP mean 2.789 to 2.808 Hz, rank-sum p=0.643 (n 9489, 12156); (ii) per cell and packet 2.874 to 2.775, p=0.0506 | pI: (i) per UP mean 11.882 to 12.147 Hz, rank-sum p=0.365 (n 9402, 12005); (ii) per cell and packet 8.709 to 8.989, p=0.553 | bottom sextile: (i) per UP mean 0.267 to 0.289 Hz, rank-sum p=0.742 (n 9232, 11772); (ii) per cell and packet 0.207 to 0.241, p=8.13e-05
== 000041 reading b (first vs last third): top sextile: (i) per UP mean 2.789 to 2.719 Hz, rank-sum p=0.00513 (n 9489, 10760); (ii) per cell and packet 2.874 to 2.766, p=0.0351 | pI: (i) per UP mean 11.882 to 12.628 Hz, rank-sum p=0.00439 (n 9402, 10664); (ii) per cell and packet 8.709 to 9.191, p=0.591 | bottom sextile: (i) per UP mean 0.267 to 0.309 Hz, rank-sum p=9.52e-05 (n 9232, 10388); (ii) per cell and packet 0.207 to 0.253, p=0.000241
== crcns-fcx-1 reading a (first vs second third): top sextile: (i) per UP mean 3.427 to 3.374 Hz, rank-sum p=8.23e-06 (n 12520, 14797); (ii) per cell and packet 3.007 to 2.939, p=0.193 | pI: (i) per UP mean 13.119 to 13.664 Hz, rank-sum p=0.00096 (n 12738, 15054); (ii) per cell and packet 8.923 to 9.219, p=0.412 | bottom sextile: (i) per UP mean 0.291 to 0.314 Hz, rank-sum p=0.595 (n 10905, 12899); (ii) per cell and packet 0.248 to 0.284, p=3.4e-06
== crcns-fcx-1 reading b (first vs last third): top sextile: (i) per UP mean 3.427 to 3.401 Hz, rank-sum p=0.0016 (n 12520, 14395); (ii) per cell and packet 3.007 to 2.939, p=0.218 | pI: (i) per UP mean 13.119 to 14.014 Hz, rank-sum p=5.02e-05 (n 12738, 14638); (ii) per cell and packet 8.923 to 9.583, p=0.0496 | bottom sextile: (i) per UP mean 0.291 to 0.334 Hz, rank-sum p=5.18e-07 (n 10905, 12802); (ii) per cell and packet 0.248 to 0.302, p=5.86e-14
Result: not reproduced. CRCNS, per UP state: the top sextile drops (reading a, 3.427 to 3.374 Hz, p = 8.2e-6; reading b, p = 0.0016), never below its 1e-8 bound; pI rises (13.12 to 13.66 Hz, p = 9.6e-4, below its 1e-3 bound; p = 5.0e-5 under b); the slowest sextile rises under every reading (0.291 to 0.314 and 0.334 Hz), opposite to the claim. With a group holding at M4's reproduced level, one of three holds. Counting p < 0.05 as holding, two would hold and the claim would be partial. DANDI: pI and the slowest sextile rise under every reading, as on CRCNS; the top sextile falls under reading b (2.789 to 2.719 Hz, p = 0.0051) and under a(ii) (p = 0.051), and rises slightly under a(i) (2.789 to 2.808 Hz, p = 0.64).
figs5-within-wake-rem¶
Within WAKE the two highest sextiles increase and the two lowest decrease their rates, opposite to nonREM; within REM all sextiles except the fourth increase.
Source: Results, Firing rate and LFP changes within nonREM episodes and packets, last paragraph; Figure S5A and S5B and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
def sext_rate_exact(q, key="sextile"):
def f(s, sub):
cells = s["E"][s[key] == q]
if len(cells) == 0: return None
r = W.exact_rates(s, sub, cells)
return np.nanmean(r) if np.isfinite(r).any() else None
return f
def wake_entry(ds, ss, key):
out = []
for q in range(5, -1, -1):
d = []
for s in ss:
cells = s["E"][s[key] == q]
if len(cells) == 0: continue
for c in s["cycles"]:
a, b = c["wake"]; L = b - a
pre = [[max(0, a - 0.25 * L), a]]; first = [[a, a + 0.1 * L]]
d.append(W.cell_rates(s, first, cells)[0] - W.cell_rates(s, pre, cells)[0])
d = np.concatenate(d); d = d[np.isfinite(d)]
out.append(f"{6-q}: mean {d.mean():+.3f} Hz, p={fmt(stats.wilcoxon(d).pvalue)} n={len(d)}")
return "; ".join(out)
for ds in DS:
ss = [s for s in D[ds] if s["cycles"]]
rem, remx, wk = [], [], []
for q in range(5, -1, -1): # S5 numbering, 1 = highest
rem.append(W.norm_corr(ss, "rem", sext_rate(q), readings=("c",))["c"])
remx.append(W.norm_corr(ss, "rem", sext_rate_exact(q), readings=("c",))["c"])
wk.append(W.norm_corr(ss, "wake", sext_rate(q), readings=("c",))["c"])
pr(f"== {ds} REM (50 bins, exact spike times), S5 sextiles 1..6: " + "; ".join(f"{i+1}: R={r[0]:.3f} p={fmt(r[1])} n={r[2]}" for i, r in enumerate(remx)))
pr(f" REM (50 bins, 1 s grid, seconds centred in the bin): " + "; ".join(f"{i+1}: R={r[0]:.3f} p={fmt(r[1])} n={r[2]}" for i, r in enumerate(rem)))
pr(f" WAKE (a, 50 bins): " + "; ".join(f"{i+1}: R={r[0]:.3f} p={fmt(r[1])}" for i, r in enumerate(wk)))
pr(f" WAKE (b, first tenth minus the quarter-length before): " + wake_entry(ds, ss, "sextile"))
# held-out variant: cells ranked on WAKE without the first tenth of each cycle's WAKE and the period before it
def excl(s):
w = [[max(0, c["wake"][0] - 0.25 * (c["wake"][1] - c["wake"][0])), c["wake"][0] + 0.1 * (c["wake"][1] - c["wake"][0])] for c in s["cycles"]]
return np.array(w).reshape(-1, 2)
W.sextiles(D[ds], exclude=excl, key="sext_ho")
pr(f" WAKE (b), variant with sextiles ranked on WAKE without the test windows: " + wake_entry(ds, ss, "sext_ho"))
== 000041 REM (50 bins, exact spike times), S5 sextiles 1..6: 1: R=0.014 p=0.924 n=50; 2: R=0.119 p=0.411 n=50; 3: R=0.032 p=0.827 n=50; 4: R=0.288 p=0.0424 n=50; 5: R=0.322 p=0.0226 n=50; 6: R=-0.019 p=0.898 n=50 REM (50 bins, 1 s grid, seconds centred in the bin): 1: R=0.070 p=0.63 n=50; 2: R=-0.055 p=0.707 n=50; 3: R=0.036 p=0.804 n=50; 4: R=0.360 p=0.0103 n=50; 5: R=0.160 p=0.267 n=50; 6: R=0.061 p=0.675 n=50 WAKE (a, 50 bins): 1: R=0.259 p=0.0694; 2: R=-0.258 p=0.07; 3: R=0.394 p=0.00468; 4: R=0.343 p=0.0147; 5: R=0.209 p=0.145; 6: R=-0.310 p=0.0286 WAKE (b, first tenth minus the quarter-length before): 1: mean +0.630 Hz, p=1.31e-11 n=299; 2: mean +0.018 Hz, p=0.144 n=304; 3: mean -0.077 Hz, p=0.0461 n=297; 4: mean -0.098 Hz, p=0.00121 n=286; 5: mean -0.099 Hz, p=4.85e-05 n=280; 6: mean -0.066 Hz, p=4.92e-05 n=295 WAKE (b), variant with sextiles ranked on WAKE without the test windows: 1: mean +0.611 Hz, p=6.06e-11 n=300; 2: mean +0.019 Hz, p=0.137 n=304; 3: mean -0.065 Hz, p=0.0529 n=297; 4: mean -0.100 Hz, p=0.00155 n=284; 5: mean -0.095 Hz, p=4.07e-05 n=279; 6: mean -0.065 Hz, p=6.9e-05 n=297
== crcns-fcx-1 REM (50 bins, exact spike times), S5 sextiles 1..6: 1: R=0.047 p=0.746 n=50; 2: R=0.019 p=0.896 n=50; 3: R=0.365 p=0.00915 n=50; 4: R=0.086 p=0.555 n=50; 5: R=0.391 p=0.00495 n=50; 6: R=-0.061 p=0.675 n=50 REM (50 bins, 1 s grid, seconds centred in the bin): 1: R=0.074 p=0.61 n=50; 2: R=-0.059 p=0.684 n=50; 3: R=0.296 p=0.0367 n=50; 4: R=0.059 p=0.685 n=50; 5: R=0.385 p=0.00575 n=50; 6: R=-0.089 p=0.539 n=50 WAKE (a, 50 bins): 1: R=0.120 p=0.406; 2: R=0.432 p=0.00172; 3: R=0.281 p=0.0485; 4: R=0.159 p=0.27; 5: R=0.610 p=2.53e-06; 6: R=-0.307 p=0.0304 WAKE (b, first tenth minus the quarter-length before): 1: mean +0.346 Hz, p=0.000446 n=296; 2: mean +0.013 Hz, p=0.152 n=286; 3: mean -0.122 Hz, p=0.00109 n=312; 4: mean -0.070 Hz, p=0.00391 n=316; 5: mean -0.083 Hz, p=7.97e-06 n=296; 6: mean -0.058 Hz, p=8.37e-05 n=281 WAKE (b), variant with sextiles ranked on WAKE without the test windows: 1: mean +0.314 Hz, p=0.00115 n=293; 2: mean -0.006 Hz, p=0.391 n=291; 3: mean -0.088 Hz, p=0.00258 n=308; 4: mean -0.074 Hz, p=0.00302 n=312; 5: mean -0.060 Hz, p=0.000501 n=305; 6: mean -0.058 Hz, p=8.65e-05 n=278
Result: not reproduced. REM, rates from exact spike times in 50 bins: of the five sextiles other than the fourth, two have a significant positive R on CRCNS (sextiles 3 and 5, R = 0.365 and 0.391); on the 1 s grid the same two. WAKE: reading a gives significant positive R for sextiles 2, 3 and 5 and negative for 6 on CRCNS; reading b (entry change) gives sextile 1 an increase (+0.346 Hz, p = 4.5e-4) and sextile 2 no change (p = 0.15), and the lowest two both decrease; ranking the sextiles on WAKE without the test windows gives the same (sextile 2 p = 0.39). Neither part holds. DANDI: REM two sextiles (4 and 5), WAKE b sextile 2 p = 0.14.
Triplets of sub-states (M6 of the claims file), used by the Figure 5 claims.
# [claim] M6; [paper] Supplemental Experimental Procedures, Spiking metrics: triplets of nonREM packets,
# REM episodes, MAs and WAKE; nonREM-REM-nonREM triplets kept unless a WAKE (> 120 s) follows the REM
# before the second packet. Sequences are built within each SLEEP of a cycle from the packets (N),
# MAs (M), REM (R) and WAKE interruptions of 40-120 s (W).
def sequence(c):
ev = [("N", p) for p in c["packets"]] + [("M", m) for m in c["ma"]] + [("R", r) for r in c["rem"]] + [("W", w) for w in c["wi"]]
ev.sort(key=lambda e: e[1][0])
return ev
def triplets(s, kind, wake_reading="b"):
out = []
for ci, c in enumerate(s["cycles"]):
ev = sequence(c)
L = [e[0] for e in ev]
if kind == "MNM":
for i in range(len(ev) - 2):
if L[i:i + 3] == ["M", "N", "M"]: out.append((ev[i][1], ev[i + 1][1], ev[i + 2][1]))
elif kind == "RNR":
idx = [i for i, l in enumerate(L) if l == "R"]
for a, b in zip(idx[:-1], idx[1:]):
mid = L[a + 1:b]
if mid and all(x in "NM" for x in mid) and "N" in mid:
nn = [ev[k][1] for k in range(a + 1, b) if L[k] == "N"]
out.append((ev[a][1], np.array([nn[0][0], nn[-1][1]]), ev[b][1]))
elif kind in ("NMN", "NWN"):
for i in range(len(ev) - 2):
if L[i:i + 3] == ["N", kind[1], "N"]: out.append((ev[i][1], ev[i + 1][1], ev[i + 2][1]))
elif kind == "NRN":
for i in range(len(ev)):
if L[i] != "N": continue
j = i + 1
if j < len(L) and L[j] == "R":
k = j + 1
while k < len(L) and L[k] in "MWR": k += 1
if k < len(L) and L[k] == "N":
r = [ev[q][1] for q in range(j, k) if L[q] == "R"]
out.append((ev[i][1], np.array([r[0][0], r[-1][1]]), ev[k][1]))
if kind == "NWN" and wake_reading == "a":
out = []
for c0, c1 in zip(s["cycles"][:-1], s["cycles"][1:]):
if len(c0["packets"]) and len(c1["packets"]):
out.append((c0["packets"][-1], c1["wake"], c1["packets"][0]))
return out
def triplet_changes(ds, kind, **kw):
"""Per (cell, triplet): sextile, rate n, rate n+1, WAKE rate, session, triplet index."""
rows = []
for si, s in enumerate(D[ds]):
for ti, (a, b, c) in enumerate(triplets(s, kind, **kw)):
r0 = W.cell_rates(s, [a], s["E"])[0]; r1 = W.cell_rates(s, [c], s["E"])[0]
for j in range(len(s["E"])):
rows.append([s["sextile"][j], r0[j], r1[j], s["wake_rate_E"][j], si, ti, j])
return np.array(rows).reshape(-1, 7)
def sextile_tests(X, label):
out = []
for q in range(5, -1, -1):
m = X[:, 0] == q; d = X[m, 2] - X[m, 1]
# M1 b: one value per cell, its changes averaged over triplets
keys = X[m][:, [4, 6]]
if len(d) < 3: out.append(f"S{q+1}: n={len(d)}"); continue
_, inv = np.unique(keys, axis=0, return_inverse=True)
db = np.bincount(inv.ravel(), d) / np.bincount(inv.ravel())
out.append(f"S{q+1} (1 lowest): mean {d.mean():+.3f} Hz n={len(d)} signed-rank p={fmt(stats.wilcoxon(d).pvalue)} t p={fmt(stats.ttest_1samp(d, 0).pvalue)}; "
f"per cell n={len(db)} mean {db.mean():+.3f} p={fmt(stats.wilcoxon(db).pvalue)}")
pr(f" {label}:\n " + "\n ".join(out))
def s5_corr(X):
ok = (X[:, 1] > 0) & (X[:, 2] > 0) & (X[:, 3] > 0)
Y = X[ok]; d = np.log10(Y[:, 2]) - np.log10(Y[:, 1])
_, inv = np.unique(Y[:, [4, 6]], axis=0, return_inverse=True); inv = inv.ravel()
db = np.bincount(inv, d) / np.bincount(inv); wr = np.bincount(inv, Y[:, 3]) / np.bincount(inv)
ra = stats.pearsonr(np.log10(wr), db); rb = stats.pearsonr(wr, db)
return f"log change vs log10 WAKE rate R={ra[0]:.3f} p={fmt(ra[1])}; vs linear WAKE rate R={rb[0]:.3f} p={fmt(rb[1])}; cells {len(db)} (dropped {int((~ok).sum())} cell-triplets with a zero rate)"
TR = {}
for ds in DS:
for kind in ["MNM", "RNR", "NMN", "NRN"]:
TR[ds, kind] = triplet_changes(ds, kind)
for wr in "ab":
TR[ds, "NWN" + wr] = triplet_changes(ds, "NWN", wake_reading=wr)
pr(ds, "triplets:", {k: int(sum(len(triplets(s, k)) for s in D[ds])) for k in ["MNM", "RNR", "NMN", "NRN"]},
"NWN (a scored WAKE):", sum(len(triplets(s, "NWN", "a")) for s in D[ds]), "NWN (b arousal 40-120 s):", sum(len(triplets(s, "NWN", "b")) for s in D[ds]))
000041 triplets: {'MNM': 65, 'RNR': 91, 'NMN': 164, 'NRN': 171} NWN (a scored WAKE): 26 NWN (b arousal 40-120 s): 62
crcns-fcx-1 triplets: {'MNM': 172, 'RNR': 35, 'NMN': 266, 'NRN': 191} NWN (a scored WAKE): 24 NWN (b arousal 40-120 s): 98
fig5b-ma-nrem-ma¶
An intervening nonREM packet reduces the rates of the top two sextiles from one MA to the next, with an inverse relation between rate and change across cells.
Source: Results, Sleep sub-states induce differential lasting firing rate changes, paragraph 2; Figure 5B, blue; Figure S5C. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
pr(f"== {ds} MA-packet-MA:"); sextile_tests(TR[ds, "MNM"], "change MA n+1 minus MA n"); pr(" S5C:", s5_corr(TR[ds, "MNM"]))
== 000041 MA-packet-MA:
change MA n+1 minus MA n:
S6 (1 lowest): mean -0.078 Hz n=449 signed-rank p=0.134 t p=0.321; per cell n=124 mean -0.070 p=0.373
S5 (1 lowest): mean +0.001 Hz n=445 signed-rank p=0.723 t p=0.982; per cell n=123 mean -0.043 p=0.848
S4 (1 lowest): mean +0.024 Hz n=406 signed-rank p=0.964 t p=0.514; per cell n=116 mean -0.008 p=0.974
S3 (1 lowest): mean -0.020 Hz n=403 signed-rank p=0.205 t p=0.426; per cell n=106 mean -0.016 p=0.101
S2 (1 lowest): mean -0.007 Hz n=420 signed-rank p=0.861 t p=0.716; per cell n=119 mean -0.010 p=0.932
S1 (1 lowest): mean -0.001 Hz n=415 signed-rank p=0.303 t p=0.949; per cell n=114 mean +0.002 p=0.311
S5C: log change vs log10 WAKE rate R=0.009 p=0.833; vs linear WAKE rate R=0.019 p=0.638; cells 616 (dropped 567 cell-triplets with a zero rate)
== crcns-fcx-1 MA-packet-MA:
change MA n+1 minus MA n:
S6 (1 lowest): mean -0.048 Hz n=1138 signed-rank p=0.175 t p=0.372; per cell n=165 mean -0.035 p=0.0972
S5 (1 lowest): mean -0.030 Hz n=1205 signed-rank p=0.243 t p=0.31; per cell n=159 mean -0.017 p=0.603
S4 (1 lowest): mean -0.022 Hz n=1176 signed-rank p=0.129 t p=0.375; per cell n=155 mean -0.012 p=0.285
S3 (1 lowest): mean -0.016 Hz n=1085 signed-rank p=0.57 t p=0.448; per cell n=157 mean -0.032 p=0.377
S2 (1 lowest): mean -0.027 Hz n=1162 signed-rank p=0.184 t p=0.0231; per cell n=159 mean -0.032 p=0.0536
S1 (1 lowest): mean -0.003 Hz n=1099 signed-rank p=0.948 t p=0.792; per cell n=146 mean +0.024 p=0.525
S5C: log change vs log10 WAKE rate R=0.009 p=0.786; vs linear WAKE rate R=0.001 p=0.978; cells 843 (dropped 1771 cell-triplets with a zero rate)
Result: not reproduced. Across 172 (CRCNS) MA-packet-MA triplets, the top two sextiles do not decrease significantly (signed-rank p = 0.175 and 0.243), and the per-cell log change does not correlate with WAKE rate (R = 0.009, p = 0.79). DANDI agrees (65 triplets, p = 0.134 and 0.72, R = 0.009). These triplets use the deposited MAs, whose count and durations differ from the paper's (ma-statistics).
figs5d-rem-nrem-rem¶
For REM, packet, REM triplets the rate change is inversely correlated with rate.
Source: Results, Sleep sub-states induce differential lasting firing rate changes, paragraph 2; Figure S5D. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
pr(f"== {ds} REM-packet-REM, S5D:", s5_corr(TR[ds, "RNR"]))
== 000041 REM-packet-REM, S5D: log change vs log10 WAKE rate R=0.047 p=0.219; vs linear WAKE rate R=0.016 p=0.676; cells 697 (dropped 463 cell-triplets with a zero rate) == crcns-fcx-1 REM-packet-REM, S5D: log change vs log10 WAKE rate R=-0.183 p=0.109; vs linear WAKE rate R=-0.220 p=0.0524; cells 78 (dropped 30 cell-triplets with a zero rate)
Result: not reproduced. CRCNS: R = -0.183, p = 0.11 over 78 cells (35 REM-packet-REM triplets); DANDI R = 0.047, p = 0.22 over 697 cells. Neither reaches p < 1e-5.
fig5c-sigma-ma-change¶
Higher sigma power in the last 20 s of a packet goes with a larger increase of the lowest sextile from the MA before to the MA after it.
Source: Results, Sleep sub-states induce differential lasting firing rate changes, paragraph 2; Figure 5C, lower right, and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
x, y = [], []
for s in D[ds]:
if "bpz_sigma" not in s["G"]: continue
cells = s["E"][s["sextile"] == 0]
if len(cells) == 0: continue
for a, b, c in triplets(s, "MNM"):
ch = np.nanmean(W.cell_rates(s, [c], cells)[0] - W.cell_rates(s, [a], cells)[0])
x.append(W.gmean(s, "bpz_sigma", [[max(b[0], b[1] - 20), b[1]]])); y.append(ch)
x, y = np.array(x), np.array(y); ok = np.isfinite(x) & np.isfinite(y)
r = stats.pearsonr(x[ok], y[ok])
pr(f"== {ds}: lowest-sextile change MA n to n+1 against sigma in the packet's last 20 s: R={r[0]:.3f} p={fmt(r[1])} n={ok.sum()} triplets")
== 000041: lowest-sextile change MA n to n+1 against sigma in the packet's last 20 s: R=-0.247 p=0.0534 n=62 triplets == crcns-fcx-1: lowest-sextile change MA n to n+1 against sigma in the packet's last 20 s: R=-0.034 p=0.676 n=152 triplets
Result: not reproduced. Lowest-sextile change from MA to MA against late-packet sigma: CRCNS R = -0.034, p = 0.68 (152 triplets); DANDI R = -0.247, p = 0.053 (62). The sign is opposite to the paper's R = 0.181.
fig5b-wake-between-packets¶
WAKE between nonREM packets increases the rate of the fastest sextile; its decrease of slow cells is not significant (24 triplets).
Source: Results, Sleep sub-states induce differential lasting firing rate changes, paragraph 3; Figure 5B, black; Figure S5E. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
for wr in "ab":
n = sum(len(triplets(s, "NWN", wr)) for s in D[ds])
pr(f"== {ds} packet-WAKE-packet reading {wr} ({'scored WAKE' if wr=='a' else 'arousal 40-120 s'}): {n} triplets")
if n >= 3:
sextile_tests(TR[ds, "NWN" + wr], "change packet n+1 minus packet n"); pr(" S5E:", s5_corr(TR[ds, "NWN" + wr]))
== 000041 packet-WAKE-packet reading a (scored WAKE): 26 triplets
change packet n+1 minus packet n:
S6 (1 lowest): mean +0.216 Hz n=160 signed-rank p=0.0243 t p=0.00788; per cell n=88 mean +0.308 p=0.0236
S5 (1 lowest): mean +0.209 Hz n=162 signed-rank p=3.91e-05 t p=0.00113; per cell n=113 mean +0.222 p=0.000308
S4 (1 lowest): mean +0.108 Hz n=156 signed-rank p=0.0452 t p=0.0112; per cell n=108 mean +0.163 p=0.00994
S3 (1 lowest): mean +0.057 Hz n=147 signed-rank p=0.178 t p=0.1; per cell n=96 mean +0.078 p=0.0183
S2 (1 lowest): mean -0.003 Hz n=141 signed-rank p=0.76 t p=0.9; per cell n=93 mean +0.017 p=0.407
S1 (1 lowest): mean +0.011 Hz n=156 signed-rank p=0.134 t p=0.443; per cell n=101 mean +0.015 p=0.122
S5E: log change vs log10 WAKE rate R=-0.011 p=0.786; vs linear WAKE rate R=-0.008 p=0.839; cells 584 (dropped 35 cell-triplets with a zero rate)
== 000041 packet-WAKE-packet reading b (arousal 40-120 s): 62 triplets
change packet n+1 minus packet n:
S6 (1 lowest): mean -0.114 Hz n=291 signed-rank p=0.0214 t p=0.00799; per cell n=112 mean -0.150 p=0.0905
S5 (1 lowest): mean -0.032 Hz n=382 signed-rank p=0.836 t p=0.257; per cell n=132 mean -0.061 p=0.188
S4 (1 lowest): mean -0.042 Hz n=358 signed-rank p=0.149 t p=0.0308; per cell n=122 mean -0.043 p=0.218
S3 (1 lowest): mean +0.048 Hz n=377 signed-rank p=0.00107 t p=0.00476; per cell n=110 mean +0.049 p=0.000155
S2 (1 lowest): mean +0.022 Hz n=358 signed-rank p=0.187 t p=0.315; per cell n=112 mean +0.024 p=0.0421
S1 (1 lowest): mean +0.009 Hz n=423 signed-rank p=0.261 t p=0.169; per cell n=118 mean +0.017 p=0.31
S5E: log change vs log10 WAKE rate R=-0.052 p=0.17; vs linear WAKE rate R=-0.089 p=0.0192; cells 695 (dropped 80 cell-triplets with a zero rate)
== crcns-fcx-1 packet-WAKE-packet reading a (scored WAKE): 24 triplets
change packet n+1 minus packet n:
S6 (1 lowest): mean +0.149 Hz n=131 signed-rank p=0.0172 t p=0.0446; per cell n=86 mean +0.154 p=0.0385
S5 (1 lowest): mean +0.100 Hz n=120 signed-rank p=0.03 t p=0.157; per cell n=95 mean +0.075 p=0.0516
S4 (1 lowest): mean +0.159 Hz n=146 signed-rank p=0.000571 t p=0.000444; per cell n=111 mean +0.183 p=0.000693
S3 (1 lowest): mean +0.017 Hz n=150 signed-rank p=0.545 t p=0.602; per cell n=108 mean +0.022 p=0.366
S2 (1 lowest): mean +0.095 Hz n=130 signed-rank p=0.0146 t p=0.0961; per cell n=95 mean +0.120 p=0.014
S1 (1 lowest): mean +0.004 Hz n=115 signed-rank p=0.332 t p=0.837; per cell n=88 mean +0.007 p=0.316
S5E: log change vs log10 WAKE rate R=-0.010 p=0.817; vs linear WAKE rate R=-0.030 p=0.481; cells 564 (dropped 27 cell-triplets with a zero rate)
== crcns-fcx-1 packet-WAKE-packet reading b (arousal 40-120 s): 98 triplets
change packet n+1 minus packet n:
S6 (1 lowest): mean +0.029 Hz n=495 signed-rank p=0.629 t p=0.21; per cell n=160 mean +0.043 p=0.158
S5 (1 lowest): mean -0.001 Hz n=577 signed-rank p=0.979 t p=0.971; per cell n=163 mean -0.011 p=0.594
S4 (1 lowest): mean +0.022 Hz n=642 signed-rank p=0.196 t p=0.0646; per cell n=165 mean +0.024 p=0.368
S3 (1 lowest): mean +0.014 Hz n=593 signed-rank p=0.349 t p=0.18; per cell n=164 mean +0.011 p=0.199
S2 (1 lowest): mean +0.007 Hz n=599 signed-rank p=0.519 t p=0.52; per cell n=162 mean +0.006 p=0.42
S1 (1 lowest): mean -0.003 Hz n=584 signed-rank p=0.871 t p=0.593; per cell n=163 mean +0.005 p=0.844
S5E: log change vs log10 WAKE rate R=0.078 p=0.0157; vs linear WAKE rate R=0.032 p=0.313; cells 965 (dropped 78 cell-triplets with a zero rate)
Result: reproduced. Reading a (a scored WAKE between the last packet of one SLEEP and the first of the next): 24 triplets on CRCNS, within 24 +- 2.4. The top sextile increases (+0.149 Hz, signed-rank p = 0.017), the lowest does not change (p = 0.33), and the S5E correlation is not significant (R = -0.010, p = 0.82). Sextiles 2 and 4 also increase (p = 0.015 and 5.7e-4). Reading b (arousals of 40 to 120 s) gives no top-sextile increase. DANDI agrees under reading a (26 triplets, p = 0.024, 0.13, R = -0.011).
fig5c-wake-movement¶
WAKE periods with more movement have a larger effect on the rate increase of the fastest sextile from one packet to the next (R = 0.43).
Source: Results, Sleep sub-states induce differential lasting firing rate changes, paragraph 3; Figure 5C, upper left, and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
for wr in "ab":
x1, x2, x3, y, cover = [], [], [], [], []; skipped = 0
for s in D[ds]:
cells = s["E"][s["sextile"] == 5]
if len(cells) == 0 or not s["cycles"]:
skipped += len(triplets(s, "NWN", wr)) if s["cycles"] else 0
continue
G = s["G"]; k = W.secs(W.state_pieces(s, "nrem"))
mo = G.get("motion"); emg = G.get("emg")
thr = np.nanmean(mo[k]) + 5 * np.nanstd(mo[k]) if mo is not None else np.nan
for a, b, c in triplets(s, "NWN", wr):
kk = W.secs([b])
ch = np.nanmean(W.cell_rates(s, [c], cells)[0] - W.cell_rates(s, [a], cells)[0])
m_ = mo[kk] if mo is not None else np.full(len(kk), np.nan)
cover.append((s["name"], int(b[0]), int(b[1]), int(np.isfinite(m_).sum()), len(kk),
len(s["motion"]) if "motion" in s else 0))
x1.append(np.nanmean(m_) if np.isfinite(m_).any() else np.nan)
x2.append(np.nanmean(m_[np.isfinite(m_)] > thr) if np.isfinite(m_).any() else np.nan)
x3.append(np.nanmean(emg[kk]) if emg is not None and np.isfinite(emg[kk]).any() else np.nan)
y.append(ch)
if len(y) < 3:
pr(f"== {ds} reading {wr}: {len(y)} triplets; not tested (no motion or EMG signal)" if ds == "000041" else f"== {ds} reading {wr}: {len(y)} triplets"); continue
x1, x2, x3, y = map(np.array, (x1, x2, x3, y))
pr(f"== {ds} reading {wr}: {len(y)} triplets in sessions with a top-sextile pE cell; {skipped} more in sessions without one, left out")
if wr == "a":
nomo = [c_ for c_ in cover if c_[3] == 0]
pr(f"== {ds} reading a: {len(cover)} triplets, {len(nomo)} with no motion sample in their WAKE; for those, (session, WAKE start, end, "
f"seconds with motion, seconds of WAKE, length of the session's _Motion in s): {nomo}")
for nm, x in [("(a) mean motion", x1), ("(b) fraction above 5 SD of nonREM", x2), ("(c) mean EMG", x3)]:
ok = np.isfinite(x) & np.isfinite(y)
r = stats.pearsonr(x[ok], y[ok]) if ok.sum() > 2 else (np.nan, np.nan)
pr(f"== {ds} WAKE reading {wr}, {nm}: R={r[0]:.3f} p={fmt(r[1])} n={ok.sum()}")
# motion where it covers the WAKE, EMG where it does not (reading c is for a missing motion signal)
xm = np.where(np.isfinite(x1), (x1 - np.nanmean(x1)) / np.nanstd(x1), (x3 - np.nanmean(x3)) / np.nanstd(x3))
ok = np.isfinite(xm) & np.isfinite(y)
if ok.sum() > 2:
r = stats.pearsonr(xm[ok], y[ok]); pr(f" {ds} reading {wr}, z-scored motion, EMG where motion is missing: R={r[0]:.3f} p={fmt(r[1])} n={ok.sum()}")
== 000041 reading a: 20 triplets in sessions with a top-sextile pE cell; 6 more in sessions without one, left out
== 000041 reading a: 20 triplets, 20 with no motion sample in their WAKE; for those, (session, WAKE start, end, seconds with motion, seconds of WAKE, length of the session's _Motion in s): [('BWRat18-020513', 2974, 3637, 0, 663, 0), ('BWRat20-101513', 8930, 9619, 0, 689, 0), ('BWRat20-101513', 16087, 16561, 0, 474, 0), ('Bogey-012615', 7773, 9694, 0, 1921, 0), ('Bogey-012615', 19519, 20955, 0, 1436, 0), ('Dino-061814', 12487, 14041, 0, 1554, 0), ('Dino-062014', 18487, 19973, 0, 1486, 0), ('Dino-072314', 4318, 5017, 0, 699, 0), ('Dino-072314', 7059, 7528, 0, 469, 0), ('Dino-072414', 4593, 5220, 0, 627, 0), ('Dino-072414', 8186, 8682, 0, 496, 0), ('Rizzo-022615', 5722, 7246, 0, 1524, 0), ('Rizzo-022615', 18252, 19903, 0, 1651, 0), ('Rizzo-022615', 28477, 29154, 0, 677, 0), ('Rizzo-022615', 32229, 33139, 0, 910, 0), ('Rizzo-022615', 35359, 35886, 0, 527, 0), ('Rizzo-022715', 19952, 22913, 0, 2961, 0), ('Splinter-020515', 5598, 7189, 0, 1591, 0), ('Splinter-020515', 11737, 13577, 0, 1840, 0), ('Splinter-020915', 17474, 20296, 0, 2822, 0)]
== 000041 WAKE reading a, (a) mean motion: R=nan p=nan n=0
== 000041 WAKE reading a, (b) fraction above 5 SD of nonREM: R=nan p=nan n=0
== 000041 WAKE reading a, (c) mean EMG: R=nan p=nan n=0
== 000041 reading b: 46 triplets in sessions with a top-sextile pE cell; 16 more in sessions without one, left out
== 000041 WAKE reading b, (a) mean motion: R=nan p=nan n=0
== 000041 WAKE reading b, (b) fraction above 5 SD of nonREM: R=nan p=nan n=0
== 000041 WAKE reading b, (c) mean EMG: R=nan p=nan n=0
== crcns-fcx-1 reading a: 19 triplets in sessions with a top-sextile pE cell; 5 more in sessions without one, left out == crcns-fcx-1 reading a: 19 triplets, 0 with no motion sample in their WAKE; for those, (session, WAKE start, end, seconds with motion, seconds of WAKE, length of the session's _Motion in s): [] == crcns-fcx-1 WAKE reading a, (a) mean motion: R=0.222 p=0.361 n=19 == crcns-fcx-1 WAKE reading a, (b) fraction above 5 SD of nonREM: R=-0.139 p=0.57 n=19 == crcns-fcx-1 WAKE reading a, (c) mean EMG: R=0.550 p=0.0146 n=19 crcns-fcx-1 reading a, z-scored motion, EMG where motion is missing: R=0.222 p=0.361 n=19 == crcns-fcx-1 reading b: 79 triplets in sessions with a top-sextile pE cell; 19 more in sessions without one, left out == crcns-fcx-1 WAKE reading b, (a) mean motion: R=-0.079 p=0.491 n=79 == crcns-fcx-1 WAKE reading b, (b) fraction above 5 SD of nonREM: R=0.008 p=0.942 n=79 == crcns-fcx-1 WAKE reading b, (c) mean EMG: R=-0.093 p=0.416 n=79 crcns-fcx-1 reading b, z-scored motion, EMG where motion is missing: R=-0.079 p=0.491 n=79
Result: not reproduced. CRCNS, reading a: 19 of the 24 triplets lie in sessions with a top-sextile pE cell and all 19 have motion samples; the other 5 are in sessions without a top-sextile cell. The top sextile's change does not correlate with movement during WAKE (mean motion R = 0.222, p = 0.36; fraction above threshold R = -0.139, p = 0.57; reading b R = -0.079 and 0.008). Mean EMG, the criterion's reading for a dataset without motion, gives R = 0.550, p = 0.015 on these 19, a variant on CRCNS, which has motion. DANDI holds neither motion nor EMG, and its only ElectricalSeries is the 1250 Hz LFP, so the claim could not be tested there.
fig5b-ma-between-packets¶
MAs between packets do not change fast-firing cells but increase the rate of slow-firing cells, with an inverse relation between rate and change across cells.
Source: Results, Sleep sub-states induce differential lasting firing rate changes, paragraph 3; Figure 5B, yellow; Figure S5G. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
pr(f"== {ds} packet-MA-packet:"); sextile_tests(TR[ds, "NMN"], "change packet n+1 minus packet n"); pr(" S5G:", s5_corr(TR[ds, "NMN"]))
X = TR[ds, "NMN"]; m = X[:, 0] <= 1; d = X[m, 2] - X[m, 1]
pr(f" lowest two sextiles together: mean {d.mean():+.3f} Hz, n={len(d)}, signed-rank p={fmt(stats.wilcoxon(d).pvalue)}")
== 000041 packet-MA-packet:
change packet n+1 minus packet n:
S6 (1 lowest): mean -0.073 Hz n=1071 signed-rank p=7.32e-05 t p=0.000262; per cell n=139 mean -0.120 p=5.76e-06
S5 (1 lowest): mean -0.030 Hz n=1072 signed-rank p=0.0411 t p=0.00517; per cell n=142 mean -0.043 p=0.000899
S4 (1 lowest): mean -0.012 Hz n=997 signed-rank p=0.18 t p=0.13; per cell n=141 mean -0.027 p=0.0276
S3 (1 lowest): mean -0.018 Hz n=1017 signed-rank p=0.0391 t p=0.0239; per cell n=139 mean -0.027 p=0.016
S2 (1 lowest): mean +0.020 Hz n=1032 signed-rank p=0.000783 t p=0.00107; per cell n=139 mean +0.030 p=0.000198
S1 (1 lowest): mean +0.006 Hz n=1065 signed-rank p=0.0051 t p=0.0698; per cell n=139 mean +0.006 p=0.00633
S5G: log change vs log10 WAKE rate R=-0.222 p=9.52e-11; vs linear WAKE rate R=-0.162 p=2.61e-06; cells 832 (dropped 167 cell-triplets with a zero rate)
lowest two sextiles together: mean +0.013 Hz, n=2097, signed-rank p=2.01e-05
== crcns-fcx-1 packet-MA-packet:
change packet n+1 minus packet n:
S6 (1 lowest): mean -0.089 Hz n=1677 signed-rank p=3.38e-09 t p=1.13e-10; per cell n=160 mean -0.152 p=2.71e-08
S5 (1 lowest): mean -0.050 Hz n=1736 signed-rank p=9.71e-09 t p=2.08e-09; per cell n=163 mean -0.057 p=1.01e-05
S4 (1 lowest): mean -0.028 Hz n=1759 signed-rank p=0.000261 t p=4.95e-05; per cell n=165 mean -0.023 p=0.0226
S3 (1 lowest): mean -0.012 Hz n=1654 signed-rank p=0.149 t p=0.0573; per cell n=164 mean -0.001 p=0.0871
S2 (1 lowest): mean -0.001 Hz n=1704 signed-rank p=0.715 t p=0.849; per cell n=162 mean -0.006 p=0.568
S1 (1 lowest): mean +0.007 Hz n=1579 signed-rank p=0.0116 t p=0.0233; per cell n=163 mean +0.007 p=0.402
S5G: log change vs log10 WAKE rate R=-0.178 p=2.28e-08; vs linear WAKE rate R=-0.138 p=1.71e-05; cells 968 (dropped 236 cell-triplets with a zero rate)
lowest two sextiles together: mean +0.003 Hz, n=3283, signed-rank p=0.071
Result: partially reproduced. The lowest sextile increases across MAs between packets (CRCNS +0.007 Hz, signed-rank p = 0.012), and the log change correlates negatively with WAKE rate (R = -0.178, p = 2.3e-8, above the 1e-10 bound). The top sextile decreases significantly (p = 3.4e-9), against the claim that fast cells are unaffected. DANDI: +0.006 Hz (p = 0.005), R = -0.222 (p = 9.5e-11), top p = 7.3e-5.
fig5b-rem-between-packets¶
REM between packets decreases the rates of all sextiles, by about the same proportion, without a rate-dependent effect across cells.
Source: Results, Sleep sub-states induce differential lasting firing rate changes, paragraph 3; Figure 5B, red; Figure S5F. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
pr(f"== {ds} packet-REM-packet:"); sextile_tests(TR[ds, "NRN"], "change packet n+1 minus packet n"); pr(" S5F:", s5_corr(TR[ds, "NRN"]))
== 000041 packet-REM-packet:
change packet n+1 minus packet n:
S6 (1 lowest): mean +0.020 Hz n=955 signed-rank p=0.854 t p=0.467; per cell n=121 mean +0.054 p=0.135
S5 (1 lowest): mean +0.000 Hz n=1142 signed-rank p=0.412 t p=0.98; per cell n=132 mean +0.013 p=0.85
S4 (1 lowest): mean +0.000 Hz n=1106 signed-rank p=0.871 t p=0.972; per cell n=129 mean +0.003 p=0.673
S3 (1 lowest): mean +0.003 Hz n=1069 signed-rank p=0.31 t p=0.746; per cell n=125 mean +0.011 p=0.895
S2 (1 lowest): mean -0.020 Hz n=1091 signed-rank p=0.000409 t p=0.0175; per cell n=128 mean -0.018 p=0.000792
S1 (1 lowest): mean +0.001 Hz n=1118 signed-rank p=0.154 t p=0.884; per cell n=122 mean +0.002 p=0.374
S5F: log change vs log10 WAKE rate R=0.084 p=0.0213; vs linear WAKE rate R=0.109 p=0.00275; cells 752 (dropped 242 cell-triplets with a zero rate)
== crcns-fcx-1 packet-REM-packet:
change packet n+1 minus packet n:
S6 (1 lowest): mean +0.050 Hz n=1128 signed-rank p=0.0923 t p=0.00513; per cell n=145 mean +0.102 p=0.176
S5 (1 lowest): mean +0.039 Hz n=1047 signed-rank p=0.0196 t p=0.00321; per cell n=153 mean +0.032 p=0.129
S4 (1 lowest): mean +0.009 Hz n=1161 signed-rank p=0.567 t p=0.277; per cell n=159 mean -0.004 p=0.652
S3 (1 lowest): mean -0.001 Hz n=1118 signed-rank p=0.513 t p=0.938; per cell n=156 mean -0.014 p=0.93
S2 (1 lowest): mean -0.018 Hz n=1057 signed-rank p=0.00136 t p=0.0338; per cell n=156 mean -0.034 p=0.00512
S1 (1 lowest): mean +0.003 Hz n=776 signed-rank p=0.736 t p=0.504; per cell n=146 mean -0.006 p=0.883
S5F: log change vs log10 WAKE rate R=0.035 p=0.29; vs linear WAKE rate R=0.103 p=0.00199; cells 904 (dropped 152 cell-triplets with a zero rate)
Result: not reproduced. Across 191 (CRCNS) packet-REM-packet triplets, only the second-lowest sextile decreases significantly (p = 0.0014); the top two sextiles rise (+0.050 and +0.039 Hz). The S5F correlation is R = 0.035, p = 0.29. DANDI: 171 triplets, only the second-lowest decreases (p = 4.1e-4).
fig5c-rem-duration¶
Longer REM episodes produce a proportionally larger decrease of rates from one packet to the next, across all sextiles (R = -0.22).
Source: Results, Sleep sub-states induce differential lasting firing rate changes, paragraph 3; Figure 5C, upper right, and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
xa, ya, yb, xc, yc = [], [], [], [], []
for s in D[ds]:
if len(s["E"]) == 0: continue
for a, b, c in triplets(s, "NRN"):
r0 = W.cell_rates(s, [a], s["E"])[0]; r1 = W.cell_rates(s, [c], s["E"])[0]
dur = b[1] - b[0]
xa.append(dur); ya.append(np.nanmean(r1) - np.nanmean(r0))
ok = r0 > 0; yb.append(np.nanmean((r1[ok] - r0[ok]) / r0[ok]) if ok.any() else np.nan)
ok2 = (r0 > 0) & (r1 > 0); xc += [dur] * ok2.sum(); yc += list(np.log10(r1[ok2]) - np.log10(r0[ok2]))
xa, ya, yb = map(np.array, (xa, ya, yb))
ra = stats.pearsonr(xa, ya); ok = np.isfinite(yb); rb = stats.pearsonr(xa[ok], yb[ok]); rc = stats.pearsonr(xc, yc)
pr(f"== {ds}: REM duration against (a) mean-rate change R={ra[0]:.3f} p={fmt(ra[1])} n={len(xa)}; (b) mean relative change R={rb[0]:.3f} p={fmt(rb[1])}; "
f"(c) per cell log change R={rc[0]:.3f} p={fmt(rc[1])} n={len(xc)}")
== 000041: REM duration against (a) mean-rate change R=-0.059 p=0.441 n=171; (b) mean relative change R=0.007 p=0.932; (c) per cell log change R=-0.002 p=0.858 n=6240
== crcns-fcx-1: REM duration against (a) mean-rate change R=-0.036 p=0.623 n=191; (b) mean relative change R=0.074 p=0.309; (c) per cell log change R=-0.007 p=0.56 n=6136
Result: not reproduced. REM duration does not correlate with the rate change across REM under any reading: CRCNS R = -0.036, 0.074 and -0.007 (p >= 0.3); DANDI R = -0.059, 0.007 and -0.002.
fig5c-rem-theta¶
REM theta power correlates with the packet n to packet n+1 rate decrease of the slowest sextile only.
Source: Results, Sleep sub-states induce differential lasting firing rate changes, paragraph 3. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
for nm, key in [("a theta ratio", "thetaratio"), ("b 5-10 Hz power z", "thetaz")]:
out = []
for q in range(6):
x, y = [], []
for s in D[ds]:
cells = s["E"][s["sextile"] == q]
if key not in s["G"] or len(cells) == 0: continue
for a, b, c in triplets(s, "NRN"):
x.append(W.gmean(s, key, [b])); y.append(np.nanmean(W.cell_rates(s, [c], cells)[0] - W.cell_rates(s, [a], cells)[0]))
x, y = np.array(x), np.array(y); ok = np.isfinite(x) & np.isfinite(y)
r = stats.pearsonr(x[ok], y[ok])
out.append(f"S{q+1}: R={r[0]:.3f} p={fmt(r[1])} n={ok.sum()}")
pr(f"== {ds} REM {nm} (S1 lowest): " + "; ".join(out))
== 000041 REM a theta ratio (S1 lowest): S1: R=-0.056 p=0.481 n=159; S2: R=-0.117 p=0.133 n=167; S3: R=-0.008 p=0.915 n=167; S4: R=0.090 p=0.259 n=159; S5: R=0.054 p=0.49 n=167; S6: R=0.012 p=0.896 n=117
== 000041 REM b 5-10 Hz power z (S1 lowest): S1: R=0.070 p=0.38 n=159; S2: R=0.026 p=0.74 n=167; S3: R=-0.082 p=0.29 n=167; S4: R=-0.007 p=0.928 n=159; S5: R=0.028 p=0.72 n=167; S6: R=0.032 p=0.731 n=117
== crcns-fcx-1 REM a theta ratio (S1 lowest): S1: R=-0.149 p=0.06 n=161; S2: R=-0.006 p=0.931 n=191; S3: R=-0.067 p=0.359 n=191; S4: R=-0.013 p=0.866 n=183; S5: R=-0.047 p=0.544 n=170; S6: R=0.095 p=0.264 n=140
== crcns-fcx-1 REM b 5-10 Hz power z (S1 lowest): S1: R=0.034 p=0.667 n=161; S2: R=-0.129 p=0.0743 n=191; S3: R=-0.028 p=0.696 n=191; S4: R=0.009 p=0.906 n=183; S5: R=-0.102 p=0.187 n=170; S6: R=-0.200 p=0.0179 n=140
Result: not reproduced. With the theta ratio, the slowest sextile has R = -0.149, p = 0.060 on CRCNS and R = -0.056, p = 0.48 on DANDI; with 5 to 10 Hz power the only significant sextile is the fastest on CRCNS (R = -0.200, p = 0.018).
fig5c-delta-change-slow-cells¶
Regardless of the intervening state, the increase of the slowest sextile from packet n to n+1 correlates positively with the change in delta power between the packets; the same is not found for the fastest sextile.
Source: Results, Sleep sub-states induce differential lasting firing rate changes, paragraph 4; Figure 5C, lower left, and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
for b_ in ["delta", "delta14"]:
res = []
for q in (0, 5):
x, y = [], []
for s in D[ds]:
cells = s["E"][s["sextile"] == q]
if "bpn_" + b_ not in s["G"] or len(cells) == 0: continue
for c in s["cycles"]:
pk = c["packets"]
for p0, p1 in zip(pk[:-1], pk[1:]):
x.append(W.gmean(s, "bpn_" + b_, [p1]) - W.gmean(s, "bpn_" + b_, [p0]))
y.append(np.nanmean(W.cell_rates(s, [p1], cells)[0] - W.cell_rates(s, [p0], cells)[0]))
x, y = np.array(x), np.array(y); ok = np.isfinite(x) & np.isfinite(y)
r = stats.pearsonr(x[ok], y[ok]); res.append(f"{'slowest' if q==0 else 'fastest'} R={r[0]:.3f} p={fmt(r[1])} n={ok.sum()}")
pr(f"== {ds} {b_}: " + "; ".join(res))
== 000041 delta: slowest R=-0.115 p=0.0223 n=396; fastest R=-0.389 p=1.84e-12 n=305
== 000041 delta14: slowest R=-0.099 p=0.0479 n=396; fastest R=-0.573 p=4.72e-28 n=305
== crcns-fcx-1 delta: slowest R=-0.033 p=0.434 n=567; fastest R=0.017 p=0.697 n=524
== crcns-fcx-1 delta14: slowest R=-0.067 p=0.109 n=567; fastest R=-0.195 p=6.57e-06 n=524
Result: not reproduced. The slowest sextile's change between consecutive packets does not correlate positively with the delta change: CRCNS R = -0.033, p = 0.43; DANDI R = -0.115, p = 0.022 (negative).
figs2d-interneurons-unchanged¶
Unlike pyramidal cells, interneuron rates in the first and last packets of SLEEP lie on a line of slope 1 (95% interval 0.996 to 1.005).
Source: Figure S2D legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
for r in "ab":
A, B, Ab, Bb = [], [], [], []
for s in D[ds]:
fa, la = [], []
for c in s["cycles"]:
if len(c["packets"]) < 2 or len(s["I"]) == 0: continue
f = W.cell_rates(s, c["packets"][:1], s["I"])[0]; l = W.cell_rates(s, c["packets"][-1:], s["I"])[0]
A.append(f); B.append(l); fa.append(f); la.append(l)
if fa: Ab.append(np.mean(fa, 0)); Bb.append(np.mean(la, 0))
x, y = (np.concatenate(A), np.concatenate(B)) if r == "a" else (np.concatenate(Ab), np.concatenate(Bb))
lx, ly, drop = W.log_pairs(x, y); o = W.ols_slope(lx, ly); rv = W.ols_slope(ly, lx)
pr(f"== {ds} reading {r}: pI log10 slope last on first {o['slope']:.4f} [{o['lo']:.4f}, {o['hi']:.4f}], R={o['R']:.3f}, n={o['n']} (dropped {drop}); "
f"reverse, first on last, {rv['slope']:.4f} [{rv['lo']:.4f}, {rv['hi']:.4f}]; mean log10 change {np.mean(ly - lx):+.4f}, signed-rank p={fmt(stats.wilcoxon(ly, lx).pvalue)}")
== 000041 reading a: pI log10 slope last on first 0.9165 [0.8382, 0.9948], R=0.884, n=152 (dropped 9); reverse, first on last, 0.8521 [0.7793, 0.9250]; mean log10 change -0.0673, signed-rank p=0.000385 == 000041 reading b: pI log10 slope last on first 0.7902 [0.6601, 0.9203], R=0.791, n=89 (dropped 1); reverse, first on last, 0.7923 [0.6618, 0.9227]; mean log10 change -0.0739, signed-rank p=0.00208 == crcns-fcx-1 reading a: pI log10 slope last on first 0.8360 [0.7661, 0.9059], R=0.863, n=192 (dropped 9); reverse, first on last, 0.8916 [0.8171, 0.9662]; mean log10 change -0.0543, signed-rank p=0.000669 == crcns-fcx-1 reading b: pI log10 slope last on first 0.8876 [0.8022, 0.9731], R=0.882, n=123 (dropped 3); reverse, first on last, 0.8761 [0.7918, 0.9604]; mean log10 change -0.0758, signed-rank p=0.00202
Result: not reproduced. The pI log slope from first to last packet is below 1 with its 95% interval excluding 1: CRCNS 0.836 [0.766, 0.906] (reading a) and 0.888 [0.802, 0.973] (b). The reverse slope is also below 1 (0.892 and 0.876) and pI rates fall from first to last packet (mean log10 change -0.054, signed-rank p = 6.7e-4), so the interval excludes 1 partly by regression to the mean and partly by a decrease. DANDI: 0.917 [0.838, 0.995] and 0.790 [0.660, 0.920].
sleep-homogenizes-rates¶
The net effect of sleep is to homogenize the firing rate distribution, fast cells decreasing and slow cells increasing, so the population rate dispersion falls.
Source: Discussion, paragraph 1; Figure 6 and legend. The criterion and its readings are in the claims file; the code below runs each reading it names.
for ds in DS:
x, y = FL[ds, "b"]; lx, ly, _ = W.log_pairs(x, y); o = W.ols_slope(lx, ly)
cv = W.norm_corr([s for s in D[ds] if s["cycles"]], "sleep", cv_fn, readings=("a",))["a"]
X, Y = PW[ds, "ii", "a"]
sx = np.concatenate([np.repeat(s["sextile"][None], sum(1 for c in s["cycles"] if wake_windows(s, c, "ii")[1] is not None), 0).ravel() for s in D[ds] if s["cycles"]])
pr(f"== {ds}: first-to-last packet log slope {o['slope']:.3f} [{o['lo']:.3f}, {o['hi']:.3f}]; WAKE after minus before, top sextile "
f"{np.mean(Y[sx==5]-X[sx==5]):+.3f} Hz, bottom {np.mean(Y[sx==0]-X[sx==0]):+.3f} Hz; CV over SLEEP per packet R={cv[0]:.3f} p={fmt(cv[1])}")
== 000041: first-to-last packet log slope 0.825 [0.791, 0.858]; WAKE after minus before, top sextile -0.439 Hz, bottom +0.033 Hz; CV over SLEEP per packet R=-0.166 p=0.000309
== crcns-fcx-1: first-to-last packet log slope 0.872 [0.840, 0.904]; WAKE after minus before, top sextile -0.658 Hz, bottom +0.049 Hz; CV over SLEEP per packet R=-0.116 p=0.00216
Result: reproduced. The three claims this rests on, fig3d-first-last-packet-slope (slope 0.872 on CRCNS), fig3e-wake-before-after-sextiles and cv-decreases-over-sleep, are reproduced. The sub-state claims are mixed: fig5b-ma-between-packets partly, fig5b-rem-between-packets not. The reverse slopes of fig3d are also below 1, so of the three the CV decrease and the sextile changes carry the claim.
import requests
crcns_bytes = sum(int(requests.head(W.CRCNS_BASE + f"data/{n}.tar.gz", timeout=60).headers["Content-Length"]) for n in W.CRCNS_SESSIONS)
print(f"CRCNS tar.gz files streamed in full: {crcns_bytes/1e9:.1f} GB; DANDI files read in part, {sum(sz for _, _, sz in W.dandi_assets())/1e9:.1f} GB in all")
print(f"time since loading began {(time.time()-t_load)/60:.1f} min; peak memory of this process "
f"{resource.getrusage(resource.RUSAGE_SELF).ru_maxrss/1e6:.2f} GB, of the largest loading worker "
f"{resource.getrusage(resource.RUSAGE_CHILDREN).ru_maxrss/1e6:.2f} GB (2 workers at a time on DANDI, 3 on CRCNS)")
CRCNS tar.gz files streamed in full: 88.9 GB; DANDI files read in part, 149.5 GB in all time since loading began 28.9 min; peak memory of this process 2.63 GB, of the largest loading worker 5.16 GB (2 workers at a time on DANDI, 3 on CRCNS)
Summary¶
A failure to reproduce here may be a failure of this attempt, not of the paper: see the reasoning and the differences from the paper's method.
Outcomes are judged on CRCNS:fcx-1; the DANDI:000041 result of each claim is in its section.
| Claim | Outcome |
|---|---|
table1-dataset-counts |
reproduced |
wake-sleep-cycles |
reproduced |
tables1-state-durations |
reproduced |
ma-statistics |
not reproduced |
ma-fraction-over-nrem-episodes |
partially reproduced |
packet-duration |
reproduced |
fig2a-median-rates |
partially reproduced |
fig2a-skewed-wide-distribution |
partially reproduced |
fig2a-fraction-above-2hz |
reproduced |
fig2b-wake-nrem-slope |
reproduced |
burst-index-by-state |
partially reproduced |
fig2c-acg-peaks |
partially reproduced |
fig2c-acg-decay |
partially reproduced |
synchrony-skew |
reproduced |
updown-durations |
reproduced |
fig1e-up-state-dynamics |
partially reproduced |
fig2de-fast-before-slow |
reproduced |
fig2f-rate-group-correlations |
not reproduced |
fig3ab-population-rate-declines |
reproduced |
first-last-packet-mean-rate |
reproduced |
post-sleep-wake-lower |
reproduced |
fig3d-first-last-packet-slope |
reproduced |
fig3b-sextile-changes |
reproduced |
cv-decreases-over-sleep |
reproduced |
fig3c-spindles-over-sleep |
not reproduced |
fig3c-updown-over-sleep |
not reproduced |
fig3f-within-up-changes |
reproduced |
figs3a-first-last-rem-ma-slopes |
reproduced |
fig3e-wake-before-after-sextiles |
reproduced |
fig4i-band-power-within-nrem |
reproduced |
fig4-delta-packet-length |
reproduced |
fig4-late-packet-sigma-delta |
partially reproduced |
fig4-updown-within-packets |
reproduced |
fig4-spindles-within-nrem |
partially reproduced |
fig4e-late-packet-sigma |
reproduced |
fig4iv-sextiles-within-nrem |
reproduced |
fig4v-cv-within-nrem |
reproduced |
fig4vi-burst-within-nrem |
reproduced |
fig4cd-packet-rate-lfp-correlations |
not reproduced |
fig4e-within-up-sextiles |
not reproduced |
figs5-within-wake-rem |
not reproduced |
fig5b-ma-nrem-ma |
not reproduced |
figs5d-rem-nrem-rem |
not reproduced |
fig5c-sigma-ma-change |
not reproduced |
fig5b-wake-between-packets |
reproduced |
fig5c-wake-movement |
not reproduced |
fig5b-ma-between-packets |
partially reproduced |
fig5b-rem-between-packets |
not reproduced |
fig5c-rem-duration |
not reproduced |
fig5c-rem-theta |
not reproduced |
fig5c-delta-change-slow-cells |
not reproduced |
figs2d-interneurons-unchanged |
not reproduced |
sleep-homogenizes-rates |
reproduced |
Of 53 claims, 27 reproduced, 10 partially reproduced, 16 not reproduced, 0 blocked.
How the analysis differs from the paper's. Outcomes rest on CRCNS:fcx-1, with the lab's deposited intervals, UP/DOWN states and spindles. On DANDI the WAKE, SLEEP, packet, MA and episode intervals are built from the Awake, Non-REM and REM epochs, and UP/DOWN states and spindles are detected here. Band power uses 2 s windows every 1 s (averaged to 10 s where the paper's 10 s window applies) and, within UP states, 200 ms windows every 100 ms (an assumption). ISIs for the burst index are counted from spike times within each state interval. Rates and counts in normalized-time bins use the 1 s grid, each second going to the bin that holds its centre; the REM part of figs5-within-wake-rem also uses exact spike times. Where the paper leaves a sampling unit, normalization or test open, every reading the claims file names is run and printed. Where a criterion counts parts that "hold", a part holds when it meets M4's reproduced level (an assumption; the result with p < 0.05 is shown too). Sextile tests on WAKE are also run with the cells ranked on WAKE without the windows tested, and rate-rate slopes are shown with their reverse regressions, as checks on regression to the mean.
What was found about the datasets. CRCNS:fcx-1 holds the paper's data set in full and its deposited intervals and detections reproduce Table S1, except the WAKE-SLEEP duration (median 4214 s against the 5918 s Table S1 prints) and the microarousals: its MA list holds 2130 MAs, of which 434 lie within SLEEP and 1670 outside any scored SLEEP or WAKE, against 790 in the paper. DANDI:000041 lacks 5 of the 27 sessions (rat B22 and two Dino ACC probes), has no LFP for Dino-061914, holds only Awake, Non-REM and REM states (no WAKE-SLEEP cycles, packets, MAs, UP/DOWN states or spindles), no motion or EMG signal and no wideband signal, and its cell-type labels and unit sets differ from the lab's CRCNS files in several sessions. The DANDI LFP starts at time 0 in every file, and its delta power is higher in nonREM than in WAKE as scored.