A genetic algorithm optimization based Uda-Yagi antenna generator,
Project description
genuy
A genetic algorithm-based Uda-Yagi antenna optimizer. Uses PyGAD as the GA engine and pymininec for antenna simulation to evolve element lengths and spacings that maximise gain, front-to-back ratio, and VSWR across a specified bandwidth.
Features
- Optimizes reflector, driven element, and an arbitrary number of director elements
- Evaluates fitness across the full bandwidth (low edge, centre, high edge) to avoid narrow-band solutions
- Adaptive mutation and tournament selection for robust multimodal search
- Parallel fitness evaluation using all available CPU cores
- Exports the best solution as an MMANA-GAL
.maafile
Requirements
Installation
pip install genuy
Or from source:
git clone https://github.com/r2axz/genuy
cd genuy
pip install .
Usage
genuy [OPTIONS]
Key options
| Option | Default | Description |
|---|---|---|
-n, --num-elements |
4 |
Total number of elements (reflector + driven + directors) |
-f, --frequency |
145.0 MHz |
Target centre frequency |
-b, --bandwidth |
10.0 MHz |
Bandwidth over which to optimise |
-r, --element-radius |
3.0 mm |
Physical radius of all elements |
-z, --reference-impedance |
50+0j Ω |
Reference impedance for VSWR calculation |
--num-generations |
200 |
Maximum number of GA generations |
--num-solutions |
0 (auto: 10 × num genes) |
Population size |
--percent-mating |
10.0 |
Percentage of population selected as parents |
--save-maa |
(none) | Save best solution to an MMANA .maa file |
--plot-fitness |
(off) | Plot fitness vs. generation after the run |
Run genuy --help for the full list of options including element length bounds,
spacing bounds, mutation rates, VSWR penalty settings, and wire segmentation.
Examples
Optimize a 4-element 145 MHz antenna and save the result:
genuy -n 4 -f 145 -b 10 --save-maa antenna.maa
Optimize a 6-element antenna, plot convergence, and save:
genuy -n 6 -f 145 -b 10 --num-generations 500 --save-maa 6el.maa --plot-fitness
Fitness function
Each candidate solution is evaluated at three frequencies — lower band edge, centre, and upper band edge. The fitness score is:
$$F = \begin{cases} \dfrac{w_\text{vswr}}{\text{VSWR}\text{worst}} + w\text{gain} \cdot G_\text{worst} + w_\text{fb} \cdot \text{FB}\text{worst} & \text{if } \text{VSWR}\text{worst} < \text{threshold} \ p_\text{vswr} + w_\text{gain} \cdot G_\text{worst} + w_\text{fb} \cdot \text{FB}_\text{worst} & \text{otherwise} \end{cases}$$
Default weights: vswr_weight=100, gain_weight=1.0, fb_weight=2.0. The hard
VSWR penalty (high_vswr_penalty=-100) discourages solutions that are badly
mismatched anywhere in the band.
Output
After the run the best solution is printed to stdout:
Best solution : [0.512 0.18 0.474 0.15 0.452 0.19 0.438]
Best solution fitness : 47.23
VSWR : 1.34
Impedance : (42.1+3.2j)
Gain : 10.8
Front-to-Back Ratio : 18.4
License
MIT — see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file genuy-0.1.3.tar.gz.
File metadata
- Download URL: genuy-0.1.3.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
559bc2702fc5f2a51d695d800a32ee1eca8d031a0ba3ecf6214f536542b0de0a
|
|
| MD5 |
65ee8a580bc9124dd2400b3399c4b38d
|
|
| BLAKE2b-256 |
720d3c037b5fbb486a55e87b7af603ff61fa5228b4dfbea54d849ac8120536af
|
Provenance
The following attestation bundles were made for genuy-0.1.3.tar.gz:
Publisher:
publish.yml on r2axz/genuy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
genuy-0.1.3.tar.gz -
Subject digest:
559bc2702fc5f2a51d695d800a32ee1eca8d031a0ba3ecf6214f536542b0de0a - Sigstore transparency entry: 1243634223
- Sigstore integration time:
-
Permalink:
r2axz/genuy@d3d8212c10e91840dbaafead072f38d155e46f76 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/r2axz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d3d8212c10e91840dbaafead072f38d155e46f76 -
Trigger Event:
push
-
Statement type:
File details
Details for the file genuy-0.1.3-py3-none-any.whl.
File metadata
- Download URL: genuy-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2a8854f7b6866bd117bd22ebdcf0e7acf754083416c7d445effbe389bdf2672
|
|
| MD5 |
7d0c960848ad15c0c12cf4809b47b204
|
|
| BLAKE2b-256 |
47b7031ea2308d1be285bd29d289f8fef53afd356f6c4add52aa3a2ff5147ee5
|
Provenance
The following attestation bundles were made for genuy-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on r2axz/genuy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
genuy-0.1.3-py3-none-any.whl -
Subject digest:
b2a8854f7b6866bd117bd22ebdcf0e7acf754083416c7d445effbe389bdf2672 - Sigstore transparency entry: 1243634228
- Sigstore integration time:
-
Permalink:
r2axz/genuy@d3d8212c10e91840dbaafead072f38d155e46f76 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/r2axz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d3d8212c10e91840dbaafead072f38d155e46f76 -
Trigger Event:
push
-
Statement type: