def get_section_properties(sec): out = OutputGrabber(sys.stdout) out.start() psection(sec) out.stop() raw_output = out.capturedtext lines = raw_output.split("\n") name, params = lines[0].split(" { ") for s in params.split(): exec(s) # nseg, L, Ra output = {name: {"nseg": nseg, "L": L, "Ra": Ra, "mechanisms": {}}} i = 1 for line in lines[1:]: if "insert" in line: # consider doing this with a regexp start = line.find("insert") + 7 lbracket = line.find("{") rbracket = line.find("}") mech_name = line[start:lbracket - 1] output[name]["mechanisms"][mech_name] = {} for s in line[lbracket + 1:rbracket].split(): pname, value = s.split("=") output[name]["mechanisms"][mech_name][pname] = float(value) return output
def psection(self): if self.name != self.hoc_name: print "%s: " % self.name, neuron.psection(self)
def psection(cls): """Test neuron.psection(Section)""" s = h.Section(name='soma') neuron.psection(s)
def psection(self): if self.name != self.hoc_name: sys.stdout.write("%s: " % self.name) neuron.psection(self)
def testpsection(self): """Test neuron.psection(Section)""" s = h.Section(name='soma') neuron.psection(s)