Re: [Numpy-discussion] Proposal: scipy.spatial

2008-09-30 Thread Nathan Bell
On Wed, Oct 1, 2008 at 1:26 AM, Gael Varoquaux <[EMAIL PROTECTED]> wrote: > > Absolutely. I just think k should default to None, when > distance_upper_bound is specified. k=None could be interpreted as k=1 > when distance_uppper_bound is not specified. > Why not expose the various possibilities th

Re: [Numpy-discussion] Proposal: scipy.spatial

2008-09-30 Thread Barry Wark
On Mon, Sep 29, 2008 at 8:24 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > Hi, > > Once again there has been a thread on the numpy/scipy mailing lists > requesting (essentially) some form of spatial data structure. Pointers > have been posted to ANN (sadly LGPLed and in C++) as well as a handful

Re: [Numpy-discussion] Proposal: scipy.spatial

2008-09-30 Thread Gael Varoquaux
On Tue, Sep 30, 2008 at 06:10:46PM -0400, Anne Archibald wrote: > > k=None in the third call to T.query seems redundant. It should be > > possible do put some logics so that the call is simply > > distances, indices = T.query(xs, distance_upper_bound=1.0) > Well, the problem with this is that you

Re: [Numpy-discussion] xml-rpc with numpy arrays

2008-09-30 Thread Lisandro Dalcin
On Tue, Sep 30, 2008 at 9:27 PM, Brian Blais <[EMAIL PROTECTED]> > thanks for all of the help. My initial solution is to pickle my object, > with the text-based version of pickle, and send it across rpc. I do this > because the actual thing I am sending is a dictionary, with lots of arrays, > and

Re: [Numpy-discussion] Upper and lower envelopes

2008-09-30 Thread David Huard
On Tue, Sep 30, 2008 at 4:37 PM, Anne Archibald <[EMAIL PROTECTED]>wrote: > 2008/9/30 bevan <[EMAIL PROTECTED]>: > > Hello, > > > > I have some XY data. I would like to generate the equations for an upper > and > > lower envelope that excludes a percentage of the data points. > > > > I would like

Re: [Numpy-discussion] xml-rpc with numpy arrays

2008-09-30 Thread Sebastien Binet
Brian, On Tuesday 30 September 2008 17:27:32 Brian Blais wrote: > On Sep 30, 2008, at 18:42 , Sebastien Binet wrote: > > yeah... Robert pointed it to me that as xmlrpc is meant for cross- > > language RPC, > > sending python objects over the wire isn't so useful, hence the > > usage of marshal > >

[Numpy-discussion] Fwd: [sage-devel] Sage Days 11: November 7-10, Austin, Texas

2008-09-30 Thread Fernando Perez
Hi all, I think the original announcement only went to the Sage lists, but this should be of interest to this crowd as well. Cheers, f -- Forwarded message -- From: Craig Citro <[EMAIL PROTECTED]> Date: Sun, Sep 21, 2008 at 8:47 PM Subject: [sage-devel] Sage Days 11: November 7-

Re: [Numpy-discussion] xml-rpc with numpy arrays

2008-09-30 Thread Brian Blais
On Sep 30, 2008, at 18:42 , Sebastien Binet wrote: yeah... Robert pointed it to me that as xmlrpc is meant for cross- language RPC, sending python objects over the wire isn't so useful, hence the usage of marshal instead of pickle. thanks for all of the help. My initial solution is to pic

Re: [Numpy-discussion] PyArray_Resize reference counting

2008-09-30 Thread Travis E. Oliphant
Ravi wrote: > On Tuesday 30 September 2008 16:26:08 Travis E. Oliphant wrote: > >> You need to do something like: >> >> temp = PyArray_Resize(array,...) >> Py_DECREF(array) >> array = temp >> > > In this case, since a new array may be returned, is there no way to > synchronize with other o

Re: [Numpy-discussion] xml-rpc with numpy arrays

2008-09-30 Thread Sebastien Binet
Lisandro, On Tuesday 30 September 2008 15:24:56 Lisandro Dalcin wrote: > Sebastien, numpy arrays are picklable; so no need to register them > with copy_reg. I believe the actual problem with xmlrpclib is that it > uses the marshal protocol (only supports core builtin types), and not > the pickle p

Re: [Numpy-discussion] Upper and lower envelopes

2008-09-30 Thread Bevan
Anne Archibald gmail.com> writes: > > 2008/9/30 bevan gmail.com>: > > Hello, > > > > I have some XY data. I would like to generate the equations for an upper and > > lower envelope that excludes a percentage of the data points. > > > > I would like to define the slope of the envelope line (sa

Re: [Numpy-discussion] xml-rpc with numpy arrays

2008-09-30 Thread Lisandro Dalcin
Sebastien, numpy arrays are picklable; so no need to register them with copy_reg. I believe the actual problem with xmlrpclib is that it uses the marshal protocol (only supports core builtin types), and not the pickle protocol. On Tue, Sep 30, 2008 at 5:18 PM, Sebastien Binet <[EMAIL PROTECTED]> w

Re: [Numpy-discussion] Proposal: scipy.spatial

2008-09-30 Thread Nathan Bell
On Tue, Sep 30, 2008 at 6:10 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > > Well, the problem with this is that you often want to provide a > distance upper bound as well as a number of nearest neighbors. For This use case is also important in scattered data interpolation, so we definitely want

Re: [Numpy-discussion] Proposal: scipy.spatial

2008-09-30 Thread Anne Archibald
2008/9/30 Gael Varoquaux <[EMAIL PROTECTED]>: > On Tue, Sep 30, 2008 at 05:31:17PM -0400, Anne Archibald wrote: >> T = KDTree(data) > >> distances, indices = T.query(xs) # single nearest neighbor > >> distances, indices = T.query(xs, k=10) # ten nearest neighbors > >> distances, indices = T.query(x

Re: [Numpy-discussion] Help needed with the priority of 0d-arrays and np.scalars

2008-09-30 Thread Pierre GM
On Tuesday 30 September 2008 17:18:13 Travis E. Oliphant wrote: > Hmm... I'm not 100% sure off the top of my head, but I would say that > 0d arrays should determine the type coercion if any and the returned > thing should be a numpy scalar. Travis, I'm afraid I don't understand. According to you

Re: [Numpy-discussion] Proposal: scipy.spatial

2008-09-30 Thread Gael Varoquaux
On Tue, Sep 30, 2008 at 05:31:17PM -0400, Anne Archibald wrote: > T = KDTree(data) > distances, indices = T.query(xs) # single nearest neighbor > distances, indices = T.query(xs, k=10) # ten nearest neighbors > distances, indices = T.query(xs, k=None, distance_upper_bound=1.0) # > all within 1 o

Re: [Numpy-discussion] Proposal: scipy.spatial

2008-09-30 Thread Anne Archibald
2008/9/30 Peter <[EMAIL PROTECTED]>: > On Tue, Sep 30, 2008 at 5:10 AM, Christopher Barker > <[EMAIL PROTECTED]> wrote: >> >> Anne Archibald wrote: >>> I suggest the creation of >>> a new submodule of scipy, scipy.spatial, >> >> +1 >> >> Here's one to consider: >> http://pypi.python.org/pypi/Rtree

Re: [Numpy-discussion] PyArray_Resize reference counting

2008-09-30 Thread Ravi
On Tuesday 30 September 2008 16:26:08 Travis E. Oliphant wrote: > You need to do something like: > > temp = PyArray_Resize(array,...) > Py_DECREF(array) > array = temp In this case, since a new array may be returned, is there no way to synchronize with other objects holding a reference to the ori

Re: [Numpy-discussion] Help needed with the priority of 0d-arrays and np.scalars

2008-09-30 Thread Travis E. Oliphant
Pierre GM wrote: > Sorry to bump my own post, I know it's rude... > > However, I'm in dire need for some pointers: what are the priority rules when > multiplying numpy scalars and 0d ndarrays ? > > Thanks a lot in advance > ___ > Numpy-discussion mailin

Re: [Numpy-discussion] Help needed with the priority of 0d-arrays and np.scalars

2008-09-30 Thread Pierre GM
Sorry to bump my own post, I know it's rude... However, I'm in dire need for some pointers: what are the priority rules when multiplying numpy scalars and 0d ndarrays ? Thanks a lot in advance ___ Numpy-discussion mailing list Numpy-discussion@scipy.o

Re: [Numpy-discussion] Vectorization of the product of several matrices ?

2008-09-30 Thread Charles R Harris
On Sun, Sep 28, 2008 at 9:47 AM, oc-spam66 <[EMAIL PROTECTED]> wrote: > > Hello, > > I have two lists of numpy matrices : LM = [M_i, i=1..N] and LN = [N_i, i > =1..N] > and I would like to compute the list of the products : LP = [M_i * N_i, > i=1..N]. > > I can do : > > P=[] > for i in range(N) :

Re: [Numpy-discussion] Upper and lower envelopes

2008-09-30 Thread Anne Archibald
2008/9/30 bevan <[EMAIL PROTECTED]>: > Hello, > > I have some XY data. I would like to generate the equations for an upper and > lower envelope that excludes a percentage of the data points. > > I would like to define the slope of the envelope line (say 3) and then have my > code find the intercep

Re: [Numpy-discussion] PyArray_Resize reference counting

2008-09-30 Thread Travis E. Oliphant
Ravi wrote: > Hi, > Consider the following code: > >PyArrayObject *array = get_me_an_array_along_with_a_reference(); /* 1 */ >PyArray_Dims *dims = get_me_some_dims(); /* 2 */ >array = (PyArrayObject *)PyArray_Resize( array, dims, 1 ); /* 3 */ > > Is the code above valid? No. You nee

Re: [Numpy-discussion] xml-rpc with numpy arrays

2008-09-30 Thread Sebastien Binet
Hi, [..snip..] On Tuesday 30 September 2008 12:05:27 Robert Kern wrote: > > doing something wrong. Is there a way to fix this? Is there another > > approach that I should be using? > > The marshal module *only* handles builtin Python types. It explicitly > does not handle anything from third par

[Numpy-discussion] PyArray_Resize reference counting

2008-09-30 Thread Ravi
Hi, Consider the following code: PyArrayObject *array = get_me_an_array_along_with_a_reference(); /* 1 */ PyArray_Dims *dims = get_me_some_dims(); /* 2 */ array = (PyArrayObject *)PyArray_Resize( array, dims, 1 ); /* 3 */ Is the code above valid? In particular, is the assigment on line

Re: [Numpy-discussion] xml-rpc with numpy arrays

2008-09-30 Thread Robert Kern
On Tue, Sep 30, 2008 at 12:53, Brian Blais <[EMAIL PROTECTED]> wrote: > Hello, > I am trying to use xml-rpc to be able to run some simulations remotely. I > am running into a problem with the transfer of numpy arrays. my server code > looks like: > #!/usr/bin/env python > def again(x): # test ou

Re: [Numpy-discussion] What is the sign of nan?

2008-09-30 Thread Charles R Harris
On Tue, Sep 30, 2008 at 7:42 AM, Pete Forman <[EMAIL PROTECTED]>wrote: > "Charles R Harris" <[EMAIL PROTECTED]> writes: > > > OK, here is what is looks like to me at the moment given that numpy > > requires an IEEE754 machine: > > > >o We need a reliable value for NAN. [...] > > > > > >

Re: [Numpy-discussion] xml-rpc with numpy arrays

2008-09-30 Thread Uwe Schmitt
Hi, in order to marshal numpy arrays, you can use the tostring() method. The inverse is the fromstring() function in numpy. But you must know dtype and shape in order to reconstruct your array. Greetings, Uwe On 30 Sep., 19:53, Brian Blais <[EMAIL PROTECTED]> wrote: > Hello, > > I am trying to u

[Numpy-discussion] xml-rpc with numpy arrays

2008-09-30 Thread Brian Blais
Hello, I am trying to use xml-rpc to be able to run some simulations remotely. I am running into a problem with the transfer of numpy arrays. my server code looks like: #!/usr/bin/env python def again(x): # test out the sending of data return [x,x] from SimpleXMLRPCServer import Si

Re: [Numpy-discussion] What is the sign of nan?

2008-09-30 Thread Pete Forman
"Charles R Harris" <[EMAIL PROTECTED]> writes: > OK, here is what is looks like to me at the moment given that numpy > requires an IEEE754 machine: > >o We need a reliable value for NAN. [...] > > >o Max/min follow the IEEE standard. Given a choice of > nan/non-nan, retur

Re: [Numpy-discussion] Upper and lower envelopes

2008-09-30 Thread David Huard
Bevan, You can estimate the intercept and slope using least-squares (scipy.optimize.leastsq). Make sure though that errors in X are small compared to errors in Y, otherwise, your slope will be underestimated. Using the slope, you can write a function lower(b,a, X,Y) that will compute y=aX+b and r

Re: [Numpy-discussion] Numpy Nu-bee: "forward fill" function

2008-09-30 Thread Joshua Ford
Thank you so very much! > From: [EMAIL PROTECTED] > To: numpy-discussion@scipy.org > Date: Mon, 29 Sep 2008 23:24:02 -0400 > Subject: Re: [Numpy-discussion] Numpy Nu-bee: "forward fill" function > > On Monday 29 September 2008 22:31:47 Joshua Ford wrote: > > I would like to conduct the equiva

Re: [Numpy-discussion] What is the sign of nan?

2008-09-30 Thread Charles R Harris
On Tue, Sep 30, 2008 at 5:10 AM, Pete Forman <[EMAIL PROTECTED]>wrote: > I've seen no mention in this thread of IEEE Std 754-2008 which was > published last month. minNum(x, y) and maxNum(x, y) return a > floating-point number if the other argument is NaN. > > The OP's question is about the sign

Re: [Numpy-discussion] What is the sign of nan?

2008-09-30 Thread Pete Forman
I've seen no mention in this thread of IEEE Std 754-2008 which was published last month. minNum(x, y) and maxNum(x, y) return a floating-point number if the other argument is NaN. The OP's question is about the sign of NaN. In 754r it can be tested, copied, etc. Operations involving NaNs propag

Re: [Numpy-discussion] ANN: NumPy 1.2.0

2008-09-30 Thread Francesc Alted
A Monday 29 September 2008, Anne Archibald escrigué: > 2008/9/29 Francesc Alted <[EMAIL PROTECTED]>: > > But I agree with Robert Kern that tests *should* never be run under > > -OO because they are *tests*, not production code, and using the > > -OO for running the test units is simply a wrong prac

[Numpy-discussion] Upper and lower envelopes

2008-09-30 Thread bevan
Hello, I have some XY data. I would like to generate the equations for an upper and lower envelope that excludes a percentage of the data points. I would like to define the slope of the envelope line (say 3) and then have my code find the intercept that fits my requirements (say 5% of data below

Re: [Numpy-discussion] Proposal: scipy.spatial

2008-09-30 Thread Peter
On Tue, Sep 30, 2008 at 5:10 AM, Christopher Barker <[EMAIL PROTECTED]> wrote: > > Anne Archibald wrote: >> I suggest the creation of >> a new submodule of scipy, scipy.spatial, > > +1 > > Here's one to consider: > http://pypi.python.org/pypi/Rtree > and perhaps other stuff from: > http://trac.gisp