Moaddab, Wright & McDannald (2020) on CRCNS pag-2¶

Paper: Moaddab M, Wright KM, McDannald MA. Early adolescent adversity alters periaqueductal gray/dorsal raphe threat responding in adult female rats. Sci Rep 10, 18035 (2020), doi:10.1038/s41598-020-74457-3.

Dataset: CRCNS pag-2, doi:10.6080/K0833Q7F, read from the public bucket at https://crcnsarchive.s3-us-west-2.amazonaws.com/pag-2/live/. Version: unversioned. CRCNS data sets carry no version numbers, so the only published state is the current one under live/ (no old/ folder exists). It is pinned by the MD5 sums of the data set's checksums.md5: data.zip 7d1686e3d4f6f36895c38f34eda632d4, docs/crcns_pag-2_data_description.pdf 9f6c40904e9123fe8ff488d6006c8df4; the first cell checks that the object read has that MD5. The data description is version 0.6 (April 4, 2021).

Claims: claims/crcns-pag-2/10.1038-s41598-020-74457-3.yaml, written from the version of record (PMC7582948) without its supplement. Methods details the claims file lacks are taken from the paper and, where the paper leaves them open, from the authors' own script and cube in the data set (data/vlpagAnalysis.m, data/cubeFile/cube.mat), as each section says.

Claim Tested
fig1bc-adversity-slows-weight-gain blocked (no body weights in the data set)
fig1ef-acquisition-equivalent-final blocked (no pre-surgery sessions in the data set)
fig2b-baseline-poke-equivalent tested
fig2c-recording-discrimination tested
fig2d-cue-responsive-counts tested
fig2d-higher-proportion-responsive tested
fig2ef-baseline-firing tested
fig4ab-excited-temporal-pattern tested without bregma (no bregma level per rat)
fig4c-excited-inflated-onset tested
fig4de-inhibited-temporal-pattern tested without bregma
fig4f-inhibited-danger-decrease tested
fig4f-inhibited-danger-uncertainty-discrimination tested
fig5abc-excited-reduced-threat-probability tested
fig5d-threat-tuning-curve tested
figs4-peak-assignment-same-pattern tested
fig5efg-inhibited-fear-output tested
fig6-excited-firing-threat-decoupled tested
figs5-excited-firing-fear-output-unrelated tested
fig7-inhibited-firing-fear-output tested
figs6-inhibited-firing-threat-probability tested
In [1]:
import time
import collections
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
import pag2

t0 = time.time()
etag, md5_ok = pag2.check_md5()
print("data.zip ETag", etag, "matches checksums.md5:", md5_ok)
zf = pag2.open_zip()
members = [i for i in zf.infolist() if not i.is_dir()]
print(len(members), "files in data.zip;", sum(i.filename.startswith("data/matFiles/") for i in members), "unit files")
for i in members:
    if not i.filename.startswith("data/matFiles/"):
        print("  ", i.filename, i.file_size)
cube, names = pag2.load_cube(zf)
U = pag2.load_all(zf, names)
print(len(U), "units loaded in %.0f s" % (time.time() - t0))
grp = np.array([u["group"] for u in U])
data.zip ETag 7d1686e3d4f6f36895c38f34eda632d4 matches checksums.md5: True
359 files in data.zip; 354 unit files
   data/vlpagAnalysis.m 229411
   data/cue3.wav 223138
   data/cue2.wav 223242
   data/cue1.wav 223272
   data/cubeFile/cube.mat 29261351
354 units loaded in 35 s

Data check¶

What the files hold: each unit file has the spike times (spike), the event times EVT01 to EVT14 and the mean waveform. The cube, vlPAGcube, has for every unit a trial table (tag: cue type 1 to 4 and onset time per trial), binned raw, differential and Z scored firing, nose poke rates and suppression ratios (poke, cer), and the waveform. The cell below lists every field of the cube with its shape, type and range, identifies the event codes against the cube's trial table, and checks the cube's stored values against values computed here from the spikes and pokes.

In [2]:
def walk(o, path=""):
    if hasattr(o, "_fieldnames"):
        for f in o._fieldnames:
            walk(getattr(o, f), path + "." + f)
    elif isinstance(o, np.ndarray) and o.dtype == object and o.size == 1:
        walk(o.flat[0], path)
    else:
        a = np.asarray(o)
        rng = (a.min(), a.max()) if a.dtype.kind in "fiu" and a.size else ""
        print(f"vlPAGcube{path:32s} {str(a.shape):16s} {str(a.dtype):8s} {rng}")
walk(cube)

# units, rats, sessions
rats = sorted(set(u["rat"] for u in U))
print("\nrats:", {g: [r for r in rats if pag2.group_of(r) == g] for g in ("Con", "EAA")})
print("rats in the script's lists but not in the data:",
      sorted(set(pag2.CON_RATS + pag2.EAA_RATS) - set(rats)))
print("units per group:", dict(collections.Counter(grp)))
sessions = {}
for u in U:
    sessions.setdefault(u["session"], u)
print("sessions (rat and date):", len(sessions), dict(collections.Counter(s["group"] for s in sessions.values())),
      "; the paper and the data description state 72 Control and 107 EAA")
ev_sets = {tuple(np.round(u["onset"], 3)) for u in U}
print("distinct trial tables (cue onset times):", len(ev_sets))
progs = collections.defaultdict(set)
for u in U:
    progs[u["session"]].add(u["name"][10:16])
tab_keys = collections.defaultdict(set)
for u in U:
    tab_keys[tuple(np.round(u["onset"], 2))].add(u["session"])
print("sessions with more than one behaviour program:", sum(len(v) > 1 for v in progs.values()),
      "; trial tables shared by two sessions:", sum(len(v) > 1 for v in tab_keys.values()))
print("units per rat:", dict(collections.Counter(u["rat"] for u in U)))
print("behaviour programs:", dict(collections.Counter(u["name"][10:16] for u in U)))
hashes = collections.Counter((u["n_spikes"], u["counts"].sum()) for u in U)
dups = [k for k, v in hashes.items() if v > 1]
print("pairs of units with the same spike count and binned counts (possible duplicates):", len(dups))

# event codes against the cube's trial table
tag = pag2.cube_field(cube, "tag")
ok_onset = ok_type = 0
for j, u in enumerate(U):
    tt = np.array([{"danger": 1, "uncertainty": 2, "safety": 4}[x] for x in u["type"]])
    tt[(u["type"] == "uncertainty") & ~u["shock"]] = 3
    ok_onset += np.allclose(u["onset"], tag[:, 1, j])
    ok_type += np.array_equal(tt, tag[:, 0, j])
print(f"\ncue onsets equal to the cube's tag in {ok_onset}/{len(U)} units, trial types in {ok_type}/{len(U)}")
code_map = collections.Counter()
for u in U:
    for code in ("EVT09", "EVT11", "EVT12"):
        t = u["events"][code][0]
        code_map[(u["name"][10:16], code, u["type"][np.argmin(np.abs(u["onset"] - t))])] += 1
for k, v in sorted(code_map.items()):
    print("  ", k, v, "units")
print("trials per unit:", dict(collections.Counter(len(u["onset"]) for u in U)),
      "; per type:", dict(collections.Counter(u["type"]).items()) if False else
      dict(collections.Counter(tuple(sorted(collections.Counter(u["type"]).items())) for u in U)))
print("shocks per unit:", dict(collections.Counter(int(u["shock"].sum()) for u in U)),
      "; shocked uncertainty trials per unit:",
      dict(collections.Counter(int(u["shock"][u["type"] == "uncertainty"].sum()) for u in U)))
lag14 = np.concatenate([np.min(np.abs(u["events"]["EVT14"][None, :] - (u["onset"][:, None] + 31.5)), axis=1) for u in U])
print("EVT14 within 0.01 s of 31.5 s after a cue onset: %.1f%% of trials (median deviation %.3f s, max %.1f s)"
      % (100 * np.mean(lag14 < 0.01), np.median(lag14), lag14.max()))
# how far around each cue onset the spikes and the nose pokes are stored
for what, items in (("spikes", [(u["spikes"], u["onset"]) for u in U]),
                    ("nose pokes (EVT13)", [(u["events"]["EVT13"], u["onset"]) for u in sessions.values()])):
    aft, bef = map(np.concatenate, zip(*(pag2.time_from_onsets(t, on) for t, on in items)))
    w30 = (aft < 30) | (bef <= 20)
    w33 = (aft < 33.5) | (bef <= 20.5)
    tail = aft[(bef > 20.5) & np.isfinite(aft)]
    print(f"{what}: {aft.size}; within 20 s before to 30 s after a cue onset {100 * w30.mean():.2f}%, within 20.5 s before"
          f" to 33.5 s after {100 * w33.mean():.3f}% ({int((~w33).sum())} outside); time after the latest onset, outside the 20.5 s"
          f" before the next: 99th percentile {np.percentile(tail, 99):.1f} s, 99.9th {np.percentile(tail, 99.9):.1f} s;"
          f" largest time before the first cue onset of a session {bef[~np.isfinite(aft)].max():.1f} s")
gaps = np.concatenate([np.diff(np.sort(u["onset"])) for u in sessions.values()])
print("gap between consecutive cue onsets: %.1f to %.1f s, mean %.1f s" % (gaps.min(), gaps.max(), gaps.mean()))

# the authors' script: what it holds that the analysis could use
script = zf.read("data/vlpagAnalysis.m").decode("latin-1").lower()
print("\nvlpagAnalysis.m:", len(script.splitlines()), "lines; occurrences of",
      {w: script.count(w) for w in ("bregma", "outlier", "exclu", "regress(", "corrcoef", "corr(")})
script_lines = zf.read("data/vlpagAnalysis.m").decode("latin-1").splitlines()
def show(a, b):
    for k in range(a, b + 1):
        print(f"{k:5d}  {script_lines[k - 1]}")
print("\nthe interval regressions of Control cue-excited neurons (the other groups and types follow the same pattern):")
show(2149, 2150); show(2162, 2171)
print("\nthe per-neuron mean firing of cue-inhibited neurons:")
show(2796, 2817)
import re
print("\nper-neuron window means of cue-inhibited firing anywhere in the script:",
      sorted(set(re.findall(r"inh\.fire\.z\.ms250\.(\w*(?:firstfive|lastfive|cueentire)mean)", script))))
vlPAGcube.name                            (1, 22)          <U354    
vlPAGcube.wave                            (32, 1, 354)     float64  (np.float64(-0.6401225022921883), np.float64(0.5138043102796415))
vlPAGcube.tag                             (32, 2, 354)     float64  (np.float64(1.0), np.float64(18751.420575))
vlPAGcube.poke.base                       (32, 1, 354)     uint8    (np.uint8(0), np.uint8(99))
vlPAGcube.poke.cue                        (32, 1, 354)     uint8    (np.uint8(0), np.uint8(114))
vlPAGcube.poke.s1.interval                (32, 50, 354)    uint16   (np.uint16(0), np.uint16(420))
vlPAGcube.poke.ms500.interval             (32, 100, 354)   uint16   (np.uint16(0), np.uint16(600))
vlPAGcube.cer.cue                         (32, 1, 354)     float64  (np.float64(-1.0), np.float64(1.0))
vlPAGcube.cer.s1.interval                 (32, 50, 354)    float64  (np.float64(-1.0), np.float64(1.0))
vlPAGcube.cer.ms500.interval              (32, 100, 354)   float64  (np.float64(-1.0), np.float64(1.0))
vlPAGcube.fire.raw.base2                  (32, 1, 354)     uint8    (np.uint8(0), np.uint8(193))
vlPAGcube.fire.raw.base5                  (32, 1, 354)     uint8    (np.uint8(0), np.uint8(176))
vlPAGcube.fire.raw.base10                 (32, 1, 354)     uint8    (np.uint8(0), np.uint8(156))
vlPAGcube.fire.raw.select.shockOnly       (32, 1, 354)     uint8    (np.uint8(0), np.uint8(186))
vlPAGcube.fire.raw.select.shock           (32, 1, 354)     uint8    (np.uint8(0), np.uint8(149))
vlPAGcube.fire.raw.select.cueOnset        (32, 1, 354)     uint8    (np.uint8(0), np.uint8(197))
vlPAGcube.fire.raw.select.cueOffset       (32, 1, 354)     uint8    (np.uint8(0), np.uint8(202))
vlPAGcube.fire.raw.select.cueEntire       (32, 1, 354)     uint8    (np.uint8(0), np.uint8(154))
vlPAGcube.fire.raw.select.cueFirstFive    (32, 1, 354)     uint8    (np.uint8(0), np.uint8(180))
vlPAGcube.fire.raw.select.cueLastFive     (32, 1, 354)     uint8    (np.uint8(0), np.uint8(154))
vlPAGcube.fire.raw.s1.interval            (32, 50, 354)    uint16   (np.uint16(0), np.uint16(257))
vlPAGcube.fire.raw.ms500.interval         (32, 100, 354)   uint16   (np.uint16(0), np.uint16(272))
vlPAGcube.fire.raw.ms250.interval         (32, 200, 354)   uint16   (np.uint16(0), np.uint16(320))
vlPAGcube.fire.raw.ms100.interval         (32, 500, 354)   uint16   (np.uint16(0), np.uint16(440))
vlPAGcube.fire.diff.s1.interval           (32, 50, 354)    int16    (np.int16(-182), np.int16(220))
vlPAGcube.fire.diff.ms500.interval        (32, 100, 354)   int16    (np.int16(-191), np.int16(241))
vlPAGcube.fire.diff.ms250.interval        (32, 200, 354)   int16    (np.int16(-193), np.int16(293))
vlPAGcube.fire.diff.ms100.interval        (32, 500, 354)   int16    (np.int16(-193), np.int16(384))
vlPAGcube.fire.z.s1.interval              (32, 50, 354)    float64  (np.float64(-5.623197624702629), np.float64(14.735960431006063))
vlPAGcube.fire.z.ms500.interval           (32, 100, 354)   float64  (np.float64(-5.403542778373317), np.float64(16.039552201650896))
vlPAGcube.fire.z.ms250.interval           (32, 200, 354)   float64  (np.float64(-5.394688579003714), np.float64(25.936007964353593))
vlPAGcube.fire.z.ms100.interval           (32, 500, 354)   float64  (np.float64(-4.892211588264608), np.float64(31.381696358225007))

rats: {'Con': ['mh09', 'mh12', 'mh14', 'mh21', 'mh22', 'mh23', 'mh24', 'mh26'], 'EAA': ['mh15', 'mh17', 'mh29', 'mh30', 'mh31', 'mh32', 'mh34', 'mh35', 'mh36', 'mh38', 'mh39', 'mh40']}
rats in the script's lists but not in the data: ['mh10', 'mh11', 'mh13', 'mh16', 'mh18', 'mh19', 'mh20', 'mh25', 'mh27', 'mh28', 'mh33', 'mh37']
units per group: {np.str_('Con'): 151, np.str_('EAA'): 203}
sessions (rat and date): 182 {'Con': 74, 'EAA': 108} ; the paper and the data description state 72 Control and 107 EAA
distinct trial tables (cue onset times): 182
sessions with more than one behaviour program: 0 ; trial tables shared by two sessions: 0
units per rat: {'mh09': 4, 'mh12': 17, 'mh14': 5, 'mh15': 1, 'mh17': 9, 'mh21': 81, 'mh22': 28, 'mh23': 9, 'mh24': 2, 'mh26': 5, 'mh29': 5, 'mh30': 1, 'mh31': 28, 'mh32': 42, 'mh34': 7, 'mh35': 2, 'mh36': 22, 'mh38': 16, 'mh39': 64, 'mh40': 6}
behaviour programs: {'epr38a': 161, 'epr38c': 96, 'epr38b': 97}
pairs of units with the same spike count and binned counts (possible duplicates): 0

cue onsets equal to the cube's tag in 354/354 units, trial types in 354/354
   ('epr38a', 'EVT09', np.str_('danger')) 161 units
   ('epr38a', 'EVT11', np.str_('safety')) 161 units
   ('epr38a', 'EVT12', np.str_('uncertainty')) 161 units
   ('epr38b', 'EVT09', np.str_('uncertainty')) 97 units
   ('epr38b', 'EVT11', np.str_('danger')) 97 units
   ('epr38b', 'EVT12', np.str_('safety')) 97 units
   ('epr38c', 'EVT09', np.str_('safety')) 96 units
   ('epr38c', 'EVT11', np.str_('uncertainty')) 96 units
   ('epr38c', 'EVT12', np.str_('danger')) 96 units
trials per unit: {32: 354} ; per type: {((np.str_('danger'), 6), (np.str_('safety'), 10), (np.str_('uncertainty'), 16)): 354}
shocks per unit: {12: 354} ; shocked uncertainty trials per unit: {6: 354}
EVT14 within 0.01 s of 31.5 s after a cue onset: 62.5% of trials (median deviation 0.000 s, max 2.0 s)
spikes: 12899982; within 20 s before to 30 s after a cue onset 95.54%, within 20.5 s before to 33.5 s after 99.980% (2616 outside); time after the latest onset, outside the 20.5 s before the next: 99th percentile 32.7 s, 99.9th 33.4 s; largest time before the first cue onset of a session 20.1 s
nose pokes (EVT13): 92246; within 20 s before to 30 s after a cue onset 94.58%, within 20.5 s before to 33.5 s after 99.989% (10 outside); time after the latest onset, outside the 20.5 s before the next: 99th percentile 32.9 s, 99.9th 33.5 s; largest time before the first cue onset of a session 19.9 s
gap between consecutive cue onsets: 132.5 to 194.5 s, mean 163.3 s

vlpagAnalysis.m: 4908 lines; occurrences of {'bregma': 0, 'outlier': 0, 'exclu': 0, 'regress(': 22, 'corrcoef': 0, 'corr(': 0}

the interval regressions of Control cue-excited neurons (the other groups and types follow the same pattern):
 2149  regBlank = [1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1]; % must be first regression term
 2150  regProb = [1;1;1;1;1;1;0.375;0.375;0.375;0.375;0.375;0.375;0.375;0.375;0.375;0.375;0.375;0.375;0.375;0.375;0.375;0.375;0;0;0;0;0;0;0;0;0;0]; % shock probability
 2162  for ii = 1:size(con.exc.tag,3)
 2163     
 2164      for jj = 1:14 % regression for pre-cue period (2 intervals), cue period (10 intervals) and delay period (2 intervals)
 2165      regData(:,jj,ii) = con.exc.fire.z.s1.interval(:,jj+18,ii);
 2166      regInterval = con.exc.cer.s1.interval(:,jj+18,ii);
 2167      regTotal = con.exc.cer.cue(:,1,ii);
 2168      regCueTerms = [regBlank,regTotal,regProb];
 2169      [b,~,~,~,~] = regress(regData(:,jj,ii),regCueTerms);
 2170      con.exc.fire.z.s1.reg(1:2,jj,ii) = b(2:3,1);
 2171      end

the per-neuron mean firing of cue-inhibited neurons:
 2796  % Find mean firing in first 5 seconds %
 2797  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 2798  
 2799  con.inh.fire.z.ms250.cue100firstFiveMean = mean(con.inh.fire.z.ms250.cue100(:,81:100),2);
 2800  con.inh.fire.z.ms250.cuePRfirstFiveMean = mean(con.inh.fire.z.ms250.cuePR(:,81:100),2);
 2801  con.inh.fire.z.ms250.cue0firstFiveMean = mean(con.inh.fire.z.ms250.cue0(:,81:100),2);
 2802  
 2803  eaa.inh.fire.z.ms250.cue100firstFiveMean = mean(eaa.inh.fire.z.ms250.cue100(:,81:100),2);
 2804  eaa.inh.fire.z.ms250.cuePRfirstFiveMean = mean(eaa.inh.fire.z.ms250.cuePR(:,81:100),2);
 2805  eaa.inh.fire.z.ms250.cue0firstFiveMean = mean(eaa.inh.fire.z.ms250.cue0(:,81:100),2);
 2806  
 2807  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 2808  % Find mean firing for whole cue %
 2809  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 2810  
 2811  con.inh.fire.z.ms250.cue100cueEntireMean = mean(con.inh.fire.z.ms250.cue100(:,81:120),2);
 2812  con.inh.fire.z.ms250.cuePRcueEntireMean = mean(con.inh.fire.z.ms250.cuePR(:,81:120),2);
 2813  con.inh.fire.z.ms250.cue0cueEntireMean = mean(con.inh.fire.z.ms250.cue0(:,81:120),2);
 2814  
 2815  eaa.inh.fire.z.ms250.cue100cueEntireMean = mean(eaa.inh.fire.z.ms250.cue100(:,81:120),2);
 2816  eaa.inh.fire.z.ms250.cuePRcueEntireMean = mean(eaa.inh.fire.z.ms250.cuePR(:,81:120),2);
 2817  eaa.inh.fire.z.ms250.cue0cueEntireMean = mean(eaa.inh.fire.z.ms250.cue0(:,81:120),2);

per-neuron window means of cue-inhibited firing anywhere in the script: ['cue0cueentiremean', 'cue0firstfivemean', 'cue100cueentiremean', 'cue100firstfivemean', 'cueprcueentiremean', 'cueprfirstfivemean']
In [3]:
# The cube's stored values against values computed from the spikes and pokes
B10 = pag2.cube_field(cube, "fire.raw.base10")[:, 0, :].astype(float)
CSEL = {w: pag2.cube_field(cube, "fire.raw.select." + k)[:, 0, :].astype(float)
        for w, k in (("first1", "cueOnset"), ("first5", "cueFirstFive"), ("last5", "cueLastFive"))}
exact = np.array([pag2.window_rate(u, "base10") for u in U]).T
d = exact - B10
print("fire.raw.base10 minus exact 10 s rate: %.2f to %.2f Hz; cube equals floor(exact) in %.1f%% of trials"
      % (-d.max(), -d.min(), 100 * np.mean(np.floor(exact + 1e-9) == B10)))
print("cube rates stored as", pag2.cube_field(cube, "fire.raw.base10").dtype,
      "; units with a mean 10 s baseline under 1 Hz:", int(np.sum(exact.mean(0) < 1)),
      "; trials whose stored baseline is 0 Hz while spikes were fired:", int(np.sum((B10 == 0) & (exact > 0))))
cz = pag2.cube_field(cube, "fire.z.s1.interval")
cd = pag2.cube_field(cube, "fire.diff.s1.interval").astype(float)
err_d = err_z = 0.0
for j, u in enumerate(U):
    r1 = u["counts"].reshape(32, 50, 4).sum(2).astype(float)          # spikes per 1 s bin = Hz
    own = r1[:, 18:20].mean(1, keepdims=True)
    err_d = max(err_d, np.abs(r1 - own - cd[:, :, j]).max())
    z = (cd[:, :, j] - cd[:, :, j].mean()) / cd[:, :, j].std(ddof=1)
    err_z = max(err_z, np.abs(z - cz[:, :, j]).max())
print("fire.diff.s1 = 1 s rate minus the trial's own 2 s baseline, within %.2f Hz (stored as integers)" % err_d)
print("fire.z.s1 = fire.diff.s1 Z scored over all trials and bins of the unit (ddof 1), within %.1g" % err_z)

# nose pokes and suppression ratios
pb = pag2.cube_field(cube, "poke.base")[:, 0, :].astype(float)
pc = pag2.cube_field(cube, "poke.cue")[:, 0, :].astype(float)
csr = pag2.cube_field(cube, "cer.cue")[:, 0, :]
mine_pb = np.array([u["poke_base"] / 20 * 60 for u in U]).T
mine_pc = np.array([u["poke_cue"] / 10 * 60 for u in U]).T
print("\npoke.base equals pokes per minute in the 20 s before cue onset in %.1f%% of trials" % (100 * np.mean(np.isclose(pb, mine_pb))))
for w in (2, 10):
    alt = np.array([(np.searchsorted(u["events"]["EVT13"], u["onset"]) - np.searchsorted(u["events"]["EVT13"], u["onset"] - w)) / w * 60 for u in U]).T
    print("   with a %d s window: %.1f%%" % (w, 100 * np.mean(np.isclose(pb, alt))))
print("poke.cue equals pokes per minute in the 10 s cue in %.1f%% of trials" % (100 * np.mean(np.isclose(pc, mine_pc))))
sr = np.array([pag2.suppression_ratio(u, "drop") for u in U]).T
empty = np.isnan(sr)
print("cer.cue equals (base - cue)/(base + cue) with the 20 s baseline in %.2f%% of trials with pokes;"
      % (100 * np.mean(np.isclose(sr[~empty], csr[~empty]))),
      "trials with no poke in baseline and cue:", int(empty.sum()), "(unit-trials), stored as", np.unique(csr[empty]))
nsess_empty = collections.Counter()
for s, u in sessions.items():
    nsess_empty[u["group"]] += int(np.isnan(pag2.suppression_ratio(u, "drop")).sum())
print("empty trials over the 182 sessions:", dict(nsess_empty), "of", {g: 32 * n for g, n in collections.Counter(s["group"] for s in sessions.values()).items()})
print("suppression ratio range %.2f to %.2f; firing in 250 ms bins 0 to %.0f Hz; spike count per unit %d to %d"
      % (np.nanmin(sr), np.nanmax(sr), max(pag2.rates(u).max() for u in U), min(u["n_spikes"] for u in U), max(u["n_spikes"] for u in U)))
fire.raw.base10 minus exact 10 s rate: -0.90 to -0.00 Hz; cube equals floor(exact) in 100.0% of trials
cube rates stored as uint8 ; units with a mean 10 s baseline under 1 Hz: 22 ; trials whose stored baseline is 0 Hz while spikes were fired: 775
fire.diff.s1 = 1 s rate minus the trial's own 2 s baseline, within 2.00 Hz (stored as integers)
fire.z.s1 = fire.diff.s1 Z scored over all trials and bins of the unit (ddof 1), within 1e-13

poke.base equals pokes per minute in the 20 s before cue onset in 99.8% of trials
   with a 2 s window: 4.2%
   with a 10 s window: 19.0%
poke.cue equals pokes per minute in the 10 s cue in 99.8% of trials
cer.cue equals (base - cue)/(base + cue) with the 20 s baseline in 99.79% of trials with pokes; trials with no poke in baseline and cue: 255 (unit-trials), stored as [1.]
empty trials over the 182 sessions: {'Con': 88, 'EAA': 55} of {'Con': 2368, 'EAA': 3456}
suppression ratio range -1.00 to 1.00; firing in 250 ms bins 0 to 320 Hz; spike count per unit 308 to 204854

Clock check. The spikes and pokes are stored only around the trials (printed below and above), so the onsets cannot be moved into the inter-trial interval. Cue responses should appear at the cue onsets of the trial table and vanish when the onsets are moved 10 s earlier, so that every window falls before the cue; the selection rule (reading b, exact rates) is run at both, and the rates in the shifted baseline are printed to show that the spikes cover it. For the pokes, the danger minus safety suppression ratio is compared between the true labels and labels permuted within each session (seeded generator).

In [4]:
e, i = pag2.SELECTION_READINGS["b"]
true_lab = np.array([pag2.select(u, e, i) for u in U])
shift_lab = np.array([pag2.select(u, e, i, shifted=True) for u in U])
print("cue-responsive units at the true onsets:", int(np.sum(true_lab != "osc")), "of", len(U),
      "; at onsets 10 s earlier:", int(np.sum(shift_lab != "osc")),
      "(chance under the rule: about 6 tests x 2 tails x 0.0083/2 = %.1f%% of units)" % (100 * (1 - (1 - 0.0083) ** 6)))
print("mean rate in the 10 s baseline: true %.2f Hz, shifted (20 to 10 s before onset) %.2f Hz"
      % (np.mean([pag2.window_rate(u, "base10").mean() for u in U]), np.mean([pag2.window_rate(u, "base10", True).mean() for u in U])))
rng_clock = np.random.default_rng(1)
dsr = []
for s, u in sessions.items():
    a = pag2.suppression_ratio(u, "zero")
    perm = rng_clock.permutation(u["type"])
    dsr.append((a[u["type"] == "danger"].mean() - a[u["type"] == "safety"].mean(),
                a[perm == "danger"].mean() - a[perm == "safety"].mean()))
dsr = np.array(dsr)
print("danger minus safety suppression ratio per session, mean: true labels %.3f, permuted labels %.3f; sessions with danger > safety: %d and %d of %d"
      % (dsr[:, 0].mean(), dsr[:, 1].mean(), np.sum(dsr[:, 0] > 0), np.sum(dsr[:, 1] > 0), len(dsr)))
cue-responsive units at the true onsets: 221 of 354 ; at onsets 10 s earlier: 15 (chance under the rule: about 6 tests x 2 tails x 0.0083/2 = 4.9% of units)
mean rate in the 10 s baseline: true 21.46 Hz, shifted (20 to 10 s before onset) 21.44 Hz
danger minus safety suppression ratio per session, mean: true labels 0.842, permuted labels 0.005; sessions with danger > safety: 181 and 97 of 182

Findings of the data check, stated with the numbers above:

  • The 354 units (151 Control, 203 EAA) and 20 rats (8 Control, 12 EAA) match the paper. No two units share their spike counts, so no recording is deposited twice. Cue responses are present at the trial table's onsets and nearly absent 10 s earlier, and fear follows the cue labels, which is consistent with the spikes, pokes and trial table sharing a clock. The sessions do not: the units come from 182 sessions (rat and date, each with its own trial table), 74 Control and 108 EAA, where the paper and the data description state 72 and 107. No session holds more than one behaviour program and no two sessions share a trial table, so the extra sessions are not duplicates; the difference is not explained.
  • The group of each rat is given only by the lists in the authors' script, not by the data description or the files.
  • The event codes are not documented. EVT09, EVT11 and EVT12 are the cue onsets, but which code is danger, uncertainty or safety changes with the behaviour program (epr38a, b, c); EVT08 holds the shocks, EVT13 the nose pokes, EVT14 a marker about 31.5 s after each cue onset. Spikes and nose pokes are stored only around the trials, from about 20 s before to about 33.5 s after each cue onset, not over the whole session: 99.98% of spikes and 99.99% of pokes fall within 20.5 s before to 33.5 s after an onset, and 4.5% of spikes and 5.4% of pokes fall outside 20 s before to 30 s after.
  • The cube stores raw firing rates as integers truncated towards zero (uint8), so a unit firing below 1 Hz has stored rates of 0.
  • poke.base is the poke rate per minute in the 20 s before cue onset, not "2 s prior to cue presentation" as the data description says, and it is per minute, a unit the description does not give.
  • cer.cue stores 1 for the trials with no poke in baseline or cue (a ratio of 0/0).
  • The data description gives the uncertainty shock rows a shock probability of 0.25; the paper and the description's own summary give 0.375.
  • The data set holds no body weights, no pre-surgery discrimination sessions, and no bregma level per rat (the description gives only how many rats were at each of four levels). The authors' script does not mention bregma and has no step that excludes neurons (no occurrence of "bregma", "outlier" or "exclu").

Blocked claims¶

fig1bc-adversity-slows-weight-gain needs the body weights from P24 to P55, and fig1ef-acquisition-equivalent-final the eight pre-surgery discrimination sessions. Neither is in the data set: its files are the 354 recording-session units, the cube built from them, the script and three cue sounds (listed in the first cell), and the data description lists nothing else. Both are blocked as data_missing.

fig2b-baseline-poke-equivalent¶

Control and EAA rats had equivalent baseline nose poke rates during recording sessions.

One baseline rate per rat, from the 20 s before cue onset (Methods, "Calculating suppression ratios"), over its recording sessions; each session is counted once although several units share it. Readings: the mean of the rat's session means, and the mean over all its trials pooled. Two-sided independent samples t test.

In [5]:
def per_rat(fn):
    out = {}
    for s, u in sessions.items():
        out.setdefault(u["rat"], []).append(fn(u))
    return out

rats_sorted = sorted(set(u["rat"] for u in U))
rgrp = np.array([pag2.group_of(r) for r in rats_sorted])
base = per_rat(lambda u: u["poke_base"] / 20 * 60)
readings_bp = {
    "mean of session means": np.array([np.mean([x.mean() for x in base[r]]) for r in rats_sorted]),
    "all trials pooled": np.array([np.concatenate(base[r]).mean() for r in rats_sorted]),
}
for k, v in readings_bp.items():
    t = stats.ttest_ind(v[rgrp == "Con"], v[rgrp == "EAA"])
    print(f"{k:22s} Con {v[rgrp=='Con'].mean():.2f} (sd {v[rgrp=='Con'].std(ddof=1):.2f}) EAA {v[rgrp=='EAA'].mean():.2f} "
          f"(sd {v[rgrp=='EAA'].std(ddof=1):.2f}) pokes/min; t({t.df:.0f}) = {t.statistic:.2f}, p = {t.pvalue:.3f}")
print("per rat (pokes/min):", {r: round(v, 1) for r, v in zip(rats_sorted, readings_bp["mean of session means"])})
print("sessions per rat:", {r: len(base[r]) for r in rats_sorted})
mean of session means  Con 23.08 (sd 7.76) EAA 19.22 (sd 6.63) pokes/min; t(18) = 1.19, p = 0.248
all trials pooled      Con 23.08 (sd 7.76) EAA 19.22 (sd 6.63) pokes/min; t(18) = 1.19, p = 0.248
per rat (pokes/min): {'mh09': np.float64(39.0), 'mh12': np.float64(25.2), 'mh14': np.float64(20.0), 'mh15': np.float64(20.0), 'mh17': np.float64(22.9), 'mh21': np.float64(16.0), 'mh22': np.float64(13.0), 'mh23': np.float64(23.8), 'mh24': np.float64(24.5), 'mh26': np.float64(23.1), 'mh29': np.float64(20.5), 'mh30': np.float64(17.8), 'mh31': np.float64(22.5), 'mh32': np.float64(10.6), 'mh34': np.float64(13.7), 'mh35': np.float64(17.2), 'mh36': np.float64(14.5), 'mh38': np.float64(15.9), 'mh39': np.float64(36.9), 'mh40': np.float64(18.1)}
sessions per rat: {'mh09': 4, 'mh12': 12, 'mh14': 5, 'mh15': 1, 'mh17': 9, 'mh21': 21, 'mh22': 18, 'mh23': 8, 'mh24': 2, 'mh26': 4, 'mh29': 4, 'mh30': 1, 'mh31': 11, 'mh32': 16, 'mh34': 7, 'mh35': 2, 'mh36': 12, 'mh38': 16, 'mh39': 24, 'mh40': 5}

Result: reproduced. Under both readings the groups do not differ (t(18) = 1.19, p = 0.25; the paper gives t = 1.24, p = 0.23); every session has 32 trials, so the two readings give the same values.

fig2c-recording-discrimination¶

During recording sessions both groups showed high fear to danger, less to uncertainty and least to safety, with a main effect of cue, no group by cue interaction, and each cue pair differing in each group.

Per rat, the mean suppression ratio for each cue over its recording sessions (each session once). Mixed ANOVA, cue within, group between; paired t tests within each group. Readings: rat value as the mean of session means or over trials pooled; trials with no pokes (0/0) set to 0, dropped, or set to 1 as the cube stores them.

In [6]:
def sr_rat(empty, comb):
    vals = per_rat(lambda u: (pag2.suppression_ratio(u, empty), u["type"]))
    Y = []
    for r in rats_sorted:
        if comb == "session means":
            Y.append([np.mean([np.nanmean(s[t == ty]) for s, t in vals[r]]) for ty in pag2.TYPES])
        else:
            s = np.concatenate([x[0] for x in vals[r]]); t = np.concatenate([x[1] for x in vals[r]])
            Y.append([np.nanmean(s[t == ty]) for ty in pag2.TYPES])
    return np.array(Y)

for empty in ("zero", "drop", "one"):
    for comb in ("session means", "pooled"):
        Y = sr_rat(empty, comb)
        a = pag2.mixed_anova(Y, rgrp)
        line = f"empty={empty:4s} {comb:13s} cue F({a['A'][1]},{a['A'][2]}) = {a['A'][0]:.1f}, p = {a['A'][3]:.1e}; " \
               f"group x cue F = {a['group:A'][0]:.2f}, p = {a['group:A'][3]:.2f};"
        for g in ("Con", "EAA"):
            x = Y[rgrp == g]
            t1 = stats.ttest_rel(x[:, 0], x[:, 1]); t2 = stats.ttest_rel(x[:, 1], x[:, 2])
            line += f" {g} D-U t = {t1.statistic:.2f} p = {t1.pvalue:.4f}, U-S t = {t2.statistic:.2f} p = {t2.pvalue:.1e};"
        print(line)
        if empty == "zero" and comb == "session means":
            print("   means (danger, uncertainty, safety):", {g: Y[rgrp == g].mean(0).round(3) for g in ("Con", "EAA")},
                  "range per rat %.2f to %.2f" % (Y.min(), Y.max()))
empty=zero session means cue F(2,36) = 179.5, p = 1.9e-19; group x cue F = 0.17, p = 0.85; Con D-U t = 3.57 p = 0.0091, U-S t = 5.54 p = 8.7e-04; EAA D-U t = 6.01 p = 0.0001, U-S t = 12.32 p = 8.9e-08;
   means (danger, uncertainty, safety): {'Con': array([0.919, 0.715, 0.117]), 'EAA': array([0.9  , 0.69 , 0.049])} range per rat -0.11 to 1.00
empty=zero pooled        cue F(2,36) = 179.5, p = 1.9e-19; group x cue F = 0.17, p = 0.85; Con D-U t = 3.57 p = 0.0091, U-S t = 5.54 p = 8.7e-04; EAA D-U t = 6.01 p = 0.0001, U-S t = 12.32 p = 8.9e-08;
empty=drop session means cue F(2,36) = 190.7, p = 7.0e-20; group x cue F = 0.10, p = 0.90; Con D-U t = 3.68 p = 0.0079, U-S t = 5.57 p = 8.4e-04; EAA D-U t = 5.74 p = 0.0001, U-S t = 13.47 p = 3.5e-08;
empty=drop pooled        cue F(2,36) = 191.1, p = 6.7e-20; group x cue F = 0.11, p = 0.90; Con D-U t = 3.68 p = 0.0079, U-S t = 5.59 p = 8.2e-04; EAA D-U t = 5.76 p = 0.0001, U-S t = 13.34 p = 3.9e-08;
empty=one  session means cue F(2,36) = 194.5, p = 5.0e-20; group x cue F = 0.17, p = 0.84; Con D-U t = 3.59 p = 0.0089, U-S t = 5.71 p = 7.3e-04; EAA D-U t = 5.90 p = 0.0001, U-S t = 13.19 p = 4.4e-08;
empty=one  pooled        cue F(2,36) = 194.5, p = 5.0e-20; group x cue F = 0.17, p = 0.84; Con D-U t = 3.59 p = 0.0089, U-S t = 5.71 p = 7.3e-04; EAA D-U t = 5.90 p = 0.0001, U-S t = 13.19 p = 4.4e-08;

Result: reproduced. Under every reading the cue effect is large (F(2,36) from 179.5 to 194.5, p <= 1.9e-19), the group by cue interaction is absent (p from 0.84 to 0.90), and all four paired tests have p <= 0.0091 with danger > uncertainty > safety in both groups.

fig2d-cue-responsive-counts¶

32 of 151 Control neurons (21.2%) and 49 of 203 EAA neurons (24.1%) were cue-excited; 48 of 151 Control neurons (31.8%) and 84 of 203 EAA neurons (41.4%) were cue-inhibited.

Paired t tests (two-sided, p < 0.0083) of the raw rate in the 10 s before cue onset against each cue epoch, per cue, under the three readings of the claims file. Two sources of the raw rates are run: the exact rates from the spike times, and the rates stored in the authors' cube (fire.raw.base10 and fire.raw.select.cueOnset, cueFirstFive, cueLastFive), which are truncated to whole Hz. The authors' script runs its selection on the cube's stored rates (vlpagAnalysis.m, lines 9 to 67, MATLAB ttest(x, y), a paired test, at alpha 0.00833) with reading (b) (lines 136 to 147 and 225 to 236).

In [7]:
cube_rates = [dict(base10=B10[:, j], **{w: CSEL[w][:, j] for w in CSEL}) for j in range(len(U))]
labels = {}
for rd, (e, i) in pag2.SELECTION_READINGS.items():
    labels[rd, "exact"] = np.array([pag2.select(u, e, i) for u in U])
    labels[rd, "cube"] = np.array([pag2.select(u, e, i, r=cube_rates[j]) for j, u in enumerate(U)])
expected = {("Con", "exc"): 32, ("EAA", "exc"): 49, ("Con", "inh"): 48, ("EAA", "inh"): 84}
print("reading  rates   Con exc  EAA exc  Con inh  EAA inh  (paper 32, 49, 48, 84; tolerance 10%)")
for (rd, src), L in labels.items():
    cnt = {k: int(np.sum((grp == k[0]) & (L == k[1]))) for k in expected}
    within = all(abs(cnt[k] - v) <= 0.1 * v for k, v in expected.items())
    print(f"   {rd}     {src:6s}  " + "  ".join(f"{cnt[k]:7d}" for k in expected) + f"   all within tolerance: {within}")
print("unit totals:", dict(collections.Counter(grp)))
lab = labels["b", "cube"]          # the selection used by the claims that follow
lab_exact = labels["b", "exact"]
print("\nselection used below: reading (b), cube rates. Agreement with exact rates, reading (b):",
      int(np.sum(lab == lab_exact)), "of", len(U), "units;", collections.Counter(zip(lab, lab_exact)))
for g in ("Con", "EAA"):
    print(g, "by rat:", {r: dict(collections.Counter(lab[[u['rat'] == r for u in U]])) for r in rats_sorted if pag2.group_of(r) == g})
reading  rates   Con exc  EAA exc  Con inh  EAA inh  (paper 32, 49, 48, 84; tolerance 10%)
   a     exact        30       50       44       73   all within tolerance: False
   a     cube         32       49       34       67   all within tolerance: False
   b     exact        30       50       54       87   all within tolerance: False
   b     cube         32       49       48       84   all within tolerance: True
   c     exact        30       48       51       89   all within tolerance: True
   c     cube         32       47       43       85   all within tolerance: False
unit totals: {np.str_('Con'): 151, np.str_('EAA'): 203}

selection used below: reading (b), cube rates. Agreement with exact rates, reading (b): 340 of 354 units; Counter({(np.str_('inh'), np.str_('inh')): 131, (np.str_('osc'), np.str_('osc')): 130, (np.str_('exc'), np.str_('exc')): 79, (np.str_('osc'), np.str_('inh')): 10, (np.str_('exc'), np.str_('osc')): 2, (np.str_('osc'), np.str_('exc')): 1, (np.str_('inh'), np.str_('osc')): 1})
Con by rat: {'mh09': {np.str_('inh'): 2, np.str_('osc'): 2}, 'mh12': {np.str_('inh'): 8, np.str_('exc'): 8, np.str_('osc'): 1}, 'mh14': {np.str_('exc'): 2, np.str_('inh'): 3}, 'mh21': {np.str_('osc'): 53, np.str_('exc'): 8, np.str_('inh'): 20}, 'mh22': {np.str_('osc'): 7, np.str_('exc'): 11, np.str_('inh'): 10}, 'mh23': {np.str_('exc'): 1, np.str_('inh'): 3, np.str_('osc'): 5}, 'mh24': {np.str_('osc'): 2}, 'mh26': {np.str_('osc'): 1, np.str_('exc'): 2, np.str_('inh'): 2}}
EAA by rat: {'mh15': {np.str_('inh'): 1}, 'mh17': {np.str_('inh'): 2, np.str_('exc'): 5, np.str_('osc'): 2}, 'mh29': {np.str_('osc'): 2, np.str_('exc'): 1, np.str_('inh'): 2}, 'mh30': {np.str_('exc'): 1}, 'mh31': {np.str_('osc'): 19, np.str_('exc'): 5, np.str_('inh'): 4}, 'mh32': {np.str_('osc'): 13, np.str_('inh'): 21, np.str_('exc'): 8}, 'mh34': {np.str_('osc'): 3, np.str_('exc'): 4}, 'mh35': {np.str_('inh'): 2}, 'mh36': {np.str_('exc'): 7, np.str_('inh'): 9, np.str_('osc'): 6}, 'mh38': {np.str_('inh'): 7, np.str_('exc'): 4, np.str_('osc'): 5}, 'mh39': {np.str_('inh'): 35, np.str_('osc'): 20, np.str_('exc'): 9}, 'mh40': {np.str_('exc'): 5, np.str_('inh'): 1}}

Result: reproduced. With the cube's stored rates and reading (b), the counts are 32, 49, 48 and 84, the paper's exactly, and the totals are 151 and 203. With exact rates from the spike times, reading (c) is also within tolerance (30, 48, 51, 89), while reading (b) gives 30, 50, 54 and 87, the Control inhibited count outside the tolerance. Reading (a) is outside under both rate sources (Control inhibited 44 and 34). The paper's counts follow exactly from the cube's truncated rates and the script's reading (b), which the claims that follow use.

fig2d-higher-proportion-responsive¶

A higher proportion of EAA neurons than Control neurons were cue-responsive (133/203, 65.5%, against 80/151, 53.0%).

Pearson chi-square without continuity correction on the 2 by 2 table, under every reading of the selection.

In [8]:
for (rd, src), L in labels.items():
    tab = np.array([[np.sum((grp == g) & (L != "osc")), np.sum((grp == g) & (L == "osc"))] for g in ("Con", "EAA")])
    chi, p, *_ = stats.chi2_contingency(tab, correction=False)
    chiy, py, *_ = stats.chi2_contingency(tab, correction=True)
    fr = tab[:, 0] / tab.sum(1)
    print(f"reading {rd} {src:5s}: Con {tab[0,0]}/{tab[0].sum()} = {fr[0]:.3f}, EAA {tab[1,0]}/{tab[1].sum()} = {fr[1]:.3f}; "
          f"chi2 = {chi:.2f}, p = {p:.3f} (Yates {chiy:.2f}, p = {py:.3f})")
reading a exact: Con 74/151 = 0.490, EAA 123/203 = 0.606; chi2 = 4.71, p = 0.030 (Yates 4.25, p = 0.039)
reading a cube : Con 66/151 = 0.437, EAA 116/203 = 0.571; chi2 = 6.26, p = 0.012 (Yates 5.73, p = 0.017)
reading b exact: Con 84/151 = 0.556, EAA 137/203 = 0.675; chi2 = 5.19, p = 0.023 (Yates 4.70, p = 0.030)
reading b cube : Con 80/151 = 0.530, EAA 133/203 = 0.655; chi2 = 5.68, p = 0.017 (Yates 5.17, p = 0.023)
reading c exact: Con 81/151 = 0.536, EAA 137/203 = 0.675; chi2 = 7.02, p = 0.008 (Yates 6.44, p = 0.011)
reading c cube : Con 75/151 = 0.497, EAA 132/203 = 0.650; chi2 = 8.41, p = 0.004 (Yates 7.79, p = 0.005)

Result: reproduced. Under the selection used here (b, cube rates) the fractions are 0.530 and 0.655 and chi-square = 5.68, p = 0.017, as in the paper; with exact rates (b) they are 0.556 and 0.675, chi-square = 5.19, p = 0.023, also within tolerance.

fig2ef-baseline-firing¶

Baseline firing rates did not differ between Control and EAA neurons of any functional type, while across groups baseline firing differed by functional type and was lowest for cue-excited neurons.

Per neuron, the mean raw rate over all trials in (a) the 10 s or (b) the 2 s before cue onset, from the spike times. Independent samples t tests per type, two-sided; one-way ANOVA over the three types, groups pooled.

In [9]:
for src, L in (("cube (b)", lab), ("exact (b)", lab_exact)):
    for w in ("base10", "base2"):
        bf = np.array([pag2.window_rate(u, w).mean() for u in U])
        tt = []
        for ty in ("exc", "inh", "osc"):
            r = stats.ttest_ind(bf[(L == ty) & (grp == "Con")], bf[(L == ty) & (grp == "EAA")])
            tt.append(f"{ty} t({r.df:.0f}) = {r.statistic:.2f} p = {r.pvalue:.2f}")
        f = stats.f_oneway(*[bf[L == ty] for ty in ("exc", "inh", "osc")])
        means = {ty: round(bf[L == ty].mean(), 2) for ty in ("exc", "inh", "osc")}
        print(f"selection {src}, {w}: " + "; ".join(tt) + f"; type F(2,{len(U)-3}) = {f.statistic:.2f}, p = {f.pvalue:.4f}; means (Hz) {means}")
print("baseline rate range: %.2f to %.2f Hz" % (bf.min(), bf.max()))
selection cube (b), base10: exc t(79) = -0.77 p = 0.44; inh t(130) = -1.09 p = 0.28; osc t(139) = 0.05 p = 0.96; type F(2,351) = 6.44, p = 0.0018; means (Hz) {'exc': np.float64(13.88), 'inh': np.float64(22.03), 'osc': np.float64(25.27)}
selection cube (b), base2: exc t(79) = -0.73 p = 0.47; inh t(130) = -1.12 p = 0.26; osc t(139) = 0.24 p = 0.81; type F(2,351) = 6.78, p = 0.0013; means (Hz) {'exc': np.float64(14.01), 'inh': np.float64(22.06), 'osc': np.float64(25.81)}
selection exact (b), base10: exc t(78) = -0.93 p = 0.36; inh t(139) = -1.52 p = 0.13; osc t(131) = 0.23 p = 0.81; type F(2,351) = 8.84, p = 0.0002; means (Hz) {'exc': np.float64(13.45), 'inh': np.float64(20.85), 'osc': np.float64(26.91)}
selection exact (b), base2: exc t(78) = -0.89 p = 0.38; inh t(139) = -1.56 p = 0.12; osc t(131) = 0.43 p = 0.67; type F(2,351) = 9.45, p = 0.0001; means (Hz) {'exc': np.float64(13.56), 'inh': np.float64(20.87), 'osc': np.float64(27.51)}
baseline rate range: 0.00 to 124.48 Hz

Result: reproduced. With the selection used here, no group difference has p < 0.05 (smallest p = 0.26, all |t| < 1.13) under either baseline window (with the exact-rate selection, smallest p = 0.12), the type effect has F(2,351) = 6.44, p = 0.0018 (10 s) and 6.78, p = 0.0013 (2 s), and cue-excited neurons have the lowest mean (13.9 Hz, against 22.0 and 25.3). The paper's error degrees of freedom are 346, five fewer than the 351 the 354 neurons give.

Normalized firing¶

As the opening comment of the claims file and the Methods ("Z score normalization") give it: per neuron and cue (danger, uncertainty with its 16 trials, safety), the trial-mean rate in 250 ms bins minus that cue's mean 2 s pre-cue rate, Z scored over all 600 bins of the neuron. The authors' script instead averages the cube's trial-wise Z scores (fire.z.ms250, each trial's own baseline subtracted and Z scored over all trials and bins); this is run as a variant for the population ANOVAs. The figure shows the population means with the selection used here.

In [10]:
NF = np.array([pag2.normalized_firing(u)[0] for u in U])            # neurons x 3 cues x 200 bins
Z250 = pag2.cube_field(cube, "fire.z.ms250.interval")
NFc = np.zeros_like(NF)
for j, u in enumerate(U):
    for k, ty in enumerate(pag2.TYPES):
        NFc[j, k] = Z250[u["type"] == ty, :, j].mean(0)
tbin = (np.arange(200) - 80) * 0.25
fig, ax = plt.subplots(2, 2, figsize=(10, 6), sharex=True)
for a_, (pop, g) in zip(ax.flat, [(p, g) for p in ("exc", "inh") for g in ("Con", "EAA")]):
    m = (lab == pop) & (grp == g)
    for k, (ty, col) in enumerate(zip(pag2.TYPES, ("red", "purple", "blue"))):
        a_.plot(tbin[72:128], NF[m, k, 72:128].mean(0), color=col, label=ty)
    a_.axvline(0, color="k", lw=0.5); a_.axvline(10, color="k", lw=0.5)
    a_.set_title(f"{g} {pop} (n = {m.sum()})"); a_.set_ylabel("Z")
ax[0, 0].legend(); ax[1, 0].set_xlabel("s from cue onset"); ax[1, 1].set_xlabel("s from cue onset")
plt.tight_layout(); plt.show()
print("plotted means range %.2f to %.2f; all points inside the axes" % (min(NF[(lab == p)][:, :, 72:128].mean(0).min() for p in ("exc", "inh")),
      max(NF[(lab == p) & (grp == g)][:, :, 72:128].mean(0).max() for p in ("exc", "inh") for g in ("Con", "EAA"))))
No description has been provided for this image
plotted means range -1.23 to 3.73; all points inside the axes

fig4ab-excited-temporal-pattern¶

Control and EAA cue-excited neurons differed in the temporal pattern of their cue-selective firing, a group by cue by bin interaction that held with bregma recording level as a factor.

Mixed ANOVA of the normalized firing in the 56 bins from 2 s before cue onset to 2 s after offset, cue and bin within, group between. The model with bregma level cannot be run: the data set gives no bregma level per rat, and the authors' script does not mention bregma (data check).

In [11]:
def pop_anova(pop, L=None, F=None):
    L = lab if L is None else L
    F = NF if F is None else F
    m = L == pop
    a = pag2.mixed_anova(F[m][:, :, pag2.WIN["anova"]], grp[m])
    return a, m

for name, L, F in (("main (cube-rate selection, Methods normalization)", lab, NF),
                   ("variant: the script's normalization", lab, NFc),
                   ("variant: exact-rate selection", lab_exact, NF)):
    a, m = pop_anova("exc", L, F)
    f = a["group:AB"]
    print(f"{name}: n = {dict(collections.Counter(grp[m]))}; group x cue x bin F({f[1]},{f[2]}) = {f[0]:.2f}, p = {f[3]:.2g};"
          f" cue x bin F = {a['AB'][0]:.2f}, p = {a['AB'][3]:.2g}")
main (cube-rate selection, Methods normalization): n = {np.str_('Con'): 32, np.str_('EAA'): 49}; group x cue x bin F(110,8690) = 1.30, p = 0.019; cue x bin F = 9.64, p = 1.1e-144
variant: the script's normalization: n = {np.str_('Con'): 32, np.str_('EAA'): 49}; group x cue x bin F(110,8690) = 1.40, p = 0.004; cue x bin F = 12.68, p = 8.2e-203
variant: exact-rate selection: n = {np.str_('Con'): 30, np.str_('EAA'): 50}; group x cue x bin F(110,8580) = 1.29, p = 0.021; cue x bin F = 9.32, p = 1.7e-138

Result: partially reproduced. The group by cue by bin interaction is significant, F(110,8690) = 1.30, p = 0.019 (the paper: F(110,8360) = 3.32, p = 3e-28), weaker than the paper's; the script's normalization gives F = 1.40, p = 0.004, and the exact-rate selection F = 1.29, p = 0.021. The part with bregma level could not be tested, as neither the data set nor the authors' script gives a bregma level per rat, so the claim holds only in the part that could be tested.

fig4c-excited-inflated-onset¶

In the first 1 s of the cue, EAA cue-excited neurons fired more than Control neurons (main effect of group), with a significant group difference to safety; both groups still discriminated danger from uncertainty and uncertainty from safety.

Per neuron, the mean normalized firing over the four bins of the first 1 s of each cue. Mixed ANOVA (cue within, group between); independent samples t tests per cue at 0.05/3; paired t tests within each group at p < 0.025.

In [12]:
def window_tests(pop, win, L=None, F=None, show=True):
    L = lab if L is None else L
    F = NF if F is None else F
    m = L == pop
    V = F[m][:, :, pag2.WIN[win]].mean(2); g = grp[m]
    a = pag2.mixed_anova(V, g)
    out = dict(group=a["group"], gxc=a["group:A"], means={gg: V[g == gg].mean(0) for gg in ("Con", "EAA")})
    out["t"] = {ty: stats.ttest_ind(V[g == "Con", k], V[g == "EAA", k]) for k, ty in enumerate(pag2.TYPES)}
    out["paired"] = {gg: {pair: stats.ttest_rel(V[g == gg, pair[0]], V[g == gg, pair[1]]) for pair in ((0, 1), (1, 2))} for gg in ("Con", "EAA")}
    if show:
        print(f"group F({a['group'][1]},{a['group'][2]}) = {a['group'][0]:.2f}, p = {a['group'][3]:.4f}; group x cue F = {a['group:A'][0]:.2f}, p = {a['group:A'][3]:.3f}")
        print("means (danger, uncertainty, safety):", {k: v.round(3) for k, v in out["means"].items()},
              "; range per neuron %.2f to %.2f" % (V.min(), V.max()))
        for ty, r in out["t"].items():
            print(f"   {ty:11s} Con vs EAA t({r.df:.0f}) = {r.statistic:.2f}, p = {r.pvalue:.4f}")
        for gg, d in out["paired"].items():
            print(f"   {gg} paired: " + "; ".join(f"{pag2.TYPES[p[0]][:3]}-{pag2.TYPES[p[1]][:3]} t({r.df:.0f}) = {r.statistic:.2f}, p = {r.pvalue:.4f}" for p, r in d.items()))
        for gg in ("Con", "EAA"):
            byrat = collections.defaultdict(list)
            for j in np.where(m & (grp == gg))[0]:
                byrat[U[j]["rat"]].append(F[j, :, pag2.WIN[win]].mean(1))
            print(f"   {gg} by rat (n, mean danger/uncertainty/safety):", {r: (len(v), np.round(np.mean(v, 0), 2).tolist()) for r, v in byrat.items()})
    return out

print("main"); o = window_tests("exc", "first1")
print("\nvariant, the script's normalization"); window_tests("exc", "first1", F=NFc)
print("\nvariant, exact-rate selection"); window_tests("exc", "first1", L=lab_exact)
main
group F(1,79) = 5.19, p = 0.0254; group x cue F = 1.39, p = 0.252
means (danger, uncertainty, safety): {'Con': array([1.311, 0.861, 0.137]), 'EAA': array([1.908, 1.496, 1.091])} ; range per neuron -1.64 to 7.21
   danger      Con vs EAA t(79) = -1.42, p = 0.1596
   uncertainty Con vs EAA t(79) = -1.92, p = 0.0587
   safety      Con vs EAA t(79) = -3.46, p = 0.0009
   Con paired: dan-unc t(31) = 3.04, p = 0.0047; unc-saf t(31) = 6.78, p = 0.0000
   EAA paired: dan-unc t(48) = 2.34, p = 0.0233; unc-saf t(48) = 3.31, p = 0.0018
   Con by rat (n, mean danger/uncertainty/safety): {'mh12': (8, [1.48, 0.75, 0.19]), 'mh14': (2, [1.4, 0.51, 0.15]), 'mh21': (8, [1.38, 0.94, 0.14]), 'mh22': (11, [1.12, 1.17, 0.11]), 'mh23': (1, [3.01, 0.83, 0.27]), 'mh26': (2, [0.47, -0.33, -0.04])}
   EAA by rat (n, mean danger/uncertainty/safety): {'mh17': (5, [2.87, 1.91, 1.52]), 'mh29': (1, [2.21, 1.25, -0.36]), 'mh30': (1, [7.09, 3.86, 3.14]), 'mh31': (5, [0.55, 0.3, 0.52]), 'mh32': (8, [4.64, 3.51, 2.64]), 'mh34': (4, [-0.61, -0.65, -0.51]), 'mh36': (7, [2.01, 1.9, 1.18]), 'mh38': (4, [1.23, 0.99, 1.05]), 'mh39': (9, [0.96, 1.18, 0.9]), 'mh40': (5, [0.95, 0.76, 0.17])}

variant, the script's normalization
group F(1,79) = 4.96, p = 0.0288; group x cue F = 1.65, p = 0.195
means (danger, uncertainty, safety): {'Con': array([0.707, 0.428, 0.036]), 'EAA': array([1.024, 0.783, 0.576])} ; range per neuron -0.76 to 4.38
   danger      Con vs EAA t(79) = -1.29, p = 0.2025
   uncertainty Con vs EAA t(79) = -1.96, p = 0.0531
   safety      Con vs EAA t(79) = -3.60, p = 0.0005
   Con paired: dan-unc t(31) = 3.29, p = 0.0025; unc-saf t(31) = 6.33, p = 0.0000
   EAA paired: dan-unc t(48) = 2.53, p = 0.0149; unc-saf t(48) = 3.44, p = 0.0012
   Con by rat (n, mean danger/uncertainty/safety): {'mh12': (8, [0.76, 0.4, 0.05]), 'mh14': (2, [1.07, 0.42, 0.14]), 'mh21': (8, [0.77, 0.47, 0.05]), 'mh22': (11, [0.5, 0.51, -0.01]), 'mh23': (1, [2.31, 0.66, 0.25]), 'mh26': (2, [0.2, -0.15, -0.03])}
   EAA by rat (n, mean danger/uncertainty/safety): {'mh17': (5, [1.52, 1.02, 0.83]), 'mh29': (1, [0.9, 0.55, -0.06]), 'mh30': (1, [4.38, 2.39, 1.95]), 'mh31': (5, [0.25, 0.19, 0.29]), 'mh32': (8, [2.58, 1.9, 1.43]), 'mh34': (4, [-0.4, -0.44, -0.35]), 'mh36': (7, [1.08, 1.09, 0.71]), 'mh38': (4, [0.49, 0.37, 0.4]), 'mh39': (9, [0.39, 0.46, 0.38]), 'mh40': (5, [0.78, 0.53, 0.14])}

variant, exact-rate selection
group F(1,78) = 4.15, p = 0.0449; group x cue F = 1.48, p = 0.230
means (danger, uncertainty, safety): {'Con': array([1.326, 0.888, 0.155]), 'EAA': array([1.863, 1.459, 1.061])} ; range per neuron -1.64 to 7.21
   danger      Con vs EAA t(78) = -1.25, p = 0.2160
   uncertainty Con vs EAA t(78) = -1.68, p = 0.0977
   safety      Con vs EAA t(78) = -3.19, p = 0.0020
   Con paired: dan-unc t(29) = 2.89, p = 0.0073; unc-saf t(29) = 6.72, p = 0.0000
   EAA paired: dan-unc t(49) = 2.34, p = 0.0233; unc-saf t(49) = 3.31, p = 0.0018
   Con by rat (n, mean danger/uncertainty/safety): {'mh12': (8, [1.48, 0.75, 0.19]), 'mh14': (2, [1.4, 0.51, 0.15]), 'mh21': (6, [1.48, 1.09, 0.23]), 'mh22': (11, [1.12, 1.17, 0.11]), 'mh23': (1, [3.01, 0.83, 0.27]), 'mh26': (2, [0.47, -0.33, -0.04])}
   EAA by rat (n, mean danger/uncertainty/safety): {'mh17': (5, [2.87, 1.91, 1.52]), 'mh29': (1, [2.21, 1.25, -0.36]), 'mh30': (1, [7.09, 3.86, 3.14]), 'mh31': (5, [0.55, 0.3, 0.52]), 'mh32': (8, [4.64, 3.51, 2.64]), 'mh34': (5, [-0.56, -0.6, -0.48]), 'mh36': (7, [2.01, 1.9, 1.18]), 'mh38': (4, [1.23, 0.99, 1.05]), 'mh39': (9, [0.96, 1.18, 0.9]), 'mh40': (5, [0.95, 0.76, 0.17])}
Out[12]:
{'group': (np.float64(4.154852911000432),
  1,
  78,
  np.float64(0.044904558941882014)),
 'gxc': (np.float64(1.4822080520147718),
  2,
  156,
  np.float64(0.23031645988138102)),
 'means': {'Con': array([1.32629255, 0.88792706, 0.15545029]),
  'EAA': array([1.86256033, 1.45871809, 1.06148621])},
 't': {'danger': TtestResult(statistic=np.float64(-1.24726204890512), pvalue=np.float64(0.216033440530133), df=np.float64(78.0)),
  'uncertainty': TtestResult(statistic=np.float64(-1.6761149798919819), pvalue=np.float64(0.0977198281047161), df=np.float64(78.0)),
  'safety': TtestResult(statistic=np.float64(-3.19166314458217), pvalue=np.float64(0.0020393733986428355), df=np.float64(78.0))},
 'paired': {'Con': {(0,
    1): TtestResult(statistic=np.float64(2.885637198878017), pvalue=np.float64(0.007299775437572622), df=np.int64(29)),
   (1,
    2): TtestResult(statistic=np.float64(6.721781176907526), pvalue=np.float64(2.2463745813406302e-07), df=np.int64(29))},
  'EAA': {(0,
    1): TtestResult(statistic=np.float64(2.342078372903238), pvalue=np.float64(0.0232847446140101), df=np.int64(49)),
   (1,
    2): TtestResult(statistic=np.float64(3.3074178390343283), pvalue=np.float64(0.0017687055735725577), df=np.int64(49))}}}

Result: reproduced. EAA cue-excited neurons fire more in the first 1 s (group F(1,79) = 5.19, p = 0.025); the safety difference is t(79) = -3.46, p = 0.0009, below 0.0167, with EAA higher; the paired tests give danger > uncertainty (Control p = 0.0047, EAA p = 0.023) and uncertainty > safety (p <= 0.0018) in both groups. Both variants meet every part. With the script's normalization the statistics are those of the paper (group F(1,79) = 4.96 against the paper's 4.96; safety t = -3.60 against 3.61).

fig4de-inhibited-temporal-pattern¶

Control and EAA cue-inhibited neurons differed in the temporal pattern of their cue firing (a group by cue by bin interaction that held with bregma level as a factor). Control neurons decreased firing equally to danger and uncertainty with little change to safety, sustained over the cue; EAA neurons decreased most to danger, less to uncertainty, mostly in the first half of the cue.

In [13]:
for name, L, F in (("main", lab, NF), ("variant: the script's normalization", lab, NFc), ("variant: exact-rate selection", lab_exact, NF)):
    a, m = pop_anova("inh", L, F)
    f = a["group:AB"]
    print(f"{name}: n = {dict(collections.Counter(grp[m]))}; group x cue x bin F({f[1]},{f[2]}) = {f[0]:.2f}, p = {f[3]:.2g}")
m = lab == "inh"
for g in ("Con", "EAA"):
    x = NF[m & (grp == g)]
    print(g, "mean normalized firing (danger, uncertainty, safety): first half",
          x[:, :, pag2.WIN["first5"]].mean((0, 2)).round(2), "second half", x[:, :, pag2.WIN["last5"]].mean((0, 2)).round(2))
main: n = {np.str_('Con'): 48, np.str_('EAA'): 84}; group x cue x bin F(110,14300) = 1.54, p = 0.00024
variant: the script's normalization: n = {np.str_('Con'): 48, np.str_('EAA'): 84}; group x cue x bin F(110,14300) = 1.72, p = 4.4e-06
variant: exact-rate selection: n = {np.str_('Con'): 54, np.str_('EAA'): 87}; group x cue x bin F(110,15290) = 1.65, p = 2.5e-05
Con mean normalized firing (danger, uncertainty, safety): first half [-0.75 -0.61  0.04] second half [-0.69 -0.67  0.05]
EAA mean normalized firing (danger, uncertainty, safety): first half [-1.06 -0.79 -0.04] second half [-0.74 -0.76 -0.01]

Result: partially reproduced. The interaction is significant, F(110,14300) = 1.54, p = 0.00024 (the paper: F(110,14190) = 1.69, p = 9e-6), and under both variants (p = 4.4e-6 and 2.5e-5). The population means follow the described pattern: Control danger and uncertainty decrease alike over both halves of the cue (-0.75 and -0.61 in the first half, -0.69 and -0.67 in the second) with safety near zero, while EAA decreases most to danger in the first half (-1.06, uncertainty -0.79) and the two are alike in the second (-0.74, -0.76). The part with bregma level could not be tested (no bregma level per rat in the data set or the script), so the claim holds only in the part that could be tested.

fig4f-inhibited-danger-decrease¶

In the first 5 s of the cue, EAA cue-inhibited neurons decreased firing more than Control neurons (main effect of group), with a greater decrease to danger; the group difference to uncertainty fell short of the corrected level.

In [14]:
print("main"); o5 = window_tests("inh", "first5")
print("\nvariant, the script's normalization"); window_tests("inh", "first5", F=NFc)
print("\nvariant, exact-rate selection"); window_tests("inh", "first5", L=lab_exact)
main
group F(1,130) = 9.15, p = 0.0030; group x cue F = 1.29, p = 0.277
means (danger, uncertainty, safety): {'Con': array([-0.749, -0.614,  0.04 ]), 'EAA': array([-1.056, -0.791, -0.037])} ; range per neuron -2.14 to 1.17
   danger      Con vs EAA t(130) = 2.58, p = 0.0110
   uncertainty Con vs EAA t(130) = 1.76, p = 0.0801
   safety      Con vs EAA t(130) = 0.86, p = 0.3890
   Con paired: dan-unc t(47) = -1.29, p = 0.2043; unc-saf t(47) = -6.09, p = 0.0000
   EAA paired: dan-unc t(83) = -3.21, p = 0.0019; unc-saf t(83) = -9.55, p = 0.0000
   Con by rat (n, mean danger/uncertainty/safety): {'mh09': (2, [-1.04, 0.08, 0.36]), 'mh12': (8, [-0.55, -0.57, 0.25]), 'mh14': (3, [0.01, 0.32, 0.04]), 'mh21': (20, [-0.89, -0.79, -0.05]), 'mh22': (10, [-0.75, -0.5, 0.31]), 'mh23': (3, [-0.8, -1.03, -0.4]), 'mh26': (2, [-0.85, -1.06, -0.92])}
   EAA by rat (n, mean danger/uncertainty/safety): {'mh15': (1, [-1.6, -1.42, 0.79]), 'mh17': (2, [-1.82, -0.58, 0.04]), 'mh29': (2, [-1.94, -1.2, -0.31]), 'mh31': (4, [-1.37, -0.83, -0.11]), 'mh32': (21, [-0.99, -0.53, -0.23]), 'mh35': (2, [-0.83, -0.2, 0.45]), 'mh36': (9, [-0.85, -0.75, 0.25]), 'mh38': (7, [-0.23, -0.54, 0.05]), 'mh39': (35, [-1.19, -1.0, -0.04]), 'mh40': (1, [-0.75, -1.22, -0.06])}

variant, the script's normalization
group F(1,130) = 10.81, p = 0.0013; group x cue F = 1.96, p = 0.144
means (danger, uncertainty, safety): {'Con': array([-0.294, -0.239,  0.014]), 'EAA': array([-0.442, -0.334, -0.013])} ; range per neuron -1.25 to 0.60
   danger      Con vs EAA t(130) = 2.69, p = 0.0080
   uncertainty Con vs EAA t(130) = 2.39, p = 0.0185
   safety      Con vs EAA t(130) = 0.73, p = 0.4685
   Con paired: dan-unc t(47) = -1.40, p = 0.1689; unc-saf t(47) = -6.22, p = 0.0000
   EAA paired: dan-unc t(83) = -3.14, p = 0.0024; unc-saf t(83) = -8.82, p = 0.0000
   Con by rat (n, mean danger/uncertainty/safety): {'mh09': (2, [-0.44, -0.0, 0.11]), 'mh12': (8, [-0.24, -0.25, 0.1]), 'mh14': (3, [-0.01, 0.11, 0.01]), 'mh21': (20, [-0.34, -0.3, -0.02]), 'mh22': (10, [-0.29, -0.18, 0.12]), 'mh23': (3, [-0.29, -0.37, -0.15]), 'mh26': (2, [-0.33, -0.41, -0.38])}
   EAA by rat (n, mean danger/uncertainty/safety): {'mh15': (1, [-0.7, -0.63, 0.38]), 'mh17': (2, [-0.77, -0.23, -0.01]), 'mh29': (2, [-0.81, -0.51, -0.15]), 'mh31': (4, [-0.57, -0.34, -0.07]), 'mh32': (21, [-0.37, -0.2, -0.09]), 'mh35': (2, [-0.45, -0.09, 0.19]), 'mh36': (9, [-0.3, -0.26, 0.1]), 'mh38': (7, [-0.05, -0.19, 0.01]), 'mh39': (35, [-0.54, -0.46, -0.01]), 'mh40': (1, [-0.29, -0.45, -0.02])}

variant, exact-rate selection
group F(1,139) = 13.08, p = 0.0004; group x cue F = 1.94, p = 0.146
means (danger, uncertainty, safety): {'Con': array([-0.716, -0.614,  0.041]), 'EAA': array([-1.066, -0.794, -0.048])} ; range per neuron -2.14 to 1.17
   danger      Con vs EAA t(139) = 3.14, p = 0.0021
   uncertainty Con vs EAA t(139) = 1.92, p = 0.0568
   safety      Con vs EAA t(139) = 1.08, p = 0.2820
   Con paired: dan-unc t(53) = -1.05, p = 0.2992; unc-saf t(53) = -6.60, p = 0.0000
   EAA paired: dan-unc t(86) = -3.42, p = 0.0010; unc-saf t(86) = -9.89, p = 0.0000
   Con by rat (n, mean danger/uncertainty/safety): {'mh09': (2, [-1.04, 0.08, 0.36]), 'mh12': (8, [-0.55, -0.57, 0.25]), 'mh14': (3, [0.01, 0.32, 0.04]), 'mh21': (26, [-0.79, -0.75, -0.03]), 'mh22': (10, [-0.75, -0.5, 0.31]), 'mh23': (3, [-0.8, -1.03, -0.4]), 'mh26': (2, [-0.85, -1.06, -0.92])}
   EAA by rat (n, mean danger/uncertainty/safety): {'mh15': (1, [-1.6, -1.42, 0.79]), 'mh17': (2, [-1.82, -0.58, 0.04]), 'mh29': (2, [-1.94, -1.2, -0.31]), 'mh31': (4, [-1.37, -0.83, -0.11]), 'mh32': (22, [-0.98, -0.54, -0.22]), 'mh35': (2, [-0.83, -0.2, 0.45]), 'mh36': (8, [-0.91, -0.75, 0.15]), 'mh38': (7, [-0.23, -0.54, 0.05]), 'mh39': (38, [-1.19, -0.99, -0.04]), 'mh40': (1, [-0.75, -1.22, -0.06])}
Out[14]:
{'group': (np.float64(13.083084704086867),
  1,
  139,
  np.float64(0.0004160014153835957)),
 'gxc': (np.float64(1.9376049471612393),
  2,
  278,
  np.float64(0.14598893802349788)),
 'means': {'Con': array([-0.71623231, -0.61449659,  0.04071714]),
  'EAA': array([-1.06593152, -0.7936862 , -0.04802178])},
 't': {'danger': TtestResult(statistic=np.float64(3.1418222725488363), pvalue=np.float64(0.0020521850298562683), df=np.float64(139.0)),
  'uncertainty': TtestResult(statistic=np.float64(1.9206289093903934), pvalue=np.float64(0.056826208308544075), df=np.float64(139.0)),
  'safety': TtestResult(statistic=np.float64(1.0800526975914573), pvalue=np.float64(0.28198917243091115), df=np.float64(139.0))},
 'paired': {'Con': {(0,
    1): TtestResult(statistic=np.float64(-1.0483332928426334), pvalue=np.float64(0.29924227579822427), df=np.int64(53)),
   (1,
    2): TtestResult(statistic=np.float64(-6.6016855871022155), pvalue=np.float64(1.9721483126688495e-08), df=np.int64(53))},
  'EAA': {(0,
    1): TtestResult(statistic=np.float64(-3.4200335730322693), pvalue=np.float64(0.0009596699612671833), df=np.int64(86)),
   (1,
    2): TtestResult(statistic=np.float64(-9.893733772650755), pvalue=np.float64(7.480855684219882e-16), df=np.int64(86))}}}

Result: reproduced. Group F(1,130) = 9.15, p = 0.003, with EAA lower; danger t(130) = 2.58, p = 0.011, below 0.0167, with EAA lower; uncertainty t(130) = 1.76, p = 0.080, short of the corrected level as in the paper. Both variants meet the criterion; the script's normalization gives the paper's statistics (group F = 10.81 against 10.82, danger t = 2.69 against 2.70, uncertainty t = 2.39, p = 0.0185 against 2.38, p = 0.019).

fig4f-inhibited-danger-uncertainty-discrimination¶

In the first half of the cue, EAA cue-inhibited neurons discriminated danger from uncertainty, while Control cue-inhibited neurons did not.

Paired t tests of the first 5 s firing to danger and uncertainty within each group, judged at 0.05/2 and 0.05/3.

In [15]:
for gg in ("EAA", "Con"):
    r = o5["paired"][gg][(0, 1)]
    print(f"{gg}: danger {o5['means'][gg][0]:.3f}, uncertainty {o5['means'][gg][1]:.3f}; t({r.df:.0f}) = {r.statistic:.2f}, p = {r.pvalue:.4f};"
          f" below 0.025: {r.pvalue < 0.025}, below 0.0167: {r.pvalue < 0.05/3}")
for name, kw in (("script's normalization", dict(F=NFc)), ("exact-rate selection", dict(L=lab_exact))):
    ov = window_tests("inh", "first5", show=False, **kw)
    print(name + ":", {gg: (round(ov["paired"][gg][(0, 1)].statistic, 2), round(ov["paired"][gg][(0, 1)].pvalue, 4)) for gg in ("EAA", "Con")})
EAA: danger -1.056, uncertainty -0.791; t(83) = -3.21, p = 0.0019; below 0.025: True, below 0.0167: True
Con: danger -0.749, uncertainty -0.614; t(47) = -1.29, p = 0.2043; below 0.025: False, below 0.0167: False
script's normalization: {'EAA': (np.float64(-3.14), np.float64(0.0024)), 'Con': (np.float64(-1.4), np.float64(0.1689))}
exact-rate selection: {'EAA': (np.float64(-3.42), np.float64(0.001)), 'Con': (np.float64(-1.05), np.float64(0.2992))}

Result: reproduced. EAA neurons fire less to danger than to uncertainty (t(83) = -3.21, p = 0.0019, below both corrected levels; the paper: t = 3.14, p = 0.002); Control neurons do not differ (t(47) = -1.29, p = 0.20; the paper: t = 1.40, p = 0.17). The script's normalization gives the paper's values (EAA t = -3.14, p = 0.0024; Control t = -1.40, p = 0.17).

Single-unit regression¶

Per neuron, the 32 trials of its session; the response is the trial's normalized firing in each 1 s interval of the cue; the regressors are the trial's suppression ratio for the 10 s cue (fear output) and the cue's shock probability, 1, 0.375 or 0 (threat probability), with a constant (Methods, "Single-unit, linear regression"). The claims file names readings of the trial-wise normalized firing and of the 0/0 trials:

  • firing (a): trial rate minus its cue's mean 2 s baseline, Z scored with the neuron's normalization; (b): the same with the trial's own baseline; (c): the trial's rate Z scored over all trials and bins of the neuron;
  • 0/0 trials: set to 0, or dropped.

Two more readings come from the authors' script, which regresses the cube's trial-wise Z score (vlPAGcube.fire.z.s1.interval, columns 21 to 30) on the cube's suppression ratio (vlPAGcube.cer.cue) (vlpagAnalysis.m, lines 2162 to 2171, printed in the data check): firing (d), the cube's Z score, and 0/0 trials set to 1, as the cube stores them. All twelve combinations are run. The two window readings of the claims file (mean of the interval betas, or one regression on the window's mean firing) give the same beta (see pag2.interval_betas).

The rule, used for every claim that rests on the regressions (Figs. 5, S4, 6, S5, 7, S6): the outcome is judged under one combination, the script's own (d, 0/0 trials set to 1), the same for every claim and not chosen claim by claim. The paper leaves the trial-wise firing open and the authors' code in the data set settles it, so this follows the code (author, step 1.6), as an assumption. The section below shows that this combination also gives the paper's printed statistics more closely than any other. Each claim's section also gives the outcome under the claims file's own rule (reproduced under one of its six readings, a to c with 0/0 trials set to 0 or dropped); where the two differ, the outcome is marked as resting on the assumption.

For the population firing (Figs. 4, 6, 7), the Methods fix the normalization (the trial-averaged differential firing is Z scored), the claims file follows them, and the script's different normalization is a variant (reader, step 2: where the Methods and the code disagree, the Methods decide and the code's choice is a variant). It is run as a full variant, under every regression reading.

In [16]:
ZS1 = pag2.cube_field(cube, "fire.z.s1.interval")
READINGS = [(f, e) for f in "abcd" for e in ("zero", "drop", "one")]
ADOPTED = ("d", "one")
resp = lab != "osc"

def all_betas(unc=0.375, L=None):
    L = lab if L is None else L
    out = {}
    for rd in READINGS:
        FO = np.full((len(U), 10), np.nan); TP = np.full((len(U), 10), np.nan)
        for j, u in enumerate(U):
            if L[j] == "osc":
                continue
            FO[j], TP[j] = pag2.interval_betas(u, rd[0], rd[1], unc, ZS1[:, :, j])
        out[rd] = (FO, TP)
    return out

BETAS = all_betas()
nan_fits = {rd: int(np.isnan(v[0][resp]).any(1).sum()) for rd, v in BETAS.items()}
print("neurons regressed:", int(resp.sum()), "; fits with a missing beta under any reading:", sum(nan_fits.values()))
neurons regressed: 213 ; fits with a missing beta under any reading: 0

Neurons in the regressions¶

The paper's error degrees of freedom imply fewer neurons than the selection gives (Fig. 5A to C, t(66) and F(1,65), about 68 and 67 of 81 cue-excited neurons; Fig. 5D, F(1,78), 80). The cell below counts the neurons that a rule might drop: those whose session has trials without pokes (0/0), fits with a missing beta, and designs that are not of full rank. The script's searches above find no exclusion step in it.

In [17]:
nempty = np.array([int(np.isnan(pag2.suppression_ratio(u, "drop")).sum()) for u in U])
for pop in ("exc", "inh"):
    for g in ("Con", "EAA"):
        mm = (lab == pop) & (grp == g)
        print(f"{pop} {g}: {mm.sum()} neurons; {int(np.sum(mm & (nempty > 0)))} from sessions with a 0/0 trial "
              f"({int(nempty[mm].sum())} unit-trials); {mm.sum() - int(np.sum(mm & (nempty > 0)))} without")
def full_rank(u, empty):
    X = np.column_stack([np.ones(32), pag2.suppression_ratio(u, empty), [0.375 if t == "uncertainty" else pag2.PROB[t] for t in u["type"]]])
    X = X[~np.isnan(X).any(1)]
    return np.linalg.matrix_rank(X) == 3
for pop in ("exc", "inh"):
    idx_ = np.where(lab == pop)[0]
    print(pop, "betas missing under any reading:", sum(int(np.isnan(BETAS[rd][0][idx_]).any(1).sum()) for rd in READINGS),
          "; designs not of full rank (0/0 set to 1, dropped):", sum(not full_rank(U[j], "one") for j in idx_), sum(not full_rank(U[j], "drop") for j in idx_))
exc Con: 32 neurons; 17 from sessions with a 0/0 trial (42 unit-trials); 15 without
exc EAA: 49 neurons; 7 from sessions with a 0/0 trial (23 unit-trials); 42 without
inh Con: 48 neurons; 22 from sessions with a 0/0 trial (38 unit-trials); 26 without
inh EAA: 84 neurons; 17 from sessions with a 0/0 trial (30 unit-trials); 67 without
exc betas missing under any reading: 0 ; designs not of full rank (0/0 set to 1, dropped): 0 0
inh betas missing under any reading: 0 ; designs not of full rank (0/0 set to 1, dropped): 1 1

None of these gives the paper's counts. 24 of the 81 cue-excited neurons (17 Control, 7 EAA) come from sessions with a trial without pokes, no beta is missing under any reading, and every cue-excited design is of full rank (one cue-inhibited design is not; see the section on it before the summary). Dropping the neurons with a 0/0 trial would leave 57 cue-excited neurons, not 67 or 68. Which neurons the paper left out stays open, and the tests use all selected neurons.

Which regression reading the paper's statistics follow¶

For each of the twelve combinations, the statistics the paper prints for Figs. 5A to C, 5D and 5E to G, and the Control R2 of Fig. 6 (with the script's normalization of the firing, which gives the paper's population statistics), against the paper's values. Absolute values of t are compared, as the paper prints them unsigned. The last column is the mean relative deviation from the paper's values.

In [18]:
GRID = np.arange(9) * 0.125
TUNE = {}
for rd in READINGS:
    TUNE[rd] = np.array([[pag2.interval_betas(U[j], rd[0], rd[1], v, ZS1[:, :, j])[1].mean() for v in GRID] for j in np.where(lab == "exc")[0]])
PAPER = {"5ABC GxR F": 6.80, "5ABC TP t": 2.71, "5ABC FO t": 0.17, "5D assign F": 18.88, "5D group F": 4.01, "5D GxA F": 1.25,
         "5EFG GxRxI F": 2.14, "5EFG FO t": 2.31, "5EFG TP t": 0.81, "6 Con dan R2": 0.56, "6 Con unc R2": 0.22}
def paper_stats(rd):
    FO, TP = BETAS[rd]
    out = {}
    me = lab == "exc"; ge = grp[me]
    a = pag2.mixed_anova(np.stack([FO[me], TP[me]], 1), ge)
    tp, fo = TP[me].mean(1), FO[me].mean(1)
    out["5ABC GxR F"] = a["group:A"][0]
    out["5ABC TP t"] = abs(stats.ttest_ind(tp[ge == "Con"], tp[ge == "EAA"]).statistic)
    out["5ABC FO t"] = abs(stats.ttest_ind(fo[ge == "Con"], fo[ge == "EAA"]).statistic)
    a = pag2.mixed_anova(TUNE[rd], ge)
    out["5D assign F"], out["5D group F"], out["5D GxA F"] = a["A"][0], a["group"][0], a["group:A"][0]
    mi = lab == "inh"; gi = grp[mi]
    a = pag2.mixed_anova(np.stack([FO[mi], TP[mi]], 1), gi)
    out["5EFG GxRxI F"] = a["group:AB"][0]
    fo, tp = FO[mi][:, 5:].mean(1), TP[mi][:, 5:].mean(1)
    out["5EFG FO t"] = abs(stats.ttest_ind(fo[gi == "Con"], fo[gi == "EAA"]).statistic)
    out["5EFG TP t"] = abs(stats.ttest_ind(tp[gi == "Con"], tp[gi == "EAA"]).statistic)
    tpw = TP[:, :10].mean(1)
    for k, ty in ((0, "dan"), (1, "unc")):
        mm = me & (grp == "Con")
        out[f"6 Con {ty} R2"] = stats.pearsonr(NFc[mm, k, pag2.WIN["first1"]].mean(1), tpw[mm])[0] ** 2
    return out
print("reading   " + " ".join(f"{k:>12s}" for k in PAPER) + "  mean rel. dev.")
print("paper     " + " ".join(f"{v:12.2f}" for v in PAPER.values()))
DEV = {}
for rd in READINGS:
    s = paper_stats(rd)
    DEV[rd] = np.mean([abs(s[k] - v) / v for k, v in PAPER.items()])
    print(f"{rd[0]} {rd[1]:4s}    " + " ".join(f"{s[k]:12.2f}" for k in PAPER) + f"  {DEV[rd]:.3f}")
print("closest to the paper:", min(DEV, key=DEV.get), "; adopted:", ADOPTED)
reading     5ABC GxR F    5ABC TP t    5ABC FO t  5D assign F   5D group F     5D GxA F 5EFG GxRxI F    5EFG FO t    5EFG TP t 6 Con dan R2 6 Con unc R2  mean rel. dev.
paper             6.80         2.71         0.17        18.88         4.01         1.25         2.14         2.31         0.81         0.56         0.22
a zero            2.48         1.71         0.23        19.32         2.55         1.11         2.07         1.99         0.79         0.47         0.14  0.236
a drop            2.42         1.79         0.03        18.60         3.18         1.00         1.90         2.08         0.84         0.44         0.14  0.277
a one             2.07         1.74         0.11        17.71         3.00         0.73         2.01         2.07         0.72         0.47         0.15  0.260
b zero            4.80         1.89         1.18        14.72         2.63         1.24         2.07         1.53         0.65         0.42         0.22  0.724
b drop            3.79         2.02         0.62        15.56         3.37         1.01         1.90         1.80         0.84         0.35         0.19  0.432
b one             3.50         2.00         0.48        14.84         3.35         0.88         2.01         1.94         0.81         0.41         0.21  0.345
c zero            0.55         1.14         0.67        18.58         1.42         0.50         2.14         2.39         0.91         0.61         0.18  0.556
c drop            0.44         1.17         0.87        19.22         1.73         1.07         2.01         2.54         1.02         0.57         0.18  0.633
c one             0.31         1.12         1.01        17.98         1.57         0.62         2.13         2.52         0.85         0.59         0.19  0.721
d zero            4.83         2.05         0.78        18.36         3.55         1.62         2.16         1.86         0.65         0.55         0.22  0.452
d drop            3.94         2.12         0.28        19.43         4.11         1.49         2.06         2.16         0.79         0.51         0.20  0.167
d one             3.79         2.12         0.17        18.69         4.15         1.34         2.15         2.34         0.82         0.57         0.22  0.076
closest to the paper: ('d', 'one') ; adopted: ('d', 'one')

The script's combination (d, 0/0 trials set to 1) gives the paper's statistics most closely: mean relative deviation 0.076, against 0.167 for the next, (d, 0/0 dropped), and 0.236 to 0.724 for the claims file's six readings. Under it the Fig. 5D statistics are F = 18.69, 4.15 and 1.34 (the paper 18.88, 4.01 and 1.25), the Fig. 5E to G statistics F = 2.15, t = 2.34 and 0.82 (the paper 2.14, 2.31 and 0.81) and the Fig. 6 Control R2 0.57 and 0.22 (the paper 0.56 and 0.22). Its Fig. 5A to C statistics are further from the paper's (F = 3.79 and t = 2.12 against 6.80 and 2.71), where the paper's degrees of freedom show that about 13 neurons were left out. This supports the adopted combination as the one the paper computed; the combination itself is taken from the script (lines 2162 to 2171), not from this comparison.

fig5abc-excited-reduced-threat-probability¶

Control cue-excited neurons signaled threat probability (positive betas from cue onset, rising over the cue) with fear output betas near zero; EAA cue-excited neurons showed lower threat probability betas and similar fear output betas, a group by regressor interaction.

Mixed ANOVA of the betas (regressor and interval within, group between); t tests of the whole-cue mean betas between groups.

In [19]:
def fig5abc(B, L=None):
    L = lab if L is None else L
    rows = {}
    m = L == "exc"; g = grp[m]
    for rd, (FO, TP) in B.items():
        a = pag2.mixed_anova(np.stack([FO[m], TP[m]], 1), g)
        tp, fo = TP[m].mean(1), FO[m].mean(1)
        t1 = stats.ttest_ind(tp[g == "Con"], tp[g == "EAA"]); t2 = stats.ttest_ind(fo[g == "Con"], fo[g == "EAA"])
        full = a["group:A"][3] < 0.05 and t1.pvalue < 0.05 and t1.statistic > 0 and t2.pvalue >= 0.05
        part = (not full) and t1.pvalue < 0.05 and t1.statistic > 0
        rows[rd] = "reproduced" if full else "partial" if part else "not"
        print(f"{rd[0]} {rd[1]:4s}: group x regressor F({a['group:A'][1]},{a['group:A'][2]}) = {a['group:A'][0]:.2f}, p = {a['group:A'][3]:.3f}; "
              f"TP Con {tp[g=='Con'].mean():.3f} EAA {tp[g=='EAA'].mean():.3f} t = {t1.statistic:.2f} p = {t1.pvalue:.3f}; "
              f"FO Con {fo[g=='Con'].mean():.3f} EAA {fo[g=='EAA'].mean():.3f} t = {t2.statistic:.2f} p = {t2.pvalue:.3f} -> {rows[rd]}")
    return rows

r5 = fig5abc(BETAS)
FO, TP = BETAS[ADOPTED]
m = lab == "exc"
for g in ("Con", "EAA"):
    print(g, "adopted reading, mean betas per 1 s interval: TP", TP[m & (grp == g)].mean(0).round(2), "FO", FO[m & (grp == g)].mean(0).round(2))
a zero: group x regressor F(1,79) = 2.48, p = 0.119; TP Con 1.193 EAA 0.786 t = 1.71 p = 0.091; FO Con 0.078 EAA 0.105 t = -0.23 p = 0.820 -> not
a drop: group x regressor F(1,79) = 2.42, p = 0.124; TP Con 1.205 EAA 0.783 t = 1.79 p = 0.077; FO Con 0.099 EAA 0.104 t = -0.03 p = 0.973 -> not
a one : group x regressor F(1,79) = 2.07, p = 0.154; TP Con 1.186 EAA 0.781 t = 1.74 p = 0.086; FO Con 0.115 EAA 0.101 t = 0.11 p = 0.910 -> not
b zero: group x regressor F(1,79) = 4.80, p = 0.031; TP Con 1.235 EAA 0.780 t = 1.89 p = 0.062; FO Con -0.040 EAA 0.128 t = -1.18 p = 0.240 -> not
b drop: group x regressor F(1,79) = 3.79, p = 0.055; TP Con 1.279 EAA 0.791 t = 2.02 p = 0.047; FO Con -0.001 EAA 0.095 t = -0.62 p = 0.534 -> partial
b one : group x regressor F(1,79) = 3.50, p = 0.065; TP Con 1.276 EAA 0.799 t = 2.00 p = 0.049; FO Con -0.001 EAA 0.072 t = -0.48 p = 0.630 -> partial
c zero: group x regressor F(1,79) = 0.55, p = 0.462; TP Con 0.658 EAA 0.488 t = 1.14 p = 0.257; FO Con 0.096 EAA 0.049 t = 0.67 p = 0.504 -> not
c drop: group x regressor F(1,79) = 0.44, p = 0.509; TP Con 0.659 EAA 0.486 t = 1.17 p = 0.246; FO Con 0.112 EAA 0.049 t = 0.87 p = 0.386 -> not
c one : group x regressor F(1,79) = 0.31, p = 0.582; TP Con 0.649 EAA 0.484 t = 1.12 p = 0.265; FO Con 0.122 EAA 0.048 t = 1.01 p = 0.317 -> not
d zero: group x regressor F(1,79) = 4.83, p = 0.031; TP Con 0.928 EAA 0.546 t = 2.05 p = 0.044; FO Con 0.014 EAA 0.087 t = -0.78 p = 0.440 -> reproduced
d drop: group x regressor F(1,79) = 3.94, p = 0.051; TP Con 0.945 EAA 0.551 t = 2.12 p = 0.037; FO Con 0.041 EAA 0.068 t = -0.28 p = 0.779 -> partial
d one : group x regressor F(1,79) = 3.79, p = 0.055; TP Con 0.953 EAA 0.558 t = 2.12 p = 0.037; FO Con 0.037 EAA 0.053 t = -0.17 p = 0.866 -> partial
Con adopted reading, mean betas per 1 s interval: TP [0.72 0.68 0.87 0.88 0.77 0.96 1.12 1.15 1.16 1.22] FO [ 0.11  0.07 -0.16 -0.15 -0.03 -0.12 -0.1   0.17  0.35  0.23]
EAA adopted reading, mean betas per 1 s interval: TP [0.49 0.29 0.51 0.44 0.57 0.57 0.61 0.63 0.74 0.75] FO [ 0.11  0.03 -0.15 -0.1  -0.01  0.03  0.12  0.14  0.19  0.18]
In [20]:
print("variant, exact-rate selection")
r5x = fig5abc(all_betas(L=lab_exact), L=lab_exact)
variant, exact-rate selection
a zero: group x regressor F(1,78) = 2.01, p = 0.160; TP Con 1.157 EAA 0.802 t = 1.50 p = 0.138; FO Con 0.090 EAA 0.127 t = -0.30 p = 0.765 -> not
a drop: group x regressor F(1,78) = 1.92, p = 0.170; TP Con 1.169 EAA 0.799 t = 1.57 p = 0.120; FO Con 0.114 EAA 0.125 t = -0.09 p = 0.928 -> not
a one : group x regressor F(1,78) = 1.58, p = 0.213; TP Con 1.148 EAA 0.797 t = 1.51 p = 0.135; FO Con 0.131 EAA 0.123 t = 0.06 p = 0.950 -> not
b zero: group x regressor F(1,78) = 4.59, p = 0.035; TP Con 1.215 EAA 0.796 t = 1.75 p = 0.085; FO Con -0.047 EAA 0.149 t = -1.33 p = 0.188 -> not
b drop: group x regressor F(1,78) = 3.47, p = 0.066; TP Con 1.256 EAA 0.807 t = 1.85 p = 0.068; FO Con 0.000 EAA 0.117 t = -0.73 p = 0.465 -> not
b one : group x regressor F(1,78) = 3.12, p = 0.081; TP Con 1.249 EAA 0.814 t = 1.82 p = 0.073; FO Con 0.002 EAA 0.095 t = -0.58 p = 0.561 -> not
c zero: group x regressor F(1,78) = 0.27, p = 0.603; TP Con 0.628 EAA 0.497 t = 0.91 p = 0.368; FO Con 0.107 EAA 0.062 t = 0.61 p = 0.541 -> not
c drop: group x regressor F(1,78) = 0.18, p = 0.674; TP Con 0.627 EAA 0.496 t = 0.92 p = 0.360; FO Con 0.125 EAA 0.062 t = 0.84 p = 0.403 -> not
c one : group x regressor F(1,78) = 0.09, p = 0.767; TP Con 0.616 EAA 0.493 t = 0.87 p = 0.389; FO Con 0.136 EAA 0.062 t = 0.98 p = 0.330 -> not
d zero: group x regressor F(1,78) = 4.37, p = 0.040; TP Con 0.893 EAA 0.557 t = 1.84 p = 0.069; FO Con 0.008 EAA 0.101 t = -0.96 p = 0.339 -> not
d drop: group x regressor F(1,78) = 3.42, p = 0.068; TP Con 0.908 EAA 0.562 t = 1.90 p = 0.060; FO Con 0.038 EAA 0.083 t = -0.44 p = 0.658 -> not
d one : group x regressor F(1,78) = 3.24, p = 0.076; TP Con 0.914 EAA 0.569 t = 1.90 p = 0.061; FO Con 0.035 EAA 0.069 t = -0.33 p = 0.743 -> not

Result: partially reproduced. Under the adopted reading (d, 0/0 trials set to 1) the whole-cue threat probability beta is higher in Control (0.953 against 0.558, t = 2.12, p = 0.037) and the fear output betas do not differ (p = 0.87), but the group by regressor interaction falls short (F(1,79) = 3.79, p = 0.055). Of the six combinations the claims file names, none meets all three parts; (b) with 0/0 trials dropped gives the same partial pattern. The script's firing with 0/0 trials set to 0 meets all three (interaction p = 0.031), but that combination is not the adopted one and is further from the paper's statistics (section above). The claims file's own rule (one of its six readings) gives the same outcome, partial, so the outcome does not rest on the assumption. Control threat probability betas are positive from the first interval and rise over the cue (0.72 to 1.22). With the exact-rate selection no combination meets the threat probability part (smallest p = 0.060). The paper's degrees of freedom (F(1,65), t(66)) imply about 67 of the 81 neurons; which were left out is not said.

fig5d-threat-tuning-curve¶

The threat tuning curve of cue-excited neurons peaked at an uncertainty assignment of 0.500 in both groups; the EAA curve had the same shape but was lower across all assignments (main effect of assignment and of group, no interaction).

Nine regressions per neuron with the uncertainty value 0 to 1 in steps of 0.125, the threat probability beta averaged over the 10 intervals (Methods, "Threat probability tuning curve").

In [21]:
m = lab == "exc"; g = grp[m]
for rd in READINGS:
    T = TUNE[rd]
    a = pag2.mixed_anova(T, g)
    cm = {gg: T[g == gg].mean(0) for gg in ("Con", "EAA")}
    peaks = {gg: GRID[np.argmax(v)] for gg, v in cm.items()}
    ok = all(p == 0.5 for p in peaks.values()) and a["A"][3] < 0.05 and a["group"][3] < 0.05 and cm["EAA"].mean() < cm["Con"].mean() and a["group:A"][3] >= 0.05
    print(f"{rd[0]} {rd[1]:4s}: peaks {peaks}; assignment F({a['A'][1]},{a['A'][2]}) = {a['A'][0]:.2f}, p = {a['A'][3]:.1e}; "
          f"group F({a['group'][1]},{a['group'][2]}) = {a['group'][0]:.2f}, p = {a['group'][3]:.3f}; group x assignment F = {a['group:A'][0]:.2f}, p = {a['group:A'][3]:.3f}"
          f" -> {'reproduced' if ok else 'not'}")
T = TUNE[ADOPTED]
print("adopted reading, curve Con", T[g == "Con"].mean(0).round(3), "EAA", T[g == "EAA"].mean(0).round(3))
plt.figure(figsize=(5, 3))
for gg, col in (("Con", "gray"), ("EAA", "navy")):
    plt.errorbar(GRID, T[g == gg].mean(0), T[g == gg].std(0, ddof=1) / np.sqrt((g == gg).sum()), color=col, label=gg)
plt.axvline(0.375, ls="--", color="k", lw=0.5); plt.xlabel("uncertainty assignment"); plt.ylabel("threat beta"); plt.legend(); plt.show()
print("plotted range %.2f to %.2f" % (T.mean(0).min() if False else min(T[g == gg].mean(0).min() for gg in ("Con", "EAA")), max(T[g == gg].mean(0).max() for gg in ("Con", "EAA"))))
a zero: peaks {'Con': np.float64(0.5), 'EAA': np.float64(0.5)}; assignment F(8,632) = 19.32, p = 4.0e-26; group F(1,79) = 2.55, p = 0.114; group x assignment F = 1.11, p = 0.356 -> not
a drop: peaks {'Con': np.float64(0.5), 'EAA': np.float64(0.5)}; assignment F(8,632) = 18.60, p = 3.7e-25; group F(1,79) = 3.18, p = 0.079; group x assignment F = 1.00, p = 0.433 -> not
a one : peaks {'Con': np.float64(0.5), 'EAA': np.float64(0.5)}; assignment F(8,632) = 17.71, p = 6.0e-24; group F(1,79) = 3.00, p = 0.087; group x assignment F = 0.73, p = 0.666 -> not
b zero: peaks {'Con': np.float64(0.5), 'EAA': np.float64(0.5)}; assignment F(8,632) = 14.72, p = 7.7e-20; group F(1,79) = 2.63, p = 0.109; group x assignment F = 1.24, p = 0.271 -> not
b drop: peaks {'Con': np.float64(0.5), 'EAA': np.float64(0.625)}; assignment F(8,632) = 15.56, p = 5.3e-21; group F(1,79) = 3.37, p = 0.070; group x assignment F = 1.01, p = 0.426 -> not
b one : peaks {'Con': np.float64(0.5), 'EAA': np.float64(0.625)}; assignment F(8,632) = 14.84, p = 5.2e-20; group F(1,79) = 3.35, p = 0.071; group x assignment F = 0.88, p = 0.530 -> not
c zero: peaks {'Con': np.float64(0.5), 'EAA': np.float64(0.5)}; assignment F(8,632) = 18.58, p = 4.0e-25; group F(1,79) = 1.42, p = 0.238; group x assignment F = 0.50, p = 0.853 -> not
c drop: peaks {'Con': np.float64(0.5), 'EAA': np.float64(0.5)}; assignment F(8,632) = 19.22, p = 5.4e-26; group F(1,79) = 1.73, p = 0.192; group x assignment F = 1.07, p = 0.381 -> not
c one : peaks {'Con': np.float64(0.5), 'EAA': np.float64(0.5)}; assignment F(8,632) = 17.98, p = 2.6e-24; group F(1,79) = 1.57, p = 0.214; group x assignment F = 0.62, p = 0.760 -> not
d zero: peaks {'Con': np.float64(0.5), 'EAA': np.float64(0.5)}; assignment F(8,632) = 18.36, p = 8.0e-25; group F(1,79) = 3.55, p = 0.063; group x assignment F = 1.62, p = 0.115 -> not
d drop: peaks {'Con': np.float64(0.5), 'EAA': np.float64(0.5)}; assignment F(8,632) = 19.43, p = 2.9e-26; group F(1,79) = 4.11, p = 0.046; group x assignment F = 1.49, p = 0.156 -> reproduced
d one : peaks {'Con': np.float64(0.5), 'EAA': np.float64(0.5)}; assignment F(8,632) = 18.69, p = 2.8e-25; group F(1,79) = 4.15, p = 0.045; group x assignment F = 1.34, p = 0.220 -> reproduced
adopted reading, curve Con [0.583 0.706 0.839 0.953 1.005 0.969 0.856 0.706 0.558] EAA [0.335 0.407 0.486 0.558 0.602 0.598 0.543 0.454 0.358]
No description has been provided for this image
plotted range 0.34 to 1.00

Result: reproduced, resting on an assumption. Under the adopted reading (d, 0/0 trials set to

  1. both curves peak at 0.500, the assignment effect is F(8,632) = 18.69, p = 3e-25, the group effect F(1,79) = 4.15, p = 0.045 with EAA lower (curve 0.34 to 0.60 against 0.56 to 1.00), and there is no interaction (p = 0.22). The peaks are at 0.500 under ten of the twelve readings and the assignment effect holds under all, but the group effect is significant only with the script's firing (d) and 0/0 trials dropped or set to 1 (p = 0.046 and 0.045); under the claims file's readings (a to c) it is p = 0.07 to 0.24, and under those the claim is not reproduced. The outcome therefore rests on the adopted combination, which is the script's (lines 2162 to 2171, printed in the data check: regress of fire.z.s1.interval on cer.cue, which stores 1 for 0/0 trials) and the one closest to the paper's statistics (its assignment and group F are 18.69 and 4.15 against the paper's 18.88 and 4.01).

figs4-peak-assignment-same-pattern¶

Using the peak uncertainty assignment (0.500) in place of the actual probability gave the same pattern of threat probability signaling in cue-excited neurons and of fear output signaling in cue-inhibited neurons.

In [22]:
B05 = all_betas(0.5)
def s4(B):
    out = {}
    for rd, (FO, TP) in B.items():
        me, mi = lab == "exc", lab == "inh"
        tp = TP[me].mean(1); fo = FO[mi][:, 5:].mean(1)
        out[rd] = (stats.ttest_ind(tp[grp[me] == "Con"], tp[grp[me] == "EAA"]), stats.ttest_ind(fo[grp[mi] == "Con"], fo[grp[mi] == "EAA"]))
    return out
a375, a5 = s4(BETAS), s4(B05)
for rd in READINGS:
    same = all((x.pvalue < 0.05) == (y.pvalue < 0.05) and np.sign(x.statistic) == np.sign(y.statistic) for x, y in zip(a375[rd], a5[rd]))
    print(f"{rd[0]} {rd[1]:4s}: exc whole-cue TP  0.375 t = {a375[rd][0].statistic:.2f} p = {a375[rd][0].pvalue:.3f} | 0.5 t = {a5[rd][0].statistic:.2f} p = {a5[rd][0].pvalue:.3f};"
          f"  inh last-5 s FO  0.375 t = {a375[rd][1].statistic:.2f} p = {a375[rd][1].pvalue:.3f} | 0.5 t = {a5[rd][1].statistic:.2f} p = {a5[rd][1].pvalue:.3f}  same: {same}")
a zero: exc whole-cue TP  0.375 t = 1.71 p = 0.091 | 0.5 t = 1.66 p = 0.100;  inh last-5 s FO  0.375 t = 1.99 p = 0.048 | 0.5 t = 2.24 p = 0.027  same: True
a drop: exc whole-cue TP  0.375 t = 1.79 p = 0.077 | 0.5 t = 1.84 p = 0.070;  inh last-5 s FO  0.375 t = 2.08 p = 0.039 | 0.5 t = 2.41 p = 0.017  same: True
a one : exc whole-cue TP  0.375 t = 1.74 p = 0.086 | 0.5 t = 1.73 p = 0.087;  inh last-5 s FO  0.375 t = 2.07 p = 0.040 | 0.5 t = 2.35 p = 0.020  same: True
b zero: exc whole-cue TP  0.375 t = 1.89 p = 0.062 | 0.5 t = 1.76 p = 0.083;  inh last-5 s FO  0.375 t = 1.53 p = 0.129 | 0.5 t = 1.68 p = 0.096  same: True
b drop: exc whole-cue TP  0.375 t = 2.02 p = 0.047 | 0.5 t = 1.97 p = 0.053;  inh last-5 s FO  0.375 t = 1.80 p = 0.074 | 0.5 t = 2.04 p = 0.043  same: False
b one : exc whole-cue TP  0.375 t = 2.00 p = 0.049 | 0.5 t = 1.92 p = 0.058;  inh last-5 s FO  0.375 t = 1.94 p = 0.054 | 0.5 t = 2.19 p = 0.030  same: False
c zero: exc whole-cue TP  0.375 t = 1.14 p = 0.257 | 0.5 t = 1.17 p = 0.245;  inh last-5 s FO  0.375 t = 2.39 p = 0.018 | 0.5 t = 2.65 p = 0.009  same: True
c drop: exc whole-cue TP  0.375 t = 1.17 p = 0.246 | 0.5 t = 1.28 p = 0.205;  inh last-5 s FO  0.375 t = 2.54 p = 0.012 | 0.5 t = 2.90 p = 0.004  same: True
c one : exc whole-cue TP  0.375 t = 1.12 p = 0.265 | 0.5 t = 1.18 p = 0.240;  inh last-5 s FO  0.375 t = 2.52 p = 0.013 | 0.5 t = 2.81 p = 0.006  same: True
d zero: exc whole-cue TP  0.375 t = 2.05 p = 0.044 | 0.5 t = 1.98 p = 0.051;  inh last-5 s FO  0.375 t = 1.86 p = 0.066 | 0.5 t = 2.02 p = 0.045  same: False
d drop: exc whole-cue TP  0.375 t = 2.12 p = 0.037 | 0.5 t = 2.11 p = 0.038;  inh last-5 s FO  0.375 t = 2.16 p = 0.033 | 0.5 t = 2.40 p = 0.018  same: True
d one : exc whole-cue TP  0.375 t = 2.12 p = 0.037 | 0.5 t = 2.09 p = 0.040;  inh last-5 s FO  0.375 t = 2.34 p = 0.021 | 0.5 t = 2.60 p = 0.011  same: True

Result: reproduced. Under the adopted reading the cue-excited threat probability difference is significant with both values (0.375 p = 0.037, 0.5 p = 0.040, Control higher), and so is the cue-inhibited fear output difference (p = 0.021 and 0.011, EAA more negative). The significance of one of the two tests changes between 0.375 and 0.5 under three other readings (b drop, b one, d zero), and is the same under the other nine. Readings (a) and (c) of the claims file give the same significance and direction with both values, so the outcome does not rest on the assumption. Under (a) to (c) the cue-excited threat probability difference is not significant with either value, so for that test the two values agree in giving no difference.

fig5efg-inhibited-fear-output¶

Control cue-inhibited neurons signaled a mix of threat probability and fear output (negative betas for both). In EAA cue-inhibited neurons the signals diverged in the second half of the cue, fear output persisting and threat probability diminishing (group by regressor by interval interaction); fear output betas in the last 5 s were more negative in EAA, threat probability betas did not differ.

In [23]:
def fig5efg(B, L=None):
    L = lab if L is None else L
    m = L == "inh"; g = grp[m]; rows = {}
    for rd, (FO, TP) in B.items():
        a = pag2.mixed_anova(np.stack([FO[m], TP[m]], 1), g)
        fo, tp = FO[m][:, 5:].mean(1), TP[m][:, 5:].mean(1)
        t1 = stats.ttest_ind(fo[g == "Con"], fo[g == "EAA"]); t2 = stats.ttest_ind(tp[g == "Con"], tp[g == "EAA"])
        f = a["group:AB"]
        full = f[3] < 0.05 and t1.pvalue < 0.05 and fo[g == "EAA"].mean() < fo[g == "Con"].mean() and t2.pvalue >= 0.05
        part = (not full) and t1.pvalue < 0.05 and fo[g == "EAA"].mean() < fo[g == "Con"].mean()
        rows[rd] = "reproduced" if full else "partial" if part else "not"
        print(f"{rd[0]} {rd[1]:4s}: group x regressor x interval F({f[1]},{f[2]}) = {f[0]:.2f}, p = {f[3]:.3f}; last 5 s FO Con {fo[g=='Con'].mean():.3f} "
              f"EAA {fo[g=='EAA'].mean():.3f} t = {t1.statistic:.2f} p = {t1.pvalue:.3f}; TP t = {t2.statistic:.2f} p = {t2.pvalue:.3f} -> {rows[rd]}")
    return rows
r5e = fig5efg(BETAS)
FO, TP = BETAS[ADOPTED]; m = lab == "inh"
for g in ("Con", "EAA"):
    print(g, "adopted reading, mean betas per interval: TP", TP[m & (grp == g)].mean(0).round(2), "FO", FO[m & (grp == g)].mean(0).round(2))
print("\nvariant, exact-rate selection"); fig5efg(all_betas(L=lab_exact), L=lab_exact)
a zero: group x regressor x interval F(9,1170) = 2.07, p = 0.029; last 5 s FO Con -0.379 EAA -0.606 t = 1.99 p = 0.048; TP t = -0.79 p = 0.432 -> reproduced
a drop: group x regressor x interval F(9,1170) = 1.90, p = 0.049; last 5 s FO Con -0.382 EAA -0.621 t = 2.08 p = 0.039; TP t = -0.84 p = 0.402 -> reproduced
a one : group x regressor x interval F(9,1170) = 2.01, p = 0.035; last 5 s FO Con -0.387 EAA -0.623 t = 2.07 p = 0.040; TP t = -0.72 p = 0.476 -> reproduced
b zero: group x regressor x interval F(9,1170) = 2.07, p = 0.029; last 5 s FO Con -0.470 EAA -0.672 t = 1.53 p = 0.129; TP t = -0.65 p = 0.516 -> not
b drop: group x regressor x interval F(9,1170) = 1.90, p = 0.049; last 5 s FO Con -0.447 EAA -0.685 t = 1.80 p = 0.074; TP t = -0.84 p = 0.404 -> not
b one : group x regressor x interval F(9,1170) = 2.01, p = 0.035; last 5 s FO Con -0.435 EAA -0.687 t = 1.94 p = 0.054; TP t = -0.81 p = 0.419 -> not
c zero: group x regressor x interval F(9,1170) = 2.14, p = 0.024; last 5 s FO Con -0.189 EAA -0.310 t = 2.39 p = 0.018; TP t = -0.91 p = 0.364 -> reproduced
c drop: group x regressor x interval F(9,1170) = 2.01, p = 0.035; last 5 s FO Con -0.192 EAA -0.320 t = 2.54 p = 0.012; TP t = -1.02 p = 0.310 -> reproduced
c one : group x regressor x interval F(9,1170) = 2.13, p = 0.024; last 5 s FO Con -0.194 EAA -0.321 t = 2.52 p = 0.013; TP t = -0.85 p = 0.395 -> reproduced
d zero: group x regressor x interval F(9,1170) = 2.16, p = 0.022; last 5 s FO Con -0.243 EAA -0.377 t = 1.86 p = 0.066; TP t = -0.65 p = 0.519 -> not
d drop: group x regressor x interval F(9,1170) = 2.06, p = 0.031; last 5 s FO Con -0.229 EAA -0.385 t = 2.16 p = 0.033; TP t = -0.79 p = 0.432 -> reproduced
d one : group x regressor x interval F(9,1170) = 2.15, p = 0.023; last 5 s FO Con -0.220 EAA -0.386 t = 2.34 p = 0.021; TP t = -0.82 p = 0.412 -> reproduced
Con adopted reading, mean betas per interval: TP [-0.12 -0.26 -0.28 -0.26 -0.24 -0.18 -0.14 -0.19 -0.16 -0.22] FO [-0.01 -0.17 -0.21 -0.31 -0.33 -0.25 -0.27 -0.19 -0.24 -0.14]
EAA adopted reading, mean betas per interval: TP [-0.06 -0.28 -0.35 -0.44 -0.32 -0.27 -0.07  0.03 -0.1  -0.04] FO [-0.11 -0.31 -0.36 -0.4  -0.4  -0.4  -0.45 -0.45 -0.32 -0.31]

variant, exact-rate selection
a zero: group x regressor x interval F(9,1251) = 1.54, p = 0.129; last 5 s FO Con -0.376 EAA -0.579 t = 1.85 p = 0.067; TP t = -0.30 p = 0.767 -> not
a drop: group x regressor x interval F(9,1251) = 1.39, p = 0.188; last 5 s FO Con -0.375 EAA -0.594 t = 1.98 p = 0.050; TP t = -0.30 p = 0.762 -> not
a one : group x regressor x interval F(9,1251) = 1.62, p = 0.104; last 5 s FO Con -0.364 EAA -0.596 t = 2.10 p = 0.038; TP t = -0.36 p = 0.721 -> partial
b zero: group x regressor x interval F(9,1251) = 1.54, p = 0.129; last 5 s FO Con -0.445 EAA -0.633 t = 1.47 p = 0.143; TP t = -0.25 p = 0.804 -> not
b drop: group x regressor x interval F(9,1251) = 1.39, p = 0.188; last 5 s FO Con -0.425 EAA -0.645 t = 1.72 p = 0.088; TP t = -0.41 p = 0.685 -> not
b one : group x regressor x interval F(9,1251) = 1.62, p = 0.104; last 5 s FO Con -0.414 EAA -0.645 t = 1.84 p = 0.067; TP t = -0.38 p = 0.701 -> not
c zero: group x regressor x interval F(9,1251) = 1.71, p = 0.083; last 5 s FO Con -0.179 EAA -0.298 t = 2.44 p = 0.016; TP t = -0.68 p = 0.498 -> partial
c drop: group x regressor x interval F(9,1251) = 1.59, p = 0.113; last 5 s FO Con -0.180 EAA -0.307 t = 2.62 p = 0.010; TP t = -0.73 p = 0.465 -> partial
c one : group x regressor x interval F(9,1251) = 1.82, p = 0.060; last 5 s FO Con -0.175 EAA -0.308 t = 2.77 p = 0.006; TP t = -0.79 p = 0.434 -> partial
d zero: group x regressor x interval F(9,1251) = 1.67, p = 0.092; last 5 s FO Con -0.227 EAA -0.357 t = 1.90 p = 0.060; TP t = -0.36 p = 0.718 -> not
d drop: group x regressor x interval F(9,1251) = 1.58, p = 0.116; last 5 s FO Con -0.214 EAA -0.364 t = 2.18 p = 0.031; TP t = -0.48 p = 0.630 -> partial
d one : group x regressor x interval F(9,1251) = 1.79, p = 0.066; last 5 s FO Con -0.205 EAA -0.365 t = 2.35 p = 0.020; TP t = -0.52 p = 0.603 -> partial
Out[23]:
{('a', 'zero'): 'not',
 ('a', 'drop'): 'not',
 ('a', 'one'): 'partial',
 ('b', 'zero'): 'not',
 ('b', 'drop'): 'not',
 ('b', 'one'): 'not',
 ('c', 'zero'): 'partial',
 ('c', 'drop'): 'partial',
 ('c', 'one'): 'partial',
 ('d', 'zero'): 'not',
 ('d', 'drop'): 'partial',
 ('d', 'one'): 'partial'}

Result: reproduced. Under the adopted reading the three-way interaction is F(9,1170) = 2.15, p = 0.023, the last-5 s fear output beta is more negative in EAA (-0.386 against -0.220, t = 2.34, p = 0.021) and the threat probability betas do not differ (p = 0.41). Readings (a) and (c) with every treatment of 0/0 trials also meet all three parts, so the outcome does not rest on the assumption; reading (b) misses the fear output part (p = 0.054 to 0.13). With the exact-rate selection the three-way interaction is not significant under any reading (p = 0.060 to 0.19).

Firing and signaling (Figs. 6, 7, S5, S6)¶

Per neuron, the normalized firing to each cue in a window (first 1 s for cue-excited neurons, last 5 s for cue-inhibited) against a beta (whole-cue mean for Fig. 6 and S5, last-5 s mean for Fig. 7 and S6), Pearson correlation per group and cue; groups compared by Fisher r-to-z, one- and two-tailed. Each reading of the regression is run. As a variant, the firing is also taken with the script's normalization (mean of the cube's trial-wise Z scores), with the adopted regression reading.

In [24]:
def corr_table(pop, win, which, span, F_all=None, readings=None, B=None, show=True):
    F_all = NF if F_all is None else F_all
    B = BETAS if B is None else B
    res = {}
    for rd in (READINGS if readings is None else readings):
        FO, TP = B[rd]
        Bm = (TP if which == "TP" else FO)[:, span].mean(1)
        rows = {}
        for k, ty in enumerate(pag2.TYPES):
            F = F_all[:, k, pag2.WIN[win]].mean(1)
            rr = {}
            for gg in ("Con", "EAA"):
                mm = (lab == pop) & (grp == gg)
                r, p = stats.pearsonr(F[mm], Bm[mm]); rr[gg] = (r, p, int(mm.sum()))
            z, p1, p2 = pag2.fisher_r_to_z(rr["Con"][0], rr["Con"][2], rr["EAA"][0], rr["EAA"][2])
            rows[ty] = dict(Con=rr["Con"], EAA=rr["EAA"], z=(z, p1, p2))
        res[rd] = rows
    for rd in res if show else ():
        print(f"{rd[0]} {rd[1]:4s}: " + " | ".join(
            f"{ty[:3]} Con r={v['Con'][0]:.2f} p={v['Con'][1]:.2g}, EAA r={v['EAA'][0]:.2f} p={v['EAA'][1]:.2g}, Z={v['z'][0]:.2f} p1={v['z'][1]:.2g} p2={v['z'][2]:.2g}"
            for ty, v in res[rd].items()))
    return res
FULL, LAST = slice(0, 10), slice(5, 10)

fig6-excited-firing-threat-decoupled¶

In Control cue-excited neurons, danger and uncertainty firing in the first 1 s of the cue predicted the whole-cue threat probability beta; in EAA cue-excited neurons they did not, and the relationships differed between groups. Safety firing was unrelated in both groups, and that relationship did not differ between groups.

In [25]:
c6 = corr_table("exc", "first1", "TP", FULL)
def judge6(v):
    dang = v["danger"]["Con"][0] > 0 and v["danger"]["Con"][1] < 0.05 and v["danger"]["EAA"][1] >= 0.05 and v["danger"]["z"][1] < 0.05
    unc = v["uncertainty"]["Con"][0] > 0 and v["uncertainty"]["Con"][1] < 0.05 and v["uncertainty"]["EAA"][1] >= 0.05 and v["uncertainty"]["z"][1] < 0.05
    saf = v["safety"]["Con"][1] >= 0.05 and v["safety"]["EAA"][1] >= 0.05 and v["safety"]["z"][1] >= 0.05
    return dang, unc, saf
for rd in READINGS:
    d_, u_, s_ = judge6(c6[rd])
    print(rd, "danger part", d_, "uncertainty part", u_, "safety part", s_)
v = c6[ADOPTED]
print("adopted reading: Control R2 danger %.3f (paper 0.56), uncertainty %.3f (paper 0.22)" % (v["danger"]["Con"][0] ** 2, v["uncertainty"]["Con"][0] ** 2))
print("\nvariant, the script's normalization of the firing, every regression reading")
c6c_all = corr_table("exc", "first1", "TP", FULL, F_all=NFc)
for rd in READINGS:
    v = c6c_all[rd]
    print(rd, "parts (danger, uncertainty, safety):", judge6(v), "; R2 Con danger %.3f, EAA %.3f; Con uncertainty %.3f, EAA %.3f"
          % (v["danger"]["Con"][0] ** 2, v["danger"]["EAA"][0] ** 2, v["uncertainty"]["Con"][0] ** 2, v["uncertainty"]["EAA"][0] ** 2))
c6c = c6c_all[ADOPTED]
a zero: dan Con r=0.49 p=0.0048, EAA r=0.02 p=0.89, Z=2.15 p1=0.016 p2=0.031 | unc Con r=0.03 p=0.86, EAA r=-0.31 p=0.028, Z=1.50 p1=0.066 p2=0.13 | saf Con r=-0.36 p=0.042, EAA r=-0.32 p=0.025, Z=-0.20 p1=0.42 p2=0.84
a drop: dan Con r=0.46 p=0.0075, EAA r=0.03 p=0.85, Z=2.00 p1=0.023 p2=0.046 | unc Con r=0.03 p=0.85, EAA r=-0.31 p=0.03, Z=1.50 p1=0.066 p2=0.13 | saf Con r=-0.37 p=0.038, EAA r=-0.32 p=0.027, Z=-0.25 p1=0.4 p2=0.8
a one : dan Con r=0.50 p=0.0038, EAA r=0.04 p=0.78, Z=2.12 p1=0.017 p2=0.034 | unc Con r=0.06 p=0.75, EAA r=-0.30 p=0.038, Z=1.54 p1=0.062 p2=0.12 | saf Con r=-0.36 p=0.043, EAA r=-0.30 p=0.035, Z=-0.27 p1=0.39 p2=0.79
b zero: dan Con r=0.48 p=0.0052, EAA r=-0.05 p=0.72, Z=2.44 p1=0.0073 p2=0.015 | unc Con r=0.16 p=0.39, EAA r=-0.35 p=0.014, Z=2.21 p1=0.013 p2=0.027 | saf Con r=-0.25 p=0.17, EAA r=-0.37 p=0.0092, Z=0.57 p1=0.29 p2=0.57
b drop: dan Con r=0.43 p=0.015, EAA r=-0.06 p=0.7, Z=2.16 p1=0.015 p2=0.031 | unc Con r=0.14 p=0.45, EAA r=-0.36 p=0.011, Z=2.18 p1=0.015 p2=0.029 | saf Con r=-0.27 p=0.14, EAA r=-0.37 p=0.0084, Z=0.48 p1=0.31 p2=0.63
b one : dan Con r=0.48 p=0.0057, EAA r=-0.05 p=0.73, Z=2.40 p1=0.0081 p2=0.016 | unc Con r=0.15 p=0.42, EAA r=-0.35 p=0.013, Z=2.18 p1=0.015 p2=0.029 | saf Con r=-0.25 p=0.16, EAA r=-0.37 p=0.0095, Z=0.53 p1=0.3 p2=0.6
c zero: dan Con r=0.52 p=0.0023, EAA r=-0.03 p=0.83, Z=2.56 p1=0.0052 p2=0.01 | unc Con r=0.05 p=0.77, EAA r=-0.30 p=0.036, Z=1.53 p1=0.063 p2=0.13 | saf Con r=-0.29 p=0.11, EAA r=-0.32 p=0.023, Z=0.17 p1=0.43 p2=0.87
c drop: dan Con r=0.49 p=0.0042, EAA r=-0.02 p=0.87, Z=2.37 p1=0.0088 p2=0.018 | unc Con r=0.05 p=0.78, EAA r=-0.30 p=0.038, Z=1.51 p1=0.066 p2=0.13 | saf Con r=-0.30 p=0.1, EAA r=-0.32 p=0.025, Z=0.11 p1=0.45 p2=0.91
c one : dan Con r=0.52 p=0.0024, EAA r=-0.01 p=0.95, Z=2.45 p1=0.0071 p2=0.014 | unc Con r=0.07 p=0.7, EAA r=-0.28 p=0.047, Z=1.53 p1=0.063 p2=0.13 | saf Con r=-0.29 p=0.11, EAA r=-0.31 p=0.032, Z=0.09 p1=0.46 p2=0.93
d zero: dan Con r=0.51 p=0.0031, EAA r=-0.01 p=0.96, Z=2.38 p1=0.0086 p2=0.017 | unc Con r=0.10 p=0.6, EAA r=-0.30 p=0.039, Z=1.70 p1=0.045 p2=0.09 | saf Con r=-0.27 p=0.14, EAA r=-0.30 p=0.039, Z=0.13 p1=0.45 p2=0.9
d drop: dan Con r=0.47 p=0.0073, EAA r=-0.01 p=0.96, Z=2.16 p1=0.015 p2=0.031 | unc Con r=0.08 p=0.67, EAA r=-0.30 p=0.034, Z=1.65 p1=0.05 p2=0.099 | saf Con r=-0.29 p=0.11, EAA r=-0.30 p=0.037, Z=0.05 p1=0.48 p2=0.96
d one : dan Con r=0.51 p=0.0031, EAA r=-0.00 p=0.98, Z=2.37 p1=0.009 p2=0.018 | unc Con r=0.09 p=0.62, EAA r=-0.30 p=0.038, Z=1.68 p1=0.047 p2=0.094 | saf Con r=-0.27 p=0.13, EAA r=-0.29 p=0.04, Z=0.10 p1=0.46 p2=0.92
('a', 'zero') danger part True uncertainty part False safety part False
('a', 'drop') danger part True uncertainty part False safety part False
('a', 'one') danger part True uncertainty part False safety part False
('b', 'zero') danger part True uncertainty part False safety part False
('b', 'drop') danger part True uncertainty part False safety part False
('b', 'one') danger part True uncertainty part False safety part False
('c', 'zero') danger part True uncertainty part False safety part False
('c', 'drop') danger part True uncertainty part False safety part False
('c', 'one') danger part True uncertainty part False safety part False
('d', 'zero') danger part True uncertainty part False safety part False
('d', 'drop') danger part True uncertainty part False safety part False
('d', 'one') danger part True uncertainty part False safety part False
adopted reading: Control R2 danger 0.257 (paper 0.56), uncertainty 0.008 (paper 0.22)

variant, the script's normalization of the firing, every regression reading
a zero: dan Con r=0.68 p=1.6e-05, EAA r=0.07 p=0.63, Z=3.23 p1=0.00062 p2=0.0012 | unc Con r=0.37 p=0.038, EAA r=-0.23 p=0.11, Z=2.63 p1=0.0042 p2=0.0084 | saf Con r=-0.31 p=0.082, EAA r=-0.26 p=0.071, Z=-0.24 p1=0.41 p2=0.81
a drop: dan Con r=0.66 p=3.7e-05, EAA r=0.08 p=0.59, Z=3.03 p1=0.0012 p2=0.0025 | unc Con r=0.37 p=0.037, EAA r=-0.23 p=0.11, Z=2.63 p1=0.0042 p2=0.0085 | saf Con r=-0.32 p=0.072, EAA r=-0.26 p=0.076, Z=-0.30 p1=0.38 p2=0.76
a one : dan Con r=0.69 p=1.5e-05, EAA r=0.09 p=0.53, Z=3.15 p1=0.0008 p2=0.0016 | unc Con r=0.39 p=0.027, EAA r=-0.22 p=0.13, Z=2.68 p1=0.0037 p2=0.0075 | saf Con r=-0.32 p=0.075, EAA r=-0.24 p=0.092, Z=-0.35 p1=0.36 p2=0.73
b zero: dan Con r=0.64 p=6.9e-05, EAA r=0.01 p=0.95, Z=3.19 p1=0.0007 p2=0.0014 | unc Con r=0.47 p=0.0066, EAA r=-0.27 p=0.058, Z=3.33 p1=0.00043 p2=0.00086 | saf Con r=-0.23 p=0.2, EAA r=-0.32 p=0.026, Z=0.40 p1=0.35 p2=0.69
b drop: dan Con r=0.59 p=0.00036, EAA r=0.01 p=0.97, Z=2.85 p1=0.0022 p2=0.0044 | unc Con r=0.44 p=0.011, EAA r=-0.28 p=0.049, Z=3.22 p1=0.00064 p2=0.0013 | saf Con r=-0.26 p=0.16, EAA r=-0.32 p=0.025, Z=0.30 p1=0.38 p2=0.77
b one : dan Con r=0.64 p=7e-05, EAA r=0.01 p=0.94, Z=3.18 p1=0.00075 p2=0.0015 | unc Con r=0.46 p=0.0084, EAA r=-0.28 p=0.055, Z=3.28 p1=0.00052 p2=0.001 | saf Con r=-0.24 p=0.19, EAA r=-0.32 p=0.027, Z=0.36 p1=0.36 p2=0.72
c zero: dan Con r=0.78 p=1.6e-07, EAA r=0.03 p=0.81, Z=4.24 p1=1.1e-05 p2=2.2e-05 | unc Con r=0.43 p=0.015, EAA r=-0.23 p=0.12, Z=2.91 p1=0.0018 p2=0.0037 | saf Con r=-0.26 p=0.16, EAA r=-0.28 p=0.055, Z=0.08 p1=0.47 p2=0.93
c drop: dan Con r=0.75 p=6.9e-07, EAA r=0.04 p=0.77, Z=3.94 p1=4e-05 p2=8e-05 | unc Con r=0.43 p=0.015, EAA r=-0.23 p=0.12, Z=2.88 p1=0.002 p2=0.004 | saf Con r=-0.27 p=0.14, EAA r=-0.27 p=0.058, Z=0.01 p1=0.5 p2=0.99
c one : dan Con r=0.77 p=2.8e-07, EAA r=0.06 p=0.7, Z=4.05 p1=2.5e-05 p2=5.1e-05 | unc Con r=0.44 p=0.012, EAA r=-0.21 p=0.14, Z=2.91 p1=0.0018 p2=0.0036 | saf Con r=-0.27 p=0.14, EAA r=-0.26 p=0.071, Z=-0.03 p1=0.49 p2=0.98
d zero: dan Con r=0.74 p=1e-06, EAA r=0.07 p=0.65, Z=3.77 p1=8.1e-05 p2=0.00016 | unc Con r=0.47 p=0.0062, EAA r=-0.22 p=0.14, Z=3.09 p1=0.00099 p2=0.002 | saf Con r=-0.24 p=0.19, EAA r=-0.25 p=0.083, Z=0.06 p1=0.48 p2=0.95
d drop: dan Con r=0.71 p=4.9e-06, EAA r=0.07 p=0.65, Z=3.48 p1=0.00025 p2=0.00051 | unc Con r=0.45 p=0.0093, EAA r=-0.22 p=0.12, Z=3.01 p1=0.0013 p2=0.0026 | saf Con r=-0.26 p=0.15, EAA r=-0.25 p=0.08, Z=-0.03 p1=0.49 p2=0.98
d one : dan Con r=0.75 p=6.8e-07, EAA r=0.07 p=0.63, Z=3.83 p1=6.4e-05 p2=0.00013 | unc Con r=0.47 p=0.007, EAA r=-0.22 p=0.13, Z=3.07 p1=0.0011 p2=0.0021 | saf Con r=-0.24 p=0.19, EAA r=-0.25 p=0.085, Z=0.05 p1=0.48 p2=0.96
('a', 'zero') parts (danger, uncertainty, safety): (np.True_, np.True_, np.True_) ; R2 Con danger 0.468, EAA 0.005; Con uncertainty 0.136, EAA 0.054
('a', 'drop') parts (danger, uncertainty, safety): (np.True_, np.True_, np.True_) ; R2 Con danger 0.438, EAA 0.006; Con uncertainty 0.138, EAA 0.053
('a', 'one') parts (danger, uncertainty, safety): (np.True_, np.True_, np.True_) ; R2 Con danger 0.470, EAA 0.008; Con uncertainty 0.153, EAA 0.047
('b', 'zero') parts (danger, uncertainty, safety): (np.True_, np.True_, np.False_) ; R2 Con danger 0.415, EAA 0.000; Con uncertainty 0.221, EAA 0.075
('b', 'drop') parts (danger, uncertainty, safety): (np.True_, np.False_, np.False_) ; R2 Con danger 0.351, EAA 0.000; Con uncertainty 0.195, EAA 0.080
('b', 'one') parts (danger, uncertainty, safety): (np.True_, np.True_, np.False_) ; R2 Con danger 0.414, EAA 0.000; Con uncertainty 0.210, EAA 0.076
('c', 'zero') parts (danger, uncertainty, safety): (np.True_, np.True_, np.True_) ; R2 Con danger 0.605, EAA 0.001; Con uncertainty 0.183, EAA 0.052
('c', 'drop') parts (danger, uncertainty, safety): (np.True_, np.True_, np.True_) ; R2 Con danger 0.566, EAA 0.002; Con uncertainty 0.181, EAA 0.051
('c', 'one') parts (danger, uncertainty, safety): (np.True_, np.True_, np.True_) ; R2 Con danger 0.591, EAA 0.003; Con uncertainty 0.194, EAA 0.045
('d', 'zero') parts (danger, uncertainty, safety): (np.True_, np.True_, np.True_) ; R2 Con danger 0.554, EAA 0.004; Con uncertainty 0.224, EAA 0.046
('d', 'drop') parts (danger, uncertainty, safety): (np.True_, np.True_, np.True_) ; R2 Con danger 0.507, EAA 0.004; Con uncertainty 0.205, EAA 0.049
('d', 'one') parts (danger, uncertainty, safety): (np.True_, np.True_, np.True_) ; R2 Con danger 0.566, EAA 0.005; Con uncertainty 0.218, EAA 0.047

Result: partially reproduced. With the Methods' normalization of the firing, which the claims file fixes, the danger part holds under every reading: under the adopted one, Control r = 0.51 (R2 = 0.26, p = 0.003), EAA r = -0.00 (p = 0.98), Z = 2.37, one-tailed p = 0.009. The uncertainty part fails under every reading, as the Control uncertainty correlation is not significant (adopted r = 0.09, R2 = 0.008, p = 0.62), and the safety part fails under every reading, as EAA safety firing correlates negatively with the beta (adopted p = 0.040). The Control R2 values (0.26 and 0.008) are far below the paper's 0.56 and 0.22. With the script's normalization of the firing, run as a full variant, every part holds under nine of the twelve regression readings (all but the three with firing b), and under the adopted one the statistics are the paper's: Control danger R2 = 0.566, p = 7e-7 (paper 0.56, 7.5e-7), Z = 3.83 (paper 3.80); Control uncertainty R2 = 0.218, p = 0.007 (paper 0.22, 0.007), Z = 3.07 (paper 3.05). The outcome follows the Methods, as the claims file does; under the script's normalization it would be reproduced.

figs5-excited-firing-fear-output-unrelated¶

In cue-excited neurons, cue firing did not predict fear output signaling for any cue in either group, and the relationships did not differ between groups.

In [26]:
def any_sig5(v):
    return any(v[ty][gg][1] < 0.05 for ty in v for gg in ("Con", "EAA")) or any(v[ty]["z"][1] < 0.05 for ty in v)
cs5 = corr_table("exc", "first1", "FO", FULL)
for rd in READINGS:
    v = cs5[rd]
    print(rd, "any correlation or one-tailed comparison significant:", any_sig5(v),
          "; smallest correlation p %.3f, smallest comparison p (one-tailed) %.3f" % (min(v[ty][gg][1] for ty in v for gg in ("Con", "EAA")), min(v[ty]["z"][1] for ty in v)))
print("\nvariant, the script's normalization, every regression reading")
cs5c = corr_table("exc", "first1", "FO", FULL, F_all=NFc)
for rd in READINGS:
    v = cs5c[rd]
    print(rd, "any significant:", any_sig5(v), "; smallest correlation p %.3f, smallest comparison p (one-tailed) %.3f"
          % (min(v[ty][gg][1] for ty in v for gg in ("Con", "EAA")), min(v[ty]["z"][1] for ty in v)))
a zero: dan Con r=0.07 p=0.71, EAA r=-0.18 p=0.23, Z=1.03 p1=0.15 p2=0.3 | unc Con r=-0.04 p=0.81, EAA r=-0.06 p=0.67, Z=0.08 p1=0.47 p2=0.94 | saf Con r=-0.14 p=0.45, EAA r=-0.22 p=0.14, Z=0.33 p1=0.37 p2=0.74
a drop: dan Con r=0.15 p=0.4, EAA r=-0.19 p=0.19, Z=1.48 p1=0.07 p2=0.14 | unc Con r=-0.04 p=0.83, EAA r=-0.07 p=0.65, Z=0.12 p1=0.45 p2=0.9 | saf Con r=-0.16 p=0.39, EAA r=-0.22 p=0.13, Z=0.28 p1=0.39 p2=0.78
a one : dan Con r=0.15 p=0.42, EAA r=-0.20 p=0.18, Z=1.47 p1=0.071 p2=0.14 | unc Con r=-0.06 p=0.75, EAA r=-0.07 p=0.65, Z=0.03 p1=0.49 p2=0.98 | saf Con r=-0.17 p=0.35, EAA r=-0.22 p=0.13, Z=0.22 p1=0.41 p2=0.83
b zero: dan Con r=0.09 p=0.64, EAA r=-0.07 p=0.65, Z=0.65 p1=0.26 p2=0.52 | unc Con r=-0.15 p=0.41, EAA r=-0.05 p=0.74, Z=-0.43 p1=0.33 p2=0.66 | saf Con r=-0.24 p=0.19, EAA r=-0.14 p=0.34, Z=-0.44 p1=0.33 p2=0.66
b drop: dan Con r=0.18 p=0.32, EAA r=-0.04 p=0.78, Z=0.95 p1=0.17 p2=0.34 | unc Con r=-0.02 p=0.92, EAA r=0.00 p=0.99, Z=-0.08 p1=0.47 p2=0.93 | saf Con r=-0.20 p=0.27, EAA r=-0.10 p=0.48, Z=-0.42 p1=0.34 p2=0.67
b one : dan Con r=0.17 p=0.34, EAA r=-0.02 p=0.9, Z=0.82 p1=0.21 p2=0.41 | unc Con r=0.00 p=0.98, EAA r=0.04 p=0.81, Z=-0.14 p1=0.45 p2=0.89 | saf Con r=-0.21 p=0.25, EAA r=-0.08 p=0.6, Z=-0.57 p1=0.28 p2=0.57
c zero: dan Con r=0.03 p=0.87, EAA r=-0.21 p=0.16, Z=1.00 p1=0.16 p2=0.32 | unc Con r=-0.07 p=0.71, EAA r=-0.10 p=0.5, Z=0.12 p1=0.45 p2=0.9 | saf Con r=-0.13 p=0.48, EAA r=-0.25 p=0.088, Z=0.52 p1=0.3 p2=0.61
c drop: dan Con r=0.13 p=0.48, EAA r=-0.22 p=0.12, Z=1.52 p1=0.065 p2=0.13 | unc Con r=-0.07 p=0.71, EAA r=-0.10 p=0.48, Z=0.15 p1=0.44 p2=0.88 | saf Con r=-0.13 p=0.47, EAA r=-0.25 p=0.081, Z=0.52 p1=0.3 p2=0.6
c one : dan Con r=0.13 p=0.48, EAA r=-0.23 p=0.11, Z=1.53 p1=0.063 p2=0.13 | unc Con r=-0.08 p=0.65, EAA r=-0.10 p=0.49, Z=0.07 p1=0.47 p2=0.94 | saf Con r=-0.14 p=0.44, EAA r=-0.25 p=0.082, Z=0.48 p1=0.32 p2=0.63
d zero: dan Con r=0.14 p=0.44, EAA r=-0.07 p=0.62, Z=0.91 p1=0.18 p2=0.36 | unc Con r=-0.10 p=0.6, EAA r=-0.02 p=0.89, Z=-0.32 p1=0.37 p2=0.75 | saf Con r=-0.18 p=0.32, EAA r=-0.13 p=0.37, Z=-0.23 p1=0.41 p2=0.82
d drop: dan Con r=0.23 p=0.2, EAA r=-0.06 p=0.68, Z=1.25 p1=0.11 p2=0.21 | unc Con r=0.02 p=0.91, EAA r=0.02 p=0.89, Z=0.00 p1=0.5 p2=1 | saf Con r=-0.16 p=0.38, EAA r=-0.10 p=0.48, Z=-0.25 p1=0.4 p2=0.8
d one : dan Con r=0.22 p=0.23, EAA r=-0.04 p=0.77, Z=1.11 p1=0.13 p2=0.27 | unc Con r=0.04 p=0.83, EAA r=0.05 p=0.72, Z=-0.05 p1=0.48 p2=0.96 | saf Con r=-0.17 p=0.34, EAA r=-0.08 p=0.58, Z=-0.40 p1=0.35 p2=0.69
('a', 'zero') any correlation or one-tailed comparison significant: False ; smallest correlation p 0.137, smallest comparison p (one-tailed) 0.150
('a', 'drop') any correlation or one-tailed comparison significant: False ; smallest correlation p 0.127, smallest comparison p (one-tailed) 0.070
('a', 'one') any correlation or one-tailed comparison significant: False ; smallest correlation p 0.126, smallest comparison p (one-tailed) 0.071
('b', 'zero') any correlation or one-tailed comparison significant: False ; smallest correlation p 0.185, smallest comparison p (one-tailed) 0.259
('b', 'drop') any correlation or one-tailed comparison significant: False ; smallest correlation p 0.270, smallest comparison p (one-tailed) 0.172
('b', 'one') any correlation or one-tailed comparison significant: False ; smallest correlation p 0.249, smallest comparison p (one-tailed) 0.207
('c', 'zero') any correlation or one-tailed comparison significant: False ; smallest correlation p 0.088, smallest comparison p (one-tailed) 0.158
('c', 'drop') any correlation or one-tailed comparison significant: False ; smallest correlation p 0.081, smallest comparison p (one-tailed) 0.065
('c', 'one') any correlation or one-tailed comparison significant: False ; smallest correlation p 0.082, smallest comparison p (one-tailed) 0.063
('d', 'zero') any correlation or one-tailed comparison significant: False ; smallest correlation p 0.317, smallest comparison p (one-tailed) 0.182
('d', 'drop') any correlation or one-tailed comparison significant: False ; smallest correlation p 0.203, smallest comparison p (one-tailed) 0.105
('d', 'one') any correlation or one-tailed comparison significant: False ; smallest correlation p 0.231, smallest comparison p (one-tailed) 0.133

variant, the script's normalization, every regression reading
a zero: dan Con r=0.20 p=0.27, EAA r=-0.17 p=0.25, Z=1.57 p1=0.059 p2=0.12 | unc Con r=0.13 p=0.49, EAA r=-0.07 p=0.62, Z=0.84 p1=0.2 p2=0.4 | saf Con r=-0.12 p=0.51, EAA r=-0.21 p=0.15, Z=0.38 p1=0.35 p2=0.71
a drop: dan Con r=0.30 p=0.095, EAA r=-0.18 p=0.21, Z=2.09 p1=0.018 p2=0.036 | unc Con r=0.15 p=0.42, EAA r=-0.08 p=0.59, Z=0.96 p1=0.17 p2=0.34 | saf Con r=-0.11 p=0.53, EAA r=-0.22 p=0.14, Z=0.44 p1=0.33 p2=0.66
a one : dan Con r=0.30 p=0.09, EAA r=-0.19 p=0.19, Z=2.13 p1=0.016 p2=0.033 | unc Con r=0.14 p=0.45, EAA r=-0.08 p=0.61, Z=0.91 p1=0.18 p2=0.36 | saf Con r=-0.12 p=0.52, EAA r=-0.22 p=0.14, Z=0.42 p1=0.34 p2=0.68
b zero: dan Con r=0.25 p=0.17, EAA r=-0.07 p=0.63, Z=1.37 p1=0.085 p2=0.17 | unc Con r=0.04 p=0.84, EAA r=-0.04 p=0.78, Z=0.33 p1=0.37 p2=0.74 | saf Con r=-0.17 p=0.34, EAA r=-0.11 p=0.44, Z=-0.26 p1=0.4 p2=0.79
b drop: dan Con r=0.27 p=0.14, EAA r=-0.05 p=0.73, Z=1.37 p1=0.086 p2=0.17 | unc Con r=0.11 p=0.54, EAA r=0.00 p=0.98, Z=0.47 p1=0.32 p2=0.64 | saf Con r=-0.14 p=0.45, EAA r=-0.08 p=0.57, Z=-0.24 p1=0.41 p2=0.81
b one : dan Con r=0.25 p=0.17, EAA r=-0.03 p=0.83, Z=1.20 p1=0.12 p2=0.23 | unc Con r=0.13 p=0.47, EAA r=0.04 p=0.81, Z=0.41 p1=0.34 p2=0.69 | saf Con r=-0.15 p=0.4, EAA r=-0.06 p=0.69, Z=-0.41 p1=0.34 p2=0.68
c zero: dan Con r=0.18 p=0.32, EAA r=-0.20 p=0.17, Z=1.61 p1=0.053 p2=0.11 | unc Con r=0.11 p=0.57, EAA r=-0.11 p=0.43, Z=0.93 p1=0.18 p2=0.35 | saf Con r=-0.10 p=0.57, EAA r=-0.25 p=0.085, Z=0.63 p1=0.26 p2=0.53
c drop: dan Con r=0.31 p=0.083, EAA r=-0.22 p=0.13, Z=2.29 p1=0.011 p2=0.022 | unc Con r=0.14 p=0.46, EAA r=-0.12 p=0.41, Z=1.09 p1=0.14 p2=0.28 | saf Con r=-0.08 p=0.65, EAA r=-0.26 p=0.076, Z=0.75 p1=0.23 p2=0.45
c one : dan Con r=0.32 p=0.075, EAA r=-0.22 p=0.13, Z=2.34 p1=0.0096 p2=0.019 | unc Con r=0.13 p=0.48, EAA r=-0.12 p=0.43, Z=1.04 p1=0.15 p2=0.3 | saf Con r=-0.08 p=0.65, EAA r=-0.25 p=0.078, Z=0.74 p1=0.23 p2=0.46
d zero: dan Con r=0.31 p=0.079, EAA r=-0.07 p=0.63, Z=1.67 p1=0.047 p2=0.094 | unc Con r=0.10 p=0.58, EAA r=-0.01 p=0.94, Z=0.47 p1=0.32 p2=0.64 | saf Con r=-0.12 p=0.51, EAA r=-0.10 p=0.49, Z=-0.08 p1=0.47 p2=0.94
d drop: dan Con r=0.34 p=0.058, EAA r=-0.06 p=0.66, Z=1.76 p1=0.039 p2=0.079 | unc Con r=0.17 p=0.34, EAA r=0.02 p=0.88, Z=0.65 p1=0.26 p2=0.52 | saf Con r=-0.10 p=0.58, EAA r=-0.08 p=0.58, Z=-0.08 p1=0.47 p2=0.94
d one : dan Con r=0.31 p=0.083, EAA r=-0.05 p=0.75, Z=1.56 p1=0.059 p2=0.12 | unc Con r=0.19 p=0.3, EAA r=0.05 p=0.72, Z=0.58 p1=0.28 p2=0.56 | saf Con r=-0.12 p=0.52, EAA r=-0.06 p=0.69, Z=-0.25 p1=0.4 p2=0.8
('a', 'zero') any significant: False ; smallest correlation p 0.152, smallest comparison p (one-tailed) 0.059
('a', 'drop') any significant: True ; smallest correlation p 0.095, smallest comparison p (one-tailed) 0.018
('a', 'one') any significant: True ; smallest correlation p 0.090, smallest comparison p (one-tailed) 0.016
('b', 'zero') any significant: False ; smallest correlation p 0.169, smallest comparison p (one-tailed) 0.085
('b', 'drop') any significant: False ; smallest correlation p 0.141, smallest comparison p (one-tailed) 0.086
('b', 'one') any significant: False ; smallest correlation p 0.172, smallest comparison p (one-tailed) 0.115
('c', 'zero') any significant: False ; smallest correlation p 0.085, smallest comparison p (one-tailed) 0.053
('c', 'drop') any significant: True ; smallest correlation p 0.076, smallest comparison p (one-tailed) 0.011
('c', 'one') any significant: True ; smallest correlation p 0.075, smallest comparison p (one-tailed) 0.010
('d', 'zero') any significant: True ; smallest correlation p 0.079, smallest comparison p (one-tailed) 0.047
('d', 'drop') any significant: True ; smallest correlation p 0.058, smallest comparison p (one-tailed) 0.039
('d', 'one') any significant: False ; smallest correlation p 0.083, smallest comparison p (one-tailed) 0.059

Result: reproduced. With the Methods' normalization, under every reading none of the six correlations and none of the three comparisons is significant (under the adopted one the smallest correlation p is 0.23 and the smallest one-tailed comparison p 0.13). With the script's normalization the adopted reading also has none (smallest comparison p 0.059), but six of the twelve readings have one comparison with one-tailed p < 0.05 (smallest 0.010).

fig7-inhibited-firing-fear-output¶

In cue-inhibited neurons, last-5 s danger firing did not predict the last-5 s fear output beta in either group; uncertainty firing predicted it positively in EAA but not in Control neurons, and safety firing predicted it negatively in both groups; none of these relationships differed between groups.

In [27]:
def judge7(v):
    return dict(
        danger=v["danger"]["Con"][1] >= 0.05 and v["danger"]["EAA"][1] >= 0.05,
        uncertainty=v["uncertainty"]["EAA"][0] > 0 and v["uncertainty"]["EAA"][1] < 0.05 and v["uncertainty"]["Con"][1] >= 0.05,
        safety=all(v["safety"][gg][0] < 0 and v["safety"][gg][1] < 0.05 for gg in ("Con", "EAA")),
        comparisons=v["danger"]["z"][1] >= 0.05 and v["uncertainty"]["z"][1] >= 0.05 and v["safety"]["z"][2] >= 0.05)
c7 = corr_table("inh", "last5", "FO", LAST)
for rd in READINGS:
    print(rd, judge7(c7[rd]))
print("\nvariant, the script's normalization, every regression reading")
c7c = corr_table("inh", "last5", "FO", LAST, F_all=NFc)
for rd in READINGS:
    print(rd, judge7(c7c[rd]))
print("\nvariant, other firing windows, adopted regression reading. The legend and Results give the last 5 s; the script computes"
      " cue-inhibited firing only over the first 5 s and the whole cue (vlpagAnalysis.m, 'Find mean firing in first 5 seconds' and 'for whole cue').")
print("   paper: danger Con R2 0.004 p 0.67, EAA 0.02 p 0.24, Z 1.04 | uncertainty Con 0.04 p 0.16, EAA 0.20 p 2.6e-05, Z 1.43 | safety Con 0.14 p 0.009, EAA 0.22 p 8.9e-06, Z 0.60")
for win in ("last5", "first5", "cue"):
    for nm, Fa in (("Methods", NF), ("script", NFc)):
        v = corr_table("inh", win, "FO", LAST, F_all=Fa, readings=[ADOPTED])[ADOPTED]
        print(f"   firing {win:6s} {nm:7s} normalization: " + " | ".join(
            f"{ty[:3]} Con R2 {v[ty]['Con'][0] ** 2:.3f} p {v[ty]['Con'][1]:.2g}, EAA R2 {v[ty]['EAA'][0] ** 2:.3f} p {v[ty]['EAA'][1]:.2g}, Z {v[ty]['z'][0]:.2f}"
            for ty in v) + "; parts " + str({k: bool(x) for k, x in judge7(v).items()}))
print("\nvariant, firing over the first 5 s, every regression reading: parts that hold")
for nm, Fa in (("Methods", NF), ("script", NFc)):
    c7f = corr_table("inh", "first5", "FO", LAST, F_all=Fa, show=False)
    for rd in READINGS:
        v = c7f[rd]
        print(f"   {nm:7s} normalization, {rd[0]} {rd[1]:4s}: " + str({k: bool(x) for k, x in judge7(v).items()})
              + f"; Control uncertainty r = {v['uncertainty']['Con'][0]:.2f}, p = {v['uncertainty']['Con'][1]:.2g}")
a zero: dan Con r=-0.15 p=0.3, EAA r=0.22 p=0.044, Z=-2.03 p1=0.021 p2=0.042 | unc Con r=0.56 p=3.7e-05, EAA r=0.63 p=1.1e-10, Z=-0.62 p1=0.27 p2=0.54 | saf Con r=-0.38 p=0.0086, EAA r=-0.32 p=0.0028, Z=-0.32 p1=0.37 p2=0.75
a drop: dan Con r=-0.12 p=0.44, EAA r=0.22 p=0.041, Z=-1.84 p1=0.033 p2=0.065 | unc Con r=0.60 p=6.5e-06, EAA r=0.64 p=6.9e-11, Z=-0.33 p1=0.37 p2=0.74 | saf Con r=-0.39 p=0.0062, EAA r=-0.33 p=0.0024, Z=-0.39 p1=0.35 p2=0.7
a one : dan Con r=-0.13 p=0.39, EAA r=0.22 p=0.048, Z=-1.86 p1=0.031 p2=0.062 | unc Con r=0.60 p=6e-06, EAA r=0.63 p=8.9e-11, Z=-0.29 p1=0.39 p2=0.77 | saf Con r=-0.39 p=0.0063, EAA r=-0.33 p=0.0022, Z=-0.36 p1=0.36 p2=0.72
b zero: dan Con r=0.21 p=0.16, EAA r=0.08 p=0.45, Z=0.68 p1=0.25 p2=0.5 | unc Con r=0.70 p=3.2e-08, EAA r=0.45 p=1.6e-05, Z=2.04 p1=0.021 p2=0.041 | saf Con r=-0.19 p=0.19, EAA r=-0.29 p=0.0069, Z=0.57 p1=0.28 p2=0.57
b drop: dan Con r=0.24 p=0.11, EAA r=0.09 p=0.43, Z=0.83 p1=0.2 p2=0.41 | unc Con r=0.70 p=2.4e-08, EAA r=0.44 p=2.9e-05, Z=2.17 p1=0.015 p2=0.03 | saf Con r=-0.31 p=0.031, EAA r=-0.29 p=0.0076, Z=-0.13 p1=0.45 p2=0.89
b one : dan Con r=0.26 p=0.075, EAA r=0.09 p=0.43, Z=0.96 p1=0.17 p2=0.34 | unc Con r=0.68 p=1e-07, EAA r=0.43 p=4e-05, Z=1.98 p1=0.024 p2=0.048 | saf Con r=-0.31 p=0.031, EAA r=-0.30 p=0.0058, Z=-0.07 p1=0.47 p2=0.94
c zero: dan Con r=0.09 p=0.56, EAA r=0.33 p=0.0025, Z=-1.35 p1=0.089 p2=0.18 | unc Con r=0.35 p=0.015, EAA r=0.57 p=1.1e-08, Z=-1.56 p1=0.06 p2=0.12 | saf Con r=-0.25 p=0.088, EAA r=-0.25 p=0.022, Z=0.00 p1=0.5 p2=1
c drop: dan Con r=0.13 p=0.37, EAA r=0.33 p=0.0019, Z=-1.15 p1=0.12 p2=0.25 | unc Con r=0.39 p=0.006, EAA r=0.58 p=9.4e-09, Z=-1.32 p1=0.094 p2=0.19 | saf Con r=-0.26 p=0.069, EAA r=-0.25 p=0.022, Z=-0.08 p1=0.47 p2=0.94
c one : dan Con r=0.12 p=0.4, EAA r=0.33 p=0.0024, Z=-1.16 p1=0.12 p2=0.25 | unc Con r=0.40 p=0.0053, EAA r=0.58 p=1e-08, Z=-1.27 p1=0.1 p2=0.2 | saf Con r=-0.27 p=0.065, EAA r=-0.25 p=0.022, Z=-0.11 p1=0.46 p2=0.91
d zero: dan Con r=0.23 p=0.11, EAA r=0.15 p=0.16, Z=0.43 p1=0.33 p2=0.67 | unc Con r=0.71 p=1.3e-08, EAA r=0.49 p=2.1e-06, Z=1.92 p1=0.028 p2=0.055 | saf Con r=-0.21 p=0.15, EAA r=-0.30 p=0.0049, Z=0.54 p1=0.3 p2=0.59
d drop: dan Con r=0.26 p=0.077, EAA r=0.16 p=0.15, Z=0.56 p1=0.29 p2=0.58 | unc Con r=0.73 p=4.7e-09, EAA r=0.48 p=3.8e-06, Z=2.15 p1=0.016 p2=0.031 | saf Con r=-0.32 p=0.027, EAA r=-0.30 p=0.0055, Z=-0.11 p1=0.46 p2=0.92
d one : dan Con r=0.28 p=0.054, EAA r=0.16 p=0.15, Z=0.69 p1=0.24 p2=0.49 | unc Con r=0.71 p=1.2e-08, EAA r=0.47 p=5.8e-06, Z=2.06 p1=0.02 p2=0.04 | saf Con r=-0.32 p=0.026, EAA r=-0.31 p=0.0042, Z=-0.06 p1=0.47 p2=0.95
('a', 'zero') {'danger': np.False_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.False_}
('a', 'drop') {'danger': np.False_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.False_}
('a', 'one') {'danger': np.False_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.False_}
('b', 'zero') {'danger': np.True_, 'uncertainty': np.False_, 'safety': False, 'comparisons': np.False_}
('b', 'drop') {'danger': np.True_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.False_}
('b', 'one') {'danger': np.True_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.False_}
('c', 'zero') {'danger': np.False_, 'uncertainty': np.False_, 'safety': False, 'comparisons': np.True_}
('c', 'drop') {'danger': np.False_, 'uncertainty': np.False_, 'safety': False, 'comparisons': np.True_}
('c', 'one') {'danger': np.False_, 'uncertainty': np.False_, 'safety': False, 'comparisons': np.True_}
('d', 'zero') {'danger': np.True_, 'uncertainty': np.False_, 'safety': False, 'comparisons': np.False_}
('d', 'drop') {'danger': np.True_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.False_}
('d', 'one') {'danger': np.True_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.False_}

variant, the script's normalization, every regression reading
a zero: dan Con r=-0.15 p=0.3, EAA r=0.22 p=0.046, Z=-2.02 p1=0.022 p2=0.044 | unc Con r=0.51 p=0.00024, EAA r=0.64 p=5.1e-11, Z=-1.08 p1=0.14 p2=0.28 | saf Con r=-0.47 p=0.00076, EAA r=-0.38 p=0.00039, Z=-0.60 p1=0.27 p2=0.55
a drop: dan Con r=-0.11 p=0.44, EAA r=0.22 p=0.042, Z=-1.84 p1=0.033 p2=0.066 | unc Con r=0.55 p=5.4e-05, EAA r=0.65 p=2.4e-11, Z=-0.85 p1=0.2 p2=0.4 | saf Con r=-0.49 p=0.00044, EAA r=-0.38 p=0.00033, Z=-0.70 p1=0.24 p2=0.48
a one : dan Con r=-0.12 p=0.4, EAA r=0.21 p=0.05, Z=-1.85 p1=0.032 p2=0.065 | unc Con r=0.55 p=5.5e-05, EAA r=0.65 p=3.1e-11, Z=-0.83 p1=0.2 p2=0.41 | saf Con r=-0.49 p=0.00043, EAA r=-0.39 p=0.00029, Z=-0.68 p1=0.25 p2=0.49
b zero: dan Con r=0.19 p=0.2, EAA r=0.12 p=0.29, Z=0.41 p1=0.34 p2=0.68 | unc Con r=0.66 p=3.4e-07, EAA r=0.48 p=3.7e-06, Z=1.45 p1=0.074 p2=0.15 | saf Con r=-0.26 p=0.07, EAA r=-0.35 p=0.0011, Z=0.51 p1=0.3 p2=0.61
b drop: dan Con r=0.21 p=0.14, EAA r=0.12 p=0.28, Z=0.52 p1=0.3 p2=0.6 | unc Con r=0.68 p=1.4e-07, EAA r=0.47 p=5.2e-06, Z=1.64 p1=0.05 p2=0.1 | saf Con r=-0.39 p=0.0063, EAA r=-0.34 p=0.0014, Z=-0.29 p1=0.39 p2=0.77
b one : dan Con r=0.24 p=0.11, EAA r=0.12 p=0.27, Z=0.64 p1=0.26 p2=0.53 | unc Con r=0.66 p=3.5e-07, EAA r=0.47 p=6.7e-06, Z=1.52 p1=0.065 p2=0.13 | saf Con r=-0.38 p=0.0071, EAA r=-0.35 p=0.0011, Z=-0.21 p1=0.42 p2=0.83
c zero: dan Con r=0.12 p=0.44, EAA r=0.36 p=0.00071, Z=-1.42 p1=0.078 p2=0.16 | unc Con r=0.38 p=0.0079, EAA r=0.66 p=6.1e-12, Z=-2.15 p1=0.016 p2=0.032 | saf Con r=-0.26 p=0.069, EAA r=-0.29 p=0.0084, Z=0.12 p1=0.45 p2=0.9
c drop: dan Con r=0.16 p=0.28, EAA r=0.37 p=0.00046, Z=-1.25 p1=0.11 p2=0.21 | unc Con r=0.42 p=0.0027, EAA r=0.67 p=2.4e-12, Z=-1.96 p1=0.025 p2=0.05 | saf Con r=-0.29 p=0.048, EAA r=-0.29 p=0.0083, Z=-0.00 p1=0.5 p2=1
c one : dan Con r=0.15 p=0.3, EAA r=0.37 p=0.0006, Z=-1.24 p1=0.11 p2=0.22 | unc Con r=0.43 p=0.0024, EAA r=0.67 p=2.7e-12, Z=-1.92 p1=0.028 p2=0.055 | saf Con r=-0.29 p=0.044, EAA r=-0.29 p=0.0085, Z=-0.04 p1=0.48 p2=0.97
d zero: dan Con r=0.21 p=0.15, EAA r=0.20 p=0.074, Z=0.08 p1=0.47 p2=0.93 | unc Con r=0.68 p=8.6e-08, EAA r=0.55 p=4.5e-08, Z=1.13 p1=0.13 p2=0.26 | saf Con r=-0.29 p=0.047, EAA r=-0.37 p=0.00054, Z=0.49 p1=0.31 p2=0.62
d drop: dan Con r=0.23 p=0.11, EAA r=0.20 p=0.068, Z=0.19 p1=0.42 p2=0.85 | unc Con r=0.71 p=1.7e-08, EAA r=0.55 p=6.1e-08, Z=1.43 p1=0.076 p2=0.15 | saf Con r=-0.40 p=0.0043, EAA r=-0.36 p=0.00071, Z=-0.27 p1=0.39 p2=0.79
d one : dan Con r=0.26 p=0.077, EAA r=0.20 p=0.066, Z=0.32 p1=0.37 p2=0.75 | unc Con r=0.70 p=2.8e-08, EAA r=0.54 p=9.1e-08, Z=1.40 p1=0.081 p2=0.16 | saf Con r=-0.40 p=0.0046, EAA r=-0.37 p=0.00058, Z=-0.21 p1=0.42 p2=0.83
('a', 'zero') {'danger': np.False_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.False_}
('a', 'drop') {'danger': np.False_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.False_}
('a', 'one') {'danger': np.False_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.False_}
('b', 'zero') {'danger': np.True_, 'uncertainty': np.False_, 'safety': False, 'comparisons': np.True_}
('b', 'drop') {'danger': np.True_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.True_}
('b', 'one') {'danger': np.True_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.True_}
('c', 'zero') {'danger': np.False_, 'uncertainty': np.False_, 'safety': False, 'comparisons': np.False_}
('c', 'drop') {'danger': np.False_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.False_}
('c', 'one') {'danger': np.False_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.False_}
('d', 'zero') {'danger': np.True_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.True_}
('d', 'drop') {'danger': np.True_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.True_}
('d', 'one') {'danger': np.True_, 'uncertainty': np.False_, 'safety': True, 'comparisons': np.True_}

variant, other firing windows, adopted regression reading. The legend and Results give the last 5 s; the script computes cue-inhibited firing only over the first 5 s and the whole cue (vlpagAnalysis.m, 'Find mean firing in first 5 seconds' and 'for whole cue').
   paper: danger Con R2 0.004 p 0.67, EAA 0.02 p 0.24, Z 1.04 | uncertainty Con 0.04 p 0.16, EAA 0.20 p 2.6e-05, Z 1.43 | safety Con 0.14 p 0.009, EAA 0.22 p 8.9e-06, Z 0.60
d one : dan Con r=0.28 p=0.054, EAA r=0.16 p=0.15, Z=0.69 p1=0.24 p2=0.49 | unc Con r=0.71 p=1.2e-08, EAA r=0.47 p=5.8e-06, Z=2.06 p1=0.02 p2=0.04 | saf Con r=-0.32 p=0.026, EAA r=-0.31 p=0.0042, Z=-0.06 p1=0.47 p2=0.95
   firing last5  Methods normalization: dan Con R2 0.078 p 0.054, EAA R2 0.025 p 0.15, Z 0.69 | unc Con R2 0.510 p 1.2e-08, EAA R2 0.223 p 5.8e-06, Z 2.06 | saf Con R2 0.103 p 0.026, EAA R2 0.096 p 0.0042, Z -0.06; parts {'danger': True, 'uncertainty': False, 'safety': True, 'comparisons': False}
d one : dan Con r=0.26 p=0.077, EAA r=0.20 p=0.066, Z=0.32 p1=0.37 p2=0.75 | unc Con r=0.70 p=2.8e-08, EAA r=0.54 p=9.1e-08, Z=1.40 p1=0.081 p2=0.16 | saf Con r=-0.40 p=0.0046, EAA r=-0.37 p=0.00058, Z=-0.21 p1=0.42 p2=0.83
   firing last5  script  normalization: dan Con R2 0.066 p 0.077, EAA R2 0.041 p 0.066, Z 0.32 | unc Con R2 0.492 p 2.8e-08, EAA R2 0.296 p 9.1e-08, Z 1.40 | saf Con R2 0.161 p 0.0046, EAA R2 0.135 p 0.00058, Z -0.21; parts {'danger': True, 'uncertainty': False, 'safety': True, 'comparisons': True}
d one : dan Con r=-0.02 p=0.9, EAA r=0.04 p=0.73, Z=-0.30 p1=0.38 p2=0.76 | unc Con r=0.24 p=0.1, EAA r=0.34 p=0.0013, Z=-0.63 p1=0.27 p2=0.53 | saf Con r=-0.30 p=0.041, EAA r=-0.42 p=5.8e-05, Z=0.79 p1=0.21 p2=0.43
   firing first5 Methods normalization: dan Con R2 0.000 p 0.9, EAA R2 0.001 p 0.73, Z -0.30 | unc Con R2 0.057 p 0.1, EAA R2 0.118 p 0.0013, Z -0.63 | saf Con R2 0.088 p 0.041, EAA R2 0.180 p 5.8e-05, Z 0.79; parts {'danger': True, 'uncertainty': True, 'safety': True, 'comparisons': True}
d one : dan Con r=-0.06 p=0.7, EAA r=0.12 p=0.28, Z=-0.95 p1=0.17 p2=0.34 | unc Con r=0.21 p=0.16, EAA r=0.44 p=2.9e-05, Z=-1.41 p1=0.079 p2=0.16 | saf Con r=-0.37 p=0.0088, EAA r=-0.47 p=7.7e-06, Z=0.60 p1=0.27 p2=0.55
   firing first5 script  normalization: dan Con R2 0.003 p 0.7, EAA R2 0.014 p 0.28, Z -0.95 | unc Con R2 0.042 p 0.16, EAA R2 0.193 p 2.9e-05, Z -1.41 | saf Con R2 0.140 p 0.0088, EAA R2 0.218 p 7.7e-06, Z 0.60; parts {'danger': True, 'uncertainty': True, 'safety': True, 'comparisons': True}
d one : dan Con r=0.18 p=0.23, EAA r=0.12 p=0.28, Z=0.31 p1=0.38 p2=0.76 | unc Con r=0.57 p=2.2e-05, EAA r=0.48 p=3.2e-06, Z=0.66 p1=0.25 p2=0.51 | saf Con r=-0.37 p=0.0099, EAA r=-0.40 p=0.00018, Z=0.19 p1=0.43 p2=0.85
   firing cue    Methods normalization: dan Con R2 0.031 p 0.23, EAA R2 0.014 p 0.28, Z 0.31 | unc Con R2 0.327 p 2.2e-05, EAA R2 0.234 p 3.2e-06, Z 0.66 | saf Con R2 0.136 p 0.0099, EAA R2 0.159 p 0.00018, Z 0.19; parts {'danger': True, 'uncertainty': False, 'safety': True, 'comparisons': True}
d one : dan Con r=0.13 p=0.37, EAA r=0.18 p=0.1, Z=-0.25 p1=0.4 p2=0.8 | unc Con r=0.56 p=3e-05, EAA r=0.56 p=2.4e-08, Z=0.00 p1=0.5 p2=1 | saf Con r=-0.45 p=0.0012, EAA r=-0.45 p=1.6e-05, Z=-0.02 p1=0.49 p2=0.99
   firing cue    script  normalization: dan Con R2 0.018 p 0.37, EAA R2 0.032 p 0.1, Z -0.25 | unc Con R2 0.318 p 3e-05, EAA R2 0.318 p 2.4e-08, Z 0.00 | saf Con R2 0.206 p 0.0012, EAA R2 0.204 p 1.6e-05, Z -0.02; parts {'danger': True, 'uncertainty': False, 'safety': True, 'comparisons': True}

variant, firing over the first 5 s, every regression reading: parts that hold
   Methods normalization, a zero: {'danger': True, 'uncertainty': False, 'safety': False, 'comparisons': True}; Control uncertainty r = 0.53, p = 0.00011
   Methods normalization, a drop: {'danger': True, 'uncertainty': False, 'safety': False, 'comparisons': True}; Control uncertainty r = 0.48, p = 0.00049
   Methods normalization, a one : {'danger': True, 'uncertainty': False, 'safety': False, 'comparisons': True}; Control uncertainty r = 0.47, p = 0.0007
   Methods normalization, b zero: {'danger': True, 'uncertainty': True, 'safety': True, 'comparisons': True}; Control uncertainty r = 0.24, p = 0.1
   Methods normalization, b drop: {'danger': True, 'uncertainty': True, 'safety': True, 'comparisons': True}; Control uncertainty r = 0.23, p = 0.12
   Methods normalization, b one : {'danger': True, 'uncertainty': True, 'safety': False, 'comparisons': True}; Control uncertainty r = 0.22, p = 0.14
   Methods normalization, c zero: {'danger': False, 'uncertainty': True, 'safety': False, 'comparisons': True}; Control uncertainty r = 0.15, p = 0.3
   Methods normalization, c drop: {'danger': False, 'uncertainty': True, 'safety': False, 'comparisons': True}; Control uncertainty r = 0.09, p = 0.52
   Methods normalization, c one : {'danger': False, 'uncertainty': True, 'safety': False, 'comparisons': True}; Control uncertainty r = 0.09, p = 0.54
   Methods normalization, d zero: {'danger': True, 'uncertainty': True, 'safety': True, 'comparisons': True}; Control uncertainty r = 0.26, p = 0.072
   Methods normalization, d drop: {'danger': True, 'uncertainty': True, 'safety': True, 'comparisons': True}; Control uncertainty r = 0.24, p = 0.094
   Methods normalization, d one : {'danger': True, 'uncertainty': True, 'safety': True, 'comparisons': True}; Control uncertainty r = 0.24, p = 0.1
   script  normalization, a zero: {'danger': True, 'uncertainty': False, 'safety': False, 'comparisons': True}; Control uncertainty r = 0.48, p = 0.00061
   script  normalization, a drop: {'danger': True, 'uncertainty': False, 'safety': False, 'comparisons': True}; Control uncertainty r = 0.42, p = 0.0026
   script  normalization, a one : {'danger': True, 'uncertainty': False, 'safety': False, 'comparisons': True}; Control uncertainty r = 0.41, p = 0.004
   script  normalization, b zero: {'danger': True, 'uncertainty': True, 'safety': True, 'comparisons': True}; Control uncertainty r = 0.21, p = 0.15
   script  normalization, b drop: {'danger': True, 'uncertainty': True, 'safety': True, 'comparisons': True}; Control uncertainty r = 0.19, p = 0.19
   script  normalization, b one : {'danger': True, 'uncertainty': True, 'safety': True, 'comparisons': True}; Control uncertainty r = 0.18, p = 0.22
   script  normalization, c zero: {'danger': False, 'uncertainty': True, 'safety': False, 'comparisons': False}; Control uncertainty r = 0.17, p = 0.24
   script  normalization, c drop: {'danger': False, 'uncertainty': True, 'safety': False, 'comparisons': False}; Control uncertainty r = 0.10, p = 0.5
   script  normalization, c one : {'danger': False, 'uncertainty': True, 'safety': False, 'comparisons': False}; Control uncertainty r = 0.09, p = 0.54
   script  normalization, d zero: {'danger': True, 'uncertainty': True, 'safety': True, 'comparisons': True}; Control uncertainty r = 0.24, p = 0.099
   script  normalization, d drop: {'danger': True, 'uncertainty': True, 'safety': True, 'comparisons': True}; Control uncertainty r = 0.21, p = 0.14
   script  normalization, d one : {'danger': True, 'uncertainty': True, 'safety': True, 'comparisons': True}; Control uncertainty r = 0.21, p = 0.16

Result: not reproduced. With the last-5 s firing the claims file names, the Control uncertainty correlation is positive and significant under every reading and under both normalizations (Methods' normalization r = 0.35 to 0.73, p <= 0.015, the weakest under firing c; adopted, Methods r = 0.71, R2 = 0.51, p = 1e-8; script R2 = 0.49, p = 3e-8; the paper R2 = 0.04, p = 0.16), so the uncertainty part fails, and with it the condition for a partial outcome. Under the adopted reading the danger correlations are not significant (p = 0.054 and 0.15), both safety correlations are negative and significant (p = 0.026 and 0.004), and the uncertainty comparison is significant one-tailed (Z = 2.06, p = 0.020), against the claim.

With the firing over the first 5 s of the cue, the window the script computes for cue-inhibited neurons (data check), every part holds under the adopted reading with both normalizations, and with the script's normalization the statistics are the paper's: Control uncertainty R2 = 0.042, p = 0.16 (paper 0.04, 0.16), EAA R2 = 0.193, p = 2.9e-5 (paper 0.20, 2.6e-5), Z = -1.41 (paper 1.43); safety Control R2 = 0.14, p = 0.009 and EAA R2 = 0.218, p = 7.7e-6 (paper 0.14, 0.009 and 0.22, 8.9e-6), Z = 0.60 (paper 0.60); danger Control R2 = 0.003, p = 0.70 and EAA R2 = 0.014, p = 0.28 (paper 0.004, 0.67 and 0.02, 0.24). Under all twelve regression readings, first-5 s firing meets every part with firing (b) or (d) (all six with the script's normalization; five of six with the Methods', b with 0/0 trials set to 1 failing the safety part); with (a) the Control uncertainty correlation stays significant (p <= 0.004), and with (c) the danger and safety parts fail. The paper's Fig. 7 was evidently computed on first-5 s firing, while its legend and Results say the last 5 s. The claims file follows the legend, so the outcome stays not reproduced; the mismatch is recorded as a finding.

figs6-inhibited-firing-threat-probability¶

In cue-inhibited neurons, cue firing also predicted threat probability signaling in both groups, with no difference between Control and EAA for any relationship.

In [28]:
def judge_s6(v):
    return all(any(v[ty][gg][1] < 0.05 for ty in v) for gg in ("Con", "EAA")), all(v[ty]["z"][1] >= 0.05 for ty in v), all(v[ty]["z"][2] >= 0.05 for ty in v)
cs6 = corr_table("inh", "last5", "TP", LAST)
for rd in READINGS:
    v = cs6[rd]
    print(rd, "a cue with p < 0.05 in each group, no comparison one-tailed, none two-tailed:", judge_s6(v),
          "; comparisons one-tailed p", [round(v[ty]["z"][1], 3) for ty in v], "two-tailed", [round(v[ty]["z"][2], 3) for ty in v])
print("\nvariant, the script's normalization, every regression reading")
cs6c = corr_table("inh", "last5", "TP", LAST, F_all=NFc)
for rd in READINGS:
    v = cs6c[rd]
    print(rd, judge_s6(v), "; comparisons one-tailed p", [round(v[ty]["z"][1], 3) for ty in v])
a zero: dan Con r=0.84 p=9.4e-14, EAA r=0.84 p=2.2e-23, Z=0.00 p1=0.5 p2=1 | unc Con r=0.04 p=0.8, EAA r=0.10 p=0.38, Z=-0.32 p1=0.38 p2=0.75 | saf Con r=-0.32 p=0.029, EAA r=-0.48 p=3.2e-06, Z=1.08 p1=0.14 p2=0.28
a drop: dan Con r=0.82 p=7.9e-13, EAA r=0.84 p=2.5e-23, Z=-0.29 p1=0.39 p2=0.78 | unc Con r=0.01 p=0.96, EAA r=0.10 p=0.37, Z=-0.50 p1=0.31 p2=0.62 | saf Con r=-0.29 p=0.043, EAA r=-0.48 p=3.4e-06, Z=1.20 p1=0.11 p2=0.23
a one : dan Con r=0.84 p=7.9e-14, EAA r=0.84 p=1.3e-23, Z=-0.01 p1=0.49 p2=0.99 | unc Con r=0.02 p=0.9, EAA r=0.10 p=0.39, Z=-0.41 p1=0.34 p2=0.68 | saf Con r=-0.30 p=0.038, EAA r=-0.48 p=4.2e-06, Z=1.13 p1=0.13 p2=0.26
b zero: dan Con r=0.75 p=8.9e-10, EAA r=0.84 p=5.1e-23, Z=-1.26 p1=0.1 p2=0.21 | unc Con r=-0.04 p=0.78, EAA r=0.14 p=0.2, Z=-0.98 p1=0.16 p2=0.33 | saf Con r=-0.31 p=0.033, EAA r=-0.44 p=2.8e-05, Z=0.82 p1=0.2 p2=0.41
b drop: dan Con r=0.73 p=3.5e-09, EAA r=0.82 p=7.8e-22, Z=-1.26 p1=0.1 p2=0.21 | unc Con r=-0.06 p=0.7, EAA r=0.14 p=0.19, Z=-1.09 p1=0.14 p2=0.27 | saf Con r=-0.23 p=0.11, EAA r=-0.44 p=2.8e-05, Z=1.26 p1=0.1 p2=0.21
b one : dan Con r=0.77 p=1.7e-10, EAA r=0.83 p=1.2e-22, Z=-0.94 p1=0.17 p2=0.35 | unc Con r=0.00 p=0.99, EAA r=0.14 p=0.19, Z=-0.77 p1=0.22 p2=0.44 | saf Con r=-0.30 p=0.037, EAA r=-0.44 p=3.4e-05, Z=0.84 p1=0.2 p2=0.4
c zero: dan Con r=0.68 p=9.3e-08, EAA r=0.76 p=4e-17, Z=-0.90 p1=0.18 p2=0.37 | unc Con r=0.36 p=0.012, EAA r=0.27 p=0.013, Z=0.52 p1=0.3 p2=0.6 | saf Con r=-0.27 p=0.061, EAA r=-0.25 p=0.02, Z=-0.11 p1=0.46 p2=0.91
c drop: dan Con r=0.69 p=7.1e-08, EAA r=0.76 p=7.1e-17, Z=-0.80 p1=0.21 p2=0.42 | unc Con r=0.36 p=0.011, EAA r=0.28 p=0.01, Z=0.51 p1=0.3 p2=0.61 | saf Con r=-0.26 p=0.07, EAA r=-0.25 p=0.022, Z=-0.09 p1=0.47 p2=0.93
c one : dan Con r=0.70 p=3.2e-08, EAA r=0.76 p=2.6e-17, Z=-0.76 p1=0.22 p2=0.45 | unc Con r=0.36 p=0.012, EAA r=0.27 p=0.012, Z=0.52 p1=0.3 p2=0.61 | saf Con r=-0.27 p=0.069, EAA r=-0.25 p=0.021, Z=-0.08 p1=0.47 p2=0.94
d zero: dan Con r=0.72 p=8.8e-09, EAA r=0.85 p=5.1e-24, Z=-1.80 p1=0.036 p2=0.072 | unc Con r=-0.02 p=0.87, EAA r=0.16 p=0.14, Z=-1.01 p1=0.16 p2=0.31 | saf Con r=-0.35 p=0.015, EAA r=-0.46 p=8.5e-06, Z=0.75 p1=0.23 p2=0.45
d drop: dan Con r=0.70 p=2.9e-08, EAA r=0.83 p=7.3e-23, Z=-1.78 p1=0.038 p2=0.075 | unc Con r=-0.05 p=0.75, EAA r=0.17 p=0.13, Z=-1.15 p1=0.12 p2=0.25 | saf Con r=-0.28 p=0.051, EAA r=-0.47 p=8.1e-06, Z=1.15 p1=0.13 p2=0.25
d one : dan Con r=0.73 p=3.8e-09, EAA r=0.84 p=8.5e-24, Z=-1.62 p1=0.052 p2=0.1 | unc Con r=0.00 p=0.98, EAA r=0.17 p=0.13, Z=-0.88 p1=0.19 p2=0.38 | saf Con r=-0.34 p=0.018, EAA r=-0.46 p=9.8e-06, Z=0.78 p1=0.22 p2=0.43
('a', 'zero') a cue with p < 0.05 in each group, no comparison one-tailed, none two-tailed: (True, True, True) ; comparisons one-tailed p [np.float64(0.5), np.float64(0.375), np.float64(0.141)] two-tailed [np.float64(0.999), np.float64(0.75), np.float64(0.281)]
('a', 'drop') a cue with p < 0.05 in each group, no comparison one-tailed, none two-tailed: (True, True, True) ; comparisons one-tailed p [np.float64(0.388), np.float64(0.309), np.float64(0.115)] two-tailed [np.float64(0.775), np.float64(0.618), np.float64(0.23)]
('a', 'one') a cue with p < 0.05 in each group, no comparison one-tailed, none two-tailed: (True, True, True) ; comparisons one-tailed p [np.float64(0.495), np.float64(0.339), np.float64(0.129)] two-tailed [np.float64(0.989), np.float64(0.679), np.float64(0.258)]
('b', 'zero') a cue with p < 0.05 in each group, no comparison one-tailed, none two-tailed: (True, True, True) ; comparisons one-tailed p [np.float64(0.104), np.float64(0.165), np.float64(0.205)] two-tailed [np.float64(0.208), np.float64(0.329), np.float64(0.41)]
('b', 'drop') a cue with p < 0.05 in each group, no comparison one-tailed, none two-tailed: (True, True, True) ; comparisons one-tailed p [np.float64(0.104), np.float64(0.137), np.float64(0.103)] two-tailed [np.float64(0.208), np.float64(0.274), np.float64(0.207)]
('b', 'one') a cue with p < 0.05 in each group, no comparison one-tailed, none two-tailed: (True, True, True) ; comparisons one-tailed p [np.float64(0.174), np.float64(0.221), np.float64(0.201)] two-tailed [np.float64(0.348), np.float64(0.442), np.float64(0.402)]
('c', 'zero') a cue with p < 0.05 in each group, no comparison one-tailed, none two-tailed: (True, True, True) ; comparisons one-tailed p [np.float64(0.184), np.float64(0.301), np.float64(0.457)] two-tailed [np.float64(0.369), np.float64(0.601), np.float64(0.913)]
('c', 'drop') a cue with p < 0.05 in each group, no comparison one-tailed, none two-tailed: (True, True, True) ; comparisons one-tailed p [np.float64(0.211), np.float64(0.304), np.float64(0.465)] two-tailed [np.float64(0.421), np.float64(0.608), np.float64(0.931)]
('c', 'one') a cue with p < 0.05 in each group, no comparison one-tailed, none two-tailed: (True, True, True) ; comparisons one-tailed p [np.float64(0.224), np.float64(0.303), np.float64(0.469)] two-tailed [np.float64(0.447), np.float64(0.606), np.float64(0.937)]
('d', 'zero') a cue with p < 0.05 in each group, no comparison one-tailed, none two-tailed: (True, False, True) ; comparisons one-tailed p [np.float64(0.036), np.float64(0.157), np.float64(0.227)] two-tailed [np.float64(0.072), np.float64(0.315), np.float64(0.454)]
('d', 'drop') a cue with p < 0.05 in each group, no comparison one-tailed, none two-tailed: (True, False, True) ; comparisons one-tailed p [np.float64(0.038), np.float64(0.125), np.float64(0.125)] two-tailed [np.float64(0.075), np.float64(0.249), np.float64(0.251)]
('d', 'one') a cue with p < 0.05 in each group, no comparison one-tailed, none two-tailed: (True, True, True) ; comparisons one-tailed p [np.float64(0.052), np.float64(0.189), np.float64(0.217)] two-tailed [np.float64(0.104), np.float64(0.378), np.float64(0.435)]

variant, the script's normalization, every regression reading
a zero: dan Con r=0.86 p=7.2e-15, EAA r=0.82 p=9e-22, Z=0.65 p1=0.26 p2=0.52 | unc Con r=0.19 p=0.2, EAA r=0.20 p=0.074, Z=-0.04 p1=0.49 p2=0.97 | saf Con r=-0.23 p=0.12, EAA r=-0.41 p=8.9e-05, Z=1.12 p1=0.13 p2=0.26
a drop: dan Con r=0.84 p=5.3e-14, EAA r=0.82 p=1.4e-21, Z=0.41 p1=0.34 p2=0.68 | unc Con r=0.17 p=0.26, EAA r=0.20 p=0.073, Z=-0.17 p1=0.43 p2=0.86 | saf Con r=-0.20 p=0.16, EAA r=-0.41 p=9.3e-05, Z=1.25 p1=0.11 p2=0.21
a one : dan Con r=0.86 p=5.2e-15, EAA r=0.82 p=6.2e-22, Z=0.66 p1=0.25 p2=0.51 | unc Con r=0.18 p=0.22, EAA r=0.20 p=0.074, Z=-0.09 p1=0.46 p2=0.93 | saf Con r=-0.21 p=0.15, EAA r=-0.41 p=0.00011, Z=1.18 p1=0.12 p2=0.24
b zero: dan Con r=0.77 p=1e-10, EAA r=0.80 p=3.5e-20, Z=-0.42 p1=0.34 p2=0.68 | unc Con r=0.12 p=0.43, EAA r=0.22 p=0.04, Z=-0.60 p1=0.27 p2=0.55 | saf Con r=-0.23 p=0.12, EAA r=-0.37 p=0.0005, Z=0.85 p1=0.2 p2=0.4
b drop: dan Con r=0.76 p=2.5e-10, EAA r=0.79 p=3.6e-19, Z=-0.35 p1=0.36 p2=0.72 | unc Con r=0.10 p=0.49, EAA r=0.22 p=0.04, Z=-0.68 p1=0.25 p2=0.5 | saf Con r=-0.15 p=0.31, EAA r=-0.37 p=0.00046, Z=1.30 p1=0.096 p2=0.19
b one : dan Con r=0.80 p=6.8e-12, EAA r=0.80 p=8.8e-20, Z=0.06 p1=0.48 p2=0.95 | unc Con r=0.16 p=0.27, EAA r=0.23 p=0.039, Z=-0.35 p1=0.36 p2=0.73 | saf Con r=-0.22 p=0.13, EAA r=-0.37 p=0.00055, Z=0.86 p1=0.19 p2=0.39
c zero: dan Con r=0.68 p=1e-07, EAA r=0.75 p=3e-16, Z=-0.74 p1=0.23 p2=0.46 | unc Con r=0.44 p=0.0018, EAA r=0.34 p=0.0018, Z=0.65 p1=0.26 p2=0.52 | saf Con r=-0.30 p=0.038, EAA r=-0.25 p=0.024, Z=-0.32 p1=0.38 p2=0.75
c drop: dan Con r=0.69 p=6.2e-08, EAA r=0.74 p=7.8e-16, Z=-0.57 p1=0.28 p2=0.57 | unc Con r=0.45 p=0.0013, EAA r=0.34 p=0.0017, Z=0.72 p1=0.24 p2=0.47 | saf Con r=-0.30 p=0.042, EAA r=-0.24 p=0.026, Z=-0.31 p1=0.38 p2=0.76
c one : dan Con r=0.70 p=3.5e-08, EAA r=0.75 p=2.3e-16, Z=-0.58 p1=0.28 p2=0.56 | unc Con r=0.45 p=0.0015, EAA r=0.34 p=0.0018, Z=0.70 p1=0.24 p2=0.48 | saf Con r=-0.29 p=0.043, EAA r=-0.24 p=0.026, Z=-0.29 p1=0.38 p2=0.77
d zero: dan Con r=0.76 p=4e-10, EAA r=0.83 p=6.3e-23, Z=-1.12 p1=0.13 p2=0.26 | unc Con r=0.13 p=0.37, EAA r=0.26 p=0.018, Z=-0.70 p1=0.24 p2=0.48 | saf Con r=-0.27 p=0.062, EAA r=-0.40 p=0.00014, Z=0.81 p1=0.21 p2=0.42
d drop: dan Con r=0.75 p=9e-10, EAA r=0.82 p=7.9e-22, Z=-1.05 p1=0.15 p2=0.3 | unc Con r=0.11 p=0.45, EAA r=0.26 p=0.018, Z=-0.81 p1=0.21 p2=0.42 | saf Con r=-0.20 p=0.17, EAA r=-0.41 p=0.00012, Z=1.24 p1=0.11 p2=0.22
d one : dan Con r=0.78 p=8.4e-11, EAA r=0.83 p=1.3e-22, Z=-0.83 p1=0.2 p2=0.41 | unc Con r=0.16 p=0.26, EAA r=0.26 p=0.017, Z=-0.54 p1=0.3 p2=0.59 | saf Con r=-0.26 p=0.07, EAA r=-0.40 p=0.00014, Z=0.85 p1=0.2 p2=0.4
('a', 'zero') (True, True, True) ; comparisons one-tailed p [np.float64(0.259), np.float64(0.485), np.float64(0.131)]
('a', 'drop') (True, True, True) ; comparisons one-tailed p [np.float64(0.341), np.float64(0.432), np.float64(0.106)]
('a', 'one') (True, True, True) ; comparisons one-tailed p [np.float64(0.255), np.float64(0.463), np.float64(0.119)]
('b', 'zero') (True, True, True) ; comparisons one-tailed p [np.float64(0.339), np.float64(0.274), np.float64(0.199)]
('b', 'drop') (True, True, True) ; comparisons one-tailed p [np.float64(0.362), np.float64(0.248), np.float64(0.096)]
('b', 'one') (True, True, True) ; comparisons one-tailed p [np.float64(0.476), np.float64(0.364), np.float64(0.194)]
('c', 'zero') (True, True, True) ; comparisons one-tailed p [np.float64(0.229), np.float64(0.258), np.float64(0.376)]
('c', 'drop') (True, True, True) ; comparisons one-tailed p [np.float64(0.283), np.float64(0.237), np.float64(0.38)]
('c', 'one') (True, True, True) ; comparisons one-tailed p [np.float64(0.279), np.float64(0.241), np.float64(0.385)]
('d', 'zero') (True, True, True) ; comparisons one-tailed p [np.float64(0.131), np.float64(0.241), np.float64(0.209)]
('d', 'drop') (True, True, True) ; comparisons one-tailed p [np.float64(0.148), np.float64(0.209), np.float64(0.108)]
('d', 'one') (True, True, True) ; comparisons one-tailed p [np.float64(0.203), np.float64(0.296), np.float64(0.198)]

Result: reproduced. Under the adopted reading danger firing predicts the threat probability beta in both groups (r = 0.73 and 0.84) and no comparison is significant (smallest p 0.052 one-tailed, 0.10 two-tailed). Under the script's firing with 0/0 trials set to 0 or dropped, the danger comparison is significant one-tailed (p = 0.036 and 0.038) but not two-tailed; under readings (a) to (c) no comparison is significant. With the script's normalization every part holds under all twelve readings (smallest one-tailed comparison p 0.096).

The design that is not of full rank¶

One cue-inhibited neuron (section Neurons in the regressions) comes from a session in which the rat never poked during a cue, so with 0/0 trials set to 1 or dropped its suppression ratio is 1 on every trial and equals the constant. numpy.linalg.lstsq then returns the minimum-norm betas, which split the constant between the two columns; Matlab regress, which the authors' script uses, sets the fear output beta to 0. Below, the adopted reading is re-run with Matlab's solution (pag2.regress_betas(..., basic=True)) for the claims that use cue-inhibited neurons.

In [29]:
rd_idx = [j for j in np.where(resp)[0] if not full_rank(U[j], "one")]
BM = {ADOPTED: tuple(a.copy() for a in BETAS[ADOPTED])}
for j in rd_idx:
    fo, tp = pag2.interval_betas(U[j], ADOPTED[0], ADOPTED[1], cube_z=ZS1[:, :, j], basic=True)
    print(U[j]["name"], grp[j], lab[j], "fear output betas, minimum norm:", BETAS[ADOPTED][0][j].round(2), "Matlab:", fo.round(2))
    BM[ADOPTED][0][j], BM[ADOPTED][1][j] = fo, tp
print("\nfig5efg-inhibited-fear-output, Matlab solution:"); fig5efg(BM)
BM05 = {ADOPTED: tuple(a.copy() for a in B05[ADOPTED])}
for j in rd_idx:
    BM05[ADOPTED][0][j], BM05[ADOPTED][1][j] = pag2.interval_betas(U[j], ADOPTED[0], ADOPTED[1], 0.5, ZS1[:, :, j], basic=True)
x375, x5 = s4(BM)[ADOPTED][1], s4(BM05)[ADOPTED][1]
print(f"figs4-peak-assignment-same-pattern, inh last-5 s FO, Matlab solution: 0.375 t = {x375.statistic:.2f} p = {x375.pvalue:.3f} | 0.5 t = {x5.statistic:.2f} p = {x5.pvalue:.3f}")
print("\nfig7-inhibited-firing-fear-output, Matlab solution:")
v = corr_table("inh", "last5", "FO", LAST, readings=[ADOPTED], B=BM)[ADOPTED]
print("   parts", {k: bool(x) for k, x in judge7(v).items()})
print("   script's normalization:", {k: bool(x) for k, x in judge7(corr_table("inh", "last5", "FO", LAST, F_all=NFc, readings=[ADOPTED], B=BM, show=False)[ADOPTED]).items()})
print("\nfigs6-inhibited-firing-threat-probability, Matlab solution:")
v = corr_table("inh", "last5", "TP", LAST, readings=[ADOPTED], B=BM)[ADOPTED]
print("   ", judge_s6(v), "; comparisons one-tailed p", [round(v[ty]["z"][1], 3) for ty in v])
mh38101617epr38bSPK05a EAA inh fear output betas, minimum norm: [ 0.19  0.05 -0.07 -0.18 -0.15 -0.17 -0.22 -0.17 -0.17 -0.22] Matlab: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]

fig5efg-inhibited-fear-output, Matlab solution:
d one : group x regressor x interval F(9,1170) = 2.14, p = 0.024; last 5 s FO Con -0.220 EAA -0.384 t = 2.30 p = 0.023; TP t = -0.82 p = 0.412 -> reproduced
figs4-peak-assignment-same-pattern, inh last-5 s FO, Matlab solution: 0.375 t = 2.30 p = 0.023 | 0.5 t = 2.56 p = 0.012

fig7-inhibited-firing-fear-output, Matlab solution:
d one : dan Con r=0.28 p=0.054, EAA r=0.16 p=0.14, Z=0.67 p1=0.25 p2=0.5 | unc Con r=0.71 p=1.2e-08, EAA r=0.47 p=5.7e-06, Z=2.05 p1=0.02 p2=0.04 | saf Con r=-0.32 p=0.026, EAA r=-0.31 p=0.0037, Z=-0.04 p1=0.48 p2=0.97
   parts {'danger': True, 'uncertainty': False, 'safety': True, 'comparisons': False}
   script's normalization: {'danger': True, 'uncertainty': False, 'safety': True, 'comparisons': True}

figs6-inhibited-firing-threat-probability, Matlab solution:
d one : dan Con r=0.73 p=3.8e-09, EAA r=0.84 p=8.5e-24, Z=-1.62 p1=0.052 p2=0.1 | unc Con r=0.00 p=0.98, EAA r=0.17 p=0.13, Z=-0.88 p1=0.19 p2=0.38 | saf Con r=-0.34 p=0.018, EAA r=-0.46 p=9.8e-06, Z=0.78 p1=0.22 p2=0.43
    (True, True, True) ; comparisons one-tailed p [np.float64(0.052), np.float64(0.189), np.float64(0.217)]

With Matlab's solution the neuron's fear output betas are 0 in every interval. Fig. 5E to G gives F(9,1170) = 2.14, p = 0.024, last-5 s fear output t = 2.30, p = 0.023 and threat p = 0.41 (against 2.15, 0.021 and 0.41); the Fig. S4 cue-inhibited test has p = 0.023 and 0.012 with 0.375 and 0.5; the parts of Fig. 7 that hold are the same under both normalizations, and Fig. S6 holds (smallest one-tailed comparison p = 0.052). No outcome changes.

Summary¶

Claim Outcome
fig1bc-adversity-slows-weight-gain blocked, data missing
fig1ef-acquisition-equivalent-final blocked, data missing
fig2b-baseline-poke-equivalent reproduced
fig2c-recording-discrimination reproduced
fig2d-cue-responsive-counts reproduced
fig2d-higher-proportion-responsive reproduced
fig2ef-baseline-firing reproduced
fig4ab-excited-temporal-pattern partially reproduced (bregma part not testable)
fig4c-excited-inflated-onset reproduced
fig4de-inhibited-temporal-pattern partially reproduced (bregma part not testable)
fig4f-inhibited-danger-decrease reproduced
fig4f-inhibited-danger-uncertainty-discrimination reproduced
fig5abc-excited-reduced-threat-probability partially reproduced
fig5d-threat-tuning-curve reproduced (assumption)
figs4-peak-assignment-same-pattern reproduced
fig5efg-inhibited-fear-output reproduced
fig6-excited-firing-threat-decoupled partially reproduced
figs5-excited-firing-fear-output-unrelated reproduced
fig7-inhibited-firing-fear-output not reproduced
figs6-inhibited-firing-threat-probability reproduced

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

How the analysis differs from the paper's: the selection uses the cube's stored rates, truncated to whole Hz, as the authors' script does (with exact rates the Control inhibited count is 54, not 48); the regressions are run under twelve readings of the trial-wise firing and of trials without pokes, and every regression claim is judged under one of them, the script's own (d, 0/0 trials set to 1), which also gives the paper's statistics most closely; the outcome of Fig. 5D rests on it, as the claims file's readings give a different outcome, while those of Figs. 5A to C and S4 are the same under the claims file's readings; the ANOVAs with bregma level could not be run; the ANOVAs and t tests use all selected neurons, so several error degrees of freedom are larger than the paper's (for example 79 against 65 for the cue-excited regression ANOVA). The population analyses follow the Methods' normalization, as the claims file fixes it; the authors' script instead averages the cube's trial-wise Z scores, and with that the statistics of Figs. 4C, 4F and 6 are the paper's to the second digit, and Fig. 6 would be reproduced. The paper's Fig. 7 statistics follow from firing over the first 5 s of the cue with the script's normalization and the adopted regression reading, where its legend says the last 5 s; with the last 5 s, as the claims file has it, Fig. 7 is not reproduced. The paper's smaller degrees of freedom for several tests are not explained by trials without pokes, missing betas or any step in the script. One cue-inhibited neuron has a design not of full rank; the regressions give it minimum-norm betas where Matlab regress gives a fear output beta of 0, and with Matlab's solution no outcome changes.

What was found about the data set: the units come from 182 sessions (74 Control, 108 EAA), not the stated 179; group membership and the event codes are documented only in the script (the codes change meaning with the behaviour program); the cube stores firing rates truncated to integers; poke.base is the 20 s baseline in pokes per minute, not the 2 s the description states; trials without pokes are stored with a suppression ratio of 1; the description gives the uncertainty shock probability as 0.25; there is no bregma level per rat, no body weight and no pre-surgery session.