[Numpy-discussion] Numeric to Numarray migration

Vineet Jain vineet at eswap.com
Tue Mar 16 03:00:07 EST 2004


I'm looking to port my application to Numarray and would like some help:

1. How do I do the following in numarray (since from numarray import
PyObject fails):

	self.startDateTimeList          = zeros(n, PyObject)

2. I have a time series array which has invalid elements. I use the
following two functions:

To get my compressed array (without the invalid elements) I use:

            self.high = extract(prices1.high, prices1.mask)

I then do some computations on the high in an external c library which
populates a new array
in the compressed format. Then I use:

        insert(self.outIndicator,self.prices1.mask,self._outIndicator)

This function insert from the scipy_base package was a lot faster than my
python equivalent. But since it
is called a lot of times the insert operation is takes a siginificant amount
of time.

   608400  195.333    0.000  195.333    0.000
C:\Python23\lib\site-packages\scipy_base\function_base.py:281(insert)

It represents about 25% of the application overall time. How do I do the
same in numarray and will the performance
be better than the above implementation. My arrays are usually greater than
20k in length.

Thanks for Numeric, I love the package and it is helped me immensely.

Vineet





More information about the NumPy-Discussion mailing list