Commit 84161f94 authored by Bryson Howell's avatar Bryson Howell

Small change to work with new pythonlpm repo

parent 25b4fb66
...@@ -3,6 +3,7 @@ import matplotlib ...@@ -3,6 +3,7 @@ import matplotlib
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import os, sys, inspect import os, sys, inspect
from os import path, getcwd from os import path, getcwd
from scipy.io import savemat
import pandas as pd import pandas as pd
import time import time
...@@ -12,7 +13,7 @@ parentdir = os.path.dirname(currentdir) ...@@ -12,7 +13,7 @@ parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir) sys.path.insert(0, parentdir)
from arcgis_terrain import get_terrain_map, lat_lon2meters from arcgis_terrain import get_terrain_map, lat_lon2meters
from LostPersonModel.main_hiker import run_replicate #change this import to where you have the LPM repo from pythonlpm.main_hiker import run_replicate, replicates #change this import to where you have the LPM repo
#Runs replicates of lost person model on data sets collected by lpm_maps.py, producing a heatmap #Runs replicates of lost person model on data sets collected by lpm_maps.py, producing a heatmap
...@@ -21,11 +22,10 @@ from LostPersonModel.main_hiker import run_replicate #change this import to wh ...@@ -21,11 +22,10 @@ from LostPersonModel.main_hiker import run_replicate #change this import to wh
def main(exp_name='test', start_idx=0, n_envs=1, n_iter=10): def main(exp_name='test', start_idx=0, n_envs=1, n_iter=10):
#Size in meters of GIS datasets #Size in meters of GIS datasets
test_extent = 20000 test_extent = 20000
download_extent = 40000 download_extent = 40000
LL = [20000, 20000, 1] LL = [20000, 20000, 3000]
#LPM Parameters #LPM Parameters
ts = 850 #walking speed ts = 850 #walking speed
...@@ -99,7 +99,12 @@ def main(exp_name='test', start_idx=0, n_envs=1, n_iter=10): ...@@ -99,7 +99,12 @@ def main(exp_name='test', start_idx=0, n_envs=1, n_iter=10):
#Run LPM #Run LPM
#plot_env(map_data,ipp_xy,find_xy,exp_name,env,incident) #plot_env(map_data,ipp_xy,find_xy,exp_name,env,incident)
start_t = time.time() start_t = time.time()
[x, y, behavior] = run_replicate(ipp_xy, find_xy, map_data, T, p_behavior, alpha, LL) #test runs
#test(ipp_xy, find_xy, map_data, T, p_behavior, alpha, LL)
#return
#run real thing
replicates(ipp_xy, find_xy, map_data, T, p_behavior, alpha, LL, exp_name)
end_t = time.time() end_t = time.time()
end_t = end_t - start_t end_t = end_t - start_t
print('Lost Person Simulation finished, it took %.2f seconds' % end_t) print('Lost Person Simulation finished, it took %.2f seconds' % end_t)
...@@ -179,6 +184,10 @@ def lf_format(inac, lf, elev): ...@@ -179,6 +184,10 @@ def lf_format(inac, lf, elev):
print("We have %d linear features and %d inacessible areas, it took %.1f seconds" % (lf_ct,inac_ct,end_t)) print("We have %d linear features and %d inacessible areas, it took %.1f seconds" % (lf_ct,inac_ct,end_t))
map_data = (bw_inac, bw_lf, elev) map_data = (bw_inac, bw_lf, elev)
#Create Matlab version of the map data
mdic = {"bw_inac": bw_inac, "bw_lf": bw_lf, "elev": elev}
savemat('./map_layers/trust/trust_0/map_data.m', mdic)
return map_data return map_data
#Creates a plot of the environment from saved data #Creates a plot of the environment from saved data
...@@ -357,7 +366,7 @@ def test_lf_format(exp_name='test',force_save='False'): ...@@ -357,7 +366,7 @@ def test_lf_format(exp_name='test',force_save='False'):
if __name__ == "__main__": if __name__ == "__main__":
start = 7 #Environment to start at (0 is first, 8 is first large map) start = 0 #Environment to start at (0 is first, 8 is first large map)
n = 1 #Number of environments to test n = 1 #Number of environments to test
mc = 10 #Monte Carlo iterations mc = 10 #Monte Carlo iterations
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment