瀏覽代碼

initialize moduules

V1.2
Jeong Geol Kim 3 年之前
父節點
當前提交
19ca68f499
共有 1 個文件被更改,包括 29 次插入2 次删除
  1. 29
    2
      modules/wavacc.py

+ 29
- 2
modules/wavacc.py 查看文件

@@ -1,13 +1,37 @@
1 1
 import sys, os, math, time
2 2
 import numpy as np
3 3
 import pandas as pd
4
+import scipy as sp
4 5
 '''
5 6
 wavacc.py for interpolate accelerometer data and extract feature as stroke.
6 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 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 35
     except Exception as e:
12 36
         print(e)
13 37
         return df
@@ -15,6 +39,7 @@ def interpolation(df):
15 39
 def decomposition(df):
16 40
     try:
17 41
         #implemnet decompositino with wavelet transform here
42
+        pass
18 43
     except Exception as e:
19 44
         print(e)
20 45
         return df
@@ -22,6 +47,7 @@ def decomposition(df):
22 47
 def getStroke(df):
23 48
     try:
24 49
         #implement get stroke here
50
+        pass
25 51
     except Exception as e:
26 52
         print(e)
27 53
         return df
@@ -29,6 +55,7 @@ def getStroke(df):
29 55
 def mergeToDataFrame(df):
30 56
     try:
31 57
         #implement merge to dataframe here
58
+        pass
32 59
     except Exception as e:
33 60
         print(e)
34 61
         return df

Loading…
取消
儲存