Block#
The Block module provides a Source
class used in parallel
processing of very large arrays in
ClearMap.ParallelProcessing.BlockProcessing
.
- class Block(source=None, slicing=None, valid=None, valid_slicing=None, offsets=None, index=None, iteration=None, blocks_shape=None, neighbours=None, name=None)[source]#
Bases:
Slice
Block source
A Block is a Slice with a sub-slice indicating the valid region to use when combining the results after block processing.
Each block has a index tuple that specifies its position in the grid of blocks in which the source was split into.
Each block also can carry a reference to its neighbouring blocks.
- as_virtual()[source]#
Returns a virtual handle to this source striped of any big array data useful for parallel processing.
Returns
- sourceSource class
The source class with out any cached array data.
Note
The slicing structure is kept here to be able to appropiately take slices in a source when processsing in parallel.
- info(short=True)[source]#
Return info string about this block within the grid of blocks.
Returns
- infostr
Info string.
- iteration_info()[source]#
Return info string about the iteration of this block in the gird of blocks.
Returns
- infostr
Info string.
- property blocks_shape#
Return the shape of the block grid this block belongs too.
Returns
- shapetuple of ints
The shape of the grid of blocks this block is part of.
- property index#
Return the grid index of the block.
Returns
- indextuple of ints
The multi index of this block in a grid of blocks.
- property iteration#
Return the index of this block in the list of all blocks to process.
Returns
- indextuple of ints
The multi index of this block in a grid of blocks.
- property n_iterations#
Returns the number of blocks in the grid to which this block belongs.
Returns
- n_iterationsint or None
The number of blocks in the block grid.
- property name#
The name of this source.
Returns
- namestr
Name of this source.
- property neighbours#
Returns the neighbours of this block.
Returns
- neighboursdict or None
The neighbours of this block in the form {index : block,…} or None
- property valid#
Return the slice of the valid region of this block.
Returns
- validSlice
The valid slice of this block.