Пример #1
0
def runSimulations(): 
    seed(183)
    for i in range(202):
        p = random()
        
        print "Probability: " + str(p)
        moduleSize = 100
        moduleNumber = 8
        N0 = moduleSize * moduleNumber
        N1 = 200
        
        generator = NetworkGenerator(moduleSize, moduleNumber, N1, 4, 1000)
        generator.initialize()
        
        
        generator.setCurrentConnectivityMatrix(p = p)
        generator.genNetwork()
        net = generator.net
    
        print "\tNetwork generated"
        
        tTotal = 60000
        dt = 1
        
        firings0, firings1, u0, u1, v0, v1 = run(net, tTotal, dt, N0, N1)
    
        print "\tNetwork ran for 60 sec"    
        a = visualiseMeanFirings(tTotal, firings0, 50, 20)
        np.save(join('SimulationData', 'mean_' + str(p)), a)
        plt.close("all")s
Пример #2
0
@author: fs3314
"""

from networkGenerator import NetworkGenerator
from visualisation import visualiseVoltage, visualiseFirings, visualiseMeanFirings
from simulation import run
import matplotlib.pyplot as plt

#%%
moduleSize = 100
moduleNumber = 8
N0 = moduleSize * moduleNumber
N1 = 200

generator = NetworkGenerator(moduleSize, moduleNumber, N1, 4, 1000)
generator.initialize()

for p in [x/10.0 for x in range(6)]:
    generator.setCurrentConnectivityMatrix(p = p)
    generator.genNetwork()
    net = generator.net
    
    tTotal = 1000
    dt = 1
    
    firings0, firings1, u0, u1, v0, v1 = run(net, tTotal, dt, N0, N1)
    visualiseVoltage(tTotal, u0, u1, v0, v1)
    
    generator.visualize(p, folder = 'Results-Q1')
    visualiseFirings(tTotal, firings0, firings1, N0, N1, p = p, folder = 'Results-Q1')