Beispiel #1
0
def test_simple():
    if not os.path.exists('./noaa_data'):
        p = params(clevel=5, storage='./noaa_data')

        t = Table([], dshape='{f0: int, f1:int, f2:int, f3:float}', params=p)

        # TODO: chunkwise copy
        t.append(adapter[:])
        t.commit()
    else:
        t = open('ctable://noaa_data')

    print '--------------------------------------'
    print 'mean', mean(t, 'f3')
    print 'std', std(t, 'f2')
    print '--------------------------------------'

    qs1 = select(t, lambda x: x > 80000, 'f0')
    qs2 = select2(t, lambda x,y: x > y, ['f0', 'f1'])

    result = t[qs1]
Beispiel #2
0
def test_simple():
    if not os.path.exists('./noaa_data'):
        p = params(clevel=5, storage='./noaa_data')

        t = Table([], dshape='{f0: int, f1:int, f2:int, f3:float}', params=p)

        # TODO: chunkwise copy
        t.append(adapter[:])
        t.commit()
    else:
        t = open('ctable://noaa_data')

    print '--------------------------------------'
    print 'mean', mean(t, 'f3')
    print 'std', std(t, 'f2')
    print '--------------------------------------'

    qs1 = select(t, lambda x: x > 80000, 'f0')
    qs2 = select2(t, lambda x, y: x > y, ['f0', 'f1'])

    result = t[qs1]
Beispiel #3
0
t = blaze.open('ctable://example1')

# Using chunked blaze array we can optimize for IO doing the sum
# operations chunkwise from disk.

t0 = time()
print blaze.mean(t, 'f0')
print "Chunked mean", round(time()-t0, 6)

# Using NumPy is just going to through the iterator protocol on
# carray which isn't going to efficient.

t0 = time()
print np.mean(t.data.ca['f0'])
print "NumPy mean", round(time()-t0, 6)

print '==================='

t0 = time()
#assert blaze.std(t, 'f0') == 28867.513458037913
print blaze.std(t, 'f0')
print "Chunked std", round(time()-t0, 6)

print '-------------------'

t0 = time()
print np.std(t.data.ca['f0'])
print "NumPy std", round(time()-t0, 6)

#blaze.generic_loop(t, 'f0')