def test_extract_time_series(self): # GIVEN sensorFile = '../data/FallDataSet/209/Testler Export/916/Test_1/340535.txt' df = pd.DataFrame({'Acc_X': [1.0, 2.0, 3.0], 'Acc_Y': [4.0, 5.0, 6.0]}) time_series_extractor = TimeSeriesExtractor( sensor_file_2_df=lambda sensor_file: {sensorFile: df}[sensor_file], columns=['Acc_X', 'Acc_Y']) # WHEN X_actual, y_actual = time_series_extractor.extract_time_series( sensorFile) # THEN X_expected = np.array([[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]]) y_expected = isFall(sensorFile) self.assertEquals(X_expected.tolist(), X_actual.tolist()) self.assertEquals(y_expected, y_actual)
def test_is_fall1(self): fall = isFall( '../data/FallDataSet/209/Testler Export/916/Test_1/340535.txt') self.assertEquals(fall, True)
def sensorFile_and_fall_df(self, sensorFile): return pd.DataFrame(data={ 'sensorFile': [sensorFile], 'fall': isFall(sensorFile) })
def test_is_fall2(self): fall = isFall( '../data/FallDataSet/209/Testler Export/813/Test_6/340535.txt') self.assertEquals(fall, False)
def extract_time_series(self, sensorFile): X = extract_time_series(self.sensor_file_2_df(sensorFile), self.columns) y = isFall(sensorFile) return X, y