<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 FFT Amplitude Scaling
The relative amplitude of a sideband follows the relative amplitude of the peak in the FFT.
Step1:  Note, this also holds for interference between waves of different amplitudes. I've verified this with beam simulations.
FFT Frequency Scaling
Off-axis component of the wave is $k_x = k \sin\theta = \frac{2\pi}{780 nm}\sin\theta$
Step2:  The step size $\Delta k$ is given by $\frac{2\pi}{(20\mu m)(1340)}$ based on pixel size and pixel count
Step3:  So the horizontal axis scale should reflect these values. Note, they will not change with the setup so we can hard-code them into our graphing routines.
For example, if a peak is found with index 166 in the FFT output, that corresponds to
<ASSISTANT_TASK:>
Python Code:
from numpy.fft import *
import numpy
t = numpy.arange(0,100)
data = 5*numpy.sin(t) + 3*numpy.sin(0.5*t)
%pylab inline
plot(data)
fft_out = abs(fft.fft(data))
fft_out.max()
plot(fft_out)
from scipy.signal import find_peaks_cwt
peak_ind = find_peaks_cwt(fft_out, numpy.arange(1,3))
fft_out[peak_ind]
247/147.0
5/3.0
Explanation: FFT Amplitude Scaling
The relative amplitude of a sideband follows the relative amplitude of the peak in the FFT.
End of explanation
K_x = 2*pi/780e-9 * numpy.sin(0.005) # in radians per meter
Explanation: Note, this also holds for interference between waves of different amplitudes. I've verified this with beam simulations.
FFT Frequency Scaling
Off-axis component of the wave is $k_x = k \sin\theta = \frac{2\pi}{780 nm}\sin\theta$
End of explanation
delta_K = 2*pi/(20e-6*1340) # deltaK in radians per meter
Explanation: The step size $\Delta k$ is given by $\frac{2\pi}{(20\mu m)(1340)}$ based on pixel size and pixel count
End of explanation
166*delta_K # radians per meter
Explanation: So the horizontal axis scale should reflect these values. Note, they will not change with the setup so we can hard-code them into our graphing routines.
For example, if a peak is found with index 166 in the FFT output, that corresponds to:
End of explanation
<END_TASK>