-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheda_plot_data.py
More file actions
52 lines (38 loc) · 1.11 KB
/
eda_plot_data.py
File metadata and controls
52 lines (38 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# by: gunnar pope
# date: 11/19/2018
import csv
import matplotlib.pyplot as plt
import numpy as np
# file = 'data/u1800@lab.d10.p01.10192018.txt'
file = 'data/uIONA@lab.d01.p01.10022018.txt'
data = []
with open(file, 'r') as f:
reader = csv.reader(f, delimiter='|')
for row in reader:
data.append(row)
setting = data[0]
if setting == ['lab']:
header = data[1]
starttime = data[2]
units = data[3]
timerdata = np.array( data[4:] )
print( units)
print( timerdata[:4])
C = 0.047e-6
Fclk = 32768.0
def NtoGskin(n):
"""Convert from number of timer clock cycles, n, to units of skin conductance, G (uS)
Input:
N = integer from 0-32768 where N is the rising-edge-to-rising-edge pulse time (change + discharge cycle
of sensor.
Output:
G = skin conductance in (uS)"""
G = (1.4*C*Fclk)/ (1.0*n) *1e6 - 1/13.3e3 #in uS
return G # in microSiemens
gskin = [ NtoGskin(int(n)) for n in timerdata]
t = np.linspace(0,len(gskin)/2.0,len(gskin))/3600
plt.plot(t,gskin)
plt.title("EDA during labor")
plt.ylabel("Skin Conductance (uS)")
plt.xlabel("Hours")
plt.show()