Go to file
Martin Chase a91953e93d
Bypass makeARGB in some cases (#1786)
* refactor out _ndarray_to_qimage()

* combine levels back with lut

* make use of Grayscale8, RGB888 and Indexed8 QImage formats

Grayscale8 and RGB888 images are those that are ready for display
without further processing.

* add Grayscale16

* apply the efflut early for uint16 mono/rgb, uint8 rgb

* ndarray indexing is faster than np.take

* handle uint16 rgb(a) with no levels same as levels=[0, 65535]

* add support for Format_RGBA64

* fix: support colormaps of shape (h, 1)

* check ImageItem uint8 and uint16 QImage formats

* uint16 mono with rgb lut -> RGBX8888

* got width and height swapped in array dimensions

* set ImageItem as row-major

* no need to form a 1d 32-bit lut for array indexing

you can index (y, x) into a lookup table of shape (nentry, 3) or
(nentry, 4) and get an output of shape (y, x, 3) or (y, x, 4)

* Revert "no need to form a 1d 32-bit lut for array indexing"

This reverts commit 45cf3100de.

* distinguish between levels_lut and colors_lut

this allows uint16 images with user lut to be rendered as
Format_Indexed8

* uint8 (1-chan) images should always combine to efflut

this efflut will then be used for Indexed8 format color table.

previously, we would be taking a performance hit with doing a numpy
lookup with levels_lut.

* adapt benchmarks/makeARGB.py to renderImageItem.py

* restructure uint8 and uint16 codepaths

* normalize 1-chan images to ndim==2 earlier up

* refactor long code into functions

* bug: qimage may not be assigned

* fix: assign to self.qimage only if not None

* for uint16, do rescale rather than do levels_lut lookup

* cases 2,3 are already handled

i.e. no more using lut to do rescale of uint16 image data.

* rescale rgb images by computation, not by memory lookup

* setImage() does not take an output argument

* try to be cupy compatible

use "xp" instead of numpy module

* add numba to benchmarking

* fix: lut_big is dtype uint8 with more than 256 entries

* bug: applying colors_lut needs C-order

* support float with no nans

* fix: variable could be uninitialized

* add float32 format tests

* avoid explicitly forcing to C-contiguous

* cache effective lut only if combination took place

every one of the four branches now does its own return.
this makes it easier to follow.

* fix cupy benchmark : typo in renderQImage

* remove for loop of 1 iteration

* use float32 for floating point benchmark

* superceded by renderImageItem.py

* lint

* benchmark without lut conversion

* put the lut onto the substrate

* fix editor complaints

* handle lack of cupy

* leading underscores imply privacy

Co-authored-by: KIU Shueng Chuan <nixchuan@gmail.com>
2021-05-19 17:21:12 -07:00
.github Remove pytest-cov 2021-05-01 14:23:33 -07:00
benchmarks Bypass makeARGB in some cases (#1786) 2021-05-19 17:21:12 -07:00
doc Make plotting with gradients more fun (#1742) 2021-05-06 23:20:21 -07:00
examples Do not attempt to avoid np.log(0), instead ignore the warning 2021-05-16 10:18:23 -07:00
pyqtgraph Bypass makeARGB in some cases (#1786) 2021-05-19 17:21:12 -07:00
tools Do not import value of mutable attribute 2021-04-25 20:08:47 -07:00
.coveragerc MNT: hard code the coverage report location 2015-08-01 11:54:15 -04:00
.flake8 Improve target item - incorporate bits from PR 313 (#1318) 2021-04-10 22:42:44 -07:00
.gitignore Protect makeARGB with tests and benchmarks (#1697) 2021-04-15 15:51:21 -07:00
.pre-commit-config.yaml Expand CI + pre-commit (#991) 2019-08-29 13:56:25 -07:00
.readthedocs.yml Add readthedocs config file as recommended 2020-05-17 16:06:00 -07:00
CHANGELOG Add changelog for 0.12.1 2021-04-06 13:08:49 -07:00
CODE_OF_CONDUCT.md Add a Code of Conduct (#1773) 2021-05-13 15:37:07 -07:00
CONTRIBUTING.md Add a Code of Conduct (#1773) 2021-05-13 15:37:07 -07:00
LICENSE.txt - Major reorganization; we now follow the standard python package structure. 2012-12-26 17:51:52 -05:00
MANIFEST.in manifest corrections 2014-12-24 11:05:05 -05:00
README.md Update README table show not-supported configs 2021-04-16 22:18:11 -07:00
pytest.ini Adjust pytest.ini warning suppressions 2021-04-15 21:09:11 -07:00
setup.py Remove unreachable code 2021-04-25 21:36:23 -07:00
test.py exampleLoaderTemplate.ui : add Qt6 and remove Qt4 2021-01-23 11:43:34 +08:00
tox.ini Update tox.ini config 2021-04-16 22:18:11 -07:00

README.md

PyQtGraph

PyPi conda-forge Build Status CodeQL Status Documentation Status Total alerts Language grade: Python

A pure-Python graphics library for PyQt5/PyQt6/PySide2/PySide6

Copyright 2020 Luke Campagnola, University of North Carolina at Chapel Hill

http://www.pyqtgraph.org

PyQtGraph is intended for use in mathematics / scientific / engineering applications. Despite being written entirely in python, the library is fast due to its heavy leverage of numpy for number crunching, Qt's GraphicsView framework for 2D display, and OpenGL for 3D display.

Requirements

pyqtgraph has adopted NEP 29.

This project supports:

  • All minor versions of Python released 42 months prior to the project, and at minimum the two latest minor versions.
  • All minor versions of numpy released in the 24 months prior to the project, and at minimum the last three minor versions.
  • All minor versions of Qt 5 and Qt 6 currently supported by upstream Qt

Currently this means:

  • Python 3.7+
  • Qt 5.12-6.0
  • Required
    • PyQt5, PyQt6, PySide2 or PySide6
    • numpy 1.17+
  • Optional
    • scipy for image processing
    • pyopengl for 3D graphics
      • pyopengl on macOS Big Sur only works with python 3.9.1+
    • hdf5 for large hdf5 binary format support
    • colorcet for supplemental colormaps
    • cupy for CUDA-enhanced image processing
      • On Windows, CUDA toolkit must be >= 11.1

Qt Bindings Test Matrix

The following table represents the python environments we test in our CI system. Our CI system uses Ubuntu 20.04, Windows Server 2019, and macOS 10.15 base images.

Qt-Bindings Python 3.7 Python 3.8 Python 3.9
PySide2-5.12
PyQt5-5.12
PySide2-5.15
PyQt5-5.15
PySide6-6.0
PyQt6-6.0
  • - Not compatible
  • - Tested

Support

Installation Methods

  • From PyPI:
    • Last released version: pip install pyqtgraph
    • Latest development version: pip install git+https://github.com/pyqtgraph/pyqtgraph@master
  • From conda
    • Last released version: conda install -c conda-forge pyqtgraph
  • To install system-wide from source distribution: python setup.py install
  • Many linux package repositories have release versions.
  • To use with a specific project, simply copy the pyqtgraph subdirectory anywhere that is importable from your project.

Documentation

The official documentation lives at pyqtgraph.readthedocs.io

The easiest way to learn pyqtgraph is to browse through the examples; run python -m pyqtgraph.examples to launch the examples application.

Used By

Here is a partial listing of some of the applications that make use of PyQtGraph!

Do you use PyQtGraph in your own project, and want to add it to the list? Submit a pull request to update this listing!