Ejemplo n.º 1
0
 def __init__(self, num_osc, parameters = None, type_conn = conn_type.ALL_TO_ALL, type_conn_represent = conn_represent.MATRIX, ccore = False):
     """!
     @brief Constructor of oscillatory network LEGION (local excitatory global inhibitory oscillatory network).
     
     @param[in] num_osc (uint): Number of oscillators in the network.
     @param[in] parameters (legion_parameters): Parameters of the network that are defined by structure 'legion_parameters'.
     @param[in] type_conn (conn_type): Type of connection between oscillators in the network.
     @param[in] type_conn_represent (conn_represent): Internal representation of connection in the network: matrix or list.
     @param[in] ccore (bool): If True then all interaction with object will be performed via CCORE library (C++ implementation of pyclustering).
     
     """
     
     # set parameters of the network
     if (parameters is not None):
         self._params = parameters;
     else:
         self._params = legion_parameters();
     
     if (ccore is True):
         self.__ccore_legion_pointer = wrapper.legion_create(num_osc, type_conn, self._params);
     else: 
         super().__init__(num_osc, type_conn, type_conn_represent);
             
         # initial states
         self._excitatory = [ random.random() for i in range(self._num_osc) ];
         self._inhibitory = [0.0] * self._num_osc;
         self._potential = [0.0] * self._num_osc;
         
         self._coupling_term = [0.0] * self._num_osc;
         self._buffer_coupling_term = [0.0] * self._num_osc;
             
         # generate first noises
         self._noise = [random.random() * self._params.ro for i in range(self._num_osc)];
Ejemplo n.º 2
0
    def __init__(self,
                 num_osc,
                 parameters=None,
                 type_conn=conn_type.ALL_TO_ALL,
                 type_conn_represent=conn_represent.MATRIX,
                 ccore=True):
        """!
        @brief Constructor of oscillatory network LEGION (local excitatory global inhibitory oscillatory network).
        
        @param[in] num_osc (uint): Number of oscillators in the network.
        @param[in] parameters (legion_parameters): Parameters of the network that are defined by structure 'legion_parameters'.
        @param[in] type_conn (conn_type): Type of connection between oscillators in the network.
        @param[in] type_conn_represent (conn_represent): Internal representation of connection in the network: matrix or list.
        @param[in] ccore (bool): If True then all interaction with object will be performed via CCORE library (C++ implementation of pyclustering).
        
        """

        self._params = None
        # parameters of the network

        self.__ccore_legion_pointer = None
        self._params = parameters

        # set parameters of the network
        if (self._params is None):
            self._params = legion_parameters()

        if ((ccore is True) and ccore_library.workable()):
            self.__ccore_legion_pointer = wrapper.legion_create(
                num_osc, type_conn, self._params)

        else:
            super().__init__(num_osc, type_conn, type_conn_represent)

            # initial states
            self._excitatory = [random.random() for _ in range(self._num_osc)]
            self._inhibitory = [0.0] * self._num_osc
            self._potential = [0.0] * self._num_osc

            self._coupling_term = None
            # coupling term of each oscillator
            self._global_inhibitor = 0
            # value of global inhibitory
            self._stimulus = None
            # stimulus of each oscillator

            self._dynamic_coupling = None
            # dynamic connection between oscillators
            self._coupling_term = [0.0] * self._num_osc
            self._buffer_coupling_term = [0.0] * self._num_osc

            # generate first noises
            self._noise = [
                random.random() * self._params.ro for i in range(self._num_osc)
            ]