mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-26 01:29:10 +00:00
superscript.py v 0.8.1
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
c048f850c0
commit
f9fd61e8a5
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"max-threads": 8,
|
"max-threads": 1,
|
||||||
"team": "",
|
"team": "",
|
||||||
"competition": "2020ilch",
|
"competition": "2020ilch",
|
||||||
"key":{
|
"key":{
|
||||||
|
@ -3,10 +3,12 @@
|
|||||||
# Notes:
|
# Notes:
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "0.8.0"
|
__version__ = "0.8.1"
|
||||||
|
|
||||||
# changelog should be viewed using print(analysis.__changelog__)
|
# changelog should be viewed using print(analysis.__changelog__)
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
0.8.1:
|
||||||
|
- optimized matchloop further by bypassing GIL
|
||||||
0.8.0:
|
0.8.0:
|
||||||
- added multithreading to matchloop
|
- added multithreading to matchloop
|
||||||
- tweaked user log
|
- tweaked user log
|
||||||
@ -122,6 +124,7 @@ import json
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from os import system, name
|
from os import system, name
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from multiprocessing import Pool
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
import time
|
import time
|
||||||
@ -148,7 +151,7 @@ def main():
|
|||||||
print("[OK] configs loaded")
|
print("[OK] configs loaded")
|
||||||
|
|
||||||
print("[OK] starting threads")
|
print("[OK] starting threads")
|
||||||
exec_threads = ThreadPoolExecutor(max_workers = config["max-threads"])
|
exec_threads = Pool(processes = config["max-threads"])
|
||||||
print("[OK] threads started")
|
print("[OK] threads started")
|
||||||
|
|
||||||
apikey = config["key"]["database"]
|
apikey = config["key"]["database"]
|
||||||
@ -230,39 +233,39 @@ def load_match(apikey, competition):
|
|||||||
|
|
||||||
return d.get_match_data_formatted(apikey, competition)
|
return d.get_match_data_formatted(apikey, competition)
|
||||||
|
|
||||||
|
def simplestats(data_test):
|
||||||
|
|
||||||
|
data = np.array(data_test[0])
|
||||||
|
data = data[np.isfinite(data)]
|
||||||
|
ranges = list(range(len(data)))
|
||||||
|
|
||||||
|
test = data_test[1]
|
||||||
|
|
||||||
|
if test == "basic_stats":
|
||||||
|
return an.basic_stats(data)
|
||||||
|
|
||||||
|
if test == "historical_analysis":
|
||||||
|
return an.histo_analysis([ranges, data])
|
||||||
|
|
||||||
|
if test == "regression_linear":
|
||||||
|
return an.regression(ranges, data, ['lin'])
|
||||||
|
|
||||||
|
if test == "regression_logarithmic":
|
||||||
|
return an.regression(ranges, data, ['log'])
|
||||||
|
|
||||||
|
if test == "regression_exponential":
|
||||||
|
return an.regression(ranges, data, ['exp'])
|
||||||
|
|
||||||
|
if test == "regression_polynomial":
|
||||||
|
return an.regression(ranges, data, ['ply'])
|
||||||
|
|
||||||
|
if test == "regression_sigmoidal":
|
||||||
|
return an.regression(ranges, data, ['sig'])
|
||||||
|
|
||||||
def matchloop(apikey, competition, data, tests): # expects 3D array with [Team][Variable][Match]
|
def matchloop(apikey, competition, data, tests): # expects 3D array with [Team][Variable][Match]
|
||||||
|
|
||||||
global exec_threads
|
global exec_threads
|
||||||
|
|
||||||
def simplestats(data_test):
|
|
||||||
|
|
||||||
data = np.array(data_test[0])
|
|
||||||
data = data[np.isfinite(data)]
|
|
||||||
ranges = list(range(len(data)))
|
|
||||||
|
|
||||||
test = data_test[1]
|
|
||||||
|
|
||||||
if test == "basic_stats":
|
|
||||||
return an.basic_stats(data)
|
|
||||||
|
|
||||||
if test == "historical_analysis":
|
|
||||||
return an.histo_analysis([ranges, data])
|
|
||||||
|
|
||||||
if test == "regression_linear":
|
|
||||||
return an.regression(ranges, data, ['lin'])
|
|
||||||
|
|
||||||
if test == "regression_logarithmic":
|
|
||||||
return an.regression(ranges, data, ['log'])
|
|
||||||
|
|
||||||
if test == "regression_exponential":
|
|
||||||
return an.regression(ranges, data, ['exp'])
|
|
||||||
|
|
||||||
if test == "regression_polynomial":
|
|
||||||
return an.regression(ranges, data, ['ply'])
|
|
||||||
|
|
||||||
if test == "regression_sigmoidal":
|
|
||||||
return an.regression(ranges, data, ['sig'])
|
|
||||||
|
|
||||||
class AutoVivification(dict):
|
class AutoVivification(dict):
|
||||||
def __getitem__(self, item):
|
def __getitem__(self, item):
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user