Brian Blais | 1 Oct 02:27

Re: xml-rpc with numpy arrays

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 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 other things.  I'll have a look at the format that Robert sent, because that looks useful for other things I am doing.

Sebastien, why is sending python objects over the wire not so useful?  is there a better way to do this sort of thing than xmlrpc?  I thought it looked particularly simple (other than this pickling issue, of course.  :)  ).


thanks,

bb




_______________________________________________
Numpy-discussion mailing list
Numpy-discussion <at> scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Fernando Perez | 1 Oct 02:39
Picon
Gravatar

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

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 <craigcitro <at> gmail.com>
Date: Sun, Sep 21, 2008 at 8:47 PM
Subject: [sage-devel] Sage Days 11: November 7-10, Austin, Texas
To: sage-devel <at> googlegroups.com, sage-support <at> googlegroups.com

Hi all,

This is a reminder that Sage Days 11 is fast approaching! The topic is
"Special functions and computational number theory meet scientific
computing." The plan is to bring together a bunch of number theorists
and scientific computing/supercomputing experts, and Austin's
incredible supercomputing facilities make this the perfect place for
it.

If you're new to Sage, and interested in this topic, attending a Sage
Days is the perfect way to get more involved. (For those of you who've
been around a while, you know the drill -- just go ahead and skip this
paragraph.) Sage Days are friendly and very intensive focused
development workshops, which are probably fairly different from other
math-related conferences and workshops you've attended. There are
usually only one to two talks per day, in order to allow for the
maximum time for working discussions and coding sprints. The groups
are organized on the first day, and there are regular progress reports
throughout the workshop.

We have a webpage:

 http://www.math.utexas.edu/sage

and a wiki page:

 http://wiki.sagemath.org/days11

If you're planning on joining us in Austin, please register soon at
http://www.ma.utexas.edu/sage/rform1.php, and add your name to the
wiki. We do have some limited funding available, so please let us know
if you'll need funding. We have a block of rooms reserved at the
Doubletree Guest Suites in Austin, and we'll let you know more details
on that soon.

If you have any questions, feel free to email me or any of the other organizers!

On behalf of the organizing committee,
-Craig Citro
Sebastien Binet | 1 Oct 02:52
Picon

Re: xml-rpc with numpy arrays

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
> > instead of pickle.
>
> 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 other things.  I'll have a look
> at the format that Robert sent, because that looks useful for other
> things I am doing.
>
> Sebastien, why is sending python objects over the wire not so
> useful?
it isn't useful if you don't have a python interpreter instance on the other end 
of the wire, ie a python program on one end and a javascript one on the other 
end :)
 (well, you can always re-engineer the pickle format to unpickle what you 
received, etc... it is 'just' a matter of programming)

cheers,
sebastien.
--

-- 
###################################
# Dr. Sebastien Binet
# Lawrence Berkeley National Lab.
# 1 Cyclotron Road
# Berkeley, CA 94720
###################################
David Huard | 1 Oct 04:28
Picon

Re: Upper and lower envelopes



On Tue, Sep 30, 2008 at 4:37 PM, Anne Archibald <peridot.faceted <at> gmail.com> wrote:
2008/9/30 bevan <bevan07 <at> 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 (say 3) and then have my
> code find the intercept that fits my requirements (say 5% of data below the
> lower envelope).  This would then give me the equation and I could plot the
> upper and lower envelopes.
>
>
> I hope this makes sense.  Thanks for any help.

For this particular problem - where you know the slope - it's not too
hard. If the slope is b, and your points are x and y, compute y-b*x,
then sort that array, and choose the 5th and 95th percentile values.

That's a pretty elegant solution. 

Thanks for sharing,

David

Anne
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion <at> scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion <at> scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Lisandro Dalcin | 1 Oct 05:16
Picon
Gravatar

Re: xml-rpc with numpy arrays

On Tue, Sep 30, 2008 at 9:27 PM, Brian Blais <bblais <at> bryant.edu>
> 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 other things.  I'll have a look at the format that Robert sent, because
> that looks useful for other things I am doing.

Did you try to send binary pickles (protocol=2)? Perhaps it works,
give a try! Of course, you need the client and server machines having
the same arch.

> Sebastien, why is sending python objects over the wire not so useful?  is
> there a better way to do this sort of thing than xmlrpc?  I thought it
> looked particularly simple (other than this pickling issue, of course.  :)
>  ).
>

I believe xmlrpclib is currently the simpler approach. Some day I'll
have the time to implement something similar using MPI communication
with mpi4py. However, I believe it can be done even better: local,
client-side proxies should automatically provide access to all
members/methods of remote, server-side instances. The registering step
needed within xmlrpclib is a bit ugly ;-)

--

-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
Gael Varoquaux | 1 Oct 07:26
Favicon
Gravatar

Re: Proposal: scipy.spatial

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 often want to provide a
> distance upper bound as well as a number of nearest neighbors.

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.

My 2 cents,

Gaël
Barry Wark | 1 Oct 08:08
Picon
Gravatar

Re: Proposal: scipy.spatial

On Mon, Sep 29, 2008 at 8:24 PM, Anne Archibald
<peridot.faceted <at> gmail.com> 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
> of pure-python implementations of kd-trees. I suggest the creation of
> a new submodule of scipy, scipy.spatial, to contain spatial data
> structures and algorithms. Specifically, I propose it contain a
> kd-tree implementation providing nearest-neighbor, approximate
> nearest-neighbor, and all-points-near queries. I have a few other
> suggestions for things it might contain, but kd-trees seem like a good
> first step.
>
> 2008/9/27 Nathan Bell <wnbell <at> gmail.com>:
>> On Sat, Sep 27, 2008 at 11:18 PM, Anne Archibald
>> <peridot.faceted <at> gmail.com> wrote:
>>>
>>> I think a kd-tree implementation would be a valuable addition to
>>> scipy, perhaps in a submodule scipy.spatial that might eventually
>>> contain other spatial data structures and algorithms. What do you
>>> think? Should we have one? Should it be based on Sturla Molden's code,
>>> if the license permits? I am willing to contribute one, if not.
>>
>> +1
>
> Judging that your vote and mine are enough in the absence of
> dissenting voices, I have written an implementation based on yours,
> Sturla Molden's, and the algorithms described by the authors of the
> ANN library. Before integrating it into scipy, though, I'd like to
> send it around for comments.
>
> Particular issues:
>
> * It's pure python right now, but with some effort it could be
> partially or completely cythonized. This is probably a good idea in
> the long run. In the meantime I have crudely vectorized it so that
> users can at least avoid looping in their own code.
> * It is able to return the r nearest neighbors, optionally subject to
> a maximum distance limit, as well as approximate nearest neighbors.
> * It is not currently set up to conveniently return all points within
> some fixed distance of the target point, but this could easily be
> added.
> * It returns distances and indices of nearest neighbors in the original array.
> * The testing code is, frankly, a mess. I need to look into using nose
> in a sensible fashion.
> * The license is the scipy license.
>
> I am particularly concerned about providing a convenient return
> format. The natural return from a query is a list of neighbors, since
> it may have variable length (there may not be r elements in the tree,
> or you might have supplied a maximum distance which doesn't contain r
> points). For a single query, it's simple to return a python list
> (should it be sorted? currently it's a heap). But if you want to
> vectorize the process, storing the results in an array becomes
> cumbersome. One option is an object array full of lists; another,
> which, I currently use, is an array with nonexistent points marked
> with an infinite distance and an invalid index. A third would be to
> return masked arrays. How do you recommend handling this variable (or
> potentially-variable) sized output?
>
>> If you're implementing one, I would highly recommend the
>> "left-balanced" kd-tree.
>> http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/2535/pdf/imm2535.pdf
>
> Research suggests that at least in high dimension a more geometric
> balancing criterion can produce vastly better results. I used the
> "sliding midpoint" rule, which doesn't allow such a numerical
> balancing but does ensure that you don't have too many long skinny
> cells (since a sphere tends to cut very many of these).
>
> I've also been thinking about what else would go in scipy.spatial. I
> think it would be valuable to have a reasonably efficient distance
> matrix function (we seem to get that question a lot, and the answer's
> not trivial) as well as a sparse distance matrix function based on the
> kd-trees. The module could potentially also swallow the (currently
> sandboxed?) delaunay code.
>
> Anne

Anne,

Thanks for taking this on. The scikits.ann has licensing issues (as
noted above), so it would be nice to have a clean-room implementation
in scipy. I am happy to port the scikits.ann API to the final API that
you choose, however, if you think that would be helpful.

Cheers,
Barry
Nathan Bell | 1 Oct 08:10
Picon
Gravatar

Re: Proposal: scipy.spatial

On Wed, Oct 1, 2008 at 1:26 AM, Gael Varoquaux
<gael.varoquaux <at> normalesup.org> 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 through different names?

# nearest k points (possibly fewer)
query_nearest(pt, k=1)

# all points within given distance
query_sphere(pt, distance)

#nearest k points within given distance (possibly fewer)
query(pt, k, distance)

Few people will use the last form, but it's useful nevertheless.

--

-- 
Nathan Bell wnbell <at> gmail.com
http://graphics.cs.uiuc.edu/~wnbell/
Picon
Gravatar

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

Anne Archibald wrote:
> 2008/9/30 Peter <numpy-discussion <at> maubp.freeserve.co.uk>:
> I think the profusion of different implementations is an argument for
> including this in scipy. I think it is also an argument for providing
> a standard interface with (at least potentially) several different
> implementations. At the moment, that proposed interface looks like:
[...]
> In the first two cases, missing neighbors are represented with an
> infinite distance and an invalid index. In the last case, distances
> and indices are both either lists (if there's only one query point) or
> object arrays of lists (if there are many query points). If only one
> neighbor is requested, the array does not have a dimension of length 1
> in the which-neighbor position. If (potentially) many neighbors are
> returned, they are sorted by distance, nearest first.
> 
> What do you think of this interface?

This is nice.  How about a keyword argument "sort=True" that lets people 
choose if they want the results sorted by distance or not?  I have seen 
cases where unsorted results are useful.

cheers,
prabhu
Vincent Schut | 1 Oct 10:47
Picon

Re: xml-rpc with numpy arrays

Lisandro Dalcin wrote:
> 
> I believe xmlrpclib is currently the simpler approach. Some day I'll
> have the time to implement something similar using MPI communication
> with mpi4py. However, I believe it can be done even better: local,
> client-side proxies should automatically provide access to all
> members/methods of remote, server-side instances. The registering step
> needed within xmlrpclib is a bit ugly ;-)
> 
> 
Try pyro: <http://pyro.sourceforge.net/> or rpyc: 
<http://rpyc.wikispaces.com/>, both of which if I recall correctly, do 
implement this.

VS.

Gmane