diff --git a/docs/source/pecuzal_embedding.py b/docs/source/pecuzal_embedding.py index bd34bfe..f647716 100644 --- a/docs/source/pecuzal_embedding.py +++ b/docs/source/pecuzal_embedding.py @@ -952,6 +952,9 @@ def uzal_cost_pecuzal(Y, Y_trial, Tw, K = 3, theiler = 1, norm = 'euclidean', ec # increased dist = compute_L_decrease(E2, E2_trial, eps2, eps2_trial, cnt+1, NN) + if math.isnan(dist): + raise Exception('Computed 0-distances. You might use model-data, thus try to add minimal additive noise to the signal you wish to embed and try again.') + if dist > dist_former and dist_former<0: break else: diff --git a/setup.py b/setup.py index a301d37..210891b 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="pecuzal_embedding", - version="1.3.0", + version="1.3.1", author="K.H.Kraemer", author_email="hkraemer@pik-potsdam.de", description="PECUZAL automatic embedding of uni- and multivariate time series", diff --git a/src/pecuzal_embedding.py b/src/pecuzal_embedding.py index bd34bfe..f647716 100644 --- a/src/pecuzal_embedding.py +++ b/src/pecuzal_embedding.py @@ -952,6 +952,9 @@ def uzal_cost_pecuzal(Y, Y_trial, Tw, K = 3, theiler = 1, norm = 'euclidean', ec # increased dist = compute_L_decrease(E2, E2_trial, eps2, eps2_trial, cnt+1, NN) + if math.isnan(dist): + raise Exception('Computed 0-distances. You might use model-data, thus try to add minimal additive noise to the signal you wish to embed and try again.') + if dist > dist_former and dist_former<0: break else: diff --git a/tests/pecuzal_embedding.py b/tests/pecuzal_embedding.py index bd34bfe..f647716 100644 --- a/tests/pecuzal_embedding.py +++ b/tests/pecuzal_embedding.py @@ -952,6 +952,9 @@ def uzal_cost_pecuzal(Y, Y_trial, Tw, K = 3, theiler = 1, norm = 'euclidean', ec # increased dist = compute_L_decrease(E2, E2_trial, eps2, eps2_trial, cnt+1, NN) + if math.isnan(dist): + raise Exception('Computed 0-distances. You might use model-data, thus try to add minimal additive noise to the signal you wish to embed and try again.') + if dist > dist_former and dist_former<0: break else: