{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import os, sys, copy, argparse, json, pickle\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": 2, "metadata": {}, "outputs": [], "source": [ "self = DailyPreprocessor(config_name='test_0729',\n", " file_net = 'new_sungnam_network_internal_target_0721.net.xml')" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1-1. 네트워크가 로드되었습니다.\n" ] } ], "source": [ "# 1-1. 네트워크 불러오기\n", "self.load_networks()" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1-2. 테이블들이 로드되었습니다.\n" ] } ], "source": [ "# 1-2. 테이블 불러오기\n", "self.load_tables()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# self.angle" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# angle_A = self.angle[self.angle.ring_type=='A']\n", "# angle_B = self.angle[self.angle.ring_type=='B']\n", "# isa2move_A = dict(zip(zip(angle_A.inter_no, angle_A.STOS_NO, angle_A.phase_no), angle_A.move_no))\n", "# isa2move_B = dict(zip(zip(angle_B.inter_no, angle_B.STOS_NO, angle_B.phase_no), angle_B.move_no))\n", "# isa2move = {'A':isa2move_A, 'B':isa2move_B}\n", "# isa2move" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1-5. 테이블을 표준화했습니다.\n" ] } ], "source": [ "# 1-5. 테이블 표준화\n", "self.standardize()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1-6. 주요 객체 (리스트, 딕셔너리)들을 저장했습니다.\n" ] } ], "source": [ "# 1-6. 주요 객체 (리스트, 딕셔너리) 저장\n", "self.store_objects()" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2-1. 매칭 테이블들을 생성했습니다.\n", "2-2. 초기화 신호가 지정되었습니다. (우회전 : g)\n", "2-3. 유턴 인덱스 / 비보호좌회전 인덱스를 지정했습니다.\n", "2-4. 직진 및 좌회전(G)을 배정했습니다.\n", "2-5. node2num_cycles.json를 저장했습니다.\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "c:\\github\\siggen\\scripts\\preprocess_daily.py:741: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '519797' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.\n", " cmatch.loc[right_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n", "c:\\github\\siggen\\scripts\\preprocess_daily.py:741: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '519796' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.\n", " cmatch.loc[right_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n", "c:\\github\\siggen\\scripts\\preprocess_daily.py:741: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '519799' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.\n", " cmatch.loc[right_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n", "c:\\github\\siggen\\scripts\\preprocess_daily.py:741: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '519798' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.\n", " cmatch.loc[right_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n", "c:\\github\\siggen\\scripts\\preprocess_daily.py:741: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '519801' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.\n", " cmatch.loc[right_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n", "c:\\github\\siggen\\scripts\\preprocess_daily.py:741: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '519800' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.\n", " cmatch.loc[right_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n", "c:\\github\\siggen\\scripts\\preprocess_daily.py:741: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '519873' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.\n", " cmatch.loc[right_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n", "c:\\github\\siggen\\scripts\\preprocess_daily.py:741: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '519874' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.\n", " cmatch.loc[right_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n", "c:\\github\\siggen\\scripts\\preprocess_daily.py:741: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '516929' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.\n", " cmatch.loc[right_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n", "c:\\github\\siggen\\scripts\\preprocess_daily.py:741: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '517055' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.\n", " cmatch.loc[right_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n", "c:\\github\\siggen\\scripts\\preprocess_daily.py:741: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '519834' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.\n", " cmatch.loc[right_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n", "c:\\github\\siggen\\scripts\\preprocess_daily.py:741: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '519833' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.\n", " cmatch.loc[right_flag, ['inc_edge_id', 'out_edge_id']] = [inc_edge_id, out_edge_id]\n" ] } ], "source": [ "# 2. 중간산출물 만들기\n", "# 2-1 매칭테이블 생성\n", "self.get_matches()\n", "# 2-2 신호 초기화\n", "self.initialize_state()\n", "# 2-3 유턴 인덱스 / 비보호좌회전 인덱스 지정\n", "self.assign_indices()\n", "# 2-4 신호배정\n", "self.assign_signals()\n", "# 2-5 기반파일 저장\n", "self.save_intermediates()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "3. 이슈사항을 저장합니다.\n" ] } ], "source": [ "self.write_issues()" ] } ], "metadata": { "kernelspec": { "display_name": "siggen_env", "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.12.4" } }, "nbformat": 4, "nbformat_minor": 2 }