mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-27 01:59:08 +00:00
superscript.py - v 1.0.4.001
changelog: - grammar fixes
This commit is contained in:
parent
a8f3598bbe
commit
57eda3815b
BIN
data analysis/__pycache__/superscript.cpython-37.pyc
Normal file
BIN
data analysis/__pycache__/superscript.cpython-37.pyc
Normal file
Binary file not shown.
@ -1,11 +1,13 @@
|
|||||||
#Titan Robotics Team 2022: Data Analysis Script
|
#Titan Robotics Team 2022: Super Script
|
||||||
#Written by Arthur Lu & Jacob Levine
|
#Written by Arthur Lu & Jacob Levine
|
||||||
#Notes:
|
#Notes:
|
||||||
#setup:
|
#setup:
|
||||||
|
|
||||||
__version__ = "1.0.4.000"
|
__version__ = "1.0.4.001"
|
||||||
|
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
1.0.4.001:
|
||||||
|
- grammar fixes
|
||||||
1.0.4.000:
|
1.0.4.000:
|
||||||
- actually pushes to firebase
|
- actually pushes to firebase
|
||||||
1.0.3.001:
|
1.0.3.001:
|
||||||
@ -37,36 +39,38 @@ import os
|
|||||||
import glob
|
import glob
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
# Use a service account
|
def titanservice():
|
||||||
cred = credentials.Certificate('keys/firebasekey.json')
|
|
||||||
firebase_admin.initialize_app(cred)
|
|
||||||
|
|
||||||
db = firestore.client()
|
# Use a service account
|
||||||
|
cred = credentials.Certificate('keys/firebasekey.json')
|
||||||
|
firebase_admin.initialize_app(cred)
|
||||||
|
|
||||||
#get all the data
|
db = firestore.client()
|
||||||
|
|
||||||
analysis.generate_data("data/bdata.csv", 100, 5, -10, 10)
|
#get all the data
|
||||||
|
|
||||||
source_dir = 'data'
|
analysis.generate_data("data/bdata.csv", 100, 5, -10, 10)
|
||||||
file_list = glob.glob(source_dir + '/*.csv') #supposedly sorts by alphabetical order, skips reading teams.csv because of redundancy
|
|
||||||
data = []
|
source_dir = 'data'
|
||||||
files = [fn for fn in glob.glob('data/*.csv')
|
file_list = glob.glob(source_dir + '/*.csv') #supposedly sorts by alphabetical order, skips reading teams.csv because of redundancy
|
||||||
|
data = []
|
||||||
|
files = [fn for fn in glob.glob('data/*.csv')
|
||||||
if not os.path.basename(fn).startswith('teams')]
|
if not os.path.basename(fn).startswith('teams')]
|
||||||
|
|
||||||
#for file_path in file_list:
|
#for file_path in file_list:
|
||||||
# if not os.path.basename(file_list).startswith("teams")
|
# if not os.path.basename(file_list).startswith("teams")
|
||||||
# data.append(analysis.load_csv(file_path))
|
# data.append(analysis.load_csv(file_path))
|
||||||
|
|
||||||
for i in files:
|
for i in files:
|
||||||
data.append(analysis.load_csv(i))
|
data.append(analysis.load_csv(i))
|
||||||
|
|
||||||
stats = []
|
stats = []
|
||||||
measure_stats = []
|
measure_stats = []
|
||||||
teams = analysis.load_csv("data/teams.csv")
|
teams = analysis.load_csv("data/teams.csv")
|
||||||
|
|
||||||
#assumes that team number is in the first column, and that the order of teams is the same across all files
|
#assumes that team number is in the first column, and that the order of teams is the same across all files
|
||||||
#unhelpful comment
|
#unhelpful comment
|
||||||
for measure in data: #unpacks 3d array into 2ds
|
for measure in data: #unpacks 3d array into 2ds
|
||||||
|
|
||||||
measure_stats = []
|
measure_stats = []
|
||||||
|
|
||||||
@ -108,11 +112,11 @@ for measure in data: #unpacks 3d array into 2ds
|
|||||||
|
|
||||||
stats.append(list(measure_stats))
|
stats.append(list(measure_stats))
|
||||||
|
|
||||||
json_out = {}
|
json_out = {}
|
||||||
|
|
||||||
for i in range(len(stats)):
|
for i in range(len(stats)):
|
||||||
json_out[files[i]]=str(stats[i])
|
json_out[files[i]]=str(stats[i])
|
||||||
|
|
||||||
print(json_out)
|
print(json_out)
|
||||||
|
|
||||||
db.collection(u'stats').document(u'stats-noNN').set(json_out)
|
db.collection(u'stats').document(u'stats-noNN').set(json_out)
|
||||||
|
Loading…
Reference in New Issue
Block a user