Пример #1
0
 def test_array(self):
     t = fromiter(self.gen(), self.ds, self.p)
     shape, dtype = to_numpy(t.datashape)
     shape_orig, dtype_orig = to_numpy(self.ds)
     self.assertEqual(dtype, dtype_orig)
     self.assertEqual(len(shape), 1)
     self.assertEqual(shape[0], self.count)
Пример #2
0
 def test_array(self):
     t = fromiter(self.gen(), self.ds, self.p)
     shape, dtype = to_numpy(t.datashape)
     shape_orig, dtype_orig = to_numpy(self.ds)
     self.assertEqual(dtype, dtype_orig)
     self.assertEqual(len(shape), 1)
     self.assertEqual(shape[0], self.count)
Пример #3
0
def build_array(array_name, rows):
    if not os.path.exists(array_name):
        ds = 'x, float'

        p = params(clevel=5, storage=array_name)
        t = fromiter((0.1*i for i in xrange(rows)),
                     dshape=ds, params=p)
        t.commit()
    else:
        t = open(array_name)

    return t
Пример #4
0
def build_array(array_name, rows):
    if not os.path.exists(array_name):
        ds = 'x, float'

        p = params(clevel=5, storage=array_name)
        t = fromiter((0.1*i for i in xrange(rows)),
                     dshape=ds, params=p)
        t.commit()
    else:
        t = open(array_name)

    return t
Пример #5
0
def test_dtw():
    # note: ucr.dtw only supports float64 atm
    count = 100 
    data  = fromiter((sin(2*pi*i/count) for i in xrange(count)), 'x, float64')
    query = data[50:60]

    loc, dist = ucr.dtw(data, query, 0.1, verbose=False)
    
    # these are stupid, mostly just to check for regressions
    ok_ (isinstance(loc, (int, long)))
    ok_ (isinstance(dist, float))
    eq_ (loc, 50)
    ok_ (dist < 1e-10 and dist >= 0.0)
Пример #6
0
def test_dtw():
    # note: ucr.dtw only supports float64 atm
    count = 100
    data = fromiter((sin(2 * pi * i / count) for i in xrange(count)),
                    'x, float64')
    query = data[50:60]

    loc, dist = ucr.dtw(data, query, 0.1, verbose=False)

    # these are stupid, mostly just to check for regressions
    ok_(isinstance(loc, (int, long)))
    ok_(isinstance(dist, float))
    eq_(loc, 50)
    ok_(dist < 1e-10 and dist >= 0.0)
Пример #7
0
def test_fromiter():
    from blaze import fromiter, params

    a = fromiter(xrange(10), 'x, float64', params=params(clevel=5))