Baseball Files
gd_players
Generate Player Stats using Day Player Records.
Uses the "Day Player" records found at the Y/M/D root of the GameDay XML
collection. One sub-directory lists all Batters playing that day, and
another sub-directory lists all Pitchers.
classes:
gdPlayerStats
gdBatterStats (gdPlayerStats)
gdPitcherStats (gdPlayerStats)
functions:
dispatch (cmd) - Module Command Dispatch
get_batter (pid, dts) - get batter stats
get_pitcher (pid, dts) - get pitcher stats
Developer@Sonnack.com
April 2012
function dispatch
Dispatch Command.
usage:
gd_players {command}
commands:
main - Default function
BatterStats - Generate Batter Stats
PitcherStats - Generate Pitcher Stats
function get_batter
Get Batter Stats and write TAB and HTML files.
function get_pitcher
Get Pitcher Stats and write TAB and HTML files.
function main
Default function.
type gdBatterStats
Batter Stats Class.
properties:
:now - Current Date
:dts - Dates List
:pid - Player ID
:records[] - Collected Player Records
.hdrs[] - Output Column Headers
.ab - Total At Bats
.h - Total Hits
.b1 - Singles
.b2 - Doubles
.b3 - Triples
.r - Total Runs
.hr - Total Home Runs
.rbi - Total Runs Batted In
.bb - Total Base on Balls (Walks)
.so - Total Strike Outs
methods:
write2file(fp) - write stats to 'fp' as TAB-delimited
write2html(fp) - write stats to 'fp' as HTML
str(obj) - Batter string
repr(obj) - JSON-like string
type gdPitcherStats
Pitcher Stats Class.
properties:
:now - Current Date
:dts - Dates List
:pid - Player ID
:records[] - Collected Player Records
.hdrs[] - Output Column Headers
.out - Outs Pitched (Innings x 3)
.whip - Total Walks Hits per Inning Pitched
.era - Earned Runs Average
.er - Earned Runs
.h - Hits (allowed)
.r - Runs (allowed)
.hr - Home Runs (allowed)
.so - Strikeouts
.bb - Walks
.hbp - Hit Batter
methods:
write2file(fp) - write stats to 'fp' as TAB-delimited
write2html(fp) - write stats to 'fp' as HTML
str(obj) - Batter string
repr(obj) - JSON-like string
type gdPlayerStats
Stats Base Class.
properties:
.now - Current Date
.dts - Dates List
.pid - Player ID
.name - Player Name (from PlayersDB)
.namekey - Player NameKey (from PlayersDB)
.records[] - Collected Player Records
methods:
len(obj) - number of records
obj[index] - get nth record
iter(obj) - record iterator