# astropy/astropy architecture

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

- Interactive diagram: https://gitdiagram.com/astropy/astropy
- Repository: https://github.com/astropy/astropy

## Overview

Astropy is an astronomy and astrophysics core library. A typical user supplies scientific data, quantities, coordinates, times, or models through public package APIs; Astropy validates and transforms those values, performs analysis, and returns scientific arrays, tables, coordinates, or visualizations. Major stages include physical representation, data interchange, astronomical transformations, scientific analysis, and interoperability. The sampled code confirms WCS pipeline execution, periodogram dispatch, SAMP client orchestration, VOTable reporting, XML streaming, and unit-aware modeling; other subsystem links are limited to documented package structure.

Main entry points: [`astropy/wcs/wcs.py`](https://github.com/astropy/astropy/blob/main/astropy/wcs/wcs.py) (WCS API), [`astropy/units/quantity.py`](https://github.com/astropy/astropy/blob/main/astropy/units/quantity.py) (Units Quantities), [`astropy/timeseries/periodograms/lombscargle/implementations/main.py`](https://github.com/astropy/astropy/blob/main/astropy/timeseries/periodograms/lombscargle/implementations/main.py) (Periodogram Dispatch), [`astropy/coordinates/sky_coordinate.py`](https://github.com/astropy/astropy/blob/main/astropy/coordinates/sky_coordinate.py) (Sky Coordinates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Scientific Primitives"]
  node_units["Units Quantities<br/>[quantity.py]"]
  node_constants["Physical Constants<br/>[constant.py]"]
  node_time["Time Handling<br/>[core.py]"]
  node_uncertainty["Uncertainty Models<br/>[core.py]"]
end

subgraph group_data["Data Interchange"]
  node_fits["FITS IO<br/>[convenience.py]"]
  node_votable["VOTable IO<br/>[table.py]"]
  node_table["Scientific Tables<br/>[table.py]"]
  node_table_index["Table Indexing<br/>[index.py]"]
  node_nddata["N-D Data<br/>[nddata.py]"]
end

subgraph group_astro["Astronomical Transformations"]
  node_coordinates["Sky Coordinates<br/>[sky_coordinate.py]"]
  node_wcs["WCS API<br/>[wcs.py]"]
  node_wcs_pipeline["WCS Pipeline<br/>[pipeline.c]"]
  node_cosmology["Cosmology Models<br/>[core.py]"]
end

subgraph group_analysis["Scientific Analysis"]
  node_modeling["Modeling Framework<br/>[core.py]"]
  node_stats["Statistical Analysis<br/>[funcs.py]"]
  node_timeseries["Time Series<br/>[core.py]"]
  node_lombscargle["Periodogram Dispatch<br/>[main.py]"]
  node_multiband["Multiband Periodograms<br/>[main.py]"]
end

subgraph group_interop["Interoperability"]
  node_visualization["Scientific Visualization<br/>[__init__.py]"]
  node_samp["SAMP Messaging"]
end

node_user(("Astronomy User"))
node_api["Astropy API<br/>[__init__.py]"]
node_samp_hub{{"SAMP Hub"}}
node_vo_files["VO Files"]

node_user -->|"uses"| node_api
node_user -->|"reads data"| node_fits
node_user -->|"exchanges data"| node_votable
node_user -->|"creates coordinates"| node_coordinates
node_user -->|"transforms pixels"| node_wcs
node_user -->|"evaluates cosmology"| node_cosmology
node_user -->|"fits models"| node_modeling
node_user -->|"analyzes data"| node_stats
node_user -->|"analyzes series"| node_timeseries
node_user -->|"plots results"| node_visualization
node_api -->|"exposes quantities"| node_units
node_coordinates -->|"applies units"| node_units
node_modeling -->|"maps units"| node_units
node_wcs -->|"runs pipeline"| node_wcs_pipeline
node_wcs_pipeline -->|"calls wcslib"| node_wcs
node_table -->|"indexes rows"| node_table_index
node_lombscargle -->|"returns power"| node_timeseries
node_lombscargle -.->|"supports multiband"| node_multiband
node_samp -->|"registers client"| node_samp_hub
node_vo_files -->|"provides XML"| node_votable

click node_api "https://github.com/astropy/astropy/blob/main/astropy/__init__.py"
click node_units "https://github.com/astropy/astropy/blob/main/astropy/units/quantity.py"
click node_constants "https://github.com/astropy/astropy/blob/main/astropy/constants/constant.py"
click node_time "https://github.com/astropy/astropy/blob/main/astropy/time/core.py"
click node_uncertainty "https://github.com/astropy/astropy/blob/main/astropy/uncertainty/core.py"
click node_fits "https://github.com/astropy/astropy/blob/main/astropy/io/fits/convenience.py"
click node_votable "https://github.com/astropy/astropy/blob/main/astropy/io/votable/table.py"
click node_table "https://github.com/astropy/astropy/blob/main/astropy/table/table.py"
click node_table_index "https://github.com/astropy/astropy/blob/main/astropy/table/index.py"
click node_nddata "https://github.com/astropy/astropy/blob/main/astropy/nddata/nddata.py"
click node_coordinates "https://github.com/astropy/astropy/blob/main/astropy/coordinates/sky_coordinate.py"
click node_wcs "https://github.com/astropy/astropy/blob/main/astropy/wcs/wcs.py"
click node_wcs_pipeline "https://github.com/astropy/astropy/blob/main/astropy/wcs/src/pipeline.c"
click node_cosmology "https://github.com/astropy/astropy/blob/main/astropy/cosmology/_src/core.py"
click node_modeling "https://github.com/astropy/astropy/blob/main/astropy/modeling/core.py"
click node_stats "https://github.com/astropy/astropy/blob/main/astropy/stats/funcs.py"
click node_timeseries "https://github.com/astropy/astropy/blob/main/astropy/timeseries/core.py"
click node_lombscargle "https://github.com/astropy/astropy/blob/main/astropy/timeseries/periodograms/lombscargle/implementations/main.py"
click node_multiband "https://github.com/astropy/astropy/blob/main/astropy/timeseries/periodograms/lombscargle_multiband/implementations/main.py"
click node_visualization "https://github.com/astropy/astropy/blob/main/astropy/visualization/__init__.py"
click node_samp "https://github.com/astropy/astropy/blob/main/astropy/samp/integrated_client.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_units,node_constants,node_time,node_uncertainty,node_user toneBlue
class node_fits,node_votable,node_table,node_table_index,node_nddata toneAmber
class node_coordinates,node_wcs,node_wcs_pipeline,node_cosmology,node_api toneMint
class node_modeling,node_stats,node_timeseries,node_lombscargle,node_multiband toneRose
class node_visualization,node_samp,node_samp_hub,node_vo_files toneIndigo
```

## Components

### Scientific Primitives

- [Units Quantities](https://github.com/astropy/astropy/blob/main/astropy/units/quantity.py): `astropy/units/quantity.py`
- [Physical Constants](https://github.com/astropy/astropy/blob/main/astropy/constants/constant.py): `astropy/constants/constant.py`
- [Time Handling](https://github.com/astropy/astropy/blob/main/astropy/time/core.py): `astropy/time/core.py`
- [Uncertainty Models](https://github.com/astropy/astropy/blob/main/astropy/uncertainty/core.py): `astropy/uncertainty/core.py`

### Data Interchange

- [FITS IO](https://github.com/astropy/astropy/blob/main/astropy/io/fits/convenience.py): `astropy/io/fits/convenience.py`
- [VOTable IO](https://github.com/astropy/astropy/blob/main/astropy/io/votable/table.py): `astropy/io/votable/table.py`
- [Scientific Tables](https://github.com/astropy/astropy/blob/main/astropy/table/table.py): `astropy/table/table.py`
- [Table Indexing](https://github.com/astropy/astropy/blob/main/astropy/table/index.py): `astropy/table/index.py`
- [N-D Data](https://github.com/astropy/astropy/blob/main/astropy/nddata/nddata.py): `astropy/nddata/nddata.py`

### Astronomical Transformations

- [Sky Coordinates](https://github.com/astropy/astropy/blob/main/astropy/coordinates/sky_coordinate.py): `astropy/coordinates/sky_coordinate.py`
- [WCS API](https://github.com/astropy/astropy/blob/main/astropy/wcs/wcs.py): `astropy/wcs/wcs.py`
- [WCS Pipeline](https://github.com/astropy/astropy/blob/main/astropy/wcs/src/pipeline.c): `astropy/wcs/src/pipeline.c`
- [Cosmology Models](https://github.com/astropy/astropy/blob/main/astropy/cosmology/_src/core.py): `astropy/cosmology/_src/core.py`

### Scientific Analysis

- [Modeling Framework](https://github.com/astropy/astropy/blob/main/astropy/modeling/core.py): `astropy/modeling/core.py`
- [Statistical Analysis](https://github.com/astropy/astropy/blob/main/astropy/stats/funcs.py): `astropy/stats/funcs.py`
- [Time Series](https://github.com/astropy/astropy/blob/main/astropy/timeseries/core.py): `astropy/timeseries/core.py`
- [Periodogram Dispatch](https://github.com/astropy/astropy/blob/main/astropy/timeseries/periodograms/lombscargle/implementations/main.py): `astropy/timeseries/periodograms/lombscargle/implementations/main.py`
- [Multiband Periodograms](https://github.com/astropy/astropy/blob/main/astropy/timeseries/periodograms/lombscargle_multiband/implementations/main.py): `astropy/timeseries/periodograms/lombscargle_multiband/implementations/main.py`

### Interoperability

- [Scientific Visualization](https://github.com/astropy/astropy/blob/main/astropy/visualization/__init__.py): `astropy/visualization/__init__.py`
- [SAMP Messaging](https://github.com/astropy/astropy/blob/main/astropy/samp/integrated_client.py): `astropy/samp/integrated_client.py`

### Other components

- **Astronomy User**
- [Astropy API](https://github.com/astropy/astropy/blob/main/astropy/__init__.py): `astropy/__init__.py`
- **SAMP Hub**
- **VO Files**

## Connections

- Astronomy User → Astropy API: uses
- Astronomy User → FITS IO: reads data
- Astronomy User → VOTable IO: exchanges data
- Astronomy User → Sky Coordinates: creates coordinates
- Astronomy User → WCS API: transforms pixels
- Astronomy User → Cosmology Models: evaluates cosmology
- Astronomy User → Modeling Framework: fits models
- Astronomy User → Statistical Analysis: analyzes data
- Astronomy User → Time Series: analyzes series
- Astronomy User → Scientific Visualization: plots results
- Astropy API → Units Quantities: exposes quantities
- Sky Coordinates → Units Quantities: applies units
- Modeling Framework → Units Quantities: maps units
- WCS API → WCS Pipeline: runs pipeline
- WCS Pipeline → WCS API: calls wcslib
- Scientific Tables → Table Indexing: indexes rows
- Periodogram Dispatch → Time Series: returns power
- Periodogram Dispatch → Multiband Periodograms: supports multiband
- SAMP Messaging → SAMP Hub: registers client
- VO Files → VOTable IO: provides XML
