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.0.tar.gz (61.0 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.0-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fitstoolz-0.2.0.tar.gz
  • Upload date:
  • Size: 61.0 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.0.tar.gz
Algorithm Hash digest
SHA256 6c40ff97c14b87b730f177a73e6e599d86a73c4335d7cefd2dba868b1759934e
MD5 3ce3100824b3959d7861e6d54e68efa3
BLAKE2b-256 7ad7e1e08273b9f06fc472d16f354d243366bf4f766dbbe4e6c87897e08a02fb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fitstoolz-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 28.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 149acd907c95efdfd7a5d89f53b6e021d93ba1a264159154621a89f4d0da37ba
MD5 6222239b9aae11ea6f42fa202638bd03
BLAKE2b-256 f1b5becc0c9dc92f948f20d7a1fef6f15e798cd320708e0b5c73c7fb977d7d3d

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