forked from HarveyBates/Open-JIP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOJIP to Graph.py
38 lines (31 loc) · 971 Bytes
/
OJIP to Graph.py
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
import serial
import time
import matplotlib.pyplot as plt
REF_VOLTAGE = 1.1
ser = serial.Serial('EnterSerialPortOfArduinoHere', 74880)
xdataArray = []
ydataArray = []
def measureOJIP():
ser.flush()
time.sleep(1)
ser.write(b'MF')
for i in range(1100):
OJIP_bytes = ser.readline()
decoded_OJIP_bytes = str(
OJIP_bytes[0:len(OJIP_bytes) - 2].decode("utf-8"))
dataSplit = [float(s) for s in decoded_OJIP_bytes.split("\t")]
xdata = dataSplit[0]
ydata = float(dataSplit[1])
ydata = ((ydata * REF_VOLTAGE) / 1023)
xdataArray.append(xdata)
ydataArray.append(ydata)
measureOJIP()
plt.figure(figsize=(5, 5))
plt.semilogx(xdataArray, ydataArray, label='OJIP',
color='xkcd:blue', marker=None)
plt.ylabel("Fluorescence (V))")
plt.xlabel("Time (ms)")
plt.xlim(0.04, 1000)
plt.yticks([0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000])
plt.legend(loc='best')
plt.show()