1
0
Fork 0
mirror of https://github.com/Findus23/collision-analyisis-and-interpolation.git synced 2024-09-19 15:13:50 +02:00
collision-analyisis-and-int.../readfiles.py

38 lines
1.2 KiB
Python
Raw Normal View History

2019-02-12 18:56:05 +01:00
from glob import glob
from os import path
from simulation import Simulation
from simulation_list import SimulationList
2019-07-06 13:24:48 +02:00
simulation_sets = {
"original": sorted(glob("../data/*")),
2019-07-29 14:01:13 +02:00
"cloud": sorted(glob("../../Bachelorarbeit_data/results/*"))
2019-07-06 13:24:48 +02:00
}
2019-02-12 18:56:05 +01:00
simulations = SimulationList()
2019-07-06 13:24:48 +02:00
for set_type, directories in simulation_sets.items():
for dir in directories:
original = set_type == "original"
spheres_file = dir + "/spheres_ini_log"
aggregates_file = dir + ("/sim/aggregates.txt" if original else "/aggregates.txt")
if not path.exists(spheres_file) or not path.exists(aggregates_file):
print(f"skipping {dir}")
continue
if "id" not in dir and original:
continue
sim = Simulation()
if set_type == "original":
sim.load_params_from_dirname(path.basename(dir))
else:
sim.load_params_from_json(dir + "/parameters.json")
sim.type = set_type
sim.load_params_from_spheres_ini_log(spheres_file)
sim.load_params_from_aggregates_txt(aggregates_file)
sim.assert_all_loaded()
simulations.append(sim)
2019-07-06 15:50:16 +02:00
# print(vars(sim))
2019-02-12 18:56:05 +01:00
2019-07-06 13:24:48 +02:00
print(len(simulations.simlist))
2019-02-12 18:56:05 +01:00
simulations.jsonlines_save()