2a) The Nyquist-Shannon sampling theorem stipulates the sampling rate required to capture the full information in a continuous signal (in time) with a finite bandgap B. If we have a signal f(t) with maximal frequency component given by A<B, then we can determine the complete signal by taking measurements spaced by 1/(2B)[s]. (With A and B in Hz). In practice a lowpass filter is employed to control noise by high frequency components, as any components with A/2 or any f/2 element f(t) will create aliasing when sampled.
/bin/bash: -c: line 0: syntax error near unexpected token `(' /bin/bash: -c: line 0: `[sampling image](sampling.webp)'
The shape of the np.fft.fft raw output is a 1D array of length n, where n is the number of samples from our signal. The significance of the i-th bin of this output is the value corresponding to the frequency bin centered at the i-th value in np.fft.fftfreq = [0,1, ... , n/2 - 1, -n/2, ... , -1]/(d*n) if n is even, or np.fft.fftfreq = [0,1, ... , (n-1)/2, -(n-1)/2, ..., -1]/(d*n) if n is odd, where d is the sample spacing. The frequency resolution is thus an array of length n as well, which covers values centered at zero with a magnitude less than half of the inverse of the sample spacing. In our code, we plot only the positive half.
We see a centered cross at F(120,120). With coloration dropping around this center value toward the outside in a circular manner. We see uniform coloration for the noise as expected. The centering of this cross is done somewhat arbitrarily by DC shifting and corresponds to the average brightness (normally done at F(0,0) by convention). The F(n-1,n-1) corresponds to the highest frequency, as we increase frequency when distancing from the center. As low frequencies contain more information than high frequencies, we see a difference in magnitude as explained above. The (i,j)th pixel output of the 2D fourier transform is thus the magnitude of frequency contribution by a frequency greater f0 given by r = sqrt(fx^2+fy^2). Thinking about the maximum limit of alternating black and white pixels, f_max = 1/(2pixels) so f = f_max / 2, where now we have a 2D expression for f_max which is proportional to r (sqrt(kx^2+ky^2)). Therefore it should not be possible to include bins representing to frequencies above a 2D nyquist frequency.