Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: <jouni.seppanen@gm...>  20041114 16:09:03

Hi, In Matlab, the command [i,j] =3D find(mat >=3D 3) causes i and j to hold the indices where the condition holds. (If there is only one output argument, it will hold indices to the flattened version of the condition.) Matplotlib's mlab.find() seems to work for onedimensional arrays only. Here's what I'm using to emulate Matlab's find; it only seems to work with Numeric, not numarray, and I have no idea whether this is an efficient way to achieve the goal. I was going to suggest that the utility be included in matplotlib, but perhaps it should then be generalized to work with numarray as well. I wonder if anyone has any ideas on how to do this? I'm a newcomer to matplotlib (and Numeric, etc.), so please do point out if there is a simpler way to achieve the effect of Matlab's find. def find(condition): """ Return the indices where condition is true. For arrays of N>=3D2 dimensions, returns a tuple T of N arrays such that the condition is true at indices (T[0][i],...,T[N1][i]). """ sh =3D condition.shape if len(sh) =3D=3D 1: return nonzero(condition) idx =3D indices(sh) cond =3D ravel(condition) return tuple([compress(cond, ravel(idx[i]))=20 for i in range(len(sh))]) =20 Jouni K Sepp=E4nen http://www.iki.fi/jks 
From: <jouni.seppanen@gm...>  20041114 18:36:50

On Sun, 14 Nov 2004 18:08:59 +0200, Jouni K Sepp=E4nen <jouni.seppanen@...> wrote: > > Here's what I'm using to emulate Matlab's find; it only seems to work > with Numeric, not numarray Oops  actually it seems that after from matplotlib.numerix import ravel, indices, compress the function works whether numerix is using numarray or Numeric. Making a special case of singledimensional inputs is not very elegant, but doing otherwise would break compatibility with the existing mlab.find; and I guess there is no way in Python of emulating Matlab's detection of the number of output arguments. =20 Jouni K Sepp=E4nen http://www.iki.fi/jks 
From: Darren Dale <dd55@co...>  20041114 21:49:34

Hi Jouni, Jouni K Sepp=E4nen wrote: >On Sun, 14 Nov 2004 18:08:59 +0200, Jouni K Sepp=E4nen ><jouni.seppanen@...> wrote: > =20 > >>Here's what I'm using to emulate Matlab's find; it only seems to work >>with Numeric, not numarray >> =20 >> > >Oops  actually it seems that after > >from matplotlib.numerix import ravel, indices, compress > >the function works whether numerix is using numarray or Numeric. > >Making a special case of singledimensional inputs is not very >elegant, but doing otherwise would break compatibility with the >existing mlab.find; and I guess there is no way in Python of emulating >Matlab's detection of the number of output arguments. > =20 > I looked at this a while back, and came to the same conclusion. Thats an=20 interesting question, can Python determine the number of output=20 arguments? I dont know of a convenient function call, but it seems like=20 that information must exist somewhere. I'll ask at c.l.p. Darren 
From: <nalon@te...>  20041115 03:39:10

Hello, I think I've found a bug in mathtext  sorry if this appeared before, I couldn't find it in the list archives. When I try: xlabel(r"$(\Omega_a^' + \Omega_a)$") I don't get what I expected. The label shows \Omega_a and stops there. Further tests showed that, whenever I try a single quote in a mathtext string, the text is not rendered from the quote on. This might not be a bug, I might be doing something wrong. If this is the case, please tell me how to do it right. Thanks in advance.  José Alexandre Nalon nalon@... 
From: Darren Dale <dd55@co...>  20041115 03:56:45

> xlabel(r"$(\Omega_a^' + \Omega_a)$") > > I don't get what I expected. The label shows \Omega_a and stops > there. Further tests showed that, whenever I try a single quote > in a mathtext string, the text is not rendered from the quote on. > > This might not be a bug, I might be doing something wrong. If > this is the case, please tell me how to do it right. > try replacing ^' with ^\prime Darren 
From: John Hunter <jdhunter@ac...>  20041115 04:17:59

>>>>> "Jos=E9" =3D=3D Jos=E9 Alexandre Nalon <nalon@...> writes: Jos=E9> Hello, I think I've found a bug in mathtext  sorry if this Jos=E9> appeared before, I couldn't find it in the list archives. Jos=E9> When I try: Jos=E9> xlabel(r"$(\Omega_a^' + \Omega_a)$") Jos=E9> I don't get what I expected. The label shows \Omega_a and Jos=E9> stops there. Further tests showed that, whenever I try a Jos=E9> single quote in a mathtext string, the text is not rendered Jos=E9> from the quote on. Jos=E9> This might not be a bug, I might be doing something Jos=E9> wrong. If this is the case, please tell me how to do it Jos=E9> right. I don't believe your use of ' is valid TeX. Try Omega_a^\prime Jos=E9> Thanks in advance. Sure thing, JDH 