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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fitstoolz-0.1.0.tar.gz.
File metadata
- Download URL: fitstoolz-0.1.0.tar.gz
- Upload date:
- Size: 45.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
838478a84b7b446d00c8aa3d89008ecc30477f24553f48f0c6f08ade53221ef9
|
|
| MD5 |
925021c17bb0abaef33662006e1185d7
|
|
| BLAKE2b-256 |
87126d22b187cae3222cc7190aa524ee84340e806c3a6dde3b4fecf57a26e8c9
|
File details
Details for the file fitstoolz-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fitstoolz-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79f4d620240da19af0a5b47ca376dcf1d5608dcde08cd7374f1c2044efc364ff
|
|
| MD5 |
b1a317d25e6d4895fed4f57db1689304
|
|
| BLAKE2b-256 |
3be9d1a7686268eb4d9fd432248a7e4072c769d59d6ba0fe767e13a6e3fb9e5c
|