{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 18,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import pandas as pd\n",
|
|
"import numpy as np\n",
|
|
"import os, sys, copy, argparse\n",
|
|
"import json\n",
|
|
"import sumolib, traci\n",
|
|
"from tqdm import tqdm\n",
|
|
"from datetime import datetime\n",
|
|
"path_root = os.path.dirname(os.path.dirname(os.path.abspath('.')))\n",
|
|
"path_scr = os.path.join(path_root, 'scripts')\n",
|
|
"sys.path.append(path_scr)\n",
|
|
"from preprocess_daily import DailyPreprocessor\n",
|
|
"from generate_signals import SignalGenerator"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 25,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"self = DailyPreprocessor(config_name='revised')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 27,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"1. 데이터를 로드합니다.\n",
|
|
"1-1. 네트워크가 로드되었습니다.\n",
|
|
"1-2. 테이블들이 로드되었습니다.\n",
|
|
"1-3. 네트워크의 모든 clean state requirement들을 체크했습니다.\n",
|
|
"1-5. 테이블을 표준화했습니다.\n",
|
|
"1-6. 주요 객체 (리스트, 딕셔너리)들을 저장했습니다.\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"self.load_data()\n",
|
|
"self.make_match1()\n",
|
|
"self.make_match2()\n",
|
|
"self.make_match3()\n",
|
|
"self.make_match4()\n",
|
|
"self.make_match5()\n",
|
|
"self.make_match6()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 46,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>phase_no</th>\n",
|
|
" <th>ring_type</th>\n",
|
|
" <th>move_no</th>\n",
|
|
" <th>inc_dire</th>\n",
|
|
" <th>out_dire</th>\n",
|
|
" <th>inc_angle</th>\n",
|
|
" <th>out_angle</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" <th>node_id</th>\n",
|
|
" <th>node_type</th>\n",
|
|
" <th>turn_type</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>179</td>\n",
|
|
" <td>004</td>\n",
|
|
" <td>-571542797_02</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>normal</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>003</td>\n",
|
|
" <td>176</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571542797_02</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>normal</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>001</td>\n",
|
|
" <td>095</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571545870_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>normal</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>179</td>\n",
|
|
" <td>271</td>\n",
|
|
" <td>-571542797_02</td>\n",
|
|
" <td>571510153_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>normal</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>4</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>092</td>\n",
|
|
" <td>270</td>\n",
|
|
" <td>571545870_02</td>\n",
|
|
" <td>571510153_01</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>normal</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>...</th>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" <td>...</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>103</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>270</td>\n",
|
|
" <td>090</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u60</td>\n",
|
|
" <td>u_turn</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>104</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>동</td>\n",
|
|
" <td>359</td>\n",
|
|
" <td>090</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u60</td>\n",
|
|
" <td>u_turn</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>105</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>000</td>\n",
|
|
" <td>180</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u60</td>\n",
|
|
" <td>u_turn</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>106</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>A</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>북</td>\n",
|
|
" <td>180</td>\n",
|
|
" <td>000</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u60</td>\n",
|
|
" <td>u_turn</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>107</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>B</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>남</td>\n",
|
|
" <td>서</td>\n",
|
|
" <td>180</td>\n",
|
|
" <td>270</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>NaN</td>\n",
|
|
" <td>u60</td>\n",
|
|
" <td>u_turn</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"<p>108 rows × 13 columns</p>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no phase_no ring_type move_no inc_dire out_dire inc_angle \\\n",
|
|
"0 175 1 A 8 남 북 179 \n",
|
|
"1 175 1 B 4 북 남 003 \n",
|
|
"2 175 2 A 7 북 동 001 \n",
|
|
"3 175 2 B 3 남 서 179 \n",
|
|
"4 175 3 A 6 동 서 092 \n",
|
|
".. ... ... ... ... ... ... ... \n",
|
|
"103 210 2 B 2 서 동 270 \n",
|
|
"104 210 3 A 7 북 동 359 \n",
|
|
"105 210 3 B 4 북 남 000 \n",
|
|
"106 210 4 A 8 남 북 180 \n",
|
|
"107 210 4 B 3 남 서 180 \n",
|
|
"\n",
|
|
" out_angle inc_edge_id out_edge_id node_id node_type turn_type \n",
|
|
"0 004 -571542797_02 571500487_01 i0 normal straight \n",
|
|
"1 176 -571500487_01 571542797_02 i0 normal straight \n",
|
|
"2 095 -571500487_01 571545870_01 i0 normal left \n",
|
|
"3 271 -571542797_02 571510153_01 i0 normal left \n",
|
|
"4 270 571545870_02 571510153_01 i0 normal straight \n",
|
|
".. ... ... ... ... ... ... \n",
|
|
"103 090 NaN NaN u60 u_turn straight \n",
|
|
"104 090 NaN NaN u60 u_turn left \n",
|
|
"105 180 NaN NaN u60 u_turn straight \n",
|
|
"106 000 NaN NaN u60 u_turn straight \n",
|
|
"107 270 NaN NaN u60 u_turn left \n",
|
|
"\n",
|
|
"[108 rows x 13 columns]"
|
|
]
|
|
},
|
|
"execution_count": 46,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"self.match6"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 28,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"self.match7 = self.match6.copy()\n",
|
|
"self.match7 = self.match7[['inter_no', 'node_id', 'move_no', 'inc_angle', 'out_angle', 'inc_dire', 'out_dire', 'inc_edge_id', 'out_edge_id', 'node_type', 'turn_type']]\n",
|
|
"\n",
|
|
"# (1) 각 교차로별 방향 목록 : pdires (possible directions)\n",
|
|
"p2dires = {} # parent_id to directions\n",
|
|
"for parent_id in self.parent_ids:\n",
|
|
" dires = self.match7[self.match7.node_id == parent_id][['inc_dire','out_dire']].values.flatten()\n",
|
|
" dires = {dire for dire in dires if type(dire)==str}\n",
|
|
" p2dires[parent_id] = dires\n",
|
|
"\n",
|
|
"# (2) 각 (교차로, 진입방향) 별 진입id 목록 : inc2id (incoming direction to incoming edge_id)\n",
|
|
"inc2id = {}\n",
|
|
"for parent_id in self.parent_ids:\n",
|
|
" for inc_dire in p2dires[parent_id]:\n",
|
|
" df = self.match7[(self.match7.node_id==parent_id) & (self.match7.inc_dire==inc_dire)]\n",
|
|
" inc2id[(parent_id, inc_dire)] = df.inc_edge_id.iloc[0]\n",
|
|
"\n",
|
|
"# (3) 각 (교차로, 진출방향) 별 진출id 목록 : out2id (outgoing direction to outgoing edge_id)\n",
|
|
"out2id = {}\n",
|
|
"for parent_id in self.parent_ids:\n",
|
|
" for out_dire in p2dires[parent_id]:\n",
|
|
" df = self.match7[(self.match7.node_id==parent_id) & (self.match7.out_dire==out_dire)]\n",
|
|
" out2id[(parent_id, out_dire)] = df.out_edge_id.iloc[0]\n",
|
|
"\n",
|
|
"# (4) 각 parent_id별 이동류번호 목록\n",
|
|
"p2move = dict() # parent id to a list of aligned movement numbers\n",
|
|
"for parent_id in self.parent_ids:\n",
|
|
" pnema = self.nema[self.nema.inc_dire.isin(p2dires[parent_id]) & self.nema.out_dire.isin(p2dires[parent_id])]\n",
|
|
" p2move[parent_id] = list(pnema.move_no)\n",
|
|
"\n",
|
|
"# (5) 방위별 방향벡터\n",
|
|
"dire2vec = dict() # direction to unit vector\n",
|
|
"theta = np.pi/2\n",
|
|
"for dire in self.dires:\n",
|
|
" dire2vec[dire] = np.array([np.cos(theta), np.sin(theta)])\n",
|
|
" theta -= np.pi/4\n",
|
|
"\n",
|
|
"# (6) 각 parent_id별 : 각 이동류별 진입/진출 엣지 id\n",
|
|
"p2move2inc_edge_id = dict() # parent id to move2inc_edge_id\n",
|
|
"p2move2out_edge_id = dict() # parent id to move2out_edge_id\n",
|
|
"for parent_id in self.parent_ids:\n",
|
|
" move2inc_edge_id = dict() # plain movement to incoming edge id\n",
|
|
" move2out_edge_id = dict() # plain movement to outgoing edge id\n",
|
|
" for move_no in range(1,17):\n",
|
|
" row = self.nema[self.nema.move_no==move_no].iloc[0]\n",
|
|
" inc_dire = row.inc_dire\n",
|
|
" out_dire = row.out_dire\n",
|
|
" inc_vec_true = dire2vec[inc_dire]\n",
|
|
" out_vec_true = dire2vec[out_dire]\n",
|
|
"\n",
|
|
" node = self.net.getNode(parent_id)\n",
|
|
" # 교차로의 모든 (from / to) edges\n",
|
|
" inc_edges = [edge for edge in node.getIncoming() if edge.getFunction() == ''] # incoming edges\n",
|
|
" out_edges = [edge for edge in node.getOutgoing() if edge.getFunction() == ''] # outgoing edges\n",
|
|
" # 교차로의 모든 (from / to) unit vector\n",
|
|
" inc_vecs = []\n",
|
|
" for inc_edge in inc_edges:\n",
|
|
" start = inc_edge.getShape()[-1]\n",
|
|
" end = inc_edge.getShape()[-2]\n",
|
|
" inc_vec = np.array(end) - np.array(start)\n",
|
|
" inc_vec = inc_vec / (inc_vec ** 2).sum() ** 0.5\n",
|
|
" inc_vecs.append(inc_vec)\n",
|
|
" out_vecs = []\n",
|
|
" for out_edge in out_edges:\n",
|
|
" start = out_edge.getShape()[0]\n",
|
|
" end = out_edge.getShape()[1]\n",
|
|
" out_vec = np.array(end) - np.array(start)\n",
|
|
" out_vec = out_vec / (out_vec ** 2).sum() ** 0.5\n",
|
|
" out_vecs.append(out_vec)\n",
|
|
" # 매칭 엣지 반환\n",
|
|
" inc_index = np.array([np.dot(inc_vec, inc_vec_true) for inc_vec in inc_vecs]).argmax()\n",
|
|
" out_index = np.array([np.dot(out_vec, out_vec_true) for out_vec in out_vecs]).argmax()\n",
|
|
" inc_edge_id = inc_edges[inc_index].getID()\n",
|
|
" out_edge_id = out_edges[out_index].getID()\n",
|
|
" move2inc_edge_id[move_no] = inc_edge_id\n",
|
|
" move2out_edge_id[move_no] = out_edge_id\n",
|
|
" p2move2inc_edge_id[parent_id] = move2inc_edge_id\n",
|
|
" p2move2out_edge_id[parent_id] = move2out_edge_id\n",
|
|
"\n",
|
|
"# (7) 각 이동류별 진입/진출 방위\n",
|
|
"m2inc_dire = dict()\n",
|
|
"m2out_dire = dict()\n",
|
|
"for move_no in range(1,17):\n",
|
|
" row = self.nema[self.nema.move_no==move_no].iloc[0]\n",
|
|
" m2inc_dire[move_no] = row.inc_dire\n",
|
|
" m2out_dire[move_no] = row.out_dire\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 45,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"{'i0': [1, 2, 3, 4, 5, 6, 7, 8],\n",
|
|
" 'i1': [3, 4, 5, 8],\n",
|
|
" 'i2': [4, 8],\n",
|
|
" 'i3': [1, 2, 3, 4, 5, 6, 7, 8],\n",
|
|
" 'i6': [1, 2, 3, 4, 5, 6, 7, 8],\n",
|
|
" 'i7': [4, 8],\n",
|
|
" 'i8': [1, 2, 3, 4, 5, 6, 7, 8],\n",
|
|
" 'i9': [2, 6]}"
|
|
]
|
|
},
|
|
"execution_count": 45,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"p2move"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 37,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"i0\n",
|
|
"1\n",
|
|
"571545870_02\n",
|
|
"571545870_02\n",
|
|
"2\n",
|
|
"571510153_02\n",
|
|
"571510153_02\n",
|
|
"3\n",
|
|
"-571542797_02\n",
|
|
"-571542797_02\n",
|
|
"4\n",
|
|
"-571500487_01\n",
|
|
"-571500487_01\n",
|
|
"5\n",
|
|
"571510153_02\n",
|
|
"571510153_02\n",
|
|
"6\n",
|
|
"571545870_02\n",
|
|
"571545870_02\n",
|
|
"7\n",
|
|
"-571500487_01\n",
|
|
"-571500487_01\n",
|
|
"8\n",
|
|
"-571542797_02\n",
|
|
"-571542797_02\n",
|
|
"9\n",
|
|
"-571500487_01\n",
|
|
"-571500487_01\n",
|
|
"10\n",
|
|
"571510153_02\n",
|
|
"571510153_02\n",
|
|
"11\n",
|
|
"571545870_02\n",
|
|
"571545870_02\n",
|
|
"12\n",
|
|
"-571500487_01\n",
|
|
"-571500487_01\n",
|
|
"13\n",
|
|
"571510153_02\n",
|
|
"571510153_02\n",
|
|
"14\n",
|
|
"-571500487_01\n",
|
|
"-571500487_01\n",
|
|
"15\n",
|
|
"-571500487_01\n",
|
|
"-571500487_01\n",
|
|
"16\n",
|
|
"571545870_02\n",
|
|
"571545870_02\n",
|
|
"i1\n",
|
|
"1\n",
|
|
"571542797_02.99\n",
|
|
"571542797_02.99\n",
|
|
"2\n",
|
|
"571543469_02\n",
|
|
"571543469_02\n",
|
|
"3\n",
|
|
"-571542810_01\n",
|
|
"-571542810_01\n",
|
|
"4\n",
|
|
"571542797_02.99\n",
|
|
"571542797_02.99\n",
|
|
"5\n",
|
|
"571543469_02\n",
|
|
"571543469_02\n",
|
|
"6\n",
|
|
"571542797_02.99\n",
|
|
"571542797_02.99\n",
|
|
"7\n",
|
|
"571542797_02.99\n",
|
|
"571542797_02.99\n",
|
|
"8\n",
|
|
"-571542810_01\n",
|
|
"-571542810_01\n",
|
|
"9\n",
|
|
"571542797_02.99\n",
|
|
"571542797_02.99\n",
|
|
"10\n",
|
|
"-571542810_01\n",
|
|
"-571542810_01\n",
|
|
"11\n",
|
|
"-571542810_01\n",
|
|
"-571542810_01\n",
|
|
"12\n",
|
|
"571543469_02\n",
|
|
"571543469_02\n",
|
|
"13\n",
|
|
"-571542810_01\n",
|
|
"-571542810_01\n",
|
|
"14\n",
|
|
"571542797_02.99\n",
|
|
"571542797_02.99\n",
|
|
"15\n",
|
|
"571543469_02\n",
|
|
"571543469_02\n",
|
|
"16\n",
|
|
"-571542810_01\n",
|
|
"-571542810_01\n",
|
|
"i2\n",
|
|
"1\n",
|
|
"571542107_02\n",
|
|
"571542107_02\n",
|
|
"2\n",
|
|
"-571542809_01\n",
|
|
"-571542809_01\n",
|
|
"3\n",
|
|
"-571542809_01\n",
|
|
"-571542809_01\n",
|
|
"4\n",
|
|
"571542811_02\n",
|
|
"571542811_02\n",
|
|
"5\n",
|
|
"-571542809_01\n",
|
|
"-571542809_01\n",
|
|
"6\n",
|
|
"571542107_02\n",
|
|
"571542107_02\n",
|
|
"7\n",
|
|
"571542811_02\n",
|
|
"571542811_02\n",
|
|
"8\n",
|
|
"-571542809_01\n",
|
|
"-571542809_01\n",
|
|
"9\n",
|
|
"571542107_02\n",
|
|
"571542107_02\n",
|
|
"10\n",
|
|
"-571542809_01\n",
|
|
"-571542809_01\n",
|
|
"11\n",
|
|
"-571542809_01\n",
|
|
"-571542809_01\n",
|
|
"12\n",
|
|
"571542811_02\n",
|
|
"571542811_02\n",
|
|
"13\n",
|
|
"-571542809_01\n",
|
|
"-571542809_01\n",
|
|
"14\n",
|
|
"571542107_02\n",
|
|
"571542107_02\n",
|
|
"15\n",
|
|
"571542811_02\n",
|
|
"571542811_02\n",
|
|
"16\n",
|
|
"-571542809_01\n",
|
|
"-571542809_01\n",
|
|
"i3\n",
|
|
"1\n",
|
|
"-571500475_01\n",
|
|
"-571500475_01\n",
|
|
"2\n",
|
|
"571540303_02.21\n",
|
|
"571540303_02.21\n",
|
|
"3\n",
|
|
"571540304_02\n",
|
|
"571540304_02\n",
|
|
"4\n",
|
|
"571556450_02\n",
|
|
"571556450_02\n",
|
|
"5\n",
|
|
"571540303_02.21\n",
|
|
"571540303_02.21\n",
|
|
"6\n",
|
|
"-571500475_01\n",
|
|
"-571500475_01\n",
|
|
"7\n",
|
|
"571556450_02\n",
|
|
"571556450_02\n",
|
|
"8\n",
|
|
"571540304_02\n",
|
|
"571540304_02\n",
|
|
"9\n",
|
|
"571556450_02\n",
|
|
"571556450_02\n",
|
|
"10\n",
|
|
"571540304_02\n",
|
|
"571540304_02\n",
|
|
"11\n",
|
|
"-571500475_01\n",
|
|
"-571500475_01\n",
|
|
"12\n",
|
|
"571540303_02.21\n",
|
|
"571540303_02.21\n",
|
|
"13\n",
|
|
"571540304_02\n",
|
|
"571540304_02\n",
|
|
"14\n",
|
|
"571556450_02\n",
|
|
"571556450_02\n",
|
|
"15\n",
|
|
"571540303_02.21\n",
|
|
"571540303_02.21\n",
|
|
"16\n",
|
|
"-571500475_01\n",
|
|
"-571500475_01\n",
|
|
"i6\n",
|
|
"1\n",
|
|
"-571542115_01\n",
|
|
"-571542115_01\n",
|
|
"2\n",
|
|
"571500535_02.18\n",
|
|
"571500535_02.18\n",
|
|
"3\n",
|
|
"571500585_02\n",
|
|
"571500585_02\n",
|
|
"4\n",
|
|
"571511538_02.121\n",
|
|
"571511538_02.121\n",
|
|
"5\n",
|
|
"571500535_02.18\n",
|
|
"571500535_02.18\n",
|
|
"6\n",
|
|
"-571542115_01\n",
|
|
"-571542115_01\n",
|
|
"7\n",
|
|
"571511538_02.121\n",
|
|
"571511538_02.121\n",
|
|
"8\n",
|
|
"571500585_02\n",
|
|
"571500585_02\n",
|
|
"9\n",
|
|
"571511538_02.121\n",
|
|
"571511538_02.121\n",
|
|
"10\n",
|
|
"571500585_02\n",
|
|
"571500585_02\n",
|
|
"11\n",
|
|
"-571542115_01\n",
|
|
"-571542115_01\n",
|
|
"12\n",
|
|
"571500535_02.18\n",
|
|
"571500535_02.18\n",
|
|
"13\n",
|
|
"571500585_02\n",
|
|
"571500585_02\n",
|
|
"14\n",
|
|
"571511538_02.121\n",
|
|
"571511538_02.121\n",
|
|
"15\n",
|
|
"571500535_02.18\n",
|
|
"571500535_02.18\n",
|
|
"16\n",
|
|
"-571542115_01\n",
|
|
"-571542115_01\n",
|
|
"i7\n",
|
|
"1\n",
|
|
"571542071_02\n",
|
|
"571542071_02\n",
|
|
"2\n",
|
|
"-571511538_02\n",
|
|
"-571511538_02\n",
|
|
"3\n",
|
|
"-571511538_02\n",
|
|
"-571511538_02\n",
|
|
"4\n",
|
|
"571542073_01\n",
|
|
"571542073_01\n",
|
|
"5\n",
|
|
"-571511538_02\n",
|
|
"-571511538_02\n",
|
|
"6\n",
|
|
"571542071_02\n",
|
|
"571542071_02\n",
|
|
"7\n",
|
|
"571542073_01\n",
|
|
"571542073_01\n",
|
|
"8\n",
|
|
"-571511538_02\n",
|
|
"-571511538_02\n",
|
|
"9\n",
|
|
"571542073_01\n",
|
|
"571542073_01\n",
|
|
"10\n",
|
|
"-571511538_02\n",
|
|
"-571511538_02\n",
|
|
"11\n",
|
|
"571542071_02\n",
|
|
"571542071_02\n",
|
|
"12\n",
|
|
"571542073_01\n",
|
|
"571542073_01\n",
|
|
"13\n",
|
|
"-571511538_02\n",
|
|
"-571511538_02\n",
|
|
"14\n",
|
|
"571542073_01\n",
|
|
"571542073_01\n",
|
|
"15\n",
|
|
"571542073_01\n",
|
|
"571542073_01\n",
|
|
"16\n",
|
|
"571542071_02\n",
|
|
"571542071_02\n",
|
|
"i8\n",
|
|
"1\n",
|
|
"571500617_02\n",
|
|
"571500617_02\n",
|
|
"2\n",
|
|
"571500618_02\n",
|
|
"571500618_02\n",
|
|
"3\n",
|
|
"-571500569_01\n",
|
|
"-571500569_01\n",
|
|
"4\n",
|
|
"571500583_01\n",
|
|
"571500583_01\n",
|
|
"5\n",
|
|
"571500618_02\n",
|
|
"571500618_02\n",
|
|
"6\n",
|
|
"571500617_02\n",
|
|
"571500617_02\n",
|
|
"7\n",
|
|
"571500583_01\n",
|
|
"571500583_01\n",
|
|
"8\n",
|
|
"-571500569_01\n",
|
|
"-571500569_01\n",
|
|
"9\n",
|
|
"571500583_01\n",
|
|
"571500583_01\n",
|
|
"10\n",
|
|
"-571500569_01\n",
|
|
"-571500569_01\n",
|
|
"11\n",
|
|
"571500617_02\n",
|
|
"571500617_02\n",
|
|
"12\n",
|
|
"571500618_02\n",
|
|
"571500618_02\n",
|
|
"13\n",
|
|
"-571500569_01\n",
|
|
"-571500569_01\n",
|
|
"14\n",
|
|
"571500583_01\n",
|
|
"571500583_01\n",
|
|
"15\n",
|
|
"571500618_02\n",
|
|
"571500618_02\n",
|
|
"16\n",
|
|
"571500617_02\n",
|
|
"571500617_02\n",
|
|
"i9\n",
|
|
"1\n",
|
|
"571510152_02\n",
|
|
"571510152_02\n",
|
|
"2\n",
|
|
"571510152_01\n",
|
|
"571510152_01\n",
|
|
"3\n",
|
|
"571510152_02\n",
|
|
"571510152_02\n",
|
|
"4\n",
|
|
"571510152_01\n",
|
|
"571510152_01\n",
|
|
"5\n",
|
|
"571510152_01\n",
|
|
"571510152_01\n",
|
|
"6\n",
|
|
"571510152_02\n",
|
|
"571510152_02\n",
|
|
"7\n",
|
|
"571510152_01\n",
|
|
"571510152_01\n",
|
|
"8\n",
|
|
"571510152_02\n",
|
|
"571510152_02\n",
|
|
"9\n",
|
|
"571510152_02\n",
|
|
"571510152_02\n",
|
|
"10\n",
|
|
"571510152_01\n",
|
|
"571510152_01\n",
|
|
"11\n",
|
|
"571510152_02\n",
|
|
"571510152_02\n",
|
|
"12\n",
|
|
"571510152_01\n",
|
|
"571510152_01\n",
|
|
"13\n",
|
|
"571510152_01\n",
|
|
"571510152_01\n",
|
|
"14\n",
|
|
"571510152_02\n",
|
|
"571510152_02\n",
|
|
"15\n",
|
|
"571510152_01\n",
|
|
"571510152_01\n",
|
|
"16\n",
|
|
"571510152_02\n",
|
|
"571510152_02\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"for parent_id in self.parent_ids:\n",
|
|
" print(parent_id)\n",
|
|
" for move_no in range(1,17):\n",
|
|
" print(move_no)\n",
|
|
" print(p2move2inc_edge_id[parent_id][move_no])\n",
|
|
" print(p2move2inc_edge_id[parent_id][move_no])"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 43,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"move_no 1\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 남\n",
|
|
"Name: 0, dtype: object\n",
|
|
"571545870_02 571542797_02\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"Name: 1, dtype: object\n",
|
|
"571510153_02 571545870_01\n",
|
|
"move_no 3\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 서\n",
|
|
"Name: 2, dtype: object\n",
|
|
"-571542797_02 571510153_01\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"Name: 3, dtype: object\n",
|
|
"-571500487_01 571542797_02\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"Name: 4, dtype: object\n",
|
|
"571510153_02 571500487_01\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"Name: 5, dtype: object\n",
|
|
"571545870_02 571510153_01\n",
|
|
"move_no 7\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 동\n",
|
|
"Name: 6, dtype: object\n",
|
|
"-571500487_01 571545870_01\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"Name: 7, dtype: object\n",
|
|
"-571542797_02 571500487_01\n",
|
|
"move_no 9\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남동\n",
|
|
"Name: 8, dtype: object\n",
|
|
"-571500487_01 571545870_01\n",
|
|
"move_no 10\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 9, dtype: object\n",
|
|
"571510153_02 571500487_01\n",
|
|
"move_no 11\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 10, dtype: object\n",
|
|
"571545870_02 571510153_01\n",
|
|
"move_no 12\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 남동\n",
|
|
"Name: 11, dtype: object\n",
|
|
"-571500487_01 571545870_01\n",
|
|
"move_no 13\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북서\n",
|
|
"Name: 12, dtype: object\n",
|
|
"571510153_02 571500487_01\n",
|
|
"move_no 14\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 13, dtype: object\n",
|
|
"-571500487_01 571510153_01\n",
|
|
"move_no 15\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 14, dtype: object\n",
|
|
"-571500487_01 571500487_01\n",
|
|
"move_no 16\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 북서\n",
|
|
"Name: 15, dtype: object\n",
|
|
"571545870_02 571500487_01\n",
|
|
"move_no 1\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 남\n",
|
|
"Name: 0, dtype: object\n",
|
|
"571542797_02.99 571542810_01\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"Name: 1, dtype: object\n",
|
|
"571543469_02 -571542797_02.99\n",
|
|
"move_no 3\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 서\n",
|
|
"Name: 2, dtype: object\n",
|
|
"-571542810_01 571543469_01\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"Name: 3, dtype: object\n",
|
|
"571542797_02.99 571542810_01\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"Name: 4, dtype: object\n",
|
|
"571543469_02 -571542797_02.99\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"Name: 5, dtype: object\n",
|
|
"571542797_02.99 571543469_01\n",
|
|
"move_no 7\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 동\n",
|
|
"Name: 6, dtype: object\n",
|
|
"571542797_02.99 -571542797_02.99\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"Name: 7, dtype: object\n",
|
|
"-571542810_01 -571542797_02.99\n",
|
|
"move_no 9\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남동\n",
|
|
"Name: 8, dtype: object\n",
|
|
"571542797_02.99 571542810_01\n",
|
|
"move_no 10\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 9, dtype: object\n",
|
|
"-571542810_01 -571542797_02.99\n",
|
|
"move_no 11\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 10, dtype: object\n",
|
|
"-571542810_01 571542810_01\n",
|
|
"move_no 12\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 남동\n",
|
|
"Name: 11, dtype: object\n",
|
|
"571543469_02 571542810_01\n",
|
|
"move_no 13\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북서\n",
|
|
"Name: 12, dtype: object\n",
|
|
"-571542810_01 571543469_01\n",
|
|
"move_no 14\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 13, dtype: object\n",
|
|
"571542797_02.99 571542810_01\n",
|
|
"move_no 15\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 14, dtype: object\n",
|
|
"571543469_02 -571542797_02.99\n",
|
|
"move_no 16\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 북서\n",
|
|
"Name: 15, dtype: object\n",
|
|
"-571542810_01 571543469_01\n",
|
|
"move_no 1\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 남\n",
|
|
"Name: 0, dtype: object\n",
|
|
"571542107_02 571542809_01\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"Name: 1, dtype: object\n",
|
|
"-571542809_01 571542107_01\n",
|
|
"move_no 3\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 서\n",
|
|
"Name: 2, dtype: object\n",
|
|
"-571542809_01 571542809_01\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"Name: 3, dtype: object\n",
|
|
"571542811_02 571542809_01\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"Name: 4, dtype: object\n",
|
|
"-571542809_01 571542811_01\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"Name: 5, dtype: object\n",
|
|
"571542107_02 571542809_01\n",
|
|
"move_no 7\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 동\n",
|
|
"Name: 6, dtype: object\n",
|
|
"571542811_02 571542107_01\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"Name: 7, dtype: object\n",
|
|
"-571542809_01 571542811_01\n",
|
|
"move_no 9\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남동\n",
|
|
"Name: 8, dtype: object\n",
|
|
"571542107_02 571542809_01\n",
|
|
"move_no 10\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 9, dtype: object\n",
|
|
"-571542809_01 571542107_01\n",
|
|
"move_no 11\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 10, dtype: object\n",
|
|
"-571542809_01 571542809_01\n",
|
|
"move_no 12\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 남동\n",
|
|
"Name: 11, dtype: object\n",
|
|
"571542811_02 571542809_01\n",
|
|
"move_no 13\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북서\n",
|
|
"Name: 12, dtype: object\n",
|
|
"-571542809_01 571542811_01\n",
|
|
"move_no 14\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 13, dtype: object\n",
|
|
"571542107_02 571542809_01\n",
|
|
"move_no 15\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 14, dtype: object\n",
|
|
"571542811_02 571542107_01\n",
|
|
"move_no 16\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 북서\n",
|
|
"Name: 15, dtype: object\n",
|
|
"-571542809_01 571542811_01\n",
|
|
"move_no 1\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 남\n",
|
|
"Name: 0, dtype: object\n",
|
|
"-571500475_01 571540304_01\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"Name: 1, dtype: object\n",
|
|
"571540303_02.21 571500475_01\n",
|
|
"move_no 3\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 서\n",
|
|
"Name: 2, dtype: object\n",
|
|
"571540304_02 571540303_01\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"Name: 3, dtype: object\n",
|
|
"571556450_02 571540304_01\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"Name: 4, dtype: object\n",
|
|
"571540303_02.21 571556450_01\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"Name: 5, dtype: object\n",
|
|
"-571500475_01 571540303_01\n",
|
|
"move_no 7\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 동\n",
|
|
"Name: 6, dtype: object\n",
|
|
"571556450_02 571500475_01\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"Name: 7, dtype: object\n",
|
|
"571540304_02 571556450_01\n",
|
|
"move_no 9\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남동\n",
|
|
"Name: 8, dtype: object\n",
|
|
"571556450_02 571500475_01\n",
|
|
"move_no 10\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 9, dtype: object\n",
|
|
"571540304_02 571556450_01\n",
|
|
"move_no 11\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 10, dtype: object\n",
|
|
"-571500475_01 571540304_01\n",
|
|
"move_no 12\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 남동\n",
|
|
"Name: 11, dtype: object\n",
|
|
"571540303_02.21 571500475_01\n",
|
|
"move_no 13\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북서\n",
|
|
"Name: 12, dtype: object\n",
|
|
"571540304_02 571540303_01\n",
|
|
"move_no 14\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 13, dtype: object\n",
|
|
"571556450_02 571540304_01\n",
|
|
"move_no 15\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 14, dtype: object\n",
|
|
"571540303_02.21 571556450_01\n",
|
|
"move_no 16\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 북서\n",
|
|
"Name: 15, dtype: object\n",
|
|
"-571500475_01 571540303_01\n",
|
|
"move_no 1\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 남\n",
|
|
"Name: 0, dtype: object\n",
|
|
"-571542115_01 571500585_01\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"Name: 1, dtype: object\n",
|
|
"571500535_02.18 571542115_01\n",
|
|
"move_no 3\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 서\n",
|
|
"Name: 2, dtype: object\n",
|
|
"571500585_02 571500535_01\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"Name: 3, dtype: object\n",
|
|
"571511538_02.121 571500585_01\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"Name: 4, dtype: object\n",
|
|
"571500535_02.18 571511538_01\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"Name: 5, dtype: object\n",
|
|
"-571542115_01 571500535_01\n",
|
|
"move_no 7\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 동\n",
|
|
"Name: 6, dtype: object\n",
|
|
"571511538_02.121 571542115_01\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"Name: 7, dtype: object\n",
|
|
"571500585_02 571511538_01\n",
|
|
"move_no 9\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남동\n",
|
|
"Name: 8, dtype: object\n",
|
|
"571511538_02.121 571542115_01\n",
|
|
"move_no 10\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 9, dtype: object\n",
|
|
"571500585_02 571511538_01\n",
|
|
"move_no 11\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 10, dtype: object\n",
|
|
"-571542115_01 571500585_01\n",
|
|
"move_no 12\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 남동\n",
|
|
"Name: 11, dtype: object\n",
|
|
"571500535_02.18 571542115_01\n",
|
|
"move_no 13\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북서\n",
|
|
"Name: 12, dtype: object\n",
|
|
"571500585_02 571500535_01\n",
|
|
"move_no 14\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 13, dtype: object\n",
|
|
"571511538_02.121 571500585_01\n",
|
|
"move_no 15\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 14, dtype: object\n",
|
|
"571500535_02.18 571511538_01\n",
|
|
"move_no 16\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 북서\n",
|
|
"Name: 15, dtype: object\n",
|
|
"-571542115_01 571500535_01\n",
|
|
"move_no 1\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 남\n",
|
|
"Name: 0, dtype: object\n",
|
|
"571542071_02 571511538_02\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"Name: 1, dtype: object\n",
|
|
"-571511538_02 571542071_01\n",
|
|
"move_no 3\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 서\n",
|
|
"Name: 2, dtype: object\n",
|
|
"-571511538_02 571511538_02\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"Name: 3, dtype: object\n",
|
|
"571542073_01 571511538_02\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"Name: 4, dtype: object\n",
|
|
"-571511538_02 571542073_02\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"Name: 5, dtype: object\n",
|
|
"571542071_02 571511538_02\n",
|
|
"move_no 7\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 동\n",
|
|
"Name: 6, dtype: object\n",
|
|
"571542073_01 571542071_01\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"Name: 7, dtype: object\n",
|
|
"-571511538_02 571542073_02\n",
|
|
"move_no 9\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남동\n",
|
|
"Name: 8, dtype: object\n",
|
|
"571542073_01 571542071_01\n",
|
|
"move_no 10\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 9, dtype: object\n",
|
|
"-571511538_02 571542073_02\n",
|
|
"move_no 11\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 10, dtype: object\n",
|
|
"571542071_02 571511538_02\n",
|
|
"move_no 12\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 남동\n",
|
|
"Name: 11, dtype: object\n",
|
|
"571542073_01 571542071_01\n",
|
|
"move_no 13\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북서\n",
|
|
"Name: 12, dtype: object\n",
|
|
"-571511538_02 571542073_02\n",
|
|
"move_no 14\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 13, dtype: object\n",
|
|
"571542073_01 571511538_02\n",
|
|
"move_no 15\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 14, dtype: object\n",
|
|
"571542073_01 571542073_02\n",
|
|
"move_no 16\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 북서\n",
|
|
"Name: 15, dtype: object\n",
|
|
"571542071_02 571542073_02\n",
|
|
"move_no 1\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 남\n",
|
|
"Name: 0, dtype: object\n",
|
|
"571500617_02 571500569_01\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"Name: 1, dtype: object\n",
|
|
"571500618_02 571500617_01\n",
|
|
"move_no 3\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 서\n",
|
|
"Name: 2, dtype: object\n",
|
|
"-571500569_01 571500618_01\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"Name: 3, dtype: object\n",
|
|
"571500583_01 571500569_01\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"Name: 4, dtype: object\n",
|
|
"571500618_02 571500583_02\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"Name: 5, dtype: object\n",
|
|
"571500617_02 571500618_01\n",
|
|
"move_no 7\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 동\n",
|
|
"Name: 6, dtype: object\n",
|
|
"571500583_01 571500617_01\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"Name: 7, dtype: object\n",
|
|
"-571500569_01 571500583_02\n",
|
|
"move_no 9\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남동\n",
|
|
"Name: 8, dtype: object\n",
|
|
"571500583_01 571500617_01\n",
|
|
"move_no 10\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 9, dtype: object\n",
|
|
"-571500569_01 571500583_02\n",
|
|
"move_no 11\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 10, dtype: object\n",
|
|
"571500617_02 571500569_01\n",
|
|
"move_no 12\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 남동\n",
|
|
"Name: 11, dtype: object\n",
|
|
"571500618_02 571500617_01\n",
|
|
"move_no 13\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북서\n",
|
|
"Name: 12, dtype: object\n",
|
|
"-571500569_01 571500618_01\n",
|
|
"move_no 14\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 13, dtype: object\n",
|
|
"571500583_01 571500569_01\n",
|
|
"move_no 15\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 14, dtype: object\n",
|
|
"571500618_02 571500583_02\n",
|
|
"move_no 16\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 북서\n",
|
|
"Name: 15, dtype: object\n",
|
|
"571500617_02 571500618_01\n",
|
|
"move_no 1\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 남\n",
|
|
"Name: 0, dtype: object\n",
|
|
"571510152_02 571510152_01.65\n",
|
|
"move_no 2\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 동\n",
|
|
"Name: 1, dtype: object\n",
|
|
"571510152_01 571510152_01.65\n",
|
|
"move_no 3\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 서\n",
|
|
"Name: 2, dtype: object\n",
|
|
"571510152_02 -571510152_01\n",
|
|
"move_no 4\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 남\n",
|
|
"Name: 3, dtype: object\n",
|
|
"571510152_01 571510152_01.65\n",
|
|
"move_no 5\n",
|
|
"inc_dire 서\n",
|
|
"out_dire 북\n",
|
|
"Name: 4, dtype: object\n",
|
|
"571510152_01 -571510152_01\n",
|
|
"move_no 6\n",
|
|
"inc_dire 동\n",
|
|
"out_dire 서\n",
|
|
"Name: 5, dtype: object\n",
|
|
"571510152_02 -571510152_01\n",
|
|
"move_no 7\n",
|
|
"inc_dire 북\n",
|
|
"out_dire 동\n",
|
|
"Name: 6, dtype: object\n",
|
|
"571510152_01 571510152_01.65\n",
|
|
"move_no 8\n",
|
|
"inc_dire 남\n",
|
|
"out_dire 북\n",
|
|
"Name: 7, dtype: object\n",
|
|
"571510152_02 -571510152_01\n",
|
|
"move_no 9\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남동\n",
|
|
"Name: 8, dtype: object\n",
|
|
"571510152_02 571510152_01.65\n",
|
|
"move_no 10\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 9, dtype: object\n",
|
|
"571510152_01 571510152_01.65\n",
|
|
"move_no 11\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 10, dtype: object\n",
|
|
"571510152_02 -571510152_01\n",
|
|
"move_no 12\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 남동\n",
|
|
"Name: 11, dtype: object\n",
|
|
"571510152_01 571510152_01.65\n",
|
|
"move_no 13\n",
|
|
"inc_dire 남서\n",
|
|
"out_dire 북서\n",
|
|
"Name: 12, dtype: object\n",
|
|
"571510152_01 -571510152_01\n",
|
|
"move_no 14\n",
|
|
"inc_dire 북동\n",
|
|
"out_dire 남서\n",
|
|
"Name: 13, dtype: object\n",
|
|
"571510152_02 -571510152_01\n",
|
|
"move_no 15\n",
|
|
"inc_dire 북서\n",
|
|
"out_dire 북동\n",
|
|
"Name: 14, dtype: object\n",
|
|
"571510152_01 571510152_01.65\n",
|
|
"move_no 16\n",
|
|
"inc_dire 남동\n",
|
|
"out_dire 북서\n",
|
|
"Name: 15, dtype: object\n",
|
|
"571510152_02 -571510152_01\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"for parent_id in self.parent_ids:\n",
|
|
" for move_no in range(1,17):\n",
|
|
" row = self.nema[self.nema.move_no==move_no].iloc[0]\n",
|
|
" inc_dire = row.inc_dire\n",
|
|
" out_dire = row.out_dire\n",
|
|
" inc_vec_true = dire2vec[inc_dire]\n",
|
|
" out_vec_true = dire2vec[out_dire]\n",
|
|
"\n",
|
|
" node = self.net.getNode(parent_id)\n",
|
|
" # 교차로의 모든 (from / to) edges\n",
|
|
" inc_edges = [edge for edge in node.getIncoming() if edge.getFunction() == ''] # incoming edges\n",
|
|
" out_edges = [edge for edge in node.getOutgoing() if edge.getFunction() == ''] # outgoing edges\n",
|
|
" # 교차로의 모든 (from / to) unit vector\n",
|
|
" inc_vecs = []\n",
|
|
" for inc_edge in inc_edges:\n",
|
|
" start = inc_edge.getShape()[-1]\n",
|
|
" end = inc_edge.getShape()[-2]\n",
|
|
" inc_vec = np.array(end) - np.array(start)\n",
|
|
" inc_vec = inc_vec / (inc_vec ** 2).sum() ** 0.5\n",
|
|
" inc_vecs.append(inc_vec)\n",
|
|
" out_vecs = []\n",
|
|
" for out_edge in out_edges:\n",
|
|
" start = out_edge.getShape()[0]\n",
|
|
" end = out_edge.getShape()[1]\n",
|
|
" out_vec = np.array(end) - np.array(start)\n",
|
|
" out_vec = out_vec / (out_vec ** 2).sum() ** 0.5\n",
|
|
" out_vecs.append(out_vec)\n",
|
|
" # 매칭 엣지 반환\n",
|
|
" inc_index = np.array([np.dot(inc_vec, inc_vec_true) for inc_vec in inc_vecs]).argmax()\n",
|
|
" out_index = np.array([np.dot(out_vec, out_vec_true) for out_vec in out_vecs]).argmax()\n",
|
|
" inc_edge_id = inc_edges[inc_index].getID()\n",
|
|
" out_edge_id = out_edges[out_index].getID()\n",
|
|
" print(row)\n",
|
|
" print(inc_edge_id, out_edge_id)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# (8) 가능한 모든 이동류에 대하여 진입id, 진출id 배정 : matching\n",
|
|
"self.matching = []\n",
|
|
"for parent_id in self.parent_ids:\n",
|
|
" inter_no = self.node2inter[parent_id]\n",
|
|
" # 좌회전과 직진(1 ~ 16)\n",
|
|
" for move_no in range(1,17):\n",
|
|
" inc_dire = m2inc_dire[move_no]\n",
|
|
" out_dire = m2out_dire[move_no]\n",
|
|
" if move_no in p2move[parent_id]:\n",
|
|
" inc_edge_id = inc2id[(parent_id, inc_dire)]\n",
|
|
" out_edge_id = out2id[(parent_id, out_dire)]\n",
|
|
" else:\n",
|
|
" inc_edge_id = p2move2inc_edge_id[parent_id][move_no]\n",
|
|
" out_edge_id = p2move2out_edge_id[parent_id][move_no]\n",
|
|
" if (inc_edge_id, out_edge_id) in self.n2io2turn[parent_id]:\n",
|
|
" turn_type = self.n2io2turn[parent_id][inc_edge_id, out_edge_id]\n",
|
|
" else:\n",
|
|
" turn_type = 'left' if move_no % 2 else 'straight'\n",
|
|
" new_row = pd.DataFrame({'inter_no':[inter_no], 'node_id':[parent_id], 'move_no':[move_no],\n",
|
|
" 'inc_dire':[inc_dire], 'out_dire':[out_dire],\n",
|
|
" 'inc_edge_id':[inc_edge_id], 'out_edge_id':[out_edge_id],\n",
|
|
" 'turn_type': turn_type})\n",
|
|
" self.matching.append(new_row)\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 24,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>node_id</th>\n",
|
|
" <th>move_no</th>\n",
|
|
" <th>inc_edge_id</th>\n",
|
|
" <th>out_edge_id</th>\n",
|
|
" <th>state</th>\n",
|
|
" <th>turn_type</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>571545870_02</td>\n",
|
|
" <td>571542797_02</td>\n",
|
|
" <td>grrrgrrGgrrrrrgrr</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>1</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>571510153_02</td>\n",
|
|
" <td>571545870_01</td>\n",
|
|
" <td>grrrgrrrgrrrrrgGr</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>2</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>3</td>\n",
|
|
" <td>-571542797_02</td>\n",
|
|
" <td>571510153_01</td>\n",
|
|
" <td>grrrgrrrgrrrrGgrr</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>3</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>4</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571542797_02</td>\n",
|
|
" <td>gGGrgrrrgrrrrrgrr</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>4</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>5</td>\n",
|
|
" <td>571510153_02</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>grrrgrrrgrrrrrgrG</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>5</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>571545870_02</td>\n",
|
|
" <td>571510153_01</td>\n",
|
|
" <td>grrrgGGrgrrrrrgrr</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>6</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571545870_01</td>\n",
|
|
" <td>grrGgrrrgrrrrrgrr</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>7</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>-571542797_02</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>grrrgrrrgGGGGrgrr</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>8</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>9</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571545870_01</td>\n",
|
|
" <td>grrGgrrrgrrrrrgrr</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>9</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>10</td>\n",
|
|
" <td>571510153_02</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>grrrgrrrgrrrrrgrG</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>10</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>11</td>\n",
|
|
" <td>571545870_02</td>\n",
|
|
" <td>571510153_01</td>\n",
|
|
" <td>grrrgGGrgrrrrrgrr</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>11</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>12</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571545870_01</td>\n",
|
|
" <td>grrGgrrrgrrrrrgrr</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>12</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>13</td>\n",
|
|
" <td>571510153_02</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>grrrgrrrgrrrrrgrG</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>13</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>14</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571510153_01</td>\n",
|
|
" <td>Grrrgrrrgrrrrrgrr</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>14</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>15</td>\n",
|
|
" <td>-571500487_01</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>grrrgrrrgrrrrrgrr</td>\n",
|
|
" <td>left</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>15</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>i0</td>\n",
|
|
" <td>16</td>\n",
|
|
" <td>571545870_02</td>\n",
|
|
" <td>571500487_01</td>\n",
|
|
" <td>grrrGrrrgrrrrrgrr</td>\n",
|
|
" <td>straight</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no node_id move_no inc_edge_id out_edge_id state \\\n",
|
|
"0 175 i0 1 571545870_02 571542797_02 grrrgrrGgrrrrrgrr \n",
|
|
"1 175 i0 2 571510153_02 571545870_01 grrrgrrrgrrrrrgGr \n",
|
|
"2 175 i0 3 -571542797_02 571510153_01 grrrgrrrgrrrrGgrr \n",
|
|
"3 175 i0 4 -571500487_01 571542797_02 gGGrgrrrgrrrrrgrr \n",
|
|
"4 175 i0 5 571510153_02 571500487_01 grrrgrrrgrrrrrgrG \n",
|
|
"5 175 i0 6 571545870_02 571510153_01 grrrgGGrgrrrrrgrr \n",
|
|
"6 175 i0 7 -571500487_01 571545870_01 grrGgrrrgrrrrrgrr \n",
|
|
"7 175 i0 8 -571542797_02 571500487_01 grrrgrrrgGGGGrgrr \n",
|
|
"8 175 i0 9 -571500487_01 571545870_01 grrGgrrrgrrrrrgrr \n",
|
|
"9 175 i0 10 571510153_02 571500487_01 grrrgrrrgrrrrrgrG \n",
|
|
"10 175 i0 11 571545870_02 571510153_01 grrrgGGrgrrrrrgrr \n",
|
|
"11 175 i0 12 -571500487_01 571545870_01 grrGgrrrgrrrrrgrr \n",
|
|
"12 175 i0 13 571510153_02 571500487_01 grrrgrrrgrrrrrgrG \n",
|
|
"13 175 i0 14 -571500487_01 571510153_01 Grrrgrrrgrrrrrgrr \n",
|
|
"14 175 i0 15 -571500487_01 571500487_01 grrrgrrrgrrrrrgrr \n",
|
|
"15 175 i0 16 571545870_02 571500487_01 grrrGrrrgrrrrrgrr \n",
|
|
"\n",
|
|
" turn_type \n",
|
|
"0 left \n",
|
|
"1 straight \n",
|
|
"2 left \n",
|
|
"3 straight \n",
|
|
"4 left \n",
|
|
"5 straight \n",
|
|
"6 left \n",
|
|
"7 straight \n",
|
|
"8 left \n",
|
|
"9 left \n",
|
|
"10 straight \n",
|
|
"11 left \n",
|
|
"12 left \n",
|
|
"13 straight \n",
|
|
"14 left \n",
|
|
"15 straight "
|
|
]
|
|
},
|
|
"execution_count": 24,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"self.matching[self.matching.inter_no==175]"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"self = SignalGenerator()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 9,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"1. 데이터를 준비합니다.\n",
|
|
"1-1. 네트워크가 로드되었습니다.\n",
|
|
"1-2. 테이블들이 로드되었습니다.\n",
|
|
"1-5. 필요한 보조 객체들이 모두 준비되었습니다.\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"self.prepare_data()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 10,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"2. 신호이력 테이블을 변환합니다.\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"self.process_history()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 17,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div>\n",
|
|
"<style scoped>\n",
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
" vertical-align: middle;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe tbody tr th {\n",
|
|
" vertical-align: top;\n",
|
|
" }\n",
|
|
"\n",
|
|
" .dataframe thead th {\n",
|
|
" text-align: right;\n",
|
|
" }\n",
|
|
"</style>\n",
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
" <thead>\n",
|
|
" <tr style=\"text-align: right;\">\n",
|
|
" <th></th>\n",
|
|
" <th>inter_no</th>\n",
|
|
" <th>phas_A</th>\n",
|
|
" <th>phas_B</th>\n",
|
|
" <th>move_A</th>\n",
|
|
" <th>move_B</th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>175</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>2</td>\n",
|
|
" <td>7</td>\n",
|
|
" <td>3</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>176</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>4</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>177</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>4</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>178</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>4</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>201</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>3</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>202</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>2</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>206</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>8</td>\n",
|
|
" <td>4</td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th>0</th>\n",
|
|
" <td>210</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>1</td>\n",
|
|
" <td>6</td>\n",
|
|
" <td>18</td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
"</table>\n",
|
|
"</div>"
|
|
],
|
|
"text/plain": [
|
|
" inter_no phas_A phas_B move_A move_B\n",
|
|
"0 175 2 2 7 3\n",
|
|
"0 176 1 1 8 4\n",
|
|
"0 177 1 1 8 4\n",
|
|
"0 178 1 1 8 4\n",
|
|
"0 201 1 1 8 3\n",
|
|
"0 202 1 1 6 2\n",
|
|
"0 206 1 1 8 4\n",
|
|
"0 210 1 1 6 18"
|
|
]
|
|
},
|
|
"execution_count": 17,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"fsec = self.present_time - 300\n",
|
|
"move = pd.read_csv(os.path.join(self.path_tables, 'move', f'move_{fsec}.csv'), index_col=0)\n",
|
|
"move"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "siggen",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.8.10"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|