Skip to content

Commit dcd40a2

Browse files
authored
Merge pull request #8 from ntwkrgr/copilot/remove-batting-metrics-throwbacks
Remove angle restriction from throwback detection
2 parents 9844805 + f0ddd43 commit dcd40a2

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

YakkerStreamApp/YakkerStreamApp/Resources/yakker_stream.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@
3737
# Yakker merges pitch + hit observations; catcher throwbacks surface as a single contributing event,
3838
# so require at least two event IDs (pitch + hit) when no pitch metrics accompany hit data.
3939
MIN_CONTRIBUTING_EVENTS_FOR_HIT = 2
40+
# Filter throwbacks based on low exit velocity (soft throws back to pitcher/catcher)
4041
THROWBACK_MAX_EXIT_VELO = 65.0
41-
THROWBACK_MIN_ANGLE_DEG = 10.0
42-
THROWBACK_MAX_ANGLE_DEG = 20.0
4342

4443
PayloadHook = Callable[[dict], Union[Awaitable[None], None]]
4544

@@ -69,15 +68,12 @@ def _is_valid(value: Optional[float]) -> bool:
6968
def _looks_like_throwback(hit_data: dict) -> bool:
7069
"""Return True when the hit profile matches a soft throwback to the mound."""
7170
exit_velocity = hit_data.get("ExitSpeedMPH")
72-
launch_angle = hit_data.get("AngleDegrees")
73-
if not (_is_valid(exit_velocity) and _is_valid(launch_angle)):
71+
if not _is_valid(exit_velocity):
7472
return False
7573
exit_velocity = float(exit_velocity)
76-
launch_angle = float(launch_angle)
77-
return (
78-
exit_velocity < THROWBACK_MAX_EXIT_VELO
79-
and THROWBACK_MIN_ANGLE_DEG <= launch_angle <= THROWBACK_MAX_ANGLE_DEG
80-
)
74+
# Filter throwbacks based solely on low exit velocity
75+
# Throwbacks are characterized by low exit velocity regardless of angle
76+
return exit_velocity < THROWBACK_MAX_EXIT_VELO
8177

8278

8379
def _is_true_hit(hit_data: dict, pitch_data: dict, contributing_events: List[str]) -> bool:

0 commit comments

Comments
 (0)