Skip to main content

FITS I/O for PyTorch with native tensor reads, datasets, and transforms

Project description

torchfits

PyPI CI Python 3.10+ License: MIT

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

MIT

Project details


Download files

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

Source Distribution

torchfits-1.0.0rc1.tar.gz (4.8 MB view details)

Uploaded Source

Built Distributions

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

torchfits-1.0.0rc1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

torchfits-1.0.0rc1-cp313-cp313-macosx_11_0_arm64.whl (918.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

torchfits-1.0.0rc1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

torchfits-1.0.0rc1-cp312-cp312-macosx_11_0_arm64.whl (918.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

torchfits-1.0.0rc1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

torchfits-1.0.0rc1-cp311-cp311-macosx_11_0_arm64.whl (920.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

torchfits-1.0.0rc1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

torchfits-1.0.0rc1-cp310-cp310-macosx_11_0_arm64.whl (920.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Hashes for torchfits-1.0.0rc1.tar.gz
Algorithm Hash digest
SHA256 ed8f973e63c2baacda1ae18036529e3ebd7c7f1eb63f119500cdd879da418c45
MD5 b623601ddaf8c06579eb870fb408d9b0
BLAKE2b-256 e6ab3c12d8b44e2c24aebe6b40ba191fd6ef2bf38856ae3182c06b78f503a2d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchfits-1.0.0rc1.tar.gz:

Publisher: build_wheels.yml on astroai/torchfits

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

File hashes

Hashes for torchfits-1.0.0rc1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7af9c900bbffa5a88c3a8507be15b4c99dd42aba2bbec8394bd6019f9923ce66
MD5 615a7c55afa839dca4fafe3e6a5117d5
BLAKE2b-256 6d45ce3b37a13ef458589dc6214995820ecedda3ea362e98b9b6409d2189c211

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file torchfits-1.0.0rc1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for torchfits-1.0.0rc1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a65717b81eb0044626b11b2fd937a3de00736ffe5afd1941c177eb9615c5e733
MD5 1364282b41fa0e74bc7a0f01fe2e4867
BLAKE2b-256 71db0922afaecd6ec4d42117bfb0a5b2ec2245b62b2cb1b3f8640f2c8393cb32

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

File hashes

Hashes for torchfits-1.0.0rc1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5f9d52d88819bf81722d5a30cd62f1639c40e52402accb6b44623ddf9b9234d1
MD5 747f868c56b703d1d1266f7bc703ff12
BLAKE2b-256 f4f7418ae5070926d4828905a9215cf03defaec4aae9ca4722bb006f0e0a4b4b

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file torchfits-1.0.0rc1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for torchfits-1.0.0rc1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 119a4bb87e0ac0ea25d2b03621c6216b8f31b63ca4195204ad251489b328af36
MD5 611fab08debbaa73da8874467c67a9c7
BLAKE2b-256 c87242546a2e2ed524e28ac442fc65eba9a68af52f8287e7b3357cf0d7fdc355

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

File hashes

Hashes for torchfits-1.0.0rc1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e6570d70e334eded3fda479baac09c1f3f2a02800e72ec54be9255f8838bd45e
MD5 d41e4dc4b49857c323c3692b378f6d7f
BLAKE2b-256 0945270a7283a066521041211fab89b036cba6bbef2f91c6adfb86ef6373d975

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file torchfits-1.0.0rc1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for torchfits-1.0.0rc1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 23c1e0db0e6f6bb318a2eae4d7b62459e29b04248719a01d50b32fcb957f0528
MD5 a1d47d438f1692ebb618c484d1d8b33b
BLAKE2b-256 34170ada67b092b57154655406ab775a5fbfc9ea322b8688145f771e6132ac2c

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

File hashes

Hashes for torchfits-1.0.0rc1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8394bcfbefb0b836fdd18f52f335e0de66bd3b7bf1b81c527f6e84dcd2e5c8dc
MD5 ea7e29762abffbabcb2214ab975cfd66
BLAKE2b-256 c9531cffd8b893ec2d3679e9f6d98639f60a351911d8d4fbe92d97fc3aee1b9f

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file torchfits-1.0.0rc1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for torchfits-1.0.0rc1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4e4d1ad599549814ce04502a7aa4074e79dccf2c87a1d90b7b15ed11ad83ab7e
MD5 ad2665cce9d1db0de769966304348370
BLAKE2b-256 75de75fb1752a27de74b3b4a184326e03744f0120345bb43a716e445c8cb3fc5

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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