From ec2a54c0a6ab1a6b9bcb6a31e05a34dd45c297d1 Mon Sep 17 00:00:00 2001 From: Nicolas Mounet Date: Wed, 4 Nov 2020 22:42:01 +0100 Subject: [PATCH] Bug fix in PiecewiseconstantFunction (models.py) --- cara/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cara/models.py b/cara/models.py index b8be7c1e..cec5f9c6 100644 --- a/cara/models.py +++ b/cara/models.py @@ -111,7 +111,7 @@ class PiecewiseconstantFunction: def __post_init__(self): if len(self.transition_times) != len(self.values)+1: raise ValueError("transition_times should contain one more element than values") - if list(set(self.transition_times)) != self.transition_times: + if sorted(list(set(self.transition_times))) != self.transition_times: raise ValueError("transition_times should not contain duplicated elements and should be sorted") def value(self,time) -> float: