From 57eda3815b9e5f1d1bc768b3fd13767decac2f5f Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Tue, 26 Feb 2019 23:18:26 -0600 Subject: [PATCH] superscript.py - v 1.0.4.001 changelog: - grammar fixes --- .../__pycache__/superscript.cpython-37.pyc | Bin 0 -> 2402 bytes data analysis/superscript.py | 120 +++++++++--------- 2 files changed, 62 insertions(+), 58 deletions(-) create mode 100644 data analysis/__pycache__/superscript.cpython-37.pyc diff --git a/data analysis/__pycache__/superscript.cpython-37.pyc b/data analysis/__pycache__/superscript.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8cb176ff939de69c7144f7b7ba414f15bcc9e744 GIT binary patch literal 2402 zcma)8&2QT_6end`mgSFpHfe(%gq`N1bG>Z9fFj7cwZMR(C<^q@f=DOGBJHq~C6}bK z#E?!IcJ9u**vIW3*#DyIPWcCRC@^%7beyEvWim)TzW4ZhU*wa&?R0zu&!2Zsj(+PR z^p{zz9tVg=Fw`+j3{k`|#mu1&t1*()Xbs-=q&6XxU<9-abe+~MO%j*7R|8D8KLX=h$5 z&;nzm$-KTmCD!h|!R(P_b>=S2@oSWh_U2yUFmD%h%i0)~gf*G}GctVETHq(>9GCUe zyG8v8dc9q`1(`Pi$uHam*um)S4=)kyYQXRepS1y}`3|2B3-ScL!>?bJzL5dvP`7lu z@Xzr%pn~Ln=`u9NWy{VWDcn1#?C6fw>li(--38Qc(Jea6Wt{~%BIR1SUT&0|z+WrY ziuGcn*ks*B9VA=jc6qDZDO&Spv1Poo)bx$aBq}JJ*p+3S|{|Kvng=MHEmZ6qd zhFW5^=a*Q82fU_8)SE`oU6`3CsE2DWPFz`4QS1b&BYvaJQVmK3d(PSG}Xfh_;= z5)}=|e5dfvmwA8p5(!l9p5C+BYAmz*darc#R?#rl&vCI^)D3lj-Z^j4OQg4p-E)%_ zJio;tlKBpUDCWDxuCc)oG?kravs*v%GxcEA9bnOaqq20?HND`$(9Hc(u_8t~b06F@8Zopa`6!=%? zt!Zw!s%suiRF70nrYbUx^l{~xc9ljGUiokVrB*))ecW>@r$4BiQTjWQYk>a#@bSZ= za1x31=()_^@K~!OE%yie`*3X~+}rWlk?m_y8YO2+sH0^Ih^3h7{`Bm=KX^ti{WM-0+N4duRikBf_cOeSlfSJh32Q8N>#R-dKWvuC~A(j=0$9&@P$G-HUQ>aNNZMhuW? zSER!93o+wiG@VL|<;IC=+?BTqn0CfI`xVl_J&DkF&(U0Al5_EY3}P1r4ryw<$5L5Wc5F>Z>f5F*q(Hg^rl;&^RU=Hfd(9 zDlFuV$y8^;BLzKuX(N*Y-Frr*&hzee?W$3LNzuCRFpW?|5X>A-IbP-fsAK z8)$-k(shWl=Dpi{>YwlO}}zrx3h`&9M6$G!0dIaRv5xLGZhNMsuPA+ ze-B{khhdcK<4lI3+y!-ewCrh-cVJ0<>uCZX;*@qygo6JLViuX&$fi->GfMR|pG?oF nlTNM48_}9;C~e5z!6ajO!Vg_wDf7J|8>B{vhuiS;u7A$I*bSlV literal 0 HcmV?d00001 diff --git a/data analysis/superscript.py b/data analysis/superscript.py index 0c98034a..f2c45db3 100644 --- a/data analysis/superscript.py +++ b/data analysis/superscript.py @@ -1,11 +1,13 @@ -#Titan Robotics Team 2022: Data Analysis Script +#Titan Robotics Team 2022: Super Script #Written by Arthur Lu & Jacob Levine #Notes: #setup: -__version__ = "1.0.4.000" +__version__ = "1.0.4.001" __changelog__ = """changelog: +1.0.4.001: + - grammar fixes 1.0.4.000: - actually pushes to firebase 1.0.3.001: @@ -37,82 +39,84 @@ import os import glob import numpy as np -# Use a service account -cred = credentials.Certificate('keys/firebasekey.json') -firebase_admin.initialize_app(cred) +def titanservice(): + + # Use a service account + cred = credentials.Certificate('keys/firebasekey.json') + firebase_admin.initialize_app(cred) -db = firestore.client() + db = firestore.client() -#get all the data + #get all the data -analysis.generate_data("data/bdata.csv", 100, 5, -10, 10) + analysis.generate_data("data/bdata.csv", 100, 5, -10, 10) -source_dir = 'data' -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')] + source_dir = 'data' + 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')] -#for file_path in file_list: -# if not os.path.basename(file_list).startswith("teams") -# data.append(analysis.load_csv(file_path)) + #for file_path in file_list: + # if not os.path.basename(file_list).startswith("teams") + # data.append(analysis.load_csv(file_path)) -for i in files: - data.append(analysis.load_csv(i)) + for i in files: + data.append(analysis.load_csv(i)) -stats = [] -measure_stats = [] -teams = analysis.load_csv("data/teams.csv") + stats = [] + measure_stats = [] + 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 -#unhelpful comment -for measure in data: #unpacks 3d array into 2ds + #assumes that team number is in the first column, and that the order of teams is the same across all files + #unhelpful comment + for measure in data: #unpacks 3d array into 2ds - measure_stats = [] + measure_stats = [] - for i in range(len(measure)): #unpacks into specific teams + for i in range(len(measure)): #unpacks into specific teams - ofbest_curve = [None] - r2best_curve = [None] + ofbest_curve = [None] + r2best_curve = [None] - line = measure[i] + line = measure[i] - #print(line) + #print(line) - x = list(range(len(line))) - eqs, rmss, r2s, overfit = analysis.optimize_regression(x, line, 10, 1) + x = list(range(len(line))) + eqs, rmss, r2s, overfit = analysis.optimize_regression(x, line, 10, 1) - beqs, brmss, br2s, boverfit = analysis.select_best_regression(eqs, rmss, r2s, overfit, "min_overfit") + beqs, brmss, br2s, boverfit = analysis.select_best_regression(eqs, rmss, r2s, overfit, "min_overfit") - #print(eqs, rmss, r2s, overfit) - - ofbest_curve.append(beqs) - ofbest_curve.append(brmss) - ofbest_curve.append(br2s) - ofbest_curve.append(boverfit) - ofbest_curve.pop(0) + #print(eqs, rmss, r2s, overfit) + + ofbest_curve.append(beqs) + ofbest_curve.append(brmss) + ofbest_curve.append(br2s) + ofbest_curve.append(boverfit) + ofbest_curve.pop(0) - #print(ofbest_curve) + #print(ofbest_curve) - beqs, brmss, br2s, boverfit = analysis.select_best_regression(eqs, rmss, r2s, overfit, "max_r2s") + beqs, brmss, br2s, boverfit = analysis.select_best_regression(eqs, rmss, r2s, overfit, "max_r2s") - r2best_curve.append(beqs) - r2best_curve.append(brmss) - r2best_curve.append(br2s) - r2best_curve.append(boverfit) - r2best_curve.pop(0) + r2best_curve.append(beqs) + r2best_curve.append(brmss) + r2best_curve.append(br2s) + r2best_curve.append(boverfit) + r2best_curve.pop(0) - #print(r2best_curve) - - measure_stats.append(teams[i] + ["|"] + list(analysis.basic_stats(line, 0, 0)) + ["|"] + list(analysis.histo_analysis(line, 1, -3, 3)) + ["|"] + ofbest_curve + ["|"] + r2best_curve) + #print(r2best_curve) + + measure_stats.append(teams[i] + ["|"] + list(analysis.basic_stats(line, 0, 0)) + ["|"] + list(analysis.histo_analysis(line, 1, -3, 3)) + ["|"] + ofbest_curve + ["|"] + r2best_curve) - stats.append(list(measure_stats)) - -json_out = {} - -for i in range(len(stats)): - json_out[files[i]]=str(stats[i]) + stats.append(list(measure_stats)) + + json_out = {} + + for i in range(len(stats)): + 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)