mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-26 01:29:10 +00:00
commit
2605f7c29f
Binary file not shown.
1
data analysis/config/competition.config
Normal file
1
data analysis/config/competition.config
Normal file
@ -0,0 +1 @@
|
|||||||
|
2020ilch
|
0
data analysis/config/database.config
Normal file
0
data analysis/config/database.config
Normal file
2
data analysis/config/keys.config
Normal file
2
data analysis/config/keys.config
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
mongodb+srv://api-user-new:titanscout2022@2022-scouting-4vfuu.mongodb.net/test?authSource=admin&replicaSet=2022-scouting-shard-0&readPreference=primary&appname=MongoDB%20Compass&ssl=true
|
||||||
|
UDvKmPjPRfwwUdDX1JxbmkyecYBJhCtXeyVk9vmO2i7K0Zn4wqQPMfzuEINXJ7e5
|
@ -1,4 +1,3 @@
|
|||||||
2020ilch
|
|
||||||
balls-blocked,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal
|
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-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-teleop,basic_stats,historical_analysis,regression_linear,regression_logarithmic,regression_exponential,regression_polynomial,regression_sigmoidal
|
@ -3,10 +3,12 @@
|
|||||||
# Notes:
|
# Notes:
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "0.0.4.002"
|
__version__ = "0.0.5.000"
|
||||||
|
|
||||||
# changelog should be viewed using print(analysis.__changelog__)
|
# changelog should be viewed using print(analysis.__changelog__)
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
0.0.5.000:
|
||||||
|
improved user interface
|
||||||
0.0.4.002:
|
0.0.4.002:
|
||||||
- removed unessasary code
|
- removed unessasary code
|
||||||
0.0.4.001:
|
0.0.4.001:
|
||||||
@ -83,6 +85,8 @@ from analysis import analysis as an
|
|||||||
import data as d
|
import data as d
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
from os import system, name
|
||||||
|
from pathlib import Path
|
||||||
import time
|
import time
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
@ -91,16 +95,16 @@ def main():
|
|||||||
while(True):
|
while(True):
|
||||||
|
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
print("time: " + str(current_time))
|
print("[OK] time: " + str(current_time))
|
||||||
|
|
||||||
print(" loading config")
|
start = time.time()
|
||||||
competition, config = load_config("config.csv")
|
config = load_config(Path("config/stats.config"))
|
||||||
print(" config loaded")
|
competition = an.load_csv(Path("config/competition.config"))[0][0]
|
||||||
|
print("[OK] configs loaded")
|
||||||
|
|
||||||
print(" loading database keys")
|
apikey = an.load_csv(Path("config/keys.config"))[0][0]
|
||||||
apikey = an.load_csv("keys.txt")[0][0]
|
tbakey = an.load_csv(Path("config/keys.config"))[1][0]
|
||||||
tbakey = an.load_csv("keys.txt")[1][0]
|
print("[OK] loaded keys")
|
||||||
print(" loaded keys")
|
|
||||||
|
|
||||||
previous_time = d.get_analysis_flags(apikey, "latest_update")
|
previous_time = d.get_analysis_flags(apikey, "latest_update")
|
||||||
|
|
||||||
@ -113,38 +117,55 @@ def main():
|
|||||||
|
|
||||||
previous_time = previous_time["latest_update"]
|
previous_time = previous_time["latest_update"]
|
||||||
|
|
||||||
print(" analysis backtimed to: " + str(previous_time))
|
print("[OK] analysis backtimed to: " + str(previous_time))
|
||||||
|
|
||||||
print(" loading data")
|
print("[OK] loading data")
|
||||||
|
start = time.time()
|
||||||
data = d.get_match_data_formatted(apikey, competition)
|
data = d.get_match_data_formatted(apikey, competition)
|
||||||
pit_data = d.pit = d.get_pit_data_formatted(apikey, competition)
|
pit_data = d.pit = d.get_pit_data_formatted(apikey, competition)
|
||||||
print(" loaded data")
|
print("[OK] loaded data in " + str(time.time() - start) + " seconds")
|
||||||
|
|
||||||
print(" running tests")
|
print("[OK] running tests")
|
||||||
|
start = time.time()
|
||||||
results = simpleloop(data, config)
|
results = simpleloop(data, config)
|
||||||
print(" finished tests")
|
print("[OK] finished tests in " + str(time.time() - start) + " seconds")
|
||||||
|
|
||||||
print(" running metrics")
|
print("[OK] running metrics")
|
||||||
|
start = time.time()
|
||||||
metricsloop(tbakey, apikey, competition, previous_time)
|
metricsloop(tbakey, apikey, competition, previous_time)
|
||||||
print(" finished metrics")
|
print("[OK] finished metrics in " + str(time.time() - start) + " seconds")
|
||||||
|
|
||||||
print(" running pit analysis")
|
print("[OK] running pit analysis")
|
||||||
|
start = time.time()
|
||||||
pit = pitloop(pit_data, config)
|
pit = pitloop(pit_data, config)
|
||||||
print(" finished pit analysis")
|
print("[OK] finished pit analysis in " + str(time.time() - start) + " seconds")
|
||||||
|
|
||||||
d.set_analysis_flags(apikey, "latest_update", {"latest_update":current_time})
|
d.set_analysis_flags(apikey, "latest_update", {"latest_update":current_time})
|
||||||
|
|
||||||
print(" pushing to database")
|
print("[OK] pushing to database")
|
||||||
|
start = time.time()
|
||||||
push_to_database(apikey, competition, results, pit)
|
push_to_database(apikey, competition, results, pit)
|
||||||
print(" pushed to database")
|
print("[OK] pushed to database in " + str(time.time() - start) + " seconds")
|
||||||
|
|
||||||
|
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 = {}
|
||||||
file = an.load_csv(file)
|
file = an.load_csv(file)
|
||||||
for line in file[1:]:
|
for line in file:
|
||||||
config_vector[line[0]] = line[1:]
|
config_vector[line[0]] = line[1:]
|
||||||
|
|
||||||
return (file[0][0], config_vector)
|
return config_vector
|
||||||
|
|
||||||
def simpleloop(data, tests): # expects 3D array with [Team][Variable][Match]
|
def simpleloop(data, tests): # expects 3D array with [Team][Variable][Match]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user