Good question.
rangevar(xmin:xmax) = minval:maxval
seems quite nonpythonic; maybe somebody who is fluent in Python can propose a reasonable alternative that could be incorporated into the Python interface to NEURON.
Barring that, if you're dead set on specifying taper the way hoc does, you can always cheat.
Code: Select all
h("create dend")
h("dend nseg = 5")
h("dend diam(0:1) = 7:3")
Then
Code: Select all
h("dend for (x,0) print x, diam(x)")
or more pythonically
Code: Select all
for seg in h.dend:
print seg.x, seg.diam
returns
Code: Select all
0.1 6.6
0.3 5.8
0.5 5
0.7 4.2
0.9 3.4
In any case, I suspect that if there isn't a compact Python equivalent for hoc's "range variable taper" syntax, it won't matter much. Few existing models implemented in hoc use the "taper" syntax. For whatever reason, most modelers that use hoc have either assumed cylindrical neurites with constant diameter, or resorted to detailed morphometric data which makes the "taper" syntax irrelevant. On those occasions where a parameter must be varied according to some mathematical rule, it is easy enough to write a procedure that applies the rule to those neurites that need it.