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

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.0
File Size Uploaded Provenance Actions
qfitswidget-1.3.0.tar.gz 27.0 kB Without provenance Details for qfitswidget-1.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 59.8 kB

Release files / qfitswidget-1.3.0.tar.gz

Download URL qfitswidget-1.3.0.tar.gz
Size 27.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1306ee4558e7efee63c71a00eee21a1cbcb2f5ae445f94a8b8e805c421e0f56b
BLAKE2b-256 checksum
How to use checksums
ba02f3f7205712a14998c8fb82124e3589b781ffe6af5cfc102a2a31a3fde68a
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.0-py3-none-any.whl

Download URL qfitswidget-1.3.0-py3-none-any.whl
Size 32.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1c3cabeb700d9e79eb970afb8941b285005005d67533dafe47b5f6a1bdf8b4b
BLAKE2b-256 checksum
How to use checksums
a7615cba7c69862985657016aed8cce1765f4ddb35335ed8e72dc4dc576dd0e8
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.0

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