Exemplo n.º 1
0
def gen_chemical_search_results():
	
	from gzip import GzipFile as zfile
	if not os.path.isfile(CHEMICAL_SEARCH_RESULTS):
		f = zfile(CHEMICAL_SEARCH_RESULTS,"w")

		subp = Popen( [DB2DB_DISTANCE,
				  os.path.join(DATADIR,"chem.db"),
				  os.path.join(DATADIR,"test_query.iddb"),
				  os.path.join(DATADIR,"main.iddb") ],stdout=PIPE)

		for line in subp.stdout:
			f.write(" ".join(["%d:%f" % pair for pair in 
				bestCandidates([float(value) for value in 
					line.strip().split()],None,50000)])+"\n")
		f.close()
Exemplo n.º 2
0
	def doTest():
		from gzip import GzipFile as zfile
		test_queries_indicies =  [int(value)-1 for value in file(TEST_QUERIES)]
		lshsearcher = LSHSearcher(matrix_file,lsh_param)
		out = zfile(output,"w")
		line_num=0
		for query_coords in file(coord_query_file):
			info("query_coords( "+str(test_queries_indicies[line_num])+"): "+query_coords)
			candidates = lshsearcher.search(query_coords)
			query_iddb=file("iquery.iddb","w")
			query_iddb.write("%d\n" % test_queries_indicies[line_num])
			query_iddb.close()
			results = refine(QueryIDDB("iquery.iddb"),candidates)
			os.unlink("iquery.iddb")
			out.write(" ".join(["%d:%f" % pair for pair in results])+"\n")
			line_num+=1
		out.close()
Exemplo n.º 3
0
 def doTest():
     from gzip import GzipFile as zfile
     test_queries_indicies = [
         int(value) - 1 for value in file(TEST_QUERIES)
     ]
     lshsearcher = LSHSearcher(matrix_file, lsh_param)
     out = zfile(output, "w")
     line_num = 0
     for query_coords in file(coord_query_file):
         info("query_coords( " + str(test_queries_indicies[line_num]) +
              "): " + query_coords)
         candidates = lshsearcher.search(query_coords)
         query_iddb = file("iquery.iddb", "w")
         query_iddb.write("%d\n" % test_queries_indicies[line_num])
         query_iddb.close()
         results = refine(QueryIDDB("iquery.iddb"), candidates)
         os.unlink("iquery.iddb")
         out.write(" ".join(["%d:%f" % pair for pair in results]) + "\n")
         line_num += 1
     out.close()
Exemplo n.º 4
0
def gen_chemical_search_results():

    from gzip import GzipFile as zfile
    if not os.path.isfile(CHEMICAL_SEARCH_RESULTS):
        f = zfile(CHEMICAL_SEARCH_RESULTS, "w")

        subp = Popen([
            DB2DB_DISTANCE,
            os.path.join(DATADIR, "chem.db"),
            os.path.join(DATADIR, "test_query.iddb"),
            os.path.join(DATADIR, "main.iddb")
        ],
                     stdout=PIPE)

        for line in subp.stdout:
            f.write(" ".join([
                "%d:%f" % pair for pair in bestCandidates(
                    [float(value)
                     for value in line.strip().split()], None, 50000)
            ]) + "\n")
        f.close()