Re: [Numpy-discussion] Please keep Numpy master working on Py3

2011-02-01 Thread David
On 02/02/2011 02:57 PM, Mark Wiebe wrote: > On Tue, Feb 1, 2011 at 9:49 PM, David > wrote: > > > > > > In the meantime, I put the relevant header in > numpy/core/src/private, to > > make the dependency clearer. > > Following that argument, there

Re: [Numpy-discussion] Please keep Numpy master working on Py3

2011-02-01 Thread Mark Wiebe
On Tue, Feb 1, 2011 at 9:49 PM, David wrote: > > > In the meantime, I put the relevant header in numpy/core/src/private, to > > make the dependency clearer. > > Following that argument, there are other unwanted dependencies between > multiarray and ufunc, causing circular dependencies. I don't

Re: [Numpy-discussion] Please keep Numpy master working on Py3

2011-02-01 Thread David
On 02/02/2011 01:53 PM, David wrote: > On 02/02/2011 08:58 AM, Pauli Virtanen wrote: >> Hi, >> >> The master branch did not build today on Python 3. Please make sure that >> your code works correctly also on Python 3, before pushing it. >> >> *** >> >> I mostly fixed the stuff for now, mostly

Re: [Numpy-discussion] Please keep Numpy master working on Py3

2011-02-01 Thread David
On 02/02/2011 08:58 AM, Pauli Virtanen wrote: > Hi, > > The master branch did not build today on Python 3. Please make sure that > your code works correctly also on Python 3, before pushing it. > > *** > > I mostly fixed the stuff for now, mostly just the usual bytes vs unicode. > > On Python

[Numpy-discussion] Postdoctoral Positions at Univ of Alabama

2011-02-01 Thread Eric Carlson
Hello All, I apologize for using this venue, and flame me if you must, but I wish to announce two Postdoctoral positions in the Department of Chemical and Biological Engineering at the University of Alabama, in Tuscaloosa, AL, USA. The funding concerns modeling of geological sequestration of CO2

Re: [Numpy-discussion] Please keep Numpy master working on Py3

2011-02-01 Thread Pauli Virtanen
On Tue, 01 Feb 2011 16:42:04 -0800, Mark Wiebe wrote: [clip] > Sorry about that, I had hoped to be able to use the build-bot to > test/diagnose the issues, but it's down and I didn't pursue it further. Hmm, I see Github's SVN gateway is broken again. Perhaps it could be possible to make it work d

Re: [Numpy-discussion] Please keep Numpy master working on Py3

2011-02-01 Thread Pauli Virtanen
On Tue, 01 Feb 2011 16:42:04 -0800, Mark Wiebe wrote: [clip: problem 1] > This looks like it's a problem in new_iterator_pywrap.c, in > PySequenceMethods npyiter_as_sequence. I got this error when trying to > slice before implementing the slot sq_slice. I copied the definition > from array_as_seq

Re: [Numpy-discussion] Please keep Numpy master working on Py3

2011-02-01 Thread Mark Wiebe
On Tue, Feb 1, 2011 at 3:58 PM, Pauli Virtanen wrote: > Hi, > > The master branch did not build today on Python 3. Please make sure that > your code works correctly also on Python 3, before pushing it. > Sorry about that, I had hoped to be able to use the build-bot to test/diagnose the issues, b

[Numpy-discussion] Please keep Numpy master working on Py3

2011-02-01 Thread Pauli Virtanen
Hi, The master branch did not build today on Python 3. Please make sure that your code works correctly also on Python 3, before pushing it. *** I mostly fixed the stuff for now, mostly just the usual bytes vs unicode. On Python 3, the tests however give two non-obvious failures -- I'm not

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-02-01 Thread eat
Hi David, (I think the discussion has divergegd, but newer mind ;-) I didn't treat far as a vector (yet, but for sure it's doable). Anyway befor going on more details I'll suggest you*ll study my new attachment. As far I can see, you just have 'simple' polynomial evaluatons, which I have refactor

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-02-01 Thread DParker
I tested with mixed scalar and array inputs for t and far, and same size arrays for both. I did not test with improperly sized arrays but I would expect (desire) an exception to be raised when the arrays are not broadcastable. Still the code seems like an ugly hack... David Parker Chromalloy

[Numpy-discussion] numpy.var fails on memmap

2011-02-01 Thread Bartosz Telenczuk
Hi, numpy.var on a memory mapped array returns a 0-d memmap object instead of a scalar (like with numpy arrays): >>> import numpy as np >>> fp = np.memmap('test.mm', dtype='float32', mode='w+', shape=(10,)) >>> fp[:] = np.random.rand(10) >>> fp_var= np.var(fp) >>> print type(fp_var) >>> print f

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-02-01 Thread josef . pktd
On Tue, Feb 1, 2011 at 3:20 PM, wrote: > I'm not sure I need to dive into cython or C for this - performance is not > an issue for my problem - I just want a flexible function that will accept > scalars or arrays. > > Both Sebastian's and eat's suggestions show using indexing to handle the > cond

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-02-01 Thread John Salvatier
Good things to know. On Tue, Feb 1, 2011 at 1:10 PM, Sturla Molden wrote: > Den 01.02.2011 20:50, skrev John Salvatier: > > I am curious: why you recommend against this? Using the C-API through > > cython seems more attractive than using the Cython-specific numpy > > features since they need a s

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-02-01 Thread Sturla Molden
Den 01.02.2011 20:50, skrev John Salvatier: > I am curious: why you recommend against this? Using the C-API through > cython seems more attractive than using the Cython-specific numpy > features since they need a specific number of dimensions (and I don't > think they broadcast) and don't seem t

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-02-01 Thread DParker
I'm not sure I need to dive into cython or C for this - performance is not an issue for my problem - I just want a flexible function that will accept scalars or arrays. Both Sebastian's and eat's suggestions show using indexing to handle the conditional statements in the original function. The

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-02-01 Thread Sturla Molden
Den 01.02.2011 20:50, skrev John Salvatier: > I am curious: why you recommend against this? For the same reason I prefer Fortran 95 over C for numerical programming: clarity. > Using the C-API through cython seems more attractive than using the > Cython-specific numpy features since they need

Re: [Numpy-discussion] create a numpy array of images

2011-02-01 Thread Francesc Alted
A Tuesday 01 February 2011 19:58:16 Sturla Molden escrigué: > Den 01.02.2011 18:58, skrev Christopher Barker: > > But if you really have big collections of images, you might try > > memory mapped arrays -- as Sturla pointed out they wont' let you > > create monster arrays on a 32 bit python, > > B

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-02-01 Thread Benjamin Root
On Tue, Feb 1, 2011 at 1:30 PM, John Salvatier wrote: > Have you thought about using cython to work with the numpy C-API ( > http://wiki.cython.org/tutorials/numpy#UsingtheNumpyCAPI)? This will be > fast, simple (you can mix and match Python and Cython). > > As for your specific issue: you can sim

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-02-01 Thread John Salvatier
I am curious: why you recommend against this? Using the C-API through cython seems more attractive than using the Cython-specific numpy features since they need a specific number of dimensions (and I don't think they broadcast) and don't seem that much easier. Are there hidden disadvantages to usin

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-02-01 Thread Sturla Molden
Den 01.02.2011 20:30, skrev John Salvatier: > Have you thought about using cython to work with the numpy C-API > (http://wiki.cython.org/tutorials/numpy#UsingtheNumpyCAPI)? This will > be fast, simple (you can mix and match Python and Cython). Never do this. Cython has NumPy array support now:

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-02-01 Thread John Salvatier
Have you thought about using cython to work with the numpy C-API ( http://wiki.cython.org/tutorials/numpy#UsingtheNumpyCAPI)? This will be fast, simple (you can mix and match Python and Cython). As for your specific issue: you can simply cast to all the inputs to numpy arrays (using asarray http:/

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-02-01 Thread DParker
Thanks for the advice. Using Sebastian's advice I was able to write a version that worked when the input arguments are both arrays with the same length. The code provided by eat works when t is an array, but not for an array of far. The numpy.vectorize version works with any combination of sc

Re: [Numpy-discussion] create a numpy array of images

2011-02-01 Thread Sturla Molden
Den 01.02.2011 18:58, skrev Christopher Barker: > But if you really have big collections of images, you might try memory > mapped arrays -- as Sturla pointed out they wont' let you create monster > arrays on a 32 bit python, But they will on 64 bit Python :D We can just memory map a temporary fil

Re: [Numpy-discussion] create a numpy array of images

2011-02-01 Thread Christopher Barker
On 2/1/11 8:31 AM, Friedrich Romstedt wrote: > In case you *have* to downsample: > > I also ran into this, with the example about my 5 images ... > im.resize((newx newy), PIL.Image.ANTIALIAS) will be your friend. > http://www.pythonware.com/library/pil/handbook/image.htm. If you want to downsample

Re: [Numpy-discussion] create a numpy array of images

2011-02-01 Thread Christopher Barker
On 2/1/11 12:39 AM, Asmi Shah wrote: > I have one more question: how to avoid the limitation of memoryerror in > numpy. as I have like 200 images to stack in the numpy array of say > 1024x1344 resolution.. have any idea apart from downsampling? If I'm doing my math right, that's 262 MB, shouldn't

[Numpy-discussion] SWIG examples from the Cookbook

2011-02-01 Thread K. B.
Hi, I asked a question on this mailing list few days ago but nobody could help me. So I wonder if it is more appropriate to post this question on the Scipy-Dev mailing list or to fill a bug repport. Thank you ! KB - original post : Hi, I'd like to ask for your help regarding the

Re: [Numpy-discussion] create a numpy array of images

2011-02-01 Thread Friedrich Romstedt
2011/2/1 Asmi Shah : > Thanks a lot Friedrich and Chris.. It came in handy to use PIL and numpy.. > :) :-) > I have one more question: how to avoid the limitation of memoryerror in > numpy. as I have like 200 images to stack in the numpy array of say > 1024x1344 resolution.. have any idea apart f

Re: [Numpy-discussion] create a numpy array of images

2011-02-01 Thread Sturla Molden
Den 01.02.2011 15:07, skrev Asmi Shah: Hi Zach and Sturla, Well I am a "she" :)) I apologize, I did not deduce correct gender from your name :) Thanks for your inputs.. I am using 32 bit python as have so many libraries integrated with it.. and moreover, i plan to put this volume rendered

Re: [Numpy-discussion] current numpy in python 2.5 ?

2011-02-01 Thread Charles R Harris
On Tue, Feb 1, 2011 at 8:22 AM, Warren Weckesser < warren.weckes...@enthought.com> wrote: > > > On Tue, Feb 1, 2011 at 9:16 AM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > >> >> >> On Tue, Feb 1, 2011 at 8:02 AM, Mark Sienkiewicz wrote: >> >>> Hi, >>> >>> I looked on the web site, but

Re: [Numpy-discussion] current numpy in python 2.5 ?

2011-02-01 Thread Warren Weckesser
On Tue, Feb 1, 2011 at 9:16 AM, Charles R Harris wrote: > > > On Tue, Feb 1, 2011 at 8:02 AM, Mark Sienkiewicz wrote: > >> Hi, >> >> I looked on the web site, but I couldn't find a list of python versions >> that numpy expects to work on. Is the trunk still expected to work in >> Python 2.5 ? >>

Re: [Numpy-discussion] current numpy in python 2.5 ?

2011-02-01 Thread Charles R Harris
On Tue, Feb 1, 2011 at 8:02 AM, Mark Sienkiewicz wrote: > Hi, > > I looked on the web site, but I couldn't find a list of python versions > that numpy expects to work on. Is the trunk still expected to work in > Python 2.5 ? > > I'm asking because it doesn't, but I don't want to file a bug repor

Re: [Numpy-discussion] current numpy in python 2.5 ?

2011-02-01 Thread Asmi Shah
http://sourceforge.net/projects/numpy/files/NumPy/1.5.1/ here you will fine the latest version of numpy with different python versions.. On Tue, Feb 1, 2011 at 4:02 PM, Mark Sienkiewicz wrote: > Hi, > > I looked on the web site, but I c

[Numpy-discussion] current numpy in python 2.5 ?

2011-02-01 Thread Mark Sienkiewicz
Hi, I looked on the web site, but I couldn't find a list of python versions that numpy expects to work on. Is the trunk still expected to work in Python 2.5 ? I'm asking because it doesn't, but I don't want to file a bug report if it is not expected to. The problem shows up when I run numpy.t

Re: [Numpy-discussion] create a numpy array of images

2011-02-01 Thread Asmi Shah
Hi Zach and Sturla, Well I am a "she" :)) Thanks for your inputs.. I am using 32 bit python as have so many libraries integrated with it.. and moreover, i plan to put this volume rendered on a web page or distribute the exe in the end, so want to be minimal for the memory requirements on the clien

Re: [Numpy-discussion] create a numpy array of images

2011-02-01 Thread Sturla Molden
Den 1. feb. 2011 kl. 11.20 skrev "totonixs...@gmail.com" : > I have one more question: how to avoid the limitation of memoryerror > in >> >> numpy. as I have like 200 images to stack in the numpy array of say >> 1024x1344 resolution.. have any idea apart from downsampling? > > Take a look at nu

Re: [Numpy-discussion] create a numpy array of images

2011-02-01 Thread totonixs...@gmail.com
Hi, On Tue, Feb 1, 2011 at 6:39 AM, Asmi Shah wrote: > Thanks a lot Friedrich and Chris.. It came in handy to use PIL and numpy.. > :) > @Zach, m aware of the poor handling of 16bit images in PIL, for that I am > using imagemagick to convert it into 8 bit first and then PIL for rest of > the proc

Re: [Numpy-discussion] using loadtxt() for given number of rows?

2011-02-01 Thread Robert Cimrman
On Mon, 31 Jan 2011, Christopher Barker wrote: > On 1/31/11 4:39 AM, Robert Cimrman wrote: >> I work with text files which contain several arrays separated by a few >> lines of other information, for example: >> >> POINTS 4 float >> -5.00e-01 -5.00e-01 0.00e+00 >> 5.00e-01 -5.0

Re: [Numpy-discussion] create a numpy array of images

2011-02-01 Thread Asmi Shah
Thanks a lot Friedrich and Chris.. It came in handy to use PIL and numpy.. :) @Zach, m aware of the poor handling of 16bit images in PIL, for that I am using imagemagick to convert it into 8 bit first and then PIL for rest of the processing.. I have one more question: how to avoid the limitation