forked from MCruces-fz/TRAGALDABAS-Kalman-Filter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrebol
executable file
·138 lines (117 loc) · 4.49 KB
/
trebol
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/usr/bin/python3
"""
TRasgo Enhanced and Beautiful configuration toOL
"""
import os
import json
import numpy as np
with open("utils/configuration.json", "r") as config_file:
config = json.load(config_file)
print(" ", "-" * 33)
print(r" _____ _ _ ")
print(r" |_ _| __ ___| |__ ___ | |")
print(r" | || '__/ _ \ '_ \ / _ \| |")
print(r" | || | | __/ |_) | (_) | |")
print(r" |_||_| \___|_.__/ \___/|_|")
print(r" ____ ___ _ _ _____ ___ ____ ")
print(r" / ___/ _ \| \ | | ___|_ _/ ___|")
print(r" | | | | | | \| | |_ | | | _ ")
print(r" | |__| |_| | |\ | _| | | |_| |")
print(r" \____\___/|_| \_|_| |___\____|")
print("\nTRasgo Enhanced and Beautiful configuration toOL")
print("\n ", "-" * 33)
print("\n\n\n")
# =================================================== #
# C H O O S E P L A N E S D I S T R I B U T I O N #
# =================================================== #
print('''
P L A N E S D I S T R I B U T I O N
[mm] [mm]
T1 # -------------------------- # 1826 0 TOP
T2 # -------------------------- # 1304 522
T3 # -------------------------- # 924 902
T4 # -------------------------- # 87 1739 BOTTOM
0 GROUND
''')
# C H O O S E V E R S I O N
print("Choose TRAGALDABAS Version:")
print(" 1.- Planes -------> T1, T3, T4")
print(" Heights/mm -> 1826, 924, 87")
print(" 2.- Planes -------> T1, T2, T3, T4")
print(" Heights/mm -> 1826, 1304, 924, 87")
print(" 0.- Write another configuration")
print(f" c.- {config['heights_planes']} (CACHED)")
heights_planes = config["heights_planes"]
while True:
version = input("Version (1, 2, 0, c): ")
if version == "1":
heights_planes = [1826, 924, 87]
break
elif version == "2":
heights_planes = [1826, 1304, 924, 87]
break
elif version == "0":
new_vz0 = input("Write heights in mm separated by commas:\n")
heights_planes = np.sort(np.array(new_vz0.split(","), dtype=np.int32)).tolist()[::-1]
break
elif version in ["c", "C", ""]:
print(f"You have chosen cached configuration: {config['heights_planes']}")
break
else:
pass
# =================================================== #
# ========= S I M U L A T E T R A C K S ? ========= #
# =================================================== #
rd_seed = None
ntracks = None
print("\n\n\n")
print("Do you want to simulate tracks?")
print(" y/yes.- Yes, of course!")
print(" n/no.- Nope, Thanks :) I want to reconstruct real data <-- [DEFAULT]")
b_sim = input("Answer: ")
if b_sim in ["y", "Y", "yes", "yeah"]:
print(f"You have chosen {b_sim} Then:")
print("Do you want generate random tracks in each run?")
print(" y/yes.- Yeah")
print(" integer.- Nope, always same numbers, not random.")
print(" (Give me an integer seed)")
while True:
if_seed = input("Answer: ")
if if_seed in ["y", "Y", "yes", "yeah"]:
rd_seed = None
break
elif if_seed.isdigit():
rd_seed = int(if_seed)
break
else:
print("Wrong answer, again...")
print("How many tracks do you want to generate?")
print(" integer.- Number of randomly generated tracks.")
print(" (Give me an integer seed)")
print(" RD.- Random number of tracks.")
print(" (Following a real distribution of number of tracks)")
while True:
ntracks = input("Number of tracks (int): ")
if ntracks.isdigit():
ntracks = int(ntracks)
break
elif ntracks in ["RD", "rd"]:
ntracks = None
break
else:
print("How am I going to generate fractional traces? Please give me an integer...")
elif b_sim in ["n", "N", "nope", "Nope", "no", "nope"]:
print("So we don't need this configurations... let's continue!")
else:
print("You have chosen \"Nope\" as default.")
print("So we don't need this configurations... let's continue!")
# Update all variables:
config["heights_planes"] = heights_planes
config["random_seed"] = rd_seed
config["tracks_number"] = ntracks
print("\n\n\nConfiguration saved to utils/configuration.json file")
print("-" * 33)
print(json.dumps(config, indent=4))
print("-" * 33)
with open("utils/configuration.json", "w") as outfile:
json.dump(config, outfile, indent=4)