[SciPy-user] scale arrays with interpolation

Alex Liberzon alex.liberzon@gmail....
Sat Sep 13 15:35:21 CDT 2008


Hi Fabian

Fortunately, I'm from the same field so I think I understand what you're 
talking about :-) If I translate your wish is::
a) find the location and the value of the maximum of the y_array => 
local_max
b) half_width is the x_array value at the position of the maximum of y_array

If this is true, then you'd better use numpy arrays and not lists:
# starting from your lists:
 x_array = asarray(x_array).astype('f') # array of floats
 y_array = asarray(y_array).astype('f')

half_width = x_array[argmax(y_array)]

scaled_x_array = x_array/half_width
scaled_y_array = y_array/max(y_array)

plot(scaled_x_array,scaled_y_array,'o')

Hope it helps,
Alex
 



More information about the SciPy-user mailing list