Skip to content

Commit 6194661

Browse files
committed
downstream references to iquod.db
1 parent 07f8641 commit 6194661

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

filter-db.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# usage: python filter-db.py <full table name> <filtered table name> <number of good / bad profiles to pick>
1+
# usage: python filter-db.py <full table name> <filtered table name> <number of good / bad profiles to pick> <db filename>
22

33
import sys, sqlite3
44

5-
if len(sys.argv) == 4:
5+
if len(sys.argv) == 5:
66

7-
conn = sqlite3.connect('iquod.db', isolation_level=None)
7+
conn = sqlite3.connect(sys.argv[4], isolation_level=None)
88
cur = conn.cursor()
99

1010
query = "DROP TABLE IF EXISTS " + sys.argv[2]

plot-roc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ def plotRow(row):
7878
pylab.savefig(dir + str(p.uid()) + '.png', bbox_inches='tight')
7979
plt.close()
8080

81-
def plot_roc():
81+
def plot_roc(inputdb='iquod.db'):
8282

8383
# get qc tests
8484
testNames = main.importQC('qctests')
8585

8686
# connect to database
87-
conn = sqlite3.connect('iquod.db', isolation_level=None)
87+
conn = sqlite3.connect(inputdb, isolation_level=None)
8888
cur = conn.cursor()
8989

9090
# extract matrix of test results and true flags into a dataframe

util/dbutils.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,11 @@ def unpack_qc_results(results):
8383
def db_to_df(table,
8484
filter_on_wire_break_test=False,
8585
filter_on_tests={},
86-
n_to_extract=numpy.iinfo(numpy.int32).max):
86+
n_to_extract=numpy.iinfo(numpy.int32).max,
87+
inputdb='iquod.db'):
8788

8889
'''
89-
Reads the table from iquod.db into a pandas dataframe.
90+
Reads the table from inputdb into a pandas dataframe.
9091
If filter_on_wire_break_test is True, the results from that test are used to exclude
9192
levels below a wire break from the test results and the wire break test is not returned.
9293
filter_on_tests is a generalised form of filter_on_wire_break and is used to exclude results; it takes a list of
@@ -99,7 +100,7 @@ def db_to_df(table,
99100
testNames.sort()
100101

101102
# connect to database
102-
conn = sqlite3.connect('iquod.db', isolation_level=None)
103+
conn = sqlite3.connect(inputdb, isolation_level=None)
103104
cur = conn.cursor()
104105

105106
# extract matrix of test results and true flags into a dataframe

util/main.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,15 @@ def dictify(rows, keys):
167167

168168
return dicts
169169

170-
def dbinteract(command, values=[], tries=0):
170+
def dbinteract(command, values=[], tries=0, inputdb='iquod.db'):
171171
'''
172172
execute the given SQL command;
173173
catch errors and retry a maximum number of times;
174174
'''
175175

176176
max_retry = 100
177177

178-
conn = sqlite3.connect('iquod.db', isolation_level=None, timeout=60)
178+
conn = sqlite3.connect(inputdb, isolation_level=None, timeout=60)
179179
cur = conn.cursor()
180180

181181
try:
@@ -201,13 +201,13 @@ def dbinteract(command, values=[], tries=0):
201201
print('database interaction failed after', max_retry, 'retries')
202202
return -1
203203

204-
def interact_many(query, values, tries=0):
204+
def interact_many(query, values, tries=0, inputdb='iquod.db'):
205205
# similar to dbinteract, but does executemany
206206
# intended exclusively for writes
207207

208208
max_retry = 100
209209

210-
conn = sqlite3.connect('iquod.db', isolation_level=None, timeout=60)
210+
conn = sqlite3.connect(inputdb, isolation_level=None, timeout=60)
211211
cur = conn.cursor()
212212

213213
try:

0 commit comments

Comments
 (0)