#NEWLINE# def ScaleData( data , old_min , old_max , new_min , new_max ) : #NEWLINE# #INDENT# 'Scale the input data so that the range old_min-old_max maps to\n  new_min-new_max.\n  ' #NEWLINE# def ScalePoint( x ) : #NEWLINE# #INDENT# if ( x is None ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# return ( ( scale * x ) + translate ) #NEWLINE# #UNINDENT# if ( old_min == old_max ) : #NEWLINE# #INDENT# scale = 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# scale = ( ( new_max - new_min ) / float ( ( old_max - data ) ) ) #NEWLINE# #UNINDENT# translate = ( new_min - ( scale * old_min ) ) #NEWLINE# return map ( ScalePoint , data )