def toimages(self, chunk_size='auto'): """ Converts to images data. This method is equivalent to series.toblocks(size).toimages(). Parameters ---------- chunk_size : str or tuple, size of series chunk used during conversion, default = 'auto' String interpreted as memory size (in kilobytes, e.g. '64'). The exception is the string 'auto', which will choose a chunk size to make the resulting blocks ~100 MB in size. Int interpreted as 'number of elements'. Only valid in spark mode. """ from thunder.images.images import Images if chunk_size is 'auto': chunk_size = str(max([int(1e5 / prod(self.baseshape)), 1])) n = len(self.shape) - 1 if self.mode == 'spark': return Images( self.values.swap(tuple(range(n)), (0, ), size=chunk_size)) if self.mode == 'local': return Images(self.values.transpose((n, ) + tuple(range(0, n))))
def toimages(self, size='150'): """ Converts Series to Images. Equivalent to calling series.toBlocks(size).toImages() Parameters ---------- size : str, optional, default = "150M" String interpreted as memory size. """ from thunder.images.images import Images n = len(self.shape) - 1 if self.mode == 'spark': return Images(self.values.swap(tuple(range(n)), (0, ), size=size)) if self.mode == 'local': return Images(self.values.transpose((n, ) + tuple(range(0, n))))
def toimages(self): """ Convert blocks to images. """ from thunder.images.images import Images if self.mode == 'spark': values = self.values.values_to_keys((0, )).unchunk() if self.mode == 'local': values = self.values.unchunk() return Images(values)