0

信号解析で問題が発生しました。スクリプト (x) に x(68, 815) の形状の配列をロードします。68 は、アレイ内の信号の数を表します。だから私はその上でPSDとCSDを実行したい. CSD: x[0] with x[1] .... x[0] with x[67] 以降... x[1] with x[1] .... x[1] with x[67 ] 等々

しかし、どういうわけか、計算された値は私の期待どおりであり、それらをさらに計算に使用すると、不穏な結果が生じます。誰かが私の間違いを見つけることができますか? 私は完全に気を失いました。森のために木が見えない。

x = np.load('/home/daniel/Dropbox/[...]')

nfft = 512
n_freqs = nfft/2+1
n_epochs = len(x) # in this case there are 68 channels, does not want to change the variable name
sfreq = 1000

def compute_mean_psd_csd(x, n_epochs, nfft, sfreq):
    '''Computes mean of PSD and CSD for signals.'''

    Rxy = np.zeros((n_epochs, n_epochs, n_freqs), dtype=complex)
    Rxx = np.zeros((n_epochs, n_epochs, n_freqs), dtype=complex)
    Ryy = np.zeros((n_epochs, n_epochs, n_freqs), dtype=complex)
    for i in range(n_epochs):
        for j in range(n_epochs):
            Rxy[i,j], freqs = mlab.csd(x[i], x[j], NFFT=nfft, Fs=sfreq)
            Rxx[i,j], _____ = mlab.psd(x[i], NFFT=nfft, Fs=sfreq)
            Ryy[i,j], _____ = mlab.psd(x[i], NFFT=nfft, Fs=sfreq)
4

0 に答える 0