Baseball Files
team_table
Generate Team Games Table.
classes:
gdTable - GameDay Games Table Class
gdStatsRecord
functions:
dispatch (cmd,..) - Module Command Dispatch
main (tc, dt0, dt1,...) - generate table for given team and dates
do_years ([tc]) - generate tables for all seasons
do_teams ([yr]) - generate tables for all teams (this season)
PitcherStyle (pname) - get CSS style for a given pitcher
Developer@Sonnack.com
April 2012
function PitcherStyle
Get Pitcher style string.
function dispatch
Dispatch Command.
usage:
team_table {command} [{team-code} [{stat-year}]]
commands:
main - [tc [yr]]
args - [tc] {from-dt} {to-dt} [{title}] [{ftag}]
spcl - [tc]
AllTeams -
AllYears - [tc]
function do_teams
Generate Team Tables for all Teams.
function do_years
Generate Team Tables for all years.
function main
Generate Team Table for given date range.
Writes the Table TAB and HTML files for the date range provided.
Returns Table object.
type gdStatsRecord
Table Stats Record Class.
properties:
.nbr - Game Number
.dt - Game Date
.gid - Game ID
.r_away - Away Runs
.r_home - Home Runs
.score - Score (string: "#-#")
.streak - Winning (+) or losing (-) streak
.home_game - (True)
.xxx_w - Team Wins
.xxx_l - Team Loses
.xxx_r - Game Runs
.xxx_h - Game Hits
.xxx_e - Game Errs
.xxx_rtot - Total Runs
.xxx_htot - Total Hits
.xxx_etot - Total Errs
.xxx_rpg - Runs per Game
.xxx_hpg - Hits per Game
.xxx_epg - Errs per Game
("xxx" = "min" or "opp")
type gdTable
GameDay Games Table Class.
properties:
.dt0 - First Date of sequence
.team_code - Team Code (e.g. "min")
.team_name - Team Name Tuple
.nbr_games - Number of games
.statdata - array of stat data
.win - Minnesota Total Wins
.lose - Minnesota Total Losses
.pct - Minnesota Win/lose Percent
(where xxx is min and opp)
.xxx_rtot - Total Runs
.xxx_htot - Total Hits
.xxx_etot - Total Errs
.xxx_runs[] - List of Runs
.xxx_hits[] - List of Runs
.xxx_errs[] - List of Runs
.xxx_rpg - Runs Per Game
.xxx_hpg - Hits Per Game
.xxx_epg - Errs Per Game
.xxx_rmax, .xxx_rmin - Max, Min Runs
.xxx_hmax, .xxx_hmin - Max, Min Hits
.xxx_emax, .xxx_emin - Max, Min Errs
.dif_runs[] - List of Run Deltas
.dif_hits[] - List of Hit Deltas
.dif_rmax, .dif_rmin - Max, Min Run Delta
.dif_hmax, .dif_hmin - Max, Min Hit Delta
.min_sp_out - Minnesota Starting Pitcher Outs
.min_sp_er - Minnesota Starting Pitcher ER
.min_sp_era - Minnesota Starting Pitcher ERA
.min_bp_out - Minnesota Bullpen Outs
.min_bp_er - Minnesota Bullpen ER
.min_bp_era - Minnesota Bullpen ERA
methods:
.write_text () - write output file
.write_html () - write HTML page
.write2file (fp) - write table to fp
.write2html (fp) - write HTML table to fp
.list_stats () - list statdata array
.games_string () - smmary string of game stats
.sp_string () - summary string of starting pitching stats
.bp_string () - summary string of bullpen pitching stats
obj[n] - Gets Nth Game
len(obj) - Number of Games (length of the rs, hs, es arrays)
iter(obj) - Get Games iterator
str(obj) - List of Games string
repl(obj) - JSON-like string