def coherence(self): """ The coherence between the different channels in the input TimeSeries object """ #XXX Calculate this from the standard output, instead of recalculating #the coherence: tseries_length = self.input.data.shape[0] spectrum_length = self.spectrum.shape[-1] coherence=np.zeros((tseries_length, tseries_length, spectrum_length)) for i in xrange(tseries_length): for j in xrange(i,tseries_length): coherence[i][j] = tsa.coherence_calculate(self.spectrum[i][j], self.spectrum[i][i], self.spectrum[j][j]) idx = tsu.tril_indices(tseries_length,-1) coherence[idx[0],idx[1],...] = coherence[idx[1],idx[0],...].conj() return coherence
def coherence(self): tseries_length = self.input.data.shape[0] spectrum_length = self.spectrum.shape[-1] coherence=np.zeros((tseries_length, tseries_length, spectrum_length)) for i in xrange(tseries_length): for j in xrange(i,tseries_length): coherence[i][j] = tsa.coherence_calculate(self.spectrum[i][j], self.spectrum[i][i], self.spectrum[j][j]) idx = tsu.tril_indices(tseries_length,-1) coherence[idx[0],idx[1],...] = coherence[idx[1],idx[0],...].conj() return coherence