How to use the neuron.h.ref 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 Neurosim-lab / netpyne / doc / source / code / mechs.py View on Github external
def ptype():
    msname = h.ref('')
    propList = {}
    for i, mechtype in enumerate(['mechs','pointps']):
        mt = h.MechanismType(i)  # either distributed mechs (0) or point process (1)
        propList[mechtype] = {}
        for j in range(int(mt.count())):
            mt.select(j)
            mt.selected(msname)
            print('\n\n', msname[0], ' mechanismtype=%d' % j)
            pname(msname[0])
            ms = h.MechanismStandard(msname[0], 1) # PARAMETER (modifiable)
            propList[mechtype][msname[0]] = []
            propName = h.ref('')
            for prop in range(int(ms.count())):
                k = ms.name(propName, prop)
                propList[mechtype][msname[0]].append(propName[0])
    print(propList)
github neuronsimulator / nrn / share / lib / python / neuron / gui2 / rangevar.py View on Github external
def get_rangevars(mech_name):
    ms = h.MechanismStandard(mech_name)
    suffix = '_' + mech_name
    lensuffix = len(suffix)
    mname = h.ref('')
    result = []
    for i in range(int(ms.count())):
        ms.name(mname, i)
        my_mname = mname[0]
        if my_mname.endswith(suffix):
            my_mname = my_mname[:-lensuffix]
        result.append({'type': 'NEURONMECH', 'mech': mech_name, 'var': my_mname, 'name': mech_name + '.' + my_mname})
    return result
github Neurosim-lab / netpyne / netpyne / conversion / neuronPyHoc.py View on Github external
def mechVarList ():
    msname = h.ref('')
    varList = {}
    for i, mechtype in enumerate(['mechs','pointps']):
        mt = h.MechanismType(i)  # either distributed mechs (0) or point process (1)
        varList[mechtype] = {}
        for j in range(int(mt.count())):
            mt.select(j)
            mt.selected(msname)
            ms = h.MechanismStandard(msname[0], 1) # PARAMETER (modifiable)
            varList[mechtype][msname[0]] = []
            propName = h.ref('')
            for var in range(int(ms.count())):
                k = ms.name(propName, var)
                varList[mechtype][msname[0]].append(propName[0])
    return varList
github Neurosim-lab / netpyne / netpyne / utils.py View on Github external
def mechVarList ():
    msname = h.ref('')
    varList = {}
    for i, mechtype in enumerate(['mechs','pointps']):
        mt = h.MechanismType(i)  # either distributed mechs (0) or point process (1)
        varList[mechtype] = {}
        for j in xrange(int(mt.count())):
            mt.select(j)
            mt.selected(msname)
            ms = h.MechanismStandard(msname[0], 1) # PARAMETER (modifiable)
            varList[mechtype][msname[0]] = []
            propName = h.ref('')
            for var in xrange(int(ms.count())):
                k = ms.name(propName, var)
                varList[mechtype][msname[0]].append(propName[0])
    return varList
github Neurosim-lab / netpyne / netpyne / conversion / neuronPyHoc.py View on Github external
def mechVarList ():
    msname = h.ref('')
    varList = {}
    for i, mechtype in enumerate(['mechs','pointps']):
        mt = h.MechanismType(i)  # either distributed mechs (0) or point process (1)
        varList[mechtype] = {}
        for j in range(int(mt.count())):
            mt.select(j)
            mt.selected(msname)
            ms = h.MechanismStandard(msname[0], 1) # PARAMETER (modifiable)
            varList[mechtype][msname[0]] = []
            propName = h.ref('')
            for var in range(int(ms.count())):
                k = ms.name(propName, var)
                varList[mechtype][msname[0]].append(propName[0])
    return varList
github Neurosim-lab / netpyne / doc / source / code / mechs.py View on Github external
def ptype():
    msname = h.ref('')
    propList = {}
    for i, mechtype in enumerate(['mechs','pointps']):
        mt = h.MechanismType(i)  # either distributed mechs (0) or point process (1)
        propList[mechtype] = {}
        for j in range(int(mt.count())):
            mt.select(j)
            mt.selected(msname)
            print('\n\n', msname[0], ' mechanismtype=%d' % j)
            pname(msname[0])
            ms = h.MechanismStandard(msname[0], 1) # PARAMETER (modifiable)
            propList[mechtype][msname[0]] = []
            propName = h.ref('')
            for prop in range(int(ms.count())):
                k = ms.name(propName, prop)
                propList[mechtype][msname[0]].append(propName[0])
    print(propList)
github MetaCell / NetPyNE-UI / netpyne_ui / neuron_geometries_utils.py View on Github external
def mechVarList():
    msname = h.ref('')
    varList = {}
    for i, mechtype in enumerate(['mechs', 'pointps']):
        # either distributed mechs (0) or point process (1)
        mt = h.MechanismType(i)
        varList[mechtype] = {}
        for j in range(int(mt.count())):
            mt.select(j)
            mt.selected(msname)
            ms = h.MechanismStandard(msname[0], 1)  # PARAMETER (modifiable)
            varList[mechtype][msname[0]] = []
            propName = h.ref('')
            for var in range(int(ms.count())):
                k = ms.name(propName, var)
                varList[mechtype][msname[0]].append(propName[0])
    return varList
github neuronsimulator / nrn / share / lib / python / neuron / psection.py View on Github external
def psection(sec):
    from neuron import h
    try:
        from neuron import rxd
        from neuron.rxd import region, species
        from neuron.rxd import rxd as rxd_module
        have_rxd = True
    except:
      have_rxd = False

    results = {}

    mname = h.ref('')

    # point processes
    pps = {}
    mt = h.MechanismType(1)
    for i in range(int(mt.count())):
        mt.select(i)
        mypps = set()
        pp = mt.pp_begin(sec=sec)
        while pp is not None:
            mypps.add(pp)
            pp = mt.pp_next()
        if mypps:
            mt.selected(mname)
            pps[mname[0]] = mypps
    results['point_processes'] = pps