Re: [Numpy-discussion] Project for Cython integration with NumPy
Hi Dag On Tue, Apr 1, 2008 at 12:52 AM, Dag Sverre Seljebotn [EMAIL PROTECTED] wrote: I am going to apply for a Google Summer of Code project about Developing Cython towards better NumPy integration (Cython: http://cython.org). Anyone interested in how this is done can have a look at the links below, any feedback is welcome. The application I am going to submit (to Python Foundation): http://wiki.cython.org/DagSverreSeljebotn/soc I now have time to actively discuss and improve it so any feedback from the NumPy community is greatly appreciated. Sorry for only responding now; I was traveling back from Europe. The project your propose has important implications for NumPy. Currently, much of the core is implemented in C and very few people have in-depth knowledge of its inner workings. We therefore have fewer eyes on that code than we'd like. Furthermore, there are only two ways of extending the core: 1) use Python callbacks, which are slow or 2) learn the C API and deal with reference counting -- too much to ask from a scientist who simply wishes to implement a fast algorithm. There are also some other projects, like scipy.ndimage, that could do with a fair bit of refactoring, and this task would be so much easier if Cython could generate the C-level ndarray code; we have precious little developer resources available as it is, and would rather spend it on solving problems than on arranging low-level API calls. Having the following implemented would already be a vast improvement on the current situation: - Array indexing x[1,2] x[1:2,3:4] x[1,...] x[1,:] - Assignment x[1,2] = 3 x[1,...] = 1 ... - Calling array methods: y = x.sum() Doing this would be easier with Travis Oliphant's numpy developer's reference at hand, and, if I recall the page on scipy.org (which is currently down) correctly, he would provide it to you free of charge on request. I am very excited about your proposal, and I really hope it takes off. Let us know if there is anything we can do to help. Best of luck, Stéfan ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Project for Cython integration with NumPy
Hi Dag On Tue, Apr 1, 2008 at 12:52 AM, Dag Sverre Seljebotn [EMAIL PROTECTED] wrote: I am going to apply for a Google Summer of Code project about Developing Cython towards better NumPy integration (Cython: http://cython.org). Anyone interested in how this is done can have a look at the links below, any feedback is welcome. The application I am going to submit (to Python Foundation): http://wiki.cython.org/DagSverreSeljebotn/soc I now have time to actively discuss and improve it so any feedback from the NumPy community is greatly appreciated. See especially: http://wiki.cython.org/enhancements/numpy One more comment about the constructor described on the page above. It would be good if we could have the same syntax as the current numpy.ndarray, and then simply call through to the underlying C constructor. We'd also need zeros, empty, ones_like and some other select functions. The goal is to remain as faithful as possible to the original API, so that there is hardly a distinction between Python and Cython. Cheers Stéfan ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Applying PIL patch
Thank you for the reply. I in fact did not have the latest PIL binary. It works beautifully now. Luckily I won't be needing RGBA support soon. Izak - Original Message From: Stéfan van der Walt [EMAIL PROTECTED] To: Discussion of Numerical Python numpy-discussion@scipy.org Sent: Monday, March 31, 2008 11:45:52 PM Subject: Re: [Numpy-discussion] Applying PIL patch Unfortunately, RGBA images cannot be read this way. A patch that fixes the issue was posted here: http://www.mail-archive.com/[EMAIL PROTECTED]/msg01482.html No response from the Image SIG guys. Regards Stéfan On Mon, Mar 31, 2008 at 6:29 PM, Christopher Barker [EMAIL PROTECTED] wrote: izak marais wrote: Sorry for the beginner question. I want to apply the PIL-numpy patch from http://www.scipy.org/Cookbook/PIL?highlight=%28PIL%29 . I have the latest windows binaries of numpy, scipy and PIL installed. Then you have the patch already-- it was added to the latest PIL. http://effbot.org/zone/pil-changes-116.htm -Chris ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. http://tc.deals.yahoo.com/tc/blockbuster/text5.com___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Applying PIL patch
Stéfan wrote:Unfortunately, RGBA images cannot be read this way. Apparently it does not work with 16bit greyscale tif images either. For anyone else stumbling upon this thread, there is a work-about to get the data into a numpy array. i = Image.open('16bitGreyscaleImage.tif') a = numpy.array(i.getdata())# a 1d numpy array a = a.reshape(i.size) #2d numpy array Perhaps there is a better way of doing it (?), but this works for me. Izak You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. http://tc.deals.yahoo.com/tc/blockbuster/text5.com___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Project for Cython integration with NumPy
Dag Sverre Seljebotn wrote: http://wiki.cython.org/enhancements/numpy One more comment about the constructor described on the page above. I read this a different way now, if what you meant is the parameters to ndarray in cdef c_numpy.ndarray(c_numpy.float, 2) x then my answer is that the paranthezis is not part of a constructor, it is part of the type of the variable (which is not a Python concept at all). This is perhaps clearer here: import numpy def negative_grayscale_image(numpy.ndarray(numpy.uint8, 2) img): cdef int i, j for i in range(arr.shape[0]): for j in range(arr.shape[1]): img[i, j] = 255 - img[i, j] -- Dag Sverre ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Project for Cython integration with NumPy
http://wiki.cython.org/enhancements/numpy One more comment about the constructor described on the page above. It would be good if we could have the same syntax as the current numpy.ndarray, and then simply call through to the underlying C constructor. We'd also need zeros, empty, ones_like and some other select functions. The goal is to remain as faithful as possible to the original API, so that there is hardly a distinction between Python and Cython. This will be automatic from how Cython operates :-) And that is, I think, what makes all of this great. Objects are Python objects all the time and by default retain all Python implementation, and we only override this implementation when the behaviour is retained. I'll walk through this code line by line: cdef c_numpy.ndarray(c_numpy.float, 2) x x = exp(4 + numpy.zeros([10, 10], dtype=numpy.float)) y = x + 3 print x[1, 3] print y[3, 5] #1: This is only a variable type declaration and constructs nothing. #2: Operating on Python objects as normal (there is nothing "special" about numpy.zeros from the perspective of Cython, it returns a Python object like all other Python functions), and the resulting object is then assigned to the typed x variable; which is no different from assigning it to an untyped variable except that a run-time type-check assertion is inserted (is the Python object an ndarray object with the right dimensions and data type). #3: (x + 3) will treat x as a Python object once again, so y will be an untyped variable referencing an ndarray like normal Python. #4: This is where it gets interesting. Because x is typed so that Cython knows the C structure of the Python objects, it translates this directly to a lookup in the buffer, using stride information, so that it ends up as saying something like *(x-data + x-strides[0] * 1 + x-strides[1] * 3) directly in C (though hopefully we can in time cache strides lookups outside for loops etc, see the gcc discussion on the page). #5: Here the data is instead accessed through the ndarray's Python __getitem__, which is much slower: A tuple is constructed, 3 and 5 put into the tuple, the tuple passed to ndarray.__getitem__ (or similar for extension types...) and so on. Question: How does strides fit in this? I've been thinking that strides could merely fall back to the Python access method because it is somewhat of a high-level operation; is there any significant gains in skipping the Python access layer? (However this question is not important for the design and either approach will fit in, so it is not a big concern for me now.) -- Dag Sverre ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] planet.scipy.org
Hi, The planet is no longer accessible. Anyone has the same issue ? Matthieu 2008/1/1, Jarrod Millman [EMAIL PROTECTED]: Hey, I just wanted to announce that we now have a NumPy/SciPy blog aggregator thanks to Gaël Varoquaux: http://planet.scipy.org/ Feel free to contact me if you have a blog that you would like included. Thanks, -- Jarrod Millman Computational Infrastructure for Research Labs 10 Giannini Hall, UC Berkeley phone: 510.643.4014 http://cirl.berkeley.edu/ ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion -- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] server down
Hi, I cannot access the numpy, scipy, or astropy repositories at scipy.org. The servers appear to be down. [redcedar:~/dev/scipy] chanley% svn update svn: PROPFIND request failed on '/svn/scipy/trunk' svn: PROPFIND of '/svn/scipy/trunk': could not connect to server (http://svn.scipy.org) Thanks, Chris -- Christopher Hanley Systems Software Engineer Space Telescope Science Institute 3700 San Martin Drive Baltimore MD, 21218 (410) 338-4338 ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] planet.scipy.org
On Tue, Apr 01, 2008 at 02:29:13PM +0200, Matthieu Brucher wrote: The planet is no longer accessible. Anyone has the same issue ? Yes, the scipy.org server is down. I think we need to wait for the US to wake up to take care of this. Ga�l ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] planet.scipy.org
Fixed now...many apologies for the outage. Travis On Apr 1, 2008, at 8:19 AM, Gael Varoquaux wrote: On Tue, Apr 01, 2008 at 02:29:13PM +0200, Matthieu Brucher wrote: The planet is no longer accessible. Anyone has the same issue ? Yes, the scipy.org server is down. I think we need to wait for the US to wake up to take care of this. Gaël ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] missing function in numpy.ma?
Hi Pierre, Im ccing Bob on this, he's the main developper for cdms2 package. At this point I think Travis original suggestion was the best. We should leave it like it was for 1.0.5 There's a lot of changes to do in order to get the backward compatibility going. And I feel it should wait until 1.1. I don't feel comfortable doing all these changes and releasing our software like this. It's a major change and it needs to be tested for a while. OUr users are massively hammering the MA and rely on it so much. Although I do see the usefulness of the new ma and at term I believe it has major merits to be used instead of oldnumeric.ma. Your thoughts? C. Pierre GM wrote: Charles, Any idea where that comes from ? No, not really. Seems that TransientVariable(*args) doesn't work. I guess it's because it has inherited a __call__method, and tries to use that method instead of the __new__. Try to call TransientVariable.__new__ instead of just TransientVariable in l505 of avariables.py, and see how it goes. You may want to rethink what subSlice does as well. Instead of calling the class constructor, you can also just create a view of your array and update the attributes accordingly. Once again, a stripped-down version of the class and its parents would be useful. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] confusion in eigenlib code
hi i came across some code for eigenface construction from some images ,using the old Numeric . http://www.owlnet.rice.edu/~elec301/Projects99/faces/code.html In the eigenlib.py http://www.owlnet.rice.edu/~elec301/Projects99/faces/code/eigenlib.py i converted the calls to Numeric functions to their numpy equivalents (to linalg.eigh() and numpy.dot())and ran the code.In this eigenlib.py i am confused by some parts where they derrive eigenvectors and sort them evalues, evectors = LinearAlgebra.eigenvectors(L) # sort them by eigenvalue and keep the top M_prime evs = map(None, evalues, evectors) evs.sort() evs.reverse() evs = evs[0:M_prime] # write those into the directory v = map(lambda x: x[1], evs) self.u = [] for k in range(M_prime): print(' ' + str(k+1)) self.u.append(Numeric.matrixmultiply(v[k], self.Phi)) #self.vector_to_image(self.u[-1], '%s/eig%03d.gif' % (dir, k)) (Here self.Psi is the average face from a collection of face images and self.Phi is obtained by substracting Psi from original image data ...mean centering i guess) what i can't understand in the above code is that when evs[0:M_prime] is taken it takes the rows from evectors.Is not the correct way to take a column of evectors as an eigenvector? If someone can make this clear please do thanks gordon ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy installation
On Mon, Mar 31, 2008 at 11:06 PM, Robert Kern [EMAIL PROTECTED] wrote: On Mon, Mar 31, 2008 at 4:17 PM, Amit Itagi [EMAIL PROTECTED] wrote: Hi, I am having problems with numpy installation. 1) These is an atlas 3.8.0 library installed somewhere in the search path. However, the installation gives errors with that installation. Is there a way to tell the installer to install the default (possibly slower) blas, instead of using the one in the path ? Create a site.cfg file with the appropriate section; copy and modify the site.cfg.example file. *I figured how to specify a particular installation of the libraries. I want to do the opposite. How do I specify the following in site.cfg - Don't search for the library. Assume that it is absent and use the default slower library ?* * * 2) Also, my main Python directory is called Python-2.5.2. When I try to configure with the installprefix, it changes Python-2.5.2 to python-2.5.2 and creates a new directory. How can I make the installer not convert the upper-case P to a lower-case ? Can you give more information like the platform you are on, the full path to this directory, the exact commands that you executed, and the results of these commands? *I am installing this on a CENTOS linux platform (64 bit AMD opteron). The path to my python directory is /home/amit/packages/Python-2.5.2 . If I temporarily make the atlas library unavailable (by renaming the directory to some name that is not in the path), I can perform the build. Now in the installation stage, I use python setup.py and then choose the option 2/home/amit/packages/Python-2.5.2. In the proposed sys.argv the path is shown as /home/amit/packages/python-2.5.2. Incidentally, it also creates this new directory during install. * *Thanks Robert. Rgds, Amit* -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] linalg.eigh() newbie doubt
but the notation evectors[:3] will give me an ndarray of shape(3,6) Am i missing something here? Yes : evectors[:3] selects the first three lines, evectors[:,3] selects the fourth column. Matthieu -- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] linalg.eigh() newbie doubt
Yes : evectors[:3] selects the first three lines, evectors[:,3] selects the fourth column. arggg!! my mistake! sorry Lorenzo thanks Matthieu gordon ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] linalg.eigh() newbie doubt
The normalized eigenvector corresponding to the eigenvalue w[i] is the column v[:,i]. so, yes, the eigvec coresponding to the eigval w[i] is v[:,i]. Lorenzo sorry i don't understand from the above sample(unordered) if i select the the 4th eigenvalue i get 1.7 evals[3]=1.7 i believe the corresponding eigenvector should be the 4th column in evectors? [6. 7. 5. 4. 4. 4.] but the notation evectors[:3] will give me an ndarray of shape(3,6) Am i missing something here? thanks gordon ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] missing function in numpy.ma?
Charles Doutriaux wrote: Hi Pierre, Im ccing Bob on this, he's the main developper for cdms2 package. I've uploaded the original ma.py file back into oldnumeric so that oldnumeric.ma should continue to work as before. Can you verify this? Thanks, -Travis O. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] missing function in numpy.ma?
All, Because numpy.ma.MaskedArray objects are now derived from classical ndarrays, the subclassing rules should be followed. As we observed yesterday with Charles, the adaptation is not as straightforward as we hoped. If you have time constraints, the easiest would indeed be to revert to the previous implementation of MaskedArray (viz, as an object, where the initialization is performed with a __init__ function). Now, I'm not sure how well it's gonna interface with numpy.ma, we need to try. In the long run however, I think you should try to switch to regular ndarrays and ndarray subclasses. I do agree it's more of a long-term process, but I'd be happy to help (you and I are working more or less on the same field anyway, I needed some tools to handle my environmental/climatic time series) Let me try to cook something up. In the meantime, please keep me posted. P. On Tuesday 01 April 2008 11:07:41 Charles Doutriaux wrote: Hi Pierre, Im ccing Bob on this, he's the main developper for cdms2 package. At this point I think Travis original suggestion was the best. We should leave it like it was for 1.0.5 There's a lot of changes to do in order to get the backward compatibility going. And I feel it should wait until 1.1. I don't feel comfortable doing all these changes and releasing our software like this. It's a major change and it needs to be tested for a while. OUr users are massively hammering the MA and rely on it so much. Although I do see the usefulness of the new ma and at term I believe it has major merits to be used instead of oldnumeric.ma. Your thoughts? ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] missing function in numpy.ma?
Hi Travis, I get this: import numpy, numpy.oldnumeric.ma as MA, numpy.oldnumeric as Numeric, PropertiedClasses File /lgm/cdat/latest/lib/python2.5/site-packages/numpy/oldnumeric/ma.py, line 2204, in module array.mean = _m(average) NameError: name 'average' is not defined C. Travis E. Oliphant wrote: Charles Doutriaux wrote: Hi Pierre, Im ccing Bob on this, he's the main developper for cdms2 package. I've uploaded the original ma.py file back into oldnumeric so that oldnumeric.ma should continue to work as before. Can you verify this? Thanks, -Travis O. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] output arguments for dot(), tensordot()
Hi all, is there a particular reason why dot() and tensordot() don't have output arguments? Andreas signature.asc Description: This is a digitally signed message part. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy installation
On Tue, Apr 1, 2008 at 8:16 AM, Amit Itagi [EMAIL PROTECTED] wrote: I figured how to specify a particular installation of the libraries. I want to do the opposite. How do I specify the following in site.cfg - Don't search for the library. Assume that it is absent and use the default slower library ? If you want to avoid compiling with say ATLAS, you can do something like ATLAS=None python setup.py build Disabling one specific version of one library is more difficult, though. cheers, David ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy installation
On Tue, Apr 1, 2008 at 10:16 AM, Amit Itagi [EMAIL PROTECTED] wrote: I am installing this on a CENTOS linux platform (64 bit AMD opteron). The path to my python directory is /home/amit/packages/Python-2.5.2 . If I temporarily make the atlas library unavailable (by renaming the directory to some name that is not in the path), I can perform the build. Now in the installation stage, I use python setup.py and then choose the option 2/home/amit/packages/Python-2.5.2. In the proposed sys.argv the path is shown as /home/amit/packages/python-2.5.2. Incidentally, it also creates this new directory during install. Looking at the code, I can confirm that the menu system is simply buggy and the cause of your problem. Do not use it. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] missing function in numpy.ma?
Charles Doutriaux wrote: Hi Travis, I get this: import numpy, numpy.oldnumeric.ma as MA, numpy.oldnumeric as Numeric, PropertiedClasses File /lgm/cdat/latest/lib/python2.5/site-packages/numpy/oldnumeric/ma.py, line 2204, in module array.mean = _m(average) NameError: name 'average' is not defined Thanks, Can you try again? Best regards, -Travis ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy installation
On Tue, Apr 1, 2008 at 10:16 AM, Amit Itagi [EMAIL PROTECTED] wrote: On Mon, Mar 31, 2008 at 11:06 PM, Robert Kern [EMAIL PROTECTED] wrote: On Mon, Mar 31, 2008 at 4:17 PM, Amit Itagi [EMAIL PROTECTED] wrote: Hi, I am having problems with numpy installation. 1) These is an atlas 3.8.0 library installed somewhere in the search path. However, the installation gives errors with that installation. Is there a way to tell the installer to install the default (possibly slower) blas, instead of using the one in the path ? Create a site.cfg file with the appropriate section; copy and modify the site.cfg.example file. I figured how to specify a particular installation of the libraries. I want to do the opposite. How do I specify the following in site.cfg - Don't search for the library. Assume that it is absent and use the default slower library ? There's nothing default about it. You should use the [lapack_opt] section to specify whichever BLAS and LAPACK libraries you like, even if they are not optimized. 2) Also, my main Python directory is called Python-2.5.2. When I try to configure with the installprefix, it changes Python-2.5.2 to python-2.5.2 and creates a new directory. How can I make the installer not convert the upper-case P to a lower-case ? Can you give more information like the platform you are on, the full path to this directory, the exact commands that you executed, and the results of these commands? I am installing this on a CENTOS linux platform (64 bit AMD opteron). The path to my python directory is /home/amit/packages/Python-2.5.2 . If I temporarily make the atlas library unavailable (by renaming the directory to some name that is not in the path), I can perform the build. Now in the installation stage, I use python setup.py and then choose the option 2/home/amit/packages/Python-2.5.2. In the proposed sys.argv the path is shown as /home/amit/packages/python-2.5.2. Incidentally, it also creates this new directory during install. Can you just do a python setup.py install instead of going through the menu system? The menu system may be bitrotten. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] missing function in numpy.ma?
Hi Travis, Ok we're almost there, in my test suite i get: maresult = numpy.core.ma.take(ta, indices, axis=axis) AttributeError: 'module' object has no attribute 'ma' data = numpy.core.ma.take(ax[:], indices) AttributeError: 'module' object has no attribute 'ma' I don't know if it was automatically put there by the converter or if we put it by hand. If it's the first one, you might want to correct this, otherwise don't worry it's easy enough to fix (i think ?) C. Travis E. Oliphant wrote: Charles Doutriaux wrote: Hi Travis, I get this: import numpy, numpy.oldnumeric.ma as MA, numpy.oldnumeric as Numeric, PropertiedClasses File /lgm/cdat/latest/lib/python2.5/site-packages/numpy/oldnumeric/ma.py, line 2204, in module array.mean = _m(average) NameError: name 'average' is not defined Thanks, Can you try again? Best regards, -Travis ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy installation
On Tue, Apr 1, 2008 at 12:43 PM, David Cournapeau [EMAIL PROTECTED] wrote: On Tue, Apr 1, 2008 at 8:16 AM, Amit Itagi [EMAIL PROTECTED] wrote: I figured how to specify a particular installation of the libraries. I want to do the opposite. How do I specify the following in site.cfg - Don't search for the library. Assume that it is absent and use the default slower library ? If you want to avoid compiling with say ATLAS, you can do something like ATLAS=None python setup.py build *The shell does not understand this command. Is this the correct syntax ? Thanks Rgds, Amit * Disabling one specific version of one library is more difficult, though. cheers, David ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy installation
On Tue, Apr 1, 2008 at 12:43 PM, David Cournapeau [EMAIL PROTECTED] wrote: On Tue, Apr 1, 2008 at 8:16 AM, Amit Itagi [EMAIL PROTECTED] wrote: I figured how to specify a particular installation of the libraries. I want to do the opposite. How do I specify the following in site.cfg - Don't search for the library. Assume that it is absent and use the default slower library ? If you want to avoid compiling with say ATLAS, you can do something like ATLAS=None python setup.py build *Ok, this part works. I am using tcsh. So I had to do setenv ATLAS None. Rgds, Amit * Disabling one specific version of one library is more difficult, though. cheers, David ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy installation
On Tue, Apr 1, 2008 at 1:31 PM, Amit Itagi [EMAIL PROTECTED] wrote: On Tue, Apr 1, 2008 at 1:21 PM, Robert Kern [EMAIL PROTECTED] wrote: On Tue, Apr 1, 2008 at 10:16 AM, Amit Itagi [EMAIL PROTECTED] wrote: I am installing this on a CENTOS linux platform (64 bit AMD opteron). The path to my python directory is /home/amit/packages/Python-2.5.2 . If I temporarily make the atlas library unavailable (by renaming the directory to some name that is not in the path), I can perform the build. Now in the installation stage, I use python setup.py and then choose the option 2/home/amit/packages/Python-2.5.2. In the proposed sys.argv the path is shown as /home/amit/packages/python-2.5.2. Incidentally, it also creates this new directory during install. Looking at the code, I can confirm that the menu system is simply buggy and the cause of your problem. Do not use it. Robert, Could you kindly suggest an alternate way of getting it right ? Just like every other Python package: $ python setup.py build ... $ sudo python setup.py install --prefix=/home/amit/packages/Python-2.5.2 http://docs.python.org/inst/inst.html -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Project for Cython integration with NumPy
Hi Dag On Tue, Apr 1, 2008 at 11:06 AM, Dag Sverre Seljebotn [EMAIL PROTECTED] wrote: One more comment about the constructor described on the page above. It would be good if we could have the same syntax as the current numpy.ndarray, and then simply call through to the underlying C constructor. We'd also need zeros, empty, ones_like and some other select functions. The goal is to remain as faithful as possible to the original API, so that there is hardly a distinction between Python and Cython. This will be automatic from how Cython operates :-) And that is, I think, what makes all of this great. Objects are Python objects all the time and by default retain all Python implementation, and we only override this implementation when the behaviour is retained. I'll walk through this code line by line: cdef c_numpy.ndarray(c_numpy.float, 2) x x = exp(4 + numpy.zeros([10, 10], dtype=numpy.float)) y = x + 3 print x[1, 3] print y[3, 5] Thanks for this example; I didn't notice that you were making a type declaration, so my original comment was not valid. #3: (x + 3) will treat x as a Python object once again, so y will be an untyped variable referencing an ndarray like normal Python. I can foresee certain situations under which we can predict the type of the result of operations like this one. Would it be possible to then handle 'y' as an ndarray as well, instead of reverting to Python object calls? Regards Stéfan ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Project for Cython integration with NumPy
I can foresee certain situations under which we can predict the type of the result of operations like this one. Would it be possible to then handle 'y' as an ndarray as well, instead of reverting to Python object calls? Indeed - plans are underway to add automatic type inference to Cython. It is all about developer resources etc. (the preliminaries can be done in another GSoC project that we hope to get accepted). When/if that happens, a lot of typing will not be necesarry, including this case. This will be an automatic consequence of Cython compiler development and not something that would need to be specifically for the case of NumPy (well, one declares would some more operator and function type signatures for NumPy, and then it would work). Basically one would then only need to declare the type of arguments to the function, while local variables would be inferred automatically. (Getting around this is impossible, though we might add a different syntax for type declaration (using decorators) so that the same code can also be run using the Python interpreter.) Perhaps in a year or so, if the current GSoCs are accepted :-) no promises though. -- Dag Sverre ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Project for Cython integration with NumPy
On Tue, Apr 01, 2008 at 10:48:30PM +0200, Dag Sverre Seljebotn wrote: though we might add a different syntax for type declaration (using decorators) so that the same code can also be run using the Python interpreter.) That would be very neat. I can see how you can get around dynamical typing in a very nice way using this. As the pypy projects says, giving a dynamically-typed language to people does not necessarily means they type dynamically-typed code. I must say I like the idea a lot, you are really pushing the concept all the way. Gaël ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy installation
Robert, I followed the recommended steps. Now I have numpy and numpy-1.0.4-py2.5.egg-info in Python-2.5.2/lib/python2.5/site-packages. However, I am not able to import numpy at the python prompt. Do I have to set pythonpath or something ? Thanks Rgds, Amit On Tue, Apr 1, 2008 at 2:44 PM, Robert Kern [EMAIL PROTECTED] wrote: On Tue, Apr 1, 2008 at 1:31 PM, Amit Itagi [EMAIL PROTECTED] wrote: On Tue, Apr 1, 2008 at 1:21 PM, Robert Kern [EMAIL PROTECTED] wrote: On Tue, Apr 1, 2008 at 10:16 AM, Amit Itagi [EMAIL PROTECTED] wrote: I am installing this on a CENTOS linux platform (64 bit AMD opteron). The path to my python directory is /home/amit/packages/Python-2.5.2 . If I temporarily make the atlas library unavailable (by renaming the directory to some name that is not in the path), I can perform the build. Now in the installation stage, I use python setup.py and then choose the option 2/home/amit/packages/Python-2.5.2. In the proposed sys.argv the path is shown as /home/amit/packages/python- 2.5.2. Incidentally, it also creates this new directory during install. Looking at the code, I can confirm that the menu system is simply buggy and the cause of your problem. Do not use it. Robert, Could you kindly suggest an alternate way of getting it right ? Just like every other Python package: $ python setup.py build ... $ sudo python setup.py install --prefix=/home/amit/packages/Python-2.5.2 http://docs.python.org/inst/inst.html -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy installation
On Tue, Apr 1, 2008 at 4:03 PM, Amit Itagi [EMAIL PROTECTED] wrote: Robert, I followed the recommended steps. Now I have numpy and numpy-1.0.4-py2.5.egg-info in Python-2.5.2/lib/python2.5/site-packages. However, I am not able to import numpy at the python prompt. Do I have to set pythonpath or something ? Possibly. Exactly what is in this .../Python-2.5.2/ directory? Is the python executable .../Python-2.5.2/bin/python? -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy installation
On Tue, Apr 1, 2008 at 4:21 PM, Amit Itagi [EMAIL PROTECTED] wrote: This directory is just the Python source distribution (post configure and make). I don't have root permissions to our cluster and the default python distribution is an older one. Hence, I have my custom Python distribution in this /Python-2.5.2/ directory. The binary is /Python-2.5.2/python . Okay, don't do that. You will have to actually install Python to another location. For example, make a directory ~/python2.5/. Now go to the Python source directory; it would probably be best to start with a clean one. Configure Python using ~/python2.5 as the prefix: $ ./configure --prefix=~/python2.5 Now make and make install. Add ~/python2.5/bin to your $PATH, preferably before /usr/bin or wherever the old python executable is. Build and install numpy using the ~/python2.5/bin/python binary. You should not need to set the --prefix. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] missing function in numpy.ma?
Charles Doutriaux wrote: Hi Travis, Ok we're almost there, in my test suite i get: maresult = numpy.core.ma.take(ta, indices, axis=axis) AttributeError: 'module' object has no attribute 'ma' data = numpy.core.ma.take(ax[:], indices) AttributeError: 'module' object has no attribute 'ma' I think the problem here is that numpy.core.ma is no longer the correct place.This should be numpy.oldnumeric.ma.take because numpy.oldnumeric.ma is the correct location. In my mind you shouldn't really have been using numpy.core.ma, but instead numpy.ma because whether things are in core or lib could change ;-) -Travis ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] output arguments for dot(), tensordot()
On Tue, Apr 1, 2008 at 11:56 AM, Andreas Klöckner [EMAIL PROTECTED] wrote: Hi all, is there a particular reason why dot() and tensordot() don't have output arguments? No technical reason. It just hasn't been done. If you were to implement it, we would be happy to accept it. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] newbie doubt about dot()
i am slightly confused by this maths i need to calculate wk=uk o (L-Psi) where uk=a vector of size (1 X N^2) o =scalar product l,Psi=vectors of (N^2 X 1) i have an ndarray U of shape(M X N^2)where uk is one of the rows , and L of shape (M X N^2) where l.transpose() is one of the rows, If i were to apply the above formula how can i find the matrix where wk is an element.? I know i have to use dot() but the rest i am finding a bit confusing can someone please help? harryos ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] newbie doubt about dot()
On Tue, 1 Apr 2008, harryos apparently wrote: i need to calculate wk=uk o (L-Psi) where uk=a vector of size (1 X N^2) o =scalar product l,Psi=vectors of (N^2 X 1) i have an ndarray U of shape(M X N^2)where uk is one of the rows , and L of shape (M X N^2) where l.transpose() is one of the rows, Your explanation is not fully clear to me, but perhaps the following will help. #dummy values rows = 2 cols = 3*3 U = numpy.ones((rows,cols)) + [[0],[1]] L = numpy.random.random((rows,cols)) - 0.5 Psi = numpy.ones((cols,1)) #computation numpy.dot(U,L.transpose() - Psi) hth, Alan Isaac ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion