None of this is being used. Most of it was abandoned. Just some brainstorming on how to approach presenting the data and what metrics to use.

Change csv file to have a column label for the various obstacles and points so it can be indexed into easier. Chagne index_col to corrospond. Finish graphs.


In [1]:
def test():
    print "testing to see if migrated repository works"

In [2]:
def dash():
    print "-" * 20

In [3]:
# import libraries
import pandas as pd
import matplotlib.pyplot as plot
import matplotlib
matplotlib.style.use('ggplot')
import random as rng
import numpy as np
%matplotlib inline

# take a url of the csv or can read the csv locally into a pandas data frame
data = pd.read_csv("robodummy.csv", index_col=0)

9 defenses

  1. Low Bar
  2. ALLIANCE selected
  3. Audience selected
  4. ALLIANCE selected
  5. ALLIANCE selected

Data structure choices include:

  • Pandas dataframes
  • Numpy Arrays
  • Object oriented
  • Dictionary

In [4]:
# Object oriented approach, would have to feed csv data into objects

# maybe get rid of this and just use library analysis tools
class Robot(object):

	def __init__(self, name, alliance, auto_points, points):

		self.name = name
		self.alliance = alliance
		self.auto_points = auto_points
		self.points = points

	def points_per_sec(self):
		return self.points / 150

	def auto_points_per_sec(self):
		return self.auto_points / 15

	def get_name(self):
		return self.name

	def get_alliance(self):
		return self.alliance

In [10]:
data


Out[10]:
Cougar Tech Webster PIttsford Rush Henrietta
Metrics
Auto Points 10.00 15.0 5.0 20.00
Points 35.00 45.0 15.0 55.00
Low Bar 1.00 1.0 1.0 1.00
Portcullis 1.00 0.5 1.0 0.50
Cheval de Frise 1.00 1.0 1.0 0.75
Moat 0.25 1.0 1.0 0.30
Ramparts 0.50 1.0 0.3 0.50
Drawbridge 0.50 1.0 0.5 0.30
Sally Port 1.00 0.3 0.5 0.90
Rock Wall 0.75 0.7 0.9 0.50
Rough Terrain 0.30 0.5 0.9 1.00

In [5]:
# needs to be changed to align with new csv formatting 
def analyze(dataframe, team):
    total_points = dataframe[team]['Points'] + dataframe[team]['Auto Points']
    cumulative_success_rate = 4
    pps = dataframe[team]['Points'] / 150
    auto_pps = dataframe[team]['Auto Points'] / 15
    
    # return a data frame instead 
    return(total_points, pps, auto_pps)

stuff = analyze(data, 'Cougar Tech')
print stuff


(45.0, 0.23333333333333334, 0.66666666666666663)

Analysis Functions:


In [12]:
data.plot.bar()


Out[12]:
<matplotlib.axes._subplots.AxesSubplot at 0x109c00310>

In [ ]:
print data.shape[0]
data[1][1]

In [ ]:
n_groups = data.shape[0]

fig, ax = plot.subplots()

index = np.arange(n_groups)
bar_width = 0.35

opacity = 0.4
error_config = {'ecolor': '0.3'}

rects1 = plot.bar(index, data["Cougar Tech"], bar_width,
                 alpha=opacity,
                 color='b',
                 error_kw=error_config,
                 label='Men')

plot.xlabel('Group')
plot.ylabel('Scores')
plot.title('Scores by group and gender')
plot.xticks(index + bar_width, data[])
plot.legend()

plot.tight_layout()
plot.show()