Skip to main content

Documentation status MIT license Supported Python versions

Python libraries and command-line tools for interfacing with FITS data in an intuitive way.

FITS numbers its axes from one and writes them fastest-varying-first; numpy does neither. fitstoolz reads the WCS once, gives every axis a name, and lets you use that name everywhere — on the data, on the coordinates, and on the command line — so you never have to work out which convention applies where.

Features

  • Image and coordinate data indexing is consistent

  • Simple API for adding, transposing and expanding axes (or dimensions)

  • Celestial, spectral and Stokes axes evaluated through the WCS rather than approximated by stepping CDELT

  • Xarray support

  • Zarr support

  • A fitstoolz command line whose subcommands double as stimela-ninja pipeline steps

Installation

$ pip install fitstoolz

Requires Python 3.11–3.13. See the installation docs for the development setup.

Example Usage

In[1]: from fitstoolz.reader import FitsData

In[2]: myfits = FitsData("example-image.fits")
       myfits.coord_names

Out[2]: ['STOKES', 'FREQ', 'DEC', 'RA']

In[3]: myfits.dshape
Out[3]: (1, 504, 100, 100) # these dimensions match the labels above

In[4]: myfits.coords

Out[4]:
Coordinates:
STOKES   (stokes) int32 4B dask.array<chunksize=(1,), meta=np.ndarray>
FREQ     (spectral) float64 4kB 8.803e+08 8.804e+08 ... 9.328e+08 9.329e+08
RA       (celestial.ra) float64 800B 53.16 53.16 53.16 ... 53.1 53.1 53.1
DEC      (celestial.dec) float64 800B -28.16 -28.16 ... -28.11 -28.11

From the command line:

$ fitstoolz header image.fits --show
$ fitstoolz stats image.fits --show
$ fitstoolz slice image.fits --axis FREQ,0,64 --outfile cube-sub.fits

Documentation

Full documentation is at fitstoolz.readthedocs.io — including a quickstart and the generated command-line reference.

Contributing

Bug reports, fixes, tests and documentation are all welcome. See CONTRIBUTING.md for the development setup, and AGENTS.md for the design conventions — particularly if your change touches axis ordering or adds a new app. By participating you agree to the Code of Conduct.

Security

A FITS file is untrusted input. SECURITY.md describes what fitstoolz does and does not guarantee about hostile or malformed ones, and how to report a vulnerability privately — please don’t open a public issue for security problems.

License

MIT — see LICENSE.

Metadata

Release files for fitstoolz 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fitstoolz 0.2.1
File Size Uploaded
fitstoolz-0.2.1.tar.gz 69.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fitstoolz 0.2.1
File Interpreter ABI Platform
fitstoolz-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 101.7 kB

Release files / fitstoolz-0.2.1.tar.gz

Download URL fitstoolz-0.2.1.tar.gz
Size 69.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9799a8733edbb801c843c1e6e7149af9fa08d519c45fdfbf690faaa973412fcc
BLAKE2b-256 checksum
How to use checksums
886a2dc6e11ba03644cc493ba6c7916fcc32f428ae1ce3c2817573f3949a9539
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / fitstoolz-0.2.1-py3-none-any.whl

Download URL fitstoolz-0.2.1-py3-none-any.whl
Size 31.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3dee323227e5df91a3687cd62363c7cd450981256859c181e52e23b01ea55ec2
BLAKE2b-256 checksum
How to use checksums
abdf479e90eebc9a4f116ad5c3fffe5a4470cd8adcbb7d4ae3aaa8e8513985ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page