QFitsWidget
A Qt widget for displaying FITS images, written in Python. It works with PySide6 or PyQt via qtpy.
Features
QFitsWidgetshows an astropyPrimaryHDU, 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.
- A customizable context menu. Header entries are Jinja templates, so you can show e.g. the RA/Dec of the clicked position.
QImageWidgetshows raw image data (not FITS) with the same stretch controls, andStretchControlscan 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
- Using icons from Font Awesome, licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/).
Metadata
Release files for qfitswidget 1.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| qfitswidget-1.2.3.tar.gz | 25.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qfitswidget-1.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 56.4 kB
Release files / qfitswidget-1.2.3.tar.gz
| Download URL | qfitswidget-1.2.3.tar.gz |
|---|---|
| Size | 25.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
847906d45c2d39d761394244f106033d11b47de12da4a49dde25d841a08bee10
|
|
BLAKE2b-256 checksum How to use checksums |
89435d3965b0f2ba9c11b5979042a5f9ee89cdddcf70979d2d48a13a0b95874d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / qfitswidget-1.2.3-py3-none-any.whl
| Download URL | qfitswidget-1.2.3-py3-none-any.whl |
|---|---|
| Size | 31.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f30a69bde748e4ef985260c8c925461f3781ce01faddcc062d6389ebe17bf200
|
|
BLAKE2b-256 checksum How to use checksums |
06696194d1bc311af078ebe79477eb75f7bd7e6697276e2edab870da215d8bc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|