Skip to main content

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

Project description

torchfits

PyPI GitHub release CI Python 3.10+ License: MIT

torchfits is FITS I/O for PyTorch: images and tables as tensors / Arrow, with a multi-threaded C++ engine (vendored CFITSIO). Optional datasets, transforms, and a torchfits CLI sit on top.

Current: 1.0.0rc4 (prerelease). Docs: stable (latest v* tag) · edge (main tip).

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). Source / GPU notes: Install.

At a glance

Task API
Image → tensor torchfits.read_tensor("img.fits", device="cuda")
Write a tensor torchfits.write("out.fits", tensor)
Filter a catalog in C++ torchfits.table.read(..., where="MAG < 20")
Columns as tensors torchfits.table.read_torch(..., where=...)
Open a MEF with torchfits.open("mef.fits") as hdul: …
Train FitsImageDataset + make_loader(..., num_workers=4)
Shell torchfits info / header / convert / cutout / …

Quick start

import torchfits

tensor = torchfits.read_tensor("image.fits", hdu=0, device="cpu")

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
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

Develop

Pixi-first (do not use bare python for project work):

git clone https://github.com/astroai/torchfits.git
cd torchfits
pixi install
pixi run preflight-push   # fast gate while editing
pixi run test             # full unit suite
pixi run ci-local         # pre-push parity

Agent conventions: AGENTS.md. Release process: docs/release.md.

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.0rc4.tar.gz (4.2 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.0rc4-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.0rc4-cp313-cp313-macosx_11_0_arm64.whl (934.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

torchfits-1.0.0rc4-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.0rc4-cp312-cp312-macosx_11_0_arm64.whl (934.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

torchfits-1.0.0rc4-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.0rc4-cp311-cp311-macosx_11_0_arm64.whl (934.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

torchfits-1.0.0rc4-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.0rc4-cp310-cp310-macosx_11_0_arm64.whl (935.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file torchfits-1.0.0rc4.tar.gz.

File metadata

  • Download URL: torchfits-1.0.0rc4.tar.gz
  • Upload date:
  • Size: 4.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for torchfits-1.0.0rc4.tar.gz
Algorithm Hash digest
SHA256 1d9edf027f384794ff78d3cbf6b4bf93275627971cbc1d8f96e193f88e71c899
MD5 d2757b6507ca48dd340144110f9ca005
BLAKE2b-256 5997c0c98f621fb8aaa7096e66969c0e061ebbf148e7858e12eb8c1e00634607

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchfits-1.0.0rc4.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.0rc4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for torchfits-1.0.0rc4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 aedda1c672a2469c8948e56e1311f21fcf4998b3d5af6ba89a56da5f32ae26c9
MD5 6121c4deed7bddcc710f9d8a0f87abf6
BLAKE2b-256 55c9d904be72b637dd0bc27042965762069579fac6ad64e3826b1afbe85b01ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchfits-1.0.0rc4-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.0rc4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for torchfits-1.0.0rc4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5c9fe71e136c34c1853db45aeaa40c81979d82328cc6cf39f302b6164375fd56
MD5 02d674f29c02356eaca11ef4d2512db0
BLAKE2b-256 2aaa7d96a418250eedd9488c554769abcbadeb298135a4de15dfda17cff293d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchfits-1.0.0rc4-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.0rc4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for torchfits-1.0.0rc4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 964a70647b4eea4b06a6dd18c9fad33e7b4d60d949b5d82456591c874f14f0e3
MD5 58371cd78c2b1c9cf223e984d0f95abf
BLAKE2b-256 7d44543ccfc85fedfb7a72b02a7757fb2ca886ec9b794713718b4de103001e82

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchfits-1.0.0rc4-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.0rc4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for torchfits-1.0.0rc4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 19149639903f628c0aafdc91972bb9ee2cf1e8cc5f7107f67214aeff5ac73427
MD5 ca8862bfca7dda2ea23f124040cc0355
BLAKE2b-256 f8c5e2412ba8c48fb86c17c05a76da697c4adb60a5afe2c40b6476605f444586

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchfits-1.0.0rc4-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.0rc4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for torchfits-1.0.0rc4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b74170803d612449a847b78cf41517055a6338011dfcd4d7932495390536c9e0
MD5 474cfb6947a9f90f2879ab599179fefc
BLAKE2b-256 b45c52fcba73ccbe1248d8b13b5b199da13d2cccf545b340ac06603e7b5ff21f

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchfits-1.0.0rc4-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.0rc4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for torchfits-1.0.0rc4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 43ba297a179342b28e1b26a5471f7e9b6c20234e533dbec2665772a3deced0d3
MD5 ec87cb4179d773227749692f8bf32ebb
BLAKE2b-256 4a18c527bd687adf3325e911bc2699594273290a23de7eb3a39e9b2bc08db07e

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchfits-1.0.0rc4-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.0rc4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for torchfits-1.0.0rc4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 28accbb0a401896fd05f9459f139783e19e8abf9b4e8c8b0c896c718e8d84649
MD5 ca1048f8e0595a30fcdc94acc0f27ad9
BLAKE2b-256 a2f4ccf74cffeeca315271f97a686c13b31b4a454cf5ac021956b756a0753b36

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchfits-1.0.0rc4-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.0rc4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for torchfits-1.0.0rc4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 17b04c112500a6112175cd772e4a2d3986a1e0d936ab70911fb6217211dd2f36
MD5 c6e4fe975c629832947457baa94095f2
BLAKE2b-256 3d91af8457d97605fb9f181ef709e5240bef100455ebe775c4d405279528ce1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for torchfits-1.0.0rc4-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