Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ACS
P
Public
VILLASframework
Data Processing
Commits
277a7801
Commit
277a7801
authored
Apr 06, 2018
by
Jan Dinkelbach
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add calculation of frequency spectrum
parent
3081e56e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
dataprocessing/timeseries.py
dataprocessing/timeseries.py
+12
-0
No files found.
dataprocessing/timeseries.py
View file @
277a7801
...
...
@@ -67,6 +67,18 @@ class TimeSeries:
-
self
.
values
.
imag
*
np
.
sin
(
2
*
np
.
pi
*
freq
*
self
.
time
))
return
ts_shift
def
calc_freq_spectrum
(
self
):
""" Calculates frequency spectrum of the time series using FFT
:param name: name of returned time series
:param freq: shift frequency
:return: new timeseries with shifted time domain values
"""
Ts
=
self
.
time
[
1
]
-
self
.
time
[
0
]
fft_values
=
np
.
fft
.
fft
(
self
.
values
)
freqs_num
=
int
(
len
(
fft_values
)
/
2
)
fft_freqs
=
np
.
fft
.
fftfreq
(
len
(
fft_values
),
d
=
Ts
)
return
fft_freqs
[:
freqs_num
],
np
.
abs
(
fft_values
[:
freqs_num
])
/
freqs_num
def
interpolate_cmpl
(
self
,
name
,
timestep
):
""" Not tested yet!
Interpolates complex timeseries with timestep
...
...
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