# martexiwell/torched-tacaw architecture

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

- Interactive diagram: https://gitdiagram.com/martexiwell/torched-tacaw
- Repository: https://github.com/martexiwell/torched-tacaw

## Overview

torched-TACAW is a PyTorch/GPU-accelerated TACAW engine built around py_multislice. Its principal workflow is configuring a calculation, running it through the dispatcher/calculator, then integrating stored diffraction intensities with detector masks to produce STEM images. The repository also provides coordinate, line-rasterization, units, and utility modules, plus current, Dask-based, and legacy postprocessing implementations. The excerpts show detector storage access and parts of configuration and dispatch; most calculation internals are unsampled, so unverified runtime links are omitted or dashed.

Main entry points: [`torched_tacaw/core.py`](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/core.py) (Config), [`torched_tacaw/postprocessing.py`](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/postprocessing.py) (Detector integration), [`torched_tacaw/postprocessing_dask.py`](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/postprocessing_dask.py) (Dask integration), [`torched_tacaw/postprocessing_old.py`](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/postprocessing_old.py) (Legacy detectors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Simulation"]
  node_config["Config<br/>[core.py]"]
  node_calculator["Calculator<br/>[core.py]"]
  node_dispatcher["Dispatcher<br/>[core.py]"]
end

subgraph group_geometry["Geometry and utilities"]
  node_coordinates["Scanning coordinates<br/>[coordinates.py]"]
  node_bresenham["Bresenham lines<br/>[bresenham.py]"]
  node_tools["Runtime utilities<br/>[tools.py]"]
  node_units["Unit conversion<br/>[units.py]"]
end

subgraph group_processing["Image processing"]
  node_detectors["Detector integration<br/>[postprocessing.py]"]
  node_dask_detectors["Dask integration"]
  node_legacy_detectors["Legacy detectors"]
end

subgraph group_storage["Data storage"]
  node_trajectory["Trajectory input<br/>[io.py]"]
  node_intensities[("Diffraction intensities")]
  node_stem_images[("STEM images")]
end

node_user(("Researcher"))
node_pyms["py_multislice"]

node_user -->|"runs"| node_dispatcher
node_dispatcher -.->|"dispatches to"| node_calculator
node_calculator -.->|"uses"| node_pyms
node_detectors -->|"reads"| node_intensities
node_detectors -->|"writes"| node_stem_images
node_dask_detectors -->|"reads"| node_intensities
node_dask_detectors -->|"writes"| node_stem_images
node_legacy_detectors -->|"reads"| node_intensities
node_config -.->|"uses"| node_coordinates
node_detectors -->|"queries grids"| node_config
node_dask_detectors -->|"queries grids"| node_config
node_legacy_detectors -->|"queries grids"| node_config

click node_config "https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/core.py"
click node_calculator "https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/core.py"
click node_dispatcher "https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/core.py"
click node_coordinates "https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/coordinates.py"
click node_bresenham "https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/bresenham.py"
click node_tools "https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/tools.py"
click node_units "https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/units.py"
click node_trajectory "https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/io.py"
click node_detectors "https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/postprocessing.py"
click node_dask_detectors "https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/postprocessing_dask.py"
click node_legacy_detectors "https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/postprocessing_old.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_config,node_calculator,node_dispatcher toneBlue
class node_coordinates,node_bresenham,node_tools,node_units toneAmber
class node_detectors,node_dask_detectors,node_legacy_detectors toneMint
class node_trajectory,node_intensities,node_stem_images toneRose
class node_user,node_pyms toneIndigo
```

## Components

### Simulation

- [Config](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/core.py): `torched_tacaw/core.py`
- [Calculator](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/core.py): `torched_tacaw/core.py`
- [Dispatcher](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/core.py): `torched_tacaw/core.py`

### Geometry and utilities

- [Scanning coordinates](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/coordinates.py): `torched_tacaw/coordinates.py`
- [Bresenham lines](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/bresenham.py): `torched_tacaw/bresenham.py`
- [Runtime utilities](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/tools.py): `torched_tacaw/tools.py`
- [Unit conversion](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/units.py): `torched_tacaw/units.py`

### Image processing

- [Detector integration](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/postprocessing.py): `torched_tacaw/postprocessing.py`
- [Dask integration](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/postprocessing_dask.py): `torched_tacaw/postprocessing_dask.py`
- [Legacy detectors](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/postprocessing_old.py): `torched_tacaw/postprocessing_old.py`

### Data storage

- [Trajectory input](https://github.com/martexiwell/torched-tacaw/blob/main/torched_tacaw/io.py): `torched_tacaw/io.py`
- **Diffraction intensities**
- **STEM images**

### Other components

- **Researcher**
- **py_multislice**

## Connections

- Researcher → Dispatcher: runs (evidence: `torched_tacaw/core.py`)
- Dispatcher → Calculator: dispatches to (evidence: `torched_tacaw/core.py`)
- Calculator → py_multislice: uses (evidence: `README.md`)
- Detector integration → Diffraction intensities: reads (evidence: `torched_tacaw/postprocessing.py`)
- Detector integration → STEM images: writes (evidence: `torched_tacaw/postprocessing.py`)
- Dask integration → Diffraction intensities: reads (evidence: `torched_tacaw/postprocessing_dask.py`)
- Dask integration → STEM images: writes (evidence: `torched_tacaw/postprocessing_dask.py`)
- Legacy detectors → Diffraction intensities: reads (evidence: `torched_tacaw/postprocessing_old.py`)
- Config → Scanning coordinates: uses (evidence: `torched_tacaw/core.py`)
- Detector integration → Config: queries grids (evidence: `torched_tacaw/postprocessing.py`)
- Dask integration → Config: queries grids (evidence: `torched_tacaw/postprocessing_dask.py`)
- Legacy detectors → Config: queries grids (evidence: `torched_tacaw/postprocessing_old.py`)
