SectionList
allroots · append · children · printnames · remove · size · subtree · unique · wholetree

SectionList

class SectionList

Syntax:

sl = n.SectionList()
sl = n.SectionList(python_iterable_of_sections)
Description:

Class for creating and managing a list of sections. Unlike a regular list, a SectionList allows including sections based on neuronal morphology (e.g. subtrees).

Example Usage:

If sl is a SectionList, then to turn that into a Python list, use py_list = list(sl); note that iterating over a SectionList is supported, so it may not be neccessary to create a Python list.

The second syntax creates a SectionList from the Python iterable and is equivalent to:

sl = n.SectionList()
for sec in python_iterable_of_sections:
    sl.append(sec)

len(sl) returns the number of sections in the SectionList.

list(sl) and [s for s in sl] generate equivalent lists.

Syntax:

sl = new SectionList()
Description:

Class for creating and managing a list of sections. Unlike a regular list, a SectionList allows including sections based on neuronal morphology (e.g. subtrees).

Example Usage:

create soma, apic, dend[5]
secs_with_extra_IA = new SectionList()
soma secs_with_extra_IA.append()
apic secs_with_extra_IA.append()
dend[3] secs_with_extra_IA.append()

Syntax:

sl = n.SectionList();
Description:

Class for creating and managing a list of sections. Unlike a regular list, a SectionList allows including sections based on neuronal morphology (e.g. subtrees).

Example Usage:

sl = n.SectionList();
soma = n.Section('soma');
dend = n.Section('dend');
sections = [soma, dend];

for sec = sections
    sl.append(sec);
end

for sec = sl.allsec()
    disp(sec.name);
end

SectionList.append()

Syntax:

sl.append(section)
sl.append(sec=section)
Description:

Append section to the list.

Syntax:

sl.append()
section {sl.append()}
Description:

Append the currently accessed section to the list. The syntax section {sl.append()} runs the append method with section being the currently accessd function.

Syntax:

sl.append(section);
Description:

Append section to the list.

SectionList.remove()

Syntax:

n = sl.remove(sec=section)
n = sl.remove(sectionlist)
Description:

Remove section from the list.

If sectionlist is present then all the sections in sectionlist are removed from sl.

Returns the number of sections removed.

Syntax:

sl.remove()
sl.remove(sectionlist)
Description:

Remove the currently accessed section from the list.

If sectionlist is present then all the sections in sectionlist are removed from sl.

Returns the number of sections removed.

Syntax:

n = sl.remove(section);
n = sl.remove(sectionlist);
Description:

Remove section from the list.

If sectionlist is present then all the sections in sectionlist are removed from sl.

Returns the number of sections removed.


SectionList.children()

Syntax:

sl.children(section)
sl.children(sec=section)
Description:

Appends the sections connected to section. Note that this includes children connected at position 0 of parent.

Note

To get a (Python) list of a section’s children, use the section’s children method. For example:

>>> from neuron import n
>>> s = n.Section('s')
>>> t = n.Section('t')
>>> u = n.Section('u')
>>> t.connect(s)
t
>>> u.connect(s)
u
>>> t.children()
[]
>>> s.children()
[u, t]

Syntax:

section sl.children()
Description:

Appends the sections connected to section. If no section is specified, it defaults to the currently accessed section. Note that this includes children connected at position 0 of parent.

Syntax:

sl.children(section);
Description:

Appends the sections connected to section. Note that this includes children connected at position 0 of parent.


SectionList.subtree()

Syntax:

sl.subtree(section)
sl.subtree(sec=section)
Description:

Appends the subtree of the section (including that one).

Note

To get a (Python) list of a section’s subtree, use the section’s subtree method.

Syntax:

section sl.subtree()
Description:

Appends the subtree of the section (including that one). If no section is specified, it defaults to the currently accessed section.

Syntax:

sl.subtree(section);
Description:

Appends the subtree of the section (including that one).


SectionList.wholetree()

Syntax:

sl.wholetree(section)
sl.wholetree(sec=section)
Description:

Appends all sections which have a path to the section. (including the specified section). The section list has the important property that the sections are in root to leaf order.

Note

To get a (Python) list of a section’s wholetree, use the section’s wholetree method.

Syntax:

section sl.wholetree()
Description:

Appends all sections which have a path to the section. (including the specified section). If no section is specified, it defaults to the currently accessed section. The section list has the important property that the sections are in root to leaf order.

Syntax:

sl.wholetree(section);
Description:

Appends all sections which have a path to the section. (including the specified section). The section list has the important property that the sections are in root to leaf order.

Example:

sl = n.SectionList();
soma = n.Section('soma');
dend = n.Section('dend');
soma.connect(dend);
sl.wholetree(soma);

% the following prints both soma and dend
for sec = sl.allsec()
    disp(sec.name);
end

SectionList.allroots()

Syntax:

sl.allroots()
Description:

Appends all the root sections. Root sections have no parent section. The number of root sections is the number of real cells in the simulation.

Syntax:

sl.allroots()
Description:

Appends all the root sections. Root sections have no parent section. The number of root sections is the number of real cells in the simulation.

Syntax:

sl.allroots();
Description:

Appends all the root sections. Root sections have no parent section. The number of root sections is the number of real cells in the simulation.


SectionList.unique()

Syntax:

n = sl.unique()
Description:

Removes all duplicates of sections in the SectionList. I.e. ensures that no section appears more than once. Returns the number of sections references that were removed.

Syntax:

n = sl.unique()
Description:

Removes all duplicates of sections in the SectionList. I.e. ensures that no section appears more than once. Returns the number of sections references that were removed.

Syntax:

n = sl.unique();
Description:

Removes all duplicates of sections in the SectionList. i.e., ensures that no section appears more than once. Returns the number of sections references that were removed.


SectionList.printnames()

Syntax:

sl.printnames()
Description:

Print the names of the sections in the list.

sl.printnames() is approximately equivalent to:

for sec in sl:
    print(sec)

Syntax:

sl.printnames()
Description:

Print the names of the sections in the list.

Syntax:

sl.printnames();
Description:

Print the names of the sections in the list.

sl.printnames() is approximately equivalent to:

for sec = sl.allsec()
    disp(sec.name);
end

SectionList.size()

Syntax:

sl.size()
Description:

Returns the number of sections in the list.

Syntax:

sl.size()
Description:

Returns the number of sections in the list.

Syntax:

sl.size()
Description:

Returns the number of sections in the list.