main
John Lauer Publish compact v5 electrical checks and six captioned progression review scenes; cooling acceptance remains open ca514b5
"""Draw solved current textures and separate, unclipped acceptance maxima."""
from pathlib import Path
import json,matplotlib,sys
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap,Normalize
from matplotlib.cm import ScalarMappable
R=Path(__file__).resolve().parents[1];D=R/(sys.argv[1] if len(sys.argv)>1 else 'revisions/compact-r11/fields-board-only-p01')
j=json.loads((D/'fields.json').read_text())
plt.style.use('dark_background');fig=plt.figure(figsize=(19.2,10.8),dpi=100);fig.patch.set_facecolor('#101923')
for left,layer,label in [(.04,'F_Cu','Front copper'),(.37,'B_Cu','Back copper, viewed from top')]:
    ax=fig.add_axes([left,.22,.30,.62]);ax.imshow(plt.imread(D/'tex'/f'J-{layer}.png'));ax.axis('off');ax.set_title(label)
cmap=LinearSegmentedColormap.from_list('fields',[[.001,0,.014],[.16,.04,.33],[.38,.09,.44],[.59,.19,.38],[.79,.30,.26],[.93,.47,.11],[.98,.68,.06],[.97,.87,.30],[.99,1,.64]])
fig.colorbar(ScalarMappable(norm=Normalize(0,j['scales']['jHi']),cmap=cmap),cax=fig.add_axes([.10,.15,.52,.025]),orientation='horizontal',label='Current density (A/mm²); display saturates at 50')
fig.text(.04,.92,'Compact R11 · saved-board filled-copper current screen',fontsize=28)
fig.text(.73,.77,'Unclipped maxima',fontsize=21)
fig.text(.73,.48,'\n'.join(f"{n['net']:<12} {n['peakJ']:5.2f} A/mm²" for n in j['nets']),fontsize=17,fontfamily='monospace',linespacing=1.8)
fig.text(.73,.31,'6 nets converged\n0.1 mm grid · 2 layers · 1 oz\n0.5 A auxiliary allowance',fontsize=17,linespacing=1.7)
fig.text(.04,.05,'AIFlow current screen passed. Explicit terminal and barrel assumptions apply.\nThis is not a cooler analysis, measured current distribution or manufacturing qualification.',fontsize=16)
out=R/(sys.argv[2] if len(sys.argv)>2 else 'revisions/compact-r11/evidence/current-p01-review.png');fig.savefig(out);plt.close(fig);print(out)