def get_sigma_input(self, mu, C=None): """ Standard deviation of input given presynaptic activity mu (and correlations C) For C=None: formula (6) in Helias14 For C given: formula (13) in Helias14 mu: averages rates C: average correlations """ mu = np.array(mu) if np.shape(mu) != (2,): raise ValueError( 'Mean activity needs to be given for both populations.') if C is None: C = np.array([[0., 0.], [0., 0.]]) else: C = np.array(C) if np.shape(C) != (2, 2): raise ValueError( 'Correlation needs to be given for all combinations of both populations.') a = bhlp.get_sigma2(mu) sigma_shared = np.dot(self.K * self.J * self.J, a) sigma_corr = np.diag( np.dot(np.dot(self.K * self.J, C), (self.K * self.J).T)) return np.sqrt(sigma_shared + sigma_corr)
def get_c_meanfield(self, mu, C=None): """ Self-consistent correlations Formula (24) without external input in Helias14 mu: average rates """ a = bhlp.get_sigma2(mu) A = np.zeros(2) A[0] = a[0] * 1. / self.NE if self.NE > 0 else 0. A[1] = a[1] * 1. / self.NI if self.NI > 0 else 0. W = self.get_w_meanfield(mu, C) M = np.array([[2. - 2. * W[0, 0], -2. * W[0, 1], 0.], [-1. * W[1, 0], 2. - (W[0, 0] + W[1, 1]), -1. * W[0, 1]], [0, -2. * W[1, 0], 2. - 2. * W[1, 1]]]) B = np.array([[2. * W[0, 0], 0], [W[1, 0], W[0, 1]], [0, 2. * W[1, 1]]]) rhs = np.dot(B, A) c = np.linalg.solve(M, rhs) C = np.array([[c[0], c[1]], [c[1], c[2]]]) return C