Browse Source

rename : vect -> vec

master
김선중 1 year ago
parent
commit
d74738eaf2
1 changed files with 12 additions and 12 deletions
  1. +12
    -12
      Scripts/preprocess_daily.py

+ 12
- 12
Scripts/preprocess_daily.py View File

@ -335,20 +335,20 @@ class DailyPreprocessor():
inc_edges = [edge for edge in node.getIncoming() if edge.getFunction() == ''] # incoming edges
out_edges = [edge for edge in node.getOutgoing() if edge.getFunction() == ''] # outgoing edges
# 교차로의 모든 (from / to) directions (unit vector)
inc_vects = []
inc_vecs = []
for inc_edge in inc_edges:
start = inc_edge.getShape()[-2]
end = inc_edge.getShape()[-1]
inc_vect = np.array(end) - np.array(start)
inc_vect = inc_vect / (inc_vect ** 2).sum() ** 0.5
inc_vects.append(inc_vect)
out_vects = []
inc_vec = np.array(end) - np.array(start)
inc_vec = inc_vec / (inc_vec ** 2).sum() ** 0.5
inc_vecs.append(inc_vec)
out_vecs = []
for out_edge in out_edges:
start = out_edge.getShape()[0]
end = out_edge.getShape()[1]
out_vect = np.array(end) - np.array(start)
out_vect = out_vect / (out_vect ** 2).sum() ** 0.5
out_vects.append(out_vect)
out_vec = np.array(end) - np.array(start)
out_vec = out_vec / (out_vec ** 2).sum() ** 0.5
out_vecs.append(out_vec)
# 진입각, 진출각 불러오기
if not pd.isna(row.inc_angle):
inc_angle = int(row.inc_angle)
@ -356,13 +356,13 @@ class DailyPreprocessor():
# 방위각을 일반각으로 가공, 라디안 변환, 단위벡터로 변환
inc_angle = (-90 - inc_angle) % 360
inc_angle = inc_angle * np.pi / 180.
inc_vect_true = np.array([np.cos(inc_angle), np.sin(inc_angle)])
inc_vec_true = np.array([np.cos(inc_angle), np.sin(inc_angle)])
out_angle = (90 - out_angle) % 360
out_angle = out_angle * np.pi / 180.
out_vect_true = np.array([np.cos(out_angle), np.sin(out_angle)])
out_vec_true = np.array([np.cos(out_angle), np.sin(out_angle)])
# 매칭 엣지 반환
inc_index = np.array([np.dot(inc_vect, inc_vect_true) for inc_vect in inc_vects]).argmax()
out_index = np.array([np.dot(out_vect, out_vect_true) for out_vect in out_vects]).argmax()
inc_index = np.array([np.dot(inc_vec, inc_vec_true) for inc_vec in inc_vecs]).argmax()
out_index = np.array([np.dot(out_vec, out_vec_true) for out_vec in out_vecs]).argmax()
inc_edge_id = inc_edges[inc_index].getID()
out_edge_id = out_edges[out_index].getID()
self.match5.at[index, 'inc_edge'] = inc_edge_id

Loading…
Cancel
Save