You can subscribe to this list here.
2000 |
Jan
(8) |
Feb
(49) |
Mar
(48) |
Apr
(28) |
May
(37) |
Jun
(28) |
Jul
(16) |
Aug
(16) |
Sep
(44) |
Oct
(61) |
Nov
(31) |
Dec
(24) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(56) |
Feb
(54) |
Mar
(41) |
Apr
(71) |
May
(48) |
Jun
(32) |
Jul
(53) |
Aug
(91) |
Sep
(56) |
Oct
(33) |
Nov
(81) |
Dec
(54) |
2002 |
Jan
(72) |
Feb
(37) |
Mar
(126) |
Apr
(62) |
May
(34) |
Jun
(124) |
Jul
(36) |
Aug
(34) |
Sep
(60) |
Oct
(37) |
Nov
(23) |
Dec
(104) |
2003 |
Jan
(110) |
Feb
(73) |
Mar
(42) |
Apr
(8) |
May
(76) |
Jun
(14) |
Jul
(52) |
Aug
(26) |
Sep
(108) |
Oct
(82) |
Nov
(89) |
Dec
(94) |
2004 |
Jan
(117) |
Feb
(86) |
Mar
(75) |
Apr
(55) |
May
(75) |
Jun
(160) |
Jul
(152) |
Aug
(86) |
Sep
(75) |
Oct
(134) |
Nov
(62) |
Dec
(60) |
2005 |
Jan
(187) |
Feb
(318) |
Mar
(296) |
Apr
(205) |
May
(84) |
Jun
(63) |
Jul
(122) |
Aug
(59) |
Sep
(66) |
Oct
(148) |
Nov
(120) |
Dec
(70) |
2006 |
Jan
(460) |
Feb
(683) |
Mar
(589) |
Apr
(559) |
May
(445) |
Jun
(712) |
Jul
(815) |
Aug
(663) |
Sep
(559) |
Oct
(930) |
Nov
(373) |
Dec
|
From: Paul F. D. <du...@us...> - 2001-03-30 18:13:48
|
You're linked now on the home page. http://pfdubois.com/numpy. I think I misspelled it in my previous message. |
From: Paul F. D. <pa...@pf...> - 2001-03-30 18:11:41
|
The Numeric home page http://pfdubois.com/numeric has been updated to include: a. New HTML and PDF version of the documentation b. New Happydoc-generated documentation for the modules, using the new Happydoc. c. Description of and link to Scientific Python. d. Navigation buttons and a hit counter. numpy.sourceforge.net still exists and links to this page. The "Homepage" button on the project page goes directly to it. I moved the contents to a web site I control so that I can work on it more easily -- sourceforge sites are hard to work on due to security. This site is hosted by Yahoo and seems to perform well. Like any site, it can be down, but I think it is down less than SF. |
From: Paul F. D. <du...@ll...> - 2001-03-28 19:08:34
|
Numeric 19.0.0 is available in source form and Windows / Python 2.1b2 zip= form. Thanks to Pete Shinners, the source should now compile with Python 2.0. Any developer who to makes a Numeric-19.0.0-Python-2.0.zip, I think the = users would like that. |
From: Paul F. D. <pa...@pf...> - 2001-03-27 22:53:54
|
I found that in 18.4.0 I had missed a couple of spots that needed version specs to setup. (2.1b2a requires a version argument to setup; I believe this was an error and they will fix it before 2.1 final, but for now I wanted it to work and it won't hurt as the information is not used) I need a volunteer to figure out what changes are needed to make 18.4 compile with Pythons before 2.1. I think all that is needed are some #if's in the right place and then some logic in the setup to set the appropriate macro when the python version is too early. But I don't have time to do it and the new "bug release" policy for Python will increase the number of stragglers who don't go to new versions. |
From: Jack J. <ja...@or...> - 2001-03-26 08:47:28
|
The setup scripts need a bit of massaging for compatibility with the distutils included with Python 2.1b2, distutils now insists on version information being available. I can hack some info in, but I thought I'd best leave this to people more knowledgeable than me... -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jac...@or... | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm |
From: Paul F. D. <pa...@pf...> - 2001-03-25 00:04:21
|
There is a new Pyfort release 6.3 that lets Pyfort work with Python 6.1b2. Please get it from http://sourceforge.net/projects/pyfortran if you are using 6.1b2. This Pyfort will work just fine with any Python version it used to work with. |
From: Paul F. D. <pa...@pf...> - 2001-03-24 22:44:57
|
Pyfort-6.3, a Python/Fortran connection tool, has been released at http://pyfortran.sourceforge.net. This version is required if you are upgrading to Python 6.1b2. |
From: Paul F. D. <pa...@pf...> - 2001-03-24 11:35:32
|
I don't know if this will help but the change is that each instance stores some (unbound) method objects. In the previous release these were stored in the class object but it turns out that isn't right wrt inheritance. I haven't much experience with pickling but I will try adding a pickle test to my test suite and see if I can figure this out. -----Original Message----- From: num...@li... [mailto:num...@li...]On Behalf Of Tavis Rudd Sent: Friday, March 23, 2001 7:28 PM To: num...@li... Subject: [Numpy-discussion] possible bug: pickling MaskedArrays with the latest cvs version of MA Hi, I'm having difficulty pickling with the new implementation of activeattributes in the cvs version of MA. With the standard pickle module I get the this traceback: >>> import MA >>> a = MA.arange(3400) >>> fp = open('a.pickle','w') >>> from pickle import dump, load >>> dump(a,fp) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/local/lib/python2.1/pickle.py", line 932, in dump Pickler(file, bin).dump(object) File "/usr/local/lib/python2.1/pickle.py", line 109, in dump self.save(object) File "/usr/local/lib/python2.1/pickle.py", line 211, in save f(self, object) File "/usr/local/lib/python2.1/pickle.py", line 471, in save_inst getstate = object.__getstate__ File "/usr/local/lib/python2.1/site-packages/MA/activeattr.py", line 39, in __getattr__ return d['_get'](self, name) File "/usr/local/lib/python2.1/site-packages/MA/activeattr.py", line 80, in basic_get return self.__dict__[name] KeyError: __getstate__ With the cPickle module I'm getting: >>> from cPickle import dump, load >>> dump(a,file) Traceback (most recent call last): File "<stdin>", line 1, in ? cPickle.UnpickleableError: Cannot pickle <type 'instance method'> objects >>> This is with python 2.1b1 and the latest cvs version of Numeric. Has anyone else had this problem? Tavis _______________________________________________ Numpy-discussion mailing list Num...@li... http://lists.sourceforge.net/lists/listinfo/numpy-discussion |
From: Tavis R. <ta...@ca...> - 2001-03-24 03:16:53
|
Hi, I'm having difficulty pickling with the new implementation of activeattributes in the cvs version of MA. With the standard pickle module I get the this traceback: >>> import MA >>> a = MA.arange(3400) >>> fp = open('a.pickle','w') >>> from pickle import dump, load >>> dump(a,fp) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/local/lib/python2.1/pickle.py", line 932, in dump Pickler(file, bin).dump(object) File "/usr/local/lib/python2.1/pickle.py", line 109, in dump self.save(object) File "/usr/local/lib/python2.1/pickle.py", line 211, in save f(self, object) File "/usr/local/lib/python2.1/pickle.py", line 471, in save_inst getstate = object.__getstate__ File "/usr/local/lib/python2.1/site-packages/MA/activeattr.py", line 39, in __getattr__ return d['_get'](self, name) File "/usr/local/lib/python2.1/site-packages/MA/activeattr.py", line 80, in basic_get return self.__dict__[name] KeyError: __getstate__ With the cPickle module I'm getting: >>> from cPickle import dump, load >>> dump(a,file) Traceback (most recent call last): File "<stdin>", line 1, in ? cPickle.UnpickleableError: Cannot pickle <type 'instance method'> objects >>> This is with python 2.1b1 and the latest cvs version of Numeric. Has anyone else had this problem? Tavis |
From: Aureli S. F. <Aur...@ip...> - 2001-03-22 10:58:47
|
Thanks to all answers in spite of the not so understandable question. I have solved my problem NewAxis seems tome the simplest and most elegant way to solve the problem. Maybe a name like 'VirtualAxis' would clarify more the question. Regards >On Mon, 19 Mar 2001, Aureli Soria Frisch wrote: >[...] >> I have a N-dimensional array A and I want to operate in one of the axis (k) >> with a 1 dimensional array (for instance, subtracting an array B of length >> k). I have looked for some solutions in the manual and did not found any. >[...] >> Is there any more elegant solution? The key point is: how to operate a N-D >> array with a 1D in one determined axis? ################################# Aureli Soria Frisch Fraunhofer IPK Dept. Pattern Recognition post: Pascalstr. 8-9, 10587 Berlin, Germany e-mail:au...@ip... fon: +49 30 39 00 61 50 fax: +49 30 39 17 517 ################################# |
From: Konrad H. <hi...@cn...> - 2001-03-20 14:17:42
|
> I have a N-dimensional array A and I want to operate in one of the axis (k) > with a 1 dimensional array (for instance, subtracting an array B of length > k). I have looked for some solutions in the manual and did not found any. I am not sure that I understand your problem exactly, but here's the solution to what I think your problem is ;-) from Scientific.indexing import index_expression import Numeric indices = index_expression[::] + \ (len(A.shape)-k-1)*index_expression[Numeric.NewAxis] result = A-B[indices] This uses a module from ScientificPython which provides syntactic sugar for indexing. In fact, the module is so simple that I include it here: --------------------------------------------------------------------------- # A nicer way to build up index tuples for arrays. # # You can do all this with slice() plus a few special objects, # but there's a lot to remember. This version is simpler because # it uses the standard array indexing syntax. # # Written by Konrad Hinsen <hi...@cn...> # last revision: 1999-7-23 # """This module provides a convenient method for constructing array indices algorithmically. It provides one importable object, 'index_expression'. For any index combination, including slicing and axis insertion, 'a[indices]' is the same as 'a[index_expression[indices]]' for any array 'a'. However, 'index_expression[indices]' can be used anywhere in Python code and returns a tuple of indexing objects that can be used in the construction of complex index expressions. Sole restriction: Slices must be specified in the double-colon form, i.e. a[::] is allowed, whereas a[:] is not. """ class _index_expression_class: import sys maxint = sys.maxint def __getitem__(self, item): if type(item) != type(()): return (item,) else: return item def __len__(self): return self.maxint def __getslice__(self, start, stop): if stop == self.maxint: stop = None return self[start:stop:None] index_expression = _index_expression_class() --------------------------------------------------------------------------- Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hi...@cn... Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- |
From: John J. L. <ph...@cs...> - 2001-03-19 22:56:47
|
On Mon, 19 Mar 2001, Aureli Soria Frisch wrote: [...] > I have a N-dimensional array A and I want to operate in one of the axis (k) > with a 1 dimensional array (for instance, subtracting an array B of length > k). I have looked for some solutions in the manual and did not found any. [...] > Is there any more elegant solution? The key point is: how to operate a N-D > array with a 1D in one determined axis? I'm not sure I understand exactly what you want. Are you sure you don't want to do A[n1,n2,...,:,...,nN] instead? (the '...'s are just an indication of where the extra numbers would go, not the literal Numeric syntax. If so, you can use s = slice(None) # n is your list [n1, n2, n3, ..., n(k-1), n(k+1), ...,nN] n.insert(k, s) print "answer is", A[n] - B print slice.__doc__ (possibly there is an off-by-one error in the above, but you get the idea) John |
From: Warren F. <fo...@sl...> - 2001-03-19 21:38:39
|
On Mon, 19 Mar 2001, Aureli Soria Frisch wrote: > Hello! > > I have a N-dimensional array A and I want to operate in one of the axis (k) > with a 1 dimensional array (for instance, subtracting an array B of length > k). I have looked for some solutions in the manual and did not found any. > > So after testing a lot I found following solution: > > A=Numeric.array(a) > > A.shape=(a1,a2,...,ak,...,aN) #where N is any int value > > B=Numeric.array(b) > B.shape=(ak,) newshape = [1] * len(A.shape) newshape[k] = A.shape[k] B.shape = newshape result = A - B wbf |
From: Jon S. <js...@wm...> - 2001-03-19 21:23:32
|
Probably this can help you. Look in the manual about the ... operator, too. bash-2.02$ python Python 1.6b1 (#3, Aug 30 2000, 08:32:49) [GCC 2.7.2.1] on freebsd3 Copyright (c) Corporation for National Research Initiatives. Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam. >>> from Numeric import * >>> a=array([[2,3],[4,5],[6,7]]) >>> b=array([9,10,11]) >>> a.shape (3, 2) >>> b.shape (3,) >>> print a+b[:,NewAxis] [[11 12] [14 15] [17 18]] >>> Jon Saenz. | Tfno: +34 946012470 Depto. Fisica Aplicada II | Fax: +34 944648500 Facultad de Ciencias. \\ Universidad del Pais Vasco \\ Apdo. 644 \\ 48080 - Bilbao \\ SPAIN On Mon, 19 Mar 2001, Aureli Soria Frisch wrote: > Hello! > > I have a N-dimensional array A and I want to operate in one of the axis (k) > with a 1 dimensional array (for instance, subtracting an array B of length > k). I have looked for some solutions in the manual and did not found any. > > So after testing a lot I found following solution: > > A=Numeric.array(a) > > A.shape=(a1,a2,...,ak,...,aN) #where N is any int value > > B=Numeric.array(b) > B.shape=(ak,) > > > A_modified=Numeric.reshape(A, (a1*a2*...*aN,ak)) #ak is not included in the > product > > result=[] > for i in A_modified: > result.append(i - B) > > > and finally reshaping the result appropriately. But it does not seem > neither elegant nor simple. > > Is there any more elegant solution? The key point is: how to operate a N-D > array with a 1D in one determined axis? > > Thanks in advance. > Regards, > Aureli > > > > > ################################# > Aureli Soria Frisch > Fraunhofer IPK > Dept. Pattern Recognition > > post: Pascalstr. 8-9, 10587 Berlin, Germany > e-mail:au...@ip... > fon: +49 30 39 00 61 50 > fax: +49 30 39 17 517 > ################################# > > > > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > http://lists.sourceforge.net/lists/listinfo/numpy-discussion > |
From: Aureli S. F. <Aur...@ip...> - 2001-03-19 20:05:27
|
Hello again, I have forgotten in my previous mail that I want the procedure to run independent of the value of N... So the value of N is not known during the implementation. Sorry about the duplication... >Hello! > >I have a N-dimensional array A and I want to operate in one of the axis >(k) with a 1 dimensional array (for instance, subtracting an array B of >length k). I have looked for some solutions in the manual and did not >found any. > >So after testing a lot I found following solution: > >A=Numeric.array(a) > >A.shape=(a1,a2,...,ak,...,aN) #where N is any int value > >B=Numeric.array(b) >B.shape=(ak,) > > >A_modified=Numeric.reshape(A, (a1*a2*...*aN,ak)) #ak is not included in >the product > >result=[] >for i in A_modified: > result.append(i - B) > > >and finally reshaping the result appropriately. But it does not seem >neither elegant nor simple. > >Is there any more elegant solution? The key point is: how to operate a N-D >array with a 1D in one determined axis? > >Thanks in advance. >Regards, >Aureli > ################################# Aureli Soria Frisch Fraunhofer IPK Dept. Pattern Recognition post: Pascalstr. 8-9, 10587 Berlin, Germany e-mail:au...@ip... fon: +49 30 39 00 61 50 fax: +49 30 39 17 517 ################################# |
From: Aureli S. F. <Aur...@ip...> - 2001-03-19 19:59:36
|
Hello! I have a N-dimensional array A and I want to operate in one of the axis (k) with a 1 dimensional array (for instance, subtracting an array B of length k). I have looked for some solutions in the manual and did not found any. So after testing a lot I found following solution: A=Numeric.array(a) A.shape=(a1,a2,...,ak,...,aN) #where N is any int value B=Numeric.array(b) B.shape=(ak,) A_modified=Numeric.reshape(A, (a1*a2*...*aN,ak)) #ak is not included in the product result=[] for i in A_modified: result.append(i - B) and finally reshaping the result appropriately. But it does not seem neither elegant nor simple. Is there any more elegant solution? The key point is: how to operate a N-D array with a 1D in one determined axis? Thanks in advance. Regards, Aureli ################################# Aureli Soria Frisch Fraunhofer IPK Dept. Pattern Recognition post: Pascalstr. 8-9, 10587 Berlin, Germany e-mail:au...@ip... fon: +49 30 39 00 61 50 fax: +49 30 39 17 517 ################################# |
From: Karl B. <Kar...@um...> - 2001-03-16 15:07:23
|
Thank you very much! "Paul F. Dubois" wrote: > > Release 18.1 is available as a Windows zip and source tar.gz > I have pasted in the change notes for both Numpy itself and MA. > > RELEASE 18 REQUIRES PYTHON 2.1 > > Documents have been updated. Homepage (only) resited to a place I can work > on more easily. > > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > http://lists.sourceforge.net/lists/listinfo/numpy-discussion -- Cheers, Karl Bellve |
From: Paul F. D. <pa...@pf...> - 2001-03-16 01:46:45
|
Release 18.1 is available as a Windows zip and source tar.gz I have pasted in the change notes for both Numpy itself and MA. RELEASE 18 REQUIRES PYTHON 2.1 Documents have been updated. Homepage (only) resited to a place I can work on more easily. |
From: Karl B. <Kar...@um...> - 2001-03-15 14:02:24
|
One of the things I am confused about is how to link to numpy on a windows NT. In the docs, it basically just says to include objectarray.h. But, I assume I must also include a static lib or a DLL. I also assume that the pyd files are just dlls under windows. Since they don't have the dll extension, I must manually load them. Is this correct? I just plan to export a 2D array via PyArray_FromDimsAndData. The let a user run a python script and wait for it to finish. -- Cheers, Karl Bellve ICQ # 13956200 Biomedical Imaging Group TLCA# 7938 University of Massachusetts Email: Kar...@um... Phone: (508) 856-6514 Fax: (508) 856-1840 PGP Public key: finger kd...@mo... |
From: Chris B. <cb...@jp...> - 2001-03-14 18:00:29
|
Chris Barker wrote: > >>> t = array(['abcd','aacd','ddfa','qqcd']) > > >>> t2 = t.astype(UnsignedInt8) > > >>> nonzero(equal(t2,ord('c'))[:,2]) > > array([0, 1, 3]) OOPS. For a little better performance: >>> nonzero(equal(t2[:,2],ord('c'))) array([0, 1, 3]) -- Christopher Barker, Ph.D. cb...@jp... --- --- --- http://www.jps.net/cbarker -----@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Water Resources Engineering ------ @ ------ @ ------ @ Coastal and Fluvial Hydrodynamics ------- --------- -------- ------------------------------------------------------------------------ ------------------------------------------------------------------------ |
From: Chris B. <cb...@jp...> - 2001-03-14 17:49:13
|
"Paul F. Dubois" wrote: > ------------------------------------------- > If I have a character array t: > > >>> t = array(['abcd','aacd','ddfa','qqcd']) > >>> print t > [[a b c d] > [a a c d] > [d d f a] > [q q c d]] > > I'm trying to find the row numbers that > have a 'c' in the third column > (and I'm trying to avoid a 'for' loop). > > What's the most efficient way to > create an array that contains the indexes > of the rows that match a particular pattern? > (using masks?) > > The answer should be an array ([0,1,3]) > The obvious approach using equal doesn't seem to work. I'll forward your > request. It seems that equal() does not support the char type (anyone know why not?): >>> equal(t,'c') Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: function not supported for these types, and can't coerce to supported types The following is kind of an ugly kludge, but it does work: >>> from Numeric import * >>> t = array(['abcd','aacd','ddfa','qqcd']) >>> t2 = t.astype(UnsignedInt8) >>> nonzero(equal(t2,ord('c'))[:,2]) array([0, 1, 3]) -Chris -- Christopher Barker, Ph.D. cb...@jp... --- --- --- http://www.jps.net/cbarker -----@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Water Resources Engineering ------ @ ------ @ ------ @ Coastal and Fluvial Hydrodynamics ------- --------- -------- ------------------------------------------------------------------------ ------------------------------------------------------------------------ |
From: Tim H. <tim...@ie...> - 2001-03-14 17:15:17
|
From: "Aureli Soria Frisch" <Aur...@ip...> > Hi, > > It seems there is a problem when multiplying complex arrays, but maybe that > is already solved for the new NumPy 17.3, is it? > > The product of complex arrays does not seem to be right. > > Code lines: > > >>> a=a_conj[:] This is your problem here. Array's differ from lists and such in that slicing does not produce a copy. 'a' and 'a_conj' point to the same data after this operation. One way to produce a copy is to use 'a = Numeric.array(a_conj)' > >>> a > array([[ 1.-0.j, 1.-1.j, 1.-2.j], > [ 1.-3.j, 1.-4.j, 1.-5.j], > [ 1.-6.j, 1.-7.j, 1.-8.j]]) > >>> a.imag=a.imag*-1 > >>> a > array([[ 1.+0.j, 1.+1.j, 1.+2.j], > [ 1.+3.j, 1.+4.j, 1.+5.j], > [ 1.+6.j, 1.+7.j, 1.+8.j]]) If you look at a_conj now, you should see that it is the same as a. > >>> Numeric.multiply(a,a_conj) > array([[ 1. +0.j, 0. +2.j, -3. +4.j], > [ -8. +6.j, -15. +8.j, -24.+10.j], > [-35.+12.j, -48.+14.j, -63.+16.j]]) So what you have here is really a squared. So, you could get this to work by replacing slicing with array(a_conf). A much simpler way is: a = Numeric.conjugate(a_conj) a*a_conj #... Hope that clears things up for you. -tim > where the answer should be [[1+0j,2+0j,5+0j][10+0j,... > > ################################# > Aureli Soria Frisch > Fraunhofer IPK > Dept. Pattern Recognition > > post: Pascalstr. 8-9, 10587 Berlin, Germany > e-mail:au...@ip... > fon: +49 30 39 00 61 50 > fax: +49 30 39 17 517 > ################################# > > > > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > http://lists.sourceforge.net/lists/listinfo/numpy-discussion |
From: Aureli S. F. <Aur...@ip...> - 2001-03-14 16:34:45
|
Hi, It seems there is a problem when multiplying complex arrays, but maybe that is already solved for the new NumPy 17.3, is it? The product of complex arrays does not seem to be right. Code lines: >>> a=a_conj[:] >>> a array([[ 1.-0.j, 1.-1.j, 1.-2.j], [ 1.-3.j, 1.-4.j, 1.-5.j], [ 1.-6.j, 1.-7.j, 1.-8.j]]) >>> a.imag=a.imag*-1 >>> a array([[ 1.+0.j, 1.+1.j, 1.+2.j], [ 1.+3.j, 1.+4.j, 1.+5.j], [ 1.+6.j, 1.+7.j, 1.+8.j]]) >>> Numeric.multiply(a,a_conj) array([[ 1. +0.j, 0. +2.j, -3. +4.j], [ -8. +6.j, -15. +8.j, -24.+10.j], [-35.+12.j, -48.+14.j, -63.+16.j]]) where the answer should be [[1+0j,2+0j,5+0j][10+0j,... ################################# Aureli Soria Frisch Fraunhofer IPK Dept. Pattern Recognition post: Pascalstr. 8-9, 10587 Berlin, Germany e-mail:au...@ip... fon: +49 30 39 00 61 50 fax: +49 30 39 17 517 ################################# |
From: Paul F. D. <pa...@pf...> - 2001-03-14 14:57:51
|
The obvious approach using equal doesn't seem to work. I'll forward your request. -- Paul -----Original Message----- From: Sam Tannous [mailto:sta...@ci...] Sent: Wednesday, March 14, 2001 3:31 AM To: Paul F. Dubois Subject: numpy array matching Paul, I can't seem to get my question posted to the discussion list. Could you please post it for me? (Or even answer it for me?) Thanks, Sam ------------------------------------------- If I have a character array t: >>> t = array(['abcd','aacd','ddfa','qqcd']) >>> print t [[a b c d] [a a c d] [d d f a] [q q c d]] I'm trying to find the row numbers that have a 'c' in the third column (and I'm trying to avoid a 'for' loop). What's the most efficient way to create an array that contains the indexes of the rows that match a particular pattern? (using masks?) The answer should be an array ([0,1,3]) Thanks for any tips, Sam |
From: Paul F. D. <pa...@pf...> - 2001-03-14 06:36:54
|
Also b = a[0::2] + a[1::2]*1.0j -----Original Message----- From: num...@li... [mailto:num...@li...]On Behalf Of Warren Focke Sent: Tuesday, March 13, 2001 6:00 PM To: Eric Hagemann Cc: Num...@li... Subject: Re: [Numpy-discussion] conversion to complex > >>> a=array([1,2,3,4], 'f') > >>> b=zeros(len(a)/2, 'F') > >>> b.real=a[0:4:2] > >>> b.imag=a[1:4:2] > >>> b > array([ 1.+2.j, 3.+4.j],'F') or, if you feel brave > >>> c=fromstring(a.tostring(), 'F') > >>> c > array([ 1.+2.j, 3.+4.j],'F') wbf On Tue, 13 Mar 2001, Eric Hagemann wrote: > I have an array of floats that is an interleaved stream of complex (real/imag) values that I want to promote to complex. My current method uses the following > > a=array([1,2,3,4]) > > b = a[0:4:2] + cmath.sqrt(-1)*a[1:4:2] > > Is there a more elegant way ? I am hoping to avoid explicit for loops etc > _______________________________________________ Numpy-discussion mailing list Num...@li... http://lists.sourceforge.net/lists/listinfo/numpy-discussion |