Esempio n. 1
0
    M = (np.outer(m1, n1) + np.outer(m2, n2)) / N
    J = R + M

    for j in range(Ntrials):

        print j

        Z = sim.SimulateActivity(t, sim.GetGaussianVector(0, 1, N), J, I=0)

        Z_sample[j, :, :] = Z[:, 0:Nsample]
        K1_sim[j, :] = np.dot(np.tanh(Z), n1) / N
        K2_sim[j, :] = np.dot(np.tanh(Z), n2) / N

    # Store

    fac.Store(Z_sample, 'Z_sample.p', path_here)
    fac.Store(K1_sim, 'K1_sim.p', path_here)
    fac.Store(K2_sim, 'K2_sim.p', path_here)

else:

    # Retrieve

    Z_sample = fac.Retrieve('Z_sample.p', path_here)
    K1_sim = fac.Retrieve('K1_sim.p', path_here)
    K2_sim = fac.Retrieve('K2_sim.p', path_here)

#### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### ####
#### Plot

fac.SetPlotParams()
Esempio n. 2
0
                  i] = delta0_c[2, i] - (Sim * Mn *
                                         mf.Phi(mu_c[2, i], delta0_c[2, i]))**2
        radius[2, i] = g * np.sqrt(integ.PrimeSq(mu_s[2, i], delta0_s[2, i]))

        ### Compute the stability outliers

        outlier[0, i] = mf.EigStationary(g, ParVec,
                                         [mu_s[0, i], delta0_s[0, i]])
        outlier[1, i] = mf.EigStationary(g, ParVec,
                                         [mu_s[1, i], delta0_s[1, i]])
        outlier[2, i] = mf.EigStationary(g, ParVec,
                                         [mu_s[2, i], delta0_s[2, i]])

    # Store

    fac.Store(mu_s, 'mu_s.p', path_here)
    fac.Store(delta0_s, 'delta0_s.p', path_here)
    fac.Store(delta0I_s, 'delta0I_s.p', path_here)
    fac.Store(mu_c, 'mu_c.p', path_here)
    fac.Store(delta0_c, 'delta0_c.p', path_here)
    fac.Store(deltainf_c, 'deltainf_c.p', path_here)
    fac.Store(delta0I_c, 'delta0I_c.p', path_here)
    fac.Store(deltainfI_c, 'deltainfI_c.p', path_here)
    fac.Store(radius, 'radius.p', path_here)
    fac.Store(outlier, 'outlier.p', path_here)

else:

    # Retrieve

    mu_s = fac.Retrieve('mu_s.p', path_here)
Esempio n. 3
0
    ### Generate the matrix

    R = g * sim.GetBulk(N)
    m = sim.GetGaussianVector(Mm, Sim, N)
    n = sim.GetGaussianVector(Mn, Sin, N)
    M = np.outer(m, n) / N
    J = R + M

    ### Simulate

    Z = sim.SimulateActivity(t, sim.GetGaussianVector(0, 1, N), J, I=0)

    # Store

    fac.Store(Z[:, 0:Nsample], 'Z.p', path_here)

else:

    # Retrieve

    Z = fac.Retrieve('Z.p', path_here)

#### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### ####
### Plot

fac.SetPlotParams()

fg = plt.figure()
ax0 = plt.axes(frameon=True)
Esempio n. 4
0
readout[0, len(t1):len(t1) + len(t2)] = np.dot(np.tanh(Z0), w) / N
readout[1, len(t1):len(t1) + len(t2)] = np.dot(np.tanh(Z1), w) / N

### Phase 3: no inputs

Z0 = sim.SimulateActivity(t3, Z0[-1, :], J, I=0)
Z1 = sim.SimulateActivity(t3, Z1[-1, :], J, I=0)

activation[0, len(t1) + len(t2):, :] = Z0
activation[1, len(t1) + len(t2):, :] = Z1

readout[0, len(t1) + len(t2):] = np.dot(np.tanh(Z0), w) / N
readout[1, len(t1) + len(t2):] = np.dot(np.tanh(Z1), w) / N

# Store

fac.Store(ParVec, 'ParVec.p', path_data)

fac.Store(readout, 'readout.p', path_data)
fac.Store(activation, 'activation.p', path_data)
fac.Store(structure, 'structure.p', path_data)

fac.Store(t, 't.p', path_data)
fac.Store(t1, 't1.p', path_data)
fac.Store(t2, 't2.p', path_data)
fac.Store(t3, 't3.p', path_data)

fac.Store(average_connectivity, 'average_connectivity.p', path_data)

#
Esempio n. 5
0
        ics_0 = [ mu_s[0,i], delta0_s[0,i], K_s[0,i] ]
        
        ### Compute NEGATIVE solutions

        mu_s[1,i], delta0_s[1,i], K_s[1,i] = mf.SolveStatic ( ics_1, g, ParVec)
        ics_1 = [ mu_s[1,i], delta0_s[1,i], K_s[1,i] ]

        ics_2 = [Mm*K_s[1,i]+0.1 + Mi, 0.1*delta0_s[1,i], K_s[1,i]+0.1]

        ### Compute CENTRAL solution

        mu_s[2,i], delta0_s[2,i], K_s[2,i] = mf.SolveStatic ( ics_2, g, ParVec, backwards = -1. )

    # Store

    fac.Store( K_s, 'K_s.p', path_here)
    fac.Store( mu_s, 'mu_s.p', path_here)
    fac.Store( delta0_s, 'delta0_s.p', path_here)

else:

    # Retrieve

    K_s = fac.Retrieve('K_s.p', path_here)
    mu_s = fac.Retrieve('mu_s.p', path_here)
    delta0_s = fac.Retrieve('delta0_s.p', path_here)


#### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### 
### Plot
Esempio n. 6
0
I = gammaOFF * IctxA + gammaON * IctxB + IA
ZA = sim.SimulateActivity(t2, Z[-1, :], J, I)
activation_B[0, len(t1):, :] = ZA
readout_B[0, len(t1):] = np.dot(np.tanh(ZA), w) / N

# B
I = gammaOFF * IctxA + gammaON * IctxB + IB
ZB = sim.SimulateActivity(t2, Z[-1, :], J, I)
activation_B[1, len(t1):, :] = ZB
readout_B[1, len(t1):] = np.dot(np.tanh(ZB), w) / N

print readout_B[0, -1], readout_B[1, -1]

# Store

fac.Store(ParVec, 'ParVec.p', path_data)

fac.Store(readout_A, 'readout_A.p', path_data)
fac.Store(readout_B, 'readout_B.p', path_data)

fac.Store(activation_A, 'activation_A.p', path_data)
fac.Store(activation_B, 'activation_B.p', path_data)

fac.Store(structure, 'structure.p', path_data)

fac.Store(t, 't.p', path_data)
fac.Store(t1, 't1.p', path_data)
fac.Store(t2, 't2.p', path_data)

#
Esempio n. 7
0
        activation[i, j, 0:len(t1), :] = Z_start
        readout[i, j, 0:len(t1)] = np.dot(np.tanh(Z_start), w) / N

        Z = sim.SimulateActivity_Noise(t2,
                                       Z_start[-1, :],
                                       J,
                                       c=c,
                                       sigma=sigma,
                                       I=I,
                                       h=h)

        activation[i, j, len(t1):, :] = Z
        readout[i, j, len(t1):] = np.dot(np.tanh(Z), w) / N

# Store

fac.Store(ParVec, 'ParVec.p', path_data)
fac.Store(c_values, 'c_values.p', path_data)
fac.Store(sigma, 'sigma.p', path_data)

fac.Store(readout, 'readout.p', path_data)
fac.Store(activation, 'activation.p', path_data)
fac.Store(structure, 'structure.p', path_data)

fac.Store(t, 't.p', path_data)
fac.Store(t1, 't1.p', path_data)
fac.Store(t2, 't2.p', path_data)

#
                [0.8 * readout[1, i], delta0_cl],
                g,
                ParVec,
                p,
                pm,
                pI,
                backwards=-1)

            eig = mf.EigStationary(g, ParVec, [readout[2, i], delta0_cl], p,
                                   pm, pI)
            outlier[2, i] = eig[0]
            radius[2, i] = g * np.sqrt(integ.PrimeSq(0, delta0_cl))

    # Store

    fac.Store(readout, 'readout.p', 'VaryA/')
    fac.Store(outlier, 'outlier.p', 'VaryA/')
    fac.Store(radius, 'radius.p', 'VaryA/')

else:

    # Retrieve

    readout = fac.Retrieve('readout.p', 'VaryA/')
    outlier = fac.Retrieve('outlier.p', 'VaryA/')
    radius = fac.Retrieve('radius.p', 'VaryA/')

#### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### ####
#### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### #### ####
### Plot