James McCool commited on
Commit
aa2e7d9
·
1 Parent(s): f93672b

Update lineups_to_remove calculation in exposure_spread function to handle zero target exposure and adjust for non-zero targets, improving accuracy in lineup adjustments.

Browse files
Files changed (1) hide show
  1. global_func/exposure_spread.py +4 -1
global_func/exposure_spread.py CHANGED
@@ -260,7 +260,10 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
260
  player_exposure = player_mask.sum() / len(working_frame)
261
 
262
  # find the number of lineups that need to be removed to reach the target exposure
263
- lineups_to_remove = (player_exposure - exposure_target) * len(working_frame)
 
 
 
264
 
265
  # isolate the rows that contain the player
266
  player_rows = working_frame[player_mask]
 
260
  player_exposure = player_mask.sum() / len(working_frame)
261
 
262
  # find the number of lineups that need to be removed to reach the target exposure
263
+ if exposure_target == 0:
264
+ lineups_to_remove = (player_exposure - exposure_target) * len(working_frame)
265
+ else:
266
+ lineups_to_remove = (player_exposure - math.ceil(exposure_target / 2)) * len(working_frame)
267
 
268
  # isolate the rows that contain the player
269
  player_rows = working_frame[player_mask]