From c54702576da92eab1a1e9ad4742603de9f86b425 Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Mon, 9 Mar 2020 20:18:30 -0500 Subject: [PATCH 1/3] working --- data analysis/__pycache__/data.cpython-37.pyc | Bin 4239 -> 4239 bytes data analysis/config/competition.config | 1 + data analysis/config/database.config | 0 data analysis/config/keys.config | 2 ++ .../{config.csv => config/stats.config} | 1 - data analysis/superscript.py | 12 +++++++----- 6 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 data analysis/config/competition.config create mode 100644 data analysis/config/database.config create mode 100644 data analysis/config/keys.config rename data analysis/{config.csv => config/stats.config} (98%) diff --git a/data analysis/__pycache__/data.cpython-37.pyc b/data analysis/__pycache__/data.cpython-37.pyc index 86de3e092dac398ecdc96c06ae44ccdd0ef56e78..58b83c4a48a2c2984475e33e57f4ebec6897e590 100644 GIT binary patch delta 20 ZcmeBI>{sM=;^pOH00PUGX&bp)1OP2p1gZc4 delta 20 ZcmeBI>{sM=;^pOH0D`W2i5t0F1OP8H1nU3* diff --git a/data analysis/config/competition.config b/data analysis/config/competition.config new file mode 100644 index 00000000..511e258a --- /dev/null +++ b/data analysis/config/competition.config @@ -0,0 +1 @@ +2020ilch \ No newline at end of file diff --git a/data analysis/config/database.config b/data analysis/config/database.config new file mode 100644 index 00000000..e69de29b diff --git a/data analysis/config/keys.config b/data analysis/config/keys.config new file mode 100644 index 00000000..77a53a68 --- /dev/null +++ b/data analysis/config/keys.config @@ -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 \ No newline at end of file diff --git a/data analysis/config.csv b/data analysis/config/stats.config similarity index 98% rename from data analysis/config.csv rename to data analysis/config/stats.config index 42e42922..5b0501ac 100644 --- a/data analysis/config.csv +++ b/data analysis/config/stats.config @@ -1,4 +1,3 @@ -2020ilch 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 diff --git a/data analysis/superscript.py b/data analysis/superscript.py index 7190bd1f..66709017 100644 --- a/data analysis/superscript.py +++ b/data analysis/superscript.py @@ -81,6 +81,7 @@ __all__ = [ from analysis import analysis as an import data as d +from pathlib import Path import numpy as np import matplotlib.pyplot as plt import time @@ -94,12 +95,13 @@ def main(): print("time: " + str(current_time)) print(" loading config") - competition, config = load_config("config.csv") + config = load_config(Path("config/stats.config")) + competition = an.load_csv(Path("config/competition.config"))[0][0] print(" config loaded") print(" loading database keys") - apikey = an.load_csv("keys.txt")[0][0] - tbakey = an.load_csv("keys.txt")[1][0] + apikey = an.load_csv(Path("config/keys.config"))[0][0] + tbakey = an.load_csv(Path("config/keys.config"))[1][0] print(" loaded keys") previous_time = d.get_analysis_flags(apikey, "latest_update") @@ -141,10 +143,10 @@ def main(): def load_config(file): config_vector = {} file = an.load_csv(file) - for line in file[1:]: + for line in file: 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] From 2faed2114733e322c91e4cdead33c7ce4171fbfa Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Mon, 9 Mar 2020 20:29:44 -0500 Subject: [PATCH 2/3] working --- data analysis/superscript.py | 51 ++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/data analysis/superscript.py b/data analysis/superscript.py index 66709017..855d5103 100644 --- a/data analysis/superscript.py +++ b/data analysis/superscript.py @@ -81,9 +81,10 @@ __all__ = [ from analysis import analysis as an import data as d -from pathlib import Path import numpy as np import matplotlib.pyplot as plt +from os import system, name +from pathlib import Path import time import warnings @@ -92,17 +93,16 @@ def main(): while(True): current_time = time.time() - print("time: " + str(current_time)) + print("[OK] time: " + str(current_time)) - print(" loading config") + start = time.time() config = load_config(Path("config/stats.config")) competition = an.load_csv(Path("config/competition.config"))[0][0] - print(" config loaded") + print("[OK] configs loaded") - print(" loading database keys") apikey = an.load_csv(Path("config/keys.config"))[0][0] tbakey = an.load_csv(Path("config/keys.config"))[1][0] - print(" loaded keys") + print("[OK] loaded keys") previous_time = d.get_analysis_flags(apikey, "latest_update") @@ -115,30 +115,47 @@ def main(): 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) 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) - 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) - 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) - 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}) - print(" pushing to database") + print("[OK] pushing to database") + start = time.time() 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): config_vector = {} From 6b3ca52651907f283dc270508789596246432093 Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Mon, 9 Mar 2020 20:35:11 -0500 Subject: [PATCH 3/3] superscript.py v 0.0.5.000 --- data analysis/superscript.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data analysis/superscript.py b/data analysis/superscript.py index 855d5103..d57eab26 100644 --- a/data analysis/superscript.py +++ b/data analysis/superscript.py @@ -3,10 +3,12 @@ # Notes: # setup: -__version__ = "0.0.4.002" +__version__ = "0.0.5.000" # changelog should be viewed using print(analysis.__changelog__) __changelog__ = """changelog: + 0.0.5.000: + improved user interface 0.0.4.002: - removed unessasary code 0.0.4.001: