50 lines
4.8 KiB
Python
50 lines
4.8 KiB
Python
"""Present preregistered results without modifying any scientific choice."""
|
||
from pathlib import Path
|
||
import json
|
||
|
||
root=Path('/data/digital-drosophila/experiments/phase4t-timing-stability')
|
||
a=json.loads((root/'audit/summary.json').read_text())
|
||
r=json.loads((root/'validation/summary.json').read_text())
|
||
p=json.loads((root/'protocol/preregistered.json').read_text())
|
||
names={x['odor_id']:x['odor_name'] for x in p['odors']}
|
||
lines=['# Phase 4T — 时序稳定性诊断与独立验证','',f"正式实验状态:`{r['status']}`",'',
|
||
'## P0:旧事件诊断','',
|
||
'20 条 Phase 4S 序列均精确复现原 matched/random credit。3 个零 credit 均为目标 KC 首次活动晚于 US,不是全程无目标活动。','',
|
||
'| seed | 首次目标 KC 放电 ms | 全程目标 active KC | 全程覆盖目标边数 |',
|
||
'|---|---:|---:|---:|']
|
||
for x in a['zero_credit_trials']:
|
||
lines.append(f"| {x['seed']} | {x['first_target_ms']:.1f} | {x['target_active_KC']} | {x['edges_covered_any_time']} |")
|
||
lines+=['','原 US=20 ms;3 个失败种子都没有 US 前目标 KC 放电。提前奖励与首次目标活动错位解释零 credit,但没有确立上游时序波动的生物学原因。','',
|
||
'## P1:新预注册实验','',
|
||
'只改候选时序选择准则,不改 frozen brain、输入强度、DAN 强度、学习幅度或 14,232-edge mask。依旧测试原有 8 个 US 时点与 6 个窗口。',
|
||
'选择目标:校准气味中最差的第 20 百分位 matched/random ratio 最大;相同分数才选更短窗口和更早 US。每气味 20 seeds,至少 16/20 ratio≥3 且均值比≥3。',
|
||
'验证分为同气味新 seeds 和未参与本轮 timing selection 的 4 个气味。后者此前出现在 Phase 4L,不是从未研究过的全新数据。']
|
||
if r['calibration']:
|
||
c=r['calibration'];lines+=['',f"冻结选择:US={c['US_ms']} ms,window={c['window_ms']} ms,tau={c['tau_ms']:.6f} ms。"]
|
||
for key,title in [('calibration','校准'),('seed_validation','同气味独立 seeds'),('odor_validation','跨气味验证')]:
|
||
g=r[key]
|
||
if g:
|
||
lines+=['',f'### {title}','','| 气味 | 达标 seeds | matched/random 均值比 | q20 比值 | 零 credit | 通过 |',
|
||
'|---|---:|---:|---:|---:|---|']
|
||
for x in g['odors']:
|
||
lines.append(f"| {names[x['odor_id']]} | {x['qualifying']}/{x['n']} | {x['ratio_of_means']:.4f} | {x['q20_ratio']:.4f} | {x['zero_credit']} | {x['pass']} |")
|
||
lines+=['','## 门槛与后续','',f"Timing gate:{r['timing_gate_pass']}。",f"五组 frozen reference:{r['frozen_reference_pass']}。",
|
||
f"Live-US 对照:{r.get('live_controls_pass','未运行')};整脑重复:{r.get('repeats_pass','未运行')}。",
|
||
f"下一门槛:{r['next_gate']}。",'','本轮没有训练权重、没有 formal A/B credit 累积、没有游戏或动作 decoder。',
|
||
'时间 credit 优于随机,不等于刺激特异记忆;只在独立 gate 通过后才能继续分组 plasticity 和 isolated/whole-brain 功能传递。',
|
||
'单元测试中 D=0、unrelated-compartment、far-timing 为代数控制,不冒充生理模拟。US/KC 同步平移 18 步验证相对时间,未改动 delay。',
|
||
'历史 integrity 最终结果见 audit/frozen-integrity.json。本报告在封存前生成;全部产物以 checksums.sha256 为准。']
|
||
diag=json.loads((root/'validation/descriptive-event-diagnosis.json').read_text())
|
||
lines+=['','## 验证失败的事后事件描述(不用于重新选参数)','',
|
||
'| 气味 | seed | ratio | 首次目标活动 ms | gate active KC | US 后事件比例 |',
|
||
'|---|---:|---:|---:|---:|---:|']
|
||
for x in diag['low_ratio_trials']:
|
||
lines.append(f"| {x['odor_name']} | {x['seed']} | {x['ratio']:.4f} | {x['first_target_ms']:.1f} | {x['gate_active_KC']} | {x['fraction_target_events_after_US']:.2%} |")
|
||
perf=json.loads((root/'performance/summary.json').read_text())
|
||
lines+=['','ethyl 3-hydroxyhexanoate 的 7 个未达标种子,在 US 前 gate 仅有 2–12 个目标 KC 激活,84.3%–97.5% 的目标放电在 US 后发生。固定时点的跨气味覆盖仍不足;不能据此反向授予 future credit。',
|
||
'另一气味有 1 个零 credit 种子首次目标活动在 29.0 ms。总体通过门槛不表示逐试次零失败。',
|
||
'',f"运行耗时(不含编译):{perf['wall_seconds_excluding_build']:.2f} s;PyTorch peak allocated VRAM:{perf['peak_VRAM_bytes']/2**20:.2f} MiB。GPU utilization 未采样。",'',
|
||
'额外异常记录:底层冻结加载器出现 NumPy 只读数组转张量提示;此轮未改其源码,完整回归与输入 checksum 用于验证未改写。审计初次 JSON 导出因缺失时刻的 NaN 停止,已修复为 null;无模型运行结果变更。']
|
||
(root/'REPORT.md').write_text('\n'.join(lines)+'\n',encoding='utf-8')
|
||
print('\n'.join(lines))
|