superscript v 0.8.4

Former-commit-id: 5ea2297017
This commit is contained in:
Arthur Lu 2021-04-09 23:45:16 +00:00
parent 8f79be68d4
commit 7abfb2d90a
2 changed files with 89 additions and 5 deletions

View File

@ -1 +1 @@
444a669a78cfcfa4224d73c7b84aa0a2b379024f e5f402045a28f8602e17dbd7e4ca6641c33ccd65

View File

@ -3,10 +3,14 @@
# Notes: # Notes:
# setup: # setup:
__version__ = "0.8.3" __version__ = "0.8.4"
# changelog should be viewed using print(analysis.__changelog__) # changelog should be viewed using print(analysis.__changelog__)
__changelog__ = """changelog: __changelog__ = """changelog:
0.84:
- added better error message for missing config.json
- added automatic config.json creation
- added splash text with version and system info
0.8.3: 0.8.3:
- updated matchloop with new regression format (requires tra_analysis 3.x) - updated matchloop with new regression format (requires tra_analysis 3.x)
0.8.2: 0.8.2:
@ -132,6 +136,7 @@ import os
from os import system, name from os import system, name
from pathlib import Path from pathlib import Path
from multiprocessing import Pool from multiprocessing import Pool
import platform
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
import time import time
@ -145,6 +150,8 @@ def main():
warnings.filterwarnings("ignore") warnings.filterwarnings("ignore")
splash()
while (True): while (True):
current_time = time.time() current_time = time.time()
@ -169,7 +176,7 @@ def main():
elif cfg_max_threads == 0: elif cfg_max_threads == 0:
alloc_processes = sys_max_threads alloc_processes = sys_max_threads
else: else:
print("[Err] Invalid number of processes, must be between -" + str(sys_max_threads) + " and " + str(sys_max_threads)) print("[ERROR] Invalid number of processes, must be between -" + str(sys_max_threads) + " and " + str(sys_max_threads))
exit() exit()
exec_threads = Pool(processes = alloc_processes) exec_threads = Pool(processes = alloc_processes)
print("[OK] " + str(alloc_processes) + " threads started") print("[OK] " + str(alloc_processes) + " threads started")
@ -205,6 +212,8 @@ def main():
set_current_time(apikey, current_time) set_current_time(apikey, current_time)
print("[OK] finished all tests, looping") print("[OK] finished all tests, looping")
print_hrule()
#clear() #clear()
def clear(): def clear():
@ -217,11 +226,39 @@ def clear():
else: else:
_ = system('clear') _ = system('clear')
def print_hrule():
print("#"+38*"-"+"#")
def print_box(s):
temp = "|"
temp += s
temp += (40-len(s)-2)*" "
temp += "|"
print(temp)
def splash():
print_hrule()
print_box(" superscript version: " + __version__)
print_box(" os: " + platform.system())
print_box(" python: " + platform.python_version())
print_hrule()
def load_config(file): def load_config(file):
config_vector = {} config_vector = {}
with open(file) as f:
config_vector = json.load(f) try:
f = open(file)
except:
print("[ERROR] could not locate config.json, generating blank config.json and exiting")
f = open(file, "w")
f.write(sample_json)
exit()
config_vector = json.load(f)
return config_vector return config_vector
@ -543,4 +580,51 @@ def graph_pit_histogram(apikey, competition, figsize=(80,15)):
plt.show() plt.show()
sample_json = """{
"max-threads": 0.5,
"team": "",
"competition": "2020ilch",
"key":{
"database":"",
"tba":""
},
"statistics":{
"match":{
"balls-blocked":["basic_stats","historical_analysis","regression_linear","regression_logarithmic","regression_exponential","regression_polynomial","regression_sigmoidal"],
"balls-collected":["basic_stats","historical_analysis","regression_linear","regression_logarithmic","regression_exponential","regression_polynomial","regression_sigmoidal"],
"balls-lower-teleop":["basic_stats","historical_analysis","regression_linear","regression_logarithmic","regression_exponential","regression_polynomial","regression_sigmoidal"],
"balls-lower-auto":["basic_stats","historical_analysis","regression_linear","regression_logarithmic","regression_exponential","regression_polynomial","regression_sigmoidal"],
"balls-started":["basic_stats","historical_analyss","regression_linear","regression_logarithmic","regression_exponential","regression_polynomial","regression_sigmoidal"],
"balls-upper-teleop":["basic_stats","historical_analysis","regression_linear","regression_logarithmic","regression_exponential","regression_polynomial","regression_sigmoidal"],
"balls-upper-auto":["basic_stats","historical_analysis","regression_linear","regression_logarithmic","regression_exponential","regression_polynomial","regression_sigmoidal"]
},
"metric":{
"elo":{
"score":1500,
"N":400,
"K":24
},
"gl2":{
"score":1500,
"rd":250,
"vol":0.06
},
"ts":{
"mu":25,
"sigma":8.33
}
},
"pit":{
"wheel-mechanism":true,
"low-balls":true,
"high-balls":true,
"wheel-success":true,
"strategic-focus":true,
"climb-mechanism":true,
"attitude":true
}
}
}"""
main() main()