Files
MeltMind/tools/greif_census/csv.py
T
ClaudeandClaude Opus 5.5 628a10bad3 docs: Claude design-state record and Greif v5 census tools
Consolidated MeltMind design decisions, S1 result review and Drive index;
stdlib-only ZIP range-read census (624 logs) with SHA256SUMS. Review
material only; not for main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 08:52:20 +00:00

9 lines
763 B
Python

import sys,os,struct,zlib,re
d=sys.argv[1]; print('file_stem,group_key,part_nodes,elements,volume_m3,inj_pressure_vp_Pa,vol_filled_vp_pct')
for f in sorted(os.listdir(d)):
b=open(os.path.join(d,f),'rb').read(); nl,el=struct.unpack('<HH',b[26:30])
t=zlib.decompressobj(-15).decompress(b[30+nl+el:]).decode('latin1')
g=lambda p:(lambda m:m.group(1) if m else '')(re.search(p,t))
s=f[:-8] if f.endswith('.log.bin') else f
print(','.join([s,s.split('_')[1],g(r'Total number of part nodes\s*=\s*(\d+)'),g(r'Total number of elements\s*=\s*(\d+)'),g(r'Volume of tetrahedral elements\s*=\s*([\dE.+-]+)'),g(r'Injection pressure at velocity/pressure switch-over\s*=\s*([\dE.+-]+)'),g(r'Volume filled at velocity/pressure switch-over\s*=\s*([\d.]+)')]))