Update localization_log_gamma_model.py

This commit is contained in:
HappyZ 2019-06-07 14:07:28 -05:00
parent 40612ad801
commit 9be5c8630a
1 changed files with 16 additions and 10 deletions

View File

@ -55,16 +55,19 @@ def fittingSingle(filepath, args):
best_env_gamma = None
best_rsses = None
for i in range(args.iternum):
result = modelfit_log_gamma(
rx_locs,
rx_rsses,
bounds_pwr=(-60, 0),
bounds_gamma=(2, 6),
bounds_loc_x=(0, 6.4),
bounds_loc_y=(0, 6.4),
monte_carlo_sampling=args.montecarlo,
monte_carlo_sampling_rate=args.montecarlo_rate
)
try:
result = modelfit_log_gamma(
rx_locs,
rx_rsses,
bounds_pwr=(-60, 0),
bounds_gamma=(2, 6),
bounds_loc_x=(0, 6.4),
bounds_loc_y=(0, 6.4),
monte_carlo_sampling=args.montecarlo,
monte_carlo_sampling_rate=args.montecarlo_rate
)
except RuntimeError:
continue
# unpack
fit_mse, est_tx_loc, est_tx_pwr, est_env_gamma, est_rsses = result
if fit_mse < min_fit_mse:
@ -75,6 +78,9 @@ def fittingSingle(filepath, args):
best_env_gamma = est_env_gamma
best_rsses = est_rsses
if best_tx_loc is None:
return
# calculate diff
data_best_est = convert_vector_to_mat(rx_locs, best_rsses, data.shape)
data_diff = data - data_best_est