]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
style(weights): rename fb_total to total in sanitize_and_renormalize fallback
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 25 May 2026 11:54:24 +0000 (13:54 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 25 May 2026 11:54:24 +0000 (13:54 +0200)
The fb_ prefix referenced the fallback array but the variable sums the
masked array. Use bare 'total' to match the primary path idiom.

quickadapter/user_data/strategies/Utils.py

index a4bc025c4ae63e7d2f699e7316cff11c87f60369..68d03d32ff686b11f5ed6ec32e399847e1546bab 100644 (file)
@@ -749,9 +749,9 @@ def sanitize_and_renormalize(
     fallback = np.ones(n, dtype=float)
     if drop_mask is not None:
         masked = np.where(drop_mask, 0.0, fallback)
-        fb_total = masked.sum()
-        if fb_total > 0.0:
-            return masked * (n / fb_total)
+        total = masked.sum()
+        if total > 0.0:
+            return masked * (n / total)
         if logger is not None:
             logger.warning(
                 "sanitize_and_renormalize: drop_mask covers all rows in "