.Shape() does not result until end of execution

When Python is the interpreter, what is a good
design for the interface to the basic NEURON

Moderator: hines

Post Reply
Posts: 2
Joined: Tue Jun 25, 2013 9:39 am
Location: Hebrew University of Jerusalem

.Shape() does not result until end of execution

Post by Ohad.Dan »

My scenario is as such : I am loading a morphology (an exported swc file), create a *shape* graph of the morphology and would like to iterate over the dendrite's branches coloring each in its turn.
The code that performs the task is as follows :

Code: Select all

from neuron import * 
from nrn import *
from time import sleep 

# Load a saved seesion with morphology

# Create a shape with the loaded morphology
h('objref sectionList')
h('sectionList = new SectionList()')
h('soma[0] sectionList.subtree()')    
h('objref shape')
h('shape = new Shape(sectionList)')

#Color each dendrite branch in orange
for i in range (len(h.dend)):
    h('access dend[' + str(i) + ']')
    # Print to screen so we know the program runs
This all works well except that while the iteration is occurring, the branches do not get colored each in its turn but rather the shape screen freezes until the iteration is complete then all the branches are colored.
I have tried to use flush() or observe() within the loop and increasing the sleep time, but neither had any effect.

My question is, what should be changed in the above implementation in order to see the color changes occur in real time (and not wait for the end of the iteration to observe the changes)?

Post Reply