superscript.py v 0.8.1

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2020-09-21 07:38:18 +00:00
parent c048f850c0
commit f9fd61e8a5
2 changed files with 35 additions and 32 deletions

View File

@ -1,5 +1,5 @@
{ {
"max-threads": 8, "max-threads": 1,
"team": "", "team": "",
"competition": "2020ilch", "competition": "2020ilch",
"key":{ "key":{

View File

@ -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,11 +233,7 @@ def load_match(apikey, competition):
return d.get_match_data_formatted(apikey, competition) return d.get_match_data_formatted(apikey, competition)
def matchloop(apikey, competition, data, tests): # expects 3D array with [Team][Variable][Match] def simplestats(data_test):
global exec_threads
def simplestats(data_test):
data = np.array(data_test[0]) data = np.array(data_test[0])
data = data[np.isfinite(data)] data = data[np.isfinite(data)]
@ -263,6 +262,10 @@ def matchloop(apikey, competition, data, tests): # expects 3D array with [Team][
if test == "regression_sigmoidal": if test == "regression_sigmoidal":
return an.regression(ranges, data, ['sig']) return an.regression(ranges, data, ['sig'])
def matchloop(apikey, competition, data, tests): # expects 3D array with [Team][Variable][Match]
global exec_threads
class AutoVivification(dict): class AutoVivification(dict):
def __getitem__(self, item): def __getitem__(self, item):
try: try: