def plot_topology_EEGs(N, t, save=False, load=False, filepath=None): if load: res = np.load(filepath) elif not load: small = SmallWorldBrain(numberOfNodes=N, averageDegree=5, rewireProbability=0, neuronThreshold=1, refractoryPeriod=1, numberOfIterations=t, fractionToFire=0.05, inhibitoryEdgeMultiplier=0, fireRate=0.01, directed=False) small.execute() lattice = small.get_number_of_excited_neurons() small = SmallWorldBrain(numberOfNodes=N, averageDegree=5, rewireProbability=0.1, neuronThreshold=1, refractoryPeriod=1, numberOfIterations=t, fractionToFire=0.05, inhibitoryEdgeMultiplier=0, fireRate=0.01, directed=False) small.execute() smallworld = small.get_number_of_excited_neurons() small = SmallWorldBrain(numberOfNodes=N, averageDegree=5, rewireProbability=0.8, neuronThreshold=1, refractoryPeriod=1, numberOfIterations=t, fractionToFire=0.05, inhibitoryEdgeMultiplier=0, fireRate=0.01, directed=False) small.execute() random = small.get_number_of_excited_neurons() if save: np.save(filepath, np.array([lattice, smallworld, random])) res = np.array([lattice, smallworld, random]) lattice = [] for _, ye in zip(np.arange(t), [list(i) for i in res[0]]): lattice.append(len(ye)) small = [] for _, ye in zip(np.arange(t), [list(i) for i in res[1]]): small.append(len(ye)) rand = [] for _, ye in zip(np.arange(t), [list(i) for i in res[2]]): rand.append(len(ye)) plt.figure() plt.plot(np.arange(t), np.array(lattice)/10000, label='Lattice', color='black') plt.plot(np.arange(t), np.array(small)/10000, label='Small-World', color='blue') plt.plot(np.arange(t), np.array(rand)/10000, label='Random', color='green') plt.xlabel('Timestep', size=16) plt.tick_params(labelsize=16) plt.ylabel('$N_{excited}/N_{total}$', size=16) plt.legend(prop={'size': 16}, loc='best')
def plot_coverage_variation(N, t, multiplierRegimes=[0, 35, 60]): small1 = SmallWorldBrain(numberOfNodes=N, averageDegree=5, rewireProbability=0.1, neuronThreshold=1, refractoryPeriod=1, numberOfIterations=t, fractionToFire=0.05, inhibitoryEdgeMultiplier=multiplierRegimes[0], fireRate=0.01, directed=False) small1.execute(movie=False) small1Array = [ len( np.unique( np.concatenate(small1.get_number_of_excited_neurons()[:i], axis=0))) / 1000 for i in np.arange(1, t) ] small2 = SmallWorldBrain(numberOfNodes=N, averageDegree=5, rewireProbability=0.1, neuronThreshold=1, refractoryPeriod=1, numberOfIterations=t, fractionToFire=0.05, inhibitoryEdgeMultiplier=multiplierRegimes[1], fireRate=0.01, directed=False) small2.execute(movie=False) small2Array = [ len( np.unique( np.concatenate(small2.get_number_of_excited_neurons()[:i], axis=0))) / 1000 for i in np.arange(1, t) ] small3 = SmallWorldBrain(numberOfNodes=N, averageDegree=5, rewireProbability=0.1, neuronThreshold=1, refractoryPeriod=1, numberOfIterations=t, fractionToFire=0.05, inhibitoryEdgeMultiplier=multiplierRegimes[2], fireRate=0.01, directed=False) small3.execute(movie=False) small3Array = [ len( np.unique( np.concatenate(small3.get_number_of_excited_neurons()[:i], axis=0))) / 1000 for i in np.arange(1, t) ] plt.figure() plt.plot(np.arange(1, t), np.array(small1Array), label='Supercritical', color='blue') plt.plot(np.arange(1, t), np.array(small2Array), label='Critical', color='red') plt.plot(np.arange(1, t), np.array(small3Array), label='Subcritical', color='black') #plt.title('Nodes: %d, <k>:%d, Refractory: %d, Threshold: %d' % (small1.numberOfNodes, small1.averageDegree, small1.refractoryPeriod, small1.neuronThreshold)) plt.xlabel('Timestep', size=16) plt.tick_params(labelsize=16) plt.ylabel('Coverage', size=16) plt.xlim([0, t]) plt.legend()