Astro Copilot
Give your AI assistant real astronomical data-reduction tools — FITS inspection, photometry, light curves, and spectra, running locally, no external service required.
Why this exists
Doing real astronomical data reduction — aperture photometry, transit fitting, WCS-aware source lookups — normally means writing throwaway Astropy/Photutils/Lightkurve scripts by hand, every time. Astro Copilot exposes that workflow as a set of Model Context Protocol tools, so an LLM like Claude can inspect your FITS files, run photometry, detect sources, extract spectra, and fit light curves directly — with proper error propagation, WCS handling, and quality flags — entirely on your machine. No data leaves your computer, and no astronomy API keys required.
Features
- FITS inspection — HDU structure, header keywords, WCS metadata, and robust image statistics (median, MAD-std, NaN/saturation flags)
- Aperture photometry — circular apertures with local sky-background annulus subtraction, full CCD error propagation (Poisson + read noise), per-source
quality_tier(good/marginal/bad), and out-of-bounds pre-validation - Automatic source detection — peak-finding with auto-estimated background and FWHM, minimum-separation filtering, and per-source SNR
- Light curve analysis — Savitzky-Golay detrending, transit detection via Box Least Squares, periodic-signal detection via Lomb-Scargle, phase-folded diagnostics
- 1D spectrum extraction — sum/median/center-row extraction from 2D spectroscopic FITS, header-based wavelength calibration, spectral feature (line) detection
- Synthetic sample data generator — creates a test FITS image, transit light curve, and variable-star CSV with one call, no external downloads needed
- Security-conscious by design — path traversal validation on every file input, coordinate bounds checking before expensive operations
Install
pip install astro-copilot
Quick Start
from astro_copilot.core.fits_io import inspect_fits_file
from astro_copilot.core.photometry import run_aperture_photometry
# Inspect a FITS file's structure, WCS, and image statistics
info = inspect_fits_file("sample_data/sample_image.fits")
print(info["selected_hdu"]["statistics"]["median"])
# Run aperture photometry on a known pixel position
result = run_aperture_photometry(
file_path="sample_data/sample_image.fits",
aperture_radius=6.0,
positions=[[128.0, 128.0]],
bkg_annulus_inner=9.0,
bkg_annulus_outer=14.0,
)
print(result["sources"][0]["mag"], result["sources"][0]["quality_tier"])
Don't have a FITS file handy? Generate one:
from astro_copilot.server import generate_sample_datasets
generate_sample_datasets("sample_data")
Connect to Claude Desktop
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"astro-copilot": {
"command": "python",
"args": ["-m", "astro_copilot.server"]
}
}
}
Restart Claude Desktop, and the following tools become available in chat: inspect_fits, aperture_photometry, detect_sources_auto, extract_spectrum, fit_lightcurve, and generate_sample_datasets.
Example
Once connected, you can ask Claude directly:
"Run aperture photometry on
sample_image.fitsat pixel (128, 128) with a 6-pixel aperture and a 9–14 pixel background annulus."
Claude calls aperture_photometry and gets back structured JSON like:
{
"status": "success",
"sources": [
{
"id": 1,
"x_px": 128.0,
"y_px": 128.0,
"bkg_subtracted_flux": 94210.5,
"snr": 187.3,
"mag": 15.318,
"mag_err": 0.006,
"quality_tier": "good",
"flags": ["OK"]
}
]
}
More worked examples — including transit detection and WCS-based sky coordinate lookups — are in docs/example_prompts.md. Full tool parameter reference: docs/tools_reference.md.
Roadmap
- PSF-fitting photometry for crowded fields
- Multi-band/multi-epoch batch processing
- Image alignment and stacking helpers
Have a feature request? Open an issue.
Contributing
Contributions are welcome:
- Fork the repo and create a feature branch from
main - Make your change, add or update tests under
tests/, and runpytest -v - Open a pull request describing what changed and why
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file astro_copilot-0.1.0.tar.gz.
File metadata
- Download URL: astro_copilot-0.1.0.tar.gz
- Upload date:
- Size: 26.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e46ab4c5443ad63a9394c56c16dd24f30aa68d832af67970ae99e0756a1b4df
|
|
| MD5 |
5ebfea72f54022e98d8991c7159e1402
|
|
| BLAKE2b-256 |
7d1546f462eb0f1a43deb0dd0099b8a3e1c0afe93b3b8cca69d9fb249cda9677
|
Provenance
The following attestation bundles were made for astro_copilot-0.1.0.tar.gz:
Publisher:
publish.yml on ManiaSacha/Astro-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
astro_copilot-0.1.0.tar.gz -
Subject digest:
1e46ab4c5443ad63a9394c56c16dd24f30aa68d832af67970ae99e0756a1b4df - Sigstore transparency entry: 2655374407
- Sigstore integration time:
-
Permalink:
ManiaSacha/Astro-mcp@cf998d6e1a49069e3f0232a8e041007060ecbba8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ManiaSacha
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cf998d6e1a49069e3f0232a8e041007060ecbba8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file astro_copilot-0.1.0-py3-none-any.whl.
File metadata
- Download URL: astro_copilot-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
953b5d5ca65a20c68362f694acc8b059e7716da3bd85dc3ec00c2d40b8f2712a
|
|
| MD5 |
562b83592291209562041189e9335b22
|
|
| BLAKE2b-256 |
52141b34e623aad1bd57c4ece8394e485782740b22a80170fd7735aede234bd7
|
Provenance
The following attestation bundles were made for astro_copilot-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on ManiaSacha/Astro-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
astro_copilot-0.1.0-py3-none-any.whl -
Subject digest:
953b5d5ca65a20c68362f694acc8b059e7716da3bd85dc3ec00c2d40b8f2712a - Sigstore transparency entry: 2655374422
- Sigstore integration time:
-
Permalink:
ManiaSacha/Astro-mcp@cf998d6e1a49069e3f0232a8e041007060ecbba8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ManiaSacha
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cf998d6e1a49069e3f0232a8e041007060ecbba8 -
Trigger Event:
push
-
Statement type: