[Numpy-discussion] Sort performance with structured array

2013-04-07 Thread Tom Aldcroft
I'm seeing about a factor of 50 difference in performance between sorting a random integer array versus sorting that same array viewed as a structured array. Am I doing anything wrong here? In [2]: x = np.random.randint(1, size=1) In [3]: xarr = x.view(dtype=[('a', np.int)]) In [4]:

[Numpy-discussion] Segfault for Numpy 1.4.1 on 64-bit CentOS-5

2012-11-16 Thread Tom Aldcroft
For library compatibility testing I'm trying to use numpy 1.4.1 with Python 2.7.3 on a 64-bit CentOS-5 platform. I installed a clean Python from source (basically ./configure --prefix=$prefix ; make install) and then installed numpy 1.4.1 with python setup.py install. The crash message begins

[Numpy-discussion] Comparing rows in a structured masked array raises exception

2012-10-21 Thread Tom Aldcroft
When comparing rows of a structured masked array I'm getting an exception. A similar operation on an structured ndarray gives the expected True/False result. Note that this exception only occurs if one or more of the mask values are True, since otherwise both row objects are np.void and the

[Numpy-discussion] Bug in numpy.mean() revisited

2012-07-26 Thread Tom Aldcroft
There was a thread in January discussing the non-obvious behavior of numpy.mean() for large arrays of float32 values [1]. This issue is nicely discussed at the end of the numpy.mean() documentation [2] with an example: a = np.zeros((2, 512*512), dtype=np.float32) a[0, :] = 1.0 a[1, :] = 0.1

Re: [Numpy-discussion] Making cdecimal.Decimal a native numpy type

2012-07-22 Thread Tom Aldcroft
On Sun, Jul 22, 2012 at 8:54 AM, Dr.Leo fhaxbo...@googlemail.com wrote: Hi, I am a seasoned numpy/pandas user mainly interested in financial applications. These and other applications would greatly benefit from a decimal data type with flexible rounding rules, precision etc. Yes, there is

Re: [Numpy-discussion] Proposed change in genfromtxt(..., comments='#', names=True) behaviour

2012-07-16 Thread Tom Aldcroft
On Mon, Jul 16, 2012 at 3:06 PM, Paul Natsuo Kishimoto m...@paul.kishimoto.name wrote: I've implemented this feature with skip_header=-1 as suggested by Pierre, and in doing so removed the regression. TravisBot seems to like it: https://github.com/numpy/numpy/pull/351 On Mon, 2012-07-16 at

Re: [Numpy-discussion] Proposed change in genfromtxt(..., comments='#', names=True) behaviour

2012-07-13 Thread Tom Aldcroft
On Fri, Jul 13, 2012 at 11:15 AM, Paul Natsuo Kishimoto m...@paul.kishimoto.name wrote: Hello everyone, I am a longtime NumPy user, and I just filed my first contribution to the code as pull request to fix what I felt was a bug in the behaviour of genfromtxt()

[Numpy-discussion] Problem with str.format() and np.recarray

2012-05-22 Thread Tom Aldcroft
I came across this problem which appears to be new in numpy 1.6.2 (vs. 1.6.1): In [17]: a = np.array([(1, )], dtype=[('a', 'i4')]) In [18]: ra = a.view(np.recarray) In [19]: '{}'.format(ra[0]) --- RuntimeError

Re: [Numpy-discussion] subclassing ndarray subtleties??

2012-05-22 Thread Tom Aldcroft
On Tue, May 22, 2012 at 4:07 PM, Dan Goodman dg.gm...@thesamovar.net wrote: On 22/05/2012 18:20, Nathaniel Smith wrote: I don't know of anything that the docs are lacking in particular. It's just that subclassing in general is basically a special form of monkey-patching: you have this

[Numpy-discussion] subclassing ndarray subtleties??

2012-05-21 Thread Tom Aldcroft
Over on the scipy-user mailing list there was a question about subclassing ndarray and I was interested to see two responses that seemed to imply that subclassing should be avoided. From Dag and Nathaniel, respectively: Subclassing ndarray is a very tricky business -- I did it once and regretted

[Numpy-discussion] numpy_quaternion: OK on numpy 1.5.0, fails on 1.6.1

2012-05-07 Thread Tom Aldcroft
Sorry to bother again, but I am running into an issue with the numpy quaternion dtype on numpy 1.6.1 : $ python ActivePython 2.7.1.4 (ActiveState Software Inc.) based on Python 2.7.1 (r271:86832, Feb 7 2011, 11:30:54) [GCC 4.0.2 20051125 (Red Hat 4.0.2-8)] on linux2 Type help, copyright, credits

Re: [Numpy-discussion] numpy_quaternion: OK on numpy 1.5.0, fails on 1.6.1

2012-05-07 Thread Tom Aldcroft
On Mon, May 7, 2012 at 3:30 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Mon, May 7, 2012 at 7:28 AM, Tom Aldcroft aldcr...@head.cfa.harvard.edu wrote: Sorry to bother again, but I am running into an issue with the numpy quaternion dtype on numpy 1.6.1 : $ python ActivePython

Re: [Numpy-discussion] Quaternion data type

2012-05-06 Thread Tom Aldcroft
wrote: On Sat, May 5, 2012 at 11:55 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, May 5, 2012 at 5:27 AM, Tom Aldcroft aldcr...@head.cfa.harvard.edu wrote: On Fri, May 4, 2012 at 11:44 PM, Ilan Schnell ischn...@enthought.com wrote: Hi Chuck, thanks for the prompt reply

[Numpy-discussion] numpy_quaternion and gcc 4.1.2

2012-05-06 Thread Tom Aldcroft
I ran into a problem trying to build and import the numpy_quaternion extension on CentOS-5 x86_64: $ python setup.py build SNIP C compiler: gcc -pthread -fno-strict-aliasing -fPIC -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC compile options:

Re: [Numpy-discussion] Quaternion data type

2012-05-05 Thread Tom Aldcroft
On Fri, May 4, 2012 at 11:44 PM, Ilan Schnell ischn...@enthought.com wrote: Hi Chuck, thanks for the prompt reply.  I as curious because because someone was interested in adding http://pypi.python.org/pypi/Quaternion to EPD, but Martin and Mark's implementation of quaternions looks much

Re: [Numpy-discussion] Quaternion data type

2012-05-05 Thread Tom Aldcroft
On Sat, May 5, 2012 at 12:55 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, May 5, 2012 at 5:27 AM, Tom Aldcroft aldcr...@head.cfa.harvard.edu wrote: On Fri, May 4, 2012 at 11:44 PM, Ilan Schnell ischn...@enthought.com wrote: Hi Chuck, thanks for the prompt reply.  I

Re: [Numpy-discussion] ndarray sub-classing and append function

2012-04-01 Thread Tom Aldcroft
On Sat, Mar 31, 2012 at 2:25 AM, Prashant Saxena animator...@yahoo.com wrote: Hi, I am sub-classing numpy.ndarry for vector array representation. The append function is like this:     def append(self, other):        self = numpy.append(self, [other], axis=0) Example: vary =

Re: [Numpy-discussion] simple manipulations of numpy arrays

2012-02-10 Thread Tom Aldcroft
This is not yet released (but will be in the near future): http://readthedocs.org/docs/astropy/en/latest/table/index.html https://github.com/astropy/astropy/blob/master/astropy/table/table.py You can at least use this as an example of how to add rows and columns to a structured array.  Or be an