--- branches/ein16/synth/d2/test_compare.py 2016/08/27 19:52:38 4458 +++ branches/ein16/synth/d2/test_compare.py 2016/08/29 15:57:31 4459 @@ -76,6 +76,34 @@ rst_eh = 1 return (rtn, rst_good, rst_eh, rst_check, rst_terrible, rst_compile, rst_NA) +# check is observed and correct is a float +def check_float(o1, c1): + if(o1 == "nan" or o1 == "inf" or o1 == "-inf"): + return false + elif (float('nan')==o1): + return false + elif(math.isnan(o1)): + return false + elif(isinstance(o1, float)): + if (float('-inf') < float(o1) < float('inf')): + if(abs(o1-divConstant)<0.01) : + return false + else: + if(not (c1.compare(zoo))): + return false + if(not (c1.compare(I))): + return false + if(c1=="nan" or c1=="inf" or c1=="-inf"): + return false + elif (float('nan')==c1): + return false + elif(math.isnan(c1)): + return false + elif (float('-inf') < float(c1) < float('inf')): + return true + else: + return false + return false #difference and error between observed data and correct data #output is length 1 @@ -91,38 +119,14 @@ for (o1,c1) in zip(obv,cor): #print ("observed:",o,"correct:",c) length+=1 - - if(o1=="nan" or o1=="inf" or o1=="-inf"): - continue - elif (float('nan')==o1): - continue - elif(math.isnan(o1)): - continue - elif(isinstance(o1, float)): - if (float('-inf') < float(o1) < float('inf')): - if(abs(o1-divConstant)<0.01) : - continue - else: - if(not (c1.compare(zoo))): - continue - if(c1=="nan" or c1=="inf" or c1=="-inf"): - continue - elif (float('nan')==c1): - continue - elif(math.isnan(c1)): - continue - elif (float('-inf') < float(c1) < float('inf')): - t+=1 - diff=abs(o1-c1) - sumdiff += diff - if(diff > maxdiff): - maxdiff = diff - o6 = o1 - c6 = c1 - else: - continue - else: - continue + if(check_float(o1, c1)): + t+=1 + diff=abs(o1-c1) + sumdiff += diff + if(diff > maxdiff): + maxdiff = diff + o6 = o1 + c6 = c1 else: continue @@ -159,40 +163,16 @@ for i in range(no): for j in range(size): length+=1 - o1=obv[i][j] - print "o1",o1 - if(o1=="nan" or o1=="inf" or o1=="-inf"): - continue - elif (float('nan')==o1): - continue - elif(math.isnan(o1)): - continue - elif(isinstance(o1, float)): - if (float('-inf') < float(o1) < float('inf')): - if(abs(o1-divConstant)<0.01) : - continue - else: - c1= cor[i][j] - if(not (c1.compare(zoo))): - continue - if(c1=="nan" or c1=="inf" or c1=="-inf"): - continue - elif (float('nan')==c1): - continue - elif(math.isnan(c1)): - continue - elif (float('-inf') < float(c1) < float('inf')): - t+=1 - diff=abs(o1-c1) - sumdiff += diff - if(diff > maxdiff): - maxdiff = diff - o6 = o1 - c6 = c1 - else: - continue - else: - continue + o1 = obv[i][j] + c1 = cor[i][j] + if(check_float(o1, c1)): + t+=1 + diff=abs(o1-c1) + sumdiff += diff + if(diff > maxdiff): + maxdiff = diff + o6 = o1 + c6 = c1 else: continue if(o6==0):
Click to toggle
does not end with </html> tag
does not end with </body> tag
The output has ended thus: o6 = o1 + c6 = c1 else: continue if(o6==0):