Strictly-conformant FITS 4.0 reader and writer.
Project description
Read and write astronomical FITS files with WCS coordinates.
A pure-Rust implementation of FITS file I/O and WCS coordinate
transforms. Reads and writes images of all BITPIX types, binary
and ASCII tables, and random-groups HDUs; reads .fz compressed
images; parses the standard WCS suite plus the SIP, TPV, TNX, and
DSS conventions.
Available as a Python package and a Rust crate.
Python
pip install fitsy
import fitsy
import numpy as np
# Read
with fitsy.open("image.fits") as f:
hdu = f[0] # ImageHdu
data = hdu.data # full array in RAM, native byte order
tile = hdu.section[0:256, 0:256] # decode only this slice (large files)
wcs = hdu.wcs()
ra, dec = wcs.pixel_to_celestial(512.0, 512.0)
# Write
img = fitsy.image(np.zeros((512, 512), dtype=np.float32),
header={"OBJECT": "test"})
fitsy.write("out.fits", [img])
Supports:
- Images of all
BITPIXtypes - Binary and ASCII tables (fixed-width columns)
- Tile-compressed image read (RICE_1, GZIP_1/2, HCOMPRESS_1, PLIO_1)
- Random-groups HDUs
- WCS celestial projections from Paper II + SIP, TPV, TNX, DSS conventions
Build the wheel from source
maturin build --release
# or for local development:
maturin develop --features python
Rust
[dependencies]
fitsy = { version = "0.1", features = ["compression"] }
use fitsy::{FitsFile, Hdu, ImageBuilder, write};
// Read
let file = FitsFile::open("image.fits")?;
let Hdu::Image(img) = file.hdu(0)? else {
return Err("not an image".into());
};
let data = img.read_physical()?; // BZERO/BSCALE applied, f64 output
let wcs = file.wcs(0, ' ')?.unwrap();
let (ra, dec) = wcs.pixel_to_celestial(512.0, 512.0)?;
// Write
let pixels = vec![0.0_f32; 512 * 512];
let hdu = ImageBuilder::new(vec![512u64, 512], pixels)?
.primary(true)
.card("OBJECT", "test", None)
.build()?;
write("out.fits", &[hdu], /* overwrite = */ false)?;
Optional features: compression (default), nalgebra, faer, python.
License
Apache 2.0 or MIT, at your option.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
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 fitsy-0.1.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: fitsy-0.1.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 848.8 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e176ad2eead2d5d50361cf28d68acecd4472097bd79900006b3dc9a354b02a44
|
|
| MD5 |
a71ef2eb546270776744302971eadbf4
|
|
| BLAKE2b-256 |
1d8fcc94596b8e6e9563e5f2922afc1793c942cffdaf239be66ee58451465110
|
Provenance
The following attestation bundles were made for fitsy-0.1.0-cp310-abi3-win_amd64.whl:
Publisher:
release.yml on dahlend/fitsy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fitsy-0.1.0-cp310-abi3-win_amd64.whl -
Subject digest:
e176ad2eead2d5d50361cf28d68acecd4472097bd79900006b3dc9a354b02a44 - Sigstore transparency entry: 1447086571
- Sigstore integration time:
-
Permalink:
dahlend/fitsy@a0c504474a9de68f3aa6e5ccbd4315b1e30144cf -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dahlend
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a0c504474a9de68f3aa6e5ccbd4315b1e30144cf -
Trigger Event:
push
-
Statement type:
File details
Details for the file fitsy-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: fitsy-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 917.3 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6c6428bafdf03ba23a15b1038267656bb2c0bb0445ebdac680b5021b34e6d69
|
|
| MD5 |
3e2d4a537f3ded9cb5640f4703ecc2a5
|
|
| BLAKE2b-256 |
8e913230eb6c4871dfc3722d5c92d0330aef63a2f6dd29c58baa8f358e43a589
|
Provenance
The following attestation bundles were made for fitsy-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on dahlend/fitsy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fitsy-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
b6c6428bafdf03ba23a15b1038267656bb2c0bb0445ebdac680b5021b34e6d69 - Sigstore transparency entry: 1447086713
- Sigstore integration time:
-
Permalink:
dahlend/fitsy@a0c504474a9de68f3aa6e5ccbd4315b1e30144cf -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dahlend
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a0c504474a9de68f3aa6e5ccbd4315b1e30144cf -
Trigger Event:
push
-
Statement type:
File details
Details for the file fitsy-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: fitsy-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 872.1 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
534b42431fec04f4a6ed07869c8daf1837c44e3fca6532e8d3edf6d2e872b21b
|
|
| MD5 |
a8d4ef631b8982c211cd62102a869305
|
|
| BLAKE2b-256 |
699017b9ffbe416c8ec25fe83cae0422d8aca3f985dfaae4ef9aa88ad3d313ca
|
Provenance
The following attestation bundles were made for fitsy-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on dahlend/fitsy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fitsy-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
534b42431fec04f4a6ed07869c8daf1837c44e3fca6532e8d3edf6d2e872b21b - Sigstore transparency entry: 1447086971
- Sigstore integration time:
-
Permalink:
dahlend/fitsy@a0c504474a9de68f3aa6e5ccbd4315b1e30144cf -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dahlend
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a0c504474a9de68f3aa6e5ccbd4315b1e30144cf -
Trigger Event:
push
-
Statement type:
File details
Details for the file fitsy-0.1.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: fitsy-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 852.7 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad4d15552fba92172541332690299f392dc015f0c5e377f775b2d4899775bf18
|
|
| MD5 |
a65e2b10d1086cb47fae7c56f2cdc511
|
|
| BLAKE2b-256 |
6d8e980ecdd4adf873a23506fa325a0a7bd436417693a29c6da6f8c57878012c
|
Provenance
The following attestation bundles were made for fitsy-0.1.0-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on dahlend/fitsy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fitsy-0.1.0-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
ad4d15552fba92172541332690299f392dc015f0c5e377f775b2d4899775bf18 - Sigstore transparency entry: 1447086838
- Sigstore integration time:
-
Permalink:
dahlend/fitsy@a0c504474a9de68f3aa6e5ccbd4315b1e30144cf -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dahlend
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a0c504474a9de68f3aa6e5ccbd4315b1e30144cf -
Trigger Event:
push
-
Statement type:
File details
Details for the file fitsy-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: fitsy-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 894.4 kB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72316b2eb5fbdbaec33881f1364715d68f6ddeee60aa8597ee04c8c271309829
|
|
| MD5 |
1011d9048f3c4b2f6073e26e8d0a5270
|
|
| BLAKE2b-256 |
5c37847f2749bd264ff1709997bea6a9005cdf4e9db1439e0dca253af209f142
|
Provenance
The following attestation bundles were made for fitsy-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on dahlend/fitsy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fitsy-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
72316b2eb5fbdbaec33881f1364715d68f6ddeee60aa8597ee04c8c271309829 - Sigstore transparency entry: 1447086387
- Sigstore integration time:
-
Permalink:
dahlend/fitsy@a0c504474a9de68f3aa6e5ccbd4315b1e30144cf -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dahlend
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a0c504474a9de68f3aa6e5ccbd4315b1e30144cf -
Trigger Event:
push
-
Statement type: