original_docstring: Calculate derivatves with respect to time (first dimension).
  
      Parameters
      ----------
       X : 2d numpy array
          array for which derivatives will be calculated in the first diminsion.
          Distinct trajectories can be specified by separating the datasets
          within X by rows of np.nan
  
      Returns
      -------
      2d numpy array :
          updated X array and corresponding time derivatives
      
docstring: Calculate derivatves with respect to time (first dimension).
  Parameters
  
  X : 2d numpy array
  array for which derivatives will be calculated in the first diminsion.
  Distinct trajectories can be specified by separating the datasets
  within X by rows of np.nan
  
  Returns
  
  2d numpy array :
  updated X array and corresponding time derivatives
docstring_tokens: Calculate derivatves with respect to time ( first dimension ) . Parameters X : 2d numpy array array for which derivatives will be calculated in the first diminsion . Distinct trajectories can be specified by separating the datasets within X by rows of np . nan Returns 2d numpy array : updated X array and corresponding time derivatives
code: def _calculate_partials(X):
      """Calculate derivatves with respect to time (first dimension).
  
      Parameters
      ----------
       X : 2d numpy array
          array for which derivatives will be calculated in the first diminsion.
          Distinct trajectories can be specified by separating the datasets
          within X by rows of np.nan
  
      Returns
      -------
      2d numpy array :
          updated X array and corresponding time derivatives
      """
      # find splits
      break_points = np.where(np.any(np.isnan(X), 1))[0].tolist()
      break_points.append(X.shape[0])
  
      start = 0
      for end in break_points:
          x_seg = np.copy(X[start:end, :])
          # calculate time derivs using filter
          time_deriv = np.empty(x_seg.shape)
          for i in range(x_seg.shape[1]):
              time_deriv[:, i] = _savitzky_golay_gram(x_seg[:, i], 7, 3, 1)
          # remove edge effects
          time_deriv = time_deriv[3:-4, :]
          x_seg = x_seg[3:-4, :]
  
          if start == 0:
              x_all = np.copy(x_seg)
              time_deriv_all = np.copy(time_deriv)
              inds_all = np.arange(start + 3, end - 4)
          else:
              x_all = np.vstack((x_all, np.copy(x_seg)))
              time_deriv_all = np.vstack((time_deriv_all,
                                          np.copy(time_deriv)))
  
              inds_all = np.hstack((inds_all,
                                    np.arange(start + 3, end - 4)))
          start = end + 1
  
      return x_all, time_deriv_all, inds_all
code_tokens: def _calculate_partials ( X ) : break_points = np . where ( np . any ( np . isnan ( X ) , 1 ) ) [ 0 ] . tolist ( ) break_points . append ( X . shape [ 0 ] ) start = 0 for end in break_points : x_seg = np . copy ( X [ start : end , : ] ) time_deriv = np . empty ( x_seg . shape ) for i in range ( x_seg . shape [ 1 ] ) : time_deriv [ : , i ] = _savitzky_golay_gram ( x_seg [ : , i ] , 7 , 3 , 1 ) time_deriv = time_deriv [ 3 : - 4 , : ] x_seg = x_seg [ 3 : - 4 , : ] if start == 0 : x_all = np . copy ( x_seg ) time_deriv_all = np . copy ( time_deriv ) inds_all = np . arange ( start + 3 , end - 4 ) else : x_all = np . vstack ( ( x_all , np . copy ( x_seg ) ) ) time_deriv_all = np . vstack ( ( time_deriv_all , np . copy ( time_deriv ) ) ) inds_all = np . hstack ( ( inds_all , np . arange ( start + 3 , end - 4 ) ) ) start = end + 1 return x_all , time_deriv_all , inds_all
short_docstring: Calculate derivatves with respect to time (first dimension).
short_docstring_tokens: Calculate derivatves with respect to time ( first dimension ) .
comment: """Calculate derivatves with respect to time (first dimension).
  
      Parameters
      ----------
       X : 2d numpy array
          array for which derivatives will be calculated in the first diminsion.
          Distinct trajectories can be specified by separating the datasets
          within X by rows of np.nan
  
      Returns
      -------
      2d numpy array :
          updated X array and corresponding time derivatives
      """$SEP$# find splits$SEP$# calculate time derivs using filter$SEP$# remove edge effects