1
0
mirror of https://github.com/Ahp06/SUMO_Emissions.git synced 2024-11-21 11:16:28 +00:00

Changed files structure

This commit is contained in:
Ahp06 2019-02-06 16:29:43 +01:00
parent 8a4e6dca4f
commit f741e76454
3 changed files with 10 additions and 7 deletions

View File

@ -85,7 +85,8 @@ class Config:
:param simulation_dir: The path to the simulation directory
:return:
"""
simdir = f'files/simulations/{simulation_dir}/'
simdir = os.path.join(os.path.dirname(__file__),f'{simulation_dir}')
for f in os.listdir(simdir):
if f.endswith('.sumocfg'):
self._SUMOCFG = os.path.join(simdir, f)

View File

@ -112,7 +112,7 @@ class Data:
:param dump_name: The name of your data dump
:return:
"""
dump_dir = 'files/dump'
dump_dir = f'{self.dir}/dump'
if not os.path.exists(dump_dir):
os.mkdir(dump_dir)

View File

@ -61,12 +61,14 @@ class RunProcess(multiprocessing.Process):
"""
now = datetime.datetime.now()
current_date = now.strftime("%Y_%m_%d_%H_%M_%S")
if not os.path.exists('files/logs'):
os.makedirs('logs')
logdir = os.path.join(os.path.dirname(__file__), f'{self.data.dir}')
if not os.path.exists(logdir):
os.makedirs(f'logs')
conf_name = self.config.config_filename.replace('.json', '')
log_filename = f'files/logs/{self.data.dump_name}_{conf_name}_{current_date}.log'
log_filename = f'{self.data.dir}/logs/{current_date}.log'
self.logger = logging.getLogger(f'{self.data.dir}_{conf_name}')
self.logger.setLevel(logging.INFO)
@ -188,7 +190,7 @@ def create_dump(dump_name, simulation_dir, areas_number):
traci.start(sumo_cmd)
if not os.path.isfile(f'files/dump/{dump_name}.json'):
if not os.path.isfile(f'{simulation_dir}/dump/{dump_name}.json'):
start = time.perf_counter()
data = Data(dump_name, traci.simulation.getNetBoundary(), areas_number, simulation_dir)
data.init_grid()