FITS I/O for PyTorch with native tensor reads, datasets, and transforms
Project description
torchfits
torchfits reads and writes FITS as PyTorch tensors and Arrow dataframes.
A multi-threaded C++ engine (vendored CFITSIO) handles images, tables, headers,
compression, and MEF files. Optional datasets, transforms, and a torchfits
CLI sit on top.
Current release: 1.0b1. Docs: astroai.github.io/torchfits.
Install
pip install torchfits
Requires Python 3.10+ and PyTorch 2.10. Pre-built wheels for Linux x86_64 and macOS arm64 (CFITSIO is vendored).
At a Glance
| Task | torchfits |
|---|---|
| Image → GPU tensor | torchfits.read_tensor("img.fits", device="cuda") |
| Write a tensor | torchfits.write("out.fits", tensor) |
| Filter a catalog in C++ | table.read(..., where="MAG < 20") |
| Open a MEF | with torchfits.open("mef.fits") as hdul: … |
| Train | FitsImageDataset + make_loader(..., num_workers=4) |
| Shell | torchfits info / header / convert / … |
Quick Start
import torchfits
tensor = torchfits.read_tensor("image.fits", hdu=0, device="cpu")
# FITS tables → dataframes (Arrow by default)
table = torchfits.table.read(
"catalog.fits",
columns=["RA", "DEC", "MAG_G"],
where="MAG_G < 20.0",
)
torchfits info science.fits
torchfits convert catalog.fits out.parquet --hdu 1 # --to optional
torchfits cutout 'science.fits[100:256,100:256]' cutout.fits
Learn more
| Documentation | Quickstart, API, CLI, galleries |
| Examples | Runnable scripts + transform plots |
| Benchmarks | Methodology and scorecards |
| Changelog | Release notes |
Contributing
git clone https://github.com/astroai/torchfits.git
cd torchfits
pixi install
pixi run test
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 torchfits-1.0.0rc1.tar.gz.
File metadata
- Download URL: torchfits-1.0.0rc1.tar.gz
- Upload date:
- Size: 4.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed8f973e63c2baacda1ae18036529e3ebd7c7f1eb63f119500cdd879da418c45
|
|
| MD5 |
b623601ddaf8c06579eb870fb408d9b0
|
|
| BLAKE2b-256 |
e6ab3c12d8b44e2c24aebe6b40ba191fd6ef2bf38856ae3182c06b78f503a2d2
|
Provenance
The following attestation bundles were made for torchfits-1.0.0rc1.tar.gz:
Publisher:
build_wheels.yml on astroai/torchfits
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torchfits-1.0.0rc1.tar.gz -
Subject digest:
ed8f973e63c2baacda1ae18036529e3ebd7c7f1eb63f119500cdd879da418c45 - Sigstore transparency entry: 2193520772
- Sigstore integration time:
-
Permalink:
astroai/torchfits@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Branch / Tag:
refs/tags/v1.0.0rc1 - Owner: https://github.com/astroai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheels.yml@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file torchfits-1.0.0rc1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: torchfits-1.0.0rc1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.13, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7af9c900bbffa5a88c3a8507be15b4c99dd42aba2bbec8394bd6019f9923ce66
|
|
| MD5 |
615a7c55afa839dca4fafe3e6a5117d5
|
|
| BLAKE2b-256 |
6d45ce3b37a13ef458589dc6214995820ecedda3ea362e98b9b6409d2189c211
|
Provenance
The following attestation bundles were made for torchfits-1.0.0rc1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
build_wheels.yml on astroai/torchfits
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torchfits-1.0.0rc1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
7af9c900bbffa5a88c3a8507be15b4c99dd42aba2bbec8394bd6019f9923ce66 - Sigstore transparency entry: 2193520800
- Sigstore integration time:
-
Permalink:
astroai/torchfits@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Branch / Tag:
refs/tags/v1.0.0rc1 - Owner: https://github.com/astroai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheels.yml@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file torchfits-1.0.0rc1-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: torchfits-1.0.0rc1-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 918.8 kB
- Tags: CPython 3.13, 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 |
a65717b81eb0044626b11b2fd937a3de00736ffe5afd1941c177eb9615c5e733
|
|
| MD5 |
1364282b41fa0e74bc7a0f01fe2e4867
|
|
| BLAKE2b-256 |
71db0922afaecd6ec4d42117bfb0a5b2ec2245b62b2cb1b3f8640f2c8393cb32
|
Provenance
The following attestation bundles were made for torchfits-1.0.0rc1-cp313-cp313-macosx_11_0_arm64.whl:
Publisher:
build_wheels.yml on astroai/torchfits
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torchfits-1.0.0rc1-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
a65717b81eb0044626b11b2fd937a3de00736ffe5afd1941c177eb9615c5e733 - Sigstore transparency entry: 2193520791
- Sigstore integration time:
-
Permalink:
astroai/torchfits@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Branch / Tag:
refs/tags/v1.0.0rc1 - Owner: https://github.com/astroai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheels.yml@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file torchfits-1.0.0rc1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: torchfits-1.0.0rc1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.12, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f9d52d88819bf81722d5a30cd62f1639c40e52402accb6b44623ddf9b9234d1
|
|
| MD5 |
747f868c56b703d1d1266f7bc703ff12
|
|
| BLAKE2b-256 |
f4f7418ae5070926d4828905a9215cf03defaec4aae9ca4722bb006f0e0a4b4b
|
Provenance
The following attestation bundles were made for torchfits-1.0.0rc1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
build_wheels.yml on astroai/torchfits
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torchfits-1.0.0rc1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
5f9d52d88819bf81722d5a30cd62f1639c40e52402accb6b44623ddf9b9234d1 - Sigstore transparency entry: 2193520848
- Sigstore integration time:
-
Permalink:
astroai/torchfits@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Branch / Tag:
refs/tags/v1.0.0rc1 - Owner: https://github.com/astroai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheels.yml@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file torchfits-1.0.0rc1-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: torchfits-1.0.0rc1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 918.8 kB
- Tags: CPython 3.12, 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 |
119a4bb87e0ac0ea25d2b03621c6216b8f31b63ca4195204ad251489b328af36
|
|
| MD5 |
611fab08debbaa73da8874467c67a9c7
|
|
| BLAKE2b-256 |
c87242546a2e2ed524e28ac442fc65eba9a68af52f8287e7b3357cf0d7fdc355
|
Provenance
The following attestation bundles were made for torchfits-1.0.0rc1-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
build_wheels.yml on astroai/torchfits
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torchfits-1.0.0rc1-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
119a4bb87e0ac0ea25d2b03621c6216b8f31b63ca4195204ad251489b328af36 - Sigstore transparency entry: 2193520822
- Sigstore integration time:
-
Permalink:
astroai/torchfits@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Branch / Tag:
refs/tags/v1.0.0rc1 - Owner: https://github.com/astroai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheels.yml@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file torchfits-1.0.0rc1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: torchfits-1.0.0rc1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6570d70e334eded3fda479baac09c1f3f2a02800e72ec54be9255f8838bd45e
|
|
| MD5 |
d41e4dc4b49857c323c3692b378f6d7f
|
|
| BLAKE2b-256 |
0945270a7283a066521041211fab89b036cba6bbef2f91c6adfb86ef6373d975
|
Provenance
The following attestation bundles were made for torchfits-1.0.0rc1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
build_wheels.yml on astroai/torchfits
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torchfits-1.0.0rc1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
e6570d70e334eded3fda479baac09c1f3f2a02800e72ec54be9255f8838bd45e - Sigstore transparency entry: 2193520810
- Sigstore integration time:
-
Permalink:
astroai/torchfits@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Branch / Tag:
refs/tags/v1.0.0rc1 - Owner: https://github.com/astroai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheels.yml@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file torchfits-1.0.0rc1-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: torchfits-1.0.0rc1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 920.1 kB
- Tags: CPython 3.11, 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 |
23c1e0db0e6f6bb318a2eae4d7b62459e29b04248719a01d50b32fcb957f0528
|
|
| MD5 |
a1d47d438f1692ebb618c484d1d8b33b
|
|
| BLAKE2b-256 |
34170ada67b092b57154655406ab775a5fbfc9ea322b8688145f771e6132ac2c
|
Provenance
The following attestation bundles were made for torchfits-1.0.0rc1-cp311-cp311-macosx_11_0_arm64.whl:
Publisher:
build_wheels.yml on astroai/torchfits
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torchfits-1.0.0rc1-cp311-cp311-macosx_11_0_arm64.whl -
Subject digest:
23c1e0db0e6f6bb318a2eae4d7b62459e29b04248719a01d50b32fcb957f0528 - Sigstore transparency entry: 2193520833
- Sigstore integration time:
-
Permalink:
astroai/torchfits@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Branch / Tag:
refs/tags/v1.0.0rc1 - Owner: https://github.com/astroai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheels.yml@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file torchfits-1.0.0rc1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: torchfits-1.0.0rc1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8394bcfbefb0b836fdd18f52f335e0de66bd3b7bf1b81c527f6e84dcd2e5c8dc
|
|
| MD5 |
ea7e29762abffbabcb2214ab975cfd66
|
|
| BLAKE2b-256 |
c9531cffd8b893ec2d3679e9f6d98639f60a351911d8d4fbe92d97fc3aee1b9f
|
Provenance
The following attestation bundles were made for torchfits-1.0.0rc1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
build_wheels.yml on astroai/torchfits
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torchfits-1.0.0rc1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
8394bcfbefb0b836fdd18f52f335e0de66bd3b7bf1b81c527f6e84dcd2e5c8dc - Sigstore transparency entry: 2193520779
- Sigstore integration time:
-
Permalink:
astroai/torchfits@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Branch / Tag:
refs/tags/v1.0.0rc1 - Owner: https://github.com/astroai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheels.yml@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file torchfits-1.0.0rc1-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: torchfits-1.0.0rc1-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 920.5 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 |
4e4d1ad599549814ce04502a7aa4074e79dccf2c87a1d90b7b15ed11ad83ab7e
|
|
| MD5 |
ad2665cce9d1db0de769966304348370
|
|
| BLAKE2b-256 |
75de75fb1752a27de74b3b4a184326e03744f0120345bb43a716e445c8cb3fc5
|
Provenance
The following attestation bundles were made for torchfits-1.0.0rc1-cp310-cp310-macosx_11_0_arm64.whl:
Publisher:
build_wheels.yml on astroai/torchfits
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torchfits-1.0.0rc1-cp310-cp310-macosx_11_0_arm64.whl -
Subject digest:
4e4d1ad599549814ce04502a7aa4074e79dccf2c87a1d90b7b15ed11ad83ab7e - Sigstore transparency entry: 2193520842
- Sigstore integration time:
-
Permalink:
astroai/torchfits@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Branch / Tag:
refs/tags/v1.0.0rc1 - Owner: https://github.com/astroai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheels.yml@7837b56bfb46f8629ac1f89e0facfadfdfc661b8 -
Trigger Event:
push
-
Statement type: