Browse Source

all-red signal character : s -> g

master
김선중 1 year ago
parent
commit
1b6d50fd1f
5 changed files with 69 additions and 9 deletions
  1. BIN
      Scripts/__pycache__/generate_signals.cpython-312.pyc
  2. BIN
      Scripts/__pycache__/preprocess_daily.cpython-312.pyc
  3. +3
    -9
      Scripts/preprocess_daily.py
  4. +65
    -0
      analysis/0805_add_SIGL_FLOW/add_SIGL_FLOW.ipynb
  5. +1
    -0
      analysis/0805_add_SIGL_FLOW/kepler.gl.json

BIN
Scripts/__pycache__/generate_signals.cpython-312.pyc View File


BIN
Scripts/__pycache__/preprocess_daily.cpython-312.pyc View File


+ 3
- 9
Scripts/preprocess_daily.py View File

@ -1123,14 +1123,8 @@ class DailyPreprocessor():
print('2-4. 직진 및 좌회전(G)을 배정했습니다.')
# 2-5 모든 현시에서 적색신호인 경우는 상시 s로 정의
# 2-5 모든 현시에서 적색신호인 경우는 상시 g로 정의
def avoid_all_reds(self):
'''
s에
'green right-turn arrow' requires stopping - vehicles may pass the junction if no vehicle uses a higher priorised foe stream. They always stop before passing. This is only generated for junction type traffic_light_right_on_red.
https://sumo.dlr.de/docs/Simulation/Traffic_Lights.html
'''
# match6에 적용
for node_id, group in self.match6.groupby('node_id'):
state_length = len(group.iloc[0].state)
@ -1147,7 +1141,7 @@ class DailyPreprocessor():
for i, row in group.iterrows():
state = list(row.state)
for index in all_red_indices:
state[index] = 's'
state[index] = 'g'
state = ''.join(state)
self.match6.at[i, 'state'] = state
@ -1167,7 +1161,7 @@ class DailyPreprocessor():
for i, row in group.iterrows():
state = list(row.state)
for index in all_red_indices:
state[index] = 's'
state[index] = 'g'
state = ''.join(state)
self.matching.at[i, 'state'] = state
print("2-5. 모든 현시에서 적색신호인 경우에 대한 처리 완료")

+ 65
- 0
analysis/0805_add_SIGL_FLOW/add_SIGL_FLOW.ipynb View File

@ -0,0 +1,65 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import os, sys, json, argparse, pickle\n",
"import sumolib, traci\n",
"from tqdm import tqdm\n",
"from datetime import datetime, timedelta\n",
"\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 generate_signals import SignalGenerator"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[436, 437, 438, 442, 443, 455, 456, 457, 458]"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"self = SignalGenerator()\n",
"self.inter_nos"
]
}
],
"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
}

+ 1
- 0
analysis/0805_add_SIGL_FLOW/kepler.gl.json
File diff suppressed because it is too large
View File


Loading…
Cancel
Save