How to use the neuron.h.define_shape function in NEURON

To help you get started, we’ve selected a few NEURON examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neuronsimulator / nrn / share / lib / python / neuron / rxd / rxd.py View on Github external
def _init():
    if len(species._all_species) == 0:
        return None
    initializer._do_init()
    # TODO: check about the 0
github mattions / neuronvisio / neuronvisio / manager.py View on Github external
def _save_geom(self, h5file_holder):
        """Store the NeuroML in the geometry table"""
        
        # writing the NeuroML model
        h.define_shape() # We need the 3D points
        
        h.load_file('mview.hoc')
        modelView = h.ModelView(0)
        modelXml = h.ModelViewXML(modelView)
        tmp_file = 'temp.xml'
        modelXml.xportLevel1(tmp_file)
        
        xml_data = ''
        with open(tmp_file, 'r') as f:
            xml_data = f.read()
        geom_group = h5file_holder.createGroup('/', self.geometry_root)
        h5file_holder.createArray(geom_group, self.geometry_node_name, 
                                  xml_data)
        os.remove(tmp_file)
github research-team / robot-dream / Nociception / cfiber.py View on Github external
def define_geometry(self):
        '''
        Adds length and diameter to sections
        '''
        for sec in self.stimsec:
            sec.L = self.L# microns
            sec.diam = self.diam # microns
        self.branch.L = self.L
        self.branch.diam = self.diam
        self.branch.nseg = 1
        h.define_shape() # Translate into 3D points.
    def position(self):
github neuronsimulator / nrn / share / lib / python / neuron / crxd / species.py View on Github external
from . import rxd
        # TODO: if a list of sections is passed in, make that one region
        # _species_count is used to create a unique _real_name for the species
        global _species_count


        regions = self.regions
        self._real_name = self._name
        initial = self.initial
        charge = self._charge

        # invalidate any old initialization of external solvers
        rxd._external_solver_initialized = False
        
        # TODO: check about the 0
github AllenInstitute / biophys_optimize / biophys_optimize / neuron_passive_fit.py View on Github external
swc = h.Import3d_SWC_read()
    swc.input(swc_path)
    imprt = h.Import3d_GUI(swc, 0)
    h("objref this")
    imprt.instantiate(h.this)

    for sec in h.allsec():
        if sec.name().startswith("axon"):
            h.delete_section(sec=sec)

    axon = h.Section()
    axon.L = 60
    axon.diam = 1
    axon.connect(h.soma[0], 0.5, 0)

    h.define_shape()

    for sec in h.allsec():
        sec.insert('pas')
        for seg in sec:
            seg.pas.e = 0

    for file_path in file_paths:
        h.load_file(file_path.encode("ascii", "ignore"))
github AllenInstitute / bmtk / bmtk / simulator / bionet / default_setters / cell_models.py View on Github external
"""
    for sec in hobj.axon:
        h.delete_section(sec=sec)

    h.execute('create axon[2]', hobj)

    for sec in hobj.axon:
        sec.L = 30
        sec.diam = 1
        hobj.axonal.append(sec=sec)
        hobj.all.append(sec=sec)  # need to remove this comment

    hobj.axon[0].connect(hobj.soma[0], 0.5, 0)
    hobj.axon[1].connect(hobj.axon[0], 1, 0)

    h.define_shape()
github AllenInstitute / bmtk / docs / examples / simulator / bionet / 14cells_nsyns / set_cell_params.py View on Github external
"""
    for sec in hobj.axon:
        h.delete_section(sec=sec)

    h.execute('create axon[2]', hobj)

    for sec in hobj.axon:
        sec.L = 30
        sec.diam = 1
        hobj.axonal.append(sec=sec)
        hobj.all.append(sec=sec)  # need to remove this comment

    hobj.axon[0].connect(hobj.soma[0], 0.5, 0)
    hobj.axon[1].connect(hobj.axon[0], 1, 0)

    h.define_shape()
github AllenInstitute / bmtk / bmtk / simulator / bionet / default_setters / cell_models.py View on Github external
h.delete_section(sec=sec)
    h.execute('create axon[2]', hobj)
    hobj.axon[0].connect(hobj.soma[0], 1.0, 0)
    hobj.axon[1].connect(hobj.axon[0], 1.0, 0)

    h.pt3dadd(beg1[0], beg1[1], beg1[2], axon_diams[0], sec=hobj.axon[0])
    h.pt3dadd(end1[0], end1[1], end1[2], axon_diams[0], sec=hobj.axon[0])
    hobj.all.append(sec=hobj.axon[0])
    h.pt3dadd(beg2[0], beg2[1], beg2[2], axon_diams[1], sec=hobj.axon[1])
    h.pt3dadd(end2[0], end2[1], end2[2], axon_diams[1], sec=hobj.axon[1])
    hobj.all.append(sec=hobj.axon[1])

    hobj.axon[0].L = 30.0
    hobj.axon[1].L = 30.0

    h.define_shape()

    for sec in hobj.axon:
        # io.log_info('sec.L: {}'.format(sec.L))
        if np.abs(30 - sec.L) > 0.0001:
            io.log_exception('Axon stub L is less than 30')