docstr: Augment time series.
  
  Parameters
  ----------
  X : numpy array
      Time series to be augmented. It must be a numpy array with shape
      (T,), (N, T), or (N, T, C), where T is the length of a series, N is
      the number of series, and C is the number of a channels in a series.
  
  Y: numpy array, optional
      Segmentation mask of the original time series. It must be a binary
      numpy array with shape (T,), (N, T), or (N, T, L), where T is the
      length of a series, N is the number of series, and L is the number
      of a segmentation classes. Default: None.
  
  Returns
  -------
  2-tuple (numpy array, numpy array), or numpy array
      The augmented time series, and (optionally) the augmented
      segmentation mask.
docstr_tok: ["Augment","time","series",".","Parameters","--","--","--","--","--","X",":","numpy","array","Time","series","to","be","augmented",".","It","must","be","a","numpy","array","with","shape","(","T",",",")",",","(","N",",","T",")",",","or","(","N",",","T",",","C",")",",","where","T","is","the","length","of","a","series",",","N","is","the","number","of","series",",","and","C","is","the","number","of","a","channels","in","a","series",".","Y",":","numpy","array",",","optional","Segmentation","mask","of","the","original","time","series",".","It","must","be","a","binary","numpy","array","with","shape","(","T",",",")",",","(","N",",","T",")",",","or","(","N",",","T",",","L",")",",","where","T","is","the","length","of","a","series",",","N","is","the","number","of","series",",","and","L","is","the","number","of","a","segmentation","classes",".","Default",":","None",".","Returns","--","--","--","-","2-tuple","(","numpy","array",",","numpy","array",")",",","or","numpy","array","The","augmented","time","series",",","and","(","optionally",")","the","augmented","segmentation","mask","."]
code: def augment(
      self, X: np.ndarray, Y: Optional[np.ndarray] = None
  ) -> Union[np.ndarray, Tuple[np.ndarray, np.ndarray]]:
      """
      Augment time series.
  
      Parameters
      ----------
      X : numpy array
          Time series to be augmented. It must be a numpy array with shape
          (T,), (N, T), or (N, T, C), where T is the length of a series, N is
          the number of series, and C is the number of a channels in a series.
  
      Y: numpy array, optional
          Segmentation mask of the original time series. It must be a binary
          numpy array with shape (T,), (N, T), or (N, T, L), where T is the
          length of a series, N is the number of series, and L is the number
          of a segmentation classes. Default: None.
  
      Returns
      -------
      2-tuple (numpy array, numpy array), or numpy array
          The augmented time series, and (optionally) the augmented
          segmentation mask.
  
      """
      X_ERROR_MSG = (
          "Input X must be a numpy array with shape (T,), (N, T), or (N, T, "
          "C), where T is the length of a series, N is the number of series, "
          "and C is the number of a channels in a series."
      )
  
      Y_ERROR_MSG = (
          "Input Y must be a numpy array with shape (T,), (N, T), or (N, T, "
          "L), where T is the length of a series, N is the number of series, "
          "and L is the number of a segmentation classes."
      )
  
      if not isinstance(X, np.ndarray):
          raise TypeError(X_ERROR_MSG)
      ndim_x = X.ndim
      if ndim_x == 1:  # (T, )
          X = X.reshape(1, -1, 1)
      elif ndim_x == 2:  # (N, T)
          X = np.expand_dims(X, 2)
      elif ndim_x == 3:  # (N, T, C)
          pass
      else:
          raise ValueError(X_ERROR_MSG)
  
      if Y is not None:
          if not isinstance(Y, np.ndarray):
              raise TypeError(Y_ERROR_MSG)
          ndim_y = Y.ndim
          if ndim_y == 1:  # (T, )
              Y = Y.reshape(1, -1, 1)
          elif ndim_y == 2:  # (N, T)
              Y = np.expand_dims(Y, 2)
          elif ndim_y == 3:  # (N, T, L)
              pass
          else:
              raise ValueError(Y_ERROR_MSG)
  
      N, T, _ = X.shape
  
      if Y is not None:
          Ny, Ty, _ = Y.shape
          # check consistency between X and Y
          if N != Ny:
              raise ValueError(
                  "The numbers of series in X and Y are different."
              )
          if T != Ty:
              raise ValueError(
                  "The length of series in X and Y are different."
              )
  
      # if this augmenter changes series length AND multiple outputs are
      # expected, it must has prob equal to 1, otherwise the outputs may have
      # different length
      if (
          self._augmented_series_length(T) != T
          and ((self.repeats > 1) or (N > 1))
          and (self.prob != 1.0)
      ):
          raise RuntimeError(
              "This augmenter changes series length. "
              "When augmenting multiple series or multiple times, parameter "
              "`prob` must be 1.0, otherwise the output series may have "
              "different length."
          )
  
      # augment
      X_aug, Y_aug = self._augment(X, Y)
  
      if ndim_x == 1:
          if self.repeats == 1:
              X_aug = X_aug.flatten()
          else:
              X_aug = X_aug.reshape(self.repeats, -1)
      elif ndim_x == 2:
          X_aug = X_aug.reshape(N * self.repeats, -1)
  
      if Y_aug is not None:
          if ndim_y == 1:
              if self.repeats == 1:
                  Y_aug = Y_aug.flatten()
              else:
                  Y_aug = Y_aug.reshape(self.repeats, -1)
          elif ndim_y == 2:
              Y_aug = Y_aug.reshape(N * self.repeats, -1)
  
      if Y_aug is None:
          return X_aug
      else:
          return X_aug, Y_aug
  
imports: from abc import ABC, abstractmethod
  from copy import deepcopy
  from typing import Any, Dict, Iterator, List, Optional, Tuple, Union, overload
  import numpy
  from .None import _default_seed
label_desc: Use image node_id 14 for calling the _Augmenter obj's underlying member method code with example usage: obj.augment(X, Y) and returns: X_aug, X_aug,  Y_aug