Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #4
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 dshape:
            dtype = to_numpy(dshape)
            self.ca = carray.carray(data, dtype, rootdir=rootdir)
        else:
            self.ca = carray.carray(data, rootdir=rootdir, cparams=cparams)