Commit Graph

2024 Commits

Author SHA1 Message Date
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
KIU Shueng Chuan 0503f96121 Format_RGB32 will always have alpha equal 255
this also fixes the assumption that we are on little-endian.

In [18]: qimg = QtGui.QImage(1, 1, QtGui.QImage.Format.Format_RGB32)

In [19]: qimg.fill(QtCore.Qt.GlobalColor.transparent)

In [20]: np.frombuffer(qimg.bits(), dtype=np.uint8)
Out[20]: array([  0,   0,   0, 255], dtype=uint8)
2021-05-07 18:09:02 +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
shahmustafa54 e1b1410260 Fixed typo in InfiniteLine (sigclicked vs. sigClicked) 2021-05-04 06:03:17 +05:00
Ogi Moore 2fd5337215 Run processEvents twice to make sure plot is redrawn 2021-05-01 18:05:33 -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
Ogi Moore a534132c62
Various performance improvements to pg.Point (#1741)
This change makes use of QPointF methods which perform faster than the python
equivalent methods.  Furthermore, some tests are added.

* Set __slots__ to empty tuple for pg.Point
* Make Point.angle() behave as Vector.angle()
2021-04-28 21:29:47 -07:00
KIU Shueng Chuan 306e9c2498 fix: cprint of remote output needs decode() 2021-04-28 16:38:15 +08:00
Ogi Moore 2d8d1d6d32 Add tmp_module fixture for test_reload 2021-04-25 21:36:42 -07:00
Ogi Moore 7c48233bfa Remove unreachable code 2021-04-25 21:36:23 -07:00
Ogi Moore 38dccf8642 Fix indentation bug with flowchart 2021-04-25 20:10:54 -07:00
Ogi Moore 4d388ee633 Use open context-manager instead of file.open()
Static code checker identified multiple places where a file is opened
but is not necessarily closed.  This commit addressed that with the
exception of RemoteGraphicsView.py
2021-04-25 17:05:05 -07:00
Ogi Moore cf95964678
Merge pull request #1738 from pijyoi/fix_font
use Format_RGB32 when using QImage as paint device
2021-04-24 09:43:42 -07:00
Ogi Moore d9a3774f6c
Merge pull request #1739 from pijyoi/manual_form
Export dialog: ParameterTree needs 2 columns
2021-04-24 09:41:40 -07:00
Ogi Moore 6a708dc203
Merge pull request #1724 from j9ac9k/use-math-module-for-single-values
Use math module methods for scalars
2021-04-23 23:10:17 -07:00
Ogi Moore 03ea368454 Clean up Errors for CodeQL analyzer
CodeQL identified some errors and warnings, which this commit cleans up.
2021-04-23 22:44:29 -07:00
Ogi Moore 329423f525 Use QTransform.rotateRadians when appropriate
In a few places in the library, we are doing the conversion from radians
to degrees just so we can call QTransform.rotate(), but there is a
QTransform.rotateRadians() method which would be more suitable, thus
making it so we do not have to handle the conversions ourselves
2021-04-23 22:43:57 -07:00
Ogi Moore e1415cb3a8 Use np.pi or math.pi instead of just pi 2021-04-23 22:43:57 -07:00
Ogi Moore 6a386e723b Fix overflow warning in QColor by using np.isfinite 2021-04-23 22:43:57 -07:00
Ogi Moore 3ea92736b8 Do not use list comprehensions with any or all
python any and all are able to break early the moment they come across a
member of the iterable that meets the condition; but having a list
comprehension nested within breaks that ability to exit early, as the
list comprehension has to finish being constructed first before it can
be evaluated
2021-04-23 22:43:57 -07:00
Ogi Moore 314121192a Use math module for isfinite or isnan for scalars
Various places in the library attempt to check if scalars are finite
via numpy methods, which are intended to be used on numpy arrays.  Using
the math module equivalent functions on scalars is significantly faster.

In a few places, I also use numpy methods explicitly (np.all vs. all)
2021-04-23 22:43:57 -07:00
Ogi Moore b0769f4be9 Use math.radians and math.degrees
Many places in the library were doing radian to degree conversion
via the manual calculation.  Doing timeit benchmarks on my system, I
am able to get a 4x speedup by using math.degrees or math.radians
instead
2021-04-23 22:43:51 -07:00
Ogi Moore 1138c67d45 Use math module trig functions for scalars
This commit replaces the use of np.sin/np.cos/np.tan uses throughout
the library with math.sin/math.cos/math.tan for scalar values
2021-04-23 22:42:46 -07:00
KIU Shueng Chuan e3372fddc5 specify that ParameterTree needs 2 columns in .ui 2021-04-24 11:21:12 +08:00
Ogi Moore c4a1cf11a1 Use clip_array or clip_scalar instead of np.clip
Significant performance issues have been identified with np.clip
and thus clip_array was created to speed up the operation.  In addition
clip_scalar was created to clip a scalar value between two other values
this commit replaces many uses of np.clip from operating on scalars to
using clip_scalar instead
2021-04-23 11:53:00 -07:00
Ogi Moore 85c726e49a Replace uses of np.log on scalers with math.log 2021-04-23 11:53:00 -07:00
Ogi Moore f8cefa6284 Use hypot method to avoid over/underflow errors
Use hypot instead of manual calculation
2021-04-23 11:53:00 -07:00
Ogi Moore b0a3849960 Use math module methods for singular values
Using numpy methods that are intended for vectorized operations is
substantially slower than using the math module, so when feasible the
math module methods should be used.
2021-04-23 11:53:00 -07:00
KIU Shueng Chuan fbc86cd2c5 use Format_RGB32 when using QImage as paint device
this allows sub-pixel font antialiasing to take place.
2021-04-23 18:54:21 +08:00
Ogi Moore a9161e0794
Merge pull request #1735 from pijyoi/fix_dpr
unify _dpiRatio() and devicePixelRatio()
2021-04-22 09:52:09 -07:00
KIU Shueng Chuan 51871cd01e be hidpi-aware for remote rendering 2021-04-22 17:26:46 +08:00
KIU Shueng Chuan f4ed46773f unify _dpiRatio() and devicePixelRatio() 2021-04-22 11:51:10 +08:00
Martin Chase d531a808e1
allow gradient position to be configured on a histogram (#1729)
* NEW features for HistgramLUTItem

* gradientPosition=('left', 'right')
* only paint if item is visible (is faster)
* link hisogram to other histograms

* fixes to be able to merge

 * drop linkHistogram (rgba needs to be better integrated)
 * make sure defaults to same as current behavior
 * draw connecting lines correctly on each side
 * add example use
2021-04-20 19:57:15 -07:00
Nils Nemitz a6f9a2be12
ColorMap: keep RGBA values as uint8, clean up docstrings (#1722)
* keep RGBA values as uint8, clean up docstrings

* ColorMap docstring correction

* enum mapping fix 2
2021-04-19 23:03:44 -07:00
Nils Nemitz 515ae5f6e3 add axisOrder='col-major' 2021-04-17 18:18:14 +09:00
Ogi Moore 342fbb053f Avoid implicit int conversion for mouse buttons 2021-04-15 22:50:50 -07:00
Ogi Moore 52de9554bb Emit warning about pyside2 bug preventing loading 2021-04-15 22:50:16 -07:00
Ogi Moore 5c67f03b0e skip test without generating warning 2021-04-15 21:02:49 -07:00
Ogi Moore 314e4eb480 Unescaped sequence and fix typo 2021-04-15 21:02:29 -07:00
Martin Chase 6fed6d42b3
Protect makeARGB with tests and benchmarks (#1697)
* update to working

* cupy tests, too

* doubling up and down

* add more realism to the benchmarks

* name to reflect scale

* use different numbers to mean different numbers

(that sure does sound tautological)

* more sensible: order, error

* thorough check of lots of makeARGB arg combos

* docstring for tool usage

* no print needed

* better error messages

* test makeARGB using cupy, too

* skip without cupy available

* switch from conda to venv

* skip cupy runs when not available

* use endian-proof makeARGB shim in tests

* generate the asv conf to suit the system

* document running asv

* comments for future matrix goals

* put all makeARGB tests together; name for clarity

* subprocess.check_output is standard for all supported pythons

* better handle lack of git version

* use makeARGB shim

* small fixes and improvements
2021-04-15 15:51:21 -07:00
Martin Chase a465f93d9b
small TargetItem fixes (#1715)
* angle is just an int, not a method

* more TargetItem use in the example

* offset is needed before super sometimes

* use setLabel, too
2021-04-14 10:44:03 -07:00
Christopher Mullins 10c1e83cd7 Expose the `clickable` property of `PlotDataItem`. (#519)
* Fix the `clickable` property of `PlotDataItem`.

Currently if you attempt to set the `clickable` property of a PlotDataItem,
this property is silently ignored. The expected behavior is to set the
`clickable` property of the underlying PlotCurveItem.

* Use setCurvesClickable and curvesClickable instead

* curve is singular
2021-04-13 22:31:26 -07:00
Ogi Moore 5a08650853
Improve target item - incorporate bits from PR 313 (#1318)
Overhaul TargetItem based on @lesauxvi 's PR #313
2021-04-10 22:42:44 -07:00
Ogi Moore bb90ef1ec9
Merge pull request #1707 from pijyoi/pyqt61_compat
add PyQt6 6.1 forwards compatibility
2021-04-10 20:27:04 -07:00
KIU Shueng Chuan 2aed5c36d5 no need to reconstruct PyQt6 enums
PyQt6 can serialize / deserialize enums and flags w/o us manually
casting them to int.

In PyQt6 6.0, it was okay to pass the already deserialized flag
back to the class constructor.
In PyQt6 6.1, the flags MouseButtons and KeyboardModifiers have
been renamed to MouseButton and KeyboardModifier respectively.

skipping the reconstruction allows it to work on both PyQt6 6.0 and 6.1.
note that this was already done in deserialize_mouse_event()
2021-04-11 09:53:49 +08:00
KIU Shueng Chuan 64702981d4 temporarily let PyQt6 6.1 run on PyQt6 6.0 ui files 2021-04-11 09:02:58 +08:00
KIU Shueng Chuan 4699bbad6b fix keyboard modifiers default value 2021-04-11 09:00:52 +08:00
Nathan Jessurun e890d832e0 promote use of '#' in mkPen 2021-04-10 17:52:51 -04:00
KIU Shueng Chuan 3be8cafff4 avoid numpy scalar overflow
the "offset" argument passed into rescaleData() is typically an element
of an ndarray, i.e. it comes from the lower bound value of the "levels"
ndarray. as such, arithmetic operations on it can overflow.

this triggers a runtime warning in the test suite.

the workaround is to convert it to a Python (integer) scalar.
2021-04-09 10:14:23 +08:00
Martin Chase 0f94c17d86
Fix roi get array region (#1700)
* ROI.py, getArrayRegion: Fix return mapped coordinates

The *getArrayRegion* method is defined as returning a tuple of the points
in the selected region and the mapped coordinates if the
*returnMappedCoords* keyword argument is set to True in the parent class
*ROI*.

In the *EllipseROI* class, *getArrayRegion* was overriden, however it
ignores the *returnMappedCoords* keyword argument, leading to unintended
bugs because of the change in interface between the parent class and
the subclass.

This patch fixes the above bug.
If *returnMappedCoords* is set to False, then only *arr* containing the
array region is returned. If *returnMappedCoords* is set to True, a
tuple of the array region and the mapped coordinates is returned.

NB: At the time of this commit, the same bug is present in several classes
extending *ROI*. This commit only fixes the issue for the *EllipseROI* class.

* ROI.py, PolyLineROI.getArrayRegion: Fix return mapped coordinats

The *getArrayRegion* method is defined as returning a tuple of the
points in the selected region and the mapped coordinates if the
*returnMappedCoords* keyword argument is set to True in the parent class
*ROI*.

In the *PolyLineROI* class, *getArrayRegion* was overriden, however it
ignores the *returnMappedCoords* keyword argument, leading to unintended
bugs because of the change in interface between the parent class and the
subclass.

This patch fixes the above bug.  If *returnMappedCoords* is set to
False, then only *arr* containing the array region is returned. If
*returnMappedCoords* is set to True, a tuple of the array region and the
mapped coordinates is returned.

* remove merge conflict cruft

* lint

Co-authored-by: Malik Olivier Boussejra <malik@boussejra.com>
2021-04-08 13:43:30 -07:00
Kyle Sunden 711ad8afaa
Merge pull request #1696 from j9ac9k/0.12.1-changelog
Add changelog for 0.12.1
2021-04-06 20:52:46 -05:00
Kyle Sunden 03b7aa7860
Update version number for release 2021-04-06 20:41:32 -05:00
Ogi Moore 3ed206fa70
Merge pull request #1690 from ntjess/master
revert to old behavior: default created from value if not present
2021-04-06 13:07:10 -07:00
Ogi Moore d4c5025289 Implement suggested changes from ixjlyons 2021-04-06 11:51:10 -07:00
pijyoi aa57c7a685
implement rescaleData as a blocked iterator using np.nditer (#1648)
* implement rescaleData_blocked

clip limits should be int if data is int

* add test for rescaleData_blocked

* dispatch to different versions depending on numpy or cupy

* make rescaleData() the only entry-point
2021-04-05 23:02:52 -07:00
Nils Nemitz 758c038411
Add ColorBarItem for simplified image level adjustment (#1596)
* Initial implementation of ColorBarItem

* initial commit

* fixed missing indent

* docstring extension and corrections

* Converted example to match others / run as part of tests

* load local color maps instead of importing from colorcet

* clean up window creation code

* horizontal color bar and clean-up

* switched to mkQApp initialization

* cleaned up some comments
2021-04-05 20:50:52 -07:00
Nils Nemitz 929f3bda0d
make sure dynamic range limiter runs even when there isn't previous data (#1691) 2021-04-05 15:46:28 -07:00
Dennis Göries b8cf3dded4
DateAxisItem: Account for daylight saving time (#1694)
* DateAxisItem: Account for daylight saving time

* Use  logic more visible in utcoffset

* Rename getOffsetFromUtc function
2021-04-05 15:45:08 -07:00
Nathan Jessurun 58d126dcf3 fixes tests 2021-04-03 20:31:04 -04:00
Nathan Jessurun 4b002c06ba revert to old behavior: default created from value if not present 2021-04-03 17:07:02 -04:00
KIU Shueng Chuan 02a48afc60 test_makeARGB() : normalize to B,G,R,A 2021-04-01 08:38:10 +08:00
KIU Shueng Chuan 17e2f0f5f2 fix makeARGB() endian ordering 2021-04-01 08:38:08 +08:00
KIU Shueng Chuan 179b27ad8c image_testing.py: swap red and blue channels 2021-04-01 08:32:31 +08:00
Ogi Moore 4dc76ed90e
Merge pull request #1617 from pijyoi/fastpath_argb
Optimize makeARGB for ubyte images
2021-03-26 14:22:56 -07:00
Ogi Moore 1a597b80b7
Merge pull request #1662 from NilsNemitz/cast-to-int_in_ImageView_QSplitter.setSizes
added cast to int so that QSplitter.setSizes works on Python 3.10
2021-03-26 12:39:38 -07:00
Nils Nemitz 028f9d12a2 cast splitter settings to int in Canvas.py 2021-03-27 04:30:51 +09:00
Ogi Moore 21605faa44
Merge pull request #1666 from NilsNemitz/revert_styleUpdate_reduction
revert style change reduction in PlotDataItem
2021-03-26 12:12:41 -07:00
Nils Nemitz d8d5d49f04 revert style change reduction in PlotDataItem 2021-03-27 03:51:44 +09:00
Daniel Lidstrom fb3a8b62bd Don't pass brush to fn.mkPen 2021-03-26 11:36:30 -07:00
Nils Nemitz 2b1e24bf11 added cast to int 2021-03-26 18:47:38 +09:00
KIU Shueng Chuan b3dc090373 implement fastpath for makeARGB 2021-03-26 04:07:19 +08:00
Kyle Sunden 43532aa802 Post release 0.12.0 2021-03-25 14:25:30 -05:00
Kyle Sunden d2a1bcf920 Update version to 0.12.0 2021-03-25 14:04:14 -05:00
Ogi Moore 3b620836c4
Merge pull request #1651 from j9ac9k/Use_collections.abc
collections.abc not just collections
2021-03-23 11:56:02 -07:00
Nils Nemitz 954c7342dd
Fix to accidentally disabled style updates in PlotDataItem (#1653)
* allowed style updates to once again update the style of curve and scatter plot, added tests

* tests interleave assign and assert to guard against delayed assignment

* > > > now 100% more camels < < <
2021-03-23 11:54:15 -07:00
Ogi Moore bb5a179647
Add Deprecation Warning to Hex Strings That Do Not Start With "#" in mkColor (#1644)
* Add deprecation warning

* Incorporate changes to docs/warning

* correct input for no warnings

* Update docs examples in LabelItem
2021-03-23 11:35:06 -07:00
Ogi Moore 5b278855d6 Switch to camelCase functions 2021-03-23 11:07:19 -07:00
Ogi Moore 675516e0b1 collections.abc not just collections 2021-03-22 22:17:28 -07:00
Ogi Moore 4951bd743e
Replace main stanza with PyQt6 compatable variant (#1645)
* Replace main stanza with PyQt6 compatable variant

* Use fn.mkQApp instead

* remove needless comments
2021-03-22 11:17:12 -07:00
Ogi Moore 69be66699a
Merge pull request #1650 from NilsNemitz/add_clip_scalar_function
Do not use clip_array on scalars (use clip_scalar instead)
2021-03-22 11:16:50 -07:00
Ogi Moore 517d243166
Remove unhelpful warnings (#1646)
* Remove warning about existing QApplication

* Remove reference to weave which we do not use

* Do away with opengl warning

* Remove weaveDebug config option
2021-03-22 11:12:01 -07:00
Nils Nemitz 2c82a84f68 Do not use clip_array on scalars (use clip_scalar instead) 2021-03-23 01:08:31 +09:00
Nils Nemitz a1eca4e2dd
handle empty adjanceny array (#1647) 2021-03-21 21:14:19 -07:00
pijyoi d74bbe3bf6
Fix functions.clip_array() (#1649)
* fix clip_array()

return error for invalid inputs.
use minmax for win32, umath.clip for other platforms

the previous code was penalizing Linux

* force output to be an array
2021-03-21 18:44:26 -07:00
Nils Nemitz d0f5a6686f
PlotDataItem: Fix view range <-> dynamic range limit pathology and switch to np.umath.clip (#1637)
* 'no offscreen clip' optimization and switch to np.umath.clip

* swapped out clipping code for new functions.array_clip
2021-03-20 22:16:15 -07:00
Nils Nemitz 574c2d24f2
Stop PlotDataItem from always sending full style information to PlotCurveItem / ScatterPlotItem (#1619)
* skip unneded style updates in PlotDataItem

* removed unwanted file

* obliviated stray debug statement
2021-03-19 22:54:53 -07:00
Nils Nemitz 5fa3901c00
Fix transformations in GradientLegend (#1639)
* rebuilt transformations

* restored drawing order to bg > bar > labels (and removed some print statements)
2021-03-19 22:06:18 -07:00
KIU Shueng Chuan 8d74dfe11b refactor code to replace np.clip 2021-03-20 08:09:29 +08:00
Ogi Moore 3f9e56f62e
Merge pull request #1630 from pijyoi/lut_combine
combine levels and lut only if both are present
2021-03-14 08:58:19 -07:00
KIU Shueng Chuan 56b54344e2 workaround np.clip regression since numpy 1.17 2021-03-14 16:01:29 +08:00
KIU Shueng Chuan 5df14aec1d combine levels and lut only if both are present
previously, if levels was present but lut was not, levels would be
converted into lut.
2021-03-13 16:27:20 +08:00
Ogi Moore c5a1174f04
Merge pull request #1605 from pijyoi/clean_shutdown
let examples have a chance to exit normally
2021-03-06 20:18:50 -08:00
KIU Shueng Chuan df64be371a remove PySide from _loadUiType()
bug:
- QT_LIB == "PYSIDE" should have been QT_LIB == PYSIDE
2021-03-03 10:44:23 +08:00
KIU Shueng Chuan 30a64d5f81 Qt.py : remove Qt4 2021-03-03 10:44:23 +08:00
KIU Shueng Chuan d82f28d390 install sys excepthook for PyQt6 2021-03-03 09:42:16 +08:00
Ogi Moore fb6ae0ff2c
Merge pull request #1613 from chrismullins/parameter-unpacking
Add keys() method to Parameter class
2021-03-02 11:05:47 -08:00
Kiu Shueng Chuan 5f6be29f66 connect paletteChanged to standalone function 2021-03-02 05:57:17 +08:00
Chris Mullins 9ed51cd1e2 Add keys() method to Parameter class
This returns the names attribute, allowing **unpacking of Parameter subclasses.
2021-02-28 03:00:19 +00:00
Ogi Moore cd73aeed0e
Merge pull request #1598 from outofculture/selfless-lambdas
Remove references to self from lambdas
2021-02-23 09:40:57 -08:00
KIU Shueng Chuan 61616ffad9 remove calls to setGraphicsSystem
in fact all are no-ops
2021-02-22 19:17:53 +08:00
Martin af82858bc8 make these tiny methods with little excuse to exist private 2021-02-21 22:31:13 -08:00
Martin 68fa95686b fix typo 2021-02-21 07:05:24 -08:00
Martin 7f4f677ce1 lambdas which reference self prevent GC 2021-02-21 06:49:07 -08:00
KIU Shueng Chuan 0dc17ef546 RawImageGLWidget follow same style as RawImageWidget
i.e. row-major convention is used internally and user inputs are
converted at the point of entry.
2021-02-20 18:58:26 +08:00
KIU Shueng Chuan 5a29373572 fix: make transpose work for either ndim 2 or 3
at the same time, increase performance by using
makeQImage(copy=False, transpose=False)
2021-02-20 18:42:13 +08:00
Martin 09fd7a81b9 account for cupy inconsistency in slicing with a boolean array
See https://github.com/cupy/cupy/issues/4693
2021-02-19 20:51:35 -08:00
Martin b7e560a7ea fix imports
* metaarray is not used
* PlotCurveItem and ScatterPlotItem needed to be imported
* sort
2021-02-19 11:33:06 -08:00
Martin b9086f1023 no "i" variable anymore 2021-02-19 11:11:38 -08:00
Ogi Moore d9eb8e1afb
Merge pull request #1575 from pijyoi/reduce_shim
Reduce number of shims for PyQt6
2021-02-19 09:40:06 -08:00
Rafael Irgolic 6da60ccec8 Qt: Remove some Qt4 shims 2021-02-18 19:12:32 +00:00
Rafael Irgolic ae54e27ff6 app.dark_mode => app.property('darkMode') 2021-02-18 19:02:18 +00:00
Ogi Moore 765032fc0b Do not upload texture every paintGL call 2021-02-16 22:19:38 -08:00
Ogi Moore 0b26ef3644 RawImageWidget uses imageAxisOrder config option 2021-02-16 22:19:13 -08:00
KIU Shueng Chuan 2719922584 RawImageWidget.py : fix port to QOpenGLWidget
Qt5 docs specify differences between QGLWidget and QOpenGLWidget:
"...when invoking paintGL().
 QOpenGLWidget sets up the viewport via glViewport().
 It does not perform any clearing."
2021-02-16 09:15:37 +08:00
lidstrom83 6519734932
Deprecate unused/unnecessary modules (#1576)
* Deprecate ordereddict module

* Import OrderedDict from collections module instead of pgcollections

* Deprecate pgcollections module

* Deprecate lru_cache module

A simpler recipe exists from the standard library using OrderedDict.

* Deprecate pil_fix module

* Python 3.7 compatibility fix

* Avoid or suppress deprecation warnings in tests
2021-02-15 09:52:06 -08:00
Martin Chase 5210c55e67
Equilateral Triangle ROI (#1581)
* feature TriangleROI

Added equilateral  TriangleROI.
getArrayRegion is not working yet

* show off (and implicitly test) our new TriangleROI

* the PolyLineROI.getArrayRegion can be used by TriangleROI

refactor the actual logic to live on ROI

* refactors for readability

* variable names
* lint
* docstring type and purpose

Co-authored-by: Fekete Imre <feketeimre87@gmail.com>
2021-02-15 06:06:55 -08:00
Ogi Moore 825286066a only cast to float32 when safe to do so 2021-02-14 17:43:32 -08:00
Ogi Moore 4ac8e39aea Remove duplicate import and remove whitespace 2021-02-14 12:05:22 -08:00
Ogi Moore 5bfe8d5a46
Merge pull request #1572 from outofculture/arbitrary-scale-center
Arbitrary scale center ROI
2021-02-14 08:49:03 -08:00
KIU Shueng Chuan a1f9100ef1 shim only the keys we actually use 2021-02-14 07:56:05 +08:00
KIU Shueng Chuan 6ad1d752fe use QKeySequence to detect platform dependent copy keys 2021-02-14 07:46:20 +08:00
KIU Shueng Chuan 968286a1cf remove drag and drop shims
used only in one place in the codebase
2021-02-14 07:44:00 +08:00
KIU Shueng Chuan f4d685f7bd remove QDialog.exec_ shim
only used by PrinterExport.py which is currently disabled
2021-02-14 07:36:41 +08:00
Ogi Moore 6c5c0b590f Skip test_reload on python 3.10+ 2021-02-13 10:57:38 -08:00
Ogi Moore dce2288a18 Fix most errors... 2021-02-13 10:57:38 -08:00
Ogi Moore 3bfe2d81ba Do not use numpy deprecated type aliases 2021-02-13 10:57:38 -08:00
Ogi Moore 955f1c37a6 Use QPointF instead of QPoint for float input 2021-02-13 10:57:38 -08:00
Ogi Moore fc550aab86 keep testing deprecated objects, catch warnings 2021-02-12 13:08:00 -08:00
Ogi Moore 36d89fa3a5 Have test_PlotCurveItem use GraphicsLayoutWidget and not the deprecated GraphicsWindow 2021-02-12 13:08:00 -08:00
Ogi Moore d14a90112c Have test_svg use GraphicsLayoutWidget not the Deprecated GraphicsWindow 2021-02-12 13:08:00 -08:00
Ogi Moore 4fcea2762f Have NonUniformImage test use GraphicsLayoutWidget not deprecated GraphicsWindow 2021-02-12 13:08:00 -08:00
Ogi Moore 45329aac51 Remove unneeded pytest.skipif decorator 2021-02-12 13:08:00 -08:00
Ogi Moore b45386ebc5 Have __init__.plot() use PlotWidget, not deprecated PlotWindow 2021-02-12 13:08:00 -08:00
Ogi Moore ff71b6be6b Add actual deprecation warnings 2021-02-11 21:34:02 -08:00
Ogi Moore bd548e00c9 Restore shimmed Qt4 methods, with deprecation warnings 2021-02-11 20:06:38 -08:00
lidstrom83 d7668f91b3
Fix ScatterPlotItem performance regression (#1569)
* Fix ScatterPlotItem performance regression

* Add hover benchmark to ScatterPlotSpeedTest.py

* Removed a performance regression from GraphicsView

* Removed some tests failing due to the last commit
2021-02-11 08:36:52 -08:00
KIU Shueng Chuan 659392d4bb don't rely on QImage being non-const
the previous formulation creates an ndarray and then creates an QImage
over it w/o copying. this relies on the QImage thus created being
non-const.

if the QImage was (unintentionally) created as const, the subsequent
QPainter render on the const QImage would trigger a COW. i.e. the
original underlying ndarray wouldn't be updated.

this is only an issue for PyQt bindings where const QImages can be
created.
2021-02-11 10:38:19 +08:00
KIU Shueng Chuan 6c8e07c377 use 64-bits qimage size for PyQt5 5.15
PyQt5 5.15 has both methods sizeInBytes() (64-bits) and byteCount()
(32-bits)
the previous formulation would use 32-bits qimage size for PyQt5 5.15.
2021-02-11 10:38:19 +08:00
Kyle Sunden 17b1b82ae9 Handle case of 0-d array in infinite line setPos 2021-02-10 13:59:37 -06:00
Ogi Moore 28e7d4d12c
Fix Small Heights in ErrorBarItem (#1558)
* Add arrayToQPath bit

* No more moveTo or lineTo

* Use better names than 'partial'

* Implement feedback from reviewer
2021-02-09 20:42:39 -08:00
Nils Nemitz 33365fb730
Reduce reallocation in dynamic range limiter (#1556)
* change imports in cupy module to be local

* reduced re-allocation in dynamic range limiter, part 1

* minor cleanup
2021-02-09 20:36:31 -08:00
lidstrom83 aed2382e38
Correct id-based keying of scatter plot pixmap cache (#1564)
* Correct id-based keying of scatter plot pixmap cache

Note: naively using the id function results in non-unique keys.

Alternatively, we could serialize the Qt objects and use these in the key. This would provide protection from the user mutating these later, but at a cost to performance.

* Make id attribute private

* Access class variable instead of instance
2021-02-09 13:58:15 -08:00
KIU Shueng Chuan c9dcc0c0ed remove app.deleteLater() from tests
Multiple tests are executed by pytest with the same Python process.
The QApplication instance is a global object that will be used by
subsequent tests.

The Qt documentation says that the object will only be deleted while
running in an event loop. In addition, the Qt docs also specifically
say that processEvents() does not process DeferredDelete events.

i.e. calling processEvents() in a loop is not equivalent to calling
QApplication.instance().exec_()
2021-02-09 16:37:19 +08:00
Ogi Moore ade6a844e7
Merge pull request #1559 from pijyoi/pyqt6_evbug
restrict PyQt6 QEvent.type() monkey patching to 6.0.0
2021-02-08 22:44:50 -08:00
Ogi Moore 2e1514d711
Cache scatter-plot items by hashable properties (#1560)
* Cache scatter-plot items by hashable properties

* use qpainterpath boundingRect+elementCount for key
2021-02-08 10:59:51 -08:00
KIU Shueng Chuan 665988dc4f remove spinbox return key workaround
the code being removed was committed in 2012.
the reason for the workaround no longer exists.

the reason this code is under scrutiny is because while porting to
PyQt6, calling ev.type() triggered a bug in PyQt6 6.0
2021-02-08 22:10:33 +08:00
KIU Shueng Chuan d5e516ad52 restrict PyQt6 QEvent.type() monkey patching to 6.0.0
The bug that this workaround was for has been fixed in PyQt6 6.0.1.

However our feature test for the bug was faulty and triggers positive
for PyQt6 6.0.1. In other words, we would be needlessly monkey patching
where it wasn't needed.
2021-02-08 08:22:19 +08:00
Ogi Moore 6d3de52773
Merge pull request #1555 from pijyoi/pyqt6_remote_mouse
PyQt6 6.0.1 QEvent.Type needs to be explicitly deserialized
2021-02-06 21:43:06 -08:00
Ogi Moore d1bcbf8ec0
Merge pull request #1554 from ixjlyons/glscatterplotitem-nodata
Disable paint in GLScatterPlotItem if it has no data
2021-02-06 16:30:24 -08:00
KIU Shueng Chuan 030c49e659 PyQt6 6.0.1 QEvent.Type needs to be explicitly deserialized
in PyQt6 6.0.0, QEvent.Type was automatically pickled / unpickled.

in PyQt6 6.0.1, QEvent.Type is now pickled to be an int, so needs to be
recreated back explicitly (like the other bindings)

this change is backwards compatible with PyQt6 6.0.0
2021-02-07 07:47:50 +08:00
Kenneth Lyons a1064345d3 Disable paint in GLScatterPlotItem if it has no data 2021-02-06 15:31:54 -08:00
KIU Shueng Chuan 54d7c591b5 PyQt6 6.0.1 changes QImage constructor api 2021-02-07 07:14:24 +08:00
Ogi Moore feaa8fe5fb
Merge pull request #1547 from pijyoi/cleanup_ci
remove ProgressDialog from CI test
2021-02-06 12:05:03 -08:00
Nils Nemitz 194941dfb2
change imports in cupy module to be local (#1548) 2021-02-06 09:21:24 -08:00
Kenneth Lyons 8332f2cda0 Remove leftover print calls from PR 1437 2021-02-06 08:04:11 -08:00
KIU Shueng Chuan 310afebe56 fix svg.setResolution(int) deprecation warning
triggered only for PyQt binding, Python 3.8, 3.9

there is a mismatch in API:
- QScreen.logicalDotsPerInchX() -> float
- QSvgGenerator.setResolution(int)
2021-02-06 17:43:12 +08:00
KIU Shueng Chuan c85c62deda getargspec -> getfullargspec
former is deprecated since Python 3.0
2021-02-06 17:08:32 +08:00
Drew e7ceebd867
LegendItem: fix docs & minor bugs (#1437)
* LegendItem: fix spelling mistake

* LegendItem: remove unused curRow variable

* LegendItem: correct calculation of rowCount

Previously, rowCount would never be updated unless setColumnCount()
was called. This fixes that issue.
It also fixes that setColumnCount() rounded down (floored) the
number of rows, instead of providing an accurate number:
e.g. 4 items in 3 columns would yield rowCount=1, when it should be 2

* LegendItem: remove rowCount argument (not implemented)

Logic to actually use the rowCount argument was not implemented.
Users might expect rowCount to limit the number of rows to e.g. 1,
but that is not what the current code does (it only works with limiting
the number of columns).
Thus, we were exposing an unused/misleading parameter to users.

This can and should be reverted if the logic for limiting the number
of rows is added.

* LegendItem: add colCount docs

* test (LegendItem): remove unused curRow variable

* test (LegendItem): check increasing rowCount as add items

* Fixed logic in placement of items in legend with multiple columns

* Actual row count here should be 2, not 3

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2021-02-05 23:00:34 -08:00
Dennis Göries bac2ff5b4b
GraphIcons: Extend and deprecate previous pixmaps (#1534)
* GraphPixmaps: deprecate pixmaps

* Deprecation print

* More doc strings and deprecation warning
2021-02-05 21:09:59 -08:00
Ogi Moore c2daa00714
Merge pull request #1546 from ixjlyons/imageview-init-keyevents
Guard against key events when there's no time axis in ImageView
2021-02-05 20:57:45 -08:00
Kenneth Lyons f1999d9a2c Guard against key events when there's no time axis in ImageView 2021-02-05 20:23:15 -08:00
pijyoi cd914495ec
get test_ref_cycles to pass (#1539)
* get test_ref_cycles to pass

let objects die without gc.collect()
if you don't have cyclic references, there should be no need to call
gc.collect()

the usage of gc.collect() was causing pytest running with coverage to
crash on Python 3.7 / PySide2 5.12 / {Linux, Windows}.

* remove imports used only by the removed code
2021-02-04 20:18:53 -08:00
Ogi Moore f336ac2d91
Merge pull request #1541 from pijyoi/remove_qt4_qtest_shim
use qWaitForWindowExposed instead of qWaitForWindowShown
2021-02-04 16:15:39 -08:00
KIU Shueng Chuan 62ded33222 remove qtest shim for Qt5 too
not considered public API of pyqtgraph
2021-02-05 07:30:33 +08:00
Christoph Buchner 6974b25a5f
Fix typo 2021-02-04 08:07:01 +01:00
KIU Shueng Chuan 711dcd4d5a use qWaitForWindowExposed instead of qWaitForWindowShown
qWaitForWindowShown has been obsolete since Qt 5.6
2021-02-04 11:35:19 +08:00
Kenneth Lyons 15bdd89293 Add a few minor notes to docs on suffix/siPrefix 2021-02-03 17:27:41 -08:00
Kenneth Lyons 0e90e70e2a Update SpinBox tests for siPrefix without suffix 2021-02-03 17:18:13 -08:00
Kenneth Lyons cd10719837 Support siPrefix with no suffix in SpinBox 2021-02-03 17:14:06 -08:00
Kenneth Lyons 66c77118dc
Support suffix for int parameters (#1528)
* Support suffix for int parameters

* Fix spinbox test for new int formatting

* Tune up SpinBox tests a bit
2021-02-03 12:30:05 -08:00
Ogi Moore 7abf7d36d0
Merge pull request #1462 from Ryytikki/patch-1
Added option to use "None" for adj in setData
2021-01-31 23:03:44 -08:00
Ogi Moore 89d20119fe Update docstring and error message 2021-01-31 22:36:59 -08:00
Ogi Moore 983a3769e7 Check for None first 2021-01-31 22:32:56 -08:00
Ogi Moore f5a823bf38
Merge pull request #1533 from pijyoi/kill_qt4_shim
Remove scale rotate translate Qt4 shims
2021-01-31 22:12:11 -08:00
Ogi Moore e02fc10a40 handle text flags like axisitem 2021-01-31 21:52:51 -08:00
Ogi Moore d70a009c29 Address more PyQt6 enum type shenanigans 2021-01-31 21:17:44 -08:00
Ogi Moore 0495f1dcce Replace deprecated method with suggested one 2021-01-31 20:39:07 -08:00
KIU Shueng Chuan ac4eaa6860 remove redundant shims 2021-02-01 09:12:42 +08:00
KIU Shueng Chuan 185f9c7dad remove scale, rotate and translate shims 2021-02-01 09:06:23 +08:00
Ogi Moore 7b3fdda1e4 Merge branch 'master' into ptree 2021-01-31 13:36:53 -08:00
KIU Shueng Chuan 7192df7032 remove setMargin and setResizeMode shims 2021-01-31 22:21:32 +08:00
KIU Shueng Chuan 97f5459573 regenerate plotConfigTemplate.ui for Qt5
the old ones were using obsoleted method "setMargin"
2021-01-31 22:12:55 +08:00
KIU Shueng Chuan 327581983f delete some more Qt4 generated templates 2021-01-31 22:11:49 +08:00
pijyoi 9d89d10bcf
some optimizations for rescaleData (#1518)
1) use float32 instead of float64 for low precision inputs
2) use in-place operations to avoid unnecessary copies
2021-01-30 14:38:34 -08:00
Ogi Moore 56ee690d58
Merge pull request #1527 from ixjlyons/improve-parameter-docs
Improve parametertree documentation coverage
2021-01-30 11:01:08 -08:00
Kenneth Lyons c24d25bce3 Improve parametertree documentation
- Increase cross-referencing
- Give all built-in parameter and parameter items at least minimal
  docstring
- Start improving coverage of the special options available for some
  parameters
- Organize the built in parameters reference for easier navigation
2021-01-30 10:06:49 -08:00
pijyoi ce8c3262f8
switch to use of QOpenGLWidget in GraphicsView.py (#1525)
* switch to use of QOpenGLWidget in GraphicsView.py

experimental plotting in PlotCurveItem gets broken by this. so we allow
Qt5 users to opt back to using QGLWidget with the enableExperimental
option.

* allow Qt6 users to turn on enableExperimental

to more easily allow users to see the broken-ness.

* drop QGLWidget, use only QOpenGLWidget
2021-01-30 08:59:29 -08:00
KIU Shueng Chuan 6b7afbf75c remove six module 2021-01-29 16:13:27 +08:00
Ogi Moore 961cdac51c
Infiniteline emits clicked signal event (#1522) 2021-01-28 22:02:51 -08:00
Dennis Göries 5bb3800adc
ItemSample: Allow toggle of visibility via mouse click in LegendItem (#1497)
* Legend toggle directly on ItemSample

* Add invisible Eye icon

* Include package data and remove username from svg

* Allow svg and png in the setup.py and cleanup sg
2021-01-28 21:14:41 -08:00
Sérgio Peixoto 3f02b30140
Bugfix/wrong translate implementation (#1520)
* Removes all translate call on the parameter name and moves them into the title instead allowing to decouple visualization from code logic

* Removes all translate calls from the Exporter class property Name and moves the translation logic when setting the QListWidgetItems for the formatList

* Adds missing call to translation function for the export action on GraphicsScene
2021-01-28 08:42:18 -08:00
KIU Shueng Chuan 2f4ceee1ce fix RemoteSpeedTest shutdown errors
fix BufferError: cannot close exported pointers exist
for some reason, even though the ctypes object falls out of function
scope, it causes a lingering reference.
in any case, the use of ctypes is no longer necessary.

Don't change temporary files mid-way for Darwin
This fixes the CI issues on Darwin.

close the remote process on app shutdown.
2021-01-28 07:19:54 +08:00
Ogi Moore b54aa3914d
Attempt i18n localization (#1513)
* Trying translate on exporter strings

* Try translate on other misc context menu strings

* First f-string and I screw it up...

* add more translation calls
2021-01-27 11:34:32 -08:00
Ogi Moore 309195ceea
Fix windows hidpi (#1516)
* set environment variables before starting QApp

* fix-422

* Better support of hidpi

* Fix Typo in App-Name

* Remove fontScaleFactor bits

* Add documenation for hidpi displays

* Fix pg not defined
2021-01-27 10:59:07 -08:00
Ogi Moore 85773e4530
Revert "have mkQApp configure QApplication such that it handles HIDPI displays on Windows (#1509)" (#1515)
This reverts commit 98f6b2f1a5.
2021-01-27 10:42:38 -08:00
Martin 219f79947e maintain non-scaling behavior for parallel sides
make sure aspectLocked still gets checked
add example
2021-01-27 10:39:08 -08:00
Ogi Moore 98f6b2f1a5
have mkQApp configure QApplication such that it handles HIDPI displays on Windows (#1509)
* set environment variables before starting QApp

* fix-422

* Better support of hidpi

* Fix Typo in App-Name

* Remove fontScaleFactor bits

* Add documenation for hidpi displays
2021-01-27 10:05:56 -08:00
Valentin Valls 9456d07ae8 Fix scale-rotate ROI handler to allow to use a random scale axis and not only x/y
The code relative to scaleSnap is maybe broken
2021-01-27 09:52:50 -08:00
KIU Shueng Chuan d96ec314be RemoteGraphicsView.py : fix mouse interactions for Qt 5.12
mouse interactions had previously only been tested on Qt 5.15 and
Qt 6.0, and found to be not working on Qt 5.12.
differences in Qt 5.12 and Qt 5.15 are documented in the comments.

an addition bug found (and fixed) was that right-click was drawing
the pop-up menu away from the mouse position.
2021-01-23 19:28:11 +08:00
KIU Shueng Chuan 5186cbd80b remove Qt4 generated template files 2021-01-23 12:12:20 +08:00
KIU Shueng Chuan 6c760f3de1 add PyQt6 to CI
skip tests that don't work for Qt6

add Qt6 and remove Qt4 from test_examples.py

update README.md

switch mouse tests to use QPointF

this eliminates all the special casing for different bindings
2021-01-23 08:31:00 +08:00
KIU Shueng Chuan eec411a3c6 fixup Flowchart for PyQt6 2021-01-23 08:31:00 +08:00
KIU Shueng Chuan d0c062d7e5 Revert "workaround missing setStops binding"
This reverts commit c4addbeaea.
2021-01-23 08:30:59 +08:00
KIU Shueng Chuan 2e688cf672 PySide6 : shim missing binding QGradient.setStops 2021-01-23 08:30:59 +08:00
KIU Shueng Chuan 3a9e81cc49 update RemoteGraphicsView.py for Qt6 2021-01-23 08:30:59 +08:00
KIU Shueng Chuan c0336acc11 bug: style() should have been styleHint()
Style is enum for { StyleNormal, StyleItalic, StyleOblique }
2021-01-23 08:29:52 +08:00
KIU Shueng Chuan 6dbda78231 Container.py : fix RecursionError 2021-01-23 08:29:52 +08:00
KIU Shueng Chuan 8a091859f1 GradientWidget.py : workaround or-ing of enum flag values 2021-01-23 08:29:52 +08:00
KIU Shueng Chuan 0957735255 AxisItem.py : workaround or-ing of text flags 2021-01-23 08:29:52 +08:00
KIU Shueng Chuan 04e0a5e5af WidgetGroup.py : PyQt6 was taking PyQt4 codepath
we drop PyQt4 codepath
2021-01-23 08:29:51 +08:00
KIU Shueng Chuan edea696bc3 ROI.py : pyqt6 has no KeyboardModifier class
the correct type to use is actually KeyboardModifiers
2021-01-23 08:29:51 +08:00
KIU Shueng Chuan 13d652c794 convert to QPointF mouse event position
DockDrop.py : use QPointF mouse coords
2021-01-23 08:29:45 +08:00
KIU Shueng Chuan 607db15949 call super() on virtual QWidget methods 2021-01-23 08:29:44 +08:00
KIU Shueng Chuan 0fa4557ad6 don't cast buttons, enums and flags to int 2021-01-23 08:29:44 +08:00
KIU Shueng Chuan 3ce7f58384 import sip from Qt.py 2021-01-23 08:29:43 +08:00
KIU Shueng Chuan dcbddb0abf add PyQt6 support to Qt.py and functions.py 2021-01-23 08:29:43 +08:00
KIU Shueng Chuan ab41c03358 generate _pyqt6.py files
VideoTemplate_pyside6.py : regenerate for cuda feature
2021-01-23 08:29:39 +08:00
Ogi Moore 4e070f40bc Fixed typo 2021-01-21 08:48:54 -08:00
Ogi Moore b3a0051a99 Use os.getenv, not os.environ 2021-01-19 23:23:24 -08:00
Martin Chase 1654cb62ac
Small ImageItem-related improvements (#1501)
* Initial asv configuration

* makeARGB benchmarks are working

* Fix array type checking and allow making QImage in greyscale mode

* Performance improvements

* benchmark minor update

* Add CLI args to video speed test for easier / automated benchmarking

* udpate asv conf

* use a buffer-qimage so we can avoid allocing so much

this should improve performance under windows

* Add CLI args to video speed test for easier / automated benchmarking

* use a buffer-qimage so we can avoid allocing so much

this should improve performance under windows

* playing with numba

* oh, mins/maxes in the other order

* maybe put the cupy in here and see what happens

* pre-alloc for gpu and cpu

* handle possibility of not having cupy

* no numba in this branch

* organize imports

* name them after their use, not their expected device

* cupy.take does not support clip mode, so do it explicitly

* add CUDA option to the VideoSpeedTest

* rename private attr xp to _xp

* handle resizes at the last moment

* cupy is less accepting of lists as args

* or somehow range isn't allowed? what histogram is this?

* construct the array with python objects

* get the python value right away

* put LUT into cupy if needed

* docstring about cuda toolkit version

* better handling and display of missing cuda lib

* lint

* import need

* handle switching between cupy and numpy in a single ImageItem

* only use xp when necessary

we can now depend on numpy >= 1.17, which means __array_function__-implementing cupy can
seamlessly pass into numpy functions. the remaining uses of xp are for our functions which
need to allocate new data structures, an operation that has to be substrate-specific.

remove empty_cupy; just check if the import succeeded, instead.

* use an option to control use of cupy

* convert cupy.ceil array to int for easier mathing

* RawImageWidget gets to use the getCupy function now, too

* raise error to calm linters; rename for clarity

* Add Generated Template Files

* document things better

* cruft removal

* warnings to communicate when cupy is expected but somehow broken

* Merge branch 'cupy-rebase' into 'l/imageitem-performance'

Abundant conflicts; accept theirs in nearly every case.

* playing with settings to suss out timeout

* playing with more stuff to suss out timeout

* replace with empty list

* skip test_ExampleApp on linux+pyside2 only

* clean out some bits that no longer make sense; linty

* ignore airspeed velocity dir

* lint

* tidy up for merge

* lint

* lint, avoid shadowing

* specific import; run-as-script setup

Co-authored-by: Luke Campagnola <luke.campagnola@gmail.com>
Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2021-01-19 23:19:03 -08:00
Torsten Sommer 510626c15f
Add NonUniformImage, example and tests. (#509)
* Add NonUniformImage, example and tests.

* Use updated test-data tag

* Fix line ending, remove lut.setLevels keyword arguments call

Co-authored-by: Ogi <ognyan.moore@gmail.com>
2021-01-19 21:43:58 -08:00
Martin Chase f2b4a15b2d
Performance enhancement: use CUDA in ImageItem (#1466)
* Add CLI args to video speed test for easier / automated benchmarking

* use a buffer-qimage so we can avoid allocing so much

this should improve performance under windows

* playing with numba

* oh, mins/maxes in the other order

* maybe put the cupy in here and see what happens

* pre-alloc for gpu and cpu

* handle possibility of not having cupy

* no numba in this branch

* organize imports

* name them after their use, not their expected device

* cupy.take does not support clip mode, so do it explicitly

* add CUDA option to the VideoSpeedTest

* rename private attr xp to _xp

* handle resizes at the last moment

* cupy is less accepting of lists as args

* or somehow range isn't allowed? what histogram is this?

* construct the array with python objects

* get the python value right away

* put LUT into cupy if needed

* docstring about cuda toolkit version

* better handling and display of missing cuda lib

* lint

* import need

* handle switching between cupy and numpy in a single ImageItem

* only use xp when necessary

we can now depend on numpy >= 1.17, which means __array_function__-implementing cupy can
seamlessly pass into numpy functions. the remaining uses of xp are for our functions which
need to allocate new data structures, an operation that has to be substrate-specific.

remove empty_cupy; just check if the import succeeded, instead.

* use an option to control use of cupy

* convert cupy.ceil array to int for easier mathing

* RawImageWidget gets to use the getCupy function now, too

* raise error to calm linters; rename for clarity

* Add Generated Template Files

* document things better

* cruft removal

* warnings to communicate when cupy is expected but somehow broken

* playing with settings to suss out timeout

* playing with more stuff to suss out timeout

* replace with empty list

* skip test_ExampleApp on linux+pyside2 only

Co-authored-by: Luke Campagnola <luke.campagnola@gmail.com>
Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2021-01-19 21:26:24 -08:00
Ogi Moore 78bc0fd3ca
Merge pull request #1495 from pijyoi/future_compat
some fixes for PySide6 future compatibility
2021-01-19 21:05:50 -08:00
Ogi Moore ee623c0fa9 Get testdata using checkout action 2021-01-19 20:20:19 -08:00
KIU Shueng Chuan b6e713c306 bug: AlignCenter should have been AlignHCenter
from the Qt documentation,
- "AlignCenter = AlignVCenter | AlignHCenter"
- "You can use at most one horizontal and one vertical flag at a time.
  Qt::AlignCenter counts as both horizontal and vertical"
- "Conflicting combinations of flags have undefined meanings"

for AxisItem.py, from the code structure, it would appear that the
intent was to use AlignHCenter.

for ROI.py, AlignCenter == AlignCenter | AlignVCenter
2021-01-19 09:45:56 +08:00
KIU Shueng Chuan 9f54baed0c test_reload.py: skip for PySide6 and Python 3.9 2021-01-16 14:37:21 +08:00
KIU Shueng Chuan d0a7ceea2d relax image tolerance for PySide6 2021-01-16 14:37:21 +08:00
KIU Shueng Chuan 28c0ea4b33 test_ref_cycles.py : change skip criteria
test_ImageView()
- PySide6 fails the same as PySide2

test_PlotWidget() and test_GraphicsWindow()
- PySide6 succeeds.
- PySide2 also succeeds. (at least on Linux and on version 5.15.2)
2021-01-16 14:37:21 +08:00
Ogi Moore 901f772b5f Skip matplotlib qt6 tests 2021-01-16 14:37:21 +08:00
KIU Shueng Chuan e03d4be767 fix: QComboBox::AdjustToMinimumContentsLength is no longer available
documentation for Qt 4.8 and Qt 5.12 have advised to "Use
AdjustToContents or AdjustToContentsOnFirstShow instead"

documentation in Qt 5.15 no longer shows AdjustToMinimumContentsLength.
2021-01-16 14:33:47 +08:00
KIU Shueng Chuan f21dfd9d95 fix get_resolution.py to use QScreen
QDesktopWidget is deprecated in Qt5 and removed in Qt6
2021-01-16 14:33:47 +08:00
KIU Shueng Chuan 4b1a8fe6b4 call GraphicsView.enterEvent() with QEnterEvent
Qt5 prototype is QWidget::enterEvent(QEvent*)
Qt6 prototype is QWidget::enterEvent(QEnterEvent*)
where QEnterEvent inherits from QEvent

RemoteGraphicsView.enterEvent() is actually already called with a
QEnterEvent instance, so all we need to do is to be able to reconstruct
it in Renderer.enterEvent()
2021-01-16 00:16:28 +08:00
KIU Shueng Chuan 74683be68b GraphicsScene.py : check for C++ item live-ness
this gets triggered in PySide6 but not in PyQt5, PySide2.
2021-01-15 13:12:36 +08:00
KIU Shueng Chuan 10530568f0 ScatterPlotItem.py: use non _USE_QRECT codepath for PySide6
verified by using ScatterPlotSpeedTest.py that PySide6 benefits from this.
2021-01-15 12:47:13 +08:00
KIU Shueng Chuan 6c9b910c5c RemoteGraphicsView.py : include PySide6 in PySide family
this is only sufficient to make remote rendering work.

various errors still get triggered under PySide6 when we try remote plotting.
2021-01-15 10:25:24 +08:00
KIU Shueng Chuan 4f619bbb4c update glinfo.py to use QOpenGLWidget 2021-01-15 08:25:09 +08:00
KIU Shueng Chuan 9145d7f24d switch to usage of QOpenGLWidget
this drops support for Qt4
2021-01-15 08:25:09 +08:00
KIU Shueng Chuan dc46812e5a Qt.py : provide QOpenGLWidget (Qt5,6) instead of QGLWidget (Qt4,5) 2021-01-15 08:25:08 +08:00
KIU Shueng Chuan 44da583511 bootstrap.py: use importlib to generically support all bindings 2021-01-15 08:25:08 +08:00