# jordydavelaar/raptor architecture

> Architecture diagram of the GitHub repository jordydavelaar/raptor, 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/jordydavelaar/raptor
- Repository: https://github.com/jordydavelaar/raptor

## Overview

RAPTOR computes relativistic images and spectra from GRMHD simulation data or analytic plasma models. The main workflow reads model parameters and a simulation snapshot, traces photon paths, transports radiation, then writes image and spectrum products for analysis. The README also documents polarized and unpolarized transport, adaptive or static camera grids, multiple model and metric options, and Python tools for plotting, FITS conversion, time series, and parameter inference. Core wiring is inferred only where the README or sampled entry point supports it; unsampled module internals are not mapped in detail.

Main entry points: [`src/io.c`](https://github.com/jordydavelaar/raptor/blob/main/src/io.c) (Image and spectrum output), [`src/main.c`](https://github.com/jordydavelaar/raptor/blob/main/src/main.c) (Run entry point), [`src/core.c`](https://github.com/jordydavelaar/raptor/blob/main/src/core.c) (Image orchestration), [`src/gr_integrator.c`](https://github.com/jordydavelaar/raptor/blob/main/src/gr_integrator.c) (Photon geodesics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_engine["RAPTOR engine"]
  node_main["Run entry point<br/>[main.c]"]
  node_core["Image orchestration<br/>[core.c]"]
  node_camera["Camera grid<br/>[camera.c]"]
  node_geodesics["Photon geodesics<br/>[gr_integrator.c]"]
  node_metric["Spacetime metric<br/>[metric.c]"]
  node_tetrad["Frame transforms<br/>[tetrad.c]"]
  node_rte["Radiative transfer<br/>[rte_integrator.c]"]
  node_polrte["Polarized transfer"]
  node_emission["Polarized emission<br/>[pol_emission.c]"]
end

subgraph group_models["Plasma models"]
  node_harm["HARM3D adapter<br/>[model.c]"]
  node_bhac["BHAC adapter<br/>[model.c]"]
  node_hamr["HAMR adapter<br/>[model.c]"]
end

subgraph group_products["Analysis products"]
  node_output["Image and spectrum output<br/>[io.c]"]
  node_plot["Plot and inspect<br/>[rapplot.py]"]
  node_fits["FITS export<br/>[fits-eht.py]"]
  node_lightcurve["Light curves<br/>[lightcurve.py]"]
end

subgraph group_inference["Parameter inference"]
  node_multinest["MultiNest fitting"]
  node_binsearch["Flux bin search<br/>[binsearch.py]"]
end

node_user(("Run user"))
node_snapshot["GRMHD snapshot"]
node_params["Run parameters"]
node_observations["Observations"]

node_user -->|"runs"| node_main
node_params -->|"configures"| node_main
node_snapshot -->|"loads as"| node_harm
node_snapshot -->|"loads as"| node_bhac
node_snapshot -->|"loads as"| node_hamr
node_main -->|"computes blocks"| node_core
node_main -->|"initializes"| node_camera
node_main -->|"writes results"| node_output
node_harm -->|"provides plasma"| node_core
node_bhac -->|"provides plasma"| node_core
node_hamr -->|"provides plasma"| node_core
node_core -->|"traces photons"| node_geodesics
node_geodesics -->|"uses metric"| node_metric
node_geodesics -->|"transfers along paths"| node_rte
node_rte -.->|"polarized mode"| node_polrte
node_polrte -->|"computes emission"| node_emission
node_output -->|"reads images"| node_plot
node_output -->|"reads uniform images"| node_fits
node_output -->|"reads spectra"| node_lightcurve
node_output -->|"reads spectra"| node_binsearch
node_output -->|"supplies model results"| node_multinest
node_observations -->|"constrains fit"| node_multinest

click node_main "https://github.com/jordydavelaar/raptor/blob/main/src/main.c"
click node_core "https://github.com/jordydavelaar/raptor/blob/main/src/core.c"
click node_camera "https://github.com/jordydavelaar/raptor/blob/main/src/camera.c"
click node_geodesics "https://github.com/jordydavelaar/raptor/blob/main/src/gr_integrator.c"
click node_metric "https://github.com/jordydavelaar/raptor/blob/main/src/metric.c"
click node_tetrad "https://github.com/jordydavelaar/raptor/blob/main/src/tetrad.c"
click node_rte "https://github.com/jordydavelaar/raptor/blob/main/src/rte_integrator.c"
click node_polrte "https://github.com/jordydavelaar/raptor/blob/main/src/pol_rte_integrator.c"
click node_emission "https://github.com/jordydavelaar/raptor/blob/main/src/pol_emission.c"
click node_harm "https://github.com/jordydavelaar/raptor/blob/main/model/harm3d/model.c"
click node_bhac "https://github.com/jordydavelaar/raptor/blob/main/model/bhac/model.c"
click node_hamr "https://github.com/jordydavelaar/raptor/blob/main/model/HAMR/model.c"
click node_output "https://github.com/jordydavelaar/raptor/blob/main/src/io.c"
click node_plot "https://github.com/jordydavelaar/raptor/blob/main/python/plotting/rapplot.py"
click node_fits "https://github.com/jordydavelaar/raptor/blob/main/python/fits/fits-eht.py"
click node_lightcurve "https://github.com/jordydavelaar/raptor/blob/main/python/timeseries/lightcurve.py"
click node_multinest "https://github.com/jordydavelaar/raptor/blob/main/python/MultiNest/Multinest_CentaurusA.py"
click node_binsearch "https://github.com/jordydavelaar/raptor/blob/main/python/binsearch/binsearch.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_main,node_core,node_camera,node_geodesics,node_metric,node_tetrad,node_rte,node_polrte,node_emission,node_user toneBlue
class node_harm,node_bhac,node_hamr toneAmber
class node_output,node_plot,node_fits,node_lightcurve toneMint
class node_multinest,node_binsearch toneRose
class node_snapshot,node_params,node_observations toneIndigo
```

## Components

### RAPTOR engine

- [Run entry point](https://github.com/jordydavelaar/raptor/blob/main/src/main.c): `src/main.c`
- [Image orchestration](https://github.com/jordydavelaar/raptor/blob/main/src/core.c): `src/core.c`
- [Camera grid](https://github.com/jordydavelaar/raptor/blob/main/src/camera.c): `src/camera.c`
- [Photon geodesics](https://github.com/jordydavelaar/raptor/blob/main/src/gr_integrator.c): `src/gr_integrator.c`
- [Spacetime metric](https://github.com/jordydavelaar/raptor/blob/main/src/metric.c): `src/metric.c`
- [Frame transforms](https://github.com/jordydavelaar/raptor/blob/main/src/tetrad.c): `src/tetrad.c`
- [Radiative transfer](https://github.com/jordydavelaar/raptor/blob/main/src/rte_integrator.c): `src/rte_integrator.c`
- [Polarized transfer](https://github.com/jordydavelaar/raptor/blob/main/src/pol_rte_integrator.c): `src/pol_rte_integrator.c`
- [Polarized emission](https://github.com/jordydavelaar/raptor/blob/main/src/pol_emission.c): `src/pol_emission.c`

### Plasma models

- [HARM3D adapter](https://github.com/jordydavelaar/raptor/blob/main/model/harm3d/model.c): `model/harm3d/model.c`
- [BHAC adapter](https://github.com/jordydavelaar/raptor/blob/main/model/bhac/model.c): `model/bhac/model.c`
- [HAMR adapter](https://github.com/jordydavelaar/raptor/blob/main/model/HAMR/model.c): `model/HAMR/model.c`

### Analysis products

- [Image and spectrum output](https://github.com/jordydavelaar/raptor/blob/main/src/io.c): `src/io.c`
- [Plot and inspect](https://github.com/jordydavelaar/raptor/blob/main/python/plotting/rapplot.py): `python/plotting/rapplot.py`
- [FITS export](https://github.com/jordydavelaar/raptor/blob/main/python/fits/fits-eht.py): `python/fits/fits-eht.py`
- [Light curves](https://github.com/jordydavelaar/raptor/blob/main/python/timeseries/lightcurve.py): `python/timeseries/lightcurve.py`

### Parameter inference

- [MultiNest fitting](https://github.com/jordydavelaar/raptor/blob/main/python/MultiNest/Multinest_CentaurusA.py): `python/MultiNest/Multinest_CentaurusA.py`
- [Flux bin search](https://github.com/jordydavelaar/raptor/blob/main/python/binsearch/binsearch.py): `python/binsearch/binsearch.py`

### Other components

- **Run user**
- **GRMHD snapshot**
- **Run parameters**
- **Observations**

## Connections

- Run user → Run entry point: runs
- Run parameters → Run entry point: configures
- GRMHD snapshot → HARM3D adapter: loads as
- GRMHD snapshot → BHAC adapter: loads as
- GRMHD snapshot → HAMR adapter: loads as
- Run entry point → Image orchestration: computes blocks
- Run entry point → Camera grid: initializes
- Run entry point → Image and spectrum output: writes results
- HARM3D adapter → Image orchestration: provides plasma
- BHAC adapter → Image orchestration: provides plasma
- HAMR adapter → Image orchestration: provides plasma
- Image orchestration → Photon geodesics: traces photons
- Photon geodesics → Spacetime metric: uses metric
- Photon geodesics → Radiative transfer: transfers along paths
- Radiative transfer → Polarized transfer: polarized mode
- Polarized transfer → Polarized emission: computes emission
- Image and spectrum output → Plot and inspect: reads images
- Image and spectrum output → FITS export: reads uniform images
- Image and spectrum output → Light curves: reads spectra
- Image and spectrum output → Flux bin search: reads spectra
- Image and spectrum output → MultiNest fitting: supplies model results
- Observations → MultiNest fitting: constrains fit
