Commit Graph

445 Commits

Author SHA1 Message Date
Ogi Moore
c7675ca8bb Fix unraisable exception in test_examples
The way we called subprocess.Popen, it looks like we didn't close all
the pipes; this PR addresses the warning that pytest generates when
running the examples.

In addition, we toggle the pytest setting to error on any warning
2021-05-31 21:06:16 -07:00
Ogi Moore
ee951331be Close the example app after it launches 2021-05-31 21:06:16 -07:00
Ogi Moore
e7a30b9324 Clean up test files
Remove if __name__ == "__main__" bits, replace some == None to is None
checks

Cleanup variety of static code checker issue

Removed missing imports, restructured some logic to make a little
cleaner, fixed a function in test_dockarea, unfortunately broke the test
so now I tell pytest to expect the Exception.
2021-05-31 21:06:16 -07:00
Luke Campagnola
e29f86578f
Revert Point.angle behavior change (#1806)
* Revert behavior change of Point.angle

* Propagate Point.angle revert
2021-05-27 08:51:06 -07:00
Fernando Bordignon
a4de137535 update cx_freeze example and add a workaround for templates 2021-05-24 17:50:24 -03:00
Mark Schloeman
1c1212e5e9 Set minStep in dec stepping SpinBox example 2021-05-16 17:37:33 -04: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
KIU Shueng Chuan
21296cd4f3 change all examples to use pg.exec() 2021-05-14 06:16:21 +08: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
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
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
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
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
e1415cb3a8 Use np.pi or math.pi instead of just pi 2021-04-23 22:43:57 -07: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
b01e0e0895 Remove unused function and change line calc
Using @pijyoi's suggestion regarding line calculation broadcasting
2021-04-23 11:53:00 -07:00
Ogi Moore
f60fa3b534 Use clip_array instead of np.clip in GLVolumeItem 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
Ogi Moore
ec4d613037
Merge pull request #1730 from pijyoi/fix_powershell 2021-04-21 07:02:28 -07: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
KIU Shueng Chuan
0781f9392b use Popen instead of os.spawnle 2021-04-21 07:31:03 +08:00
Ogi Moore
e735d2d9b8 Block pyopenGL tests on more macOS platforms
When running on macOS Big Sur, pyopenGL is unable to find the bindings

Previously this was assumed that it would be fixed in later versions
of Python 3.8, but that has not happened.
2021-04-15 22:08:50 -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
Ogi Moore
fe6ad52262 Remove infiniteline from others in examples 2021-04-10 23:10:12 -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
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
KIU Shueng Chuan
de85a23ae0 switch to row-major order 2021-03-26 04:07:19 +08:00
KIU Shueng Chuan
fda8731dab reduce memory usage during data generation
random.normal() generates as float64 and gets converted to a smaller
dtype. generating all the needed data in a single call thus uses a lot
more memory than is necessary.

this changes it such that smaller chunks are generated.
data clipping is also changed to be in-place.

the gaussian filtering which gave the video a washed-out look is also
removed. this also contributed to data generation time.
2021-03-26 04:07:19 +08:00
KIU Shueng Chuan
cbafc773f5 fix: max value of uint16 is 65535 2021-03-26 04:07:19 +08: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
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
bc7ca1beef Move Color Map Example To Main Section 2021-03-23 11:12:36 -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
KIU Shueng Chuan
c49e471192 don't skip test_ExampleApp.py 2021-03-02 05:57:17 +08:00
KIU Shueng Chuan
85e894dd73 convert uses of QTimer.singleShot to QTimer instances
On macOS and Linux with PyQt bindings, QTimer.singleShot continues
to fire on python interpreter shutdown.
2021-03-02 05:57:17 +08:00
Kiu Shueng Chuan
1ad7d49908 de-duplicate Big Sur opengl skip testing 2021-03-02 05:57:17 +08:00
KIU Shueng Chuan
de11e6315c let examples have a chance to exit normally
cleanup imported module

1) instantiate MainWindow class if present
2) delete attributes from imported module when done
2021-03-01 21:24:43 +08:00
Martin Chase
2318f49bc4
include more color in the ImageView example (#1611)
* work taken from #312 (thanks, @ptweir !)
* turn on an ROI by default
2021-02-25 16:14:34 -08:00
KIU Shueng Chuan
d8e826e379 disable opengl vsync for benchmarking 2021-02-22 21:15:57 +08:00
KIU Shueng Chuan
fbd1e89950 regenerate templates 2021-02-22 19:17:53 +08:00
KIU Shueng Chuan
a657dea084 remove graphics system combobox 2021-02-22 19:17:53 +08:00
KIU Shueng Chuan
61616ffad9 remove calls to setGraphicsSystem
in fact all are no-ops
2021-02-22 19:17:53 +08:00
KIU Shueng Chuan
e09a397ebc modify environment to choose binding
the Example App allows the user to choose a binding and a graphics
system to use to execute an example.

issue 1: setGraphicsSystem is obsolete and the method no longer exists.
thus selecting a graphics system causes an error.

issue 2: the choice of binding to use is passed as an extra command
line argument to be parsed by initExample. this is problematic for
examples that use argparse, such as VideoSpeedTest.py

issue 3: if the user has set PYQTGRAPH_QT_LIB, that takes precedence
over the choice made in the Example App.

this patch fixes the above 3 issues by setting PYQTGRAPH_QT_LIB in
the child process' environment and removing the old parsing of the
command line arguments
2021-02-22 18:13:49 +08:00
Rafael Irgolic
ae54e27ff6 app.dark_mode => app.property('darkMode') 2021-02-18 19:02:18 +00: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
5bfe8d5a46
Merge pull request #1572 from outofculture/arbitrary-scale-center
Arbitrary scale center ROI
2021-02-14 08:49:03 -08:00