import numpy as np
data = np.load("analog-signal1b.npy")
intervals=np.diff(data[0])
sampling_rate=1/intervals[0]
print("Sampling rate = ", sampling_rate, "Hz")
import matplotlib.pyplot as plt
nyquist = sampling_rate/2
fSpaceSignal=np.fft.fft(data[1])
fBase=np.linspace(0,nyquist,int(np.floor(len(data[1])/2))+1)
halfTheSignal=fSpaceSignal[:len(fBase)]
complexConjugate=np.conj(halfTheSignal)
powe=halfTheSignal*complexConjugate
fig=plt.figure(figsize=(10,10))
ax0=fig.add_subplot(211)
ax0.plot(data[0],data[1])
ax1=fig.add_subplot(212)
ax1.plot(fBase,powe/max(powe))
ax1.set_xlim([0,20])
plt.show()