# Amplitude in Frequency domain not matching time domain signal after FFT in python. Explanation? I am trying to create a Power spectral density function in python that outputs the amplitude spectral density and cumulative power spectral density graphs. I am using scipy.fft to compute the FFT of my output data. Then an operation to compute the PSD. The code can be seen below for this.

df = nyquistFreq/(N/2-1) #frequency increment
spacing = 1
freq = df*(np.linspace(start = 0, stop = (N/2+1)*spacing, num = int((N/2)*spacing),  endpoint= True)) #creatiing frequency vector
fftData = fft(output.values) #taking the fft of the data
Pxx = (2*(pow(abs(fftData[1:int((N/2+1))]/N), 2)/df))


I am then running this function with a sine signal with an amplitude of 68 and a frequency of 21

N = 10000
sampleTime = 0.0001
timE = np.linspace(0, N*sampleTime, N, endpoint = False)
amp = 68*np.sin(2*np.pi*21*timE)


Values on plot are hard to see, but the peak frequency has an amplitude of 48.08326112068523, not 68. This is a reduction of 1/sqrt(2) that has been constant no matter what amplitude I’ve used. Is there a way I can get around this amplitude reduction, so that the amplitude in the frequency domain is that of the time domain? Possibly might have something to do with the way python performs FFT, spectral scaling/density.