Hockey#

Hockey relies on the following parameterized features:

Extensions of the BaseFeature class to be specific to ice hockey rinks.

The features are all parameterized by the basic characteristics of an ice rink. A user can manually specify their own rink parameters in the HockeyRink class that will adjust the placement of these features, however the features themselves will be consistent across all hockey surfaces.

@author: Ross Drucker

class sportypy._feature_classes.hockey.BaseHockeyFeature(rink_length=0.0, rink_width=0.0, feature_radius=0.0, feature_thickness=0.0, feature_units='ft', *args, **kwargs)#

An extension of the BaseFeature class for hockey features.

The following attributes are specific to hockey 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.

rink_length#

The length of the rink in TV view. The default is 0.0

Type:

float

rink_width#

The width of the rink in TV view. The default is 0.0

Type:

float

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.hockey.Boards(rink_length=0.0, rink_width=0.0, feature_radius=0.0, feature_thickness=0.0, feature_units='ft', *args, **kwargs)#

A parameterization of the boards of a hockey rink.

The method below specifies one half of the rink’s boards. The rest of the boards are produced via a reflection over the x-axis when viewing the rink in TV view.

The rink’s boards are rounded in the arc of a circle of a specified radius, so the x and y coordinates of its center must be taken and shifted to their correct location on the ice surface

class sportypy._feature_classes.hockey.BoardsConstraint(rink_length=0.0, rink_width=0.0, feature_radius=0.0, feature_thickness=0.0, feature_units='ft', *args, **kwargs)#

A parameterization of the constraint of the boards of a hockey rink.

This corresponds to the inner edges of the boards and is used to constrain other features from extending beyond the inner boundary of the ice rink.

Unlike the Boards class (defined above), this feature is designed to function over the entire surface of an ice rink

class sportypy._feature_classes.hockey.CenterFaceoffCircle(rink_length=0.0, rink_width=0.0, feature_radius=0.0, feature_thickness=0.0, feature_units='ft', *args, **kwargs)#

A parameterization of the faceoff circle at the center of a hockey rink.

The center faceoff circle is where the each period of the game begins. It differs from the non-centered faceoff circles in that there are no adjoining hash marks on this circle. It is also a different color than the non-centered faceoff circles. Its line thickness should be given by minor_line_thickness as this is a minor line on the ice surface

class sportypy._feature_classes.hockey.CenterFaceoffSpot(rink_length=0.0, rink_width=0.0, feature_radius=0.0, feature_thickness=0.0, feature_units='ft', *args, **kwargs)#

A parameterization of the center faceoff spot of a hockey rink.

The center faceoff spot is the spot at which the game begins. Its center should lie directly in the center of the ice surface. Its radius is passed as a key in rink_params

class sportypy._feature_classes.hockey.CenterLine(center_faceoff_spot_gap=0.0, *args, **kwargs)#

A parameterization of the center line of a hockey rink.

The center line is the line that divides the ice surface in half. Its center should lie directly in the center of the ice surface. Its line thickness should be given by major_line_thickness as this is a major line on the ice surface

center_faceoff_spot_gap#

The gap in the center line that surrounds the center faceoff spot. This is measured between the inner edges of the two halves of the center line

Type:

float

class sportypy._feature_classes.hockey.DefensiveZone(nzone_length=0.0, *args, **kwargs)#

A parameterization of the defensive zone of a hockey rink.

The offensive zone is the left “third” of the rink in TV view. This is the area that a team defends when attacking from left to right

nzone_length#

The length of the neutral zone, measured from the interior edges of the zone lines (blue lines)

Type:

float

class sportypy._feature_classes.hockey.GoalCreaseFill(crease_style='', crease_length=0.0, crease_width=0.0, notch_dist_x=0.0, notch_width=0.0, *args, **kwargs)#

A parameterization of the goal crease’s filling.

The goal crease is the area where a goaltender plays their position. It is comprised of two components: the outline of the crease (see documentation for GoalCreaseOutline class), and the filling in its boundary. The goal crease may have two notches (one on each side of the line y = 0).

crease_length#

The distance from the center of the goal line to the start of the arc of the goal crease

Type:

float

crease_width#

The exterior width of the goal crease

Type:

float

notch_dist_x#

The distance from the center of the goal line to the notch (if one exists) in the goal crease

Type:

float

notch_width#

The width of the notch (if one exists) in the goal crease

Type:

float

crease_style#
The style of goal crease to implement. Viable options are:
  • nhl98the current iteration of the NHL goal crease. This is

    what is used for most professional leagues

  • nhl92the previous iteration of an NHL goal crease. It is drawn

    as a semi-circle with two L-shaped notches at the edge of the crease intersecting the semi-circle

  • ushl1the current iteration of a USA Hockey goal crease. This

    is what is currently used in the USHL (United States Hockey League)

Type:

str

class sportypy._feature_classes.hockey.GoalCreaseOutline(crease_style='', crease_length=0.0, crease_width=0.0, notch_dist_x=0.0, notch_width=0.0, *args, **kwargs)#

A parameterization of the goal crease’s outline.

The goal crease is the area where a goaltender plays their position. It is comprised of two components: the outline of the crease, and the filling in its boundary (see documentation for GoalCreaseFill class). The goal crease may have two notches (one on each side of the line y = 0).

crease_length#

The distance from the center of the goal line to the start of the arc of the goal crease

Type:

float

crease_width#

The exterior width of the goal crease

Type:

float

notch_dist_x#

The distance from the center of the goal line to the notch (if one exists) in the goal crease

Type:

float

notch_width#

The width of the notch (if one exists) in the goal crease

Type:

float

crease_style#
The style of goal crease to implement. Viable options are:
  • nhl98the current iteration of the NHL goal crease. This is

    what is used for most professional leagues

  • nhl92the previous iteration of an NHL goal crease. It is drawn

    as a semi-circle with two L-shaped notches at the edge of the crease intersecting the semi-circle

  • ushl1the current iteration of a USA Hockey goal crease. This

    is what is currently used in the USHL (United States Hockey League)

Type:

str

class sportypy._feature_classes.hockey.GoalFrame(goal_mouth_width=0.0, goal_back_width=0.0, goal_depth=0.0, post_diameter=0.0, *args, **kwargs)#

A parameterization of a goal frame.

The goal frame is where the puck enters after crossing the goal line to score a legal goal. The front face of the goal is flush with the goal line, while the back edge features rounded corners and expands outside of the front posts. The goal frame is composed of two pieces: the frame (this class) and the fill (see GoalFrameFill documentation)

goal_mouth_width#

The interior distance between the goalposts

Type:

float

goal_back_width#

The exterior distance between the widest part of the goal frame’s footprint

Type:

float

goal_depth#

The depth of the goal frame from the center of the goal line to the exterior of the back pipe of the goal frame

Type:

float

post_diameter#

The diameter of the posts of the goal frame

Type:

float

class sportypy._feature_classes.hockey.GoalFrameFill(goal_mouth_width=0.0, goal_back_width=0.0, goal_depth=0.0, post_diameter=0.0, *args, **kwargs)#

A parameterization of the filling of a goal frame.

The goal frame is where the puck enters after crossing the goal line to score a legal goal. The front face of the goal is flush with the goal line, while the back edge features rounded corners and expands outside of the front posts. The goal frame is composed of two pieces: the frame (see GoalFrame documentation) and the fill (this class)

goal_mouth_width#

The interior distance between the goalposts

Type:

float

goal_back_width#

The exterior distance between the widest part of the goal frame’s footprint

Type:

float

goal_depth#

The depth of the goal frame from the center of the goal line to the exterior of the back pipe of the goal frame

Type:

float

post_diameter#

The diameter of the posts of the goal frame

Type:

float

class sportypy._feature_classes.hockey.GoalLine(rink_length=0.0, rink_width=0.0, feature_radius=0.0, feature_thickness=0.0, feature_units='ft', *args, **kwargs)#

A parameterization of the goal lines of a hockey rink.

The goal lines are the lines over which a puck must cross (within the goal frame) in order to be considered a goal. Its line thickness should be given by minor_line_thickness as this is a minor line on the ice surface

class sportypy._feature_classes.hockey.GoaltendersRestrictedArea(short_base_width=0.0, long_base_width=0.0, *args, **kwargs)#

A parameterization of the goaltender’s restricted area of a hockey rink.

The goaltender’s restricted area marks where a goaltender is legally allowed to handle the puck behind the net. This is often referred to as “the trapezoid” as it is trapezoidal in shape. Its line thickness should be given by minor_line_thickness as this is a minor line on the ice surface.

NOTE: This is not a requirement in all leagues, and may be omitted via the has_trapezoid key in the rink_params passed to the HockeyRink class

short_base_width#

The exterior base-width of the trapezoid (should it exist) that along the goal line

Type:

float

long_base_width#

The exterior base-width of the trapezoid (should it exist) that lies along the boards

Type:

float

class sportypy._feature_classes.hockey.NODZoneFaceoffSpotRing(rink_length=0.0, rink_width=0.0, feature_radius=0.0, feature_thickness=0.0, feature_units='ft', *args, **kwargs)#

A parameterization of the off-centered faceoff spot of a hockey rink.

The non-centered faceoff spots are located in the neutral, offensive and defensive zones of the ice, with one on each side of the x-axis. These spots differ from the center faceoff spot because they have a larger diameter, differ in color, and have a colored stripe that runs through its center.

This class is responsible for creating the outer ring, not the colored stripe running through it. Please see the documentation for the NODZoneFaceoffSpotStripe class for more information on it

class sportypy._feature_classes.hockey.NODZoneFaceoffSpotStripe(gap_width=0.0, *args, **kwargs)#

A parameterization of the off-centered faceoff spot of a hockey rink.

The non-centered faceoff spots are located in the neutral, offensive and defensive zones of the ice, with one on each side of the x-axis. These spots differ from the center faceoff spot because they have a larger diameter, differ in color, and have a colored stripe that runs through its center.

This class is responsible for creating the inner stripe, not the colored outer ring around it. Please see the documentation for the NODZoneFaceoffSpotRing class for more information on it

gap_width#

The gap between the interior edge of a non-centered faceoff spot ring and the stripe running across it

Type:

float

class sportypy._feature_classes.hockey.NeutralZone(rink_length=0.0, rink_width=0.0, feature_radius=0.0, feature_thickness=0.0, feature_units='ft', *args, **kwargs)#

A parameterization of the neutral zone of a hockey rink.

The neutral zone is the middle “third” of the rink. This is the area between the two zone (blue) lines. The center of the neutral zone should lie along the line x = 0

class sportypy._feature_classes.hockey.ODZoneFaceoffCircle(hashmark_width=0.0, hashmark_ext_spacing=0.0, *args, **kwargs)#

A parameterization of the off-centered faceoff circles of a hockey rink.

The non-centered faceoff circles are located in the offensive and defensive zones of the ice, with one on each side of the x-axis. These circles differ from the center faceoff circle because they have hash marks that extend towards the boards on each side of the circle

hashmark_width#

The width of the hashmarks on the exterior of the defensive and offensive faceoff circles. Note that width refers to a distance solely in the y direction

Type:

float

hashmark_ext_spacing#

The exterior horizontal spacing between the hashmarks on the exterior of the defensive and offensive faceoff circles. Note that this is solely in the x direction

Type:

float

class sportypy._feature_classes.hockey.ODZoneFaceoffLines(faceoff_line_dist_x=0.0, faceoff_line_dist_y=0.0, faceoff_line_length=0.0, faceoff_line_width=0.0, over_x=True, over_y=True, *args, **kwargs)#

A parameterization of the faceoff lines in the offensive/defensive zone.

These lines are the L-shaped lines where players on each team line up when taking a faceoff in either the offensive or defensive zones. There are four of these faceoff lines around each offensive/defensive faceoff spot

faceoff_line_dist_x#

The distance from the center of the defensive and offensive faceoff spot to the left-most edge of the upper-right faceoff line

Type:

float

faceoff_line_dist_y#

The distance from the center of the defensive and offensive faceoff spot to the bottom edge of the upper-right faceoff line

Type:

float

faceoff_line_length#

The exterior length of the faceoff line

Type:

float

faceoff_line_width#

The exterior width of the faceoff line

Type:

float

over_x#

Whether or not the line should be reflected over the x axis

Type:

bool

over_y#

Whether or not the line should be reflected over the y axis

Type:

bool

class sportypy._feature_classes.hockey.OffIceOfficialsBox(officials_box_length=0.0, officials_box_depth=0.0, *args, **kwargs)#

A parameterization of the interior of the off-ice officials’ box.

The off-ice officials’ box is located between the two penalty boxes, opposite the team bench areas

officials_box_length#

The interior length of the off-ice officials’ box

Type:

float

officials_box_depth#

The interior depth off of the boards of the off-ice officials’ box

Type:

float

class sportypy._feature_classes.hockey.OffensiveZone(nzone_length=0.0, *args, **kwargs)#

A parameterization of the offensive zone of a hockey rink.

The offensive zone is the right “third” of the rink in TV view. This is the area that a team attacks to try to score a goal when attacking from left to right

nzone_length#

The length of the neutral zone, measured from the interior edges of the zone lines (blue lines)

Type:

float

class sportypy._feature_classes.hockey.PenaltyBoxFill(penalty_box_length=0.0, penalty_box_depth=0.0, penalty_box_separation=0.0, *args, **kwargs)#

A parameterization of the interior of the penalty box for a single team.

The penalty boxes are the areas outside the confines of the rink where players serve time for a penalty incurred. They are to be on the same side of the ice surface and separate, as close to center ice as possible, for each team. This will not include the off-ice officials’ box; see the documentation for the OffIceOfficialsBox class for more information

penalty_box_length#

The interior length of a single penalty box

Type:

float

penalty_box_depth#

The interior depth off of the boards of a single team’s penalty box

Type:

float

penalty_box_separation#

The distance that separates each team’s penalty box area. This should be equivalent to the length of the off-ice officials’ box

Type:

float

class sportypy._feature_classes.hockey.PenaltyBoxOutline(penalty_box_length=0.0, penalty_box_depth=0.0, penalty_box_separation=0.0, *args, **kwargs)#

A parameterization of the penalty box for a single team.

The penalty boxes are the areas outside the confines of the rink where players serve time for a penalty incurred. They are to be on the same side of the ice surface and separate, as close to center ice as possible, for each team. This will also include the off-ice officials’ box

penalty_box_length#

The interior length of a single penalty box

Type:

float

penalty_box_depth#

The interior depth off of the boards of a single team’s penalty box

Type:

float

penalty_box_separation#

The distance that separates each team’s penalty box area. This should be equivalent to the length of the off-ice officials’ box

Type:

float

class sportypy._feature_classes.hockey.PlayerBenchFill(bench_length=0.0, bench_depth=0.0, *args, **kwargs)#

A parameterization of the interior of the player bench area.

The player benches are the areas outside the confines of the rink where players not currently on the ice are seated. They are to be on the same side of the ice surface and separate, as close to center ice as possible

bench_length#

The exterior length of a single team’s bench area

Type:

float

bench_depth#

The interior depth off the boards of a single team’s bench area

Type:

float

class sportypy._feature_classes.hockey.PlayerBenchOutline(bench_length=0.0, bench_depth=0.0, *args, **kwargs)#

A parameterization of the player bench area’s outline for a single team.

The player benches are the areas outside the confines of the rink where players not currently on the ice are seated. They are to be on the same side of the ice surface and separate, as close to center ice as possible

bench_length#

The exterior length of a single team’s bench area

Type:

float

bench_depth#

The interior depth off the boards of a single team’s bench area

Type:

float

class sportypy._feature_classes.hockey.RefereeCrease(rink_length=0.0, rink_width=0.0, feature_radius=0.0, feature_thickness=0.0, feature_units='ft', *args, **kwargs)#

A parameterization of the referee’s crease.

The referee’s crease is a semi-circle on the “bottom” of the boards (in TV view), centered on the line y = 0 (the center of the center line)

class sportypy._feature_classes.hockey.ZoneLine(rink_length=0.0, rink_width=0.0, feature_radius=0.0, feature_thickness=0.0, feature_units='ft', *args, **kwargs)#

A parameterization of the zone lines of a hockey rink.

The zone lines are the lines that separate the neutral zone from the offensive and defensive zones. Its line thickness should be given by major_line_thickness as this is a major line on the ice surface