From b585f571da73a6f28de081598af079dd160ccc50 Mon Sep 17 00:00:00 2001 From: marcel Date: Mon, 14 Aug 2017 11:40:22 +0200 Subject: [PATCH] [bugfix] no quality set if else was hit --- pylot/core/pick/utils.py | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index a3369943..41e6f5d0 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -1078,24 +1078,22 @@ def getQualityfromUncertainty(uncertainty, Errors): regarding adjusted time errors Errors. ''' - if uncertainty == None or uncertainty == 'None': - quality = 4 - else: - if uncertainty <= Errors[0]: - quality = 0 - elif (uncertainty > Errors[0]) and \ - (uncertainty < Errors[1]): - quality = 1 - elif (uncertainty > Errors[1]) and \ - (uncertainty < Errors[2]): - quality = 2 - elif (uncertainty > Errors[2]) and \ - (uncertainty < Errors[3]): - quality = 3 - elif uncertainty > Errors[3]: - quality = 4 - else: - pass + # set initial quality to 4 (worst) and change only if one condition is hit + quality = 4 + + if uncertainty <= Errors[0]: + quality = 0 + elif (uncertainty > Errors[0]) and \ + (uncertainty < Errors[1]): + quality = 1 + elif (uncertainty > Errors[1]) and \ + (uncertainty < Errors[2]): + quality = 2 + elif (uncertainty > Errors[2]) and \ + (uncertainty < Errors[3]): + quality = 3 + elif uncertainty > Errors[3]: + quality = 4 return quality