def make_eE_noiseCov(ssn, noise_pars, LFPrange):
    # setting up e_E and e_I: the projection/measurement vectors for
    # representing the "LFP" measurement (e_E good for LFP interpretation, but e_I ?)
    # eE = np.zeros(ssn.N)
    # # eE[LFPrange] =1/len(LFPrange)
    # index_update(eE, LFPrange, 1/len(LFPrange))
    # eI = np.zeros(ssn.N)
    # eI[ssn.Ne + LFPrange] =1/len(LFPrange)

    eE = np.hstack((np.array([i in LFPrange for i in range(ssn.Ne)],
                             dtype=np.float32), np.zeros(ssn.Ni)))

    # the script assumes independent noise to E and I, and spatially uniform magnitude of noise
    noiseCov = np.hstack((noise_pars.stdevE**2 * np.ones(ssn.Ne),
                          noise_pars.stdevI**2 * np.ones(ssn.Ni)))

    OriVec = ssn.topos_vec
    if noise_pars.corr_length > 0 and OriVec.size > 1:  #assumes one E and one I at every topos
        dOri = np.abs(OriVec)
        L = OriVec.size * np.diff(OriVec[:2])
        dOri[dOri > L /
             2] = L - dOri[dOri > L / 2]  # distance on circle/periodic B.C.
        SpatialFilt = toeplitz(
            np.exp(-(dOri**2) / (2 * noise_pars.corr_length**2)) /
            np.sqrt(2 * pi) / noise_pars.corr_length * L / ssn.Ne)
        sigTau1Sprd1 = 0.394  # roughly the std of spatially and temporally filtered noise when the white seed is randn(ssn.Nthetas,Nt)/sqrt(dt) and corr_time=corr_length = 1 (ms or angle, respectively)
        SpatialFilt = SpatialFilt * np.sqrt(
            noise_pars.corr_length /
            2) / sigTau1Sprd1  # for the sake of output
        SpatialFilt = np.kron(np.eye(2), SpatialFilt)  # 2 for E/I
    else:
        SpatialFilt = np.array(1)

    return eE, noiseCov, SpatialFilt  # , eI
    def __init__(self,
                 n,
                 k,
                 tauE,
                 tauI,
                 J_2x2,
                 s_conn,
                 Ne,
                 L=180,
                 **kwargs):  #, Ni=None,

        #Ni = Ni if Ni is not None else Ne
        Ni = Ne
        Ns = [Ne, Ni]
        tau_vec = np.hstack([tauE * np.ones(Ne), tauI * np.ones(Ni)])
        distsq = lambda x: np.minimum(np.abs(x), L - np.abs(x))**2
        from util import toeplitz
        # s_2x2 = np.array(s_conn) if not np.isscalar(s_conn) else s_conn * np.ones((2,2))
        # assert s_2x2.shape == (2,2)
        # blk = lambda i, j: toeplitz(np.exp(-distsq(topos_vec[i,j])/2/s_2x2[i,j]**2))
        topos_vec = np.linspace(0, L, Ne + 1)[:-1]
        blk = toeplitz(np.exp(-distsq(topos_vec) / 2 / s_conn**2))
        W = np.vstack([
            # np.hstack([J_2x2[i,j]/Ns[i] * blk(i,j) for j in range(2)])
            np.hstack([J_2x2[i, j] / Ns[i] * blk for j in range(2)])
            for i in range(2)
        ])

        super(SSNHomogRing, self).__init__(n=n,
                                           k=k,
                                           Ne=Ne,
                                           Ni=Ni,
                                           tau_vec=tau_vec,
                                           W=W,
                                           **kwargs)