superscript.py v 0.7.0

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2020-09-20 00:45:38 +00:00
parent 6b5de9706e
commit bc3889c4e0
2 changed files with 70 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"team": "", "team": "",
"competition": "", "competition": "2020ilch",
"key":{ "key":{
"database":"", "database":"",
"tba":"" "tba":""

View File

@ -3,10 +3,12 @@
# Notes: # Notes:
# setup: # setup:
__version__ = "0.6.2" __version__ = "0.7.0"
# changelog should be viewed using print(analysis.__changelog__) # changelog should be viewed using print(analysis.__changelog__)
__changelog__ = """changelog: __changelog__ = """changelog:
0.7.0:
- finished implementing main function
0.6.2: 0.6.2:
- integrated get_team_rankings.py as get_team_metrics() function - integrated get_team_rankings.py as get_team_metrics() function
- integrated visualize_pit.py as graph_pit_histogram() function - integrated visualize_pit.py as graph_pit_histogram() function
@ -120,6 +122,65 @@ import matplotlib.pyplot as plt
import time import time
import warnings import warnings
def main():
warnings.filterwarnings("ignore")
while (True):
current_time = time.time()
print("[OK] time: " + str(current_time))
config = load_config("config.json")
competition = config["competition"]
match_tests = config["statistics"]["match"]
pit_tests = config["statistics"]["pit"]
metrics_tests = config["statistics"]["metric"]
print("[OK] configs loaded")
apikey = config["key"]["database"]
tbakey = config["key"]["tba"]
print("[OK] loaded keys")
previous_time = get_previous_time(apikey)
print("[OK] analysis backtimed to: " + str(previous_time))
print("[OK] loading data")
start = time.time()
match_data = load_match(apikey, competition)
pit_data = load_pit(apikey, competition)
print("[OK] loaded data in " + str(time.time() - start) + " seconds")
print("[OK] running tests")
start = time.time()
matchloop(apikey, competition, match_data, match_tests)
print("[OK] finished tests in " + str(time.time() - start) + " seconds")
print("[OK] running metrics")
start = time.time()
metricloop(tbakey, apikey, competition, previous_time, metrics_tests)
print("[OK] finished metrics in " + str(time.time() - start) + " seconds")
print("[OK] running pit analysis")
start = time.time()
pitloop(apikey, competition, pit_data, pit_tests)
print("[OK] finished pit analysis in " + str(time.time() - start) + " seconds")
set_current_time(apikey, current_time)
print("[OK] finished all tests, looping")
clear()
def clear():
# for windows
if name == 'nt':
_ = system('cls')
# for mac and linux(here, os.name is 'posix')
else:
_ = system('clear')
def load_config(file): def load_config(file):
config_vector = {} config_vector = {}
@ -148,6 +209,10 @@ def get_previous_time(apikey):
return previous_time return previous_time
def set_current_time(apikey, current_time):
d.set_analysis_flags(apikey, "latest_update", {"latest_update":current_time})
def load_match(apikey, competition): def load_match(apikey, competition):
return d.get_match_data_formatted(apikey, competition) return d.get_match_data_formatted(apikey, competition)
@ -403,3 +468,5 @@ def graph_pit_histogram(apikey, competition, figsize=(80,15)):
i+=1 i+=1
plt.show() plt.show()
main()