skill
EDA Skillpack
Public Made by Adomby adom
All skills for all EDA capabilities across the Adom ecosystem.
main
from pathlib import Path
import sys,pickle
D=Path(__file__).resolve().parent;sys.path.insert(0,str(D/'vendor'))
import numpy as np,matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
G=pickle.load(open(D/'copper.pkl','rb'))
fig,axs=plt.subplots(1,2,figsize=(12,8),sharex=True,sharey=True)
z=np.load(D/'dc-vbat-Q1-0.1-0.025.npz' if (D/'dc-vbat-Q1-0.1-0.025.npz').exists() else D/'dc-vbat-Q1-0.1.npz');heat=z['heatWPerA2'];x=z['x'];y=z['y']
for ax,l,idx in zip(axs,['F.Cu','B.Cu'],[0,3]):
g=G['copper']['+VBAT',l]
for p in ([g] if g.geom_type=='Polygon' else g.geoms):
a=np.asarray(p.exterior.coords);ax.fill(a[:,0],a[:,1],color='#ddd')
for ring in p.interiors:
a=np.asarray(ring.coords);ax.fill(a[:,0],a[:,1],color='white')
q=heat[idx]/.1**2
im=ax.imshow(np.ma.masked_less(q,1e-9),extent=[x[0]-.05,x[-1]+.05,y[-1]+.05,y[0]-.05],norm=LogNorm(1e-8,1e-3),cmap='inferno',alpha=.9,zorder=3)
for ref in ['MC1.1','Q1.5','Q3.5','Q5.5']:
p=next(p for p in G['pads'] if p['name']==ref);ax.plot(p['x'],p['y'],'o',ms=3,color='blue');ax.annotate(ref,(p['x'],p['y']),xytext=(4,4),textcoords='offset points',fontsize=8,color='blue')
ax.set(xlim=(104,168),ylim=(132,58),aspect='equal',title=l,xlabel='x (mm)');ax.grid(alpha=.2)
axs[0].set_ylabel('y (mm)');fig.colorbar(im,ax=axs,shrink=.6,label='Modeled Joule loss density (W/mm² at 1 A)')
fig.suptitle('Astra ESC: +VBAT input to Q1 drain\nNative refilled copper, 0.10 mm DC mesh, 20°C assumed; not a temperature map')
fig.savefig(D/'vbat-q1-loss.png',dpi=160)