Syntax:
ms = h.MechanismStandard(name_str) ms = h.MechanismStandard(name_str, vartype)
With no vartype or vartype = 1, this provides storage for parameter values of a membrane mechanism or point process. This class is useful in maintaining a default set of parameters and can be used to specify values for a set of sections.
name_str is a density mechanism such as hh or a point process such as VClamp. A MechanismStandard instance, when created, contains default values for all parameters associated with the mechanism.
In combination with the MechanismType class it is possible to create generic graphical interface widgets that are independent of the particular mechanism and parameter names.
If vartype = 1, 2, or 3, the storage is for PARAMETER, ASSIGNED, or STATE variables respectively. If vartype = 0, the storage is for all three types.
If vartype = -1, the count and names (and array size) of the GLOBAL variables are accessible, but any other method will generate an error message.
Example:
from neuron import h, gui ms1 = h.MechanismStandard('hh') ms2 = h.MechanismStandard('AlphaSynapse') ms2.set('gmax', 0.3) ms1.panel() ms2.panel() objref ms1, ms2 ms1 = new MechanismStandard("hh") ms2 = new MechanismStandard("AlphaSynapse") ms2.set("gmax", .3) ms1.panel() ms2.panel()![]()
The following example prints all the names associated with POINT_PROCESS and SUFFIX mechanisms.
from neuron import h, gui soma = h.Section() def pname(msname): s = h.ref('') for i in xrange(-1, 4): ms = h.MechanismStandard(msname, i) print '\n', msname, ' vartype=%d' % i for j in xrange(int(ms.count())): k = ms.name(s, j) print '%-5d %-20s size=%d' % (j, s[0], k) def ptype(): msname = h.ref('') for i in xrange(2): mt = h.MechanismType(i) for j in xrange(int(mt.count())): mt.select(j) mt.selected(msname) print '\n\n', msname[0], ' mechanismtype=%d' % j pname(msname[0]) ptype()
See also
ms.panel()
ms.panel("string")
Popup a panel of parameters for this mechanism. It's a good idea to set the default values before generating the panel.
With no argument the first item in the panel will be the name of the mechanism. Otherwise the string is used as the first item label.
See also
ms.action("hoc_command")
Warning
Currently only takes a HOC string and does not work with a Python callable.
ms.in()
ms.in(x)
ms.in(pointprocess)
ms.in(mechanismstandard)
copies parameter values into this mechanism standard from ...
If the source is not the same type as the standard then nothing happens.
ms.out()
ms.out(x)
ms.out(pointprocess)
ms.out(mechanismstandard)
copies parameter values from this mechanism standard to ...
If the target is not the same type as the standard then nothing happens.
ms.set('varname', val [, arrayindex])
val = ms.get('varname' [, arrayindex])
ms.save('name')
cnt = ms.count()
ms.name(strref)
size = ms.name(strref, i)
The single arg form assigns the name of the mechanism to the strref variable.
When the i parameter is present (i ranges from 0 to ms.count()-1) the strref parameter gets assigned the ith name of the mechanism represented by the MechanismStandard. In addition the return value is the array size of that parameter (1 for a scalar).
Example:
from neuron import h, gui ms = h.MechanismStandard('hh') name_strref = h.ref('') # read the name of the mechanism ms.name(name_strref) print name_strref[0] # displays: hh