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 1000 Maximum number of GA generations
--num-solutions 100 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 1000 --num-solutions 150 --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.1.tar.gz (6.5 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.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: genuy-0.1.1.tar.gz
  • Upload date:
  • Size: 6.5 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.1.tar.gz
Algorithm Hash digest
SHA256 830f57348e1292d9d24230249b341fbbbf49ac2a6b7cc3319eec8214ae82bc04
MD5 484db7df8e6f26bcfcce96cd4b1d4b64
BLAKE2b-256 02f3ebc02e44e0206921094e75938bd1ca447a2c59e19ba189e1eddb0fbf7f9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for genuy-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: genuy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 41a97df463322da399788f35b79929900a90cf6491ec3f4da28fed72f80e1b94
MD5 f6cbde18a8dda378be4030847639dade
BLAKE2b-256 2ec4a86ba2c829c41e4a964f378c077e222ad66fbe5634056e99dc352156a357

See more details on using hashes here.

Provenance

The following attestation bundles were made for genuy-0.1.1-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