molecule
AFS_Adom flight computer molecule
Public Unreviewedby ae007
Active fin stabilization flight computer for a sounding rocket, a clean-room AI redesign of the Rice Eclipse AFS board: RP2350B, ICM-45686, KX134-1211, MMC5983MA, MS5611, TMP117, INA219A, 8 servos, 2S LiPo, USB-C; 4-layer Adom molecule, designed end to end by Claude through KiCad and adom-aiflow
main
ae007
Project page: AFS_Adom rev A (Rice Eclipse AFS clean-room AI redesign): highlight reel and narrated process video with…
cbe460e
7d ago
"""Tiny dependency-free SVG line plotter for the simulation results."""
def plot(path, title, xlabel, ylabel, series, w=960, h=480):
"""series: list of (name, xs, ys)."""
m = {'l': 70, 'r': 20, 't': 40, 'b': 50}
xs_all = [x for _, xs, _ in series for x in xs]; ys_all = [y for _, _, ys in series for y in ys]
x0, x1 = min(xs_all), max(xs_all); y0, y1 = min(ys_all), max(ys_all)
if y1 == y0: y1 = y0 + 1
if x1 == x0: x1 = x0 + 1
pad = (y1 - y0) * 0.05; y0 -= pad; y1 += pad
def X(x): return m['l'] + (x - x0) / (x1 - x0) * (w - m['l'] - m['r'])
def Y(y): return h - m['b'] - (y - y0) / (y1 - y0) * (h - m['t'] - m['b'])
colors = ['#1f77b4', '#d62728', '#2ca02c', '#ff7f0e', '#9467bd', '#8c564b']
out = [f'<svg xmlns="http://www.w3.org/2000/svg" width="{w}" height="{h}" font-family="Arial" font-size="12">',
f'<rect width="{w}" height="{h}" fill="white"/>', f'<text x="{w/2}" y="22" text-anchor="middle" font-size="14" font-weight="bold">{title}</text>']
for k in range(6):
gy = y0 + (y1 - y0) * k / 5; gx = x0 + (x1 - x0) * k / 5
out.append(f'<line x1="{m["l"]}" y1="{Y(gy):.1f}" x2="{w-m["r"]}" y2="{Y(gy):.1f}" stroke="#ddd"/>')
out.append(f'<text x="{m["l"]-6}" y="{Y(gy)+4:.1f}" text-anchor="end">{gy:.3g}</text>')
out.append(f'<line x1="{X(gx):.1f}" y1="{m["t"]}" x2="{X(gx):.1f}" y2="{h-m["b"]}" stroke="#ddd"/>')
out.append(f'<text x="{X(gx):.1f}" y="{h-m["b"]+16}" text-anchor="middle">{gx:.3g}</text>')
out.append(f'<rect x="{m["l"]}" y="{m["t"]}" width="{w-m["l"]-m["r"]}" height="{h-m["t"]-m["b"]}" fill="none" stroke="#333"/>')
out.append(f'<text x="{w/2}" y="{h-8}" text-anchor="middle">{xlabel}</text>')
out.append(f'<text x="14" y="{h/2}" text-anchor="middle" transform="rotate(-90 14 {h/2})">{ylabel}</text>')
for i, (name, xs, ys) in enumerate(series):
step = max(1, len(xs) // 4000)
pts = ' '.join(f'{X(x):.1f},{Y(y):.1f}' for x, y in list(zip(xs, ys))[::step])
out.append(f'<polyline points="{pts}" fill="none" stroke="{colors[i % 6]}" stroke-width="1.3"/>')
out.append(f'<rect x="{w-m["r"]-150}" y="{m["t"]+8+16*i}" width="12" height="3" fill="{colors[i % 6]}"/><text x="{w-m["r"]-132}" y="{m["t"]+14+16*i}">{name}</text>')
out.append('</svg>'); open(path, 'w').write('\n'.join(out))