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
Antenna parameters
| Option | Default | Description |
|---|---|---|
-n, --num-elements |
4 |
Number of elements (reflector+driven+directors) |
-f, --frequency |
145.0 |
Centre frequency, MHz |
-b, --bandwidth |
10.0 |
Optimization bandwidth, MHz |
-r, --element-radius |
3.0 |
Element radius, mm |
-z, --reference-impedance |
50+0j |
Reference impedance for VSWR, Ω |
GA and output parameters
| Option | Default | Description |
|---|---|---|
--num-generations |
200 |
Maximum GA generations |
--num-solutions |
0 (auto: 10×genes) |
Population size |
--percent-mating |
10.0 |
% of population selected as parents |
--mutation-percent-max |
40.0 |
Max gene mutation % (adaptive) |
--mutation-percent-min |
20.0 |
Min gene mutation % (adaptive) |
--vswr-punish-early |
(off) | Return penalty on first bad-VSWR frequency |
--seed |
(random) | Random seed; printed so runs are reproducible |
--save-maa |
(none) | Save best solution as MMANA .maa file |
--plot-fitness |
(off) | Plot fitness vs. generation after run |
Run genuy --help for the full option list.
Per-element constraints
Use --constrain-length and --constrain-spacing to narrow the search space
for individual elements. Elements and spacings are numbered starting from 1.
Both options are repeatable.
# Fix element 1 (reflector) length range tightly, leave others free
genuy -n 5 -f 145 -b 10 --constrain-length 1 0.51 0.53
# Constrain spacing between elements 2 and 3
genuy -n 5 -f 145 -b 10 --constrain-spacing 2 0.10 0.15
# Multiple constraints
genuy -n 5 -f 145 -b 10 \
--constrain-length 1 0.51 0.53 \
--constrain-length 2 0.47 0.49 \
--constrain-spacing 1 0.12 0.18
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
Reproduce a previous run using a saved seed:
genuy -n 4 -f 145 -b 10 --seed 1234567890 --save-maa antenna.maa
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=3.0, fb_weight=1.0,
boom_length_weight=1.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.6.tar.gz.
File metadata
- Download URL: genuy-0.1.6.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70cd9a95b021e616f7827acbc824720a0034c8329f3953ca94608b7c16f1b0a8
|
|
| MD5 |
4d4745d79eed21659a9b36ca81c7e23e
|
|
| BLAKE2b-256 |
bafc2c1eb0356fd4d9864cb627591b3872325c4020d1ba3b9e91262fe832a85a
|
Provenance
The following attestation bundles were made for genuy-0.1.6.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.6.tar.gz -
Subject digest:
70cd9a95b021e616f7827acbc824720a0034c8329f3953ca94608b7c16f1b0a8 - Sigstore transparency entry: 1252491349
- Sigstore integration time:
-
Permalink:
r2axz/genuy@0a9df0e7a76e9ec64bfcd590dbca79c123556e06 -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/r2axz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0a9df0e7a76e9ec64bfcd590dbca79c123556e06 -
Trigger Event:
push
-
Statement type:
File details
Details for the file genuy-0.1.6-py3-none-any.whl.
File metadata
- Download URL: genuy-0.1.6-py3-none-any.whl
- Upload date:
- Size: 8.7 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 |
6d7d81e1cca235ea546c499f79a8799e117983ec04aa0c36ba307bc0652c03ea
|
|
| MD5 |
432612cad472c5a4e77e46e48ab49536
|
|
| BLAKE2b-256 |
8c7938e8feb5af3a7b9378ebad3389252f869ffac35e64ad3e72964c90dc1f1f
|
Provenance
The following attestation bundles were made for genuy-0.1.6-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.6-py3-none-any.whl -
Subject digest:
6d7d81e1cca235ea546c499f79a8799e117983ec04aa0c36ba307bc0652c03ea - Sigstore transparency entry: 1252491353
- Sigstore integration time:
-
Permalink:
r2axz/genuy@0a9df0e7a76e9ec64bfcd590dbca79c123556e06 -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/r2axz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0a9df0e7a76e9ec64bfcd590dbca79c123556e06 -
Trigger Event:
push
-
Statement type: