Skip to content
Snippets Groups Projects
Commit 2989e95b authored by Daniel Brown's avatar Daniel Brown
Browse files

adding xlim/ylim to map plotting function. Fixing issue in test scripts where...

adding xlim/ylim to map plotting function. Fixing issue in test scripts where it wasn't using the correct kat.ini hopefully
parent 5df83b5f
No related branches found
No related tags found
No related merge requests found
......@@ -136,11 +136,12 @@ A Flask based website that runs the Finesse test suites is included in PyKat. Th
Prerequistes:
Flask
Numpy
CodernityDB
Command to start server:
.. code:: bash
python -m pykat.test.web_server --path=[path to create website] --port=[HTTP port] --git-bin=[path to git binary]
python -m pykat.testing.web_server --path=[path to create website] --port=[HTTP port] --git-bin=[path to git binary]
The website can then be accessed in a web browser at the address: localhost:[port]
\ No newline at end of file
......@@ -47,7 +47,7 @@ def run_kat_file(item):
#try:
start = time.time()
out,err = utils.runcmd(["nice", "--18", FINESSE_EXE, "--noheader", kat], cwd=SUITE_PATH)
out,err = utils.runcmd([FINESSE_EXE, "--noheader", kat], cwd=SUITE_PATH)
runtime = time.time()-start
OUT_FILE = os.path.join(SUITE_PATH,basename + ".out")
......@@ -321,7 +321,7 @@ class FinesseTestProcess(Thread):
self.pool = Pool(initializer=initProcess,initargs=(self.done_kats,) ,processes = self.pool_size)
results = self.pool.imap_unordered(run_kat_file, runs, 1)
print "DONE POOL!!!!"
print "Finsihed running pool of kats"
self.pool.close()
for result in results:
......@@ -338,7 +338,7 @@ class FinesseTestProcess(Thread):
if len(self.kat_run_exceptions[suite].keys()) > 0:
print "Could not run the following kats:\n" + "\n".join(self.kat_run_exceptions[suite].keys()) + " in " + suite
else:
print "No errors whilst running" + suite
print "No exceptions whilst running: " + suite
self.diffing = True
......@@ -398,8 +398,7 @@ class FinesseTestProcess(Thread):
else:
max = np.max(rel_diff)
self.output_differences[suite][out] = (False,
max)
self.output_differences[suite][out] = (False, max)
......@@ -410,10 +409,13 @@ class FinesseTestProcess(Thread):
f_out.close()
f_in.close()
print "removing out file ", out_file
os.remove(out_file)
self.done_kats.value += 1
print "Finished diffing..."
REPORT_PATH = os.path.join(self.BASE_DIR,"reports")
if not os.path.exists(REPORT_PATH):
......
......@@ -290,7 +290,8 @@
$(nTd).empty();
$(nTd).append(a);
$(nTd).append(b);
// removed ability to rerun, doesn't quite work
//$(nTd).append(b);
}, "mDataProp": "test_id", "bSearchable": false, "sTitle": "", "bSortable": false
},
{ "mDataProp": "test_id", "sTitle": "Test ID","bSearchable": true, "bVisible": true, "sClass": "center" },
......@@ -443,6 +444,8 @@
});
}
function updateBranches(){
$("#btnStartTest").attr("disabled", true);
blist = $("#branch_list");
......
......@@ -19,6 +19,7 @@ import numpy as np
from pykat.testing.web.database_indices import TestIDIndex, SrcCommitIndex, KatTestIndex
import re, gzip
import os, sys, traceback
from multiprocessing import cpu_count
global current_test, scheduled_tests, schedule_lock,enabled_suites
......@@ -200,8 +201,10 @@ class FinesseProcessWatcher(Thread):
EXE = ""
KAT_EXE = os.path.join(app.instance_path,"tests",str(self.process_to_watch.test_id),"build","kat" + EXE)
KAT_INI = os.path.join(app.instance_path,"tests",str(self.process_to_watch.test_id),"build","kat.ini")
KAT_STORE_PATH = os.path.join(app.instance_path,"kat_store")
KAT_STORE_EXE = os.path.join(KAT_STORE_PATH,"kat_" + str(self.process_to_watch.get_version()) + EXE)
KAT_STORE_INI = os.path.join(KAT_STORE_PATH,"kat.ini_" + str(self.process_to_watch.get_version()))
if not os.path.exists(KAT_STORE_PATH):
os.mkdir(KAT_STORE_PATH)
......@@ -212,12 +215,18 @@ class FinesseProcessWatcher(Thread):
shutil.copyfile(KAT_EXE, KAT_STORE_EXE)
if os.path.exists(KAT_INI):
if os.path.exists(KAT_STORE_INI):
os.remove(KAT_STORE_INI)
shutil.copyfile(KAT_INI, KAT_STORE_INI)
# Remove the src and lib directories from the build as they are not needed
# and take up a fair bit of space
BUILD_PATH = os.path.join(self.process_to_watch.BASE_DIR, "build")
utils.runcmd(["rm","src","-rf"],cwd=BUILD_PATH)
utils.runcmd(["rm","lib","-rf"],cwd=BUILD_PATH)
utils.runcmd(["rm","-rf","src"],cwd=BUILD_PATH)
utils.runcmd(["rm","-rf","lib"],cwd=BUILD_PATH)
except RecordNotFound:
print "Could not find database records for test id " + str(self.process_to_watch.test_id)
......@@ -394,13 +403,19 @@ def __finesse_start_test(git_commit, kats, nobuild=False):
EXE = ""
TEST_BUILD_PATH = os.path.join(TEST_RUN_PATH, "build")
KAT_EXE = os.path.join(app.instance_path, "kat_store", "kat_" + str(git_commit) + EXE)
KAT_INI = os.path.join(app.instance_path, "kat_store", "kat.ini_" + str(git_commit))
if os.path.exists(KAT_EXE):
print "using existing kat file " + KAT_EXE
utils.git(["clone","git://gitmaster.atlas.aei.uni-hannover.de/finesse/base.git",TEST_BUILD_PATH])
os.mkdir(TEST_BUILD_PATH)
KAT_NEW_EXE = os.path.join(TEST_BUILD_PATH,"kat" + EXE)
KAT_NEW_INI = os.path.join(TEST_BUILD_PATH,"kat.ini")
shutil.copyfile(KAT_EXE, KAT_NEW_EXE)
shutil.copyfile(KAT_INI, KAT_NEW_INI)
else:
nobuild = False
......@@ -461,6 +476,7 @@ def finesse_get_test_progress():
finally:
schedule_lock.release()
@app.route('/finesse/get_branches', methods=["POST"])
def finesse_get_branches():
SRC_PATH = os.path.join(app.instance_path,"finesse_src")
......
......@@ -25,7 +25,7 @@ def start(instance_path,port=5000, debug=True, ip="0.0.0.0", git_bin="/usr/bin/g
if(app.instance_path!=instance_path):
print app.instance_path, instance_path
raise Exception("Instance path of Flask app didn't match the requested value")
raise Exception("Instance path of Flask app (%s) didn't match the requested value (%s)" %(app.instance_path, instance_path))
os.chdir(instance_path)
......
......@@ -182,22 +182,47 @@ class surfacemap(object):
return self.ROMWeights, EI
def plot(self, show=True, clabel=None):
def plot(self, show=True, clabel=None, xlim=None, ylim=None):
import pylab
if xlim != None:
_x = np.logical_and(self.x<=max(xlim)/100.0, self.x>=min(xlim)/100.0)
xmin = np.min(np.where(_x == True))
xmax = np.max(np.where(_x == True))
else:
xmin = 0
xmax = len(self.x)-1
xlim = [self.x.min()*100, self.x.max()*100]
if ylim != None:
_y = np.logical_and(self.y<=max(ylim)/100.0, self.y>=min(ylim)/100.0)
ymin = np.min(np.where(_y == True))
ymax = np.max(np.where(_y == True))
else:
ymin = 0
ymax = len(self.y)-1
ylim = [self.y.min()*100, self.y.max()*100]
zmin = self.data[xmin:xmax,ymin:ymax].min()
zmax = self.data[xmin:xmax,ymin:ymax].max()
# 100 factor for scaling to cm
xrange = 100*self.x
yrange = 100*self.y
fig = pylab.figure()
axes = pylab.imshow(self.data, extent=[min(xrange),max(xrange),min(yrange),max(yrange)])
axes = pylab.pcolormesh(xrange, yrange, self.data, vmin=zmin, vmax=zmax)
pylab.xlabel('x [cm]')
pylab.ylabel('y [cm]')
if xlim != None: pylab.xlim(xlim)
if ylim != None: pylab.ylim(ylim)
pylab.title('Surface map {0}, type {1}'.format(self.name, self.type))
cbar = fig.colorbar(axes)
cbar.set_clim(zmin, zmax)
if clabel != None:
cbar.set_label(clabel)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment