code: def akinesia_times(self, data_frame):
          
  
          raise_timestamps = data_frame.td[data_frame.action_type == 1]
          down_timestamps = data_frame.td[data_frame.action_type == 0]
          if len(raise_timestamps) == len(down_timestamps):
              at = np.mean(down_timestamps.values - raise_timestamps.values)
          else:
              if len(raise_timestamps) > len(down_timestamps):
                  at = np.mean(down_timestamps.values - raise_timestamps.values[:-(len(raise_timestamps)
                                                                                   - len(down_timestamps))])
              else:
                  at = np.mean(down_timestamps.values[:-(len(down_timestamps)-len(raise_timestamps))]
                               - raise_timestamps.values)
          duration = math.ceil(data_frame.td[-1])
          return np.abs(at), duration
docs: This method calculates akinesia times, mean dwell time on each key in milliseconds
  
              :param data_frame: the data frame
              :type data_frame: pandas.DataFrame
              :return at: akinesia times
              :rtype at: float
              :return duration: test duration (seconds)
              :rtype duration: float