Re: [Tutor] finding a maximum between the absolute difference of several columns

2012-02-17 Thread Peter Otten
Andre' Walker-Loud wrote: import numpy as np Vhel_fdiff3 = np.array([abs(Vmatch3_1 - Vmatch3_2), abs(Vmatch3_1 - Vmatch3_3), abs(Vmatch3_3 - Vmatch3_2)]) your_answer = Vhel_fdiff3.max(axis=0) or import numpy as np a = np.array([Vmatch3_1-Vmatch3_2, Vmatch3_1-Vmatch3_3, Vmatch3_3-

Re: [Tutor] finding a maximum between the absolute difference of several columns

2012-02-17 Thread Andre' Walker-Loud
import numpy as np Vhel_fdiff3 = np.array([abs(Vmatch3_1 - Vmatch3_2), abs(Vmatch3_1 - Vmatch3_3), abs(Vmatch3_3 - Vmatch3_2)]) your_answer = Vhel_fdiff3.max(axis=0) or import numpy as np a = np.array([Vmatch3_1-Vmatch3_2, Vmatch3_1-Vmatch3_3, Vmatch3_3- Vmatch3_2]) print

[Tutor] finding a maximum between the absolute difference of several columns

2012-02-16 Thread Elaina Ann Hyde
Hello all, I am still scripting away and have reached my next quandry, this one is much simpler than the last, basically I read in a file with several columns. Vmatch3_1=dat[col1] Vmatch3_2=dat[col2] Vmatch3_3=dat[col3] Vdav=5.0 Vhel_fdiff3=max(abs(Vmatch3_1 - Vmatch3_2),abs(Vmatch3_1 -

Re: [Tutor] finding a maximum between the absolute difference of several columns

2012-02-16 Thread Mark Lawrence
On 17/02/2012 01:04, Elaina Ann Hyde wrote: Hello all, I am still scripting away and have reached my next quandry, this one is much simpler than the last, basically I read in a file with several columns. Vmatch3_1=dat[col1] Vmatch3_2=dat[col2] Vmatch3_3=dat[col3] Vdav=5.0

Re: [Tutor] finding a maximum between the absolute difference of several columns

2012-02-16 Thread Elaina Ann Hyde
On Fri, Feb 17, 2012 at 1:41 PM, Rohan Sachdeva rsach...@usc.edu wrote: The way I would do this is to put all of the differences in a list then take the maximum of the list. So.. a = Vmatch3_1 - Vmatch3_2 b = Vmatch3_1 - Vmatch3_3 c = Vmatch3_3 - Vmatch3_2 Vhel_fdiff3=max([a,b,c]) That

Re: [Tutor] finding a maximum between the absolute difference of several columns

2012-02-16 Thread Mark Lawrence
On 17/02/2012 02:53, Elaina Ann Hyde wrote: On Fri, Feb 17, 2012 at 1:41 PM, Rohan Sachdevarsach...@usc.edu wrote: The way I would do this is to put all of the differences in a list then take the maximum of the list. So.. a = Vmatch3_1 - Vmatch3_2 b = Vmatch3_1 - Vmatch3_3 c = Vmatch3_3 -

Re: [Tutor] finding a maximum between the absolute difference of several columns

2012-02-16 Thread Elaina Ann Hyde
On Fri, Feb 17, 2012 at 2:27 PM, Mark Lawrence breamore...@yahoo.co.ukwrote: On 17/02/2012 02:53, Elaina Ann Hyde wrote: On Fri, Feb 17, 2012 at 1:41 PM, Rohan Sachdevarsach...@usc.edu wrote: The way I would do this is to put all of the differences in a list then take the maximum of the

Re: [Tutor] finding a maximum between the absolute difference of several columns

2012-02-16 Thread Andre' Walker-Loud
Hi Elaina, Vhel_fdiff3=[] for i in xrange(len(Vmatch3_1)): Vhel_fdiff3.append(max([abs(Vmatch3_1[i] - Vmatch3_2[i]),abs(Vmatch3_1[i] - Vmatch3_3[i]),abs(Vmatch3_3[i] - Vmatch3_2[i])])) #print Vhel_fdiff3 #appending writes a list, but numpy which makes the with_ work needs an