hnn_core.Cell

class hnn_core.Cell(name, pos, sections, synapses, topology, sect_loc, 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’.

topologylist of list

The topology of cell sections. Each element is a list of 4 items in the format [parent_sec, parent_loc, child_sec, child_loc] where parent_sec and parent_loc are float between 0 and 1 specifying the location in the section to connect and parent_sec and child_sec are names of the connecting 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.

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)

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.

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.

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, cell_types, show])

Plot the cell morphology.

record([record_vsec, record_isec])

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.

__repr__()[source]

Return repr(self).

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.

copy()[source]

Return copy of instance.

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.

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, cell_types=None, show=True)[source]

Plot the cell morphology.

Parameters
axinstance of Axes3D

Matplotlib 3D axis

showbool

If True, show the plot

Returns
axesinstance of Axes3D

The matplotlib 3D axis handle.

record(record_vsec=False, record_isec=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.

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.