From b7334f14528182a0616d7556f127446eb7d7f444 Mon Sep 17 00:00:00 2001 From: belthlemar Date: Tue, 22 Oct 2024 13:17:32 +0200 Subject: [PATCH] fix --- src/antares/tsgen/ts_generator.py | 5 +---- tests/test_unit.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/antares/tsgen/ts_generator.py b/src/antares/tsgen/ts_generator.py index 36eb4ad..38352cb 100644 --- a/src/antares/tsgen/ts_generator.py +++ b/src/antares/tsgen/ts_generator.py @@ -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: diff --git a/tests/test_unit.py b/tests/test_unit.py index 7b3c7b5..1836588 100644 --- a/tests/test_unit.py +++ b/tests/test_unit.py @@ -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(