Skip to content

Commit 3acd6f5

Browse files
committed
Fix tests
1 parent 3539406 commit 3acd6f5

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/muse/carbon_budget.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ def adjust_bounds(
431431
ub_price: float,
432432
emissions_cache: dict[float, float],
433433
target: float,
434-
resolution: int,
434+
resolution: int = 2,
435435
) -> tuple[float, float]:
436436
"""Adjust the bounds of the carbon price for the bisection algorithm.
437437
@@ -488,7 +488,7 @@ def decrease_bounds(
488488
ub_price: float,
489489
emissions_cache: dict[float, float],
490490
target: float,
491-
resolution: int,
491+
resolution: int = 2,
492492
) -> tuple[float, float]:
493493
"""Decreases the lb of the carbon price, and sets the ub to the previous lb."""
494494
denominator = max(target, 1e-3)
@@ -505,7 +505,7 @@ def increase_bounds(
505505
ub_price: float,
506506
emissions_cache: dict[float, float],
507507
target: float,
508-
resolution: int,
508+
resolution: int = 2,
509509
) -> tuple[float, float]:
510510
"""Increases the ub of the carbon price, and sets the lb to the previous ub."""
511511
denominator = max(target, 1e-3)
@@ -542,7 +542,7 @@ def bisect_bounds_inverted(
542542
resolution: int = 2,
543543
) -> tuple[float, float]:
544544
"""Bisects the bounds of the carbon price, in the case of inverted bounds."""
545-
midpoint = round((lb_price + ub_price) / resolution)
545+
midpoint = round((lb_price + ub_price) / 2.0, resolution)
546546
midpoint_emissions = emissions_cache[midpoint]
547547
if midpoint_emissions > target:
548548
ub_price = midpoint

0 commit comments

Comments
 (0)