Skip to main content

fitstoolz

Documentation status Apache License 2.0 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.

Academic attribution

Please acknowledge this project and its contributors when using the work in research, and cite the associated publications and software release where applicable. This is a scholarly request, not an additional licence condition. Citation information can be found in CITATION.cff.

Origins

fitstoolz is a partial rewrite of Owlcat’s Owlcat/FitsTool.py. Sphesihle Makhathini, a contributor to Owlcat, developed it into a standalone package to modernise and expand those FITS tools. Credit goes to the Owlcat contributors for the original work; see NOTICE for attribution.

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 native fitstoolz command line; install fitstoolz[ninja] to use its subcommands 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

Apache License 2.0 — see LICENSE and NOTICE.

Metadata

Release files for fitstoolz 0.2.2

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.2
File Size Uploaded
fitstoolz-0.2.2.tar.gz 79.9 kB Details

Built distribution (wheel)

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

Total release size: 119.6 kB

Release files / fitstoolz-0.2.2.tar.gz

Download URL fitstoolz-0.2.2.tar.gz
Size 79.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a375e5a307feb8edfb9ba5f2b1736e9d8234f46f36821705ab1cbb57f7d8a45f
BLAKE2b-256 checksum
How to use checksums
bc349427f0067f083ad07d620527a5661a24406ceaf43a1035cded09dc8e8e24
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.2-py3-none-any.whl

Download URL fitstoolz-0.2.2-py3-none-any.whl
Size 39.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3045d9fdc9d5843304825424a55cfcb0a2813763937c33800f12feed8b44356
BLAKE2b-256 checksum
How to use checksums
3648c1ef62f0e1029caf5aafa949bdc6aeabe72e863d966ea1583d358ea85d34
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.2 This release

2 release files

0.2.1

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