Re: [Numpy-discussion] Creating a bool array with Cython

2012-02-26 Thread Neal Becker
Keith Goodman wrote: > Is this a reasonable (and fast) way to create a bool array in cython? > > def makebool(): > cdef: > int n = 2 > np.npy_intp *dims = [n] > np.ndarray[np.uint8_t, ndim=1] a > a = PyArray_EMPTY(1, dims, NPY_UINT8, 0) >

Re: [Numpy-discussion] Problem Building Numpy with Python 2.7.1 and OS X 10.7.3

2012-02-26 Thread Samuel John
Hi The plain gcc (non-llvm) is no longer there, if you install Lion and directly Xcode 4.3. Only, if you have the old Xcode 4.2 or lower, then you may have a non-llvm gcc. For Xcode 4.3, I recommend installing the "Command Line Tools for Xcode" from the preferences of Xcode. Then you'll have th

Re: [Numpy-discussion] Creating a bool array with Cython

2012-02-26 Thread Keith Goodman
On Sat, Feb 25, 2012 at 7:04 PM, Dag Sverre Seljebotn wrote: > On 02/25/2012 03:26 PM, Keith Goodman wrote: >> Is this a reasonable (and fast) way to create a bool array in cython? >> >>      def makebool(): >>          cdef: >>              int n = 2 >>              np.npy_intp *dims = [n] >>    

Re: [Numpy-discussion] Problem Building Numpy with Python 2.7.1 and OS X 10.7.3

2012-02-26 Thread Ralf Gommers
On Sun, Feb 26, 2012 at 4:38 PM, Samuel John wrote: > Hi > > The plain gcc (non-llvm) is no longer there, if you install Lion and > directly Xcode 4.3. > Only, if you have the old Xcode 4.2 or lower, then you may have a non-llvm > gcc. > > For Xcode 4.3, I recommend installing the "Command Line T

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-26 Thread Warren Weckesser
On Thu, Feb 23, 2012 at 2:19 PM, Warren Weckesser < warren.weckes...@enthought.com> wrote: > > On Thu, Feb 23, 2012 at 2:08 PM, Travis Oliphant wrote: > >> This is actually on my short-list as well --- it just didn't make it to >> the list. >> >> In fact, we have someone starting work on it this w

[Numpy-discussion] log relative error

2012-02-26 Thread josef . pktd
(I got distracted by some numerical accuracy checks. np.polyfit looks good in NIST test.) Does numpy have something like this? def lre(actual, desired): '''calculate log relative error, number of correct significant digits not an informative function name Parameters --

Re: [Numpy-discussion] Migrating issues to GitHub

2012-02-26 Thread Wes McKinney
On Thu, Feb 16, 2012 at 4:32 PM, Ralf Gommers wrote: > > > On Thu, Feb 16, 2012 at 10:20 PM, Thouis (Ray) Jones > wrote: >> >> On Thu, Feb 16, 2012 at 19:25, Ralf Gommers >> wrote: >> > In another thread Jira was proposed as an alternative to Trac. Can you >> > point >> > out some of its strengt

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-26 Thread Nathaniel Smith
On Sun, Feb 26, 2012 at 5:23 PM, Warren Weckesser wrote: > I haven't pushed it to the extreme, but the "big" example (in the examples/ > directory) is a 1 gig text file with 2 million rows and 50 fields in each > row.  This is read in less than 30 seconds (but that's with a solid state > drive).

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-26 Thread Warren Weckesser
On Sun, Feb 26, 2012 at 1:00 PM, Nathaniel Smith wrote: > On Sun, Feb 26, 2012 at 5:23 PM, Warren Weckesser > wrote: > > I haven't pushed it to the extreme, but the "big" example (in the > examples/ > > directory) is a 1 gig text file with 2 million rows and 50 fields in each > > row. This is r

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-26 Thread Francesc Alted
On Feb 26, 2012, at 1:16 PM, Warren Weckesser wrote: > For anyone benchmarking software like this, be sure to clear the disk cache > before each run. In linux: > > $ sync > $ sudo sh -c "echo 3 > /proc/sys/vm/drop_caches" > It is also a good idea to run a disk-cache enabled test too, just to b

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-26 Thread Nathaniel Smith
On Sun, Feb 26, 2012 at 7:16 PM, Warren Weckesser wrote: > On Sun, Feb 26, 2012 at 1:00 PM, Nathaniel Smith wrote: >> For this kind of benchmarking, you'd really rather be measuring the >> CPU time, or reading byte streams that are already in memory. If you >> can process more MB/s than the drive

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-26 Thread Warren Weckesser
On Sun, Feb 26, 2012 at 1:49 PM, Nathaniel Smith wrote: > On Sun, Feb 26, 2012 at 7:16 PM, Warren Weckesser > wrote: > > On Sun, Feb 26, 2012 at 1:00 PM, Nathaniel Smith wrote: > >> For this kind of benchmarking, you'd really rather be measuring the > >> CPU time, or reading byte streams that a

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-26 Thread Francesc Alted
On Feb 26, 2012, at 1:49 PM, Nathaniel Smith wrote: > On Sun, Feb 26, 2012 at 7:16 PM, Warren Weckesser > wrote: >> On Sun, Feb 26, 2012 at 1:00 PM, Nathaniel Smith wrote: >>> For this kind of benchmarking, you'd really rather be measuring the >>> CPU time, or reading byte streams that are alrea

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-26 Thread Nathaniel Smith
On Sun, Feb 26, 2012 at 7:58 PM, Warren Weckesser wrote: > Right, I got that.  Sorry if the placement of the notes about how to clear > the cache seemed to imply otherwise. OK, cool, np. >> Clearing the disk cache is very important for getting meaningful, >> repeatable benchmarks in code where y

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-26 Thread Warren Weckesser
On Sun, Feb 26, 2012 at 3:00 PM, Nathaniel Smith wrote: > On Sun, Feb 26, 2012 at 7:58 PM, Warren Weckesser > wrote: > > Right, I got that. Sorry if the placement of the notes about how to > clear > > the cache seemed to imply otherwise. > > OK, cool, np. > > >> Clearing the disk cache is very

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-26 Thread Erin Sheldon
Excerpts from Warren Weckesser's message of Sun Feb 26 16:22:35 -0500 2012: > Yes, thanks! I'm working on a mmap version now. I'm very curious to see > just how much of an improvement it can give. FYI, memmap is generally an incomplete solution for numpy arrays; it only understands rows, not co

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-26 Thread Erin Sheldon
Excerpts from Erin Sheldon's message of Sun Feb 26 17:35:00 -0500 2012: > Excerpts from Warren Weckesser's message of Sun Feb 26 16:22:35 -0500 2012: > > Yes, thanks! I'm working on a mmap version now. I'm very curious to see > > just how much of an improvement it can give. > > FYI, memmap is g

Re: [Numpy-discussion] Problem Building Numpy with Python 2.7.1 and OS X 10.7.3

2012-02-26 Thread Patrick Armstrong
Hi, On 2012-02-25, at 5:14 AM, Ralf Gommers wrote: > Since you're using pip, I assume that gcc-4.2 is llvm-gcc. As a first step, I > suggest using plain gcc and not using pip (so just "python setup.py > install"). Also make sure you follow the recommendations in "version specific > notes" at ht

[Numpy-discussion] How to modify an array

2012-02-26 Thread tetsuro_kikuchi
Dear sirs, Please allow me to ask you a beginner's question. I have an nparray whose shape is (144, 91, 1). The elements of this array are integer "0", "1" or "2", but I don't know which of the three integers is assigned to each element. I would like to make a copy of this array, and then replac

Re: [Numpy-discussion] How to modify an array

2012-02-26 Thread Olivier Delalleau
This should do what you want: array_copy = my_array.copy() array_copy[array_copy == 2] = 0 -=- Olivier Le 26 février 2012 19:53, a écrit : > Dear sirs, > > > Please allow me to ask you a beginner's question. > > I have an nparray whose shape is (144, 91, 1). The elements of this array > are in

Re: [Numpy-discussion] How to modify an array

2012-02-26 Thread tetsuro_kikuchi
Dear Olivier, Thank you very much for your help. It worked fine! Tetsuro Kikuchi Olivier Delalleau

[Numpy-discussion] numpy ndenumerate

2012-02-26 Thread Nathan Faggian
Hi, Is there a good reason for ndenumerate in numpy being slower than standard indexing? For example: --- import numpy as np def fast_itt(a): for index, value in np.ndenumerate(a): a[index] += 1 def slow_itt(a): for r in range(0, a.shape[0]): for c in range(0, a.shape[

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-26 Thread Jay Bourque
Erin Sheldon gmail.com> writes: > > Excerpts from Wes McKinney's message of Sat Feb 25 15:49:37 -0500 2012: > > That may work-- I haven't taken a look at the code but it is probably > > a good starting point. We could create a new repo on the pydata GitHub > > org (http://github.com/pydata) and