-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheval_atl_ant_tests_loop_krti.py
129 lines (105 loc) · 5.6 KB
/
eval_atl_ant_tests_loop_krti.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
'''
Created on May 30, 2016
@author: Peter Hillyard
'''
# This script is used to evaluate the performance of the three antenna types
# used during our experimentation in Atlanta.
import sys
import numpy as np
sys.path.insert(0, '../my_span_package') # Adds higher directory to python modules path.
import rti_class as rti
# node_loc_fname = 'data/node_loc_data/neals_old_house/node_loc_2012_11_01.txt'
# rss_fname = 'data/rss_data/neals_old_house/rss_2012_11_01_all.txt'
# node_loc_fname = 'data/node_loc_data/airbnb_atl/node_loc_2016_05_17.txt'
# rss_fname = 'data/rss_data/airbnb_atl/rss_2016_05_17_omni_peter_2_all.txt'
# pivot_coords_fname = 'data/true_loc_data/airbnb_atl/pivot_coords_2016_05_17.txt'
# path_ind_fname = 'data/true_loc_data/airbnb_atl/pivot_idx_2016_05_17.txt'
loc = 'gregs_house'
node_loc_date = '2016_05_19'
rss_date_and_name = '2016_05_19_lcom_peter_walk_2_all'
pivot_coord_date = '2016_05_19'
pivot_idx_date = '2016_05_19'
# loc = 'airbnb_atl'
# node_loc_date = '2016_05_17'
# rss_date_and_name = '2016_05_17_lcom_peter_walk_2_all'
# pivot_coord_date = '2016_05_17'
# pivot_idx_date = '2016_05_17'
# loc = 'pizza_house'
# node_loc_date = '2016_05_16'
# rss_date_and_name = '2016_05_18_epatch_qi_2_all'
# pivot_coord_date ='2016_05_16'
# pivot_idx_date = '2016_05_16'
node_loc_fname = 'data/node_loc_data/' + loc + '/node_loc_' + node_loc_date + '.txt'
rss_fname = 'data/rss_data/' + loc + '/rss_' + rss_date_and_name + '.txt'
pivot_coords_fname = 'data/true_loc_data/' + loc + '/pivot_coords_' + pivot_coord_date + '.txt'
path_ind_fname = 'data/true_loc_data/' + loc + '/pivot_idx_' + pivot_idx_date + '.txt'
results_fname = 'data/results/' + loc + '/performance_' + rss_date_and_name + '.txt'
print rss_date_and_name
num_ch = 4
rti_T = 0.0
skip_time=16.0
cal_time=16.0
path_start_time = skip_time+cal_time
speed = 1.0 / 2.0
minRMSE = 100000.
# Loop through parameters
for delta_p in [1.0]:
for sigmax2 in [0.1,0.05,0.025,0.01]:
for delta in [7.5,10.0,12.0,15.0,20.0]:
for epl in [0.25,0.5,0.75,1.0]:
# Initialize rti stuff
# rti_obj = rti.ab_rti(node_loc_fname,num_ch,delta_p,sigmax2,delta,epl,rti_T,skip_time,cal_time)
# rti_obj.set_true_coord_params(path_start_time,speed,pivot_coords_fname,path_ind_fname)
# Initialize moving average rti stuff
# ltb_len = 20
# stb_len = 5
#
# rti_obj = rti.ma_rti(node_loc_fname,num_ch,delta_p,sigmax2,delta,epl,rti_T,skip_time,cal_time)
# rti_obj.set_mabd_params(ltb_len,stb_len)
# rti_obj.set_true_coord_params(path_start_time,speed,pivot_coords_fname,path_ind_fname)
#
# Initialize moving average, top M links rti stuff
# ltb_len = 20
# stb_len = 5
# M = 2
# fade_type = 'lse'
#
# rti_obj = rti.fade_level_rti(node_loc_fname,num_ch,delta_p,sigmax2,delta,epl,rti_T,skip_time,cal_time)
# rti_obj.set_extra_params(ltb_len,stb_len,M,fade_type)
# rti_obj.set_true_coord_params(path_start_time,speed,pivot_coords_fname,path_ind_fname)
#
# Initialize moving average, top M links rti stuff
ktype = 'gaus' # type of kernel
R = np.array(range(-110, 0)) # Range of RSS values
for sigma_G2 in [25.0,30.0]:
for beta_p in [0.99,0.999,0.9995]: # short term
beta_q = 0.70 # long term
rti_obj = rti.krti(node_loc_fname,num_ch,delta_p,sigmax2,delta,epl,rti_T,skip_time,cal_time)
rti_obj.set_extra_params(R,ktype,sigma_G2,beta_p,beta_q)
rti_obj.set_true_coord_params(path_start_time,speed,pivot_coords_fname,path_ind_fname)
est_coord_vec = []
true_coord_vec = []
# loop through all lines in the RSS .txt file
with open(rss_fname,'r') as f:
for line in f:
rti_obj.observe(line)
#rti_obj.plot_current_image(pause_time=0.05)
true_coord_vec.append(rti_obj.get_true_coord())
est_coord_vec.append(rti_obj.get_est_coord())
true_coord_vec = np.array(true_coord_vec)
est_coord_vec = np.array(est_coord_vec)
rmse = rti_obj.compute_rmse(true_coord_vec,est_coord_vec,save_type=None,out_fname=results_fname)
if rmse < minRMSE:
str_out = 'R=' + str(sigma_G2) + ', betaP=' + str(beta_p)
print str_out
out_str = 'dp=' + str(delta_p) + ', sx2=' + str(sigmax2)
out_str += ', delta=' + str(delta) + ', lambda=' + str(epl)
out_str += ', rmse=' + str(rmse)
print out_str
minRMSE = rmse
#sre,yvals = rti_obj.compute_cdf(true_coord_vec,est_coord_vec)
# plt.plot(sre,yvals)
# plt.grid()
# plt.ylabel('Percentile')
# plt.xlabel('Error (ft)')
# plt.show()