[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-80900":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":14,"forks30d":14,"starsTrendScore":18,"compositeScore":19,"rankGlobal":9,"rankLanguage":9,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":9,"pushedAt":9,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":14,"starSnapshotCount":14,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},80900,"antenna-forge","1ove9\u002Fantenna-forge","1ove9","AI-driven inverse antenna design with real NEC2 + openEMS in the loop. Try the live in-browser playground.",null,"Python",174,28,16,0,5,71,140,33,4.39,"MIT License",false,"main",[],"2026-06-12 02:04:08","# ⚡ Source Sequence Antenna Forge (YAF)\n\n[English](README.md) | [中文](README.zh-CN.md)\n\n**AI-driven antenna invention platform** — automatic exploration, generation,\noptimization, and verification of antenna topologies that did not exist before.\n\n## Quick Demo — one command, a real simulation figure\n\nThe PNG below is produced by `scripts\u002Fdemo_wow.py`. **Every number on it comes\nfrom a real NEC2 run** (Method of Moments via the `necpp` Python binding) —\nno mock, no analytical fallback, and if `necpp` is missing the solver raises\n`SolverUnavailable` rather than fabricating output. Reproduce it with one\ncommand:\n\n```bash\npython3 scripts\u002Fdemo_wow.py    # → docs\u002Fassets\u002Fdipole_demo.png\n```\n\n![Dipole real-NEC2 demo](docs\u002Fassets\u002Fdipole_demo.png)\n\nThe three panels are: (1) input impedance R(f) \u002F X(f) with the resonance\npoint (X → 0) marked, (2) E-plane polar radiation pattern with the measured\npeak gain of 2.13 dBi, and (3) S11(f) \u002F VSWR(f) with the −10 dB bandwidth\nshaded. The annotation box gives the field-by-field \"measured vs. textbook\"\ncomparison (textbook half-wave dipole reference: R ≈ 73 Ω, G ≈ 2.15 dBi).\n\nClosed-loop inverse design — putting real NEC2 inside the optimizer:\n\n```bash\npython3 scripts\u002Fdemo_inverse_design.py    # → docs\u002Fassets\u002Finverse_design_convergence.png\n```\n\n![Inverse-design convergence](docs\u002Fassets\u002Finverse_design_convergence.png)\n\nGolden-section search over the dipole length, 14 iterations \u002F **16 real NEC2\nsolver calls \u002F ~6 ms** wall time, converges from a ±75 mm bracket down to\n**L = 477.892 mm** (≈ 0.478 λ at 300 MHz), with R = 71.85 Ω, X = +0.03 Ω,\nG = 2.13 dBi — i.e. the optimizer rediscovers the textbook thin-wire\nresonant length to sub-millimeter precision with no antenna theory baked\ninto the objective.\n\n### Headline case study — 9-parameter Yagi-Uda inverse design\n\nThe platform's flagship demonstration: a 5-element Yagi-Uda at 300 MHz with\n**9 continuous design parameters** (5 element lengths + 4 inter-element\nspacings), driven by `scipy.optimize.differential_evolution` and evaluated\nby **real NEC2 in every single iteration** — 5858 solver calls, 12.7 s wall\ntime on a laptop. Full write-up:\n[`docs\u002Fcase_study_yagi.md`](docs\u002Fcase_study_yagi.md).\n\n```bash\npython3 scripts\u002Fcase_yagi.py     # baseline + optimization → JSON in results\u002F\npython3 scripts\u002Fplot_yagi.py     # → docs\u002Fassets\u002Fyagi_design.png\n```\n\n![Yagi-Uda inverse design](docs\u002Fassets\u002Fyagi_design.png)\n\n**Clean 5-vs-5 contest (same element count, same NEC2 backend):**\n\n| Quantity | Viezbicke 5-elem (NBS TN 688) | YAF AI 5-elem | Δ |\n|---|---|---|---|\n| Forward gain G_fwd | +11.03 dBi | **+12.63 dBi** | **+1.60 dB** |\n| Front-to-back F\u002FB | 13.79 dB | **15.00 dB** | **+1.21 dB** |\n| Boom length | 1.00 λ | 1.17 λ | +0.17 λ |\n| Element count | 5 | 5 | 0 (clean attribution) |\n\n**The AI design Pareto-dominates the canonical Viezbicke 5-element\nreference on both gain *and* F\u002FB simultaneously**, with the same number\nof elements. Across the broader published 5-element design space\n(Viezbicke, ARRL Handbook, DL6WU, Lawson\u002FCebik) the AI strictly\ndominates 3 of 4 on both axes (see `docs\u002Fcase_study_yagi.md` §6).\n\nThe optimizer *independently* recovers Viezbicke-style director tapering\n(L: 0.440 → 0.434 → 0.429 m, monotonically decreasing rear-to-front) and\na balanced 0.243 λ reflector spacing — both consistent with published\n5-element Yagi recipes — without being told anything about antenna design.\nThe \"AI\" part of the loop is just differential evolution; the unique\nplatform contribution is *what it's optimizing against*: real\nMethod-of-Moments physics, not a surrogate or analytical model.\n\n> *Bonus: the 5858-record DE history (`results\u002Fyagi_optimized.json`) is a\n> free FNO-surrogate training set — every input geometry and output\n> (R, X, G_fwd, G_back, F\u002FB) is recorded, ready for whoever wants to try\n> active-learning DE in a later phase.*\n\n## Architecture\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│  Web UI (React + Three.js + WebGPU)                             │\n│  3D editor │ Design browser │ Experiment tracking │ Live monitor│\n└────────────────────────┬────────────────────────────────────────┘\n                         │ REST \u002F WebSocket\n┌────────────────────────▼────────────────────────────────────────┐\n│  API Gateway (FastAPI + Pydantic)                               │\n└────────────────────────┬────────────────────────────────────────┘\n                         │\n┌────────────────────────▼────────────────────────────────────────┐\n│  Orchestration Core (Python asyncio + Celery)                   │\n└─────┬────────────┬───────────┬─────────────┬──────────────┬─────┘\n      │            │           │             │              │\n┌──────────┐  ┌────────┐  ┌─────────┐  ┌───────────┐  ┌───────────┐\n│ Geometry │  │ AI     │  │ Solver  │  │ Optimizer │  │ Post-proc │\n│ Kernel   │  │ Engine │  │ Adapter │  │ Engine    │  │ Analyzer  │\n└──────────┘  └────────┘  └─────────┘  └───────────┘  └───────────┘\n```\n\n## Quick start\n\n```bash\n# Clone the project\ngit clone https:\u002F\u002Fgithub.com\u002F1ove9\u002Fantenna-forge.git yaf && cd yaf\n\n# Copy the env template\ncp .env.example .env\n\n# Start all services\ndocker compose up -d\n\n# Health check\ncurl http:\u002F\u002Flocalhost:8000\u002Fhealth\n# → {\"status\": \"ok\", \"version\": \"0.1.0\"}\n\n# Open the frontend\nopen http:\u002F\u002Flocalhost:5173\n```\n\n## Core modules\n\n| Module | Path | Description |\n|--------|------|-------------|\n| Domain models | `yaf_core\u002Fdomain\u002F` | Design, Geometry, Simulation, Optimization |\n| Port protocols | `yaf_core\u002Fports\u002F` | SolverAdapter, AIBackend, CADBackend |\n| Geometry kernel | `yaf_core\u002Fgeometry\u002F` | OpenCASCADE, parametric generators, SIREN, topology optimization |\n| Physics models | `yaf_core\u002Fphysics\u002F` | Metasurfaces, RIS, OAM, graphene, space-time modulation |\n| Solvers | `yaf_solvers\u002F` | openEMS, NEC2, MEEP, HFSS, CST, FEKO |\n| AI engine | `yaf_ai\u002F` | Diffusion, VAE, GAN, FNO, PINN, differentiable FDTD, Bayesian optimization |\n| API service | `yaf_api\u002F` | FastAPI + WebSocket |\n| Task queue | `yaf_worker\u002F` | Celery + Redis |\n| Database | `yaf_db\u002F` | PostgreSQL + Qdrant |\n| Frontend | `frontend\u002F` | React 18 + Three.js + TypeScript |\n\n## API quick start\n\n```bash\n# Create a design\ncurl -X POST http:\u002F\u002Flocalhost:8000\u002Fapi\u002Fv1\u002Fdesigns \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"name\": \"test_dipole\",\n    \"frequency_range\": [2.4e9, 2.5e9],\n    \"size_constraint\": {\"x_min\": -0.1, \"x_max\": 0.1, \"y_min\": -0.1, \"y_max\": 0.1, \"z_min\": -0.1, \"z_max\": 0.1},\n    \"polarization\": \"linear\",\n    \"material_palette\": [\"copper\"]\n  }'\n\n# Simulate with NEC2\ncurl -X POST http:\u002F\u002Flocalhost:8000\u002Fapi\u002Fv1\u002Fsimulations \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"design_id\": \"\u003Cdesign-uuid>\", \"solver\": \"nec2\", \"frequency_min\": 2400000000, \"frequency_max\": 2500000000}'\n```\n\n## AI demos\n\n```bash\n# Differentiable FDTD gradient optimization\npython -m yaf_ai.differentiable.diff_fdtd_jax --demo\n\n# VAE antenna-geometry generation (--epochs 2 already triggers a weight save; 20 is the default convergence run)\npython -m yaf_ai.generative.vae_designer --train --epochs 20\n\n# Bayesian optimization\npython -m yaf_ai.optimization.bayesian --demo\n\n# End-to-end inverse-design pipeline\npython -m yaf_ai.inverse_design.pipeline --demo\n\n# End-to-end half-wave dipole example (NEC2 → S11 + gain)\npython scripts\u002Fdemo_dipole.py\n```\n\n> See `docs\u002FHONEST_STATUS.md`: **neither solver fabricates results.** NEC2\n> (`necpp`) and openEMS both run real solvers and raise `SolverUnavailable`\n> when their backend is missing — there is no silent analytical fallback on\n> either path.\n\n## Acceptance commands\n\nThe project's acceptance commands: 6 core commands (infrastructure, tests,\ndifferentiable FDTD, generative models, demo) plus the real-NEC2 truth checks\nand the Yagi case-study demo. The repository currently passes all of the below:\n\n```bash\n# 1. Infrastructure boot\ndocker compose up -d                                          # postgres \u002F redis \u002F minio \u002F qdrant \u002F api\n\n# 2. API health check\ncurl -fsS http:\u002F\u002Flocalhost:8000\u002Fhealth                        # → 200 {\"status\":\"ok\",\"version\":\"0.1.0\"}\n\n# 3. Test suite (includes real-NEC2 half-wave dipole assertion)\npytest tests\u002F -x -q                                           # → all passed\n\n# 4. Differentiable FDTD — gradient flow proof\npython -m yaf_ai.differentiable.diff_fdtd_jax --demo          # → \"✓ Gradient flow verified\" + monotone loss\n\n# 5. VAE training + weights checkpoint\npython -m yaf_ai.generative.vae_designer --train --epochs 2   # → models\u002Fvae_designer.pt written\n\n# 6. Dipole demo — S11 + gain (real NEC2)\npython scripts\u002Fdemo_dipole.py                                 # → S11\u002FVSWR\u002FPeak gain printed (2.20 dBi)\n\n# 7. NEC2 truth check vs textbook\npython3 scripts\u002Fverify_dipole.py                              # → PASS: R=68.30 Ω (err 6.4%), G=2.12 dBi\n\n# 8. openEMS truth check — real full-wave FDTD vs cavity model\npython3 scripts\u002Fverify_patch.py                               # → PASS: f_res 2.435 GHz vs 2.513 GHz (err 3.1%)\n\n# 9. 3-panel showcase PNG (Z sweep \u002F polar pattern \u002F S11+BW)\npython3 scripts\u002Fdemo_wow.py                                   # → docs\u002Fassets\u002Fdipole_demo.png\n\n# 10. Closed-loop inverse design (real NEC2 in the loop)\npython3 scripts\u002Fdemo_inverse_design.py                        # → 477.89 mm + inverse_design_convergence.png\n\n# 11. Yagi-Uda case study — 9-param DE × real NEC2\npython3 scripts\u002Fcase_yagi.py                                  # → baselines + opt JSON, +1.60 dB Pareto-dominant vs Viezbicke\npython3 scripts\u002Fplot_yagi.py                                  # → docs\u002Fassets\u002Fyagi_design.png\n\n# Static type check\nmypy yaf_core yaf_ai yaf_solvers --strict                     # → Success: no issues in 64 source files\n```\n\nA per-command credibility annotation lives in `docs\u002FHONEST_STATUS.md`\n(revised 2026-05-25); \"what's still missing once everything is green\" is in\n`docs\u002Fnext-steps.md`; the full Yagi case-study walkthrough is in\n`docs\u002Fcase_study_yagi.md`.\n\n## Tech stack\n\n| Layer | Technology |\n|-------|------------|\n| Backend | Python 3.11, FastAPI, Pydantic v2 |\n| Differentiable | JAX, Flax, Optax |\n| Deep learning | PyTorch 2.x |\n| Geometry | pythonocc-core, trimesh, gmsh |\n| Task queue | Celery + Redis |\n| Database | PostgreSQL 16, Qdrant (vector) |\n| Object storage | MinIO (S3-compatible) |\n| Frontend | React 18, TypeScript, Vite, Three.js |\n| Deployment | Docker Compose (dev), Kubernetes (prod) |\n\n\n## License\n\nYAF source code is distributed under the **MIT License** — see\n[`LICENSE`](LICENSE).\n\n**Third-party dependencies carry their own licenses, some of them\ncopyleft.** In particular, the optional `necpp` Method-of-Moments\nbackend and the `openEMS` \u002F `CSXCAD` FDTD backend are GPL-licensed.\nYAF does not bundle or redistribute any of them; users install\nthem separately and assume the combined-work obligations that may\nresult. See [`NOTICE`](NOTICE) for the full license-boundary\ndiscussion and mitigations for downstream redistributors. This is\nprovided in good faith and is not legal advice.\n\n\n## Open-core model\n\nYAF follows an **open-core** model. This repository is the **core engine**:\nfree, self-hostable, and MIT-licensed. It covers **wire antennas** (NEC2\nMethod-of-Moments) and **planar \u002F patch antennas** (openEMS full-wave FDTD),\ndriven by **classical optimization** (differential evolution \u002F golden-section\nsearch), and it is complete and useful on its own for that scope.\n\n**Available now in this open-source core**\n\n- Wire-antenna simulation with real NEC2 Method-of-Moments via `necpp` — no\n  analytical fallback (missing solver raises rather than fabricates).\n- Full-wave FDTD simulation with real openEMS (`openEMS` \u002F `CSXCAD` Python\n  bindings): builds the CSX structure, runs the time-domain solve, and extracts\n  S11 \u002F input impedance from the port and the gain pattern via NF2FF. Same\n  honesty rule — missing bindings raise `SolverUnavailable`, never fabricate.\n- Classical optimization with the real solver inside every iteration:\n  half-wave dipole resonance search and the 9-parameter Yagi-Uda inverse\n  design.\n- Known-answer truth checks and reproducible benchmarks: half-wave dipole\n  (`scripts\u002Fverify_dipole.py`, NEC2) and a rectangular microstrip patch\n  (`scripts\u002Fverify_patch.py`, openEMS — simulated resonance within 3.1 % of the\n  cavity-model prediction). See also `docs\u002Fcase_study_yagi.md`.\n- FastAPI service, Pydantic domain models, and the solver \u002F AI adapter\n  interfaces.\n\nSource Sequence maintains a separate **enhanced edition** — a hosted \u002F\ncommercial product with an embedded web platform — for professional and\ncommercial users. To set expectations honestly, the capabilities below are\n**planned \u002F on the roadmap; they are *not yet shipped*, in either the\nopen-source core or the enhanced edition.**\n\n**Planned \u002F on the roadmap (not yet available)**\n\n- Broader full-wave coverage — microstrip arrays, metasurfaces, and full 3-D\n  structures, plus commercial solvers (HFSS \u002F CST \u002F FEKO \u002F COMSOL). *(The\n  openEMS FDTD backend is real and validated on a single patch-antenna\n  truth check today; wider geometry coverage and the commercial-solver\n  adapters are still on the roadmap — see `docs\u002FHONEST_STATUS.md`.)*\n- Generative AI geometry design (diffusion \u002F VAE) connected to a real physics\n  oracle. *(These generative models exist in the repo today only as\n  **early \u002F experimental** code: trained on synthetic geometry, not yet wired\n  into a simulation loop. They are not production-ready.)*\n- Multi-objective, multi-band joint optimization.\n- RIS (reconfigurable intelligent surface) inverse design.\n- In-browser visual design platform.\n- Cloud compute — run designs without installing a solver locally.\n- Team collaboration and design version management.\n\nIn short: **the open-source core lets you validate the method and reproduce\nthe benchmarks; the enhanced edition is aimed at taking that into real\nengineering projects.** Nothing on the roadmap above is implied to work today.\n\n- A commercial enhanced edition is in development; details will be announced.\n- For commercial inquiries, please open a GitHub issue for now.\n\n\n## Acknowledgements\n\nThis project was built by a single engineer, using AI coding assistants\nto help with implementation. The architecture, the physics-validation\nmethodology (the real-NEC2 truth checks and known-answer regressions),\nand the benchmark design (the 5-vs-5 Yagi comparison and the honesty\ntiers in `docs\u002FHONEST_STATUS.md`) are my own. Where a module's design is\ninformed by an open-source project, that project is cited at the top of\nthe file and in `NOTICE`.\n","Source Sequence Antenna Forge (YAF) 是一个基于AI的天线设计平台，能够自动探索、生成、优化并验证前所未有的天线拓扑结构。其核心功能包括通过集成真实NEC2仿真器实现闭环反向设计，确保所有输出数据均来自实际计算而非模拟或理论值。该平台特别适合需要高精度和创新性的天线设计场景，如无线通信系统开发等。使用Python编写，并采用MIT许可证开源发布。",2,"2026-06-06 04:03:55","CREATED_QUERY"]