master
John Lauer Publish thermal bottleneck planner, accepted candidate, analysis and native recording scripts 0049da5 29d ago
import json,numpy as np
from pathlib import Path
import matplotlib;matplotlib.use('Agg')
import matplotlib.pyplot as plt
P=Path(__file__).resolve().parent;E=P/'edit';E.mkdir(exist_ok=True);C=P/'candidate-01';r=json.loads((C/'comparison.json').read_text())
plt.rcParams.update({'figure.facecolor':'#101925','axes.facecolor':'#101925','text.color':'white','axes.labelcolor':'white','xtick.color':'white','ytick.color':'white','axes.edgecolor':'#647887','font.size':12})
fig,axes=plt.subplots(2,2,figsize=(12,7),gridspec_kw={'height_ratios':[2,1]})
for i,key in enumerate(['before','after']):
 z=np.load(C/(key+'-VAC1.npz'));ext=z['extent'];im=axes[0,i].imshow(z['temperatureRiseC']+25,origin='lower',extent=ext,cmap='inferno',vmin=25,vmax=65);axes[0,i].set_title('VAC1 '+('before: obstructed copper' if key=='before' else 'after: trace moved inside'));axes[0,i].set_aspect('equal');axes[0,i].set_xlabel('mm')
fig.colorbar(im,ax=list(axes[0]),label='Calculated copper temperature (°C)',shrink=.7)
ax=axes[1,0];nets=['VAC1','VBUS','VAC2'];x=np.arange(3)
ax.bar(x-.18,[r['before'][n]['bottomHeatW']*1000 for n in nets],.36,label='before',color='#7d91a2');ax.bar(x+.18,[r['after'][n]['bottomHeatW']*1000 for n in nets],.36,label='after',color='#50c9d6');ax.set_xticks(x,nets);ax.set_ylabel('Bottom heat flow (mW)');ax.legend(facecolor='#101925',labelcolor='white',fontsize=9)
ax=axes[1,1];ax.axis('off');ax.text(0,.9,'ESTIMATE — same boundary conditions\n65°C source / 25°C ambient\n35 µm copper; h = 5 W/m²K; mask ε = 0.8\nPackage, vias, other layers and enclosure omitted\nNot a junction-temperature or board-power rating',va='top',linespacing=1.5,fontsize=11)
fig.subplots_adjust(left=.07,right=.85,bottom=.08,top=.94,hspace=.45,wspace=.30);fig.savefig(E/'heat.png',dpi=130)