mirror of
https://github.com/titanscouting/tra-superscript.git
synced 2024-11-10 06:54:45 +00:00
Merge branch 'superscriptGUI' into master-staged
This commit is contained in:
commit
c33e75bec6
77
config.json
77
config.json
@ -1,21 +1,76 @@
|
|||||||
{
|
{
|
||||||
"max-threads": 0.5,
|
"max-threads": 0.5,
|
||||||
"team": "",
|
"team": "",
|
||||||
"competition": "",
|
"competition": "2020ilch",
|
||||||
"key": {
|
"key": {
|
||||||
"database":"",
|
"database": "mongodb+srv://analysis:MU2gPeEjEurRt2n@2022-scouting-4vfuu.mongodb.net/<dbname>?retryWrites=true&w=majority",
|
||||||
"tba":""
|
"tba": "UDvKmPjPRfwwUdDX1JxbmkyecYBJhCtXeyVk9vmO2i7K0Zn4wqQPMfzuEINXJ7e5"
|
||||||
},
|
},
|
||||||
"statistics": {
|
"statistics": {
|
||||||
"match": {
|
"match": {
|
||||||
"balls-blocked":["basic_stats","historical_analysis","regression_linear","regression_logarithmic","regression_exponential","regression_polynomial","regression_sigmoidal"],
|
"balls-blocked": [
|
||||||
"balls-collected":["basic_stats","historical_analysis","regression_linear","regression_logarithmic","regression_exponential","regression_polynomial","regression_sigmoidal"],
|
"basic_stats",
|
||||||
"balls-lower-teleop":["basic_stats","historical_analysis","regression_linear","regression_logarithmic","regression_exponential","regression_polynomial","regression_sigmoidal"],
|
"historical_analysis",
|
||||||
"balls-lower-auto":["basic_stats","historical_analysis","regression_linear","regression_logarithmic","regression_exponential","regression_polynomial","regression_sigmoidal"],
|
"regression_linear",
|
||||||
"balls-started":["basic_stats","historical_analyss","regression_linear","regression_logarithmic","regression_exponential","regression_polynomial","regression_sigmoidal"],
|
"regression_logarithmic",
|
||||||
"balls-upper-teleop":["basic_stats","historical_analysis","regression_linear","regression_logarithmic","regression_exponential","regression_polynomial","regression_sigmoidal"],
|
"regression_exponential",
|
||||||
"balls-upper-auto":["basic_stats","historical_analysis","regression_linear","regression_logarithmic","regression_exponential","regression_polynomial","regression_sigmoidal"]
|
"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_analyss",
|
||||||
|
"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": {
|
"metric": {
|
||||||
"elo": {
|
"elo": {
|
||||||
|
151
design.kv
Normal file
151
design.kv
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
<Launch>:
|
||||||
|
orientation: "vertical"
|
||||||
|
|
||||||
|
NavigationLayout:
|
||||||
|
ScreenManager:
|
||||||
|
id: screen_manager
|
||||||
|
HomeScreen:
|
||||||
|
name: "Home"
|
||||||
|
BoxLayout:
|
||||||
|
orientation: "vertical"
|
||||||
|
MDToolbar:
|
||||||
|
title: screen_manager.current
|
||||||
|
elevation: 10
|
||||||
|
left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]
|
||||||
|
|
||||||
|
GridLayout:
|
||||||
|
cols: 1
|
||||||
|
padding: 15, 15
|
||||||
|
spacing: 20, 20
|
||||||
|
MDTextFieldRect:
|
||||||
|
hint_text: "Console Log"
|
||||||
|
# size_hint: .8, None
|
||||||
|
# align: 'center'
|
||||||
|
# Widget:
|
||||||
|
SettingsScreen:
|
||||||
|
name: "Settings"
|
||||||
|
BoxLayout:
|
||||||
|
orientation: 'vertical'
|
||||||
|
MDToolbar:
|
||||||
|
title: screen_manager.current
|
||||||
|
elevation: 10
|
||||||
|
left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]
|
||||||
|
Widget:
|
||||||
|
InfoScreen:
|
||||||
|
name: "Info"
|
||||||
|
BoxLayout:
|
||||||
|
orientation: 'vertical'
|
||||||
|
MDToolbar:
|
||||||
|
title: screen_manager.current
|
||||||
|
elevation: 10
|
||||||
|
left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]
|
||||||
|
# GridLayout:
|
||||||
|
# cols: 2
|
||||||
|
# padding: 15, 15
|
||||||
|
# spacing: 20, 20
|
||||||
|
BoxLayout:
|
||||||
|
orientation: "horizontal"
|
||||||
|
MDLabel:
|
||||||
|
text: "DB Key:"
|
||||||
|
halign: 'center'
|
||||||
|
MDTextField:
|
||||||
|
hint_text: "placeholder"
|
||||||
|
pos_hint: {"center_y": .5}
|
||||||
|
|
||||||
|
BoxLayout:
|
||||||
|
orientation: "horizontal"
|
||||||
|
MDLabel:
|
||||||
|
text: "TBA Key:"
|
||||||
|
halign: 'center'
|
||||||
|
MDTextField:
|
||||||
|
hint_text: "placeholder"
|
||||||
|
pos_hint: {"center_y": .5}
|
||||||
|
BoxLayout:
|
||||||
|
orientation: "horizontal"
|
||||||
|
MDLabel:
|
||||||
|
text: "CPU Use:"
|
||||||
|
halign: 'center'
|
||||||
|
MDLabel:
|
||||||
|
text: "placeholder"
|
||||||
|
halign: 'center'
|
||||||
|
BoxLayout:
|
||||||
|
orientation: "horizontal"
|
||||||
|
MDLabel:
|
||||||
|
text: "Network:"
|
||||||
|
halign: 'center'
|
||||||
|
MDLabel:
|
||||||
|
text: "placeholder"
|
||||||
|
halign: 'center'
|
||||||
|
Widget:
|
||||||
|
BoxLayout:
|
||||||
|
orientation: "horizontal"
|
||||||
|
MDLabel:
|
||||||
|
text: "Progress"
|
||||||
|
halign: 'center'
|
||||||
|
MDProgressBar:
|
||||||
|
id: progress
|
||||||
|
value: 50
|
||||||
|
StatsScreen:
|
||||||
|
name: "Stats"
|
||||||
|
MDCheckbox:
|
||||||
|
size_hint: None, None
|
||||||
|
size: "48dp", "48dp"
|
||||||
|
pos_hint: {'center_x': .5, 'center_y': .5}
|
||||||
|
on_active: Screen.test()
|
||||||
|
|
||||||
|
#Navigation Drawer -------------------------
|
||||||
|
MDNavigationDrawer:
|
||||||
|
id: nav_drawer
|
||||||
|
BoxLayout:
|
||||||
|
orientation: "vertical"
|
||||||
|
padding: "8dp"
|
||||||
|
spacing: "8dp"
|
||||||
|
MDLabel:
|
||||||
|
text: "Titan Scouting"
|
||||||
|
font_style: "Button"
|
||||||
|
size_hint_y: None
|
||||||
|
height: self.texture_size[1]
|
||||||
|
|
||||||
|
MDLabel:
|
||||||
|
text: "Data Analysis"
|
||||||
|
font_style: "Caption"
|
||||||
|
size_hint_y: None
|
||||||
|
height: self.texture_size[1]
|
||||||
|
ScrollView:
|
||||||
|
MDList:
|
||||||
|
OneLineAvatarListItem:
|
||||||
|
text: "Home"
|
||||||
|
on_press:
|
||||||
|
# nav_drawer.set_state("close")
|
||||||
|
# screen_manager.transition.direction = "left"
|
||||||
|
screen_manager.current = "Home"
|
||||||
|
IconLeftWidget:
|
||||||
|
icon: "home"
|
||||||
|
|
||||||
|
OneLineAvatarListItem:
|
||||||
|
text: "Settings"
|
||||||
|
on_press:
|
||||||
|
# nav_drawer.set_state("close")
|
||||||
|
# screen_manager.transition.direction = "right"
|
||||||
|
# screen_manager.fade
|
||||||
|
screen_manager.current = "Settings"
|
||||||
|
IconLeftWidget:
|
||||||
|
icon: "cog"
|
||||||
|
OneLineAvatarListItem:
|
||||||
|
text: "Info"
|
||||||
|
on_press:
|
||||||
|
# nav_drawer.set_state("close")
|
||||||
|
# screen_manager.transition.direction = "right"
|
||||||
|
# screen_manager.fade
|
||||||
|
screen_manager.current = "Info"
|
||||||
|
IconLeftWidget:
|
||||||
|
icon: "cog"
|
||||||
|
OneLineAvatarListItem:
|
||||||
|
text: "Stats"
|
||||||
|
on_press:
|
||||||
|
# nav_drawer.set_state("close")
|
||||||
|
# screen_manager.transition.direction = "right"
|
||||||
|
# screen_manager.fade
|
||||||
|
screen_manager.current = "Stats"
|
||||||
|
IconLeftWidget:
|
||||||
|
icon: "cog"
|
58
main.py
Normal file
58
main.py
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
from kivy.lang import Builder
|
||||||
|
|
||||||
|
from kivymd.uix.screen import Screen
|
||||||
|
from kivymd.uix.list import OneLineListItem, MDList, TwoLineListItem, ThreeLineListItem
|
||||||
|
from kivymd.uix.list import OneLineIconListItem, IconLeftWidget
|
||||||
|
from kivy.uix.scrollview import ScrollView
|
||||||
|
|
||||||
|
|
||||||
|
from kivy.uix.boxlayout import BoxLayout
|
||||||
|
from kivy.uix.screenmanager import ScreenManager, Screen
|
||||||
|
from kivy.uix.dropdown import DropDown
|
||||||
|
from kivy.uix.button import Button
|
||||||
|
from kivy.base import runTouchApp
|
||||||
|
from kivymd.uix.menu import MDDropdownMenu, MDMenuItem
|
||||||
|
|
||||||
|
from kivymd.app import MDApp
|
||||||
|
# import superscript as ss
|
||||||
|
|
||||||
|
# from tra_analysis import analysis as an
|
||||||
|
import data as d
|
||||||
|
from collections import defaultdict
|
||||||
|
import json
|
||||||
|
import math
|
||||||
|
import numpy as np
|
||||||
|
import os
|
||||||
|
from os import system, name
|
||||||
|
from pathlib import Path
|
||||||
|
from multiprocessing import Pool
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
|
import time
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
# global exec_threads
|
||||||
|
|
||||||
|
|
||||||
|
# Screens
|
||||||
|
class HomeScreen(Screen):
|
||||||
|
pass
|
||||||
|
class SettingsScreen(Screen):
|
||||||
|
pass
|
||||||
|
class InfoScreen(Screen):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class StatsScreen(Screen):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class MyApp(MDApp):
|
||||||
|
def build(self):
|
||||||
|
self.theme_cls.primary_palette = "Red"
|
||||||
|
return Builder.load_file("design.kv")
|
||||||
|
def test():
|
||||||
|
print("test")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
MyApp().run()
|
@ -135,20 +135,20 @@ from concurrent.futures import ThreadPoolExecutor
|
|||||||
import time
|
import time
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
global exec_threads
|
# global exec_threads
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
global exec_threads
|
# global exec_threads
|
||||||
|
|
||||||
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("config.json")
|
config = load_config("red-alliance-analysis\data-analysis\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"]
|
||||||
@ -169,8 +169,8 @@ def main():
|
|||||||
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"]
|
||||||
@ -203,7 +203,7 @@ def main():
|
|||||||
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():
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ def matchloop(apikey, competition, data, tests): # expects 3D array with [Team][
|
|||||||
variable_data.append((data[team][variable], test))
|
variable_data.append((data[team][variable], test))
|
||||||
test_filtered.append(test)
|
test_filtered.append(test)
|
||||||
|
|
||||||
result_filtered = exec_threads.map(simplestats, variable_data)
|
result_filtered = map(simplestats, variable_data)
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
result_filtered = list(result_filtered)
|
result_filtered = list(result_filtered)
|
||||||
|
Loading…
Reference in New Issue
Block a user