Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Oct 22, 2024
1 parent 8760208 commit b7334f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/antares/tsgen/ts_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,7 @@ def _compute_failure_rates(outage_rates: FloatArray, durations: IntArray) -> Flo
from outage rates (= share of a period during which a unit is in outage),
and outage duration expectations.
"""
denominator = outage_rates + durations * (1 - outage_rates)
if np.any(denominator != 0):
return outage_rates / denominator
return denominator
return outage_rates / (outage_rates + durations * (1 - outage_rates))


def _combine_failure_rates(rates1: FloatArray, rates2: FloatArray) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def base_cluster_365_days():
)


def test_ts_gen_with_matrix_full_of_zeros(rng):
def test_cluster_with_null_duration(rng):
days = 365
with pytest.raises(ValueError, match="Planned outage duration is null or negative on following days"):
ThermalCluster(
Expand Down

0 comments on commit b7334f1

Please sign in to comment.