hnn_core.Cell¶
- class hnn_core.Cell(name, pos, sections, synapses, sect_loc, cell_tree, gid=None)[source]¶
Create a cell object.
- Parameters:
- namestr
The name of the cell.
- postuple
The (x, y, z) coordinates.
- sectionsdict of Section
Dictionary with keys as section name.
- synapsesdict of dict
Keys are name of synaptic mechanism. Each synaptic mechanism has keys for parameters of the mechanism, e.g., ‘e’, ‘tau1’, ‘tau2’. sections.
- sect_locdict of list
Can have keys ‘proximal’ or ‘distal’ each containing names of section locations that are proximal or distal.
- gidint or None (optional)
Each cell in a network is uniquely identified by it’s “global ID”: GID. The GID is an integer from 0 to n_cells, or None if the cell is not yet attached to a network. Once the GID is set, it cannot be changed.
- cell_treedict of list
Stores the tree representation of a cell. Root is the 0 end of ‘soma’. Nodes are a tuple (sec_name, node_pos) where sec_name is the name of the section and node_pos is the 0 end or 1 end. The data structure is the adjacency list representation of a tree. The keys of the dict are the parent nodes. The value is the list of nodes (children nodes) connected to the parent node.
Examples
>>> section_soma = Section( L=39, diam=20, cm=0.85, Ra=200., end_pts=[[0, 0, 0], [0, 39., 0]] )
- Attributes:
- poslist of length 3
The position of the cell.
- sectionsnested dict
The section parameters. The key is the name of the section and the value is a dictionary parametrizing the morphology of the section and the mechanisms inserted.
- synapsesdict
The synapses that the cell can use for connections.
- dipole_pplist of h.Dipole()
The Dipole objects (see dipole.mod).
- vsecdict
Recording of section specific voltage. Must be enabled by running simulate_dipole(net, record_vsec=True) or simulate_dipole(net, record_vsoma=True)
- isecdict
Contains recording of section specific currents indexed by synapse type (keys can be soma_gabaa, soma_gabab etc.). Must be enabled by running simulate_dipole(net, record_isec=True) or simulate_dipole(net, record_isoma=True)
- cadict
Contains recording of section speicifc calcium concentration. Must be enabled by running simulate_dipole(net, record_ca=True).
- tonic_biaseslist of h.IClamp
The current clamps inserted at each section of the cell for tonic biasing inputs.
- gidint
GID of the cell in a network (or None if not yet assigned)
- sect_locdict of list
Can have keys ‘proximal’ or ‘distal’ each containing names of section locations that are proximal or distal.
- cell_treedict of list
Stores the tree representation of a cell. Root is the 0 end of ‘soma’. Nodes are a tuple (sec_name, node_pos) where sec_name is the name of the section and node_pos is the 0 end or 1 end. The data structure is the adjacency list representation of a tree. The keys of the dict are the parent nodes. The value is the list of nodes (children nodes) connected to the parent node.
Methods
build
([sec_name_apical])Build cell in Neuron and insert dipole if applicable.
copy
()Return copy of instance.
create_tonic_bias
(amplitude, t0, tstop[, loc])Create tonic bias at the soma.
define_shape
(node)Redefines end_pts according to section lengths.
distance_section
(target_sec_name, curr_node)Find distance between the current node and the target section.
modify_section
(sec_name[, L, diam, cm, Ra])Change attributes of section specified by sec_name
parconnect_from_src
(gid_presyn, nc_dict, ...)Parallel receptor-centric connect FROM presyn TO this cell,
plot_morphology
([ax, color, pos, xlim, ...])Plot the cell morphology.
record
([record_vsec, record_isec, record_ca])Record current and voltage from all sections
setup_source_netcon
(threshold)Created for _PC.cell and specifies SOURCES of spikes.
syn_create
(secloc, e, tau1, tau2)Create an h.Exp2Syn synapse.
to_dict
()Converts an object of Cell class to a dictionary.
- build(sec_name_apical=None)[source]¶
Build cell in Neuron and insert dipole if applicable.
- Parameters:
- sec_name_apicalstr | None
If not None, a dipole will be inserted in this cell in alignment with this section. The section should belong to the apical dendrite of a pyramidal neuron.
- create_tonic_bias(amplitude, t0, tstop, loc=0.5)[source]¶
Create tonic bias at the soma.
- Parameters:
- amplitudefloat
The amplitude of the input.
- t0float
The start time of tonic input (in ms).
- tstopfloat
The end time of tonic input (in ms).
- locfloat (0 to 1)
The location of the input in the soma section.
- define_shape(node)[source]¶
Redefines end_pts according to section lengths.
Detects change in section lengths of the sections in the subtree of the input node.
- Parameters:
- nodetuple of size 2
The first element is the section name The second element is the node end used (0 or 1)
- distance_section(target_sec_name, curr_node)[source]¶
Find distance between the current node and the target section.
- Parameters:
- target_sec_namestring
Name of the target section
- curr_nodetuple
Source node from where search begins. It is of the the form (sec_name, end_pt).
- Returns:
- distancefloat
Path distance between source node and mid of the target section.
- modify_section(sec_name, L=None, diam=None, cm=None, Ra=None)[source]¶
Change attributes of section specified by sec_name
- Parameters:
- sec_namestr
Name of section to be modified. Must be a key of Cell.sections
- Lfloat | int | None
length of a section in microns. Default None.
- diamfloat | int | None
diameter of a section in microns.
- cmfloat | int | None
membrane capacitance in micro-Farads.
- Rafloat | int | None
axial resistivity in ohm-cm.
Notes
Leaving default of None produces no change.
- parconnect_from_src(gid_presyn, nc_dict, postsyn, inplane_distance)[source]¶
- Parallel receptor-centric connect FROM presyn TO this cell,
based on GID.
- Parameters:
- gid_presynint
The cell ID of the presynaptic neuron
- nc_dictdict
Dictionary with keys: pos_src, A_weight, A_delay, lamtha Defines the connection parameters
- postsyninstance of h.Exp2Syn
The postsynaptic cell object.
- inplane_distancefloat
The in plane-distance (in um) between pyramidal cell somas in the square grid.
- Returns:
- ncinstance of h.NetCon
A network connection object.
- plot_morphology(ax=None, color=None, pos=(0, 0, 0), xlim=(-250, 150), ylim=(-100, 100), zlim=(-100, 1200), show=True)[source]¶
Plot the cell morphology.
- Parameters:
- axinstance of Axes3D
Matplotlib 3D axis
- colorstr | dict | None
Color of cell. If str, entire cell plotted with color indicated by str. If dict, colors of individual sections can be specified. Must have a key for every section in cell as defined in the Cell.sections attribute.
- | Ex: ``{‘apical_trunk’: ‘r’, ‘soma’: ‘b’, …}``
- postuple of int or float | None
Position of cell soma. Must be a tuple of 3 elements for the (x, y, z) position of the soma in 3D space. Default: (0, 0, 0)
- xlimtuple of int | tuple of float
x limits of plot window. Default (-250, 150)
- ylimtuple of int | tuple of float
y limits of plot window. Default (-100, 100)
- zlimtuple of int | tuple of float
z limits of plot window. Default (-100, 1200)
- showbool
If True, show the plot
- Returns:
- axesinstance of Axes3D
The matplotlib 3D axis handle.
- record(record_vsec=False, record_isec=False, record_ca=False)[source]¶
Record current and voltage from all sections
- Parameters:
- record_vsec‘all’ | ‘soma’ | False
Option to record voltages from all sections (‘all’), or just the soma (‘soma’). Default: False.
- record_isec‘all’ | ‘soma’ | False
Option to record voltages from all sections (‘all’), or just the soma (‘soma’). Default: False.
- record_ca‘all’ | ‘soma’ | False
Option to record calcium concentration from all sections (‘all’), or just the soma (‘soma’). Default: False.
- setup_source_netcon(threshold)[source]¶
Created for _PC.cell and specifies SOURCES of spikes.
- Parameters:
- thresholdfloat
The voltage threshold for action potential.
- syn_create(secloc, e, tau1, tau2)[source]¶
Create an h.Exp2Syn synapse.
- Parameters:
- seclocinstance of nrn.Segment
The section location. E.g., soma(0.5).
- e: float
Reverse potential (in mV)
- tau1: float
Rise time (in ms)
- tau2: float
Decay time (in ms)
- Returns:
- syninstance of h.Exp2Syn
A two state kinetic scheme synapse.