Blend a new signal into an existing direction without letting one PDF dominate.
(
existing_weight: float,
incoming_weight: float,
blend: float,
new_direction_cap: float,
new_direction_scale: float,
)
| 387 | |
| 388 | return None |
| 389 | |
| 390 | |
| 391 | def _blend_weight( |
| 392 | existing_weight: float, |
| 393 | incoming_weight: float, |
| 394 | blend: float, |
| 395 | new_direction_cap: float, |
| 396 | new_direction_scale: float, |
| 397 | ) -> float: |
| 398 | """Blend a new signal into an existing direction without letting one PDF dominate.""" |
| 399 | incoming = min(max(float(incoming_weight or 0.0), 0.0), PDF_DIRECTION_WEIGHT_CAP) |
| 400 | existing = max(float(existing_weight or 0.0), 0.0) |
| 401 | |
| 402 | if existing > 0: |
| 403 | blended = existing + blend * (incoming - existing) |
| 404 | return round(max(existing, min(PDF_DIRECTION_WEIGHT_CAP, blended)), 4) |
| 405 | |
| 406 | seeded = min(PDF_DIRECTION_WEIGHT_CAP, incoming * new_direction_scale, new_direction_cap) |
| 407 | return round(seeded, 4) |
| 408 |
no outgoing calls
no test coverage detected