Baseball Files
chart_maker
Chart Maker.
usage:
module_name {command} {arguments}
commands:
games_back - All Divisions Games-Back Charts [1]
division_wins - All Divisions Wins Charts [1]
win_loss - All Teams Win-Loss Charts [1]
team_winloss - Team Win-Loss Percentage Chart[2]
team_500 - Team Games Above-Below .500 Chart [2]
team_runs - Team Runs Above-Below Win-Loss Chart [2]
team_rundiff - Team Run Difference Chart [2]
team_avg - Team AVG-OBP-SLG Chart [1]
target_field - Target Field Attendance
strikezone - Pitches [2]
demo - Demo (Team Logos)
test - Test function
main - Default function (sin/cos)
[1] Loads GameDay XML files.
[2] Loads GameDay TAB file.
classes:
small_chart (object)
percentage_chart (small_chart)
above_below_chart (small_chart)
run_diff_chart (small_chart)
functions:
team_winloss (tc, yr) - Team Win-Loss Percentage
team_500 (tc, yr) - Team Games Above-Below .500
team_runs (tc, yr) - Team Runs Above-Below Win-Loss
team_rundiff (tc, yr) - Team Run Difference
division_wins (yr) - Division Teams Wins (3 x 2)
division_wins_chart (msbs, lg, dv, yr) - Division Teams Wins
div_games_back (yr) - Games Back (3 Divisions x 2 Leagues)
div_games_back_chart (msbs, lg, dv, yr) - Games Back
teams_win_loss (yr) - Team Win-Loss (all 30 Teams)
team_win_loss (tc, yr, sz) - Team Win-Loss
win_loss_chart (msbs, tc, yr, sz) - Team Win-Loss chart
team_avg_obp_slg (tc, yr) - Team AVG/OBP/SLG
avg_obp_slg_chart (tc, yr, sz) - Team AVG/OBP/SLG chart
target_field () - Target Field Attendance
strikezone (gid) - Strike Zone Balls-Strikes
generate_team_winloss_chart (data, caption)
generate_team_500_chart (data, caption)
generate_runs_chart (data, caption)
generate_rundiff_chart (data, caption)
generate_division_wins_chart (dims, data, title)
generate_games_back_chart (dims, data, title)
generate_win_loss_chart (dims, data, title)
get_team_stats (tc, yr) - get team stats data
*get_pitch_data (tc, yr) - get pitch fx data
extract_win_loss (msbs, tc) - extract Team Win-Loss data from msb list
extract_division_wins (msbs, lg, dv) - extract Division Wins from msg blist
extract_games_back (msbs, lg, dv) - extract Division Games Back data from msb list
load_team_data (filename) - load team data table
load_target_field_data (yr) - load TF attendance data table
load_pitch_data (filename) - load pitch fx data table
demo () - Team Logos
test (args, tc, yr) - Test
main (args, tc, yr) - Default function
dispatch (cmd, args) - Module Command Dispatch
*planned
Developer@Sonnack.com
May 2012
function avg_obp_slg_chart
Team Season AVG/OBP/SLG Record.
function demo
Demo -- Team Logos.
function dispatch
Dispatch Command.
function div_games_back
Division Games Back Charts.
function div_games_back_chart
Create Games Back Chart for a given League and Division.
function division_wins
Division Wins Charts.
function division_wins_chart
Create Division Wins Chart for a given League and Division.
function extract_division_wins
Extract one Division's win record from a list of MSB records.
Output is a list of tuples:
(The tuples are listed in order by game-date.)
[... ( game-date, [..(tc,W)..] ) ...]
The second element of each tuple is an ordered list of tuples:
(The tuples are listed in order by team-code.)
... ( team-code, wins ) ...
function extract_games_back
Extract one Division's games back (GB) data from a list of MSB records.
Output is a list of tuples:
(The tuples are listed in order by game-date.)
[... ( game-date, [..(tc,GB)..] ) ...]
The second element of each tuple is an ordered list of tuples:
(The tuples are listed in order by team-code.)
... ( team-code, games-back ) ...
function extract_win_loss
Extract one Team's win-loss (W-L) data from a list of MSB records.
Output is a List of Tuples:
( game-date, game-id, team-wins, team-losses )
function generate_division_wins_chart
Create Divisions Wins Chart given a data set.
Input "data" is a list of tuples:
(The tuples are listed in order by game-date.)
(The game-date isn't currently used; ideally it should be p/o the X-axis.)
[... ( game-date, [..(tc,W)..] ) ...]
The second element of each tuple is an ordered list of tuples:
(The tuples are listed in order by team-code.)
... ( team-code, wins ) ...
function generate_games_back_chart
Create Games Back Chart given a data set.
Output is a list of tuples:
(The tuples are listed in order by game-date.)
(The game-date isn't currently used; ideally it should be p/o the X-axis.)
[... ( game-date, [..(tc,GB)..] ) ...]
The second element of each tuple is an ordered list of tuples:
(The tuples are listed in order by team-code.)
... ( team-code, games-back ) ...
function generate_rundiff_chart
Generate a Team RunDiff Chart given a data set.
function generate_runs_chart
Generate a Team Runs Chart given a data set.
function generate_team_500_chart
Create Above/Below .500 Chart given a data set.
function generate_team_winloss_chart
Create Above/Below .500 Chart given a data set.
function generate_win_loss_chart
Create Win-Loss Chart given a data set.
function get_team_stats
Load season game data to date for a given team and year.
Returns a List of Tuples:
(dt, nid, AVG, OBP, SLG)
function load_pitch_data
Load pitch data table for a given game.
function load_target_field_data
Load Target Field attendance data for a given year.
function load_team_data
Load season stats table for a given team and year.
0: Ws, 1:Ls, 2:Runs, 3:oppRuns, 4:Hits, 5:oppHits
function main
function strikezone
Generate a Strike Zone Chart.
pitch := [INN, T/B, Pit, Bat, etype, ptype, px, pz, sz_top, sz_bot]
function target_field
Generate a Target Field attendence chart.
function target_field_1
Generate a Target Field attendence chart.
function target_field_2
Generate a Target Field attendence chart.
function team_500
Generate a Team Above-Below .500 Chart (from the games table).
function team_avg_obp_slg
Team Season AVG/OBP/SLG Record.
function team_rundiff
Generate a RunDiff Chart (from the games table).
function team_runs
Generate a Runs Win-Lost Chart (from the games table).
function team_win_loss
Team Season Win/Loss Record.
function team_winloss
Generate a Team Win-Loss Percentage Chart (from the games table).
function teams_win_loss
All Teams Season Win/Loss Record.
function test
function win_loss_chart
Create Win-Loss Chart given a Team and Year.
lambda ZoneX
lambda ZoneY
type above_below_chart
Above/Below Chart class.
type percentage_chart
Percentage Chart class.
type run_diff_chart
Run Difference Chart class.
type small_chart
Small Chart base class