# fjebaker/reltrans architecture

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

- Interactive diagram: https://gitdiagram.com/fjebaker/reltrans
- Repository: https://github.com/fjebaker/reltrans

## Overview

Reltrans is an X-ray reverberation model for black-hole accretion systems, producing time-averaged spectra and energy-dependent cross spectra. The main user workflow is to supply energies and model parameters through Python or XSPEC, invoke the model, and obtain spectral or timing results. Its documented model capabilities include relativistic spacetime effects, continuum and reflection, and multiple model flavours. The Python-to-native entry is visible in the excerpt; most Fortran internals are unsampled, so their relationships are shown only as unverified dashed links.

Main entry points: [`subroutines/reltrans_interface.f90`](https://github.com/fjebaker/reltrans/blob/main/subroutines/reltrans_interface.f90) (Model entry points), [`pyreltrans/__init__.py`](https://github.com/fjebaker/reltrans/blob/main/pyreltrans/__init__.py) (Python API), [`subroutines/xspec_interface.f90`](https://github.com/fjebaker/reltrans/blob/main/subroutines/xspec_interface.f90) (XSPEC interface), [`subroutines/propercross.f90`](https://github.com/fjebaker/reltrans/blob/main/subroutines/propercross.f90) (Cross spectra)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_python["Python API<br/>[__init__.py]"]
  node_xspec["XSPEC interface"]
  node_native["Model entry points"]
end

subgraph group_physics["Relativistic physics"]
  node_relativity["Kerr spacetime<br/>[kerrz.f90]"]
  node_raytrace["Photon ray tracing<br/>[raytracing.f90]"]
  node_profiles["Disc profiles"]
end

subgraph group_emission["Emission model"]
  node_continuum["Continuum emission"]
  node_emissivity["Disc emissivity<br/>[emissivity.f90]"]
  node_reflection["Reflection spectra"]
end

subgraph group_outputs["Spectral timing"]
  node_response["Instrument response<br/>[resproutines.f90]"]
  node_spectrum["Spectrum assembly<br/>[components.f90]"]
  node_impulse["Impulse response"]
  node_cross["Cross spectra<br/>[propercross.f90]"]
  node_frequency["Frequency lags<br/>[lag_freq.f90]"]
  node_fold["Spectral folding<br/>[fold.f90]"]
end

node_user(("Model user"))

node_user -->|"calls"| node_python
node_user -->|"loads model"| node_xspec
node_python -->|"calls native"| node_native
node_xspec -.->|"dispatches"| node_native
node_native -.->|"uses"| node_relativity
node_native -.->|"uses"| node_raytrace
node_native -.->|"uses"| node_profiles
node_native -.->|"uses"| node_continuum
node_native -.->|"uses"| node_emissivity
node_native -.->|"uses"| node_reflection
node_native -.->|"produces"| node_spectrum
node_native -.->|"computes"| node_impulse
node_native -.->|"computes"| node_cross
node_cross -.->|"derives lags"| node_frequency
node_native -.->|"applies"| node_response
node_native -.->|"folds output"| node_fold

click node_python "https://github.com/fjebaker/reltrans/blob/main/pyreltrans/__init__.py"
click node_xspec "https://github.com/fjebaker/reltrans/blob/main/subroutines/xspec_interface.f90"
click node_native "https://github.com/fjebaker/reltrans/blob/main/subroutines/reltrans_interface.f90"
click node_relativity "https://github.com/fjebaker/reltrans/blob/main/subroutines/kerrz.f90"
click node_raytrace "https://github.com/fjebaker/reltrans/blob/main/subroutines/raytracing.f90"
click node_profiles "https://github.com/fjebaker/reltrans/tree/main/subroutines/radial_profiles"
click node_continuum "https://github.com/fjebaker/reltrans/tree/main/subroutines/continuum"
click node_emissivity "https://github.com/fjebaker/reltrans/blob/main/subroutines/emissivity.f90"
click node_reflection "https://github.com/fjebaker/reltrans/tree/main/subroutines/rest_frame_reflection"
click node_response "https://github.com/fjebaker/reltrans/blob/main/subroutines/resproutines.f90"
click node_spectrum "https://github.com/fjebaker/reltrans/blob/main/subroutines/components.f90"
click node_impulse "https://github.com/fjebaker/reltrans/blob/main/subroutines/impulseresponse.f90"
click node_cross "https://github.com/fjebaker/reltrans/blob/main/subroutines/propercross.f90"
click node_frequency "https://github.com/fjebaker/reltrans/blob/main/subroutines/lag_freq.f90"
click node_fold "https://github.com/fjebaker/reltrans/blob/main/subroutines/fold.f90"

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_python,node_xspec,node_native,node_user toneBlue
class node_relativity,node_raytrace,node_profiles toneAmber
class node_continuum,node_emissivity,node_reflection toneMint
class node_response,node_spectrum,node_impulse,node_cross,node_frequency,node_fold toneRose
```

## Components

### User interfaces

- [Python API](https://github.com/fjebaker/reltrans/blob/main/pyreltrans/__init__.py): `pyreltrans/__init__.py`
- [XSPEC interface](https://github.com/fjebaker/reltrans/blob/main/subroutines/xspec_interface.f90): `subroutines/xspec_interface.f90`
- [Model entry points](https://github.com/fjebaker/reltrans/blob/main/subroutines/reltrans_interface.f90): `subroutines/reltrans_interface.f90`

### Relativistic physics

- [Kerr spacetime](https://github.com/fjebaker/reltrans/blob/main/subroutines/kerrz.f90): `subroutines/kerrz.f90`
- [Photon ray tracing](https://github.com/fjebaker/reltrans/blob/main/subroutines/raytracing.f90): `subroutines/raytracing.f90`
- [Disc profiles](https://github.com/fjebaker/reltrans/tree/main/subroutines/radial_profiles): `subroutines/radial_profiles`

### Emission model

- [Continuum emission](https://github.com/fjebaker/reltrans/tree/main/subroutines/continuum): `subroutines/continuum`
- [Disc emissivity](https://github.com/fjebaker/reltrans/blob/main/subroutines/emissivity.f90): `subroutines/emissivity.f90`
- [Reflection spectra](https://github.com/fjebaker/reltrans/tree/main/subroutines/rest_frame_reflection): `subroutines/rest_frame_reflection`

### Spectral timing

- [Instrument response](https://github.com/fjebaker/reltrans/blob/main/subroutines/resproutines.f90): `subroutines/resproutines.f90`
- [Spectrum assembly](https://github.com/fjebaker/reltrans/blob/main/subroutines/components.f90): `subroutines/components.f90`
- [Impulse response](https://github.com/fjebaker/reltrans/blob/main/subroutines/impulseresponse.f90): `subroutines/impulseresponse.f90`
- [Cross spectra](https://github.com/fjebaker/reltrans/blob/main/subroutines/propercross.f90): `subroutines/propercross.f90`
- [Frequency lags](https://github.com/fjebaker/reltrans/blob/main/subroutines/lag_freq.f90): `subroutines/lag_freq.f90`
- [Spectral folding](https://github.com/fjebaker/reltrans/blob/main/subroutines/fold.f90): `subroutines/fold.f90`

### Other components

- **Model user**

## Connections

- Model user → Python API: calls (evidence: `README.md`)
- Model user → XSPEC interface: loads model (evidence: `README.md`)
- Python API → Model entry points: calls native (evidence: `pyreltrans/__init__.py`)
- XSPEC interface → Model entry points: dispatches
- Model entry points → Kerr spacetime: uses
- Model entry points → Photon ray tracing: uses
- Model entry points → Disc profiles: uses
- Model entry points → Continuum emission: uses
- Model entry points → Disc emissivity: uses
- Model entry points → Reflection spectra: uses
- Model entry points → Spectrum assembly: produces
- Model entry points → Impulse response: computes
- Model entry points → Cross spectra: computes
- Cross spectra → Frequency lags: derives lags
- Model entry points → Instrument response: applies
- Model entry points → Spectral folding: folds output
