# jtoleary/spinn architecture

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

- Interactive diagram: https://gitdiagram.com/jtoleary/spinn
- Repository: https://github.com/jtoleary/spinn

## Overview

SPINN learns hidden drift and diffusion physics in stochastic differential equations by propagating uncertainty through known dynamics and fitting neural networks to moment estimates from data. The repository is compact: the sampled implementation is concentrated in core.py, while the README supplies the broader framework description. Data.zip and Examples.zip are visible in the tree, but their contents were not inspected, so their roles and connections are not assumed.

Main entry points: [`core.py`](https://github.com/jtoleary/spinn/blob/main/core.py) (Model training), [`Data.zip`](https://github.com/jtoleary/spinn/blob/main/Data.zip) (Data archive)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_method["Moment methods"]
  node_ut["Sigma points<br/>[core.py]"]
  node_drift["Drift targets<br/>[core.py]"]
  node_diffusion["Diffusion targets<br/>[core.py]"]
end

subgraph group_learning["Hidden physics learning"]
  node_networks["Neural networks<br/>[core.py]"]
  node_training["Model training<br/>[core.py]"]
  node_reconstruction["Physics reconstruction<br/>[core.py]"]
end

subgraph group_artifacts["Repository artifacts"]
  node_data["Data archive<br/>[Data.zip]"]
  node_examples["Examples archive<br/>[Examples.zip]"]
end

node_researcher(("Researcher"))

node_researcher -.->|"supplies data"| node_data
node_data -.->|"provides moments"| node_drift
node_ut -->|"supports estimates"| node_drift
node_ut -->|"supports estimates"| node_diffusion
node_drift -->|"sets targets"| node_training
node_diffusion -->|"sets targets"| node_training
node_networks -->|"trains models"| node_training
node_training -.->|"enables reconstruction"| node_reconstruction

click node_data "https://github.com/jtoleary/spinn/blob/main/Data.zip"
click node_examples "https://github.com/jtoleary/spinn/blob/main/Examples.zip"
click node_ut "https://github.com/jtoleary/spinn/blob/main/core.py"
click node_drift "https://github.com/jtoleary/spinn/blob/main/core.py"
click node_diffusion "https://github.com/jtoleary/spinn/blob/main/core.py"
click node_networks "https://github.com/jtoleary/spinn/blob/main/core.py"
click node_training "https://github.com/jtoleary/spinn/blob/main/core.py"
click node_reconstruction "https://github.com/jtoleary/spinn/blob/main/core.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_ut,node_drift,node_diffusion toneBlue
class node_networks,node_training,node_reconstruction toneAmber
class node_data,node_examples toneMint
class node_researcher toneIndigo
```

## Components

### Moment methods

- [Sigma points](https://github.com/jtoleary/spinn/blob/main/core.py): `core.py`
- [Drift targets](https://github.com/jtoleary/spinn/blob/main/core.py): `core.py`
- [Diffusion targets](https://github.com/jtoleary/spinn/blob/main/core.py): `core.py`

### Hidden physics learning

- [Neural networks](https://github.com/jtoleary/spinn/blob/main/core.py): `core.py`
- [Model training](https://github.com/jtoleary/spinn/blob/main/core.py): `core.py`
- [Physics reconstruction](https://github.com/jtoleary/spinn/blob/main/core.py): `core.py`

### Repository artifacts

- [Data archive](https://github.com/jtoleary/spinn/blob/main/Data.zip): `Data.zip`
- [Examples archive](https://github.com/jtoleary/spinn/blob/main/Examples.zip): `Examples.zip`

### Other components

- **Researcher**

## Connections

- Researcher → Data archive: supplies data
- Data archive → Drift targets: provides moments
- Sigma points → Drift targets: supports estimates (evidence: `core.py`)
- Sigma points → Diffusion targets: supports estimates (evidence: `core.py`)
- Drift targets → Model training: sets targets (evidence: `core.py`)
- Diffusion targets → Model training: sets targets (evidence: `core.py`)
- Neural networks → Model training: trains models (evidence: `core.py`)
- Model training → Physics reconstruction: enables reconstruction (evidence: `core.py`)
