From 1eac666d02d7dd6752e33f1090b40b5363d523ad Mon Sep 17 00:00:00 2001 From: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon, 10 Mar 2014 23:54:35 -0400 Subject: [PATCH] PlotDataItem._fourierTransform now uses np.interp --- pyqtgraph/graphicsItems/PlotDataItem.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pyqtgraph/graphicsItems/PlotDataItem.py b/pyqtgraph/graphicsItems/PlotDataItem.py index 3b8d7061..5806475d 100644 --- a/pyqtgraph/graphicsItems/PlotDataItem.py +++ b/pyqtgraph/graphicsItems/PlotDataItem.py @@ -651,16 +651,12 @@ class PlotDataItem(GraphicsObject): def _fourierTransform(self, x, y): ## Perform fourier transform. If x values are not sampled uniformly, - ## then use interpolate.griddata to resample before taking fft. + ## then use np.interp to resample before taking fft. dx = np.diff(x) uniform = not np.any(np.abs(dx-dx[0]) > (abs(dx[0]) / 1000.)) if not uniform: - try: - import scipy.interpolate as interp - except: - raise Exception('Fourier transform of irregularly-sampled data requires the package scipy.interpolate.') x2 = np.linspace(x[0], x[-1], len(x)) - y = interp.griddata(x, y, x2, method='linear') + y = np.interp(x2, x, y) x = x2 f = np.fft.fft(y) / len(y) y = abs(f[1:len(f)/2]) -- GitLab