ptvis.utils.linearly_transform

ptvis.utils.linearly_transform(x, x1, y1, x2, y2)[source]

Linearly transform a value.

The transformation is performed element-wise after NumPy broadcasting.

Parameters:
Returns:

numpy.ndarray of float – Value transformed from x.

Examples

>>> linearly_transform(0.5, 0, 0, 1, 2)
array(1.)
>>> linearly_transform([0.2, 0.5], 0, 0, 1, [[2], [4]])
array([[0.4, 1. ],
       [0.8, 2. ]])