Fast Fourier Transform Bug

151 views
Skip to first unread message

Thomas W

unread,
Aug 29, 2017, 4:29:17 PM8/29/17
to pyqtgraph

Right clicking a plot, and going to Plot Options -> Transforms -> Power Spectrum results in a crash, which appears to be from the lack of __future__ division.

pyqtgraph/graphicsItems/PlotDataItem.py
line 683, in _fourierTransform

y = abs(f[1:len(f)/2])
TypeError: slice indices must be integers or None or have an __index__ method
Message has been deleted

Bob

unread,
Jun 13, 2019, 1:18:53 PM6/13/19
to pyqtgraph
I have found this also. I don't suppose there is a fix coming? Is it possible to disable this menu item?

 

Kenneth Lyons

unread,
Jun 14, 2019, 11:21:55 PM6/14/19
to pyqtgraph
This problem looks like it was fixed a couple years ago [1], though that wouldn't have made it into the most recent release (from about 2015). You could try installing from the latest develop branch: https://github.com/pyqtgraph/pyqtgraph#installation-methods

One way to work around this:

plt = pg.plot([1, 2], [1, 2])
plt
.getPlotItem().ctrl.fftCheck.setEnabled(False)

That will disable the checkbox for the FFT operation, selectively disabling that feature.

Bob

unread,
Jun 15, 2019, 6:42:51 AM6/15/19
to pyqtgraph
Thanks, disabling the option is fine since the FFT means nothing for my data. 

itay peled

unread,
Oct 15, 2019, 4:35:49 AM10/15/19
to pyqtgraph
Just change this line to:
y = abs(f[1:len(f)//2])
(using // instead of / to get integer for slice index)
Reply all
Reply to author
Forward
0 new messages