Skip to content

Commit

Permalink
fixed matrix out of index error
Browse files Browse the repository at this point in the history
  • Loading branch information
biuti committed Aug 20, 2023
1 parent b7d9453 commit 936c253
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion airscore/core/formulas/lclib/weightedarea.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def tot_lc_calculation_integrate(res, t) -> float:
# matrix = weight_matrix()
ratio = c_round(toDo(best_dist_to_ess, ss_distance), integrate_precision)
# slice_dist = ss_distance / len(matrix)
index = int(ratio * len(t.formula.matrix))
index = min(len(t.formula.matrix) - 1, int(ratio * len(t.formula.matrix))) # avoid out of range if pilot bombed out at Start
missing_time = t.max_time - t.start_time
landed_out = sum(weight * t.formula.slice_dist * missing_time for weight in missing_area_integrate(t.formula.matrix, index, 0))
return (res.fixed_LC + landed_out) / (1800 * ss_distance)
Expand Down

0 comments on commit 936c253

Please sign in to comment.