def poly_map_domain(oldx, domain, window):
 domain = np.array(domain, dtype=np.float64)
 window = np.array(window, dtype=np.float64)
 scl = ((window[1] - window[0]) / (domain[1] - domain[0]))
 off = (((window[0] * domain[1]) - (window[1] * domain[0])) / (domain[1] - domain[0]))
 return (off + (scl * oldx))

def poly_map_domain ( oldx , domain , window ) : domain = np . array ( domain , dtype = np . float64 ) window = np . array ( window , dtype = np . float64 ) scl = ( ( window [ 1 ] - window [ 0 ] ) / ( domain [ 1 ] - domain [ 0 ] ) ) off = ( ( ( window [ 0 ] * domain [ 1 ] ) - ( window [ 1 ] * domain [ 0 ] ) ) / ( domain [ 1 ] - domain [ 0 ] ) ) return ( off + ( scl * oldx ) )
map domain into window by shifting and scaling .