Skip to content

Commit 747bbee

Browse files
committed
Partial fix to traub 2005 demo.
1 parent d458ca8 commit 747bbee

3 files changed

Lines changed: 17 additions & 16 deletions

File tree

snippets/nsdf_vec.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
# Maintainer:
77
# Created: Sat Dec 19 22:27:27 2015 (-0500)
88
# Version:
9-
# Last-Updated: Tue Dec 29 12:50:02 2015 (-0500)
9+
# Last-Updated: Thu Aug 11 11:09:33 2016 (-0400)
1010
# By: Subhasis Ray
11-
# Update #: 134
11+
# Update #: 135
1212
# URL:
1313
# Keywords:
1414
# Compatibility:
@@ -100,7 +100,7 @@ def write_nsdf():
100100
pulse.delay[0] = 5 * (ii+1)
101101
pulse.width[0] = 20
102102
t_lead.threshold = 0.5
103-
moose.connect(pulse, 'output', t_lead,'Vm');
103+
moose.connect(pulse, 'output', t_lead,'Vm')
104104
moose.connect(nsdf, 'requestOut', pulse, 'getOutputValue')
105105
# ei = nsdf.eventInput[ii]
106106
# moose.connect(t_lead, 'spikeOut', ei, 'input')

traub_2005/py/display_morphology.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
# Maintainer:
77
# Created: Fri Mar 8 11:26:13 2013 (+0530)
88
# Version:
9-
# Last-Updated: Sat Aug 6 15:47:37 2016 (-0400)
10-
# By: subha
11-
# Update #: 377
9+
# Last-Updated: Thu Aug 11 11:29:36 2016 (-0400)
10+
# By: Subhasis Ray
11+
# Update #: 389
1212
# URL:
1313
# Keywords:
1414
# Compatibility:
@@ -76,8 +76,8 @@ def cell_to_graph(cell, label=False):
7676
msg = 'distalOut'
7777
else:
7878
raise Exception('No neighbors on raxial or distal')
79-
es = [(c1.path, c2[0].path, {'weight': 2/ (moose.Compartment(c1).Ra + moose.Compartment(c2).Ra)}) \
80-
for c1 in moose.wildcardFind('%s/##[ISA=Compartment]' % (cell.path)) \
79+
es = [(c1.path, c2[0].path, {'weight': 2/ (c1.Ra + c2[0].Ra)}) \
80+
for c1 in moose.wildcardFind('%s/##[ISA=CompartmentBase]' % (cell.path)) \
8181
for c2 in moose.Compartment(c1).neighbors[msg]]
8282
g = nx.Graph()
8383
g.add_edges_from(es)
@@ -109,7 +109,7 @@ def plot_cell_topology(cell, label=False):
109109
weights = np.array([g.edge[e[0]][e[1]]['weight'] for e in g.edges()])
110110
try:
111111
pos = nx.graphviz_layout(g,prog='twopi',root=cell.path + '/comp_1')
112-
except NameError, AttributeError:
112+
except (NameError, AttributeError) as e:
113113
# this is the best networkx can do by itself. Its Furchtman
114114
# Reingold layout ends up with overlapping edges even for a
115115
# tree. igraph does much better.
@@ -151,7 +151,6 @@ def plot_cell_topology(cell, label=False):
151151
print('-p filename (optional) save outputin a pdf file named "filename".')
152152
print('-h,--help print this help')
153153
sys.exit(0)
154-
print( 'args', optlist, args)
155154
figures = []
156155
if len(celltype) > 0:
157156
try:

traub_2005/py/gui.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
# Maintainer:
77
# Created: Fri Jul 12 11:53:50 2013 (+0530)
88
# Version:
9-
# Last-Updated: Sat Aug 6 14:30:41 2016 (-0400)
10-
# By: subha
11-
# Update #: 743
9+
# Last-Updated: Thu Aug 11 11:59:17 2016 (-0400)
10+
# By: Subhasis Ray
11+
# Update #: 746
1212
# URL:
1313
# Keywords:
1414
# Compatibility:
@@ -195,9 +195,10 @@ def displayGraph(self, g, label=False):
195195
print('Empty graph for cell. Make sure proto file has `*asymmetric` on top. I cannot handle symmetric compartmental connections')
196196
return
197197
weights = np.array([g.edge[e[0]][e[1]]['weight'] for e in g.edges()])
198-
#pos = nx.graphviz_layout(g, prog='twopi')
199-
from networkx.drawing.nx_agraph import graphviz_layout
200-
pos = graphviz_layout(g, prog='twopi')
198+
try:
199+
pos = nx.graphviz_layout(g, prog='twopi')
200+
except (NameError, AttributeError) as e:
201+
pos = nx.spectral_layout(g)
201202
xmin, ymin, xmax, ymax = 1e9, 1e9, -1e9, -1e9
202203
for p in pos.values():
203204
if xmin > p[0]:
@@ -211,6 +212,7 @@ def displayGraph(self, g, label=False):
211212
edge_widths = 10.0 * weights / max(weights)
212213
node_colors = ['k' if x in axon else 'gray' for x in g.nodes()]
213214
lw = [1 if n.endswith('comp_1') else 0 for n in g.nodes()]
215+
print('Edge widths:', edge_widths)
214216
self.axes.clear()
215217
self.axes.set_xlim((xmin-10, xmax+10))
216218
self.axes.set_ylim((ymin-10, ymax+10))

0 commit comments

Comments
 (0)