Add scripts to properly generate agr data
Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
parent
a101f8588a
commit
98257b746c
27
util/preds.py
Normal file
27
util/preds.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
|
if len(sys.argv) != 5:
|
||||||
|
print("Usage: python preds.py <iaca> <mca> <osaca> <uica>")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
iaca_pred = float(sys.argv[1])
|
||||||
|
mca_pred = float(sys.argv[2])
|
||||||
|
osaca_pred = float(sys.argv[3])
|
||||||
|
uica_pred = float(sys.argv[4])
|
||||||
|
preds = [iaca_pred, mca_pred, osaca_pred, uica_pred]
|
||||||
|
|
||||||
|
start = -4.0
|
||||||
|
end = 36.0
|
||||||
|
npoints = 50
|
||||||
|
offset = (end - start) / (npoints - 1)
|
||||||
|
i = 0
|
||||||
|
for pred in preds:
|
||||||
|
print(f"@target G0.S{i+6}")
|
||||||
|
print(f"@type xy")
|
||||||
|
for j in range(npoints):
|
||||||
|
pos = start + offset * j
|
||||||
|
print("{:.6f} {}".format(pos, pred))
|
||||||
|
|
||||||
|
print("&")
|
||||||
|
i += 1
|
33
util/string_to_agr.py
Normal file
33
util/string_to_agr.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
print("Usage: python string_to_agr.py input_filename")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
input_filename = sys.argv[1]
|
||||||
|
result_list = []
|
||||||
|
|
||||||
|
with open(input_filename, 'r') as file:
|
||||||
|
for line in file:
|
||||||
|
numbers = re.findall(r'\d+\.\d+', line)
|
||||||
|
divided_numbers = [float(number) / 8 for number in numbers]
|
||||||
|
result_list.append(divided_numbers)
|
||||||
|
|
||||||
|
start = -2.5
|
||||||
|
bar_offset = 1.0
|
||||||
|
group_offset = 8.0
|
||||||
|
i = 0
|
||||||
|
|
||||||
|
for group in result_list:
|
||||||
|
print(f"@target G0.S{i}")
|
||||||
|
print(f"@type bar")
|
||||||
|
|
||||||
|
j = 0
|
||||||
|
for meas in group:
|
||||||
|
pos = start + i * bar_offset + j * group_offset
|
||||||
|
print(f"{pos} {meas}")
|
||||||
|
j += 1
|
||||||
|
|
||||||
|
print("&")
|
||||||
|
i += 1
|
Loading…
Reference in New Issue
Block a user