Skip to content

Commit 214f32c

Browse files
committed
Improved graph export
1 parent e10549b commit 214f32c

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

neuromllite/GraphVizHandler.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class GraphVizHandler(DefaultNetworkHandler):
1818
pop_indices = {}
1919

2020
pop_colors = {}
21+
pop_types = {}
2122

2223
proj_weights = {}
2324
proj_shapes = {}
@@ -119,14 +120,34 @@ def handle_population(self, population_id, component, size=-1, component_obj=Non
119120
fcolor= '#ffffff'
120121

121122
print('Color %s -> %s -> %s'%(properties['color'], rgb, color))
123+
124+
if properties and 'type' in properties:
125+
self.pop_types[population_id] = properties['type']
122126

123127
self.pop_colors[population_id] = color
124128

125-
label = population_id
129+
label = '<%s'%population_id
126130
if self.level>=3:
127-
label = '<%s<br/><i>%s cell%s</i>>'%(population_id, size, '' if size==1 else 's')
131+
label += '<br/><i>%s cell%s</i>'%( size, '' if size==1 else 's')
132+
if self.level>=4:
128133

129-
134+
from neuroml import SpikeSourcePoisson
135+
from pyneuroml.pynml import convert_to_units
136+
137+
if component_obj and isinstance(component_obj,SpikeSourcePoisson):
138+
start = convert_to_units(component_obj.start, 'ms')
139+
if start == int(start): start = int(start)
140+
duration = convert_to_units(component_obj.duration,'ms')
141+
if duration == int(duration): duration = int(duration)
142+
rate = convert_to_units(component_obj.rate,'Hz')
143+
if rate == int(rate): rate = int(rate)
144+
145+
label += '<br/>Spikes %s-%sms @ %sHz'%(start,start+duration, rate)
146+
147+
else:
148+
label += '<br/>%s'%(component)
149+
150+
label += '>'
130151

131152
if properties and 'region' in properties:
132153

@@ -165,6 +186,10 @@ def handle_projection(self, projName, prePop, postPop, synapse, hasWeights=False
165186
self.proj_pre_pops[projName] = prePop
166187
self.proj_post_pops[projName] = postPop
167188

189+
if prePop in self.pop_types:
190+
if 'I' in self.pop_types[prePop]:
191+
shape = 'dot'
192+
168193
if self.nl_network:
169194
#print synapse
170195
#print self.nl_network.synapses

0 commit comments

Comments
 (0)