2727Score = namedtuple ('Score' , ['score' , 'percentile' ])
2828
2929# GLOBAL CONSTANTS
30- testNames = ['Pacer Test' , 'Flexed Arm\n Hang' , 'Mile Run' , 'Agility' ,
31- 'Push Ups' ]
32- testMeta = dict (zip (testNames , ['laps' , 'sec' , 'min:sec' , 'sec' , '' ]))
30+ test_names = ['Pacer Test' , 'Flexed Arm\n Hang' , 'Mile Run' , 'Agility' ,
31+ 'Push Ups' ]
32+ test_meta = dict (zip (test_names , ['laps' , 'sec' , 'min:sec' , 'sec' , '' ]))
3333
3434
3535def attach_ordinal (num ):
@@ -54,7 +54,7 @@ def format_score(scr, test):
5454 info (like for pushups) then don't add the carriage return to
5555 the string
5656 """
57- md = testMeta [test ]
57+ md = test_meta [test ]
5858 if md :
5959 return '{0}\n {1}' .format (scr , md )
6060 else :
@@ -63,10 +63,10 @@ def format_score(scr, test):
6363
6464def format_ycursor (y ):
6565 y = int (y )
66- if y < 0 or y >= len (testNames ):
66+ if y < 0 or y >= len (test_names ):
6767 return ''
6868 else :
69- return testNames [y ]
69+ return test_names [y ]
7070
7171
7272def plot_student_results (student , scores , cohort_size ):
@@ -75,12 +75,12 @@ def plot_student_results(student, scores, cohort_size):
7575 fig .subplots_adjust (left = 0.115 , right = 0.88 )
7676 fig .canvas .set_window_title ('Eldorado K-8 Fitness Chart' )
7777
78- pos = np .arange (len (testNames ))
78+ pos = np .arange (len (test_names ))
7979
80- rects = ax1 .barh (pos , [scores [k ].percentile for k in testNames ],
80+ rects = ax1 .barh (pos , [scores [k ].percentile for k in test_names ],
8181 align = 'center' ,
8282 height = 0.5 ,
83- tick_label = testNames )
83+ tick_label = test_names )
8484
8585 ax1 .set_title (student .name )
8686
@@ -95,7 +95,7 @@ def plot_student_results(student, scores, cohort_size):
9595 # Set the right-hand Y-axis ticks and labels
9696 ax2 = ax1 .twinx ()
9797
98- scoreLabels = [format_score (scores [k ].score , k ) for k in testNames ]
98+ scoreLabels = [format_score (scores [k ].score , k ) for k in test_names ]
9999
100100 # set the tick locations
101101 ax2 .set_yticks (pos )
@@ -156,11 +156,11 @@ def plot_student_results(student, scores, cohort_size):
156156
157157
158158student = Student ('Johnny Doe' , 2 , 'boy' )
159- scores = dict (zip (testNames ,
160- ( Score ( v , p ) for v , p in
161- zip ([ '7' , '48' , '12:52' , '17' , '14' ],
162- np . round ( np . random . uniform ( 0 , 1 ,
163- len (testNames )) * 100 , 0 )))))
159+ scores = dict (zip (
160+ test_names ,
161+ ( Score ( v , p ) for v , p in
162+ zip ([ '7' , '48' , '12:52' , '17' , '14' ] ,
163+ np . round ( np . random . uniform ( 0 , 100 , len (test_names )) , 0 )))))
164164cohort_size = 62 # The number of other 2nd grade boys
165165
166166arts = plot_student_results (student , scores , cohort_size )
0 commit comments