Beispiel #1
0
def test_fid(dataset, fd):
    query = [
        int(random.uniform(dataset[0] - 100, dataset[-1] + 200) + 0.5)
        for i in xrange(1000)
    ]
    query.sort()

    while 1:
        r1 = _fidtool.query_samples(fd, query)
        r2 = [reference_query(dataset, q) for q in query]

        if r1 == r2:
            print "Success"
        elif len(r1) != len(r2):
            print "Failure, len(r1)=%d, len(r2)=%d" % (len(r1), len(r2))
            break
        else:
            for i, (j, k) in enumerate(zip(r1, r2)):
                if j != k:
                    print "%s: %s != %s" % (query[i], j, k)
                else:
                    print "%s: %s" % (query[i], j)
            break

        break
Beispiel #2
0
def dump_fid(fd):
    sample = 0
    i = -1

    while 1:
        next_sample, next_i = _fidtool.query_samples(fd, [sample])[0]
        if next_i <= i:
            break

        for j in xrange(i, next_i):
            print next_sample

        sample = next_sample + 1
        i = next_i
Beispiel #3
0
def dump_fid(fd):
    sample = 0
    i = -1

    while 1:
        next_sample, next_i = _fidtool.query_samples(fd, [sample])[0]
        if next_i <= i:
            break

        for j in xrange(i, next_i):
            print next_sample

        sample = next_sample + 1
        i = next_i
Beispiel #4
0
def test_fid(dataset, fd):
    query = [int(random.uniform(dataset[0] - 100, dataset[-1] + 200) + 0.5)
             for i in xrange(1000)]
    query.sort()

    while 1:
        r1 = _fidtool.query_samples(fd, query)
        r2 = [reference_query(dataset, q) for q in query]

        if r1 == r2:
            print "Success"
        elif len(r1) != len(r2):
            print "Failure, len(r1)=%d, len(r2)=%d" % (len(r1), len(r2))
            break
        else:
            for i, (j, k) in enumerate(zip(r1, r2)):
                if j != k:
                    print "%s: %s != %s" % (query[i], j, k)
                else:
                    print "%s: %s" % (query[i], j)
            break

        break