Skip to main content

Baseball features

The features a baseball surface is drawn from (sportypy._feature_classes.baseball).

BaseBaseballFeature​

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.

Attributes​

  • feature_radius (float): The radius needed to draw the feature. This may not be needed for all features. The default is 0.0
  • feature_thickness (float): 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
  • field_units (str): The units with which the feature is drawn. The default is "ft"

FieldConstraint​

The constraint around the bounding box of the field.

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

InfieldDirt​

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")

Attributes​

  • home_plate_circle_radius (float): The radius of the dirt circle surrounding home plate
  • foul_line_to_foul_grass (float): The distance from the outer edge of the foul line to the inner edge of the grass in foul territory
  • pitchers_plate_dist (float): The distance from the front edge of the pitcher's plate to the back tip of home plate
  • infield_arc_radius (float): The distance from the front edge of the pitcher's mound to the back of the infield dirt

InfieldGrass​

The grass that comprises the infield.

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

Attributes​

  • foul_line_to_infield_grass (float): The distance from the outer edge of the foul line to the outer edge of the infield grass
  • home_plate_circle_radius (float): The radius of the dirt circle surrounding home plate
  • baseline_distance (float): The distance of each baseline

HomePlate​

Home plate.

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

Attributes​

  • home_plate_edge_length (float): The length of a full side of home plate

Base​

A base on the diamond.

The base is where a runner is considered safe

Attributes​

  • base_side_length (float): The length of one side of a square base
  • adjust_x_left (bool): Whether or not to adjust the base's x anchor to the left
  • adjust_x_right (bool): Whether or not to adjust the base's x anchor to the right

PitchersMound​

The mound from which the pitcher throws.

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

PitchersPlate​

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

Attributes​

  • pitchers_plate_length (float): The length of the pitcher's plate (the dimension in the x direction)

BattersBox​

The box in which batters stand when batting.

The boxes are located around home plate

Attributes​

  • batters_box_length (float): The length of the batter's box (in the y direction) measured from the outside of the chalk lines
  • batters_box_width (float): The width of the batter's box (in the x direction) measured from the outside of the chalk lines
  • batters_box_y_adj (float): The shift off of center in the y direction that the batter's box needs to be moved to properly align

CatchersBox​

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

Attributes​

  • catchers_box_depth (float): The distance from the back tip of home plate to the back edge of the catcher's box

  • catchers_box_width (float): The distance between the outer edges of the catcher's box

  • batters_box_length (float): The length of the batter's box (in the y direction) measured from the outside of the chalk lines

  • batters_box_width (float): The width of the batter's box (in the x direction) measured from the outside of the chalk lines

  • catchers_box_shape (str): The shape of the catcher's box. Currently-supported values are:

    • "rectangle" (default behavior)
    • "trapezoid" (see sportypy.surfaces.LittleLeagueField for example)
  • batters_box_y_adj (float): The shift off of center in the y direction that the batter's box needs to be moved to properly align

FoulLine​

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)

Attributes​

  • is_line_1b (bool): Whether or not the foul line is the first base line
  • line_distance (float): The length of the foul line
  • batters_box_length (float): The length of the batter's box (in the y direction) measured from the outside of the chalk lines
  • batters_box_width (float): The width of the batter's box (in the x direction) measured from the outside of the chalk lines
  • batters_box_y_adj (float): The shift off of center in the y direction that the batter's box needs to be moved to properly align
  • home_plate_side_to_batters_box (float): The distance from the outer edge of the batter's box to the outer edge of home plate

RunningLane​

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

Attributes​

  • running_lane_length (float): 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
  • running_lane_depth (float): The straight-line distance from the outer edge of the first-base line to the outer edge of the running lane
  • running_lane_start_distance (float): The straight-line distance from the back tip of home plate to the start of the running lane