Baseball#

Baseball relies on the following parameterized features:

Extensions of the BaseFeature class to be specific to baseball fields.

The features are all parameterized by the basic characteristics of a baseball field. A user can manually specify their own field parameters in the BaseballField class that will adjust the placement of these features, however the features themselves will be consistent across all baseball surfaces.

@author: Ross Drucker

class sportypy._feature_classes.baseball.Base(base_side_length=0.0, adjust_x_left=False, adjust_x_right=False, *args, **kwargs)#

A base on the diamond.

The base is where a runner is considered safe

base_side_length#

The length of one side of a square base

Type:

float

adjust_x_left#

Whether or not to adjust the base’s x anchor to the left

Type:

bool

adjust_x_right#

Whether or not to adjust the base’s x anchor to the right

Type:

bool

class sportypy._feature_classes.baseball.BaseBaseballFeature(feature_radius=0.0, feature_thickness=0.0, feature_units='ft', *args, **kwargs)#

An extension of the BaseFeature class for baseball features.

The following attributes are specific to baseball features only. For more information on inherited attributes, please see the BaseFeature class definition. The default values are provided to ensure that the feature can at least be created.

feature_radius#

The radius needed to draw the feature. This may not be needed for all features. The default is 0.0

Type:

float

feature_thickness#

The thickness with which to draw the feature. This is normally given as the horizontal width of the feature in TV view, however it may be used to specify other thicknesses as needed. The default is 0.0

Type:

float

field_units#

The units with which the feature is drawn. The default is "ft"

Type:

str

class sportypy._feature_classes.baseball.BattersBox(batters_box_length=0.0, batters_box_width=0.0, batters_box_y_adj=0.0, *args, **kwargs)#

The box in which batters stand when batting.

The boxes are located around home plate

batters_box_length#

The length of the batter’s box (in the y direction) measured from the outside of the chalk lines

Type:

float

batters_box_width#

The width of the batter’s box (in the x direction) measured from the outside of the chalk lines

Type:

float

batters_box_y_adj#

The shift off of center in the y direction that the batter’s box needs to be moved to properly align

Type:

float

class sportypy._feature_classes.baseball.CatchersBox(catchers_box_depth=0.0, catchers_box_width=0.0, batters_box_length=0.0, batters_box_y_adj=0.0, catchers_box_shape='rectangle', *args, **kwargs)#

The box in which batters stand when batting.

The catcher’s box is located behind home plate, connecting to the back edges of the batters’ boxes

catchers_box_depth#

The distance from the back tip of home plate to the back edge of the catcher’s box

Type:

float

catchers_box_width#

The distance between the outer edges of the catcher’s box

Type:

float

batters_box_length#

The length of the batter’s box (in the y direction) measured from the outside of the chalk lines

Type:

float

batters_box_width#

The width of the batter’s box (in the x direction) measured from the outside of the chalk lines

Type:

float

catchers_box_shape#

The shape of the catcher’s box. Currently-supported values are:

  • "rectangle" (default behavior)

  • "trapezoid" (see sportypy.surfaces.LittleLeagueField for

    example)

Type:

str

batters_box_y_adj#

The shift off of center in the y direction that the batter’s box needs to be moved to properly align

Type:

float

class sportypy._feature_classes.baseball.FieldConstraint(feature_radius=0.0, feature_thickness=0.0, feature_units='ft', *args, **kwargs)#

The constraint around the bounding box of the field.

This can be a bit tricky, so large default values are set here.

class sportypy._feature_classes.baseball.FoulLine(is_line_1b=False, line_distance=0.0, batters_box_length=0.0, batters_box_width=0.0, batters_box_y_adj=0.0, home_plate_side_to_batters_box=0.0, *args, **kwargs)#

The lines that designate fair territory from foul territory.

Since a ball on the line is considered in fair territory, the outer edge of the baseline must lie in fair territory (aka the line y = +/- x)

is_line_1b#

Whether or not the foul line is the first base line

Type:

bool

line_distance#

The length of the foul line

Type:

float

batters_box_length#

The length of the batter’s box (in the y direction) measured from the outside of the chalk lines

Type:

float

batters_box_width#

The width of the batter’s box (in the x direction) measured from the outside of the chalk lines

Type:

float

batters_box_y_adj#

The shift off of center in the y direction that the batter’s box needs to be moved to properly align

Type:

float

home_plate_side_to_batters_box#

The distance from the outer edge of the batter’s box to the outer edge of home plate

Type:

float

class sportypy._feature_classes.baseball.HomePlate(home_plate_edge_length=0.0, *args, **kwargs)#

Home plate.

The back tip of home plate will be located at the origin.

home_plate_edge_length#

The length of a full side of home plate

Type:

float

class sportypy._feature_classes.baseball.InfieldDirt(home_plate_circle_radius=0.0, foul_line_to_foul_grass=0.0, pitchers_plate_dist=0.0, infield_arc_radius=0.0, *args, **kwargs)#

The dirt that comprises the infield.

This includes the base paths, the infield arc, and the home plate circle. The home plate circle may be drawn over in other shapes as needed (example: Detroit’s Comerica Park has a home plate shaped dirt area as the home plate “circle”)

home_plate_circle_radius#

The radius of the dirt circle surrounding home plate

Type:

float

foul_line_to_foul_grass#

The distance from the outer edge of the foul line to the inner edge of the grass in foul territory

Type:

float

pitchers_plate_dist#

The distance from the front edge of the pitcher’s plate to the back tip of home plate

Type:

float

infield_arc_radius#

The distance from the front edge of the pitcher’s mound to the back of the infield dirt

Type:

float

class sportypy._feature_classes.baseball.InfieldGrass(foul_line_to_infield_grass=0.0, home_plate_circle_radius=0.0, baseline_distance=0.0, *args, **kwargs)#

The grass that comprises the infield.

This is the area between the basepaths and the outfield that give the infield definition

foul_line_to_infield_grass#

The distance from the outer edge of the foul line to the outer edge of the infield grass

Type:

float

home_plate_circle_radius#

The radius of the dirt circle surrounding home plate

Type:

float

baseline_distance#

The distance of each baseline

Type:

float

class sportypy._feature_classes.baseball.PitchersMound(feature_radius=0.0, feature_thickness=0.0, feature_units='ft', *args, **kwargs)#

The mound from which the pitcher throws.

The pitcher’s plate (the rubber) is located on this mound, but is drawn separately

class sportypy._feature_classes.baseball.PitchersPlate(pitchers_plate_length=0.0, *args, **kwargs)#

The pitcher’s plate.

This is also known as the rubber. It is where a pitcher must throw the ball from to start the play

pitchers_plate_length#

The length of the pitcher’s plate (the dimension in the x direction)

Type:

float

class sportypy._feature_classes.baseball.RunningLane(running_lane_depth=0.0, running_lane_length=0.0, running_lane_start_distance=0.0, *args, **kwargs)#

The running lane along the first base line.

This is entirely in foul territory. The depth should be measured from the foul-side edge of the baseline to the outer edge of the running lane mark

running_lane_length#

The straight-line length of the running lane measured from the point nearest home plate. As an example, if the base lines are 90 feet, and the running lane starts a distance of 45 feet down the line from the back tip of home plate, and extends 3 feet beyond first base, this parameter would be given as 48.0

Type:

float

running_lane_depth#

The straight-line distance from the outer edge of the first-base line to the outer edge of the running lane

Type:

float

running_lane_start_distance#

The straight-line distance from the back tip of home plate to the start of the running lane

Type:

float