30 lines
1.6 KiB
Python
30 lines
1.6 KiB
Python
"""Copy only new small sealed evidence into Git; never copy bulk datasets."""
|
|
import json
|
|
from pathlib import Path
|
|
import shutil
|
|
import sys
|
|
|
|
ROOT = Path('/data/digital-drosophila'); MODEL = ROOT/'models/male-cns-lif/terminal-scope-diagnostic-v1'
|
|
EXP = ROOT/'experiments/phase4ab-terminal-scope'
|
|
sys.path.insert(0, str(MODEL))
|
|
import diagnostic
|
|
_, _, _, _, save, digest, _, _ = diagnostic.load_context()
|
|
for folder in (MODEL, EXP):
|
|
assert diagnostic.manifest_check(folder, digest)['pass']
|
|
registry = ROOT/'registry/phase4ab-terminal-scope'; registry.mkdir(exist_ok=False)
|
|
records = []
|
|
for p in sorted(EXP.rglob('*')):
|
|
if not p.is_file() or p.suffix not in ('.json', '.csv', '.md', '.sha256') or p.stat().st_size > 4*1024**2:
|
|
continue
|
|
dst = registry/'evidence'/p.relative_to(EXP); dst.parent.mkdir(parents=True, exist_ok=True)
|
|
with p.open('rb') as src, dst.open('xb') as out: shutil.copyfileobj(src, out)
|
|
assert digest(p) == digest(dst)
|
|
records.append({'source': str(p.relative_to(ROOT)), 'copy': str(dst.relative_to(registry)),
|
|
'sha256': digest(p), 'bytes': p.stat().st_size})
|
|
save(registry/'evidence-index.json', records)
|
|
save(registry/'seal-verification.json', {str(p.relative_to(ROOT)): diagnostic.manifest_check(p, digest) for p in (MODEL, EXP)})
|
|
for source, dest in [('INTERPRETATION.zh.md', 'phase4ab-terminal-scope.md'), ('REPORT.md', 'phase4ab-technical-results.md')]:
|
|
target = ROOT/'docs/progress'/dest
|
|
with (EXP/source).open('rb') as src, target.open('xb') as out: shutil.copyfileobj(src, out)
|
|
print('Published', len(records), 'small evidence copies; no data copied to Git')
|