NeuronModel#
- class dendrify.neuronmodel.NeuronModel(connections, **kwargs)[source]#
Bases:
object
Creates a multicompartmental neuron model by connecting individual compartments and merging their equations, parameters and custom events.This model can then be used for creating a population of neurons through Brian’s NeuronGroup. This class also contains useful methods for managing model properties and for automating the initialization of custom events and simulation parameters.
Tip
Dendrify aims to facilitate the development of reduced, few-compartmental I&F models that help us study how key dendritic properties may affect network-level functions. It is not designed to substitute morphologically and biophysically detailed neuron models, commonly used for highly-accurate, single-cell simulations. If you are interested in the latter category of models, please see Brian’s SpatialNeuron.
- Parameters:
connections (list[tuple[Compartment, Compartment, str | Quantity]]) – A description of how the various compartments belonging to the same neuron model should be connected.
kwargs (
Quantity
, optional) – Kwargs are used to specify important electrophysiological properties, such as the specific capacitance or resistance. For all available options see:EphysProperties
.
Warning
Parameters set here affect all model compartments and can override any compartment-specific parameters.
Example
>>> # Valid format: [*(x, y, z)], where >>> # x -> Soma or Dendrite object >>> # y -> Soma or Dendrite object other than x >>> # z -> 'half_cylinders' or 'cylinder_ + name' or brian2.nS unit >>> # (by default 'half_cylinders') >>> soma = Soma('s', ...) >>> prox = Dendrite('p', ...) >>> dist = Dendrite('d', ...) >>> connections = [(soma, prox, 15*nS), (prox, dist, 10*nS)] >>> model = NeuronModel(connections)
Methods:
Allows adding custom equations.
Allows specifying extra/custom parameters.
Plots a graph-like representation of a NeuronModel using the Graph class and the Fruchterman-Reingold force-directed algorithm from Networkx.
Allows specifying essential dSpike properties affecting all compartments.
Links a NeuronModel to a NeuronGroup.
Attributes:
Merges all compartments' equations into a single string.
Creates a list of all event actions for dendritic spiking.
Organizes all custom events for dendritic spiking into a dictionary.
Merges all compartments' parameters into a dictionary.
- add_equations(eqs)[source]#
Allows adding custom equations.
- Parameters:
eqs (str) – A string of Brian-compatible equations.
- add_params(params_dict)[source]#
Allows specifying extra/custom parameters.
- Parameters:
params_dict (dict) – A dictionary of parameters.
- as_graph(fontsize=10, fontcolor='white', scale_nodes=1, color_soma='#4C6C92', color_dendrites='#A7361C', alpha=1, scale_edges=1, seed=None)[source]#
Plots a graph-like representation of a NeuronModel using the Graph class and the Fruchterman-Reingold force-directed algorithm from Networkx.
- Parameters:
fontsize (int, optional) – The size in pt of each node’s name, by default
10
.fontcolor (str, optional) – The color of each node’s name, by default
'white'
.scale_nodes (float, optional) – Percentage change in node size, by default
1
.color_soma (str, optional) – Somatic node color, by default
'#4C6C92'
.color_dendrites (str, optional) – Dendritic nodes color, by default
'#A7361C'
.alpha (float, optional) – Nodes color opacity, by default
1
.scale_edges (float, optional) – The percentage change in edges length, by default
1
.seed (int, optional) – Set the random state for deterministic node layouts, by default
None
. .
- dspike_properties(channel=None, tau_rise=None, tau_fall=None, offset_fall=None, refractory=None)[source]#
Allows specifying essential dSpike properties affecting all compartments.
- Parameters:
channel (str) – Ion channel type. Available options:
'Na'
,'Ca'
(coming soon).tau_rise (
Quantity
) – The decay time constant of the current causing the dSpike’s depolarization phase, by defaultNone
.tau_fall (
Quantity
) – The decay time constant of the current causing the dSpike’s repolarization phase, by defaultNone
.offset_fall (
Quantity
) – The delay for starting the dSpike repolarization phase, by defaultNone
.refractory (
Quantity
) – The duration of the dSpike inactive period, by defaultNone
.
- property equations#
Merges all compartments’ equations into a single string.
- Returns:
All model equations.
- Return type:
str
- property event_actions#
Creates a list of all event actions for dendritic spiking.
- Returns:
All event actions for dendritic spiking
- Return type:
list
- property events#
Organizes all custom events for dendritic spiking into a dictionary.
- Returns:
All model custom events for dendritic spiking.
- Return type:
dict
- link(ng, automate='all', verbose=False)[source]#
Links a NeuronModel to a NeuronGroup. This allows dendrify to automatically handle the initialization of important simulation parameters.
- Parameters:
ng (brian2.NeuronGroup) – A NeuronGroup that was created using a NeuronModel.
automate (str, optional) – What to automate. Available options:
'all'
(default),'v_rest'
,'events'
.verbose (bool, optional) – If
True
it prints all the code that was created and run in the background by dendrify, by defaultFalse
- property parameters#
Merges all compartments’ parameters into a dictionary.
- Returns:
All model parameters.
- Return type:
dict