Spaces:
Running
Running
Deploy Xfly/C3L comparison GUI
Browse files
library/ngspice/studies/xfly6s_xfly8s_c3l_scaled_comparison/gui/xfly_compare_gui.py
CHANGED
|
@@ -338,6 +338,55 @@ HTML = r"""<!doctype html>
|
|
| 338 |
padding: 30px;
|
| 339 |
text-align: center;
|
| 340 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
table {
|
| 342 |
width: 100%;
|
| 343 |
border-collapse: collapse;
|
|
@@ -569,6 +618,30 @@ HTML = r"""<!doctype html>
|
|
| 569 |
metricsTable.hidden = false;
|
| 570 |
}
|
| 571 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 572 |
form.addEventListener('submit', async (event) => {
|
| 573 |
event.preventDefault();
|
| 574 |
const topologies = [...form.querySelectorAll('input[name="topology"]:checked')].map(x => x.value);
|
|
@@ -599,7 +672,7 @@ HTML = r"""<!doctype html>
|
|
| 599 |
|
| 600 |
runButton.disabled = true;
|
| 601 |
statusEl.textContent = 'Running ngspice...';
|
| 602 |
-
|
| 603 |
try {
|
| 604 |
const response = await fetch('/api/run', {
|
| 605 |
method: 'POST',
|
|
@@ -616,6 +689,7 @@ HTML = r"""<!doctype html>
|
|
| 616 |
statusEl.innerHTML = `<span class="error">${error.message}</span>`;
|
| 617 |
plotWrap.innerHTML = `<div class="placeholder error">${error.message}</div>`;
|
| 618 |
} finally {
|
|
|
|
| 619 |
runButton.disabled = false;
|
| 620 |
}
|
| 621 |
});
|
|
|
|
| 338 |
padding: 30px;
|
| 339 |
text-align: center;
|
| 340 |
}
|
| 341 |
+
.progress-card {
|
| 342 |
+
width: min(520px, calc(100% - 44px));
|
| 343 |
+
display: grid;
|
| 344 |
+
gap: 14px;
|
| 345 |
+
padding: 28px;
|
| 346 |
+
color: var(--ink);
|
| 347 |
+
text-align: left;
|
| 348 |
+
}
|
| 349 |
+
.progress-title {
|
| 350 |
+
display: flex;
|
| 351 |
+
align-items: baseline;
|
| 352 |
+
justify-content: space-between;
|
| 353 |
+
gap: 14px;
|
| 354 |
+
font-size: 14px;
|
| 355 |
+
font-weight: 720;
|
| 356 |
+
}
|
| 357 |
+
.progress-title span {
|
| 358 |
+
color: var(--muted);
|
| 359 |
+
font-size: 12px;
|
| 360 |
+
font-weight: 650;
|
| 361 |
+
font-variant-numeric: tabular-nums;
|
| 362 |
+
white-space: nowrap;
|
| 363 |
+
}
|
| 364 |
+
.progress-track {
|
| 365 |
+
position: relative;
|
| 366 |
+
height: 10px;
|
| 367 |
+
overflow: hidden;
|
| 368 |
+
border-radius: 999px;
|
| 369 |
+
background: #dfe7ec;
|
| 370 |
+
}
|
| 371 |
+
.progress-track::before {
|
| 372 |
+
content: "";
|
| 373 |
+
position: absolute;
|
| 374 |
+
inset: 0;
|
| 375 |
+
width: 42%;
|
| 376 |
+
border-radius: inherit;
|
| 377 |
+
background: linear-gradient(90deg, var(--blue), #14b8a6);
|
| 378 |
+
animation: progress-slide 1.1s ease-in-out infinite;
|
| 379 |
+
}
|
| 380 |
+
.progress-meta {
|
| 381 |
+
color: var(--muted);
|
| 382 |
+
font-size: 13px;
|
| 383 |
+
line-height: 1.45;
|
| 384 |
+
}
|
| 385 |
+
@keyframes progress-slide {
|
| 386 |
+
0% { transform: translateX(-105%); }
|
| 387 |
+
50% { transform: translateX(70%); }
|
| 388 |
+
100% { transform: translateX(245%); }
|
| 389 |
+
}
|
| 390 |
table {
|
| 391 |
width: 100%;
|
| 392 |
border-collapse: collapse;
|
|
|
|
| 618 |
metricsTable.hidden = false;
|
| 619 |
}
|
| 620 |
|
| 621 |
+
function showProgress(topologies) {
|
| 622 |
+
const started = Date.now();
|
| 623 |
+
metricsTable.hidden = true;
|
| 624 |
+
const labels = {xfly6s: 'Xfly6S', xfly8s: 'Xfly8S', c3l: 'C3L'};
|
| 625 |
+
const topologyText = topologies.map(key => labels[key] || key).join(' / ');
|
| 626 |
+
plotWrap.innerHTML = `
|
| 627 |
+
<div class="progress-card" role="status" aria-live="polite">
|
| 628 |
+
<div class="progress-title">
|
| 629 |
+
<strong>Running NGSpice</strong>
|
| 630 |
+
<span id="elapsedTime">0.0 s</span>
|
| 631 |
+
</div>
|
| 632 |
+
<div class="progress-track" aria-hidden="true"></div>
|
| 633 |
+
<div class="progress-meta">Simulating ${topologyText}</div>
|
| 634 |
+
</div>
|
| 635 |
+
`;
|
| 636 |
+
const elapsedEl = document.getElementById('elapsedTime');
|
| 637 |
+
const timer = window.setInterval(() => {
|
| 638 |
+
const elapsed = (Date.now() - started) / 1000;
|
| 639 |
+
elapsedEl.textContent = `${elapsed.toFixed(1)} s`;
|
| 640 |
+
statusEl.textContent = `Running ngspice... ${elapsed.toFixed(1)} s`;
|
| 641 |
+
}, 100);
|
| 642 |
+
return () => window.clearInterval(timer);
|
| 643 |
+
}
|
| 644 |
+
|
| 645 |
form.addEventListener('submit', async (event) => {
|
| 646 |
event.preventDefault();
|
| 647 |
const topologies = [...form.querySelectorAll('input[name="topology"]:checked')].map(x => x.value);
|
|
|
|
| 672 |
|
| 673 |
runButton.disabled = true;
|
| 674 |
statusEl.textContent = 'Running ngspice...';
|
| 675 |
+
const stopProgress = showProgress(topologies);
|
| 676 |
try {
|
| 677 |
const response = await fetch('/api/run', {
|
| 678 |
method: 'POST',
|
|
|
|
| 689 |
statusEl.innerHTML = `<span class="error">${error.message}</span>`;
|
| 690 |
plotWrap.innerHTML = `<div class="placeholder error">${error.message}</div>`;
|
| 691 |
} finally {
|
| 692 |
+
stopProgress();
|
| 693 |
runButton.disabled = false;
|
| 694 |
}
|
| 695 |
});
|