Commit a3fa15b7 authored by Pauline Pommeret's avatar Pauline Pommeret

Saving only half fft spectrum

parent 84dc1f6a
......@@ -90,6 +90,9 @@ def fft(frame, centering=None):
# Retrieves data
frame_number, (x_values, y_values) = split_frame(frame)
# Computes max of positive fft freqs
m_fft = (y_values.size + 1)/2
# Specific to centering
if centering is not None:
offset = int((len(x_values) - centering)/2)
......@@ -98,10 +101,10 @@ def fft(frame, centering=None):
# Creates frequency space, x_values[1] - x_values[0] is the typical delta
# in x_values.
freqs = numpy.fft.fftfreq(y_values.size, x_values[1] - x_values[0])
freqs = numpy.fft.fftfreq(y_values.size, x_values[1] - x_values[0])[0:m_fft]
# Computes the fft on the signal, retrieves real part.
transform = abs(numpy.fft.fft(y_values))
transform = abs(numpy.fft.fft(y_values))[0:m_fft]
return (frame_number, list(freqs), list(transform))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment