lab week 4 Flashcards
temporal EEG filtering
also spectral
focusing on one spectral component
power spectrum
a range of amplitudes (or power, A2) extracted from the Fourier Transform
Real-valued part of the Fourier coefficients
i.e. length of complex coefficient
Fourier transform
decomposes a signal into a complex spectrum that, for each frequency, has an amplitude (real) and a phase (imaginary)
create a matrix of simulated signals
simulate an EEG like this in Python
what is this?
offsets, phases
you have a number of subplots. Print the title for a certain subplot after you’ve looped over all of them
what is the maximum frequency at which you could measure the sine waves of your signal?
Nyquist frequency
you can only measure a frequency if you sample the signal at an even higher frequency
maximum frequency that can be measured is exactly 1/2 of the sampling rate
what is the length of the frequency axis?
the number of frequencies that can be measured
similar to N/2 + 1
N = the number of samples
+1 because we get the 0Hz, the DC offset, for free)
produced by fft.rfftfreq(N, 1 / srate)
what does Fourier spectrum contain?
complex numbers that have the amplitude as their real component, and the phase as their imaginary component.
extract the real-valued component from the imaginary number
also magnitude, modulus
np.abs(imaginary_numbers)
will extract sqrt( a2 + b2 ) from (a + bi)
Fourier transform in Python
import scipy.fft as fft
spectrum = fft.rfft(signal)
amplitudes = np.abs(spectrum)/(N_of_samples/2)
frequency_axis = fft.rfftfreq(N_of_samples, 1 / srate )
plt.plot(frequency_axis, amplitudes)
Return the angle of the complex argument
also argument
numpy.angle( data_structure_with_complex_numbers )
The counterclockwise angle from the positive real axis on the complex plane in the range (-pi, pi]
plot the phase of the Fourier Spectrum
import scipy.fft as fft
spectrum = fft.rfft(signal)
phases = np.angle(spectrum)/np.pi
frequency_axis = fft.rfftfreq(N_of_samples, 1 / srate )
plt.plot(frequency_axis, phases)