def __get_tremor_measurements(self, data_frame, directory, files_list): """ Convenience method that gets the finger tapping measurements :param data_frame: the dataframe where the features will be added :type data_frame: pandas.DataFrame :param directory: the directory name that contains the files :type features: str :param files_list: the list of files :type files_list: str :return data_frame: the dataframe :rtype data_frame: pandas.DataFrame """ abr_measurement_type = 'T' tp = pdkit.TremorProcessor() for f in files_list: if f.startswith(abr_measurement_type): tts = pdkit.TremorTimeSeries().load( join(self.__build_folder_path(directory), f)) features = tp.extract_features( tts, self.__get_measurement_name(abr_measurement_type, f)) if features is not None: data_frame = self.__save_features_to_dataframe( features, data_frame, f) else: print('file error: ' + f) return data_frame
def process(self, element, *args, **kwargs): user, mag_sum_accs = element if user and mag_sum_accs: ind, vals = zip(*mag_sum_accs) ser1 = pd.Series([float(v) for v in vals], index=[pd.Timestamp(i) for i in ind]) tp = pdkit.TremorProcessor() yield user, tp.spkt_welch_density(ser1)[0][1] else: yield user, 0
def CalculatePandasAbsoluteEnergyMap(element): user, mag_sum_accs = element if user and mag_sum_accs: ind, vals = zip(*mag_sum_accs) ser1 = pd.Series([float(v) for v in vals], index=[pd.Timestamp(i) for i in ind]) tp = pdkit.TremorProcessor() return user, tp.abs_energy(ser1) else: return user, 0
def setUp(self): self.tp = pdkit.TremorProcessor(lower_frequency=0.0, upper_frequency=4.0) self.filename_cloudupdrs = './tests/data/pronation_supination_left_hand.csv'
def setUp(self): self.tp = pdkit.TremorProcessor() self.filename_cloudupdrs = './tests/data/kinetic_tremor_left_hand.csv' self.filename_mpower = './tests/data/mpower_tremor.json'