* 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>
* 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>
* 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>
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
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)
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.
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()
this lets us support the various bindings w/o having to add binding
specific code.
it breaks PyQt4 support since PyQt4 template files are suffixed as
"_pyqt" rather than "_pyqt4"
QFont.setBold(True) calls QFont.setWeight(QFont.Weight.Bold)
in Qt 5, QFont.Weight.Bold == 75
in Qt 6, QFont.Weight.Bold == 700
in PySide6, QFont.setWeight() no longer accepts an integer value.
convert QTreeWidget.setFirstItemColumnSpanned(item, True) to
item.setFirstColumnSpanned(True)
the former is deprecated since Qt 5.15.2 and removed in Qt 6.
* extend ColorMap functionality for palette management
* manual merge with changes in master branch
* extend ColorMap functionality for palette management
* manual merge with changes in master branch
* light mode / dark mode swapping demo
* color map updates
* added ColorCET and Matplotlib import for color maps
* minor cleanup
* restored lost indent
* Code cleanup
* Add colorcet as optional dependency
Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
* LegendItem: Introduce itemStyles and provide ToggleItem
Show example
* Minor cleanup of the legend item and test
* Make ItemSample customizable
* Remove example modifications
* Changes for sampleType according to review
* Use log modulus transform for y axis log scaling
* Update log modulus to use eps and retain behaviour around -1 < x < 1
* Update setLogMode Dosctring
* Update setLogMode docString
Co-authored-by: Hanwant <admin@madigan.tech>
* MAINT: Post 0.11.1 release, drop py2, qt4
This focuses on distribution, tests, and docs. This may not be comprehensive, but covers the cases I found by looking and a few greps
Noteably, this does not change any actual internal code yet, to avoid merge conflicts with pending PRs.
* NEP 29 language/versions
* Added hovering demo to ScatterPlot example
* Use Qt's serialization for SymbolAtlas.symbolMap keys
Yields significant performance improvements when updating the scatter plot's options. See e.g. the plot hover example.
* Further optimized scatter plot picking
* Fix ScatterPlot example tool tip
* Clean up while I'm here
* Compatibility
* Some simple optimizations for ScatterPlotItem
Speedups for ScatterPlotSpeedTest.py:
~50% without pxMode
~ 0% pxMode with useCache
~30% pxMode without useCache
* ~3x speedup in scatter plot speed test with pxMode
* More optimization low-hanging fruit for the scatter plot
* Removed hover example to lazily pass tests
* Avoid segfault
* Re-add hover example to ScatterPlot.py
* Switch to id-based keying for scatter plot symbol atlas
- Use cases exist where serialization-based keying is a significant bottleneck, e.g. updating without atlas invalidation when a large variety pens or brushes are present.
- To avoid a performance hit, the onus is on the user to carefully reuse pen and brush objects.
* Optimized caching in scatter plot hovering example
* Fixed and optimized scatter plot hovering example
* Minor scatter plot optimization
* Cleanup
* Store hovered points in a set for the hovering example
* Keep a limited number symbol atlas entries around for future reuse
* Added a docstring note to remind the user to reuse QPen and QBrush objects for better performance
* Tidied up hovering example
* Typo
* Avoid unnecessary atlas rebuilds
* Refactored SymbolAtlas
* Efficient appending to SymbolAtlas
* SymbolAtlas rewrite
* Cleanup and profiling
* Add randomized brushes to speed test
* Add loc indexer to ScatterPlotItem
* Profile ScatterPlotItem.paint to identify bottlenecks
* Reuse targetRect to improve paint performance
* Readability improvements (opinionated)
* Only need to set x and y of targetRect
- w and h can stay set to 0 (not entirely sure why)
- this is a bit faster than setting all of x, y, w, h
* Minor renaming
* Strip off API changes and leave to another PR
* Renaming
* Compatibility
* Use drawPixmap(x, y, pm, sx, sy, sw, sh) signature to avoid needing to update QRectFs
* Use different drawing approaches for each Qt binding for performance reasons
* Fix a bug introduced two commits ago
Incidentally, I think there is a similar bug in the main branch currently.
* Minor performance and readability improvements
* Strip out source and target QRectF stuff
* Bring source and target QRectF stuff back in a less coupled way
* Leave deprecating getSpotOpts for another PR
* Compatibility fix
* Added docstrings and use SymbolAtlas__len__ where possible
* Fix export issue
* Add missing import
* Add deprecation warnings
* Avoid using deprecated methods
* Fix and cleanup max spot size measurements
* Make creation of style opts entries explicit
* Add hovering API to ScatterPlotItem
* Compatibility
* Marshal pen and brush lists in setPen and setBrush
* Fixed platform dependent bug
The flag was set on ItemClipsChildrenToShape to solve the issue of #316
"A GraphicsItem object overlaps the ViewBox border line" at Luke Campagnola's
suggestion to solve further issues that @espdev had. Luke wisely
commented that this approach needs extensive testing.
We tested it. It broke PDF export in Orange. :)
A solution to #316 was merged in PR #321, which was refined from the discussion
in #316. I am not sure that, given rest of #321, the ItemClipsChildrenToShape
was really needed. Even without modifications to ChildGroup I did not
see any border problems (but I could replicate them in pre-#321 pyqtgraph).
Removing this flag fixes (and unneeded supporting code) fixes PDF export
regression in Orange while borders still seem a-OK.
This allows you to easily create code to toggle lines on or off by setting to the appropriate array if on, or None if off. Currently you have to have 2 seperate setData calls, one with adj and one without
The i-th position of that array used to define if points (i) and (i+1)
were connected, but in master it defines whether points (i-1) and (i) are connected.
This commit reverts to (i) and (i+1) interpretation.
* Fix TickSliderItem: Avoid ghost ticks | Improved customPlot.py code
If `TickSliderItem.setTickValue` was called when a full repaint of the `TickSliderItem` was
not already scheduled, the tick was visible at the old and the new position. This could e.g. be seen
when using the autoscale button in the `customPlot.py` example.
Further, code from `customPlot.py` is improved to make use of `Tick.setVisible` instead of adding and
removing ticks based on their visibility.
* customPlot.py: Explain bool conversion
Co-authored-by: 2xB <2xB@users.noreply.github.com>
* changes to setData and dataRect to handle setting empty data
* simplified named argument check
* tests for clearing PlotDataItem by setData() and setData([],[]), commented out vestigal xClean/yClean
* removed last remains of xClean/yClean
* TickSliderItem: allowRemove property added
Following #744, this PR suggests the addition of a property
`allowRemove` to `TickSliderItem` and therefore also to
`GradientEditorItem`. It sets the default of whether ticks can
be removed by the user and therefore contemplates `allowAdd`.
I would be interested in other opinions on this design decision,
as #744 suggests to reuse `allowAdd` for the prohibition of
tick removal.
I personally suggest this solution, since it does not change
the effect of the current API.
Fix#744
* customPlot.py: Added markers to example using TickSliderItem
* examples\GradientWidget.py: Demonstrate use of allowRemove
Co-authored-by: 2xB <2xB@users.noreply.github.com>
* Fix examples/customPlot.py: mouseDragEvent misses axis argument
Fixes#1277
* customPlot.py: Update methodolgy to disable menu
If there's an argument for this, we should use it
* customPlot.py: Show how to disable axis interaction
* Fix ViewBox: Moving axis in RectMode not implemented => use normal move mode
Grabbing an axis in RectMode leads to the zoom rectangle being displayed
in unreasonable positions. In this case, fall back to normal mode.
* customPlot.py: Only disable right-click zoom for demonstration
In cases where continuous zooming is not wished (e.g. in case of
complicated rebinning after zooming), this might come in handy
and there is no reason not to show it.
Co-authored-by: 2xB <2xB@users.noreply.github.com>
* Fix: TickSliderItem ignores Tick.removeAllowed
This prohibits removing ticks from a `TickSliderItem` if they were set to `tick.removeAllowed=False`.
Test code:
```python3
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore
import numpy as np
app = pg.mkQApp()
class CustomWidget(pg.GraphicsView):
def __init__(self, parent=None, *args, **kargs):
pg.GraphicsView.__init__(self, parent, useOpenGL=False, background=None)
self.item = pg.TickSliderItem(*args, **kargs)
for pos in (0, 0.5, 1):
tick = self.item.addTick(pos)
tick.removeAllowed = False # Possibility 1
# Possibility 2
for tick, value in self.item.listTicks():
tick.removeAllowed = False
self.setCentralItem(self.item)
self.setFixedHeight(31)
w = CustomWidget()
w.show()
app.exec_()
```
* Make 'removeAllowed' regular property of 'Tick'
Co-authored-by: 2xB <2xB@users.noreply.github.com>
* Fix: TickSliderItem method uses function from subclass GradientEditorItem
* Improved code layout
Previously, creating a `GradientEditorItem` lead to 34 executions
of `updateGradient`, with these improvements, only 2 are needed.
Further, removed duplicate code and used signals whenever possible.
Co-authored-by: 2xB <2xB@users.noreply.github.com>
* Emit signal when GraphicScene.addItem() is used
Emit a signal (sigItemAdded) just after adding an item to a scene.
The item object is emited as the only signal argument.
This signal is useful for code that may want to react to newly added
items of a plot.
* Emit signal when GraphicScene.removeItem() is used
Emit a signal (sigItemRemoved) just after removing an item from a scene.
The item object is emited as the only signal argument.
This signal is useful for code that may want to react to removed
items in a plot.
* [SVGExporter] Fix width and height
* [SVGExporter] Fix background color
* [SVGExporter] Remove f-strings
* [Exporter] Fix for QtGui.QGraphicsScene
* Revert "[Exporter] Fix for QtGui.QGraphicsScene"
This reverts commit 5bdd25ea40.
* [test_svg] Fix unit test
* Permit nan, inf, and -inf for float SpinBox
Bounds are enforced against inf and -inf inputs, but not for nan.
* Ensure SpinBox text is updated when out-of-bounds value is entered
* Make inf and nan entry in SpinBox case-insensitive
* Make SpinBox example behave as advertised
* Make non-finite SpinBox values optionally allowed
* Python 2 compatibility
The three parameters "shape, vectors, origin" can't be passed as parameters because they are computed, which raise an error when kwds is passed to affineSlice.
- Parameters now respond to title change in setOpts
- Add Parameter.title()
- Action parameter uses default name/title handling in addition to setting button text (fixes#1320)
* example app now workw with Qt4 and Python2 again
* Example App is now part of the test suite
* Add initExample
* No scary warning when launching examples
* Fix scary examples.__main__ warning
* Use courier new font as its on all platforms
* Remove commented out code
* Add newline
* Updated docs, example app now tested
* Non-relative import for example app
* Proper importing now
* dynamic range limiting in PlotDataItem
* revised version of cynamic range limiting
* replaced == with is operator
* removed unicode +- character, converted to ascii
* code/docstring cleanup
* clean state with changes
* silenced numpy all-NaN warnings
* reverted PlotWidget.py to original
* reverted PlotWidget.py to original
* reverted PlotWidget.py to original
* rewrapped/reformated setDynamicRangeLimits docstring
Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
* LegendItem: Enable customization of label text size and tests
* One more CI
* Remove deleteLater of QAPP in legend item test
* Remove assert statement in setLabelTextSize
* Modify legend test without assertion
* Add a docs build job to CI
* Add sphinxopts to fail on warning
* Test sphinx warning
* Redid ci stage conditionals
* update conf.py to remove deprecation warning
* introduce 3rd stage for proper conditionals
* Attempt to fix malformed table
Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
This commit adds a depth buffer in renderToArray().
This fixes the issue that overlapping objects are rendered incorrectly
when using renderToArray() on a GLViewWidget.
This might be related to issue #743.
* Add "lstep" and "rstep" step Modes
stepMode is currently either True or False. If it is True,
it requires the user to make len(x) = len(y)+1. This is
inconvenient because it makes it difficult to change the
stepMode on a given curve (just as one would change, e.g.,
its color).
This commit extends the current situation by introducing
two more step modes: "lstep" and "rstep", which do not require
passing an extra x value. In turn, this modes associate each
y value to either the left or the right boundary of the step.
For example, the "rstep" mode is handy when plotting "life"
digital signals in which x,y data pairs are appended as they
are read.
This commit does not modify the behaviour in case of stepMode=True
* Replace step mode names: lstep,rstep -> left,right
* Improve docs for stepMode
Reword docstring and add it to PlotDataItem class too
* Document left and right stepModes as added in v 0.12.0
TODO: confirm the exact version number to use here
* Add comments stress the need for "is True"
Some conditional statements in the code regarding stepMode are
done with "is True". This is actually required since other
possible values such as "left" also evaluate as true but should
not be caught.
* Deprecate boolean API for stepMode
Introduce stepMode="mid" as a replacement of stepMode=True,
but keeping full backwards compatibility with the old API.
Adapt docs, examples and tests accordingly.
* Raise ValueError on unsupported stepMode values
* Rename "mid" step mode to "center"
* Remove "added in 0.12.0" note
See https://github.com/pyqtgraph/pyqtgraph/pull/1360#discussion_r502746919
* Add deprecation warning when stepMode=True
Issue a DeprecationWarning if stepMode=True is being passed to the
constructor or setData() of PlotDataItem or PlotCurveItem.
Note: warnings module is imported locally so that it is esier to
remove once this check is no longer needed.
* Fix wrong syntax in last commit
Fix usage of "default" kwarg in dict.get()
* SignalProxy: Correct initialization without slot argument and provide tests
* Add missing slot is None case on disconnect
* Start new tests
* Exception block
* Test no module
* Different signal
* Debugging the signal connect
* Re initialize proxy after disconnect
* Add more test cases for blockSignal
* Change test case for signal count
* Give up for python 2 and pyside
* Exclude for Python 2.7 and PySide
* Convert float to integers in timer start period
This is something we're overriding in Orange3 (biolab/orange3#5007), as we change the symbols' alpha_value to show selected symbols. The default + and x symbols are too thin to show a noticeable change in alpha_value.
But I thought you might agree that the symbols look nicer this way.
* Fix PlotItem.setAxisItems
- Use extend so visibleAxes remains a flat list.
- More robust logic for detecting adding an AxisItem instance to
mulitple plots and suggest a workaround in the error message.
* Simplify membership check
* Add test for PlotItem setAxisitem logic
- avoid extra work when setLabelAngle would have no effect
- fix errors from bad parent transform (usually the displaying widget has not been given a size yet)
- add fileno method since console occludes sys.stdout
- fix editor spawning
- don't store sys.stdout, since this is not guaranteed to be the real stdout
* Exposed ability to set pens for handles and hovering for ROIs
* Consistent color format for pen creation
* Exposed ability to set pens for handles and hovering for ROIs
* Consistent color format for pen creation
* Add handleHoverPen arg to ROI and rename Handle arg to hoverPen
Co-authored-by: nmearl <nchlsearl@gmail.com>
* Handle axis SI prefix scaling in MatplotlibExporter
* Added some MatplotlibExporter tests and added matplotlib to CI deps
* Install mpl with pip instead of conda
* Cleanup
* make imageView-timeline unmovable
* imageview.timeline now visible over white background
* activate splitter when roi visible
* Re-add roiCurves
Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>