Skip to main content

QFitsWidget

A Qt widget for displaying FITS images, written in Python. It works with PySide6 or PyQt via qtpy.

Features

  • QFitsWidget shows an astropy PrimaryHDU, with cuts, stretch and colormap controls.
  • When the header has a WCS, the sky position under the mouse is available, for example in the context menu.
  • Optional overlays: center mark, compass directions, text overlay and a zoom view. Each one can be switched on and off and has its own color.
  • Image overlays: data layers drawn on top of the image (e.g. a cloud map) with their own colormap and opacity, set with set_overlay(). NaN pixels are transparent, and the values under the mouse are shown in the text overlay.
  • A customizable context menu. Header entries are Jinja templates, so you can show e.g. the RA/Dec of the clicked position.
  • QImageWidget shows raw image data (not FITS) with the same stretch controls, and StretchControls can be used on its own.

Installation

pip install qfitswidget

You also need a Qt binding, for example pip install pyside6.

Usage

import sys

from astropy.io import fits
from qtpy import QtWidgets

from qfitswidget import QFitsWidget, MenuHeader, MenuAction


def offset_telescope(pixel, wcs):
    print(f"Clicked pixel {pixel}, sky position {wcs}")


app = QtWidgets.QApplication(sys.argv)

viewer = QFitsWidget()
viewer.set_menu(
    [
        MenuHeader("RA: {{wcs.ra|hms}}, Dec: {{wcs.dec|dms}}"),
        MenuAction("Offset telescope to position", offset_telescope),
    ]
)
viewer.display(fits.open(sys.argv[1])[0])
viewer.resize(800, 600)
viewer.show()

sys.exit(app.exec())

test.py in this repository is a slightly longer version of this example.

Development

uv sync
uv run pytest

See CONTRIBUTING.md for the full workflow.

License

MIT, see LICENSE.

3rd party

Metadata

Release files for qfitswidget 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qfitswidget 1.3.2
File Size Uploaded Provenance Actions
qfitswidget-1.3.2.tar.gz 27.3 kB Without provenance Details for qfitswidget-1.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qfitswidget 1.3.2
File Interpreter ABI Platform Actions
qfitswidget-1.3.2-py3-none-any.whl Python 3 none any Details for qfitswidget-1.3.2-py3-none-any.whl

Total release size: 60.3 kB

Release files / qfitswidget-1.3.2.tar.gz

Download URL qfitswidget-1.3.2.tar.gz
Size 27.3 kB
Tags Source
SHA-256 checksum
How to use checksums
05884d7f7a0f83c2cd8288176d08362dca0e31fa82cb06d7b47649b49b600cd9
BLAKE2b-256 checksum
How to use checksums
a8a170227aefc9d7ba25c027fce6fab56c6cde93c4a6975ac83c4d6388a16b4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / qfitswidget-1.3.2-py3-none-any.whl

Download URL qfitswidget-1.3.2-py3-none-any.whl
Size 33.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b02e36d17312d5f2bea03f56f20e5954b9a37f82e92a90ea9199493ea3af3506
BLAKE2b-256 checksum
How to use checksums
347c4c76b8450547fefc4641ed1cc64f8ee7eb8dd6d1ef576505a69fe0fd7b54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for qfitswidget 1.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.3.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page