hnn_core.Network

class hnn_core.Network(params, add_drives_from_params=False, legacy_mode=True)

The Network class.

Parameters
paramsdict

The parameters to use for constructing the network.

add_drives_from_paramsbool

If True, add drives as defined in the params-dict. NB this is mainly for backward-compatibility with HNN GUI, and will be deprecated in a future release. Default: False

legacy_modebool

Set to True by default to enable matching HNN GUI output when drives are added suitably. Will be deprecated in a future release.

Attributes
paramsdict

The parameters of the network

cellname_listlist

The names of real cell types in the network (e.g. ‘L2_basket’)

gid_rangesdict

A dictionary of unique identifiers of each real and artificial cell in the network. Every cell type is represented by a key read from cellname_list, followed by keys read from external_drives. The value of each key is a range of ints, one for each cell in given category. Examples: ‘L2_basket’: range(0, 270), ‘evdist1’: range(272, 542), etc

pos_dictdict

Dictionary containing the coordinate positions of all cells. Keys are ‘L2_pyramidal’, ‘L5_pyramidal’, ‘L2_basket’, ‘L5_basket’, or any external drive name

cell_responseCellResponse

An instance of the CellResponse object.

external_drivesdict (keys: drive names) of dict (keys: parameters)

The external driving inputs to the network. Drives are added by defining their spike-time dynamics, and their connectivity to the real cells of the network. Event times are instantiated before simulation, and are stored under the 'events'-key (list of list; first index for trials, second for event time lists for each drive cell).

external_biasesdict of dict (bias parameters for each cell type)

The parameters of bias inputs to cell somata, e.g., tonic current clamp

__repr__()

Return repr(self).

add_bursty_drive(name, *, tstart=0, tstart_std=0, tstop=None, location, burst_rate, burst_std=0, numspikes=2, spike_isi=10, repeats=1, weights_ampa=None, weights_nmda=None, synaptic_delays=0.1, space_constant=100.0, seedcore=2, distribution='normal')

Add a bursty (rhythmic) external drive to all cells of the network

Parameters
namestr

Unique name for the drive

tstartfloat

Start time of the burst trains (default: 0)

tstart_stdfloat

If greater than 0, randomize start time with standard deviation tstart_std (unit: ms). Effectively jitters start time across multiple trials.

tstopfloat

End time of burst trains (defaults to None: tstop is set to the end of the simulation)

burst_ratefloat

The mean rate at which cyclic bursts occur (unit: Hz)

burst_stdfloat

The standard deviation of the burst occurrence on each cycle (unit: ms). Default: 0 ms

numspikesint

The number of spikes in a burst. This is the spikes/burst parameter in the GUI. Default: 2 (doublet)

spike_isifloat

Time between spike events within a cycle (ISI). Default: 10 ms

repeatsint

The number of bursts per cycle. Default: 1

locationstr

Target location of synapses (‘distal’ or ‘proximal’)

weights_ampadict or None

Synaptic weights (in uS) of AMPA receptors on each targeted cell type (dict keys). Cell types omitted from the dict are set to zero.

weights_nmdadict or None

Synaptic weights (in uS) of NMDA receptors on each targeted cell type (dict keys). Cell types omitted from the dict are set to zero.

synaptic_delaysfloat or dict

Synaptic delay (in ms) at the column origin, dispersed laterally as a function of the space_constant. If float, applies to all target cell types. Use dict to create delay->cell mapping.

space_constantfloat

Describes lateral dispersion (from column origin) of synaptic weights and delays within the simulated column

seedcoreint

Optional initial seed for random number generator (default: 2).

distributionstr

Must be ‘normal’ (will be deprecated in a future release).

add_evoked_drive(name, *, mu, sigma, numspikes, sync_within_trial=False, location, weights_ampa=None, weights_nmda=None, space_constant=3.0, synaptic_delays=0.1, seedcore=2)

Add an ‘evoked’ external drive to the network

Parameters
namestr

Unique name for the drive

mufloat

Mean of Gaussian event time distribution

sigmafloat

Standard deviation of event time distribution

numspikesint

Number of spikes at each target cell

sync_within_trialbool

If True, the target cells receive each numspike synchronously. By default (False), spike times arriving at each target cell are sampled independently using the Gaussian parameteres (mu, sigma).

locationstr

Target location of synapses (‘distal’ or ‘proximal’)

weights_ampadict or None

Synaptic weights (in uS) of AMPA receptors on each targeted cell type (dict keys). Cell types omitted from the dict are set to zero.

weights_nmdadict or None

Synaptic weights (in uS) of NMDA receptors on each targeted cell type (dict keys). Cell types omitted from the dict are set to zero.

synaptic_delaysfloat or dict

Synaptic delay (in ms) at the column origin, dispersed laterally as a function of the space_constant. If float, applies to all target cell types. Use dict to create delay->cell mapping.

space_constantfloat

Describes lateral dispersion (from column origin) of synaptic weights and delays within the simulated column

seedcoreint

Optional initial seed for random number generator (default: 2).

add_poisson_drive(name, *, tstart=0, tstop=None, rate_constant, location, weights_ampa=None, weights_nmda=None, space_constant=100.0, synaptic_delays=0.1, seedcore=2)

Add a Poisson-distributed external drive to the network

Parameters
namestr

Unique name for the drive

tstartfloat

Start time of Poisson-distributed spike train (default: 0)

tstopfloat

End time of the spike train (defaults to None: tstop is set to the end of the simulation)

rate_constantfloat or dict of floats

Rate constant (lambda) of the renewal-process generating the samples. If a float is provided, the same rate constant is applied to each target cell type. Cell type-specific values may be provided as a dictionary, in which a key must be present for each cell type with non-zero AMPA or NMDA weights.

locationstr

Target location of synapses (‘distal’ or ‘proximal’)

weights_ampadict or None

Synaptic weights (in uS) of AMPA receptors on each targeted cell type (dict keys). Cell types omitted from the dict are set to zero.

weights_nmdadict or None

Synaptic weights (in uS) of NMDA receptors on each targeted cell type (dict keys). Cell types omitted from the dict are set to zero.

synaptic_delaysfloat or dict

Synaptic delay (in ms) at the column origin, dispersed laterally as a function of the space_constant. If float, applies to all target cell types. Use dict to create delay->cell mapping.

space_constantfloat

Describes lateral dispersion (from column origin) of synaptic weigths and delays within the simulated column

seedcoreint

Optional initial seed for random number generator (default: 2).

add_tonic_bias(*, cell_type=None, amplitude=None, t0=None, T=None)

Attach parameters of tonic biasing input for a given cell type.

Parameters
cell_typestr

The cell type whose cells will get the tonic input. Valid inputs are those in net.cellname_list.

amplitudefloat

The amplitude of the input.

t0float

The start time of tonic input (in ms). Default: 0 (beginning of simulation).

Tfloat

The end time of tonic input (in ms). Default: end of simulation.

copy()

Return a copy of the Network instance

The returned copy retains the intrinsic connectivity between cells, as well as those of any external drives or biases added to the network. The parameters of drive dynamics are also retained, but the instantiated events of the drives are cleared. This allows iterating over the values defining drive dynamics, without the need to re-define connectivity.

Returns
net_copyinstance of Network

A copy of the instance with previous simulation results and events of external drives removed.

gid_to_type(gid)

Reverse lookup of gid to type.

plot_cells(ax=None, show=True)

Plot the cells using Network.pos_dict.

Parameters
axinstance of matplotlib Axes3D | None

An axis object from matplotlib. If None, a new figure is created.

showbool

If True, show the figure.

Returns
figinstance of matplotlib Figure

The matplotlib figure handle.