forked from mvanlobensels/random-track-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_track_dataset.py
executable file
·74 lines (63 loc) · 2.41 KB
/
make_track_dataset.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from .track_generator import TrackGenerator
from .utils import Mode, SimType
from datetime import datetime
import yaml
import os
def make_track_dataset(path_to_config : 'default_config.yaml'):
'''
Args:
path_to_config (str): Path to yaml config file. Use this yaml to change things
like the number of tracks to generate, track parameters, output options, etc.
Returns:
(str) abs path to folder where FSSIM yaml cone/track descriptions were saved
'''
with open(path_to_config, 'r') as f:
config = yaml.load(f, Loader=yaml.FullLoader)
NUM_TRACKS = config['NUM_TRACKS']
n_points = config['n_points']
n_regions = config['n_regions']
min_bound = config['min_bound']
max_bound = config['max_bound']
mode = Mode[config['mode']]
track_width = config['track_width']
cone_spacing = config['cone_spacing']
length_start_area = config['length_start_area']
curvature_threshold = eval(config['curvature_threshold'])
straight_threshold = eval(config['straight_threshold'])
plot_track = config['plot_track']
visualise_voronoi = config['visualise_voronoi']
create_output_file = config['create_output_file']
output_folder = config['output_location']
z_offset = config['z_offset']
lat_offset = config['lat_offset']
lon_offset = config['lon_offset']
sim_type = SimType[config['sim_type']]
track_gen = TrackGenerator(
n_points,
n_regions,
min_bound,
max_bound,
mode,
plot_track,
visualise_voronoi,
create_output_file,
output_folder,
track_width,
cone_spacing,
length_start_area,
curvature_threshold,
straight_threshold,
z_offset,
lat_offset,
lon_offset,
sim_type
)
for i in range(NUM_TRACKS):
out_file_name = f'{i}_{str(sim_type)[str(sim_type).index(".") + 1 : ]}'
saved_at = track_gen.create_track(out_file_name)
print('saved_at : ' + saved_at)
print(f'Created {NUM_TRACKS} tracks in folder {os.path.dirname(os.path.abspath(saved_at))}')
return os.path.dirname(saved_at) # TODO 1/13 placeholder
if __name__ == '__main__':
make_track_dataset('default_config.yaml')
print("Done")