2019-02-12 18:56:05 +01:00
|
|
|
from os import path
|
2021-03-08 13:25:11 +01:00
|
|
|
from pathlib import Path
|
2019-02-12 18:56:05 +01:00
|
|
|
|
|
|
|
from simulation import Simulation
|
|
|
|
from simulation_list import SimulationList
|
|
|
|
|
2019-07-06 13:24:48 +02:00
|
|
|
simulation_sets = {
|
2021-10-12 15:45:43 +02:00
|
|
|
"winter": sorted(Path("../../tmp/winter/").glob("*"))
|
|
|
|
# "original": sorted(glob("../data/*")),
|
|
|
|
# "cloud": sorted(glob("../../Bachelorarbeit_data/results/*"))
|
2020-11-30 12:58:50 +01:00
|
|
|
# "benchmark": sorted(glob("../../Bachelorarbeit_benchmark/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:
|
2021-10-12 15:45:43 +02:00
|
|
|
print(dir)
|
|
|
|
spheres_file = dir / "spheres_ini.log"
|
|
|
|
aggregates_file = sorted(dir.glob("frames/aggregates.*"))[-1]
|
2019-07-06 13:24:48 +02:00
|
|
|
if not path.exists(spheres_file) or not path.exists(aggregates_file):
|
|
|
|
print(f"skipping {dir}")
|
|
|
|
continue
|
|
|
|
sim = Simulation()
|
2021-10-12 15:45:43 +02:00
|
|
|
sim.load_params_from_setup_txt(dir / "cfg.txt")
|
2019-07-06 13:24:48 +02:00
|
|
|
sim.type = set_type
|
|
|
|
sim.load_params_from_spheres_ini_log(spheres_file)
|
|
|
|
sim.load_params_from_aggregates_txt(aggregates_file)
|
2021-10-12 15:45:43 +02:00
|
|
|
# sim.assert_all_loaded()
|
2019-08-05 13:15:28 +02:00
|
|
|
if sim.rel_velocity < 0 or sim.distance < 0:
|
2019-08-06 15:14:00 +02:00
|
|
|
# Sometimes in the old dataset the second object wasn't detected.
|
|
|
|
# To be save, we'll exclude them
|
|
|
|
print(vars(sim))
|
|
|
|
continue
|
|
|
|
if sim.largest_aggregate_water_fraction < 0:
|
|
|
|
# a handful of simulations had a typo in the aggregates simulations.
|
|
|
|
# to fix those rerun aggregates on all of them
|
2019-07-29 15:37:11 +02:00
|
|
|
print(vars(sim))
|
|
|
|
raise ValueError("invalid aggregate data. Please rerun postprocessing")
|
2019-08-20 16:17:05 +02:00
|
|
|
if sim.water_retention_both < 0 or sim.water_retention_both > 1:
|
|
|
|
print(vars(sim))
|
|
|
|
print(sim.water_retention_both)
|
|
|
|
raise ValueError("water retention is invalid")
|
2019-07-06 13:24:48 +02:00
|
|
|
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
|
|
|
|
2021-10-12 15:45:43 +02:00
|
|
|
simulations.jsonlines_save(Path("winter.jsonl"))
|