# superdarncanada/genetic-array architecture

> Architecture diagram of the GitHub repository superdarncanada/genetic-array, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/superdarncanada/genetic-array
- Repository: https://github.com/superdarncanada/genetic-array

## Overview

genetic-array computes wide-beam antenna weight configurations, then evaluates and plots their radiation patterns and analyzes receiver-beam pointing corrections. The main workflow is NEC pattern preparation, batch optimization, configuration selection, and correction analysis. The graph reflects the sampled calls and README workflow; some correction-analysis internals and unsampled module details are not fully visible, so uncertain links are omitted.

Main entry points: [`batch_genetic_solver.py`](https://github.com/superdarncanada/genetic-array/blob/main/batch_genetic_solver.py) (Batch optimizer), [`beam_corrections.py`](https://github.com/superdarncanada/genetic-array/blob/main/beam_corrections.py) (Beam correction analysis), [`array_factor.py`](https://github.com/superdarncanada/genetic-array/blob/main/array_factor.py) (Array-factor tools), [`reading_nec.py`](https://github.com/superdarncanada/genetic-array/blob/main/reading_nec.py) (NEC converter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Pattern preparation"]
  node_nec["NEC converter<br/>[reading_nec.py]"]
  node_pattern["Antenna pattern"]
end

subgraph group_optimization["Beam optimization"]
  node_batch["Batch optimizer"]
  node_solver["Genetic solver<br/>[genetic_solver.py]"]
  node_factor["Array-factor tools<br/>[array_factor.py]"]
  node_plotting["Plot utilities<br/>[plotting.py]"]
  node_results["Optimization results"]
end

subgraph group_analysis["Correction analysis"]
  node_cached["Cached weights"]
  node_corrections["Beam correction analysis"]
  node_correction_plots["Correction plots"]
end

node_operator(("Array engineer"))

node_operator -->|"converts NEC data"| node_nec
node_nec -->|"writes pattern"| node_pattern
node_operator -->|"runs optimization"| node_batch
node_pattern -->|"supplies pattern"| node_batch
node_batch -->|"creates solver"| node_solver
node_batch -->|"computes factors"| node_factor
node_batch -->|"uses tick tools"| node_plotting
node_factor -->|"uses formatters"| node_plotting
node_batch -->|"writes HDF5 and plots"| node_results
node_operator -->|"copies selected phases"| node_cached
node_cached -->|"provides weights"| node_corrections
node_corrections -->|"uses directivity tools"| node_factor
node_corrections -->|"generates plots"| node_correction_plots
node_corrections -->|"reports beam directions"| node_operator

click node_nec "https://github.com/superdarncanada/genetic-array/blob/main/reading_nec.py"
click node_pattern "https://github.com/superdarncanada/genetic-array/blob/main/antenna_factor_12000khz.npz"
click node_batch "https://github.com/superdarncanada/genetic-array/blob/main/batch_genetic_solver.py"
click node_solver "https://github.com/superdarncanada/genetic-array/blob/main/genetic_solver.py"
click node_factor "https://github.com/superdarncanada/genetic-array/blob/main/array_factor.py"
click node_plotting "https://github.com/superdarncanada/genetic-array/blob/main/plotting.py"
click node_cached "https://github.com/superdarncanada/genetic-array/blob/main/beam_corrections.py"
click node_corrections "https://github.com/superdarncanada/genetic-array/blob/main/beam_corrections.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_nec,node_pattern toneBlue
class node_batch,node_solver,node_factor,node_plotting,node_results toneAmber
class node_cached,node_corrections,node_correction_plots toneMint
class node_operator toneIndigo
```

## Components

### Pattern preparation

- [NEC converter](https://github.com/superdarncanada/genetic-array/blob/main/reading_nec.py): `reading_nec.py`
- [Antenna pattern](https://github.com/superdarncanada/genetic-array/blob/main/antenna_factor_12000khz.npz): `antenna_factor_12000khz.npz`

### Beam optimization

- [Batch optimizer](https://github.com/superdarncanada/genetic-array/blob/main/batch_genetic_solver.py): `batch_genetic_solver.py`
- [Genetic solver](https://github.com/superdarncanada/genetic-array/blob/main/genetic_solver.py): `genetic_solver.py`
- [Array-factor tools](https://github.com/superdarncanada/genetic-array/blob/main/array_factor.py): `array_factor.py`
- [Plot utilities](https://github.com/superdarncanada/genetic-array/blob/main/plotting.py): `plotting.py`
- **Optimization results**

### Correction analysis

- [Cached weights](https://github.com/superdarncanada/genetic-array/blob/main/beam_corrections.py): `beam_corrections.py`
- [Beam correction analysis](https://github.com/superdarncanada/genetic-array/blob/main/beam_corrections.py): `beam_corrections.py`
- **Correction plots**

### Other components

- **Array engineer**

## Connections

- Array engineer → NEC converter: converts NEC data (evidence: `README.md`)
- NEC converter → Antenna pattern: writes pattern (evidence: `reading_nec.py`)
- Array engineer → Batch optimizer: runs optimization (evidence: `README.md`)
- Antenna pattern → Batch optimizer: supplies pattern (evidence: `batch_genetic_solver.py`)
- Batch optimizer → Genetic solver: creates solver (evidence: `batch_genetic_solver.py`)
- Batch optimizer → Array-factor tools: computes factors (evidence: `batch_genetic_solver.py`)
- Batch optimizer → Plot utilities: uses tick tools (evidence: `batch_genetic_solver.py`)
- Array-factor tools → Plot utilities: uses formatters (evidence: `array_factor.py`)
- Batch optimizer → Optimization results: writes HDF5 and plots (evidence: `batch_genetic_solver.py`)
- Array engineer → Cached weights: copies selected phases (evidence: `README.md`)
- Cached weights → Beam correction analysis: provides weights (evidence: `beam_corrections.py`)
- Beam correction analysis → Array-factor tools: uses directivity tools (evidence: `beam_corrections.py`)
- Beam correction analysis → Correction plots: generates plots (evidence: `README.md`)
- Beam correction analysis → Array engineer: reports beam directions (evidence: `README.md`)
