0
0
SciPydata~10 mins

FFT computation (fft) in SciPy - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the FFT function from scipy.

SciPy
from scipy.fft import [1]
Drag options to blanks, or click blank then click option'
Afft
Bifft
Cfftshift
Drfft
Attempts:
3 left
💡 Hint
Common Mistakes
Importing the inverse FFT function ifft instead of fft.
Importing fftshift which is used for shifting zero frequency components.
2fill in blank
medium

Complete the code to compute the FFT of the signal array.

SciPy
result = [1](signal)
Drag options to blanks, or click blank then click option'
Anp.fft
Bfft
Cscipy.fftshift
Difft
Attempts:
3 left
💡 Hint
Common Mistakes
Using ifft which computes the inverse FFT.
Using np.fft which is a module, not a function.
3fill in blank
hard

Fix the error in the code to correctly compute the FFT of the data array.

SciPy
from scipy.fft import fft

output = [1](data, n=128)
Drag options to blanks, or click blank then click option'
Afft
Bifft
Cfftshift
Drfft
Attempts:
3 left
💡 Hint
Common Mistakes
Using ifft instead of fft.
Using fftshift which only shifts the zero frequency component.
4fill in blank
hard

Fill both blanks to create a dictionary of frequencies and their FFT magnitudes for values greater than 10.

SciPy
freq_magnitudes = {freq: abs(fft_result)[1] for freq, fft_result in zip(freqs, fft_values) if abs(fft_result) [2] 10}
Drag options to blanks, or click blank then click option'
A** 2
B>
C>=
D* 2
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication * 2 instead of exponentiation ** 2.
Using >= instead of > in the condition.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps frequency labels to FFT magnitudes for frequencies above 5 Hz.

SciPy
freq_dict = [1]: abs([2]) for [3], val in zip(freq_list, fft_vals) if [3] > 5}
Drag options to blanks, or click blank then click option'
Af'Freq_{freq}'
Bval
Cfreq
Dfreq_list
Attempts:
3 left
💡 Hint
Common Mistakes
Using the list name instead of the loop variable in the condition.
Using raw frequency values as keys instead of formatted strings.