Skip to main content

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 .maa file

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

genuy-0.1.2.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

genuy-0.1.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file genuy-0.1.2.tar.gz.

File metadata

  • Download URL: genuy-0.1.2.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

Hashes for genuy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fc739afc832988717bd8dacc4f8cf8594eecc34d1eefe1d7d963e83adb2cedae
MD5 02ca8e1287e683c501da2b8bcef7f9b2
BLAKE2b-256 82613351a6efdfed5b37f1953c4152eec64dfb377c49f3a1d510d49cdf618c3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for genuy-0.1.2.tar.gz:

Publisher: publish.yml on r2axz/genuy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file genuy-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: genuy-0.1.2-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

Hashes for genuy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 51d4589b6b5d14c8f83c9b06f5baf4d6415357b74f8c7634eca0fe75500d6fce
MD5 8f2c2bc2c9921ec52646e6535990cf67
BLAKE2b-256 a2f3ce899017d2625de6c6af43d05ff232d203b76b108e0f89a7904449470e67

See more details on using hashes here.

Provenance

The following attestation bundles were made for genuy-0.1.2-py3-none-any.whl:

Publisher: publish.yml on r2axz/genuy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page