o How would a Python version of POOMA compare/contrast to Numpy?
POOMA (Parallel Object-Oriented Methods and Applications) a C++ high
performance simulation infrastructure package
http://www.acl.lanl.gov/pooma/
Would boost add anything advantages to the current Numpy methodology?
http://www.boost.org/
Thanks,
Norman Shelley

Hi,
I have occasionally dabbled with numpy in the past, but I'm starting to
use it more heavily now. I have two (minor, I think) question/comments:
1) RandomArray seems to be initialized from the time. At least when I
repeatedly execute a script that uses RandomArray.uniform, the first
number generated changes very little from one invocation to another.
For example, with the following file:
---------
# testRA.py
from RandomArray import *
print uniform(-1.0, 1.0)
---------
I get:
--------
cholla 192% python testRA.py
0.434084415436
cholla 193% python testRA.py
0.433970689774
cholla 194% python testRA.py
0.433856964111
cholla 195% python testRA.py
0.433781266212
--------
Is that really desirable behavior? It is easily fixed in my script; I
just generate one random number first and throw it away. (I'm running
on a sparc under solaris 2.6.)
2) The example in the documentation on negative strides in slices is
incorrect, or old. It says:
>>> a = reshape(arrayrange(9),(3,3))
>>> print a[2:-1, 0]
[6 3 0]
That's not the result I get. I think two colons were wanted there.
Clay

I'm about to start work on a wavelets module for python... don't know how
far i want to go yet....
is there an existsing project?
i couldn't find one!
tariq

Since I made that typo I have people going to pfdubois.com/numeric when I
actually made it /numpy. I can create a numerc -- but I think it would be nicer
if I did the automatic redirection trick. So what does one do to get a browser
to switch to a different site?

I am looking for efficient ways to code neighbourhood functions. For
example a neighbourhod add for an element in an array will simply be the sum
of the neighbours:
1 0 2
3 x 3 , then x becomes 7 (first order neighbour), 11 (2nd order) etc.
1 1 0
I would be interested in efficient ways of doing this for a whole array,
something like a_nsum = neighbour_sum(a, order=1), where each element in
a_nsum is the sum of the corresponding element in a.
There must be some work done on neighbourhood functions for arrays, so I
would be grateful for some pointers.
Thanks,
Robert Denham
************************************************************************
The information in this e-mail together with any attachments is
intended only for the person or entity to which it is addressed
and may contain confidential and/or privileged material.
Any form of review, disclosure, modification, distribution
and/or publication of this e-mail message is prohibited.
If you have received this message in error, you are asked to
inform the sender as quickly as possible and delete this message
and any copies of this message from your computer and/or your
computer system network.
************************************************************************

I have been trying to optimise a simple set intersection function
for a Numpy-based application on which I am working. The function needs
to
find the common elements (i.e the intersection) of two or more
Numpy rank-1 arrays of integers passed to it as arguments - call them
array A, array B etc. My first attempt used searchsorted() to see where
in array A each element of array B would fit and then check if the
element in array A at that position equalled the element in array B - if
it did,
then that element was part of the intersection:
def intersect(A,B):
c = searchsorted(A,B)
d = compress(less(c,len(A)),B)
return compress(equal(take(A,compress(less(c,len(A)),c)),d),d)
This works OK but it requires the arrays to be stored in sorted order
(which is what
we did) or to be sorted by the function (not shown).
I should add that the arrays passed to the function may have up to a few
million elements each.
Ole Nielsen at ANU (Australian National University), who gave a paper on
data
mining using Python at IPC9, suggested an improvement, shown below.
Provided the arrays are pre-sorted, Ole's function is about 40% faster
than my attempt, and about the same speed if the arrays aren't
pre-sorted.
However, Ole's function can be generalised to find the intersection of
more than
two arrays at a time. Most of the time is spent sorting the arrays, and
this
increases as N.log(N) as the total size of the concatenated arrays (N)
increases
(I checked this empirically).
def intersect(Arraylist):
C = sort(concatenate(Arraylist))
D = subtract(C[0:-n], C[n:]) #or
# D = convolve(C,[n,-n])
return compress(equal(D,0),C) #or
# return take(C,nonzero(equal(D,0)))
Paul Dubois suggested the following elegant alternative:
def intersect(x,y):
return compress(sum(equal(subtract.outer(x,y),0),1),x)
Unfortunately, perhaps due to the overhead of creating the rank-2 array
to
hold the results of the subtract.outer() method call, it turns out to be
slower than Ole's function, as well as using huge tracts of memory.
My questions for the list, are:
a) can anyone suggest any further optimisation of Ole's function, or
some
alternative?
b) how much do you think would be gained by re-implementing this
function in C using the Numpy C API? If such an effort would be
worthwhile,
are there any things we should consider while tackling this task?
Regards,
Tim Churches
Sydney, Australia

I am just working on an article describing a program which makes heavy
use of NumPy, so I should cite some reference to it. Did anyone do
this before? What is the most appropriate reference? I think URLs
are acceptable these days, but it should be a rather stable one.
Konrad.
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen(a)cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron | Fax: +33-2.38.63.15.17
45071 Orleans Cedex 2 | Deutsch/Esperanto/English/
France | Nederlands/Francais
-------------------------------------------------------------------------------

I was reading some sections of the latest NumPy tutorial (the one
currently listed as http://pfdubois.com/numpy/numdoc.pdf ) and spotted
these typos, listed below in case you want to fix them. Page numbers refer
to the actual page numbers printed on the page (not the PDF document's
numbers).
- p.14: "A very useful features of arrays..." (should be "feature").
- p.15, top-of-page NumPy example: arrays are shown printed before the
corresponding "print" command (see "print a" and "print b").
- p.17: in the "Advanced Users" section: the explanation of what these
sections are for should perhaps be included in the previous page's
"Advanced Users" section, since that one is the first such occurrence
in the tutorial.
- p.19, near the end: Above "identity": "The first example BELOW satisfies...
while the second array ...": there is only one example "below", the
buggy example. The first, correct example is probably the one given
previously on the same page.
Christos

Since I can't search the web site, here is a question...
I am using the following calls inside my C++ app:
import_array();
a=PyRun_SimpleString("from image_module import *"); // my module for
wrapping a C++ class
a=PyRun_SimpleString("image=imagemanager()\n"); // load a new
instance of the class into Python
a=PyRun_SimpleString("a=image.GetImage(0)"); // assign image 0 to a
Basically, GetImage() returns a numpy Array Object for image 0, properly
initialized by PyArray_FromDimsAndData(). I can't return all the images
because they might not be sequential in memory (off loaded to the
filesystem).
"a" appears to be an list of numbers. I am not sure if Python knows it
is a PyArrayObject. This is where I am getting into trouble. I can't do
something like a=PyRun_SimpleString("a = a + 100"); I get an error
"Value Error: Function not Supported".
I am trying to figure out what namespace did "import_array()" import
Numeric into.
Also, I am using _numpy_d.pyd that I compiled under Windows NT and MSVC
6.0.
--
Cheers,
Karl Bellve, Ph.D. ICQ # 13956200
Biomedical Imaging Group TLCA# 7938
University of Massachusetts
Email: Karl.Bellve(a)umassmed.edu
Phone: (508) 856-6514
Fax: (508) 856-1840
PGP Public key: finger kdb(a)molmed.umassmed.edu

Hi,
I am pretty new to numpy and am using it for
image processing. (Also, I am not 100% sure
that this is the appropriate email address for
this question--feel free to redirect me.)
My problem is that I would like to be able
to dive down into C and write my own filters etc.,
but I do not want to have to surmount the
somewhat daunting Python/C-extension learning curve if
that is at all possible. I am wondering if
anybody has "packaged" this ability anywhere,
sort of like Perl's Inline.pm.
Thanks,
Mike Drumheller
=====
Michael Drumheller
2735 NE 87th Street, Seattle, Washington 98115
206/523-7865 drumheller(a)alum.mit.edu
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/