Commit 371d8e66 authored by kaghog's avatar kaghog
Browse files

calibrate minimum distance threshold

parent d1062112
......@@ -90,8 +90,9 @@ def impute_work_locations(context, distributions, destinations, df_syn_persons_w
radius = prepare_radius_from_cdf(cdf, midpoint_bins, random_values)
#define a threshold distance to be added to the target distance that serves as maximum distance for a person
# the target distance in this case is the midpoint distance of the histogram plus a maximum threshold distance
#this is because we want to select distances within a boundary of this threshold
threshold = 500 #in meters #Todo maybe get this value from the average midpoint of the distance bins
threshold = 0 #in meters #Todo maybe get this value from the average midpoint of the distance bins
radius = radius + threshold
#prepare the home and destination coordinates
......@@ -113,13 +114,14 @@ def impute_work_locations(context, distributions, destinations, df_syn_persons_w
# Method 2: select distances based on number of employees identified in the locations
# In order not to possibly sample distances that are smaller than target distance, is to have a minimum
# threshold below the target distance and consider locations between the threshold and target (donut shape)
# the target distance in this case is the midpoint distance of the histogram plus a maximum threshold distance
for ind, dist in zip(indices,distances):
# limit to distances (indices) within for random selection so that we can use np.choose which works with 32 items
farthest_dist = dist[-1]
minimum_selection_bound = max((farthest_dist - 2*threshold), dist[0])
min_threshold = 1000 # I am testing this arbitrarily - need to calibrate
min_threshold_band = farthest_dist - min_threshold
minimum_selection_bound = max(min_threshold_band, dist[0])
maximum_selection_bound = farthest_dist
ind = ind[(dist >= minimum_selection_bound) & (dist <= maximum_selection_bound)]
......
Supports Markdown
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