def coherency(self): tseries_length = self.data.shape[0] spectrum_length = self.spectrum.shape[-1] coherency=np.zeros((tseries_length, tseries_length, spectrum_length),dtype=complex) for i in xrange(tseries_length): for j in xrange(i,tseries_length): coherency[i][j] = tsa.coherency_calculate(self.spectrum[i][j], self.spectrum[i][i], self.spectrum[j][j]) idx = tsu.tril_indices(tseries_length,-1) coherency[idx[0],idx[1],...] = coherency[idx[1],idx[0],...].conj() return coherency
def output(self): """The standard output for this kind of analyzer is the coherency """ data = self.input.data tseries_length = data.shape[0] spectrum_length = self.spectrum.shape[-1] coherency=np.zeros((tseries_length, tseries_length, spectrum_length),dtype=complex) for i in xrange(tseries_length): for j in xrange(i,tseries_length): coherency[i][j] = tsa.coherency_calculate(self.spectrum[i][j], self.spectrum[i][i], self.spectrum[j][j]) idx = tsu.tril_indices(tseries_length,-1) coherency[idx[0],idx[1],...] = coherency[idx[1],idx[0],...].conj() return coherency