def linscale(d, lim):
 return (((d - d.min()) * (lim[1] - lim[0])) + lim[0])

def linscale ( d , lim ) : return ( ( ( d - d . min ( ) ) * ( lim [ 1 ] - lim [ 0 ] ) ) + lim [ 0 ] )
utility function to linearly scale array d to the interval defined by lim .