diff --git a/Analysis/0411_unp-left_p-right-uturn/0411_unp-left.ipynb b/Analysis/0411_unp-left_p-right-uturn/0411_unp-left.ipynb index f1d14e145..4915085e2 100644 --- a/Analysis/0411_unp-left_p-right-uturn/0411_unp-left.ipynb +++ b/Analysis/0411_unp-left_p-right-uturn/0411_unp-left.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -19,6 +19,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ + "비보호좌회전, 신호우회전, 유턴\n", + "\n", "줄임말 목록\n", "- `i` : 교차로번호, `inter_no`\n", "- `f` : 진입, from, `inc_edge_id`\n", @@ -41,7 +43,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -53,20 +55,7 @@ "1-2. 테이블들이 로드되었습니다.\n", "1-3. 네트워크의 모든 clean state requirement들을 체크했습니다.\n", "1-4. 테이블들의 무결성 검사를 완료했습니다.\n", - "2. 중간산출물을 생성합니다.\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "이동류정보 불러오는 중: 100%|██████████| 17280/17280 [00:14<00:00, 1185.13it/s]\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ + "2. 중간산출물을 생성합니다.\n", "2-1. 매칭 테이블들을 생성했습니다.\n", "2-2. 비보호우회전(g)을 배정했습니다.\n", "2-3. 직진 및 좌회전(G)을 배정했습니다.\n", @@ -82,7 +71,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -110,8 +99,8 @@ " phase_no\n", " ring_type\n", " move_no\n", - " inc_dir\n", - " out_dir\n", + " inc_dire\n", + " out_dire\n", " inc_angle\n", " out_angle\n", " \n", @@ -177,12 +166,12 @@ "" ], "text/plain": [ - " inter_no phase_no ring_type move_no inc_dir out_dir inc_angle out_angle\n", - "0 175 1 A 8 남 북 179 179\n", - "1 175 1 B 4 북 남 001 001\n", - "2 175 2 A 7 북 동 001 001\n", - "3 175 2 B 3 남 서 179 179\n", - "4 175 3 A 6 동 서 090 090" + " inter_no phase_no ring_type move_no inc_dire out_dire inc_angle out_angle\n", + "0 175 1 A 8 남 북 179 179\n", + "1 175 1 B 4 북 남 001 001\n", + "2 175 2 A 7 북 동 001 001\n", + "3 175 2 B 3 남 서 179 179\n", + "4 175 3 A 6 동 서 090 090" ] }, "metadata": {}, @@ -213,12 +202,12 @@ " phase_no\n", " ring_type\n", " move_no\n", - " inc_dir\n", - " out_dir\n", + " inc_dire\n", + " out_dire\n", " inc_angle\n", " out_angle\n", - " inc_edge\n", - " out_edge\n", + " inc_edge_id\n", + " out_edge_id\n", " node_id\n", " \n", " \n", @@ -298,19 +287,19 @@ "" ], "text/plain": [ - " inter_no phase_no ring_type move_no inc_dir out_dir inc_angle out_angle \\\n", - "0 175 1 A 8 남 북 179 179 \n", - "1 175 1 B 4 북 남 001 001 \n", - "2 175 2 A 7 북 동 001 001 \n", - "3 175 2 B 3 남 서 179 179 \n", - "4 175 3 A 6 동 서 090 090 \n", + " 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 북 남 001 \n", + "2 175 2 A 7 북 동 001 \n", + "3 175 2 B 3 남 서 179 \n", + "4 175 3 A 6 동 서 090 \n", "\n", - " inc_edge out_edge node_id \n", - "0 -571542797_02 571542797_02 i0 \n", - "1 -571500487_01 571500487_01 i0 \n", - "2 -571500487_01 571500487_01 i0 \n", - "3 -571542797_02 571542797_02 i0 \n", - "4 571545870_02 571545870_01 i0 " + " out_angle inc_edge_id out_edge_id node_id \n", + "0 179 -571542797_02 571542797_02 i0 \n", + "1 001 -571500487_01 571500487_01 i0 \n", + "2 001 -571500487_01 571500487_01 i0 \n", + "3 179 -571542797_02 571542797_02 i0 \n", + "4 090 571545870_02 571545870_01 i0 " ] }, "metadata": {}, @@ -321,6 +310,287 @@ "display(self.match4.head())\n", "display(self.match5.head())" ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1. 데이터를 로드합니다.\n", + "1-1. 네트워크가 로드되었습니다.\n", + "1-2. 테이블들이 로드되었습니다.\n", + "1-3. 네트워크의 모든 clean state requirement들을 체크했습니다.\n", + "1-4. 테이블들의 무결성 검사를 완료했습니다.\n", + "2-1. 매칭 테이블들을 생성했습니다.\n" + ] + } + ], + "source": [ + "self.load_data()\n", + "self.get_matches()" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
inter_nophase_noring_typemove_noinc_direout_direinc_angleout_angleinc_edge_idout_edge_idnode_id
01751A8179179-571542797_02571542797_02i0
11751B4001001-571500487_01571500487_01i0
21752A7001001-571500487_01571500487_01i0
31752B3179179-571542797_02571542797_02i0
41753A6090090571545870_02571545870_01i0
....................................
32102B2270270NaNNaNu60
42103A7000000NaNNaNu60
52103B4000000NaNNaNu60
62104A8180180NaNNaNu60
72104B3180180NaNNaNu60
\n", + "

116 rows × 11 columns

\n", + "
" + ], + "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 북 남 001 \n", + "2 175 2 A 7 북 동 001 \n", + "3 175 2 B 3 남 서 179 \n", + "4 175 3 A 6 동 서 090 \n", + ".. ... ... ... ... ... ... ... \n", + "3 210 2 B 2 서 동 270 \n", + "4 210 3 A 7 북 동 000 \n", + "5 210 3 B 4 북 남 000 \n", + "6 210 4 A 8 남 북 180 \n", + "7 210 4 B 3 남 서 180 \n", + "\n", + " out_angle inc_edge_id out_edge_id node_id \n", + "0 179 -571542797_02 571542797_02 i0 \n", + "1 001 -571500487_01 571500487_01 i0 \n", + "2 001 -571500487_01 571500487_01 i0 \n", + "3 179 -571542797_02 571542797_02 i0 \n", + "4 090 571545870_02 571545870_01 i0 \n", + ".. ... ... ... ... \n", + "3 270 NaN NaN u60 \n", + "4 000 NaN NaN u60 \n", + "5 000 NaN NaN u60 \n", + "6 180 NaN NaN u60 \n", + "7 180 NaN NaN u60 \n", + "\n", + "[116 rows x 11 columns]" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "self.match6" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['i0', 'i1', 'i2', 'i3', 'i6', 'i7', 'i8', 'i9']" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "self.parent_ids" + ] } ], "metadata": { diff --git a/Data/tables/child_uturn.csv b/Data/tables/child_uturn.csv index 5d723eedc..7e7c4db73 100644 --- a/Data/tables/child_uturn.csv +++ b/Data/tables/child_uturn.csv @@ -1,4 +1,4 @@ -parent_id,child_id,direction,condition,inc_edge,out_edge +parent_id,child_id,direction,condition,inc_edge_id,out_edge_id i0,u00,북,좌회전시,571500487_02,571500487_01.32 i2,u20,북,보행신호시,571542810_01.51,571542810_02 i3,u30,북,보행신호시,571556452_01,571556452_02 diff --git a/Intermediates/match6.csv b/Intermediates/match6.csv index 4ca5b75b9..ccff3dd0a 100644 --- a/Intermediates/match6.csv +++ b/Intermediates/match6.csv @@ -39,12 +39,12 @@ 37,177,u20,4,B,1,ggrggg 38,178,c30,1,A,20,rrrrrr 39,178,c30,1,B,20,rrrrrr -40,178,c30,2,A,20,rrrrrr -41,178,c30,2,B,20,rrrrrr -42,178,c30,3,A,20,rrrrrr -43,178,c30,3,B,20,rrrrrr -44,178,c30,4,A,20,rrrrrr -45,178,c30,4,B,20,rrrrrr +40,178,c30,2,A,20,GGGrrr +41,178,c30,2,B,20,rrrGGG +42,178,c30,3,A,20,GGGrrr +43,178,c30,3,B,20,rrrGGG +44,178,c30,4,A,20,GGGrrr +45,178,c30,4,B,20,rrrGGG 46,178,i3,1,A,8,grrrrrrrrrgrrrrrrrrr 47,178,i3,1,B,4,grrrrrrrrrgrrrrrrrrr 48,178,i3,2,A,7,grrrrrrrrrgrrrrrrrrr diff --git a/Results/sn_1704417600.add.xml b/Results/sn_1704417600.add.xml index a61d940ad..828c38ba9 100644 --- a/Results/sn_1704417600.add.xml +++ b/Results/sn_1704417600.add.xml @@ -1,5 +1,5 @@ - + @@ -44,424 +44,456 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - + + - - + + - - + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + - - + + - + - + @@ -506,7 +538,7 @@ - + @@ -551,7 +583,7 @@ - + @@ -596,7 +628,7 @@ - + diff --git a/Results/sn_1704417900.add.xml b/Results/sn_1704417900.add.xml index 344340632..5c09135db 100644 --- a/Results/sn_1704417900.add.xml +++ b/Results/sn_1704417900.add.xml @@ -1,467 +1,499 @@ - + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + @@ -506,7 +538,7 @@ - + @@ -551,7 +583,7 @@ - + @@ -596,62 +628,62 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + \ No newline at end of file diff --git a/Scripts/__pycache__/generate_signals.cpython-38.pyc b/Scripts/__pycache__/generate_signals.cpython-38.pyc index b42479518..85db433c6 100644 Binary files a/Scripts/__pycache__/generate_signals.cpython-38.pyc and b/Scripts/__pycache__/generate_signals.cpython-38.pyc differ diff --git a/Scripts/__pycache__/preprocess_daily.cpython-38.pyc b/Scripts/__pycache__/preprocess_daily.cpython-38.pyc index 52312dbaa..fd1395f84 100644 Binary files a/Scripts/__pycache__/preprocess_daily.cpython-38.pyc and b/Scripts/__pycache__/preprocess_daily.cpython-38.pyc differ diff --git a/Scripts/preprocess_daily.py b/Scripts/preprocess_daily.py index f5ca9d14e..8bc51b811 100644 --- a/Scripts/preprocess_daily.py +++ b/Scripts/preprocess_daily.py @@ -43,7 +43,7 @@ class DailyPreprocessor(): loading_dtype = { 'inter_no':'int', 'start_hour':'int', 'start_minute':'int', 'cycle':'int','offset':'int', 'node_id':'str', 'inter_type':'str', 'parent_id':'str','child_id':'str', - 'direction':'str', 'condition':'str', 'inc_edge':'str', 'out_edge':'str', + 'direction':'str', 'condition':'str', 'inc_edge_id':'str', 'out_edge_id':'str', 'end_unix':'int', 'inter_name':'str', 'inter_lat':'float', 'inter_lon':'float', 'group_no':'int', 'main_phase_no':'int', 'phase_no':'int','ring_type':'str', 'angle_code':'str'} @@ -315,7 +315,7 @@ class DailyPreprocessor(): match4의 각 행에 진입엣지id, 진출엣지id 노드id 추가한 테이블 * 진입, 진출엣지id를 얻은 방법 : cosine similarity - 컬럼명 : inter_no, phase_no, ring_type, move_no, inc_dire, out_dire, inc_angle, out_angle, inc_edge, out_edge, node_id + 컬럼명 : inter_no, phase_no, ring_type, move_no, inc_dire, out_dire, inc_angle, out_angle, inc_edge_id, out_edge_id, node_id ''' # parent node만 가져옴. @@ -365,8 +365,8 @@ class DailyPreprocessor(): 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 - self.match5.at[index, 'out_edge'] = out_edge_id + self.match5.at[index, 'inc_edge_id'] = inc_edge_id + self.match5.at[index, 'out_edge_id'] = out_edge_id self.match5['node_id'] = self.match5['inter_no'].map(self.inter2node) self.match5 = self.match5.sort_values(by=['inter_no','phase_no','ring_type']).reset_index(drop=True) @@ -375,7 +375,7 @@ class DailyPreprocessor(): ''' match5에서 부교차로(유턴교차로, 연동교차로)에 대한 행들을 추가함 - 컬럼명 : inter_no, phase_no, ring_type, move_no, inc_dire, out_dire, inc_angle, out_angle, inc_edge, out_edge, node_id + 컬럼명 : inter_no, phase_no, ring_type, move_no, inc_dire, out_dire, inc_angle, out_angle, inc_edge_id, out_edge_id, node_id ''' self.node2inter = dict(zip(self.inter_node['node_id'], self.inter_node['inter_no'])) @@ -409,14 +409,14 @@ class DailyPreprocessor(): parent_id = row.parent_id dire = row.direction condition = row.condition - inc_edge_id = row.inc_edge - out_edge_id = row.out_edge + inc_edge_id = row.inc_edge_id + out_edge_id = row.out_edge_id # match5에서 부모노드id에 해당하는 행들을 가져옴 (cmatch) cmatch = self.match5.copy()[self.match5.node_id==parent_id] # match dataframe for a child node cmatch = cmatch.sort_values(by=['phase_no', 'ring_type']).reset_index(drop=True) cmatch['node_id'] = child_id - cmatch[['inc_edge', 'out_edge']] = np.nan + cmatch[['inc_edge_id', 'out_edge_id']] = np.nan # 보행신호시/좌회전시 진입/진출방향 ind = self.dires.index(dire) @@ -432,9 +432,9 @@ class DailyPreprocessor(): # 보행신호시/좌회전시 진입/진출 엣지id 배정 ind = self.dires.index(dire) if condition == "보행신호시": - cmatch.loc[pedes_exists, ['inc_edge', 'out_edge']] = [inc_edge_id, out_edge_id] + cmatch.loc[pedes_exists, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id] elif condition == "좌회전시": - cmatch.loc[right_exists, ['inc_edge', 'out_edge']] = [inc_edge_id, out_edge_id] + cmatch.loc[right_exists, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id] # 신호없음이동류발생시/보행신호이동류발생시 조건 all_redsigns = cmatch.move_no == 18 @@ -442,20 +442,20 @@ class DailyPreprocessor(): # 만약 어떤 유턴신호도 배정되지 않았다면 # 좌회전시 → 보행신호시 → 보행신호이동류발생시 → 신호없음이동류발생시 순으로 진입/진출 엣지id 배정 - uturn_not_assigned = cmatch[['inc_edge','out_edge']].isna().any(axis=1).all() + uturn_not_assigned = cmatch[['inc_edge_id','out_edge_id']].isna().any(axis=1).all() if uturn_not_assigned: # 좌회전시 if right_exists.any(): - cmatch.loc[right_exists, ['inc_edge', 'out_edge']] = [inc_edge_id, out_edge_id] + cmatch.loc[right_exists, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id] # 보행신호시 elif pedes_exists.any(): - cmatch.loc[pedes_exists, ['inc_edge', 'out_edge']] = [inc_edge_id, out_edge_id] + cmatch.loc[pedes_exists, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id] # 보행신호이동류(17) 발생시 elif crosswalk_on.any(): - cmatch.loc[crosswalk_on & (cmatch.out_dire!=dire), ['inc_edge', 'out_edge']] = [inc_edge_id, out_edge_id] + cmatch.loc[crosswalk_on & (cmatch.out_dire!=dire), ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id] # 신호없음이동류(18) 발생시 elif all_redsigns.any(): - cmatch.loc[all_redsigns & (cmatch.out_dire!=dire), ['inc_edge', 'out_edge']] = [inc_edge_id, out_edge_id] + cmatch.loc[all_redsigns & (cmatch.out_dire!=dire), ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id] cmatches.append(cmatch) # 각 연등교차로(coordination node)에 대하여 (inc_edge_id, out_edge_id) 부여 @@ -477,11 +477,11 @@ class DailyPreprocessor(): 각 교차로에 대하여, 가능한 모든 이동류 (1~18, 21)에 대한 진입·진출엣지ID를 지정한 테이블 * 시차제 - 컬럼명 : inter_no, move_no, inc_dire, out_dire, inc_edge, out_edge, node_id + 컬럼명 : inter_no, move_no, inc_dire, out_dire, inc_edge_id, out_edge_id, node_id ''' self.match7 = self.match6.copy() - self.match7 = self.match7[['inter_no', 'move_no', 'inc_dire', 'out_dire', 'inc_edge', 'out_edge', 'node_id']] + self.match7 = self.match7[['inter_no', 'move_no', 'inc_dire', 'out_dire', 'inc_edge_id', 'out_edge_id', 'node_id']] # parent_ids = sorted(self.inter_node[self.inter_node.inter_type=='parent'].node_id.unique()) # child_ids = sorted(self.inter_node[self.inter_node.inter_type=='child'].node_id.unique()) @@ -499,13 +499,13 @@ class DailyPreprocessor(): for node_id in self.parent_ids: for inc_dire in pdires[node_id]: df = self.match7[(self.match7.node_id==node_id) & (self.match7.inc_dire==inc_dire)] - inc2id[(node_id, inc_dire)] = df.inc_edge.iloc[0] + inc2id[(node_id, inc_dire)] = df.inc_edge_id.iloc[0] # (4) 각 (교차로, 진출방향) 별 진출id 목록 : out2id (outgoing direction to outgoing edge_id) out2id = {} for node_id in self.parent_ids: for out_dire in pdires[node_id]: df = self.match7[(self.match7.node_id==node_id) & (self.match7.out_dire==out_dire)] - out2id[(node_id, out_dire)] = df.out_edge.iloc[0] + out2id[(node_id, out_dire)] = df.out_edge_id.iloc[0] # (5) 각 교차로별 가능한 (진입방향, 진출방향) 목록 : pflow (possible flows) pflow = {} for node_id in self.parent_ids: @@ -519,27 +519,27 @@ class DailyPreprocessor(): # 좌회전과 직진(1 ~ 16) for (inc_dire, out_dire) in pflow[node_id]: move_no = self.nema[(self.nema.inc_dire==inc_dire) & (self.nema.out_dire==out_dire)].move_no.iloc[0] - inc_edge = inc2id[(node_id, inc_dire)] - out_edge = out2id[(node_id, out_dire)] + inc_edge_id = inc2id[(node_id, inc_dire)] + out_edge_id = out2id[(node_id, out_dire)] new_row = pd.DataFrame({'inter_no':[inter_no], 'move_no':[move_no], 'inc_dire':[inc_dire], 'out_dire':[out_dire], - 'inc_edge':[inc_edge], 'out_edge':[out_edge], 'node_id':[node_id]}) + 'inc_edge_id':[inc_edge_id], 'out_edge_id':[out_edge_id], 'node_id':[node_id]}) self.matching.append(new_row) # 보행신호(17), 전적색(18) new_row = pd.DataFrame({'inter_no':[inter_no] * 2, 'move_no':[17, 18], 'inc_dire':[None]*2, 'out_dire':[None]*2, - 'inc_edge':[None]*2, 'out_edge':[None]*2, 'node_id':[node_id]*2}) + 'inc_edge_id':[None]*2, 'out_edge_id':[None]*2, 'node_id':[node_id]*2}) self.matching.append(new_row) # 신호우회전(21) for d in range(len(dires_right)-1): inc_dire = dires_right[d] out_dire = dires_right[d+1] if {inc_dire, out_dire}.issubset(pdires[node_id]): - inc_edge = inc2id[(node_id, inc_dire)] - out_edge = out2id[(node_id, out_dire)] + inc_edge_id = inc2id[(node_id, inc_dire)] + out_edge_id = out2id[(node_id, out_dire)] new_row = pd.DataFrame({'inter_no':[inter_no], 'move_no':[21], 'inc_dire':[inc_dire], 'out_dire':[out_dire], - 'inc_edge':[inc_edge], 'out_edge':[out_edge], 'node_id':[node_id]}) + 'inc_edge_id':[inc_edge_id], 'out_edge_id':[out_edge_id], 'node_id':[node_id]}) self.matching.append(new_row) self.matching.append(self.match7[self.match7.node_id.isin(self.child_ids)]) self.matching = pd.concat(self.matching) @@ -594,11 +594,11 @@ class DailyPreprocessor(): for _, row in self.matching.iterrows(): node_id = row.node_id move_no = row.move_no - inc_edge = row.inc_edge - out_edge = row.out_edge + inc_edge_id = row.inc_edge_id + out_edge_id = row.out_edge_id if move_no != 21: - inc_edge = self.net.getEdge(inc_edge) - out_edge = self.net.getEdge(out_edge) + inc_edge = self.net.getEdge(inc_edge_id) + out_edge = self.net.getEdge(out_edge_id) for conn in inc_edge.getConnections(out_edge): index = conn.getTLLinkIndex() if index >= 0: @@ -619,11 +619,11 @@ class DailyPreprocessor(): # 유턴교차로 for _, row in self.uturn.iterrows(): node_id = row.child_id - inc_edge = row.inc_edge - out_edge = row.out_edge - if not (pd.isna(inc_edge) and pd.isna(out_edge)): - inc_edge = self.net.getEdge(inc_edge) - out_edge = self.net.getEdge(out_edge) + inc_edge_id = row.inc_edge_id + out_edge = row.out_edge_id + if not (pd.isna(inc_edge_id) and pd.isna(out_edge_id)): + inc_edge = self.net.getEdge(inc_edge_id) + out_edge = self.net.getEdge(out_edge_id) for conn in inc_edge.getConnections(out_edge): index = conn.getTLLinkIndex() if index >= 0: @@ -644,13 +644,13 @@ class DailyPreprocessor(): for row in self.matching.itertuples(index=True): node_id = row.node_id move_no = row.move_no - inc_edge = row.inc_edge - out_edge = row.out_edge + inc_edge_id = row.inc_edge_id + out_edge_id = row.out_edge_id state = copy.deepcopy(self.node2init)[node_id] if move_no != 21: - inc_edge = self.net.getEdge(inc_edge) - out_edge = self.net.getEdge(out_edge) + inc_edge = self.net.getEdge(inc_edge_id) + out_edge = self.net.getEdge(out_edge_id) for conn in inc_edge.getConnections(out_edge): index = conn.getTLLinkIndex() if index >= 0: @@ -671,15 +671,15 @@ class DailyPreprocessor(): for i, row in self.match6.iterrows(): node_id = row.node_id move_no = row.move_no - inc_edge = row.inc_edge - out_edge = row.out_edge + inc_edge_id = row.inc_edge_id + out_edge_id = row.out_edge_id state = copy.deepcopy(self.node2init)[node_id] - if (pd.isna(inc_edge)) or (pd.isna(out_edge)): + if (pd.isna(inc_edge_id)) or (pd.isna(out_edge_id)): continue if (move_no != 21): # print(i, node_id, move_no, ''.join(state)) - inc_edge = self.net.getEdge(inc_edge) - out_edge = self.net.getEdge(out_edge) + inc_edge = self.net.getEdge(inc_edge_id) + out_edge = self.net.getEdge(out_edge_id) for conn in inc_edge.getConnections(out_edge): index = conn.getTLLinkIndex() if index >= 0: