Skip to content
Snippets Groups Projects
Commit c5761842 authored by Simon Oehrl's avatar Simon Oehrl
Browse files

Comment out unnecessary stuff

parent a507be57
No related branches found
No related tags found
No related merge requests found
...@@ -11,11 +11,10 @@ is not structured spatially. ...@@ -11,11 +11,10 @@ is not structured spatially.
from copy import deepcopy from copy import deepcopy
from math import sqrt from math import sqrt
import numpy as np import numpy as np
from mpl_toolkits.mplot3d import Axes3D # from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt # import matplotlib.pyplot as plt
import nest import nest
import nest.raster_plot
import nest.topology as tp import nest.topology as tp
...@@ -23,6 +22,7 @@ class Brunel3D: ...@@ -23,6 +22,7 @@ class Brunel3D:
def __init__(self): def __init__(self):
self.layer_dict = {} self.layer_dict = {}
nest.SetKernelStatus({"local_num_threads": 1})
nest.Install("streamingmodule") nest.Install("streamingmodule")
# nest.SetKernelStatus({'print_time': True}) # nest.SetKernelStatus({'print_time': True})
...@@ -196,70 +196,70 @@ class Brunel3D: ...@@ -196,70 +196,70 @@ class Brunel3D:
def simulate(self): def simulate(self):
nest.Simulate(1000) nest.Simulate(1000)
def plot_positions(self): # def plot_positions(self):
ex_pos = self.layers[0][1]['positions'] # ex_pos = self.layers[0][1]['positions']
in_pos = self.layers[1][1]['positions'] # in_pos = self.layers[1][1]['positions']
fig = plt.figure() # fig = plt.figure()
ax = Axes3D(fig) # ax = Axes3D(fig)
for c, m, positions in [('b', 'o', ex_pos), ('r', '^', in_pos)]: # for c, m, positions in [('b', 'o', ex_pos), ('r', '^', in_pos)]:
ax.scatter([x for x, y, z in positions], # ax.scatter([x for x, y, z in positions],
[y for x, y, z in positions], # [y for x, y, z in positions],
[z for x, y, z in positions], # [z for x, y, z in positions],
c=c, marker=m) # c=c, marker=m)
def get_results(self): # def get_results(self):
mm = (self.layer_dict['Multimeter'][0] + 1,) # mm = (self.layer_dict['Multimeter'][0] + 1,)
sd = (self.layer_dict['SpikeDetector'][0] + 1,) # sd = (self.layer_dict['SpikeDetector'][0] + 1,)
mm_status = nest.GetStatus(mm)[0] # mm_status = nest.GetStatus(mm)[0]
sd_status = nest.GetStatus(sd)[0] # sd_status = nest.GetStatus(sd)[0]
nest.raster_plot.from_device(sd, hist=True) # nest.raster_plot.from_device(sd, hist=True)
senders = mm_status['events']['senders'] # senders = mm_status['events']['senders']
times = mm_status['events']['times'] # times = mm_status['events']['times']
v_m = mm_status['events']['V_m'] # v_m = mm_status['events']['V_m']
v_th = mm_status['events']['V_th'] # v_th = mm_status['events']['V_th']
step = int(max(senders)/100 + 1) # Only plot results from some GIDs # step = int(max(senders)/100 + 1) # Only plot results from some GIDs
mm_events = [] # mm_events = []
for i in range(1, max(senders) + 1, step): # for i in range(1, max(senders) + 1, step):
if i in senders: # if i in senders:
indices = np.argwhere(senders == i) # indices = np.argwhere(senders == i)
mm_events.append({'GID': i, # mm_events.append({'GID': i,
'times': [times[n] for n in indices], # 'times': [times[n] for n in indices],
'V_m': [v_m[n] for n in indices], # 'V_m': [v_m[n] for n in indices],
'V_th': [v_th[n] for n in indices]}) # 'V_th': [v_th[n] for n in indices]})
return {'multimeter': mm_events, # return {'multimeter': mm_events,
'spike_detector': nest.GetStatus(sd)[0]} # 'spike_detector': nest.GetStatus(sd)[0]}
if __name__ == '__main__': # if __name__ == '__main__':
nest.ResetKernel() # nest.ResetKernel()
print('Making specifications') # print('Making specifications')
brunel = Brunel3D() # brunel = Brunel3D()
brunel.make_layer_specs() # brunel.make_layer_specs()
brunel.make_connection_specs() # brunel.make_connection_specs()
print('Making layers') # print('Making layers')
brunel.make_layers() # brunel.make_layers()
nest.topology.DumpLayerNodes([l[0] for l in brunel.layer_dict.values()][:2], # nest.topology.DumpLayerNodes([l[0] for l in brunel.layer_dict.values()][:2],
'brunel_nodes.txt') # 'brunel_nodes.txt')
print('Making connections') # print('Making connections')
brunel.make_connections() # brunel.make_connections()
brunel.simulate() # brunel.simulate()
print('Getting results') # print('Getting results')
brunel.plot_positions() # brunel.plot_positions()
results = brunel.get_results() # results = brunel.get_results()
for value in ['V_m', 'V_th']: # for value in ['V_m', 'V_th']:
plt.figure() # plt.figure()
for n in results['multimeter'][::20]: # for n in results['multimeter'][::20]:
plt.plot(n['times'], n[value], label='{}'.format(n['GID'])) # plt.plot(n['times'], n[value], label='{}'.format(n['GID']))
plt.legend() # plt.legend()
plt.title(value) # plt.title(value)
plt.show() # plt.show()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment