Re: [Numpy-discussion] take not respecting masked arrays?

2010-02-28 Thread Pierre GM
On Mar 1, 2010, at 1:02 AM, Peter Shinners wrote: >> Here is the code as I would like it to work. > http://python.pastebin.com/CsEnUrSa > > > import numpy as np > > values = np.array((40, 18, 37, 9, 22)) > index = np.arange(3)[None,:] + np.arange(5)[:,None] > mask = index >= len(values) > > ma

Re: [Numpy-discussion] how to work with numpy.int8 in c

2010-02-28 Thread David Cournapeau
On Mon, Mar 1, 2010 at 1:35 PM, James Bergstra wrote: > Could someone point me to documentation (or even numpy src) that shows > how to allocate a numpy.int8 in C, or check to see if a PyObject is a > numpy.int8? In numpy, the type is described in the dtype type object, so you should create the a

Re: [Numpy-discussion] take not respecting masked arrays?

2010-02-28 Thread Pierre GM
On Feb 28, 2010, at 11:12 PM, Charles R Harris wrote: > > > __ > > Ah, Pierre, now that you are here... ;) Can you take a look at the invalid > value warnings in the masked array tests and maybe fix them up by turning > off the warnings where appropriate? I'd do it myself except that I he

Re: [Numpy-discussion] take not respecting masked arrays?

2010-02-28 Thread Peter Shinners
On 02/28/2010 08:01 PM, Pierre GM wrote: > On Feb 28, 2010, at 8:59 PM, Peter Shinners wrote: > >> I have a 2D masked array that has indices into a 1D array. I want to use >> some form of "take" to fetch the values into the 2D array. I've tried >> both numpy.take and numpy.ma.take, but they bot

[Numpy-discussion] how to work with numpy.int8 in c

2010-02-28 Thread James Bergstra
Could someone point me to documentation (or even numpy src) that shows how to allocate a numpy.int8 in C, or check to see if a PyObject is a numpy.int8? Thanks, James -- http://www-etud.iro.umontreal.ca/~bergstrj ___ NumPy-Discussion mailing list NumPy

Re: [Numpy-discussion] take not respecting masked arrays?

2010-02-28 Thread Charles R Harris
On Sun, Feb 28, 2010 at 9:01 PM, Pierre GM wrote: > On Feb 28, 2010, at 8:59 PM, Peter Shinners wrote: > > I have a 2D masked array that has indices into a 1D array. I want to use > > some form of "take" to fetch the values into the 2D array. I've tried > > both numpy.take and numpy.ma.take, but

Re: [Numpy-discussion] take not respecting masked arrays?

2010-02-28 Thread Pierre GM
On Feb 28, 2010, at 8:59 PM, Peter Shinners wrote: > I have a 2D masked array that has indices into a 1D array. I want to use > some form of "take" to fetch the values into the 2D array. I've tried > both numpy.take and numpy.ma.take, but they both return a new unmasked > array. Mmh. Surprisin

Re: [Numpy-discussion] Iterative Matrix Multiplication

2010-02-28 Thread Charles R Harris
On Sun, Feb 28, 2010 at 7:58 PM, Ian Mallett wrote: > On Sun, Feb 28, 2010 at 6:54 PM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > >> Why not just add a vector to get translation? There is no need to go the >> homogeneous form. Or you can just leave the vectors at length 4 and use a

Re: [Numpy-discussion] Iterative Matrix Multiplication

2010-02-28 Thread Ian Mallett
On Sun, Feb 28, 2010 at 6:54 PM, Charles R Harris wrote: > Why not just add a vector to get translation? There is no need to go the > homogeneous form. Or you can just leave the vectors at length 4 and use a > slice to access the first three components. That way you can leave the ones > in place.

Re: [Numpy-discussion] Iterative Matrix Multiplication

2010-02-28 Thread Charles R Harris
On Sun, Feb 28, 2010 at 7:35 PM, Ian Mallett wrote: > On Sun, Feb 28, 2010 at 6:31 PM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > >> As I understand it, you want *different* matrices applied to each vector? > > Nope--I need the same matrix applied to each vector. > > Because 3D tran

Re: [Numpy-discussion] Iterative Matrix Multiplication

2010-02-28 Thread Ian Mallett
On Sun, Feb 28, 2010 at 6:31 PM, Charles R Harris wrote: > As I understand it, you want *different* matrices applied to each vector? Nope--I need the same matrix applied to each vector. Because 3D translation matrices must, if I understand correctly be 4x4, the vectors must first be changed to

Re: [Numpy-discussion] Iterative Matrix Multiplication

2010-02-28 Thread Charles R Harris
On Sun, Feb 28, 2010 at 5:53 PM, Ian Mallett wrote: > Hi, > > I have a list of vec3 lists (e.g. [[1,2,3],[4,5,6],[7,8,9],...]). To every > single one of the vec3 sublists, I am currently applying transformations. I > need to optimize this with numpy. > > To get proper results, as far as I can te

[Numpy-discussion] take not respecting masked arrays?

2010-02-28 Thread Peter Shinners
I have a 2D masked array that has indices into a 1D array. I want to use some form of "take" to fetch the values into the 2D array. I've tried both numpy.take and numpy.ma.take, but they both return a new unmasked array. I can get it working by converting the take results into a masked array a

Re: [Numpy-discussion] Building Numpy Windows Superpack

2010-02-28 Thread David Cournapeau
Patrick Marsh wrote: > Hi David, > > There really isn't much in the way of commands that I've used - I > haven't gotten that far. So far, I've downloaded your binaries and then > attempted to set up my numpy site.cfg file to use your binaries. I used > the following as my site.cfg > > [atlas

Re: [Numpy-discussion] Iterative Matrix Multiplication

2010-02-28 Thread josef . pktd
On Sun, Feb 28, 2010 at 7:53 PM, Ian Mallett wrote: > Hi, > > I have a list of vec3 lists (e.g. [[1,2,3],[4,5,6],[7,8,9],...]). To every > single one of the vec3 sublists, I am currently applying transformations.  I > need to optimize this with numpy. > > To get proper results, as far as I can tel

Re: [Numpy-discussion] Building Numpy Windows Superpack

2010-02-28 Thread Patrick Marsh
Hi David, There really isn't much in the way of commands that I've used - I haven't gotten that far. So far, I've downloaded your binaries and then attempted to set up my numpy site.cfg file to use your binaries. I used the following as my site.cfg [atlas] library_dirs = d:\svn\BlasLapack\bina

[Numpy-discussion] Iterative Matrix Multiplication

2010-02-28 Thread Ian Mallett
Hi, I have a list of vec3 lists (e.g. [[1,2,3],[4,5,6],[7,8,9],...]). To every single one of the vec3 sublists, I am currently applying transformations. I need to optimize this with numpy. To get proper results, as far as I can tell, the vec3 lists must be expressed as vec4s: [[1,2,3],[4,5,6],[7

Re: [Numpy-discussion] [ANN]: Taylorpoly, an implementation of vectorized Taylor polynomial operations and request for opinions

2010-02-28 Thread Sebastian Walter
On Sun, Feb 28, 2010 at 9:06 PM, Friedrich Romstedt wrote: > 2010/2/28 Sebastian Walter : >>> I think I can use that to make my upy accept arbitrary functions, but >>> how do you apply sin() to a TTP? >> >> perform truncated Taylor expansion of  [y]_D = sin([x]_D), i.e. >> y_d = d^d/dt^d  sin( \su

Re: [Numpy-discussion] [ANN]: Taylorpoly, an implementation of vectorized Taylor polynomial operations and request for opinions

2010-02-28 Thread Friedrich Romstedt
2010/2/28 Sebastian Walter : >> I think I can use that to make my upy accept arbitrary functions, but >> how do you apply sin() to a TTP? > > perform truncated Taylor expansion of  [y]_D = sin([x]_D), i.e. > y_d = d^d/dt^d  sin( \sum_{k=0}^{D-1} x_k t^k) |_{t=0} > to obtain an explicit algorithm. >

Re: [Numpy-discussion] Speedup a code using apply_along_axis

2010-02-28 Thread Xavier Gnata
On 02/28/2010 08:17 PM, josef.p...@gmail.com wrote: > On Sun, Feb 28, 2010 at 1:51 PM, Xavier Gnata wrote: > >> Hi, >> >> I'm sure I reinventing the wheel with the following code: >> from numpy import * >> from scipy import polyfit,stats >> >> def f(x,y,z): >>return x+y+z >> M=fromfunction(

Re: [Numpy-discussion] Speedup a code using apply_along_axis

2010-02-28 Thread josef . pktd
On Sun, Feb 28, 2010 at 1:51 PM, Xavier Gnata wrote: > Hi, > > I'm sure I reinventing the wheel with the following code: > from numpy import * > from scipy import polyfit,stats > > def f(x,y,z): >    return x+y+z > M=fromfunction(f,(2000,2000,10)) > > def foo(M): >    ramp=where(M<1000)[0] is thi

Re: [Numpy-discussion] SciPy Mail List and Contacting Dave Kuhlman

2010-02-28 Thread Robert Kern
On Sun, Feb 28, 2010 at 10:37, Wayne Watson wrote: > Google shows there is a mail list for SciPy, but when I go to the web page When you say "the web page", please include the URL. Are you talking about this page: http://www.scipy.org/Mailing_Lists ? > it shows GMANE, and various feeds for S

[Numpy-discussion] Speedup a code using apply_along_axis

2010-02-28 Thread Xavier Gnata
Hi, I'm sure I reinventing the wheel with the following code: from numpy import * from scipy import polyfit,stats def f(x,y,z): return x+y+z M=fromfunction(f,(2000,2000,10)) def foo(M): ramp=where(M<1000)[0] l=len(ramp) t=arange(l) if(l>1): return polyfit(t,ramp,1)[0]

Re: [Numpy-discussion] SciPy Mail List and Contacting Dave Kuhlman

2010-02-28 Thread josef . pktd
On Sun, Feb 28, 2010 at 11:37 AM, Wayne Watson wrote: > Google shows there is a mail list for SciPy, but when I go to the web page > it shows GMANE, and various feeds for SciPy-Dev and User. Maybe I'm missing > something? > > Information about gmane.comp.python.scientific.user that's the gmane mi

Re: [Numpy-discussion] Reading and Comparing Two Files

2010-02-28 Thread Robert Love
On Feb 28, 2010, at 6:24 AM, Friedrich Romstedt wrote: > 2010/2/28 Robert Love : >> What is the efficient numpy way to compare data from two different files? >> For the nth line in each file I want to operate on the numbers. I've been >> using loadtxt() >> >> data_5x5 = N.loadtxt("file5") >

[Numpy-discussion] SciPy Mail List and Contacting Dave Kuhlman

2010-02-28 Thread Wayne Watson
Google shows there is a mail list for SciPy, but when I go to the web page it shows GMANE, and various feeds for SciPy-Dev and User. Maybe I'm missing something? Information about gmane.comp.python.scientific.user The archive for this list can be read the following ways: On the web, using

Re: [Numpy-discussion] Apply a function to all indices

2010-02-28 Thread Ernest Adrogué
28/02/10 @ 01:56 (-0500), thus spake David Warde-Farley: > On 26-Feb-10, at 8:12 AM, Ernest Adrogué wrote: > > > Thanks for the tip. I didn't know that... > > Also, frompyfunc appears to crash python when the last argument is 0: > > > > In [9]: func=np.frompyfunc(lambda x: x, 1, 0) > > > > In [10]

Re: [Numpy-discussion] Python 3 porting

2010-02-28 Thread Xavier Gnata
Hi, Do you plan to make some noise about that when numpy2.0 will be release? IMHO you should. Do you for instance plan to have a clear announcement on the scipy web site? Xavier > Hi, > > The test suite passes now on Pythons 2.4 - 3.1. Further testing is very > welcome -- also on Python 2.x. Plea

Re: [Numpy-discussion] Building Numpy Windows Superpack

2010-02-28 Thread Ralf Gommers
On Sun, Feb 28, 2010 at 12:35 PM, Patrick Marsh wrote: > Greetings, > > I have been trying to build the numpy superpack on windows using the > binaries posted by David. Unfortunately, I haven't even been able to > correctly write the site.cfg file to locate all three sets of binaries > needed fo

Re: [Numpy-discussion] [ANN]: Taylorpoly, an implementation of vectorized Taylor polynomial operations and request for opinions

2010-02-28 Thread Sebastian Walter
On Sun, Feb 28, 2010 at 12:47 AM, Friedrich Romstedt wrote: > Sebastian, and, please, be not offended by what I wrote.  I regret a > bit my jokes ... It's simply too late at night. no offense taken > > Friedrich > ___ > NumPy-Discussion mailing list > Nu

Re: [Numpy-discussion] [ANN]: Taylorpoly, an implementation of vectorized Taylor polynomial operations and request for opinions

2010-02-28 Thread Sebastian Walter
On Sun, Feb 28, 2010 at 12:30 AM, Friedrich Romstedt wrote: > 2010/2/27 Sebastian Walter : >> I'm sorry this comment turns out to be confusing. > > Maybe it's not important. > >> It has apparently quite the contrary effect of what I wanted to achieve: >> Since there is already a polynomial module

Re: [Numpy-discussion] Sorting objects with ndarrays

2010-02-28 Thread Gael Varoquaux
On Sun, Feb 28, 2010 at 03:01:18PM +0100, Friedrich Romstedt wrote: > > Well, I might not have to compare ndarrays, but fairly arbitrary > > structures (dictionnaries, classes and lists) as I am dealing with > > semi-structured data coming from a stack of unorganised experimental > > data. Python h

Re: [Numpy-discussion] Sorting objects with ndarrays

2010-02-28 Thread Friedrich Romstedt
> Well, I might not have to compare ndarrays, but fairly arbitrary > structures (dictionnaries, classes and lists) as I am dealing with > semi-structured data coming from a stack of unorganised experimental > data. Python has some logic for comparing these structures by comparing > their members, b

Re: [Numpy-discussion] Reading and Comparing Two Files

2010-02-28 Thread josef . pktd
On Sun, Feb 28, 2010 at 7:24 AM, Friedrich Romstedt wrote: > 2010/2/28 Robert Love : >> What is the efficient numpy way to compare data from two different files?   >> For the nth line in each file I want to operate on the numbers.   I've been >> using loadtxt() >> >> data_5x5 = N.loadtxt("file5")

Re: [Numpy-discussion] Reading and Comparing Two Files

2010-02-28 Thread Friedrich Romstedt
2010/2/28 Robert Love : > What is the efficient numpy way to compare data from two different files?   > For the nth line in each file I want to operate on the numbers.   I've been > using loadtxt() > > data_5x5 = N.loadtxt("file5") > > data_8x8 = N.loadtxt("file8") > > for line in data_5x5: >    

Re: [Numpy-discussion] Sorting objects with ndarrays

2010-02-28 Thread Gael Varoquaux
On Sun, Feb 28, 2010 at 01:05:15PM +0200, Pauli Virtanen wrote: > su, 2010-02-28 kello 10:25 +0100, Gael Varoquaux kirjoitti: > [clip] > > The problem is that ndarrays cannot be compared. So I have tried to > > override the 'cmp' in the 'sorted' function, however I am comparing > > fairly complex o

Re: [Numpy-discussion] Sorting objects with ndarrays

2010-02-28 Thread Pauli Virtanen
su, 2010-02-28 kello 10:25 +0100, Gael Varoquaux kirjoitti: [clip] > The problem is that ndarrays cannot be compared. So I have tried to > override the 'cmp' in the 'sorted' function, however I am comparing > fairly complex objects, and I am having a hard time predicting wich > member of the object

Re: [Numpy-discussion] Building Numpy Windows Superpack

2010-02-28 Thread David Cournapeau
Hi Patrick, On Sun, Feb 28, 2010 at 1:35 PM, Patrick Marsh wrote: > Greetings, > I have been trying to build the numpy superpack on windows using the > binaries posted by David. Could you post *exactly* the sequence of commands you executed ? Especially at the beginning, building things can be f

[Numpy-discussion] Sorting objects with ndarrays

2010-02-28 Thread Gael Varoquaux
Hi, I need to have list of objects that contain ndarrays to be sorted. The reason that I want them sorted is that these list are populated in an arbitrary order, but there order really doesn't matter, and I am trying to make it reproducible for debugging and hashing. The problem is that ndarrays