hhn.py
1 """!
2 
3 @brief Oscillatory Neural Network based on Hodgkin-Huxley Neuron Model
4 @details Implementation based on paper @cite article::nnet::hnn::1.
5 
6 @authors Andrei Novikov (pyclustering@yandex.ru)
7 @date 2014-2018
8 @copyright GNU Public License
9 
10 @cond GNU_PUBLIC_LICENSE
11  PyClustering is free software: you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  PyClustering is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with this program. If not, see <http://www.gnu.org/licenses/>.
23 @endcond
24 
25 """
26 
27 from scipy.integrate import odeint
28 
29 from pyclustering.core.wrapper import ccore_library
30 
31 import pyclustering.core.hhn_wrapper as wrapper
32 
33 from pyclustering.nnet import *
34 
35 from pyclustering.utils import allocate_sync_ensembles
36 
37 import numpy
38 import random
39 
41  """!
42  @brief Describes parameters of Hodgkin-Huxley Oscillatory Network.
43 
44  @see hhn_network
45 
46  """
47 
48  def __init__(self):
49  """!
50  @brief Default constructor of parameters for Hodgkin-Huxley Oscillatory Network.
51  @details Constructor initializes parameters by default non-zero values that can be
52  used for simple simulation.
53  """
54 
55 
56  self.nu = random.random() * 2.0 - 1.0;
57 
58 
59  self.gNa = 120.0 * (1 + 0.02 * self.nu);
60 
61 
62  self.gK = 36.0 * (1 + 0.02 * self.nu);
63 
64 
65  self.gL = 0.3 * (1 + 0.02 * self.nu);
66 
67 
68 
69  self.vNa = 50.0;
70 
71 
72  self.vK = -77.0;
73 
74 
75  self.vL = -54.4;
76 
77 
78  self.vRest = -65.0;
79 
80 
81 
82  self.Icn1 = 5.0;
83 
84 
85  self.Icn2 = 30.0;
86 
87 
88 
89  self.Vsyninh = -80.0;
90 
91 
92  self.Vsynexc = 0.0;
93 
94 
95  self.alfa_inhibitory = 6.0;
96 
97 
98  self.betta_inhibitory = 0.3;
99 
100 
101 
102  self.alfa_excitatory = 40.0;
103 
104 
105  self.betta_excitatory = 2.0;
106 
107 
108 
109  self.w1 = 0.1;
110 
111 
112  self.w2 = 9.0;
113 
114 
115  self.w3 = 5.0;
116 
117 
118 
119  self.deltah = 650.0;
120 
121 
122  self.threshold = -10;
123 
124 
125  self.eps = 0.16;
126 
127 
129  """!
130  @brief Central element consist of two central neurons that are described by a little bit different dynamic than peripheral.
131 
132  @see hhn_network
133 
134  """
135 
136  def __init__(self):
137  """!
138  @brief Constructor of central element.
139 
140  """
141 
142 
143  self.membrane_potential = 0.0;
144 
145 
146  self.active_cond_sodium = 0.0;
147 
148 
150 
151 
153 
154 
155  self.pulse_generation = False;
156 
157 
159 
160  def __repr__(self):
161  """!
162  @brief Returns string that represents central element.
163 
164  """
165  return "%s, %s" % (self.membrane_potential, self.pulse_generation_time);
166 
167 
169  """!
170  @brief Oscillatory Neural Network with central element based on Hodgkin-Huxley neuron model. Interaction between oscillators is performed via
171  central element (no connection between oscillators that are called as peripheral). Peripheral oscillators receive external stimulus.
172  Central element consist of two oscillators: the first is used for synchronization some ensemble of oscillators and the second controls
173  synchronization of the first central oscillator with various ensembles.
174 
175  Usage example where oscillatory network with 6 oscillators is used for simulation. The first two oscillators
176  have the same stimulus, as well as the third and fourth oscillators and the last two. Thus three synchronous
177  ensembles are expected after simulation.
178  @code
179  # change period of time when high strength value of synaptic connection exists from CN2 to PN.
180  params = hhn_parameters();
181  params.deltah = 400;
182 
183  # create oscillatory network with stimulus
184  net = hhn_network(6, [0, 0, 25, 25, 47, 47], params);
185 
186  # simulate network
187  (t, dyn) = net.simulate(1200, 600);
188 
189  # draw network output during simulation (membrane potential of peripheral and central neurons).
190  amount_canvases = 6 + 2; # 6 peripheral oscillator + 2 central elements
191  visualizer = dynamic_visualizer(amount_canvases, x_title="Time", y_title="V", y_labels=False);
192  visualizer.append_dynamics(t, dyn_peripheral, 0, separate);
193  visualizer.append_dynamics(t, dyn_central, amount_canvases - 2, True);
194  visualizer.show();
195  @endcode
196 
197  To increase performance CCORE can be used, for that purpose special flag should be specified when network is
198  constructed:
199  @code
200  # create oscillatory network with stimulus using CCORE
201  net = hhn_network(6, [0, 0, 25, 25, 47, 47], params, ccore=True);
202  @endcode
203 
204  There is visualized result of simulation where three synchronous ensembles of oscillators can be observed. The
205  first and the second oscillators form the first ensemble, the third and the fourth form the second ensemble and
206  the last two oscillators form the third ensemble.
207  @image html hhn_three_ensembles.png
208 
209  """
210 
211  def __init__(self, num_osc, stimulus = None, parameters = None, type_conn = None, type_conn_represent = conn_represent.MATRIX, ccore = True):
212  """!
213  @brief Constructor of oscillatory network based on Hodgkin-Huxley neuron model.
214 
215  @param[in] num_osc (uint): Number of peripheral oscillators in the network.
216  @param[in] stimulus (list): List of stimulus for oscillators, number of stimulus should be equal to number of peripheral oscillators.
217  @param[in] parameters (hhn_parameters): Parameters of the network.
218  @param[in] type_conn (conn_type): Type of connections between oscillators in the network (ignored for this type of network).
219  @param[in] type_conn_represent (conn_represent): Internal representation of connection in the network: matrix or list.
220  @param[in] ccore (bool): If 'True' then CCORE is used (C/C++ implementation of the model).
221 
222  """
223 
224  super().__init__(num_osc, conn_type.NONE, type_conn_represent);
225 
226  if (stimulus is None):
227  self._stimulus = [0.0] * num_osc;
228  else:
229  self._stimulus = stimulus;
230 
231  if (parameters is not None):
232  self._params = parameters;
233  else:
234  self._params = hhn_parameters();
235 
236  self.__ccore_hhn_pointer = None;
237  self.__ccore_hhn_dynamic_pointer = None;
238 
239  if ( (ccore is True) and ccore_library.workable() ):
240  self.__ccore_hhn_pointer = wrapper.hhn_create(num_osc, self._params);
241  else:
242  self._membrane_dynamic_pointer = None; # final result is stored here.
243 
244  self._membrane_potential = [0.0] * self._num_osc;
245  self._active_cond_sodium = [0.0] * self._num_osc;
246  self._inactive_cond_sodium = [0.0] * self._num_osc;
247  self._active_cond_potassium = [0.0] * self._num_osc;
248  self._link_activation_time = [0.0] * self._num_osc;
249  self._link_pulse_counter = [0.0] * self._num_osc;
250  self._link_deactivation_time = [0.0] * self._num_osc;
251  self._link_weight3 = [0.0] * self._num_osc;
252  self._pulse_generation_time = [ [] for i in range(self._num_osc) ];
253  self._pulse_generation = [False] * self._num_osc;
254 
255  self._noise = [random.random() * 2.0 - 1.0 for i in range(self._num_osc)];
256 
258 
259 
260  def __del__(self):
261  """!
262  @brief Destroy dynamically allocated oscillatory network instance in case of CCORE usage.
263 
264  """
265  if self.__ccore_hhn_pointer:
266  wrapper.hhn_destroy(self.__ccore_hhn_pointer)
267 
268 
269  def simulate(self, steps, time, solution = solve_type.RK4):
270  """!
271  @brief Performs static simulation of oscillatory network based on Hodgkin-Huxley neuron model.
272  @details Output dynamic is sensible to amount of steps of simulation and solver of differential equation.
273  Python implementation uses 'odeint' from 'scipy', CCORE uses classical RK4 and RFK45 methods,
274  therefore in case of CCORE HHN (Hodgkin-Huxley network) amount of steps should be greater than in
275  case of Python HHN.
276 
277  @param[in] steps (uint): Number steps of simulations during simulation.
278  @param[in] time (double): Time of simulation.
279  @param[in] solution (solve_type): Type of solver for differential equations.
280 
281  @return (tuple) Dynamic of oscillatory network represented by (time, peripheral neurons dynamic, central elements
282  dynamic), where types are (list, list, list).
283 
284  """
285 
286  return self.simulate_static(steps, time, solution);
287 
288 
289  def simulate_static(self, steps, time, solution = solve_type.RK4):
290  """!
291  @brief Performs static simulation of oscillatory network based on Hodgkin-Huxley neuron model.
292  @details Output dynamic is sensible to amount of steps of simulation and solver of differential equation.
293  Python implementation uses 'odeint' from 'scipy', CCORE uses classical RK4 and RFK45 methods,
294  therefore in case of CCORE HHN (Hodgkin-Huxley network) amount of steps should be greater than in
295  case of Python HHN.
296 
297  @param[in] steps (uint): Number steps of simulations during simulation.
298  @param[in] time (double): Time of simulation.
299  @param[in] solution (solve_type): Type of solver for differential equations.
300 
301  @return (tuple) Dynamic of oscillatory network represented by (time, peripheral neurons dynamic, central elements
302  dynamic), where types are (list, list, list).
303 
304  """
305 
306  # Check solver before simulation
307  if (solution == solve_type.FAST):
308  raise NameError("Solver FAST is not support due to low accuracy that leads to huge error.");
309 
310  self._membrane_dynamic_pointer = None;
311 
312  if (self.__ccore_hhn_pointer is not None):
313  self.__ccore_hhn_dynamic_pointer = wrapper.hhn_dynamic_create(True, False, False, False);
314  wrapper.hhn_simulate(self.__ccore_hhn_pointer, steps, time, solution, self._stimulus, self.__ccore_hhn_dynamic_pointer);
315 
316  peripheral_membrane_potential = wrapper.hhn_dynamic_get_peripheral_evolution(self.__ccore_hhn_dynamic_pointer, 0);
317  central_membrane_potential = wrapper.hhn_dynamic_get_central_evolution(self.__ccore_hhn_dynamic_pointer, 0);
318  dynamic_time = wrapper.hhn_dynamic_get_time(self.__ccore_hhn_dynamic_pointer);
319 
320  self._membrane_dynamic_pointer = peripheral_membrane_potential;
321 
322  wrapper.hhn_dynamic_destroy(self.__ccore_hhn_dynamic_pointer);
323 
324  return (dynamic_time, peripheral_membrane_potential, central_membrane_potential);
325 
326  if (solution == solve_type.RKF45):
327  raise NameError("Solver RKF45 is not support in python version.");
328 
329  dyn_peripheral = [ self._membrane_potential[:] ];
330  dyn_central = [ [0.0, 0.0] ];
331  dyn_time = [ 0.0 ];
332 
333  step = time / steps;
334  int_step = step / 10.0;
335 
336  for t in numpy.arange(step, time + step, step):
337  # update states of oscillators
338  (memb_peripheral, memb_central) = self._calculate_states(solution, t, step, int_step);
339 
340  # update states of oscillators
341  dyn_peripheral.append(memb_peripheral);
342  dyn_central.append(memb_central);
343  dyn_time.append(t);
344 
345  self._membrane_dynamic_pointer = dyn_peripheral;
346  return (dyn_time, dyn_peripheral, dyn_central);
347 
348 
349  def _calculate_states(self, solution, t, step, int_step):
350  """!
351  @brief Caclculates new state of each oscillator in the network. Returns only excitatory state of oscillators.
352 
353  @param[in] solution (solve_type): Type solver of the differential equations.
354  @param[in] t (double): Current time of simulation.
355  @param[in] step (uint): Step of solution at the end of which states of oscillators should be calculated.
356  @param[in] int_step (double): Differentiation step that is used for solving differential equation.
357 
358  @return (list) New states of membrance potentials for peripheral oscillators and for cental elements as a list where
359  the last two values correspond to central element 1 and 2.
360 
361  """
362 
363  next_membrane = [0.0] * self._num_osc;
364  next_active_sodium = [0.0] * self._num_osc;
365  next_inactive_sodium = [0.0] * self._num_osc;
366  next_active_potassium = [0.0] * self._num_osc;
367 
368  # Update states of oscillators
369  for index in range (0, self._num_osc, 1):
370  result = odeint(self.hnn_state,
371  [ self._membrane_potential[index], self._active_cond_sodium[index], self._inactive_cond_sodium[index], self._active_cond_potassium[index] ],
372  numpy.arange(t - step, t, int_step),
373  (index , ));
374 
375  [ next_membrane[index], next_active_sodium[index], next_inactive_sodium[index], next_active_potassium[index] ] = result[len(result) - 1][0:4];
376 
377  next_cn_membrane = [0.0, 0.0];
378  next_cn_active_sodium = [0.0, 0.0];
379  next_cn_inactive_sodium = [0.0, 0.0];
380  next_cn_active_potassium = [0.0, 0.0];
381 
382  # Update states of central elements
383  for index in range(0, len(self._central_element)):
384  result = odeint(self.hnn_state,
385  [ self._central_element[index].membrane_potential, self._central_element[index].active_cond_sodium, self._central_element[index].inactive_cond_sodium, self._central_element[index].active_cond_potassium ],
386  numpy.arange(t - step, t, int_step),
387  (self._num_osc + index , ));
388 
389  [ next_cn_membrane[index], next_cn_active_sodium[index], next_cn_inactive_sodium[index], next_cn_active_potassium[index] ] = result[len(result) - 1][0:4];
390 
391  # Noise generation
392  self._noise = [ 1.0 + 0.01 * (random.random() * 2.0 - 1.0) for i in range(self._num_osc)];
393 
394  # Updating states of PNs
395  self.__update_peripheral_neurons(t, step, next_membrane, next_active_sodium, next_inactive_sodium, next_active_potassium);
396 
397  # Updation states of CN
398  self.__update_central_neurons(t, next_cn_membrane, next_cn_active_sodium, next_cn_inactive_sodium, next_cn_active_potassium);
399 
400  return (next_membrane, next_cn_membrane);
401 
402 
403  def __update_peripheral_neurons(self, t, step, next_membrane, next_active_sodium, next_inactive_sodium, next_active_potassium):
404  """!
405  @brief Update peripheral neurons in line with new values of current in channels.
406 
407  @param[in] t (doubles): Current time of simulation.
408  @param[in] step (uint): Step (time duration) during simulation when states of oscillators should be calculated.
409  @param[in] next_membrane (list): New values of membrane potentials for peripheral neurons.
410  @Param[in] next_active_sodium (list): New values of activation conductances of the sodium channels for peripheral neurons.
411  @param[in] next_inactive_sodium (list): New values of inactivaton conductances of the sodium channels for peripheral neurons.
412  @param[in] next_active_potassium (list): New values of activation conductances of the potassium channel for peripheral neurons.
413 
414  """
415 
416  self._membrane_potential = next_membrane[:];
417  self._active_cond_sodium = next_active_sodium[:];
418  self._inactive_cond_sodium = next_inactive_sodium[:];
419  self._active_cond_potassium = next_active_potassium[:];
420 
421  for index in range(0, self._num_osc):
422  if (self._pulse_generation[index] is False):
423  if (self._membrane_potential[index] >= 0.0):
424  self._pulse_generation[index] = True;
425  self._pulse_generation_time[index].append(t);
426  elif (self._membrane_potential[index] < 0.0):
427  self._pulse_generation[index] = False;
428 
429  # Update connection from CN2 to PN
430  if (self._link_weight3[index] == 0.0):
431  if (self._membrane_potential[index] > self._params.threshold):
432  self._link_pulse_counter[index] += step;
433 
434  if (self._link_pulse_counter[index] >= 1 / self._params.eps):
435  self._link_weight3[index] = self._params.w3;
436  self._link_activation_time[index] = t;
437  elif ( not ((self._link_activation_time[index] < t) and (t < self._link_activation_time[index] + self._params.deltah)) ):
438  self._link_weight3[index] = 0.0;
439  self._link_pulse_counter[index] = 0.0;
440 
441 
442  def __update_central_neurons(self, t, next_cn_membrane, next_cn_active_sodium, next_cn_inactive_sodium, next_cn_active_potassium):
443  """!
444  @brief Update of central neurons in line with new values of current in channels.
445 
446  @param[in] t (doubles): Current time of simulation.
447  @param[in] next_membrane (list): New values of membrane potentials for central neurons.
448  @Param[in] next_active_sodium (list): New values of activation conductances of the sodium channels for central neurons.
449  @param[in] next_inactive_sodium (list): New values of inactivaton conductances of the sodium channels for central neurons.
450  @param[in] next_active_potassium (list): New values of activation conductances of the potassium channel for central neurons.
451 
452  """
453 
454  for index in range(0, len(self._central_element)):
455  self._central_element[index].membrane_potential = next_cn_membrane[index];
456  self._central_element[index].active_cond_sodium = next_cn_active_sodium[index];
457  self._central_element[index].inactive_cond_sodium = next_cn_inactive_sodium[index];
458  self._central_element[index].active_cond_potassium = next_cn_active_potassium[index];
459 
460  if (self._central_element[index].pulse_generation is False):
461  if (self._central_element[index].membrane_potential >= 0.0):
462  self._central_element[index].pulse_generation = True;
463  self._central_element[index].pulse_generation_time.append(t);
464  elif (self._central_element[index].membrane_potential < 0.0):
465  self._central_element[index].pulse_generation = False;
466 
467 
468  def hnn_state(self, inputs, t, argv):
469  """!
470  @brief Returns new values of excitatory and inhibitory parts of oscillator and potential of oscillator.
471 
472  @param[in] inputs (list): States of oscillator for integration [v, m, h, n] (see description below).
473  @param[in] t (double): Current time of simulation.
474  @param[in] argv (tuple): Extra arguments that are not used for integration - index of oscillator.
475 
476  @return (list) new values of oscillator [v, m, h, n], where:
477  v - membrane potantial of oscillator,
478  m - activation conductance of the sodium channel,
479  h - inactication conductance of the sodium channel,
480  n - activation conductance of the potassium channel.
481 
482  """
483 
484  index = argv;
485 
486  v = inputs[0]; # membrane potential (v).
487  m = inputs[1]; # activation conductance of the sodium channel (m).
488  h = inputs[2]; # inactivaton conductance of the sodium channel (h).
489  n = inputs[3]; # activation conductance of the potassium channel (n).
490 
491  # Calculate ion current
492  # gNa * m[i]^3 * h * (v[i] - vNa) + gK * n[i]^4 * (v[i] - vK) + gL (v[i] - vL)
493  active_sodium_part = self._params.gNa * (m ** 3) * h * (v - self._params.vNa);
494  inactive_sodium_part = self._params.gK * (n ** 4) * (v - self._params.vK);
495  active_potassium_part = self._params.gL * (v - self._params.vL);
496 
497  Iion = active_sodium_part + inactive_sodium_part + active_potassium_part;
498 
499  Iext = 0.0;
500  Isyn = 0.0;
501  if (index < self._num_osc):
502  # PN - peripheral neuron - calculation of external current and synaptic current.
503  Iext = self._stimulus[index] * self._noise[index]; # probably noise can be pre-defined for reducting compexity
504 
505  memory_impact1 = 0.0;
506  for i in range(0, len(self._central_element[0].pulse_generation_time)):
507  memory_impact1 += self.__alfa_function(t - self._central_element[0].pulse_generation_time[i], self._params.alfa_inhibitory, self._params.betta_inhibitory);
508 
509  memory_impact2 = 0.0;
510  for i in range(0, len(self._central_element[1].pulse_generation_time)):
511  memory_impact2 += self.__alfa_function(t - self._central_element[1].pulse_generation_time[i], self._params.alfa_inhibitory, self._params.betta_inhibitory);
512 
513  Isyn = self._params.w2 * (v - self._params.Vsyninh) * memory_impact1 + self._link_weight3[index] * (v - self._params.Vsyninh) * memory_impact2;
514  else:
515  # CN - central element.
516  central_index = index - self._num_osc;
517  if (central_index == 0):
518  Iext = self._params.Icn1; # CN1
519 
520  memory_impact = 0.0;
521  for index_oscillator in range(0, self._num_osc):
522  for index_generation in range(0, len(self._pulse_generation_time[index_oscillator])):
523  memory_impact += self.__alfa_function(t - self._pulse_generation_time[index_oscillator][index_generation], self._params.alfa_excitatory, self._params.betta_excitatory);
524 
525  Isyn = self._params.w1 * (v - self._params.Vsynexc) * memory_impact;
526 
527  elif (central_index == 1):
528  Iext = self._params.Icn2; # CN2
529  Isyn = 0.0;
530 
531  else:
532  assert 0;
533 
534 
535  # Membrane potential
536  dv = -Iion + Iext - Isyn;
537 
538  # Calculate variables
539  potential = v - self._params.vRest;
540  am = (2.5 - 0.1 * potential) / (math.exp(2.5 - 0.1 * potential) - 1.0);
541  ah = 0.07 * math.exp(-potential / 20.0);
542  an = (0.1 - 0.01 * potential) / (math.exp(1.0 - 0.1 * potential) - 1.0);
543 
544  bm = 4.0 * math.exp(-potential / 18.0);
545  bh = 1.0 / (math.exp(3.0 - 0.1 * potential) + 1.0);
546  bn = 0.125 * math.exp(-potential / 80.0);
547 
548  dm = am * (1.0 - m) - bm * m;
549  dh = ah * (1.0 - h) - bh * h;
550  dn = an * (1.0 - n) - bn * n;
551 
552  return [dv, dm, dh, dn];
553 
554 
555  def allocate_sync_ensembles(self, tolerance = 0.1):
556  """!
557  @brief Allocates clusters in line with ensembles of synchronous oscillators where each. Synchronous ensemble corresponds to only one cluster.
558 
559  @param[in] tolerance (double): maximum error for allocation of synchronous ensemble oscillators.
560 
561  @return (list) Grours (lists) of indexes of synchronous oscillators. For example [ [index_osc1, index_osc3], [index_osc2], [index_osc4, index_osc5] ].
562 
563  """
564 
565  return allocate_sync_ensembles(self._membrane_dynamic_pointer, tolerance, 20.0, None);
566 
567 
568  def __alfa_function(self, time, alfa, betta):
569  """!
570  @brief Calculates value of alfa-function for difference between spike generation time and current simulation time.
571 
572  @param[in] time (double): Difference between last spike generation time and current time.
573  @param[in] alfa (double): Alfa parameter for alfa-function.
574  @param[in] betta (double): Betta parameter for alfa-function.
575 
576  @return (double) Value of alfa-function.
577 
578  """
579 
580  return alfa * time * math.exp(-betta * time);
581 
def hnn_state(self, inputs, t, argv)
Returns new values of excitatory and inhibitory parts of oscillator and potential of oscillator...
Definition: hhn.py:468
def __alfa_function(self, time, alfa, betta)
Calculates value of alfa-function for difference between spike generation time and current simulation...
Definition: hhn.py:568
Vsyninh
Synaptic reversal potential [mV] for inhibitory effects.
Definition: hhn.py:89
gK
Maximal conductivity for potassium current.
Definition: hhn.py:62
gNa
Maximal conductivity for sodium current.
Definition: hhn.py:59
def allocate_sync_ensembles(self, tolerance=0.1)
Allocates clusters in line with ensembles of synchronous oscillators where each.
Definition: hhn.py:555
membrane_potential
Membrane potential of cenral neuron (V).
Definition: hhn.py:143
Icn2
External current [mV] for central element 2.
Definition: hhn.py:85
Utils that are used by modules of pyclustering.
Definition: __init__.py:1
vNa
Reverse potential of sodium current [mV].
Definition: hhn.py:69
betta_excitatory
Betta-parameter for alfa-function for excitatory effect.
Definition: hhn.py:105
betta_inhibitory
Betta-parameter for alfa-function for inhibitory effect.
Definition: hhn.py:98
eps
Affects pulse counter.
Definition: hhn.py:125
deltah
Period of time [ms] when high strength value of synaptic connection exists from CN2 to PN...
Definition: hhn.py:119
def __update_central_neurons(self, t, next_cn_membrane, next_cn_active_sodium, next_cn_inactive_sodium, next_cn_active_potassium)
Update of central neurons in line with new values of current in channels.
Definition: hhn.py:442
def simulate(self, steps, time, solution=solve_type.RK4)
Performs static simulation of oscillatory network based on Hodgkin-Huxley neuron model.
Definition: hhn.py:269
threshold
Threshold of the membrane potential that should exceeded by oscillator to be considered as an active...
Definition: hhn.py:122
active_cond_sodium
Activation conductance of the sodium channel (m).
Definition: hhn.py:146
vL
Reverse potential of leakage current [mV].
Definition: hhn.py:75
gL
Maximal conductivity for leakage current.
Definition: hhn.py:65
pulse_generation_time
Timestamps of generated pulses.
Definition: hhn.py:158
def __init__(self)
Constructor of central element.
Definition: hhn.py:136
w3
Strength of the synaptic connection from CN2 to PN.
Definition: hhn.py:115
Central element consist of two central neurons that are described by a little bit different dynamic t...
Definition: hhn.py:128
vRest
Rest potential [mV].
Definition: hhn.py:78
Common network description that consists of information about oscillators and connection between them...
Definition: __init__.py:97
vK
Reverse potential of potassium current [mV].
Definition: hhn.py:72
inactive_cond_sodium
Inactivaton conductance of the sodium channel (h).
Definition: hhn.py:149
pulse_generation
Spike generation of central neuron.
Definition: hhn.py:155
def __repr__(self)
Returns string that represents central element.
Definition: hhn.py:160
active_cond_potassium
Activaton conductance of the sodium channel (h).
Definition: hhn.py:152
Oscillatory Neural Network with central element based on Hodgkin-Huxley neuron model.
Definition: hhn.py:168
def __init__(self)
Default constructor of parameters for Hodgkin-Huxley Oscillatory Network.
Definition: hhn.py:48
def __update_peripheral_neurons(self, t, step, next_membrane, next_active_sodium, next_inactive_sodium, next_active_potassium)
Update peripheral neurons in line with new values of current in channels.
Definition: hhn.py:403
w2
Strength of the synaptic connection from CN1 to PN.
Definition: hhn.py:112
alfa_excitatory
Alfa-parameter for alfa-function for excitatory effect.
Definition: hhn.py:102
Describes parameters of Hodgkin-Huxley Oscillatory Network.
Definition: hhn.py:40
w1
Strength of the synaptic connection from PN to CN1.
Definition: hhn.py:109
def __del__(self)
Destroy dynamically allocated oscillatory network instance in case of CCORE usage.
Definition: hhn.py:260
alfa_inhibitory
Alfa-parameter for alfa-function for inhibitory effect.
Definition: hhn.py:95
def simulate_static(self, steps, time, solution=solve_type.RK4)
Performs static simulation of oscillatory network based on Hodgkin-Huxley neuron model.
Definition: hhn.py:289
Icn1
External current [mV] for central element 1.
Definition: hhn.py:82
def _calculate_states(self, solution, t, step, int_step)
Caclculates new state of each oscillator in the network.
Definition: hhn.py:349
Vsynexc
Synaptic reversal potential [mV] for exciting effects.
Definition: hhn.py:92
def __init__(self, num_osc, stimulus=None, parameters=None, type_conn=None, type_conn_represent=conn_represent.MATRIX, ccore=True)
Constructor of oscillatory network based on Hodgkin-Huxley neuron model.
Definition: hhn.py:211
Neural and oscillatory network module.
Definition: __init__.py:1