Exemplo n.º 1
0
def _check_window_params(data, window_length):
    """
    Check that a window of length `window_length` is well-defined on `data`.

    Parameters
    ----------
    data : np.ndarray[ndim=2]
        The array of data to check.
    window_length : int
        Length of the desired window.

    Returns
    -------
    None

    Raises
    ------
    WindowLengthNotPositive
        If window_length < 1.
    WindowLengthTooLong
        If window_length is greater than the number of rows in `data`.
    """
    if window_length < 1:
        raise WindowLengthNotPositive(window_length=window_length)

    if window_length > data.shape[0]:
        raise WindowLengthTooLong(
            nrows=data.shape[0],
            window_length=window_length,
        )
Exemplo n.º 2
0
 def _validate(self):
     super(PositiveWindowLengthMixin, self)._validate()
     if not self.windowed:
         raise WindowLengthNotPositive(window_length=self.window_length)
Exemplo n.º 3
0
 def _validate(self):
     if not self.windowed:
         raise WindowLengthNotPositive(window_length=self.window_length)
     return super(RequiredWindowLengthMixin, self)._validate()
Exemplo n.º 4
0
 def _validate(self):
     if self.windowed or self.window_length is NotSpecified:
         return super(RequiredWindowLengthMixin, self)._validate()
     raise WindowLengthNotPositive(window_length=self.window_length)