Commit Graph

2919 Commits

Author SHA1 Message Date
Ogi Moore
c0b9f3e26e
Merge pull request #1795 from pijyoi/avoid_writable_qimage
don't rely on QImage-wrapped buffer being writable
2021-06-01 23:05:01 -07:00
Ogi Moore
45cf6fa232 Remove comment about QImage data references
Comment was out of date and no longer relevant, removing at @pijyoi's
suggestion.
2021-06-01 22:50:02 -07:00
Nils Nemitz
39f705fd7f
Sanitize input for plotItem.showGrid (was documentation fix for plotItem.showGrid alpha setting) (#1809)
* documentation fix for plotItem.showGrid alpha setting

* revert to 0-1 scale
2021-06-01 22:43:58 -07:00
Ogi Moore
0da1958ff1
Merge pull request #1768 from pijyoi/rgb32_alpha_chan
Format_RGB32 will always have alpha equal 255
2021-06-01 22:25:08 -07:00
3DAlgoLab
28b1499f09
Force cameraPosition() to return Vector class. (#1799)
* Update GLViewWidget.py

Fix the wrong conversion of QVector3D to numpy array.

* new way to fix the conversion error

* Recover prev. version of pixelSize

Co-authored-by: Jaeyoon Jeong <diem389@gmail.com>
2021-06-01 22:21:50 -07:00
Ogi Moore
4264219144 Add PyQt6 version check for QByteArray creation 2021-06-01 22:01:58 -07:00
Ogi Moore
f01f3d473f Have debug.printExc emits RuntimeWarning
Several bugs have snuck through due to being wrapped with printExc,
which would prevent the exception from raising, but printing the trace
to the console.  In pytest, this output is not captured at all, and is
invisible unless the -s parameter is added.

This PR changes the print statement to a runtime warning, which pytest
will capture.
2021-05-31 21:06:16 -07:00
Ogi Moore
c7675ca8bb Fix unraisable exception in test_examples
The way we called subprocess.Popen, it looks like we didn't close all
the pipes; this PR addresses the warning that pytest generates when
running the examples.

In addition, we toggle the pytest setting to error on any warning
2021-05-31 21:06:16 -07:00
Ogi Moore
d72be799d7 Catch and Address Warnings in test_svg and pytest.ini
On Windows, pyreadline is emitting a deprecation warning we can ignore.
Furthermore, test_svg was using NamedTemporaryFile in a manner that was
causing permission denied errors, so this commit switches to the use of
pytest friendly temporary files
2021-05-31 21:06:16 -07:00
Ogi Moore
d859cec95a Replace uses of tempfile.mktemp with tempfile.NamedTemporaryFile
This issue was flagged as a security issue in the static code analyzer
2021-05-31 21:06:16 -07:00
Ogi Moore
ceeacf4e5f Remove test_exit_crash.py
This file contains two tests, one of which has been skipped forever,
and the second (test_pg_exit) has been a flakey test that does not test
in general, testing a use-case we likely do not see any more.  So
therefore I am removing this test from the library.
2021-05-31 21:06:16 -07:00
Ogi Moore
ab792a73a6 Address in-tree-build deprecation issue in pip 2021-05-31 21:06:16 -07:00
Ogi Moore
4224fe5664 Avoid permissions issues on windows CI 2021-05-31 21:06:16 -07:00
Ogi Moore
1d55fde41a Suppress non-relevant deprecation warning 2021-05-31 21:06:16 -07:00
Ogi Moore
d519630d14 Fix check for equality between floats
While this fix prevents an assertion error, the assertion error was
being suppressed; and was only noticeable via pytest -s where the error
was printed to console.  Future work should be done to minimize the use
of bare exceptions so these tests do not fail silently
2021-05-31 21:06:16 -07:00
Ogi Moore
648b8c7df4 Fix issue with int comparson impacting Qt6 2021-05-31 21:06:16 -07:00
Ogi Moore
ee951331be Close the example app after it launches 2021-05-31 21:06:16 -07:00
Ogi Moore
e7a30b9324 Clean up test files
Remove if __name__ == "__main__" bits, replace some == None to is None
checks

Cleanup variety of static code checker issue

Removed missing imports, restructured some logic to make a little
cleaner, fixed a function in test_dockarea, unfortunately broke the test
so now I tell pytest to expect the Exception.
2021-05-31 21:06:16 -07:00
Ogi Moore
0160de22fb Remove QApplication.instance() deleteLater call
the test_signalproxy.py had a fixture for the QApplication instance,
only problem is at the end of each use of the fixture, it would mark
the application instance for deletion, which is most definitely not what
we want
2021-05-31 21:06:16 -07:00
Ogi Moore
a6971c768d Move and Update test-data repo into pyqtgraph repo
To reduce complexity, and make it easier to add more images and tests,
the images in the `test-data` repository should be merged with the main
repository.  Furthermore, we can remove a lot of the subprocess work in
the image_testing.py file, as we no longer need to have it interact with
git.

The images are not the same.  Images were regenerated with Qt6, and now
have proper big and little endian handling thanks to @pijyoi

Second commit is a slightly modified variant of
2e135ab282d6007b34a3854921be54d0e9efb241 authored by @pijyoi
it is to convert qimages to RGBA8888 for testing.  Image
files were regenerated images for the big/little handling

Fixed issue with bogus test from test_NonUniformImage and generated a
new image
2021-05-31 21:05:00 -07:00
KIU Shueng Chuan
cabcf6cd29 pairs: allocate and manipulate dest polygon buffer directly 2021-05-27 23:31:05 -07:00
KIU Shueng Chuan
8f4104a9ab use qpolygonf underlying buffer as backstore 2021-05-27 19:07:50 -07:00
Ogi Moore
270fc59cab Insert NaN values for connect='pairs' in Qt6
Since the QPainterPath.addPolygon(QPolygonF) does not filter out the NaN
values, we can insert NaN values to create discontinuities in the Lines,
and thus supporting connect='pairs' functionality
2021-05-27 09:38:23 -07:00
Ogi Moore
78e678c1b9 Support connect=finite for qt6 2021-05-27 09:37:23 -07:00
Luke Campagnola
e29f86578f
Revert Point.angle behavior change (#1806)
* Revert behavior change of Point.angle

* Propagate Point.angle revert
2021-05-27 08:51:06 -07:00
Martin Chase
1735effea7
fix click bug on removable ROIs; test (#1804) 2021-05-26 17:14:08 -07:00
Ogi Moore
62165bbe45 Revert "Speed up arrayToQPath when connect='pairs'"
This reverts commit d62d3b182f.

Through testing, this was shown to perform quite poorly.
2021-05-25 23:30:06 -07:00
Ogi Moore
c6f1d2df94 Cleanup old code, conform comments to pep8 2021-05-25 22:32:26 -07:00
Ogi Moore
07ba7be2a4 Add basic tests for arrayToQPath 2021-05-25 22:32:26 -07:00
Ogi Moore
d62d3b182f Speed up arrayToQPath when connect='pairs'
As discussed earlier, the process of QDataStream >> QPainterPath is
quite slow, so this commit makes an improvement on QPainterPath creation
for the case of connect='pairs' by using a naive method of moving the
path and drawing a line on the path.  This was the fastest method
identified during testing.
2021-05-25 21:58:58 -07:00
Ogi Moore
aaae0b9e1c Have MultiPlotSpeedTest use skipFiniteCheck 2021-05-25 21:58:58 -07:00
Ogi Moore
7860d641ab Perform finiteCheck on PlotCurveItem.setData
The check for NaN values in arrayToQPath is expensive, this change
attempts to do the check one time, and if no NaN values are present,
an optional flag is passed along telling arrayToQPath that the check
can be skipped
2021-05-25 21:58:58 -07:00
Ogi Moore
f08d239578 Use QPolygonF for connect='all'
Since QDataStream >> QPainterPath is an expensive operation, we can
construct our QPainterPath from an open polygon instead but only if the
connect='all' mode is present.  Future optimizations work can likely
be had with constructing a polygon from each connected segment
2021-05-25 21:58:58 -07:00
KIU Shueng Chuan
d220e8a6e9 Restructuring of QPainterPath ByteArray 2021-05-25 21:36:27 -07:00
Ogi Moore
7bc5f215c0
Merge pull request #1802 from fbordignon/cx_freeze_example
update cx_freeze example and add a workaround for templates
2021-05-24 14:13:07 -07:00
Fernando Bordignon
a4de137535 update cx_freeze example and add a workaround for templates 2021-05-24 17:50:24 -03:00
Ogi Moore
ed1653f3c5
Merge pull request #1800 from wubella/master
Fixing GLMeshItem memory leak in face drawing on 64-bit Linux (#1783)
2021-05-23 21:22:31 -07:00
Wyatt Ubellacker
7e5c90a7a4 Fixing GLMeshItem memory leak in face drawing on 64-bit Linux (#1783) 2021-05-23 18:31:49 -07:00
KIU Shueng Chuan
7499c3b375 clip values can be derived from lut shape
also makes it clear that indices won't be out of range
2021-05-22 11:34:20 +08:00
KIU Shueng Chuan
9426ef0391 don't rely on QImage-wrapped buffer being writable 2021-05-22 09:10:03 +08:00
KIU Shueng Chuan
03ddf92839 implement numba lookup 2021-05-22 08:23:47 +08:00
Martin Chase
ac84f45787
callable luts still need to be put onto a substrate (#1791) 2021-05-20 07:22:49 -07:00
Kenneth Lyons
bcb6a5d66a
Merge pull request #1779 from manschloemark/master
Use fallback minStep in dec mode SpinBox (Issue 1756)
2021-05-19 18:15:10 -07:00
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
Mark Schloeman
1c1212e5e9 Set minStep in dec stepping SpinBox example 2021-05-16 17:37:33 -04:00
Mark Schloeman
c9ea25eed6 SpinBox in dec mode sets minStep to step as fallback 2021-05-16 17:37:33 -04:00
Ogi Moore
9566e2ba36
Merge pull request #1778 from j9ac9k/fix-glvolumeitem-example
Do not attempt to avoid np.log(0), instead ignore the warning in GLVolumeItem Example
2021-05-16 10:38:07 -07:00
Ogi Moore
9624b2a049 Do not attempt to avoid np.log(0), instead ignore the warning
Fixes #1775, also took the opportunity to clean the file a bit.
2021-05-16 10:18:23 -07:00
Ogi Moore
d3e0d041de
Merge pull request #1774 from pijyoi/pg_exec
implement pg.exec()
2021-05-15 22:42:59 -07:00
Martin Chase
253055003b
Add a Code of Conduct (#1773)
* Code of Conduct adapted from PuPPy and matplotlib

* improve wording; transparency in moderation; fix link
2021-05-13 15:37:07 -07:00