1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
|
.. _hoc_mechtype:
MechanismType
-------------
.. hoc:class:: MechanismType
Syntax:
``mt = new MechanismType(0)``
``mt = new MechanismType(1)``
Description:
Provides a way of iterating over all membrane mechanisms or point
processes and allows selection via a menu or under hoc control.
The 0 argument creates a list of all available distributed
membrane mechanisms (as opposed to PointProcesses). eg "hh", "pas", "extracellular". that can
be inserted into a section.
The 1 argument creates a
list of all available Point Processes.
eg. IClamp, AlphaSynapse, VClamp.
Mechanism order is the same as the argument order that created the "special"
during \ ``nrnivmodl`` or \ ``mknrndll``. Therefore when a saved session depends
on information in a \ ``MechanismType`` it is dependent on a particular special
or dll.
Example:
.. code-block::
none
objref mt
//Print the names of all density mechanisms
mt = new MechanismType(0)
strdef mname
for i=0, mt.count()-1 {
mt.select(i)
mt.selected(mname)
print mname
}
.. seealso::
:hoc:class:`MechanismStandard`
----
.. hoc:method:: MechanismType.select
Syntax:
``mt.select("name")``
``mt.select(i)``
Description:
selects either the named mechanism or the i'th mechanism in the list.
----
.. hoc:method:: MechanismType.selected
Syntax:
``i = mt.selected([strdef])``
Description:
returns the index of the current selection. If present, strarg is assigned
to the name of the current selection.
----
.. hoc:method:: MechanismType.remove
Syntax:
``mt.remove()``
Description:
For distributed mechanisms invoked with the "insert" statement.
Deletes selected mechanism from currently
accessed section. A nop if the mechanism is not in the section.
----
.. hoc:method:: MechanismType.make
Syntax:
``mt.make()``
``mt.make(objectvar)``
Description:
\ ``mt.make()``
For distributed mechanisms. Inserts selected mechanism into currently
accessed section.
\ ``mt.make(objectvar)``
For point processes. The arg becomes a reference to a new point process
of type given by the selection.
Note that the newly created point process is not located in any section.
Note that if *objectvar* was the only reference to another object then
that object is destroyed.
----
.. hoc:method:: MechanismType.count
Syntax:
``i = mt.count()``
Description:
The number of different mechanisms in the list.
----
.. hoc:method:: MechanismType.menu
Syntax:
``mt.menu()``
Description:
Inserts a special menu into the currently open \ ``xpanel``. The menu
label always reflects the current selection. Submenu items are indexed
according to position with the first item being item 0. When the mouse
button is released on a submenu item that item becomes the selection
and the action (if any) is executed.
----
.. hoc:method:: MechanismType.action
Syntax:
``mt.action("command")``
Description:
The action to be executed when a submenu item is selected.
----
.. hoc:method:: MechanismType.is_netcon_target
Syntax:
``boolean = mt.is_netcon_target(i)``
Description:
The i'th point process has a NET_RECEIVE block and can therefore be
a target for a :hoc:class:`NetCon` object.
----
.. hoc:method:: MechanismType.has_net_event
Syntax:
``boolean = mt.has_net_event(i)``
Description:
The i'th point process has a net_event call in its NET_RECEIVE block
and can therefore be a source for a :hoc:class:`NetCon` object.
This means it is :hoc:class:`NetCon` stimulator or that
the point process can be used as an artificial neural network cell.
----
.. hoc:method:: MechanismType.is_artificial
Syntax:
``boolean = mt.is_artificial(i)``
Description:
The i'th point process is an ARTIFICIAL_CELL
and can therefore be a source for a :hoc:class:`NetCon` object.
This means it is :hoc:class:`NetCon` stimulator or that
the point process can be used as an artificial neural network cell.
This seems to have, but does not, equivalent functionality to
:hoc:func:`has_net_event` and was introduced because ARTIFICIAL_CELL objects are no
longer located in sections. Some ARTIFICIAL_CELLs such as the PatternStim
do not make use of net_event in their implementation, and some PointProcesses
do use net_event and must be located in sections for their proper function,
e.g. reciprocal synapses.
----
.. hoc:method:: MechanismType.pp_begin
Syntax:
``obj = mt.pp_begin()``
Description:
Initializes an iterator used to iterate over point processes of
a particular type in the currently accessed section.
Returns the first point process in the currently accessed
section having the type specified by the :hoc:meth:`MechanismType.select`
statement. This only works if the the MechanismType was instantiated
with the (1) argument. If there is no such point process in the
section the method returns NULLobject. Note that, prior to version
6.2, although
the x=1 node is normally
considered to be part of the section, the parent node
was not looked at (normally x = 0) unless the section was the
root of the tree. As of version 6.2, both the 0 and 1 locations
are looked at and if the point process used the section to locate
it, then it is returned. If the point process used the child or
parent section to locate it, it is not returned.
Example:
.. code-block::
none
create cable
access cable
nseg = 5
objref stim[3]
for i=0,2 stim[i] = new IClamp(i/2)
objref mt, pp
mt = new MechanismType(1)
mt.select("IClamp")
for (pp = mt.pp_begin(); object_id(pp) != 0; pp = mt.pp_next()) {
x = pp.get_loc()
printf("%s located at %s(%g)\n", pp, secname(), x)
pop_section()
}
----
.. hoc:method:: MechanismType.pp_next
Syntax:
``obj = mt.pp_next()``
Description:
Returns the next point process of the type and in the section that
were specified in the earlier call to :hoc:meth:`MechanismType.pp_begin` .
When there are no more point processes, the return value is NULLobject.
----
.. hoc:method:: MechanismType.internal_type
Syntax:
``internal_type = mt.internal_type()``
Description:
Return the internal type index of the selected mechanism.
|