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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fitstoolz-0.2.1.tar.gz (69.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fitstoolz-0.2.1-py3-none-any.whl (31.9 kB view details)

Uploaded Python 3

File details

Details for the file fitstoolz-0.2.1.tar.gz.

File metadata

  • Download URL: fitstoolz-0.2.1.tar.gz
  • Upload date:
  • Size: 69.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fitstoolz-0.2.1.tar.gz
Algorithm Hash digest
SHA256 9799a8733edbb801c843c1e6e7149af9fa08d519c45fdfbf690faaa973412fcc
MD5 103db34b6d31a5c39cc4ba6fdc72687b
BLAKE2b-256 886a2dc6e11ba03644cc493ba6c7916fcc32f428ae1ce3c2817573f3949a9539

See more details on using hashes here.

File details

Details for the file fitstoolz-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: fitstoolz-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 31.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fitstoolz-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3dee323227e5df91a3687cd62363c7cd450981256859c181e52e23b01ea55ec2
MD5 77710412299b0d8a8aaf2e994d276e7c
BLAKE2b-256 abdf479e90eebc9a4f116ad5c3fffe5a4470cd8adcbb7d4ae3aaa8e8513985ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page