pysted.utils.stack
- pysted.utils.stack(datamap, data)
Compute a new frame consisting in a replication of the given data centered at every positions and multiplied by the factors given in the datamap.
Example:
>>> datamap = numpy.array([[2, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) >>> data = numpy.array([[1, 2, 1], [2, 3, 2], [1, 2, 1]]) >>> utils.stack(datamap, data) numpy.array([[6, 4, 0, 0], [4, 2, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]])
- Parameters:
datamap – A 2D array indicating how many data are positioned in every
data – A 2D array containing the data to replicate.
- Returns:
A 2D array shaped like datamap.