1 | initial version |
For mapping one real interval to another interval, you have the numpy function interp() (linear approximation).
Example :
import numpy as np
from numpy import interp
prec = 200
xp = np.linspace(0.0, 99.0, prec)
yp = np.linspace(-1.0, 1.0, prec)
print interp([52.0],xp,yp)
The printed value is near 0.0 (middle of interval [-1,1]) because 52.0 is near 50.0 (middle of interval [0,99])