Commit Graph

87 Commits

Author SHA1 Message Date
Kyle Sunden 34c6981b0f Update version number in __init__ 2021-10-09 00:37:49 -05:00
njessurun c0eb3267d2 Remove python 2 code paths 2021-08-02 12:07:25 -04:00
Kyle Sunden a472f8c5de
Remove all usage of python2_3.py (#1939)
* Remove all usage of python2_3.py

Technically these functions were exported at the top level of the library, this removes them without warning... If we want to we can bring them back for there, but I honestly don't think its needed, as we are py3 only now and have been for multiple releases.

This may introduce a number of 'useless cast' or similar but those were always happening anyway

This PR brought to you by sed

* Update varname in hdf example to avoid collision with builtin

* Clean up some leftover comments surrounding imports of compat code

* Unnecessary string casts

* Additional unnecessary casts

* syntax error fix

* more unnecessary casts

* Yet more unnecessary casts
2021-08-01 21:43:32 -07:00
Martin Chase 1d40d50b89
push bullet lists over 2 spaces to get them to show up as such in the… (#1912)
* push bullet lists over 2 spaces to get them to show up as such in the docs

* separate the literal block from the bullet list
2021-07-21 07:12:35 -07:00
Kyle Sunden 53fc415813
Update version number 2021-07-08 01:18:00 -05:00
KIU Shueng Chuan 427128ece1 add imports used by ACQ4 2021-06-25 21:19:34 +08:00
KIU Shueng Chuan 81baa182c5 add __all__ to various files 2021-06-25 21:19:33 +08:00
KIU Shueng Chuan 61badc88b3 implement pg.exec() 2021-05-14 06:16:21 +08: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
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
Kyle Sunden 03b7aa7860
Update version number for release 2021-04-06 20:41:32 -05: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
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 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
KIU Shueng Chuan 61616ffad9 remove calls to setGraphicsSystem
in fact all are no-ops
2021-02-22 19:17:53 +08:00
Ogi Moore 4ac8e39aea Remove duplicate import and remove whitespace 2021-02-14 12:05:22 -08:00
Ogi Moore b45386ebc5 Have __init__.plot() use PlotWidget, not deprecated PlotWindow 2021-02-12 13:08:00 -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
Kyle Sunden 3b1e55af1e
MAINT: Post 0.11.1 release, drop py2, qt4 (#1473)
* 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
2020-12-22 10:25:06 -08:00
Ogi Moore 195f609b31 Update __version__ 2020-12-19 09:17:23 -08:00
Ogi Moore 3f7a9bb642
Merge pull request #1273 from edumur/develop
Implemented pColorMeshItem
2020-10-12 09:24:10 -07:00
Felipe Silveira 9a83b72e9d
Import ThreadSafeTimer in __init__
This fixes issue #1303
2020-07-08 10:03:32 -03:00
Etienne Dumur cbbd8287ad Remove matplotlib dependencies 2020-06-25 22:07:41 +02:00
Ogi Moore ce6da3e93f First pass at implementing the diff from PR307 2020-06-24 23:34:17 -07:00
Etienne Dumur 426a70ae60 Implemented pColorMeshItem 2020-06-23 19:59:04 +02:00
Kyle Sunden e1f2cdce74 Final preparations for 0.11.0 release
Intend to tag and upload after this is merged
2020-06-08 18:25:45 -05:00
Adam Strzelecki 983cc1695e
Patch/window handling (#468)
* Do not wrap PlotView/ImageView

There is no need to wrap PlotView/ImageView into QMainWindow, since
only purpose of the QMainWindow is some default menu toolbar & menu
handling, that is not used by PyQtGraph anyway.

Moreover, every parent-less Qt widget can become window, so this
change just use PlotView/ImageView as windows, removing extra
complexity, eg. method forwarding, self.win property.

Another benefit of this change, it that these windows get initial
dimensions and titles as they were designed in .ui file.

* Properly cleanup on ImageView.close()

We should not close explicitly child widgets or clear scene, otherwise
Qt will deallocate children views, and cause "wrapped C/C++ object of
type ImageItem has been deleted" error next time we call close()
and/or some other methods.

All children, including self.ui.roiPlot, self.ui.graphicsView will be
closed together with its parent, so there is no need to close them
explicitly.

So the purpose of close it to reclaim the memory, but not to make the existing ImageView object dysfunctional.

* Remove references to plot & image windows after close

PyQtGraph images and plots module list variables are currently holding
references to all plots and image windows returned directly from main
module. This does not seem to be documented however, and causes the Qt
windows to be not released from memory, even if user releases all own
references.

This change removes the references from images/plots list once window
is closed, so when there is no other reference, window and all related
memory is reclaimed.

* Change all UI forms title from Form to PyQtGraph

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2020-06-01 11:23:18 -07:00
Lev Maximov a76d9daec2
Date axis item (#1154)
* Add DateAxisItem

* Change style to camelCase

* Fix missing first tick for negative timestamps

* Add ms precision, auto skipping

Auto skipping allows a zoom level to skip ticks automatically if the
maximum number of ticks/pt is exceeded

* fixes suggested by @goetzc

* workaround for negative argument to utcfromtimestamp on windows

* attachToPlotItem method

* default date axis orientation

* Use new DateAxisItem in Plot Customization example

* attachToPlotItem bugfix

* examples of DateAxisItem

* modified description of customPlot example

* added descriptions to the new examples, reformatted their code, included the first one into utils.py

* typo

* Refactored code for setting axis items into new function

Replaces "DateAxisItem.attachToPlotItem"

* Fix string comparison with ==

* Doc: Slightly more text for DateAxisItem, small improvement for PlotItem

* Make PlotWidget.setAxisItems official

* Fix typo in docstring

* renamed an example

* merge bug fix

* Revert "merge bug fix"

This reverts commit 876b5a7cdb.

* Real bug fix

* support for dates upto -1e13..1e13

* Automatically limit DateAxisItem to a range from -1e12 to 1e12 years

Very large years (|y|>1e13) cause infinite loop, and since nobody
needs time 100 times larger than the age of the universe anyways,
this constrains it to 1e12.

Following suggestion by @axil:
https://github.com/pyqtgraph/pyqtgraph/pull/1154#issuecomment-612662168

* Also catch ValueErrors occuring on Linux before OverfloeErrors

While zooming out, before hitting OverflowErrors, utctimestamp
produces ValueErrors (at least on my Linux machine), so they
are also catched.

* Fix: Timestamp 0 corresponds to year 1970

For large years, x axis labels jump by 1970 years if it is not
accounted for timestamp 0 to be equal to year 1970.

* Fix: When zooming into extreme dates, OSError occurs

This commit catches the OSError like the other observed errors

* Disable stepping below years for dates outside *_REGULAR_TIMESTAMP

2 reasons: First: At least on my Linux machine, zooming into
those dates creates infinite loops. Second: Nobody needs
sub-year-precision for those extreme years anyways.

* Adapt zoom level sizes based on current font size and screen resolution

This is somewhat experimental. With this commit, no longer 60 px are
assumed as width for all zoom levels, but the current font and
display resolution are considered to calculate the width of ticks in
each zoom level. See the new function `updateZoomLevels` for
details.
Before calling this function, overridden functions `paint` and
`generateDrawSpecs` provide information over the current display
and font via `self.fontScaleFactor` and `self.fontMetrics`.

* Meaningful error meassage when adding axis to multiple PlotItems

As @axil noted in the DateAxisItem PR, currently users get a
segmentation fault when one tries to add an axis to multiple
PlotItems. This commit adds a meaningful RuntimeError message
for that case.

* setZoomLevelForDensity: Refactoring and calculating optimal spacing on the fly

* DateTimeAxis Fix: 1970 shows when zooming far out

* Refactoring: Make zoomLevels a customizable dict again

* updated the dateaxisitem example

* Fix: Get screen resolution in a way that also works for Qt 4

This is both a simplification in code and an improvement in backwards compatibility with Qt 4.

* DateAxisItem Fix: Also resolve time below 0.5 seconds

* unix line endings in examples

* DateTimeAxis Fix: For years < 1 and > 9999, stepping broke

Stepping was off by 1970 years for years < 1 and > 9999,
resulting in a gap in ticks visible when zooming out. Fixed by
subtracting the usual 1970 years.

* DateTimeAxis Fix: Zooming out too far causes infinite loop

Fixed by setting default limits to +/- 1e10 years. Should still
be enough.

* improved second dateaxisitem example

* 1..9999 years limit

* DateTimeAxis: Use OrderedDict to stay compatible with Python < 3-6

* DateAxisItem: Use font height to determine spacing for vertical axes

* window title

* added dateaxisitem.rst

* updated index.rst

Co-authored-by: Lukas Heiniger <lukas.heiniger@sed.ethz.ch>
Co-authored-by: Lev Maximov <lev.maximov@gmail.com>
Co-authored-by: 2xB <2xB@users.noreply.github.com>
2020-04-27 11:43:22 -07:00
Ogi Moore 60c760a2e0
Add RemoteGraphicsView to __init__.py (#1066) 2019-11-19 08:15:27 -08:00
Kenneth Lyons faef56c3e7 Qulogic py3 fixes (#1073)
* py3k: Remove reduce calls.

* py3k: Remove compatibility sortList function.

Sorting by key has existed since Python 2.4.

* Remove unnecessary sys.path manipulation.

This file doesn't have any __main__ code to run anyway.

* Use context manager
2019-11-12 08:45:42 -08:00
Eugene Prilepin b1df230964 Remove 'global' for CONFIG_OPTIONS because it is redundant for dict (#1055) 2019-11-02 21:51:20 -07:00
Daniel Hrisca aa3a5d3995 remote legacy work-around for old numpy errors (#1046)
* remote legacy work-around for old numpy errors

* forgot to remove the numpy_fix import

* require numyp >= 1.8.0
2019-09-26 10:08:43 -07:00
Kenneth Lyons 563083cf86 Handle invalid file descriptor in exit 2019-06-23 12:14:52 -07:00
Luke Campagnola 349625c875 Update version string to 0.11.0.dev0 and handling in setup
Merge commit '1a3a0a70930b' into version-update
2018-05-30 08:53:32 -07:00
danielhrisca 1a3a0a7093 update version for new development 2018-05-08 10:02:06 +03:00
Luke Campagnola e61bbeda41 Merge branch 'develop' into datatree-arrays 2018-04-25 11:25:57 -07:00
Luke Campagnola 927fe44ab9 move mkQApp to Qt.py to make it easier to import internally
GraphicsLayoutWidget now calls mkQApp
2018-02-23 17:34:15 -08:00
Luke Campagnola 09aa198731 Add top level stack() function for debugging 2018-01-24 09:06:37 -08:00
James b9c7e379f3 Prevent ReferenceErrors on cleanup
Prevents a ReferenceError being thrown when PyQtGraph tries to put TensorFlow stuff onto a QGraphicsScene() on cleanup - see https://github.com/pyqtgraph/pyqtgraph/issues/603 and https://stackoverflow.com/questions/41542571/pyqtgraph-tries-to-put-tensorflow-stuff-onto-a-qgraphicsscene-on-cleanup
2017-12-18 15:57:31 +00:00
Luke Campagnola 8398e578b9 Add a collapsible QGroubBox widget 2017-09-03 16:48:08 -07:00
Luke Campagnola 6cdad190ab Merge remote-tracking branch 'campagnola/develop' into datatree-arrays 2017-01-16 11:34:42 -08:00
Ales Erjavec c4c31c3650 Fix `cleanup` when the running qt application is not a QApplication 2016-11-28 15:43:35 +01:00
Luke Campagnola 1426e334e1 PyQtGraph release 0.10.0 2016-11-04 22:47:56 -07:00
Luke Campagnola b50e2423ce Add config option sanity checking 2016-08-31 15:15:03 -07:00
Luke Campagnola a76fc37112 imageAxisOrder config option now accepts "row-major" and "col-major" instead of "normal" and "legacy"
ImageItems can individually control their axis order
image tests pass with axis order check
2016-08-23 09:10:26 -07:00
Luke Campagnola bee5878915 Added imageAxisOrder config option
Added global config documentation
ROIs don't exactly work yet..
2016-08-23 09:06:43 -07:00
Eric Dill 9d09f4ba4e DOC: Document the valid args for bg/fg 2015-07-12 16:43:05 -05:00
Luke Campagnola 0976991efd Import from python2_3 for all uses of basestring, cmp, and xrange 2015-05-19 09:29:55 -04:00
Luke Campagnola 1fe5976e19 Merge branch 'pyqt5' into develop
Conflicts:
	examples/parametertree.py
	pyqtgraph/Qt.py
	pyqtgraph/graphicsItems/FillBetweenItem.py
	pyqtgraph/graphicsItems/InfiniteLine.py
	pyqtgraph/imageview/ImageView.py
2015-02-28 11:46:41 -05:00