Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Jakimow
EO Time Series Viewer
Commits
1eac666d
Commit
1eac666d
authored
Mar 10, 2014
by
Luke Campagnola
Browse files
PlotDataItem._fourierTransform now uses np.interp
parent
4263379a
Changes
1
Hide whitespace changes
Inline
Side-by-side
pyqtgraph/graphicsItems/PlotDataItem.py
View file @
1eac666d
...
...
@@ -651,16 +651,12 @@ class PlotDataItem(GraphicsObject):
def
_fourierTransform
(
self
,
x
,
y
):
## Perform fourier transform. If x values are not sampled uniformly,
## then use interp
olate.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
,
x
2
,
method
=
'linear'
)
y
=
np
.
interp
(
x2
,
x
,
y
)
x
=
x2
f
=
np
.
fft
.
fft
(
y
)
/
len
(
y
)
y
=
abs
(
f
[
1
:
len
(
f
)
/
2
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment