class_docstr: !
  @brief Model of oscillatory network that uses Landau-Stuart oscillator and Kuramoto model as a synchronization mechanism.
  @details Dynamic of each oscillator in the network is described by following differential Landau-Stuart equation with feedback:
  
  [
  \dot{z}_{i} = (i\omega_{i} + 
  ho^{2}_{i} - |z_{i}|^{2} )z_{i} + rac{1}{N}\sum_{j=0}^{N}k_{ij}(z_{j} - z_{i});
  ]
  
  Where left part of the equation is Landau-Stuart equation and the right is a Kuramoto model for synchronization.
  For solving this equation Runge-Kutta 4 method is used by default.
  
  Example:
  @code
      # Prepare oscillatory network parameters.
      amount_oscillators = 3;
      frequency = 1.0;
      radiuses = [1.0, 2.0, 3.0];
      coupling_strength = 1.0;
      
      # Create oscillatory network
      oscillatory_network = fsync_network(amount_oscillators, frequency, radiuses, coupling_strength);
      
      # Simulate network during 200 steps on 10 time-units of time-axis.
      output_dynamic = oscillatory_network.simulate(200, 10, True);    # True is to collect whole output dynamic.
      
      # Visualize output result
      fsync_visualizer.show_output_dynamic(output_dynamic);
  @endcode
  
  Example of output dynamic of the network:
  @image html fsync_sync_examples.png
class_docstr_tok: ["!","@","brief","Model","of","oscillatory","network","that","uses","Landau-Stuart","oscillator","and","Kuramoto","model","as","a","synchronization","mechanism",".","@","details","Dynamic","of","each","oscillator","in","the","network","is","described","by","following","differential","Landau-Stuart","equation","with","feedback",":","[","\\dot","{","z","}","_","{","i","}","=","(","i\\omega_","{","i","}","+","ho^","{","2","}","_","{","i","}","-","|z_","{","i","}","|^","{","2","}",")","z_","{","i","}","+","rac","{","1","}","{","N","}","\\sum_","{","j=0","}","^","{","N","}","k_","{","ij","}","(","z_","{","j","}","-","z_","{","i","}",")",";","]","Where","left","part","of","the","equation","is","Landau-Stuart","equation","and","the","right","is","a","Kuramoto","model","for","synchronization",".","For","solving","this","equation","Runge-Kutta","4","method","is","used","by","default",".","Example",":","@","code","#","Prepare","oscillatory","network","parameters",".","amount_oscillators","=","3",";","frequency","=","1.0",";","radiuses","=","[","1.0",",","2.0",",","3.0","]",";","coupling_strength","=","1.0",";","#","Create","oscillatory","network","oscillatory_network","=","fsync_network","(","amount_oscillators",",","frequency",",","radiuses",",","coupling_strength",")",";","#","Simulate","network","during","200","steps","on","10","time-units","of","time-axis",".","output_dynamic","=","oscillatory_network.simulate","(","200",",","10",",","True",")",";","#","True","is","to","collect","whole","output","dynamic",".","#","Visualize","output","result","fsync_visualizer.show_output_dynamic","(","output_dynamic",")",";","@","endcode","Example","of","output","dynamic","of","the","network",":","@","image","html","fsync_sync_examples.png"]
docstr: !
  @brief Performs static simulation of oscillatory network.
  
  @param[in] steps (uint): Number simulation steps.
  @param[in] time (double): Time of simulation.
  @param[in] collect_dynamic (bool): If True - returns whole dynamic of oscillatory network, otherwise returns only last values of dynamics.
  
  @return (list) Dynamic of oscillatory network. If argument 'collect_dynamic' is True, than return dynamic for the whole simulation time,
           otherwise returns only last values (last step of simulation) of output dynamic.
  
  @see simulate()
  @see simulate_dynamic()
docstr_tok: ["!","@","brief","Performs","static","simulation","of","oscillatory","network",".","@","param","[","in","]","steps","(","uint",")",":","Number","simulation","steps",".","@","param","[","in","]","time","(","double",")",":","Time","of","simulation",".","@","param","[","in","]","collect_dynamic","(","bool",")",":","If","True","-","returns","whole","dynamic","of","oscillatory","network",",","otherwise","returns","only","last","values","of","dynamics",".","@","return","(","list",")","Dynamic","of","oscillatory","network",".","If","argument","'collect_dynamic","'","is","True",",","than","return","dynamic","for","the","whole","simulation","time",",","otherwise","returns","only","last","values","(","last","step","of","simulation",")","of","output","dynamic",".","@","see","simulate","(",")","@","see","simulate_dynamic","(",")"]
code: def simulate(self, steps, time, collect_dynamic=False):
      """!
      @brief Performs static simulation of oscillatory network.
  
      @param[in] steps (uint): Number simulation steps.
      @param[in] time (double): Time of simulation.
      @param[in] collect_dynamic (bool): If True - returns whole dynamic of oscillatory network, otherwise returns only last values of dynamics.
  
      @return (list) Dynamic of oscillatory network. If argument 'collect_dynamic' is True, than return dynamic for the whole simulation time,
               otherwise returns only last values (last step of simulation) of output dynamic.
  
      @see simulate()
      @see simulate_dynamic()
  
      """
  
      dynamic_amplitude, dynamic_time = (
          ([], [])
          if collect_dynamic is False
          else ([self.__amplitude], [0])
      )
  
      step = time / steps
      int_step = step / 10.0
  
      for t in numpy.arange(step, time + step, step):
          self.__amplitude = self.__calculate(t, step, int_step)
  
          if collect_dynamic is True:
              dynamic_amplitude.append(
                  [
                      numpy.real(amplitude)[0]
                      for amplitude in self.__amplitude
                  ]
              )
              dynamic_time.append(t)
  
      if collect_dynamic is False:
          dynamic_amplitude.append(
              [
                  numpy.real(amplitude)[0]
                  for amplitude in self.__amplitude
              ]
          )
          dynamic_time.append(time)
  
      output_sync_dynamic = fsync_dynamic(
          dynamic_amplitude, dynamic_time
      )
      return output_sync_dynamic
  
imports: import matplotlib.pyplot
  import numpy
  import random
  import pyclustering.utils
  from scipy.integrate import odeint
  from pyclustering.nnet import network, conn_type, conn_represent
label_desc: Use image node_id 2 for calling the fsync_network obj's underlying member method code with example usage: obj.simulate(steps, time, collect_dynamic) and returns: output_sync_dynamic