# hvasbath/beat architecture

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

- Interactive diagram: https://gitdiagram.com/hvasbath/beat
- Repository: https://github.com/hvasbath/beat

## Overview

BEAT is a Bayesian earthquake-analysis application for inferring earthquake source properties from seismic and geodetic observations. A typical user configures a project and supplies observations, then runs an inversion and inspects plots of the results. The runtime includes separate seismic and geodetic likelihood/modeling components, source-geometry and Green’s-function machinery, and several sampling strategies. The tree and excerpts establish these capabilities, but do not expose all CLI-to-model wiring; the graph omits uncertain links rather than implying a complete execution trace.

Main entry points: [`beat/models/geodetic.py`](https://github.com/hvasbath/beat/blob/master/beat/models/geodetic.py) (Geodetic model), [`beat/models/problems.py`](https://github.com/hvasbath/beat/blob/master/beat/models/problems.py) (Problem definitions), [`beat/models/seismic.py`](https://github.com/hvasbath/beat/blob/master/beat/models/seismic.py) (Seismic model), [`beat/config.py`](https://github.com/hvasbath/beat/blob/master/beat/config.py) (Project configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Project workflow"]
  node_cli["BEAT commands<br/>[beat.py]"]
  node_down["BEATdown<br/>[beatdown.py]"]
  node_config["Project configuration<br/>[config.py]"]
  node_input["Data handling<br/>[inputf.py]"]
  node_plot["Result plots"]
end

subgraph group_models["Observation models"]
  node_seismic["Seismic model<br/>[seismic.py]"]
  node_geodetic["Geodetic model<br/>[geodetic.py]"]
  node_polarity["Polarity model<br/>[polarity.py]"]
  node_problem["Problem definitions<br/>[problems.py]"]
  node_covariance["Covariance<br/>[covariance.py]"]
end

subgraph group_source["Source physics"]
  node_heart["Synthetics and mappings<br/>[heart.py]"]
  node_sources["Earthquake sources<br/>[sources.py]"]
  node_fault["Finite-fault geometry<br/>[fault.py]"]
  node_bem["BEM sources<br/>[sources.py]"]
  node_sweep["Rupture timing<br/>[fast_sweep.py]"]
  node_voronoi["Voronoi mapping<br/>[voronoi.py]"]
end

subgraph group_inference["Bayesian inference"]
  node_sampler["Sampling strategies"]
  node_metropolis["Metropolis sampler<br/>[metropolis.py]"]
  node_smc["SMC sampler<br/>[smc.py]"]
  node_pt["Parallel tempering<br/>[pt.py]"]
  node_backend["Trace backend<br/>[backend.py]"]
end

node_user(("Researcher"))
node_engine["Pyrocko GF engine"]

node_user -->|"runs commands"| node_cli
node_user -->|"runs commands"| node_down
node_cli -->|"manages projects"| node_config
node_cli -->|"requests plots"| node_plot
node_input -->|"provides observations"| node_seismic
node_input -->|"provides observations"| node_geodetic
node_config -->|"configures"| node_seismic
node_config -->|"configures"| node_geodetic
node_config -->|"configures"| node_problem
node_problem -->|"includes model"| node_seismic
node_problem -->|"includes model"| node_geodetic
node_problem -->|"includes model"| node_polarity
node_seismic -->|"uses covariance"| node_covariance
node_geodetic -->|"uses covariance"| node_covariance
node_seismic -->|"prepares synthetics"| node_heart
node_geodetic -->|"prepares synthetics"| node_heart
node_heart -.->|"queries Green’s functions"| node_engine
node_geodetic -.->|"uses BEM engine"| node_bem
node_fault -->|"calculates rupture times"| node_sweep
node_fault -->|"maps discretization"| node_voronoi
node_problem -->|"provides inference problem"| node_sampler
node_sampler -->|"selects strategy"| node_metropolis
node_sampler -->|"selects strategy"| node_smc
node_sampler -->|"selects strategy"| node_pt
node_metropolis -->|"records samples"| node_backend
node_smc -->|"records samples"| node_backend
node_pt -->|"records chains"| node_backend
node_plot -->|"reads results"| node_backend

click node_cli "https://github.com/hvasbath/beat/blob/master/beat/apps/beat.py"
click node_down "https://github.com/hvasbath/beat/blob/master/beat/apps/beatdown.py"
click node_config "https://github.com/hvasbath/beat/blob/master/beat/config.py"
click node_input "https://github.com/hvasbath/beat/blob/master/beat/inputf.py"
click node_plot "https://github.com/hvasbath/beat/tree/master/beat/plotting"
click node_seismic "https://github.com/hvasbath/beat/blob/master/beat/models/seismic.py"
click node_geodetic "https://github.com/hvasbath/beat/blob/master/beat/models/geodetic.py"
click node_polarity "https://github.com/hvasbath/beat/blob/master/beat/models/polarity.py"
click node_problem "https://github.com/hvasbath/beat/blob/master/beat/models/problems.py"
click node_covariance "https://github.com/hvasbath/beat/blob/master/beat/covariance.py"
click node_heart "https://github.com/hvasbath/beat/blob/master/beat/heart.py"
click node_sources "https://github.com/hvasbath/beat/blob/master/beat/sources.py"
click node_fault "https://github.com/hvasbath/beat/blob/master/beat/ffi/fault.py"
click node_bem "https://github.com/hvasbath/beat/blob/master/beat/bem/sources.py"
click node_sweep "https://github.com/hvasbath/beat/blob/master/beat/fast_sweeping/fast_sweep.py"
click node_voronoi "https://github.com/hvasbath/beat/blob/master/beat/voronoi/voronoi.py"
click node_sampler "https://github.com/hvasbath/beat/tree/master/beat/sampler"
click node_metropolis "https://github.com/hvasbath/beat/blob/master/beat/sampler/metropolis.py"
click node_smc "https://github.com/hvasbath/beat/blob/master/beat/sampler/smc.py"
click node_pt "https://github.com/hvasbath/beat/blob/master/beat/sampler/pt.py"
click node_backend "https://github.com/hvasbath/beat/blob/master/beat/backend.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_cli,node_down,node_config,node_input,node_plot toneBlue
class node_seismic,node_geodetic,node_polarity,node_problem,node_covariance toneAmber
class node_heart,node_sources,node_fault,node_bem,node_sweep,node_voronoi toneMint
class node_sampler,node_metropolis,node_smc,node_pt,node_backend toneRose
class node_user,node_engine toneIndigo
```

## Components

### Project workflow

- [BEAT commands](https://github.com/hvasbath/beat/blob/master/beat/apps/beat.py): `beat/apps/beat.py`
- [BEATdown](https://github.com/hvasbath/beat/blob/master/beat/apps/beatdown.py): `beat/apps/beatdown.py`
- [Project configuration](https://github.com/hvasbath/beat/blob/master/beat/config.py): `beat/config.py`
- [Data handling](https://github.com/hvasbath/beat/blob/master/beat/inputf.py): `beat/inputf.py`
- [Result plots](https://github.com/hvasbath/beat/tree/master/beat/plotting): `beat/plotting`

### Observation models

- [Seismic model](https://github.com/hvasbath/beat/blob/master/beat/models/seismic.py): `beat/models/seismic.py`
- [Geodetic model](https://github.com/hvasbath/beat/blob/master/beat/models/geodetic.py): `beat/models/geodetic.py`
- [Polarity model](https://github.com/hvasbath/beat/blob/master/beat/models/polarity.py): `beat/models/polarity.py`
- [Problem definitions](https://github.com/hvasbath/beat/blob/master/beat/models/problems.py): `beat/models/problems.py`
- [Covariance](https://github.com/hvasbath/beat/blob/master/beat/covariance.py): `beat/covariance.py`

### Source physics

- [Synthetics and mappings](https://github.com/hvasbath/beat/blob/master/beat/heart.py): `beat/heart.py`
- [Earthquake sources](https://github.com/hvasbath/beat/blob/master/beat/sources.py): `beat/sources.py`
- [Finite-fault geometry](https://github.com/hvasbath/beat/blob/master/beat/ffi/fault.py): `beat/ffi/fault.py`
- [BEM sources](https://github.com/hvasbath/beat/blob/master/beat/bem/sources.py): `beat/bem/sources.py`
- [Rupture timing](https://github.com/hvasbath/beat/blob/master/beat/fast_sweeping/fast_sweep.py): `beat/fast_sweeping/fast_sweep.py`
- [Voronoi mapping](https://github.com/hvasbath/beat/blob/master/beat/voronoi/voronoi.py): `beat/voronoi/voronoi.py`

### Bayesian inference

- [Sampling strategies](https://github.com/hvasbath/beat/tree/master/beat/sampler): `beat/sampler`
- [Metropolis sampler](https://github.com/hvasbath/beat/blob/master/beat/sampler/metropolis.py): `beat/sampler/metropolis.py`
- [SMC sampler](https://github.com/hvasbath/beat/blob/master/beat/sampler/smc.py): `beat/sampler/smc.py`
- [Parallel tempering](https://github.com/hvasbath/beat/blob/master/beat/sampler/pt.py): `beat/sampler/pt.py`
- [Trace backend](https://github.com/hvasbath/beat/blob/master/beat/backend.py): `beat/backend.py`

### Other components

- **Researcher**
- **Pyrocko GF engine**

## Connections

- Researcher → BEAT commands: runs commands
- Researcher → BEATdown: runs commands
- BEAT commands → Project configuration: manages projects
- BEAT commands → Result plots: requests plots
- Data handling → Seismic model: provides observations
- Data handling → Geodetic model: provides observations
- Project configuration → Seismic model: configures
- Project configuration → Geodetic model: configures
- Project configuration → Problem definitions: configures
- Problem definitions → Seismic model: includes model
- Problem definitions → Geodetic model: includes model
- Problem definitions → Polarity model: includes model
- Seismic model → Covariance: uses covariance
- Geodetic model → Covariance: uses covariance
- Seismic model → Synthetics and mappings: prepares synthetics
- Geodetic model → Synthetics and mappings: prepares synthetics
- Synthetics and mappings → Pyrocko GF engine: queries Green’s functions
- Geodetic model → BEM sources: uses BEM engine
- Finite-fault geometry → Rupture timing: calculates rupture times
- Finite-fault geometry → Voronoi mapping: maps discretization
- Problem definitions → Sampling strategies: provides inference problem
- Sampling strategies → Metropolis sampler: selects strategy
- Sampling strategies → SMC sampler: selects strategy
- Sampling strategies → Parallel tempering: selects strategy
- Metropolis sampler → Trace backend: records samples
- SMC sampler → Trace backend: records samples
- Parallel tempering → Trace backend: records chains
- Result plots → Trace backend: reads results
