示例#1
0
    def __init__(self, data=None, dshape=None, params=None):
        # need at least one of the three
        assert (data is not None) or (dshape is not None) or \
               (params.get('storage'))

        # Extract the relevant carray parameters from the more
        # general Blaze params object.
        if params:
            cparams, rootdir, format_flavor = to_cparams(params)
        else:
            rootdir, cparams = None, None

        if isinstance(data, CArraySource):
            data = data.ca
            dshape = dshape if dshape else data.dshape

        if dshape:
            shape, dtype = to_numpy(dshape)
            self.ca = carray.carray(data,
                                    dtype=dtype,
                                    rootdir=rootdir,
                                    cparams=cparams)
            self.dshape = dshape
        else:
            self.ca = carray.carray(data, rootdir=rootdir, cparams=cparams)
            self.dshape = from_numpy(self.ca.shape, self.ca.dtype)
示例#2
0
    def __init__(self, data=None, dshape=None, params=None):
        # need at least one of the three
        assert (data is not None) or (dshape is not None) or \
               (params.get('storage'))

        if isinstance(data, ctable):
            self.ca = data
            return

        # Extract the relevant carray parameters from the more
        # general Blaze params object.
        if params:
            cparams, rootdir, format_flavor = to_cparams(params)
        else:
            rootdir,cparams = None, None

        # Extract the relevant carray parameters from the more
        # general Blaze params object.
        if dshape:
            shape, dtype = to_numpy(dshape)
            if len(data) == 0:
                data = np.empty(0, dtype=dtype)
                self.ca = ctable(data, rootdir=rootdir, cparams=cparams)
            else:
                self.ca = ctable(data, dtype=dtype, rootdir=rootdir)
        else:
            self.ca = ctable(data, rootdir=rootdir, cparams=cparams)
示例#3
0
    def __init__(self, data=None, dshape=None, params=None):
        # need at least one of the three
        assert (data is not None) or (dshape is not None) or \
               (params.get('storage'))

        if isinstance(data, ctable):
            self.ca = data
            return

        # Extract the relevant carray parameters from the more
        # general Blaze params object.
        if params:
            cparams, rootdir, format_flavor = to_cparams(params)
        else:
            rootdir, cparams = None, None

        # Extract the relevant carray parameters from the more
        # general Blaze params object.
        if dshape:
            shape, dtype = to_numpy(dshape)
            if len(data) == 0:
                data = np.empty(0, dtype=dtype)
                self.ca = ctable(data, rootdir=rootdir, cparams=cparams)
            else:
                self.ca = ctable(data, dtype=dtype, rootdir=rootdir)
        else:
            self.ca = ctable(data, rootdir=rootdir, cparams=cparams)
示例#4
0
文件: chunked.py 项目: bussiere/blaze
    def __init__(self, data=None, dshape=None, params=None):
        # need at least one of the three
        assert (data is not None) or (dshape is not None) or \
               (params.get('storage'))

        # Extract the relevant carray parameters from the more
        # general Blaze params object.
        if params:
            cparams, rootdir, format_flavor = to_cparams(params)
        else:
            rootdir,cparams = None, None

        if dshape:
            dtype = to_numpy(dshape)
            self.ca = carray.carray(data, dtype, rootdir=rootdir)
        else:
            self.ca = carray.carray(data, rootdir=rootdir, cparams=cparams)