class_docstr: !
  @brief Model of oscillatory network that is based on the Eckhorn model.
  
  @details CCORE option can be used to use the pyclustering core - C/C++ shared library for processing that significantly increases performance.
  
  Here is an example how to perform PCNN simulation:
  @code
      from pyclustering.nnet.pcnn import pcnn_network, pcnn_visualizer
  
      # Create Pulse-Coupled neural network with 10 oscillators.
      net = pcnn_network(10)
  
      # Perform simulation during 100 steps using binary external stimulus.
      dynamic = net.simulate(50, [1, 1, 1, 0, 0, 0, 0, 1, 1, 1])
  
      # Allocate synchronous ensembles from the output dynamic.
      ensembles = dynamic.allocate_sync_ensembles()
  
      # Show output dynamic.
      pcnn_visualizer.show_output_dynamic(dynamic, ensembles)
  @endcode
class_docstr_tok: ["!","@","brief","Model","of","oscillatory","network","that","is","based","on","the","Eckhorn","model",".","@","details","CCORE","option","can","be","used","to","use","the","pyclustering","core","-","C\/C++","shared","library","for","processing","that","significantly","increases","performance",".","Here","is","an","example","how","to","perform","PCNN","simulation",":","@","code","from","pyclustering.nnet.pcnn","import","pcnn_network",",","pcnn_visualizer","#","Create","Pulse-Coupled","neural","network","with","10","oscillators",".","net","=","pcnn_network","(","10",")","#","Perform","simulation","during","100","steps","using","binary","external","stimulus",".","dynamic","=","net.simulate","(","50",",","[","1",",","1",",","1",",","0",",","0",",","0",",","0",",","1",",","1",",","1","]",")","#","Allocate","synchronous","ensembles","from","the","output","dynamic",".","ensembles","=","dynamic.allocate_sync_ensembles","(",")","#","Show","output","dynamic",".","pcnn_visualizer.show_output_dynamic","(","dynamic",",","ensembles",")","@","endcode"]
docstr: !
  @brief Constructor of oscillatory network is based on Kuramoto model.
  
  @param[in] num_osc (uint): Number of oscillators in the network.
  @param[in] parameters (pcnn_parameters): Parameters of the network.
  @param[in] type_conn (conn_type): Type of connection between oscillators in the network (all-to-all, grid, bidirectional list, etc.).
  @param[in] type_conn_represent (conn_represent): Internal representation of connection in the network: matrix or list.
  @param[in] height (uint): Number of oscillators in column of the network, this argument is used 
              only for network with grid structure (GRID_FOUR, GRID_EIGHT), for other types this argument is ignored.
  @param[in] width (uint): Number of oscillotors in row of the network, this argument is used only 
              for network with grid structure (GRID_FOUR, GRID_EIGHT), for other types this argument is ignored.
  @param[in] ccore (bool): If True then all interaction with object will be performed via CCORE library (C++ implementation of pyclustering).
docstr_tok: ["!","@","brief","Constructor","of","oscillatory","network","is","based","on","Kuramoto","model",".","@","param","[","in","]","num_osc","(","uint",")",":","Number","of","oscillators","in","the","network",".","@","param","[","in","]","parameters","(","pcnn_parameters",")",":","Parameters","of","the","network",".","@","param","[","in","]","type_conn","(","conn_type",")",":","Type","of","connection","between","oscillators","in","the","network","(","all-to-all",",","grid",",","bidirectional","list",",","etc.",")",".","@","param","[","in","]","type_conn_represent","(","conn_represent",")",":","Internal","representation","of","connection","in","the","network",":","matrix","or","list",".","@","param","[","in","]","height","(","uint",")",":","Number","of","oscillators","in","column","of","the","network",",","this","argument","is","used","only","for","network","with","grid","structure","(","GRID_FOUR",",","GRID_EIGHT",")",",","for","other","types","this","argument","is","ignored",".","@","param","[","in","]","width","(","uint",")",":","Number","of","oscillotors","in","row","of","the","network",",","this","argument","is","used","only","for","network","with","grid","structure","(","GRID_FOUR",",","GRID_EIGHT",")",",","for","other","types","this","argument","is","ignored",".","@","param","[","in","]","ccore","(","bool",")",":","If","True","then","all","interaction","with","object","will","be","performed","via","CCORE","library","(","C++","implementation","of","pyclustering",")","."]
code: def __init__(
      self,
      num_osc,
      parameters=None,
      type_conn=conn_type.ALL_TO_ALL,
      type_conn_represent=conn_represent.MATRIX,
      height=None,
      width=None,
      ccore=True,
  ):
      """!
      @brief Constructor of oscillatory network is based on Kuramoto model.
  
      @param[in] num_osc (uint): Number of oscillators in the network.
      @param[in] parameters (pcnn_parameters): Parameters of the network.
      @param[in] type_conn (conn_type): Type of connection between oscillators in the network (all-to-all, grid, bidirectional list, etc.).
      @param[in] type_conn_represent (conn_represent): Internal representation of connection in the network: matrix or list.
      @param[in] height (uint): Number of oscillators in column of the network, this argument is used
                  only for network with grid structure (GRID_FOUR, GRID_EIGHT), for other types this argument is ignored.
      @param[in] width (uint): Number of oscillotors in row of the network, this argument is used only
                  for network with grid structure (GRID_FOUR, GRID_EIGHT), for other types this argument is ignored.
      @param[in] ccore (bool): If True then all interaction with object will be performed via CCORE library (C++ implementation of pyclustering).
  
      """
  
      self._outputs = None  # list of outputs of oscillators.
  
      self._feeding = None  # feeding compartment of each oscillator.
      self._linking = None  # linking compartment of each oscillator.
      self._threshold = None  # threshold of each oscillator.
  
      self._params = None
  
      self.__ccore_pcnn_pointer = None
  
      # set parameters of the network
      if parameters is not None:
          self._params = parameters
      else:
          self._params = pcnn_parameters()
  
      if (ccore is True) and ccore_library.workable():
          network_height = height
          network_width = width
  
          if (type_conn == conn_type.GRID_FOUR) or (
              type_conn == conn_type.GRID_EIGHT
          ):
              if (network_height is None) or (network_width is None):
                  side_size = num_osc ** (0.5)
                  if side_size - math.floor(side_size) > 0:
                      raise NameError(
                          "Invalid number of oscillators in the network in case of grid structure"
                      )
  
                  network_height = int(side_size)
                  network_width = int(side_size)
          else:
              network_height = 0
              network_width = 0
  
          self.__ccore_pcnn_pointer = wrapper.pcnn_create(
              num_osc,
              type_conn,
              network_height,
              network_width,
              self._params,
          )
      else:
          super().__init__(
              num_osc, type_conn, type_conn_represent, height, width
          )
  
          self._outputs = [0.0] * self._num_osc
  
          self._feeding = [0.0] * self._num_osc
          self._linking = [0.0] * self._num_osc
          self._threshold = [
              random.random() for i in range(self._num_osc)
          ]
  
imports: import random
  import numpy
  import matplotlib.pyplot
  import matplotlib.animation
  from PIL import Image
  from pyclustering.nnet import *
  from pyclustering.core.wrapper import ccore_library
  import pyclustering.core.pcnn_wrapper
  from pyclustering.utils import draw_dynamics
label_desc: Use image node_id 1 to create a new pcnn_network object from inherited base classes: network with example: obj = pcnn_network(num_osc, parameters, type_conn, type_conn_represent, height, width, ccore)