Spectrogram from scipy.signal with Python To test the python spectrogram (from scipy.signal) , I've created a signal with 2 harmonics: 2 Hz and 8 Hz. Then I've added 50Hz noise and a trend (https://i.imgur.com/t1SnQck.png). I wanted to retrieve those frequencies with spectrogram. I only find 10 Hz and about 50 Hz with the noised signal (https://i.imgur.com/I0hMtAC.png). I tried on the original signal without trend and without noise. I only find about 10 Hz (https://i.imgur.com/MVokSSS.png). Do you have any explanation of this ? 
The code is only 3 lines ("new_sa" is the noised signal with the trend and "PerEch" period of sampling).

from scipy.signal import spectrogram
f,t1,Sxx = spectrogram(new_sa,1/PerEch)
plt.pcolormesh(t1,f,Sxx)
plt.colorbar()


Thank you
The input to your spectrogram is too short in terms of time.  To get 2 Hz plot resolution, you need an input vector long enough to represent at least 0.5 seconds (preferably 3X more) worth of samples at your sample rate.