Multiscale representation
- class MultiScaleOT.TMultiScaleSetup
Multiscale representation of a measure supported on a point cloud.
- __init__(self: MultiScaleOT.TMultiScaleSetup, pos: numpy.ndarray[numpy.float64], mu: numpy.ndarray[numpy.float64], depth: int, childMode: int = 1, setup: bool = True, setupDuals: bool = True, setupRadii: bool = True) None
- Parameters:
pos – 2d double array of point locations where the measure is supported
mu – 1d double array of point masses
depth – multiscale representation will have depth+1 layers. depth=0 means no multiscale representation, just the original point cloud.
childMode –
determines the order of children nodes in intermediate layers.
0 (=tree): adaptive 2^n tree where empty branches are discarded
1 (=grid): every layer is assumed to be a full Cartesian grid, nodes are numbered and stored in C order. Simpler if applicable, only works if all nodes are actually required.
setup – whether constructor automatically runs basic setup() method
setupDuals – whether constructor allocates storage for dual variables (can be done later with method setupDuals() )
setupRadii – whether constructor computes radii of hierarchical partition cells (can be done later with setupRadii() )
- coarsenSignal(self: MultiScaleOT.TMultiScaleSetup, signal: numpy.ndarray[numpy.float64], lFinest: int, lCoarsest: int, mode: int) list
Coarsens a double-valued signal from one layer to subsequent coarser layers.
- Parameters:
signal – 1d double array with signal at finest layer
lFinest – id of finest layer
lCoarsest – id of coarsest layer
mode –
determines how signal is refined.
0: coarse value is min over children
1: coarse value is max over children
- Returns:
list of double array containing coarsened signal at requested layers.
- coarsenSignalInt(self: MultiScaleOT.TMultiScaleSetup, signal: numpy.ndarray[numpy.int32], lFinest: int, lCoarsest: int, mode: int) list
Coarsens a int32-valued signal from one layer to subsequent coarser layers.
- Parameters:
signal – 1d int32 array with signal at finest layer
lFinest – id of finest layer
lCoarsest – id of coarsest layer
mode –
determines how signal is refined.
0: coarse value is min over children
1: coarse value is max over children
- Returns:
list of double array containing coarsened signal at requested layers.
- getChildren(self: MultiScaleOT.TMultiScaleSetup, nLayer: int, id: int) numpy.ndarray[numpy.int32]
Get list of children of node id at layer nLayer.
- getDepth(self: MultiScaleOT.TMultiScaleSetup) int
Returns the value of the depth parameter of the TMultiScaleSetup instance (which is <number of layers>-1).
- getDual(self: MultiScaleOT.TMultiScaleSetup, nLayer: int) numpy.ndarray[numpy.float64]
Return dual variable values at layer nLayer.
- getMeasure(self: MultiScaleOT.TMultiScaleSetup, nLayer: int) numpy.ndarray[numpy.float64]
Get measure at layer nLayer. If nLayer==nLayers-1==depth it returns the original measure.
- getNLayers(self: MultiScaleOT.TMultiScaleSetup) int
Returns the number of layers of the TMultiScaleSetup instance (which is depth+1).
- getNPoints(self: MultiScaleOT.TMultiScaleSetup, nLayer: int) int
Get number of points at layer nLayer.
- getParents(self: MultiScaleOT.TMultiScaleSetup, nLayer: int) numpy.ndarray[numpy.int32]
Get parents of nodes at layer nLayer.
Returns zeros at coarsest layer, nLayer=0. At finer layers returns array of int32 of size of current layer. Each entry gives id of parent node in parent layer. This id is location of the parent node in points or measure arrays.
- getPoints(self: MultiScaleOT.TMultiScaleSetup, nLayer: int) numpy.ndarray[numpy.float64]
Get points at layer nLayer. If nLayer==nLayers-1==depth it returns the original point cloud.
- getRadii(self: MultiScaleOT.TMultiScaleSetup, nLayer: int) numpy.ndarray[numpy.float64]
Get radii at layer nLayer. Only valid for nLayer<=nLayers-2 since there are no radii on finest layer.
- refineSignal(self: MultiScaleOT.TMultiScaleSetup, signal: numpy.ndarray[numpy.float64], lTop: int, mode: int = 0) numpy.ndarray[numpy.float64]
Refines a hierarchical signal from one layer to the subsequent finer layer.
- Parameters:
signal – 1d double array with signal at coarse layer
lTop – id of coarse layer
mode –
determines how signal is refined.
0: fine value equals parent value (default)
1: fine value is interpolated piecewise linearly (only works on Cartesian grids constructed with childMode=grid, experimental))
- Returns:
1d double array containing refined signal at fine layer (one layer below coarse layer)
- setChildModeGrid(self: MultiScaleOT.TMultiScaleSetup) None
Sets childMode to 0 (=tree). Only meaningful before setup() is called, see constructor.
- setChildModeTree(self: MultiScaleOT.TMultiScaleSetup) None
Sets childMode to 1 (=grid). Only meaningful before setup() is called, see constructor.
- setDual(self: MultiScaleOT.TMultiScaleSetup, alpha: numpy.ndarray[numpy.float64], nLayer: int) None
Set dual variable at layer nLayer to alpha and then propagates values to all coarser layers by maximization over child nodes.
- Parameters:
alpha – 1d double array with new values for dual variable. Size needs to equal number of cells in that layer.
nLayer – id of layer on which dual variable is to be set.
- setInterpolationMode(self: MultiScaleOT.TMultiScaleSetup, interpolation_mode: int) None
Experimental undocumented method.
- setup(self: MultiScaleOT.TMultiScaleSetup) int
Basic setup after calling the constructor. Instance cannot be used without calling this first, but constructor by default calls it automatically. See also constructor.
- setupDuals(self: MultiScaleOT.TMultiScaleSetup) int
Allocate memory for dual variables (at all scales). See also constructor.
- setupRadii(self: MultiScaleOT.TMultiScaleSetup) int
Compute radii of hierarchical partition cells. See also constructor.
- updateMeasure(self: MultiScaleOT.TMultiScaleSetup, newMeasure: numpy.ndarray[numpy.float64]) int
Overwrites the point masses of the multi scale representation at the finest layer and internally updates all coarser nodes.
- updatePositions(self: MultiScaleOT.TMultiScaleSetup, newPositions: numpy.ndarray[numpy.float64]) int
Overwrites the spatial positions of the multi scale representation at the finest layer and internally updates all coarser nodes and radii values.