[Tutor] scaling values

kevin parks kp8 at mac.com
Tue Mar 14 09:02:47 CET 2006


i have various functions (that i didn't write) that put out data in 
lists of various types. But some functions (which i didn't write) that 
expect the data to be scaled, sometimes 0-1 sometimes 1-2, sometimes 
0-127..., sometimes 0 - 32768... gosh you name it. In other words i 
have a bunch of black boxes that don't speak the same language .... is 
there a scaling function in python (or numeric or scipy) that can scale 
a list of values to a high precision?

x = [13, 71, 120, 88, 82, 100, 10, 65, 101, 45, 26]

foo = scale(x, 0, 1.0)

and get that list scaled 0 to 1, or if i had:

x = [.12789, .982779, .19798198, .266796, .656527, .257877091]

foo = scale(x, 0, 127)

cheers,

-kp--



More information about the Tutor mailing list