Commit aa137a44 authored by Daniel Brown's avatar Daniel Brown
Browse files

any 0 points now show the abs err as rel err is undefined

parent f41a1f8d
......@@ -331,10 +331,11 @@ class FinesseTestProcess(Thread):
# for computing relative errors we need to make sure we
# have no zeros in the data
ref_arr_c = np.where(ref_arr == 0, 1, ref_arr)
ref_arr_c[ref_arr_c==0] = 1
rel_diff = np.abs(out_arr-ref_arr)/np.abs(ref_arr_c)
nzix = (ref_arr != 0)
rel_diff = np.abs(out_arr-ref_arr)
# only compute rel diff for non zero values
rel_diff[nzix] = np.divide(rel_diff[nzix], np.abs(ref_arr[nzix]))
diff = np.any(rel_diff >= self.diff_rel_eps)
......
......@@ -17,7 +17,7 @@ from CodernityDB.database_thread_safe import ThreadSafeDatabase
from CodernityDB.database import RecordNotFound
import numpy as np
from pykat.testing.web.database_indices import TestIDIndex, SrcCommitIndex, KatTestIndex
import re
import re, gzip
import os, sys, traceback
global current_test, scheduled_tests, schedule_lock,enabled_suites
......@@ -637,13 +637,12 @@ def finesse_view_out(test_id,suite, out):
OUT_FILE = os.path.join(app.instance_path,"tests",str(test_id),"outputs",suite,out+".gz")
if os.path.exists(OUT_FILE):
contents = open(OUT_FILE).read()
contents = gzip.open(OUT_FILE, 'rb').read()
else:
contents = "out file not found"
response = make_response(contents)
response.headers["Content-type"] = "text/plain"
response.headers["Content-encoding"] = "gzip"
return response
......@@ -668,13 +667,13 @@ def finesse_view_log(test_id,suite, kat):
OUT_FILE = os.path.join(app.instance_path,"tests",str(test_id),"outputs",suite,log + ".gz")
if os.path.exists(OUT_FILE):
contents = open(OUT_FILE).read()
file = gzip.open(OUT_FILE, 'rb')
contents = file.read()
else:
contents = "log file not found"
contents = "log file not found"
response = make_response(contents)
response.headers["Content-type"] = "text/plain"
response.headers["Content-encoding"] = "gzip"
return response
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment