Update initialize_params

pull/163/head
Shirley 2021-08-04 01:12:41 -05:00 committed by JulioV
parent 834bd3b93d
commit 4ddb2845a6
1 changed files with 108 additions and 102 deletions

View File

@ -23,6 +23,8 @@ def run_barnett_features_for_rapids(input_dataframe, accuracy_limit=51.0, timezo
mobmatmiss = convert_to_flights_pauses(lonlat, r, w)
mobmat = guess_pause(mobmatmiss, min_pause_dur, min_pause_dist)
obj = initialize_params(mobmat)
data_for_pandas = []
if obj:
lsmf = []
lssigloc = []
for i in range(n_reps):
@ -48,7 +50,7 @@ def run_barnett_features_for_rapids(input_dataframe, accuracy_limit=51.0, timezo
temp_avg.append(np_lsmf[i][j])
avg_output_features.append(np.mean(temp_avg, axis=0))
data_for_pandas = []
for idx, row in enumerate(avg_output_features):
date = row_names[idx]
date_str = str(date[0]) + "-" + str(date[1]) + "-" + str(date[2])
@ -533,7 +535,7 @@ def collapse_pause_in_matrix(matrix, flatmat):
else:
output_mat = []
if flatmat[0][0] > 1:
output_mat = matrix[0:flatmat[0][0]-1,]
output_mat = list(matrix[0:flatmat[0][0]-1,])
for i in range(len(flatmat)):
start_idx = flatmat[i][0]
@ -734,6 +736,7 @@ def initialize_params(matrix):
three = np.where(np_matrix[:,0] == 3)
four = np.where(np_matrix[:,0] == 4)
if len(one) > 1:
ID1p1 = one[0]+1
condition1 = one[0][len(one[0])-1]
if len(one[0]) > 0 and condition1 == len(np_matrix)-1:
@ -809,6 +812,9 @@ def initialize_params(matrix):
the_dict = {'ID1': one, "ID2": two, "ID3": three, "ID4":four, "ID1p1": ID1p1, "allts": all_timestamp, "ind11": ind11, "ind12": ind12, "phatall": phatall, "fd": flight_distances, "ft": flight_times, "fa": fa, "fts": flight_timestamps, "pt": pause_times, "pts": pts, "fxs": fxs, "fys": fys, "pxs": pxs, "pys": pys, "allxs": all_x, "allys": all_y}
return the_dict
else:
print("No flight")
return None
#simulate_mobility_gaps
#impute the missing gaps hot-tech computation