0
$\begingroup$

I have a limited background in DSP but I need to generate a spectrogram of an electrocardiography (ECG). I am using the scipy.signal.spectrogram and I need to set its various parameters

scipy.signal.spectrogram(x, fs=1.0, window=('tukey', 0.25), nperseg=None, noverlap=None, nfft=None, detrend='constant', return_onesided=True, scaling='density', axis=- 1, mode='psd')

as follows:

f, t, Sxx = signal.spectrogram(ecg_signal,fs=1000, nfft=512, window=('hanning'),return_onesided=True, noverlap=256)

but to be honest I am not sure If I know what I am doing. Can someone suggest what are the appropriate values of the various parameters? The ECG signal is sampled at fs=1000Hz and is only 5 minutes long. I would like to know how to select the best window to use, nperseg, noverlap, nfft and what are the implication of the variation values selected.

$\endgroup$

1 Answer 1

0
$\begingroup$

This really depends on the requirements of your application: what features are you looking for, what is the spectral resolution that you need, how quickly do these features change what frequency regions are these features in and do you need calibrated (e.g. $nV/\sqrt{Hz}$) or just relative energies.

Here are some "starter" suggestion. An FFT length of 1024 will give you a frequency resolution of about 1Hz and a time resolution of about 1 second or so. Hanning or Hamming windows are fine. You can try an overlap of 75% which gives you 4 spectrograms per seconds with some interpolation in time.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.