-
Notifications
You must be signed in to change notification settings - Fork 0
/
test
52 lines (44 loc) · 1.61 KB
/
test
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
import serial
import time
import threading
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
readings={'rssi':0,'send_num':0,'x':0,'y':0,'h':0,'pressure':0,
'temperature':0, 'air_quality':0, 'pm25':0, 'pm10':0,'humidity':0,'battery':0}
readings['rssi']=0 #defaultowe rssi
DIR='C:/Users/Andrzej/Desktop/'
file = open(DIR+"raw.txt","r")
fields = file.readlines()
file.close()
read1=[]
read2=[]
read3=[]
read4=[]
def load_reading(line_num):
read1.append(44330*(1 - np.power(float(fields[line_num].split('_')[7])/float(1013.25), 0.1903))-182)
read2.append(str(fields[line_num].split('_')[4]))
read3.append(str(fields[line_num].split('_')[5]))
read4.append(str(fields[line_num].split('_')[7]))
'''
readings['rssi'].append(str(fields[line_num].split('_')[2]))
readings['send_num'] = str(fields[line_num].split('_')[3])
readings['x'] = str(fields[line_num].split('_')[4])
readings['y'] =str(fields[line_num].split('_')[5])
readings['h'] = str(fields[line_num].split('_')[6])
readings['pressure'] = str(fields[line_num].split('_')[7])
readings['temperature'] = str(fields[line_num].split('_')[8])
readings['air_quality'] = str(fields[line_num].split('_')[9])
readings['pm25'] = str(fields[line_num].split('_')[10])
readings['pm10'] = str(fields[line_num].split('_')[11])
readings['humidity'] = str(fields[line_num].split('_')[12])
readings['battery'] = str(fields[line_num].split('_')[13])
'''
line_num=0
while(line_num<170):
load_reading(line_num)
line_num+=1
print(read1)
#time.sleep(0.1)
print(max(read1))
print(min(read1))