deleted config.json

changed superscript config lookup to relative path
added additional requirements to requirements.txt
added build spec file for superscript
This commit is contained in:
Arthur Lu 2021-04-02 21:35:05 +00:00
parent 79689d69c8
commit 18dbc174bd
7 changed files with 114 additions and 157 deletions

View File

@ -1,2 +1,7 @@
FROM python FROM ubuntu:20.04
WORKDIR ~/ WORKDIR /
RUN apt-get -y update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN apt-get install -y python3 python3-dev git python3-pip python3-kivy python-is-python3 libgl1-mesa-dev build-essential
RUN ln -s $(which pip3) /usr/bin/pip
RUN pip install pymongo pandas numpy scipy scikit-learn matplotlib pylint kivy

View File

@ -0,0 +1,2 @@
FROM titanscout2022/tra-analysis-base:latest
WORKDIR /

View File

@ -1,7 +1,7 @@
{ {
"name": "TRA Analysis Development Environment", "name": "TRA Analysis Development Environment",
"build": { "build": {
"dockerfile": "Dockerfile", "dockerfile": "dev-dockerfile",
}, },
"settings": { "settings": {
"terminal.integrated.shell.linux": "/bin/bash", "terminal.integrated.shell.linux": "/bin/bash",
@ -24,5 +24,5 @@
"ms-python.python", "ms-python.python",
"waderyan.gitblame" "waderyan.gitblame"
], ],
"postCreateCommand": "apt install vim -y ; pip install -r src/requirements.txt ; pip install pylint ; pip install tra-analysis; pip install pytest" "postCreateCommand": "/usr/bin/pip3 install -r /workspaces/tra-data-analysis/src/requirements.txt && /usr/bin/pip3 install --no-cache-dir pylint && /usr/bin/pip3 install pytest"
} }

View File

@ -1,101 +0,0 @@
{
"max-threads": 0.5,
"team": "",
"competition": "",
"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_analysis",
"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
}
}
}

View File

@ -2,4 +2,18 @@ requests
pymongo pymongo
pandas pandas
tra-analysis tra-analysis
dnspython
pyinstaller
requests
pymongo
numpy
scipy
scikit-learn
six
matplotlib
pyparsing
pandas
kivy==2.0.0rc2 kivy==2.0.0rc2

View File

@ -143,67 +143,67 @@ def main():
warnings.filterwarnings("ignore") warnings.filterwarnings("ignore")
# while (True): while (True):
current_time = time.time() current_time = time.time()
print("[OK] time: " + str(current_time)) print("[OK] time: " + str(current_time))
config = load_config("red-alliance-analysis\data-analysis\config.json") config = load_config("config.json")
competition = config["competition"] competition = config["competition"]
match_tests = config["statistics"]["match"] match_tests = config["statistics"]["match"]
pit_tests = config["statistics"]["pit"] pit_tests = config["statistics"]["pit"]
metrics_tests = config["statistics"]["metric"] metrics_tests = config["statistics"]["metric"]
print("[OK] configs loaded") print("[OK] configs loaded")
print("[OK] starting threads") print("[OK] starting threads")
cfg_max_threads = config["max-threads"] cfg_max_threads = config["max-threads"]
sys_max_threads = os.cpu_count() sys_max_threads = os.cpu_count()
if cfg_max_threads > -sys_max_threads and cfg_max_threads < 0 : if cfg_max_threads > -sys_max_threads and cfg_max_threads < 0 :
alloc_processes = sys_max_threads + cfg_max_threads alloc_processes = sys_max_threads + cfg_max_threads
elif cfg_max_threads > 0 and cfg_max_threads < 1: elif cfg_max_threads > 0 and cfg_max_threads < 1:
alloc_processes = math.floor(cfg_max_threads * sys_max_threads) alloc_processes = math.floor(cfg_max_threads * sys_max_threads)
elif cfg_max_threads > 1 and cfg_max_threads <= sys_max_threads: elif cfg_max_threads > 1 and cfg_max_threads <= sys_max_threads:
alloc_processes = cfg_max_threads alloc_processes = cfg_max_threads
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("[Err] 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")
apikey = config["key"]["database"] apikey = config["key"]["database"]
tbakey = config["key"]["tba"] tbakey = config["key"]["tba"]
print("[OK] loaded keys") print("[OK] loaded keys")
previous_time = get_previous_time(apikey) previous_time = get_previous_time(apikey)
print("[OK] analysis backtimed to: " + str(previous_time)) print("[OK] analysis backtimed to: " + str(previous_time))
print("[OK] loading data") print("[OK] loading data")
start = time.time() start = time.time()
match_data = load_match(apikey, competition) match_data = load_match(apikey, competition)
pit_data = load_pit(apikey, competition) pit_data = load_pit(apikey, competition)
print("[OK] loaded data in " + str(time.time() - start) + " seconds") print("[OK] loaded data in " + str(time.time() - start) + " seconds")
print("[OK] running match stats") print("[OK] running match stats")
start = time.time() start = time.time()
matchloop(apikey, competition, match_data, match_tests) matchloop(apikey, competition, match_data, match_tests)
print("[OK] finished match stats in " + str(time.time() - start) + " seconds") print("[OK] finished match stats in " + str(time.time() - start) + " seconds")
print("[OK] running team metrics") print("[OK] running team metrics")
start = time.time() start = time.time()
metricloop(tbakey, apikey, competition, previous_time, metrics_tests) metricloop(tbakey, apikey, competition, previous_time, metrics_tests)
print("[OK] finished team metrics in " + str(time.time() - start) + " seconds") print("[OK] finished team metrics in " + str(time.time() - start) + " seconds")
print("[OK] running pit analysis") print("[OK] running pit analysis")
start = time.time() start = time.time()
pitloop(apikey, competition, pit_data, pit_tests) pitloop(apikey, competition, pit_data, pit_tests)
print("[OK] finished pit analysis in " + str(time.time() - start) + " seconds") print("[OK] finished pit analysis in " + str(time.time() - start) + " seconds")
set_current_time(apikey, current_time) set_current_time(apikey, current_time)
print("[OK] finished all tests, looping") print("[OK] finished all tests, looping")
# clear() # clear()
def clear(): def clear():

37
src/superscript.spec Normal file
View File

@ -0,0 +1,37 @@
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['superscript.py'],
pathex=['/workspaces/tra-data-analysis/src'],
binaries=[],
datas=[],
hiddenimports=[
"dnspython",
"sklearn.utils._weight_vector",
"requests",
],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='superscript',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )