Jeong Geol Kim 3 лет назад
Родитель
Сommit
19ca68f499
1 измененных файлов: 29 добавлений и 2 удалений
  1. 29
    2
      modules/wavacc.py

+ 29
- 2
modules/wavacc.py Просмотреть файл

1
 import sys, os, math, time
1
 import sys, os, math, time
2
 import numpy as np
2
 import numpy as np
3
 import pandas as pd
3
 import pandas as pd
4
+import scipy as sp
4
 '''
5
 '''
5
 wavacc.py for interpolate accelerometer data and extract feature as stroke.
6
 wavacc.py for interpolate accelerometer data and extract feature as stroke.
6
 Denosing step is not implemented this module. See addValidDetection function in coordsi.py for denoising.
7
 Denosing step is not implemented this module. See addValidDetection function in coordsi.py for denoising.
7
 '''
8
 '''
8
-def interpolation(df):
9
+def openDataframe(path):
9
     try:
10
     try:
10
-        #implement data here
11
+        handletracedf = pd.read_csv(path)
12
+        return handletracedf
13
+        #implement open dataframe here
14
+    except Exception as e:
15
+        print(e)
16
+
17
+def interpolation(dataframe, ):
18
+    '''
19
+    1. (frame, isValid, acc)
20
+    2. scatter plot of acc if isValid == 1
21
+    3. interpolate acc of isValid == 1.
22
+    '''
23
+    try:
24
+        df = dataframe
25
+        frame = list(df.index.values)
26
+        acc = pd.Series.tolist(df['acceleration'])
27
+        val = pd.Series.tolist(df['isValid'])
28
+
29
+        merged = []
30
+        for i in range(0, len(val)):
31
+            merged.append([frame[i], val[i], acc[i]])
32
+        return merged
33
+
34
+        pass
11
     except Exception as e:
35
     except Exception as e:
12
         print(e)
36
         print(e)
13
         return df
37
         return df
15
 def decomposition(df):
39
 def decomposition(df):
16
     try:
40
     try:
17
         #implemnet decompositino with wavelet transform here
41
         #implemnet decompositino with wavelet transform here
42
+        pass
18
     except Exception as e:
43
     except Exception as e:
19
         print(e)
44
         print(e)
20
         return df
45
         return df
22
 def getStroke(df):
47
 def getStroke(df):
23
     try:
48
     try:
24
         #implement get stroke here
49
         #implement get stroke here
50
+        pass
25
     except Exception as e:
51
     except Exception as e:
26
         print(e)
52
         print(e)
27
         return df
53
         return df
29
 def mergeToDataFrame(df):
55
 def mergeToDataFrame(df):
30
     try:
56
     try:
31
         #implement merge to dataframe here
57
         #implement merge to dataframe here
58
+        pass
32
     except Exception as e:
59
     except Exception as e:
33
         print(e)
60
         print(e)
34
         return df
61
         return df

Загрузка…
Отмена
Сохранить