fitsio
A full featured python library to read from and write to FITS files.
Decision gist · record as of 2026-08-14
Yes, if you work with FITS files in astronomy or related fields. The package is actively maintained, has no known vulnerabilities, and provides efficient partial-read access that astropy.io.fits does not. The GPL-2.0-or-later license is a blocker only if your project is proprietary and cannot adopt copyleft terms. For academic and open-source astronomy work, it is a solid, well-established choice.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >= 3.10; C extension compilation needed (pre-built wheels available for common platforms).
- Medium install friction due to C extension compilation, but pre-built wheels are available for current Python versions (3.10–3.13) across macOS, Linux, and Windows.
- Active maintenance with a recent release (29 days old) and a bundled cfitsio library eliminates external dependency conflicts.
License · maintenance · safety
GPL-2.0-or-later (copyleft) — Licensed under GPL-2.0-or-later (copyleft). Any derivative work or modification must be distributed under the same or compatible GPL license; proprietary closed-source projects cannot use this package without legal review.
last release 2026-07-16 (29 days) · last repo commit 2026-08-14 · 149 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 87,043 downloads/mo, #13,817 on PyPI
Alternatives
Verify before relying
import fitsio
import numpy as np
# Read all data from first HDU
data = fitsio.read('data.fits')
# Read subset of rows and columns
data = fitsio.read('data.fits', rows=[35, 1001], columns=['x', 'y'], ext=2)
# Write a new FITS file with a binary table
data = np.zeros(10, dtype=[('id', 'i8'), ('ra', 'f8'), ('dec', 'f8')])
fitsio.write('output.fits', data)- Performance characteristics for very large FITS files (memory usage, read/write speed).
- Completeness of support for all FITS compression formats (RICE, GZIP, PLIO, HCOMPRESS) in current version.
- Compatibility with FITS files produced by other major astronomy software (e.g., CFITSIO, astropy.io.fits).
What it is and what it does
fitsio is a Python wrapper around cfitsio that provides direct, efficient access to FITS files—the standard data format in astronomy. It reads and writes image arrays, binary tables, and ASCII tables into NumPy arrays, with support for partial reads (subsets of rows and columns) without loading entire files into memory. The library handles variable-length columns, compressed images, multiple HDU extensions, header keyword manipulation, and row filtering.
The package bundles its own cfitsio library, so no external system dependency is required. It supports slice notation similar to NumPy arrays and memmap, making it natural for Python users familiar with NumPy. Active maintenance and broad wheel availability (Python 3.10–3.13 on macOS, Linux, Windows) keep install friction moderate despite the C extension.
Use it for
- Load astronomical survey data (images, catalogs) from FITS files into NumPy for analysis without reading entire files into memory.
- Extract specific columns and row ranges from large FITS binary tables for statistical or machine-learning pipelines.
- Write processed astronomical data back to FITS format with proper headers and metadata for archival or sharing with collaborators.
- Iterate over rows in a FITS table with buffering for efficient streaming processing of large catalogs.
- Read and modify FITS header keywords (e.g., WCS, photometric calibration metadata) for data reduction workflows.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you work with FITS files in astronomy or related fields.
The package is actively maintained, has no known vulnerabilities, and provides efficient partial-read access that astropy.io.fits does not. The GPL-2.0-or-later license is a blocker only if your project is proprietary and cannot adopt copyleft terms. For academic and open-source astronomy work, it is a solid, well-established choice.
Install
fitsio on PyPI
Before you install
Medium install friction due to C extension compilation, but pre-built wheels are available for current Python versions (3.10–3.13) across macOS, Linux, and Windows. Active maintenance with a recent release (29 days old) and a bundled cfitsio library eliminates external dependency conflicts.
Requires Python >= 3.10; C extension compilation needed (pre-built wheels available for common platforms).
License in practice
Licensed under GPL-2.0-or-later (copyleft). Any derivative work or modification must be distributed under the same or compatible GPL license; proprietary closed-source projects cannot use this package without legal review.
Quickstart
import fitsio
import numpy as np
# Read all data from first HDU
data = fitsio.read('data.fits')
# Read subset of rows and columns
data = fitsio.read('data.fits', rows=[35, 1001], columns=['x', 'y'], ext=2)
# Write a new FITS file with a binary table
data = np.zeros(10, dtype=[('id', 'i8'), ('ra', 'f8'), ('dec', 'f8')])
fitsio.write('output.fits', data)
Verify before relying
- Performance characteristics for very large FITS files (memory usage, read/write speed).
- Completeness of support for all FITS compression formats (RICE, GZIP, PLIO, HCOMPRESS) in current version.
- Compatibility with FITS files produced by other major astronomy software (e.g., CFITSIO, astropy.io.fits).
Package facts
| License | GPL-2.0-or-later copyleft |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 1 packagenumpy |
| Maintenance | Actively maintained 29 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 87,043 / month, #13,817 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: Science/ResearchTopic :: Scientific/Engineering :: Astronomy |
Evidence: fitsio-1.4.2-cp310-cp310-macosx_13_0_x86_64.whl; fitsio-1.4.2-cp310-cp310-macosx_14_0_arm64.whl; fitsio-1.4.2-cp310-cp310-manylinux_2_28_x86_64.whl; fitsio-1.4.2-cp310-cp310-musllinux_1_2_x86_64.whl; fitsio-1.4.2-cp310-cp310-win_amd64.whl; fitsio-1.4.2-cp311-cp311-macosx_13_0_x86_64.whl; fitsio-1.4.2-cp311-cp311-macosx_14_0_arm64.whl; fitsio-1.4.2-cp311-cp311-manylinux_2_28_x86_64.whl; fitsio-1.4.2-cp311-cp311-musllinux_1_2_x86_64.whl; fitsio-1.4.2-cp311-cp311-win_amd64.whl; fitsio-1.4.2-cp312-cp312-macosx_13_0_x86_64.whl; fitsio-1.4.2-cp312-cp312-macosx_14_0_arm64.whl; fitsio-1.4.2-cp312-cp312-manylinux_2_28_x86_64.whl; fitsio-1.4.2-cp312-cp312-musllinux_1_2_x86_64.whl; fitsio-1.4.2-cp312-cp312-win_amd64.whl; fitsio-1.4.2-cp313-cp313-macosx_13_0_x86_64.whl; fitsio-1.4.2-cp313-cp313-macosx_14_0_arm64.whl; fitsio-1.4.2-cp313-cp313-manylinux_2_28_x86_64.whl; fitsio-1.4.2-cp313-cp313-musllinux_1_2_x86_64.whl; fitsio-1.4.2-cp313-cp313-win_amd64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “FITS file read write”
- fitsiofitsio reads and writes FITS (Flexible Image Data Format) files, the…
- scmreposcmrepo provides an fsspec-based filesystem interface to Git…
- aiofileProvides asynchronous file I/O operations for asyncio programs, with…
Give your agent the search over MCP, or paste the wish link into any chat.
More Astronomy packages
Albumentations applies image transformations to training data, supporting classification, segmentation, object detection, and pose estimation with a unified API for images, masks, bounding boxes, and keypoints.
Install it if you need a unified, production-grade augmentation API for computer vision tasks.
Converts dates between the Gregorian calendar and 15+ alternative calendar systems including Hebrew, Islamic, Julian, French Republican, Mayan, and others, plus calculates holidays across North American, Jewish, and other traditions.
Install only if you actually need multi-calendar support; the single pymeeus dependency is manageable.
Converts between Julian dates and Gregorian or Julian calendar dates, storing Julian dates as pairs of floating-point numbers for maximum precision.
However, be aware that it will not receive bug fixes or updates—verify that its behavior matches your requirements before committing to it in a production system.
PyERFA wraps the ERFA C library (Essential Routines for Fundamental Astronomy) as NumPy universal functions, exposing key astronomy algorithms for scalar or array inputs.
Install it if you need fundamental astronomy calculations or if another package depends on it.
PyMeeus implements astronomical algorithms from Jean Meeus's classical reference, providing Python classes for computing celestial positions, lunar phases, planetary phenomena, and time conversions with minimal dependencies.
However, verify Python version compatibility first and consider whether other libraries better suit production-grade use cases.
PyEphem computes high-precision positions of planets, moons, stars, comets, and asteroids in the sky for any observer location and date, using C-based numeric routines from the XEphem astronomy application.
See also RoffIO · PyAVM · lasio · texttable · asdf · python-lzf · sttable · ImageIO · missingpy