-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpath_constants.py
43 lines (32 loc) · 1.6 KB
/
path_constants.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
import os
import sys
VSLAM_LAB_DIR = os.path.dirname(os.path.abspath(__file__))
VSLAM_LAB_PATH = os.path.dirname(VSLAM_LAB_DIR)
VSLAMLAB_BENCHMARK = os.path.join(VSLAM_LAB_PATH, 'VSLAM-LAB-Benchmark')
VSLAMLAB_EVALUATION = os.path.join(VSLAM_LAB_PATH, 'VSLAM-LAB-Evaluation')
VSLAMLAB_BASELINES = os.path.join(VSLAM_LAB_DIR, 'Baselines')
COMPARISONS_YAML_DEFAULT = os.path.join(VSLAM_LAB_DIR, 'configs', 'comp_complete.yaml')
EXP_YAML_DEFAULT = os.path.join(VSLAM_LAB_DIR, 'configs', 'exp_debug.yaml')
CONFIG_DEFAULT = 'config_debug.yaml'
VSLAM_LAB_EVALUATION_FOLDER = 'vslamlab_evaluation'
RGB_BASE_FOLDER = 'rgb'
ABLATION_PARAMETERS_CSV = 'log_ablation_parameters.csv'
SCRIPT_LABEL = f"\033[95m[{os.path.basename(__file__)}]\033[0m "
def set_VSLAMLAB_path(new_path, file_path, target_line_start):
new_line = f"{target_line_start} \"{new_path}\""
print(f"{SCRIPT_LABEL}Set {new_line}")
with open(file_path, 'r') as file:
lines = file.readlines()
with open(file_path, 'w') as file:
for line in lines:
if line.strip().startswith(target_line_start):
file.write(new_line + '\n')
else:
file.write(line)
if __name__ == "__main__":
if len(sys.argv) > 2:
function_name = sys.argv[1]
if function_name == 'set_VSLAMLAB_BENCHMARK_path':
set_VSLAMLAB_path(os.path.join(sys.argv[2], 'VSLAM-LAB-Benchmark'), __file__, "VSLAMLAB_BENCHMARK =")
if function_name == 'set_VSLAMLAB_EVALUATION_path':
set_VSLAMLAB_path(os.path.join(sys.argv[2], 'VSLAM-LAB-Evaluation'), __file__, "VSLAMLAB_EVALUATION =")