| 1 |
"""I have also noticed a trend in a number of the failed cases that |
| 2 |
involve array comparisons: the mean discrepancy is very small, |
| 3 |
and there are a small number of significant outliers. At present, |
| 4 |
such a test fails the rigorous criteria we are using. However, |
| 5 |
I am thinking of writing a utility to identify these cases and |
| 6 |
mark them as acceptable failures. Any comments/objections? |
| 7 |
|
| 8 |
|
| 9 |
Basic idea: |
| 10 |
- look for failed tests, possibly only of the array types |
| 11 |
- for each test, |
| 12 |
extract tra_discrepmean, tra_outliers, tda_sigthresh |
| 13 |
if abs(mean)<sigthresh and outliers<something, |
| 14 |
set attn=N |
| 15 |
print something to stdout |
| 16 |
|
| 17 |
""" |
| 18 |
from __future__ import print_function |
| 19 |
import sqlite3 |
| 20 |
import time, sys |
| 21 |
|
| 22 |
def run(test_run,maxoutliers=50,maxdev=0.015): |
| 23 |
|
| 24 |
|
| 25 |
db = sqlite3.connect("/aten/data1/ssb/test/stf/cgi/db/stf.db") |
| 26 |
idlist=[] |
| 27 |
|
| 28 |
|
| 29 |
ctr = db.execute("""SELECT result_scalar.key_id, result_scalar.test_name |
| 30 |
FROM result_scalar |
| 31 |
WHERE result_scalar.test_run = ? |
| 32 |
AND result_scalar.status = 'F' |
| 33 |
AND project = 'syn_pysyn' |
| 34 |
AND host = 'gaudete' """,(test_run,)) |
| 35 |
|
| 36 |
|
| 37 |
for x in ctr: |
| 38 |
key,name=x |
| 39 |
if "testcr" in name: |
| 40 |
ctra = db.execute("""SELECT result_tra.value |
| 41 |
FROM result_tra |
| 42 |
WHERE result_tra.key_id = ? |
| 43 |
AND result_tra.name = 'discrepmean'""", |
| 44 |
(key,)) |
| 45 |
|
| 46 |
for xx in ctra: |
| 47 |
discrepmean=float(xx[0]) |
| 48 |
|
| 49 |
ctra2 = db.execute("""SELECT result_tra.value |
| 50 |
FROM result_tra |
| 51 |
WHERE result_tra.key_id = ? |
| 52 |
AND result_tra.name = 'outliers'""", |
| 53 |
(key,)) |
| 54 |
|
| 55 |
|
| 56 |
for xxx in ctra2: |
| 57 |
n_outliers=float(xxx[0]) |
| 58 |
if ( (abs(discrepmean) <= maxdev) and |
| 59 |
(n_outliers < maxoutliers) ): |
| 60 |
idlist.append(key) |
| 61 |
print(name, discrepmean, n_outliers) |
| 62 |
|
| 63 |
db.execute("""UPDATE result_scalar SET attn = 'N' |
| 64 |
WHERE key_id = ?""",(key,)) |
| 65 |
|
| 66 |
db.execute("""INSERT INTO result_tra |
| 67 |
( key_id, name, value ) values (?, ?, ? )""" , |
| 68 |
( key, "attn_code", "autoaccept") ) |
| 69 |
|
| 70 |
|
| 71 |
db.commit() |
| 72 |
db.close() |
| 73 |
print(len(idlist), " acceptable failures found and marked") |
| 74 |
|
| 75 |
|
| 76 |
if len(idlist) > 0: |
| 77 |
qdb = sqlite3.connect("/aten/data1/ssb/test/stf/cgi/db/stf_query.db") |
| 78 |
|
| 79 |
|
| 80 |
now = time.time() |
| 81 |
c = qdb.execute("INSERT INTO query_id ( time ) VALUES ( ? ) ",(now,)) |
| 82 |
qid = c.lastrowid |
| 83 |
qdb.commit() |
| 84 |
|
| 85 |
|
| 86 |
for k in idlist: |
| 87 |
qdb.execute("INSERT INTO query ( qid, key_id ) VALUES ( ?, ? ) ", (qid, k) ) |
| 88 |
|
| 89 |
|
| 90 |
qdb.commit() |
| 91 |
qdb.close() |
| 92 |
|
| 93 |
|
| 94 |
url="http://stsdas.stsci.edu/cgi-bin/stf.cgi?query=summary&qid=%s\n"%qid |
| 95 |
sys.stdout.write(url) |
| 96 |
|
| 97 |
if __name__ == '__main__': |
| 98 |
run(*sys.argv[1:]) |