refactor: simplify best lag value handling in energy correlation calculations
- Updated the `_correlate_energy_weight` function to streamline the unpacking of the `best` variable, removing unnecessary tuple elements for improved clarity and efficiency in the correlation logic.
This commit is contained in:
parent
0365d9eb52
commit
1c512b0d0a
|
|
@ -170,7 +170,7 @@ def _correlate_energy_weight(profile_id: str, max_lag: int) -> Optional[Dict]:
|
||||||
|
|
||||||
balance_by = {d: kcal_by[d] - tdee_f for d in kcal_by}
|
balance_by = {d: kcal_by[d] - tdee_f for d in kcal_by}
|
||||||
|
|
||||||
best: Optional[Tuple[int, float, int, List[Tuple[int, float]]]] = None
|
best: Optional[Tuple[int, float, int]] = None
|
||||||
lag_details: List[Dict[str, Any]] = []
|
lag_details: List[Dict[str, Any]] = []
|
||||||
|
|
||||||
max_l = max(0, min(int(max_lag), 28))
|
max_l = max(0, min(int(max_lag), 28))
|
||||||
|
|
@ -211,7 +211,7 @@ def _correlate_energy_weight(profile_id: str, max_lag: int) -> Optional[Dict]:
|
||||||
"tdee_kcal_used": round(tdee_f, 0),
|
"tdee_kcal_used": round(tdee_f, 0),
|
||||||
}
|
}
|
||||||
|
|
||||||
lag_b, r_b, n_b, _ = best
|
lag_b, r_b, n_b = best
|
||||||
direction = _direction_from_r(r_b)
|
direction = _direction_from_r(r_b)
|
||||||
conf = _lag_confidence(n_b, r_b)
|
conf = _lag_confidence(n_b, r_b)
|
||||||
interp = (
|
interp = (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user