Ejemplo n.º 1
0
 def createDataSource(dset, withShape=False):
     dset_5d = H5pyDset5DWrapper(dset)
     src = ArraySource(dset_5d)
     if withShape:
         return src, dset_5d.shape
     else:
         return src
Ejemplo n.º 2
0
def _createArrayDataSource(source,withShape = False):
    #has to handle NumpyArray
    #check if the array is 5d, if not so embed it in a canonical way
    if len(source.shape) == 2:
        source = source.reshape( (1,) + source.shape + (1,1) )
    elif len(source.shape) == 3 and source.shape[2] <= 4:
        source = source.reshape( (1,) + source.shape[0:2] + (1,) + (source.shape[2],) )
    elif len(source.shape) == 3:
        source = source.reshape( (1,) + source.shape + (1,) )
    elif len(source.shape) == 4:
        source = source.reshape( (1,) + source.shape )
    src = ArraySource(source)
    if withShape:
        return src,source.shape
    else:
        return src
Ejemplo n.º 3
0
 def setUp(self):
     import numpy as np
     from datasources import ArraySource
     self.raw = np.random.randint(0, 100, (10, 3, 3, 128, 3))
     self.a = ArraySource(self.raw)
     self.ss = SliceSource(self.a, projectionAlongTZC)
import dask.array
from datasources import ArraySource
from in_memory_catalog import Catalog

# Build Catalog of Catalogs.
subcatalogs = {}
for name, size, fruit, animal in zip(
    ["tiny", "small", "medium", "large"],
    [3, 100, 1000, 10_000],
    ["apple", "banana", "orange", "grape"],
    ["bird", "cat", "dog", "penguin"],
):
    subcatalogs[name] = Catalog(
        {
            k: ArraySource(v * dask.array.ones((size, size)))
            for k, v in zip(["ones", "twos", "threes"], [1, 2, 3])
        },
        metadata={
            "fruit": fruit,
            "animal": animal
        },
    )
catalog = Catalog(subcatalogs)