pysted.utils.rescale

pysted.utils.rescale(data, factor)

Rescale the data container (and content) given the ratio between the current container unit size and the new container unit size.

Example:

>>> data_10nm = numpy.array([[1, 0, 0, 0],
                             [0, 1, 0, 0],
                             [0, 0, 0, 0],
                             [0, 0, 0, 0]])
>>> rescale(data_10nm, 2) # rescale to 20 nm size
numpy.array([[2, 0],
             [0, 0]])
Parameters:
  • data – A 2D array.

  • factor – The ratio between the original container units and the new container units.

Returns:

A 2D array.