Creating cell templates for Network Builder

The basics of how to develop, test, and use models.
Post Reply
pedrofelix
Posts: 2
Joined: Thu Nov 28, 2024 8:33 am

Creating cell templates for Network Builder

Post by pedrofelix »

Hello,
I've been having some issues regarding the Network builder.
I've created a cell template in Python with the objective of instantiating it so that when the GUI opens it is available on the Network Builder's list.
I tried many approaches such as loading a hoc file, trying to manually import a cell, etc, but all failed.
Ideally, I need the whole process to be programmatic and automatic rather than having to upload/create something manually in the interface.
What should I do?

This is an example code:

Code: Select all

from neuron import h

class MyCell:
    def __init__(self):
        self.soma = h.Section(name='soma', cell=self)
        self.dend = h.Section(name='dend', cell=self)
        self.dend.connect(self.soma(0.5))

        self.soma.L = self.soma.diam = 12
        self.dend.L = 100
        self.dend.diam = 1

        for sec in [self.soma, self.dend]:
            sec.Ra = 100
            sec.cm = 1
            sec.insert('pas')

        self.soma.insert('hh')


cell = MyCell(1)


h("objref cell_soma")
h.cell_soma = cell.soma


h("nb.addcell(cell_soma)")
Post Reply