コード例 #1
0
                raise ValueError("x and y signals must have same size")
        except ValueError, err_msg:
            raise ValueError(err_msg)
            return

        ' Initialize default values if not given '
        if self._tau_max == 0:
            self._tau_max = lx / 10
        if self._window == 0:
            self._window = lx / 10

        ' Initialize lag array'
        lag_array = np.arange(-self._tau_max, self._tau_max + 1, self._tau_inc)

        ' Initialize Mutual information instance once '
        mi = MutualInformation(self._n_neighbours, self._type, self._var_resc,
                               self._noise)

        ' Initialize results '
        window_MI = {}

        i = self._tau_max
        while i <= lx - self._window:
            curr_coef_lag = []
            for k in lag_array:
                if k <= 0:  # For negative tau
                    curr_x = x[i:i + self._window].values
                    curr_y = y[i + k:i + k + self._window].values

                else:  # For positive tau
                    curr_x = x[i - k:i - k + self._window].values
                    curr_y = y[i:i + self._window].values
コード例 #2
0
         raise ValueError("x and y signals must have same size")
 except ValueError, err_msg:
     raise ValueError(err_msg)
     return
 
 ' Initialize default values if not given '
 if self._tau_max == 0 :
     self._tau_max = lx / 10
 if self._window == 0 :
     self._window = lx / 10
 
 ' Initialize lag array'
 lag_array = np.arange(-self._tau_max, self._tau_max +1, self._tau_inc)
 
 ' Initialize Mutual information instance once '
 mi = MutualInformation(self._n_neighbours, self._type, self._var_resc, self._noise)
 
 ' Initialize results '
 window_MI = {}
 
 i = self._tau_max
 while i <= lx - self._window : 
     curr_coef_lag = []
     for k in lag_array :
         if k <= 0 :  # For negative tau
             curr_x = x[i : i + self._window].values
             curr_y = y[i + k : i + k + self._window].values
                 
         else :      # For positive tau
             curr_x = x[i - k : i - k + self._window].values
             curr_y = y[i : i + self._window].values
コード例 #3
0
                raise ValueError("x and y signals must have same size")
        except ValueError, err_msg:
            raise ValueError(err_msg)
            return

        ' Initialize default values if not given '
        if self._tau_max == 0 :
            self._tau_max = lx / 10
        if self._window == 0 :
            self._window = lx / 10

        ' Initialize lag array'
        lag_array = np.arange(-self._tau_max, self._tau_max +1, self._tau_inc)

        ' Initialize Mutual information instance once '
        mi = MutualInformation(self._n_neighbours, self._type, self._var_resc, self._noise)

        ' Initialize results '
        window_MI = {}

        i = self._tau_max

        while i <= lx - self._window:
            curr_coef_lag = []

            fixed_x = pd.DataFrame(x[i: i + self._window].values)
            fixed_y = pd.DataFrame(y[i: i + self._window].values)

            # For negative tau
            for k in lag_array[lag_array <= 0]:
                curr_y = y[i + k: i + k + self._window].values