Commit Graph

2737 Commits

Author SHA1 Message Date
Ogi Moore
649757eb31 Remove use of QPolygonF in non-finite cases
With some experimentation, it was determined that when the QPainterPath
is drawn with a QPen that has a thickness greater than 1, the end result
is quite broken.  Due to us trying to exploit non-advertised behavior
we are removing this optimization step.
2021-06-03 22:53:09 -07:00
Ogi Moore
4264219144 Add PyQt6 version check for QByteArray creation 2021-06-01 22:01:58 -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
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
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
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
KIU Shueng Chuan
dfddb39ce0 Revert "add QApplication.exec() to Qt5 bindings"
This reverts commit 2dad9862cb.
2021-05-14 06:16:21 +08:00
KIU Shueng Chuan
0fb0209e43 Revert "provide QApplication.exec() for PySide6 6.0"
This reverts commit 3eb69e6d9b.
2021-05-14 06:16:21 +08:00
KIU Shueng Chuan
0754602c3c fix in-library uses of exec_() 2021-05-14 06:16:21 +08:00
KIU Shueng Chuan
21296cd4f3 change all examples to use pg.exec() 2021-05-14 06:16:21 +08:00
KIU Shueng Chuan
61badc88b3 implement pg.exec() 2021-05-14 06:16:21 +08:00
Ogi Moore
1905f83047
Merge pull request #1772 from pijyoi/fix_remote
don't print out expected Exception
2021-05-13 12:22:00 -07:00
KIU Shueng Chuan
381147450d pass through any AttributeError 2021-05-13 14:43:28 +08:00
KIU Shueng Chuan
210203d628 don't print out expected Exception 2021-05-13 13:58:06 +08:00
Ogi Moore
eed220e874
Merge pull request #1771 from pijyoi/fix_pyside6.1
some fixes PySide6 6.1.0
2021-05-12 21:51:01 -07:00
KIU Shueng Chuan
3eb69e6d9b provide QApplication.exec() for PySide6 6.0 2021-05-13 09:48:47 +08:00
KIU Shueng Chuan
2dad9862cb add QApplication.exec() to Qt5 bindings 2021-05-13 09:02:42 +08:00
KIU Shueng Chuan
3b32e27083 RemoteGraphicsView.py : fix deprecated mouse positions 2021-05-13 08:57:15 +08:00
KIU Shueng Chuan
70c123a95c fix localPos() deprecated warnings 2021-05-13 08:42:45 +08:00
KIU Shueng Chuan
60661f586f fix: QVector3D has no copy constructor 2021-05-13 08:23:06 +08:00
Ogi Moore
96e83b7d43
Merge pull request #1766 from pijyoi/vst_numba_toggle
VideoSpeedTest.py : Add numba checkbox
2021-05-07 08:40:03 -07:00
KIU Shueng Chuan
09ce81655d VideoSpeedTest.py : Add numba checkbox 2021-05-07 15:35:27 +08:00
Nils Nemitz
bfc63bb730
Make plotting with gradients more fun (#1742)
* added convenience functions to better handle plotting with gradients

* docstring correction, example name correction

* retrying to get  documentation format right

* another attempt at cleaning up docs

* Don't hardcode timer type (and docs fixing attempt)

* more docstring re-formatting

* linebreaks in docstrings

* more documentation adjustments

* documentation pass

* some corrections to documentation

* more adjustments to documentation

* again?

* removed some whitespace and redundant blank lines, changed some checks '== None' to 'is None'

* fixed mis-spelling QColor as Qcolor
2021-05-06 23:20:21 -07:00
Martin Chase
2fb7cdafbd
more complete test yields more complete behavior (#1765) 2021-05-05 18:07:34 -07:00
Martin Chase
fa1be1e5bf
show and hide properly for maxTraces; +test (#1764) 2021-05-05 17:08:04 -07:00
Kenneth Lyons
cafe079910
Support horizontal HistogramLUT{Item,Widget} (#1757)
* Improve HistogramLUTItem docs, a few cosmetic changes

* Initial implementation of horizontally-oriented HistogramLUTItem

- Also adds support in HistogramLUTWidget
- Fixes AxisItem orientation bug for vertical orientation
- Make use of GradientEditorItem orientation (fixes another bug for
  vertical orientation)
- Use horizontal orientation in an example for demonstration

* Remove unused HistogramLUTItem option

* A few more minor fixups

* Copy paste bug

* Use f-strings

* Update from review and a couple more minor updates

* Woops

* Add doc for orientation arg

* Add top/bottom orientation to doc. Expand on levelMode doc a bit
2021-05-04 21:25:42 -07:00
Ogi Moore
7dd033c03b
Merge pull request #1759 from alimustafashah/master
#1758 Fixed typo in InfiniteLine (sigclicked vs. sigClicked)
2021-05-03 20:31:51 -07:00
shahmustafa54
e1b1410260 Fixed typo in InfiniteLine (sigclicked vs. sigClicked) 2021-05-04 06:03:17 +05:00
Ogi Moore
cf70cf4395
Merge pull request #1754 from j9ac9k/remove-pytest-extensions-from-ci
Remove pytest extensions from ci
2021-05-01 21:28:49 -07:00
Ogi Moore
2fd5337215 Run processEvents twice to make sure plot is redrawn 2021-05-01 18:05:33 -07:00
Ogi Moore
cb48ce0548 Remove pytest-cov 2021-05-01 14:23:33 -07:00
Ogi Moore
6163a60198 Remove pytest-xdist 2021-05-01 14:23:28 -07:00
Martin Chase
85e2574230
useCupy option should be settable after ImageItem init (#1749)
* do not cache the cupy so the config option can be set later

* getCupy will always return None if the option is not set

* test of failing behavior

* divorce skip from option; restore option after test
2021-04-30 10:41:11 -07:00
Fernando Bordignon
7dc4823cc6
Update symbols documentation and inverted up and down arrows of scatterplotitem (#1747) 2021-04-29 19:34:19 -07:00
pijyoi
4d6a8e4998
add usage of numba (for rescale) (#1695)
* implement rescale using numba

* workaround to pass test_makeARGB.py

* key on (input, output) manually

* remove minimum version check

* signature needs to be a list of signatures

numba considers it a mistake for single-item non-list but works around
it internally

* add numba test to test_makeARGB.py

* add numba as dependency in CI

* handle properly the case where useNumba was already True

* restore useCupy setting after test

* filter numba nan warning

* don't make changes to test_cupy_makeARGB_...
2021-04-28 22:29:09 -07:00
Nils Nemitz
a7bc2b9a63
clean-up of PlotDataItem downsample methods (#1725)
* clean-up of PlotDataItem downsample methods

* high end of range at low end, not zero

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2021-04-28 22:07:24 -07:00
Martin Chase
4ee1fe4388
fix bug when plotting boolean arrays (#1748)
* test and fix for plotting boolean arrays

* smaller is faster

* oh, that bool went away

* tests should keep up with optimizations
2021-04-28 21:35:27 -07:00