main
John Lauer
Advance Board32 through current acceptance and retain unresolved thermal gate
1f15473
"""Publish quantitative screening plots from recorded Fields outputs, not hardware data."""
from pathlib import Path
import json,hashlib
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap,LogNorm
from matplotlib.cm import ScalarMappable
R=Path(__file__).resolve().parents[1];D=R/'checkpoints/board32-fields/full-0p1';p=json.loads((D/'fields.json').read_text())
plt.rcParams.update({'figure.facecolor':'#101923','axes.facecolor':'#101923','text.color':'#edf3f8','axes.labelcolor':'#edf3f8','xtick.color':'#b8cad9','ytick.color':'#b8cad9','font.size':14})
cmap=LinearSegmentedColormap.from_list('fields-inferno',[[.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=plt.figure(figsize=(19.2,10.8),dpi=100);a=fig.add_axes([.04,.2,.29,.65]);b=fig.add_axes([.35,.2,.29,.65]);c=fig.add_axes([.76,.31,.21,.44])
for ax,layer in [(a,'F_Cu'),(b,'B_Cu')]:
ax.imshow(plt.imread(D/'tex'/f'J-{layer}.png'));ax.set_title('Front copper' if layer=='F_Cu' else 'Back copper · viewed from top');ax.axis('off')
nets=sorted(p['nets'],key=lambda x:x['net']);c.barh([n['net'] for n in nets],[n['peakJ'] for n in nets],color='#58d5c5');c.axvline(60,color='#ffb77b',linestyle='--');c.set_xlim(0,65);c.set_xlabel('Unclipped peak (A/mm²)');c.set_title('All six current screens pass',fontsize=15)
for i,n in enumerate(nets):c.text(n['peakJ']+.7,i,f"{n['peakJ']:.2f}",va='center',fontsize=11)
hi=p['scales']['jHi'];bar=fig.colorbar(ScalarMappable(norm=LogNorm(hi/300,hi),cmap=cmap),cax=fig.add_axes([.10,.14,.57,.022]),orientation='horizontal');bar.set_label('Display current density (A/mm²), logarithmic; saturated near 50')
fig.text(.05,.93,'Board32 · current carried through the saved copper',fontsize=27)
fig.text(.05,.045,'0.1 mm grid · assumed 35 µm surface copper / 25 µm plating · 3 A main-path screen, 0.3 A auxiliary\nTexture display is clipped; acceptance uses the unclipped peaks at right. Fabricator copper and hardware remain unqualified.',fontsize=15)
fig.savefig(R/'aiflow/run/timeline/board32-current-screen.png');plt.close(fig)
report={'fieldsSha256':hashlib.sha256((D/'fields.json').read_bytes()).hexdigest(),'inputIdentity':p['inputIdentity'],'displayLimitAperMm2':hi,'unclippedPeaks':{n['net']:n['peakJ'] for n in nets},'status':'engineering-screen-not-hardware-qualification'}
(R/'checkpoints/board32-fields/plot-review.json').write_text(json.dumps(report,indent=2)+'\n')