Commit Graph

2661 Commits

Author SHA1 Message Date
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
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
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
1326ebe2f4 Update numpy version used in CI from 1.19 to 1.20 2021-04-16 22:33:59 -07:00
Ogi Moore
41eadd678b Remove build docs CI job
Now that readthedocs supports building docs on pull requests, we no
longer need to build the docs ourselves as part of the CI pipeline.
2021-04-16 22:32:14 -07:00
Ogi Moore
7740de4a26 Update README table show not-supported configs 2021-04-16 22:18:11 -07:00
Ogi Moore
a231c9ffb0 Update tox.ini config 2021-04-16 22:18:11 -07: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
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
Ogi Moore
435c54d20b Adjust pytest.ini warning suppressions
Show standard library Deprecation and PendingDeprecation warnings
Remove warning filters used for older Qt bindings no longer supported
2021-04-15 21:09:11 -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
Ogi Moore
dfa225f56f
Merge pull request #1714 from j9ac9k/merge-519-in-master
Expose the `clickable` property of `PlotDataItem`. (#519)
2021-04-13 23:20:11 -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
6f74d56266
Merge pull request #1710 from pijyoi/reorder_tests
run pyqtgraph tests before examples
2021-04-11 08:10:53 -07:00
Ogi Moore
d2e1f99b5e
Merge pull request #1708 from j9ac9k/remove-infiniteline-from-others-example
Remove infiniteline from others in examples
2021-04-11 08:08:25 -07:00
KIU Shueng Chuan
8cb53d321b run pyqtgraph tests before examples 2021-04-11 21:51:44 +08: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
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
Ogi Moore
a3443571f2
Merge pull request #1706 from ntjess/update-mkPen
promote use of '#' in mkPen
2021-04-10 20:21:53 -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
Ogi Moore
10d924818c
Merge pull request #1701 from pijyoi/fix_overflow_warning
avoid numpy scalar overflow
2021-04-08 21:54:23 -07: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
4bbbb189db Add changelog for 0.12.1 2021-04-06 13:08:49 -07: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