scale_coordinates

sofia_redux.toolkit.resampling.scale_coordinates(coordinates, scale, offset, reverse=False)[source]

Apply scaling factors and offsets to N-dimensional data.

The two available transforms are controlled by the reverse. The transform functions apply the following functions:

Reverse

f(x)

False (default)

(x - offset) / scale

True

(x * scale) + offset

Parameters:
coordinatesnumpy.ndarray (N, M) or (N,)

Either a 1 or 2-dimensional array may be supplied. If a 1-dimensional array is supplied, it is assumed that it represents a single coordinates in N-dimensions. If a 2-dimensional array is supplied, it should be of shape (N, M) where N is the number of dimensions, and M is the number of coordinates.

scalenumpy.ndarray (N,)

The scaling factor to apply to each dimension.

offsetnumpy.ndarray (N,)

The offset to apply to each dimension.

reversebool, optional

If True, apply the reverse transform. The default is False.

Returns:
numpy.ndarray of numpy.float64 (N, M) or (N,)

The scaled coordinates array.