-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #375 from tracerrx/pitch-data
Pitch data
- Loading branch information
Showing
13 changed files
with
192 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#A list of mlb pitch types appearing in statcast | ||
#https://www.daktronics.com/en-us/support/kb/DD3312647 | ||
#Dont change the index, but feel free to change | ||
#the descriptions | ||
|
||
PITCH_LONG = { | ||
"AB": "Automatic Ball", | ||
"AS": "Automatic Strike", | ||
"CH": "Change-up", | ||
"CU": "Curveball", | ||
"EP": "Eephus", | ||
"FC": "Cutter", | ||
"FF": "4 Seam Fastball", #MLB default is "Four-Seam Fastball" | ||
"FO": "Forkball", | ||
"FS": "Splitter", | ||
"FT": "2 Seam Fastball", #MLB default is "Two-Seam Fastball" | ||
"GY": "Gyroball", | ||
"IN": "Intentional Ball", | ||
"KC": "Knuckle Curve", | ||
"KN": "Knuckleball", | ||
"NP": "No Pitch", | ||
"SC": "Screwball", | ||
"SI": "Sinker", | ||
"SL": "Slider", | ||
"UN": "Unknown" | ||
} | ||
PITCH_SHORT = { | ||
"AB": "AB", | ||
"AS": "AS", | ||
"CH": "CH", | ||
"CU": "CU", | ||
"EP": "EP", | ||
"FC": "FC", | ||
"FF": "FF", | ||
"FO": "FO", | ||
"FS": "FS", | ||
"FT": "FT", | ||
"GY": "GY", | ||
"IN": "IN", | ||
"KC": "KC", | ||
"KN": "KN", | ||
"NP": "NP", | ||
"SC": "SC", | ||
"SI": "SI", | ||
"SL": "SL", | ||
"UN": "UN" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
from data.game import Game | ||
|
||
import data.pitches | ||
|
||
class Pitches: | ||
def __init__(self, game: Game): | ||
self.balls = game.balls() | ||
self.strikes = game.strikes() | ||
last_pitch = game.last_pitch() | ||
if last_pitch is None: | ||
self.last_pitch_speed = "0" | ||
self.last_pitch_type = "UK" | ||
self.last_pitch_type_long = "Unknown" | ||
else: | ||
self.last_pitch_speed = f"{round(last_pitch[0])}" | ||
self.last_pitch_type = data.pitches.PITCH_SHORT[last_pitch[1]] | ||
self.last_pitch_type_long = data.pitches.PITCH_LONG[last_pitch[1]] | ||
|
||
def __str__(self) -> str: | ||
return f"Count: {self.balls} - {self.strikes}. Last pitch: {self.last_pitch_speed}mph {self.last_pitch_type} {self.last_pitch_long}" |
Oops, something went wrong.