Re: [Numpy-discussion] Memory leak with matrices?

2010-03-09 Thread Robert Kern
,:] creates a view onto the same memory of the original array. Since you modify the values in-place, a[0,0] gets set to a[0,0]-a[0,0]==0, then a[1,0] gets set to a[1,0] - a[0,0] == a[1,0] - 0 == a[1,0], etc. Try this instead: a -= a[0,:].copy() -- Robert Kern I have come to believe that the whole

Re: [Numpy-discussion] crash at prompt exit after running test

2010-03-09 Thread Robert Kern
of the crash? -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy-Discussion mailing

Re: [Numpy-discussion] crash at prompt exit after running test

2010-03-09 Thread Robert Kern
(gdb) prompt: (gdb) continue # - Type this. Python 2.6.2 ... import numpy # - Type this and do whatever else is necessary to reproduce the crash. ... (gdb) bt # - Type this. # - Copy-paste these results here. -- Robert Kern I have come to believe that the whole world is an enigma

Re: [Numpy-discussion] Memory leak in signal.convolve2d? Alternative?

2010-03-09 Thread Robert Kern
(ones((1,1)), ones((1,1))) This does not leak for me using SVN versions of numpy and scipy. I recommend upgrading. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying

Re: [Numpy-discussion] numarray iterator question

2010-03-10 Thread Robert Kern
really want: u_row = my_func (u_row) Iterate over indices instead: for i in range(len(u)): u[i] = my_func(u[i]) -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had

Re: [Numpy-discussion] matrix operation

2010-03-12 Thread Robert Kern
]: array([[ 0.6667, 1.], [ 0.5 , 5.]]) -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] basic numpy array operation

2010-03-15 Thread Robert Kern
A = np.array([1,2,3,4,5,6]), k = 2 b = [1,2] c=[3,4,5,6] b = A[:2] c = A[2:] -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] Setting small numbers to zero.

2010-03-17 Thread Robert Kern
--much better for this. And numpy.clip() may be helpful here, No, it's not. though last I checked, it's written in Python, No, it isn't. and thus not all that fast. No, it's reasonably performant. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma

Re: [Numpy-discussion] Setting small numbers to zero.

2010-03-17 Thread Robert Kern
import Timer t = Timer(a[abs(a) 0.1] = 0, import numpy;a=numpy.random.random((2000, 2000))) t.repeat() -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth

Re: [Numpy-discussion] Setting small numbers to zero.

2010-03-17 Thread Robert Kern
On Wed, Mar 17, 2010 at 14:07, josef.p...@gmail.com wrote: On Wed, Mar 17, 2010 at 3:01 PM, Robert Kern robert.k...@gmail.com wrote: On Wed, Mar 17, 2010 at 14:04, Christopher Barker chris.bar...@noaa.gov wrote: Friedrich Romstedt wrote: Code: import numpy import time

Re: [Numpy-discussion] Setting small numbers to zero.

2010-03-17 Thread Robert Kern
On Wed, Mar 17, 2010 at 14:18, Keith Goodman kwgood...@gmail.com wrote: On Wed, Mar 17, 2010 at 12:08 PM, Robert Kern robert.k...@gmail.com wrote: On Wed, Mar 17, 2010 at 14:03, Keith Goodman kwgood...@gmail.com wrote: On Wed, Mar 17, 2010 at 12:04 PM, Christopher Barker chris.bar...@noaa.gov

Re: [Numpy-discussion] Int bitsize in python and c

2010-03-18 Thread Robert Kern
using a C long would work best for you. It's platform dependent, but it matches the platform dependent changes in numpy. It depends on what your needs are. If you need a consistent size (perhaps you are writing bytes out to a file), then always use the int32 or int64 specific types. -- Robert Kern

Re: [Numpy-discussion] dtype='|S8' -- what does vertical bar mean?

2010-03-23 Thread Robert Kern
be easy. Little help? That character is used to specify the byte order. | means native byte order. For 'S' dtypes, it doesn't make a difference; it has no byte order. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad

Re: [Numpy-discussion] StringIO test failure with Python3.1.2

2010-03-24 Thread Robert Kern
, because StringIO is in io in python 3, and we have a io module in numpy (.io is the new syntax for relative import). Ignore my previous email. This is the correct answer. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad

Re: [Numpy-discussion] StringIO test failure with Python3.1.2

2010-03-24 Thread Robert Kern
On Wed, Mar 24, 2010 at 09:35, Nadav Horesh nad...@visionsense.com wrote: Any idea why  from .io import StringIO and not  from io import StringIO ??? (Why is the extra . before io) It is a relative import, i.e. numpy.lib.io . -- Robert Kern I have come to believe that the whole

Re: [Numpy-discussion] StringIO test failure with Python3.1.2

2010-03-24 Thread Robert Kern
, because StringIO is in io in python 3, and we have a io module in numpy (.io is the new syntax for relative import). Bug reported: http://bugs.python.org/issue8221 -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad

Re: [Numpy-discussion] StringIO test failure with Python3.1.2

2010-03-24 Thread Robert Kern
On Wed, Mar 24, 2010 at 10:20, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Mar 24, 2010 at 9:07 AM, Robert Kern robert.k...@gmail.com wrote: On Wed, Mar 24, 2010 at 09:43, David Cournapeau courn...@gmail.com wrote: On Wed, Mar 24, 2010 at 11:35 PM, Nadav Horesh nad

Re: [Numpy-discussion] What does float64 mean on a 32-bit machine?

2010-03-24 Thread Robert Kern
. It has no effect on floating point types; 32- and 64-bit versions are standard on all supported platforms though the higher precisions vary significantly from machine to machine regardless of whether it is 32- or 64-bit. -- Robert Kern I have come to believe that the whole world is an enigma

Re: [Numpy-discussion] should ndarray implement __round__ for py3k?

2010-03-25 Thread Robert Kern
context: http://bugs.python.org/issue7261 I'd put that in the would be nice, but not a priority category. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth

Re: [Numpy-discussion] Renamed numpy.lib.io ?

2010-03-26 Thread Robert Kern
-March/049551.html etc. Is it to take effect with the incoming numpy 2.0 release ? Yes. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto

Re: [Numpy-discussion] Interpolation question

2010-03-28 Thread Robert Kern
of Rbf could be made to handle the vector-valued case. I leave that as an exercise to Andrea, of course. :-) -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth

Re: [Numpy-discussion] Interpolation question

2010-03-28 Thread Robert Kern
them properly to avoid RBFs going crazy. Scaling each axis by its standard deviation is a typical first start. Shifting and scaling the values such that they each go from 0 to 1 is another useful thing to try. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless

Re: [Numpy-discussion] Fourier transform

2010-03-29 Thread Robert Kern
On Mon, Mar 29, 2010 at 16:00, Pascal pascal...@parois.net wrote: Hi, Does anyone have an idea how fft functions are implemented? Is it pure python? based on BLAS/LAPACK? or is it using fftw? Using FFTPACK converted from FORTRAN to C. -- Robert Kern I have come to believe that the whole

Re: [Numpy-discussion] Interpolation question

2010-03-29 Thread Robert Kern
has some GP code: http://pymc.googlecode.com/files/GPUserGuide.pdf -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] indexing question

2010-03-30 Thread Robert Kern
subsystems. The list indexing takes priority so the list-indexed axes end up first in the result. The sliced axes follow them. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had

Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Robert Kern
should be faster than a boolean op. Branch prediction failures are really costly in modern CPUs. http://en.wikipedia.org/wiki/Branch_prediction -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret

Re: [Numpy-discussion] Dealloat Numy arrays in C

2010-03-31 Thread Robert Kern
the capitalization). This is almost always PyMem_Free() from Python. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] Is this odd?

2010-04-02 Thread Robert Kern
( irrespective to what is inside array). a.size 0 -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] Is this odd?

2010-04-02 Thread Robert Kern
the array. b[0] is the array itself. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy

Re: [Numpy-discussion] Getting index of array after applying cond

2010-04-02 Thread Robert Kern
, 7, 6], [1, 2, 3, 4, 5]]) In [3]: cond = (x 5) In [4]: i, j = where(cond) In [5]: i Out[5]: array([1, 1, 1, 1, 1]) In [6]: j Out[6]: array([0, 1, 2, 3, 4]) In [7]: argmax(x[cond]) Out[7]: 2 In [8]: i[2], j[2] Out[8]: (1, 2) In [9]: x[i[2], j[2]] Out[9]: 8 -- Robert Kern I have

Re: [Numpy-discussion] How do I ensure numpy headers are present in setup.py?

2010-04-02 Thread Robert Kern
() to get the dependencies. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy-Discussion

Re: [Numpy-discussion] Annoyance of memap rray with multiprocessing.Pool.applay_async

2010-04-03 Thread Robert Kern
instances don't pickle. Don't pass them as arguments to apply_async() or related functions. Instead, pass the filename and other arguments to memmap() and reconstruct the arrays in each process. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made

Re: [Numpy-discussion] Annoyance of memap rray withmultiprocessing.Pool.applay_async

2010-04-04 Thread Robert Kern
, and then reconstruct an ndarray on the other side and just change the type to memmap without actually memory-mapping the file. Thus you have a __del__ method referring to attributes that haven't been set up. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma

Re: [Numpy-discussion] Annoyance of memap rraywithmultiprocessing.Pool.applay_async

2010-04-05 Thread Robert Kern
shared memory array instead. I wonder, since both types share common properties, if there a way to interchange then transparently. Yes, you just need to instantiate the memmap arrays separately in each process. -- Robert Kern I have come to believe that the whole world is an enigma

Re: [Numpy-discussion] Math Library

2010-04-05 Thread Robert Kern
directory in numpy/core/src? David already did this: numpy/core/src/npymath/ -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] Math Library

2010-04-05 Thread Robert Kern
On Mon, Apr 5, 2010 at 10:56, Charles R Harris charlesr.har...@gmail.com wrote: On Mon, Apr 5, 2010 at 9:43 AM, Robert Kern robert.k...@gmail.com wrote: On Mon, Apr 5, 2010 at 10:40, Charles R Harris charlesr.har...@gmail.com wrote: Hi All, David Cournapeau has mentioned that he would

Re: [Numpy-discussion] Proposal for new ufunc functionality

2010-04-10 Thread Robert Kern
provide both the start and end points (rather than being fence-posts like reduceat). Is the `reducein` important to have, as compared to `reduceat`? Yes, I think so. If there are some areas you want to ignore, that's difficult to do with reduceat(). -- Robert Kern I have come to believe

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Robert Kern
On Mon, Apr 12, 2010 at 04:03, Nadav Horesh nad...@visionsense.com wrote: Is there a way to get the file-name given a memmap array object? Not at this time. This would be very useful, though, so patches are welcome. -- Robert Kern I have come to believe that the whole world is an enigma

Re: [Numpy-discussion] Best dtype for Boolean values

2010-04-12 Thread Robert Kern
this be (a) the cheapest way (w.r.t. memory) to store Booleans and Yes. (b) the most efficient way to compare two lists of Booleans? Yes. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Robert Kern
On Mon, Apr 12, 2010 at 15:52, Charles R Harris charlesr.har...@gmail.com wrote: On Mon, Apr 12, 2010 at 2:37 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Mon, Apr 12, 2010 at 1:55 PM, Brent Pedersen bpede...@gmail.com wrote: On Mon, Apr 12, 2010 at 9:49 AM, Robert Kern

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Robert Kern
the .name attribute of a file object to be a file name, the .name attribute an another type of object may be something different. memmap objects are quite different from file objects; we gain no particular consistency by using .name instead of .filename. -- Robert Kern I have come to believe

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Robert Kern
On Mon, Apr 12, 2010 at 16:14, Brent Pedersen bpede...@gmail.com wrote: On Mon, Apr 12, 2010 at 1:59 PM, Robert Kern robert.k...@gmail.com wrote: On Mon, Apr 12, 2010 at 15:52, Charles R Harris charlesr.har...@gmail.com wrote: On Mon, Apr 12, 2010 at 2:37 PM, Charles R Harris charlesr.har

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Robert Kern
On Mon, Apr 12, 2010 at 16:43, Gael Varoquaux gael.varoqu...@normalesup.org wrote: On Mon, Apr 12, 2010 at 04:39:23PM -0500, Robert Kern wrote: where should i write the docs? in the file itself or through the doc editor? also re path, since it can be a file-like, that would have

Re: [Numpy-discussion] Name of the file associated with a memmap

2010-04-12 Thread Robert Kern
On Mon, Apr 12, 2010 at 17:00, Brent Pedersen bpede...@gmail.com wrote: On Mon, Apr 12, 2010 at 2:46 PM, Robert Kern robert.k...@gmail.com wrote: On Mon, Apr 12, 2010 at 16:43, Gael Varoquaux gael.varoqu...@normalesup.org wrote: On Mon, Apr 12, 2010 at 04:39:23PM -0500, Robert Kern wrote

Re: [Numpy-discussion] Proposal for new ufunc functionality

2010-04-12 Thread Robert Kern
replace 2 with 3 and have no 2s in the by array): add.reduceby(array=[1,2,3,4,5,6,7,8,9], by=[0,1,0,1,3,0,0,3,3]) == [17, 6, 0, 22] This basically generalizes bincount() to other binary ufuncs. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma

Re: [Numpy-discussion] Proposal for new ufunc functionality

2010-04-12 Thread Robert Kern
to the scipy cookbook, but scipy.org is not responding.] I've bounced the server. Try again. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] Proposal for new ufunc functionality

2010-04-13 Thread Robert Kern
On Sat, Apr 10, 2010 at 17:59, Robert Kern robert.k...@gmail.com wrote: On Sat, Apr 10, 2010 at 12:45, Pauli Virtanen p...@iki.fi wrote: la, 2010-04-10 kello 12:23 -0500, Travis Oliphant kirjoitti: [clip] Here are my suggested additions to NumPy: ufunc methods: [clip]       * reducein

Re: [Numpy-discussion] How to combine a pair of 1D arrays?

2010-04-14 Thread Robert Kern
no way to get around that, I am afraid. It might be doable with a bit of ctypes if there is not a native numpy call.   import numpy as np   a = np.array((1,2,3,4))   b = np.array((11,12,13,14))   c = np.magical_fuse(a, b)   # what goes here? c = np.vstack([a, b]) -- Robert Kern I have come

Re: [Numpy-discussion] simple rectangular grid

2010-04-15 Thread Robert Kern
(16):    for iy in range (16):        const[ix, iy] = u[ix] + 1j*u[iy] In [7]: real, imag = np.mgrid[-7.5:7.5:16j, -7.5:7.5:16j] In [8]: const = real + 1j * imag -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad

Re: [Numpy-discussion] Numpy compilation error

2010-04-16 Thread Robert Kern
/carv/d1/people/pradeep/src/numpy-1.3.0/numpy', You should not have these two entries in your sys.path. Did you add them yourself via PYTHONPATH? If so, remove them. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad

Re: [Numpy-discussion] Numpy compilation error

2010-04-16 Thread Robert Kern
it. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy-Discussion mailing list NumPy

Re: [Numpy-discussion] Numpy compilation error

2010-04-16 Thread Robert Kern
-1.3.0/. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy-Discussion mailing list NumPy

Re: [Numpy-discussion] Numpy compilation error

2010-04-18 Thread Robert Kern
/' or the equivalent if you decide to fix the --prefix as above. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] Numpy compilation error

2010-04-18 Thread Robert Kern
probably replace the line in setup.py.in (sorry if this is not exactly right; I only downloaded the 1.7.0 sources, which still uses numarray): numpy_incl = @NUMPY_INC_DIR@ to: import numpy numpy_incl = numpy.get_include() Then the value of NUMPY_INC_DIR will not matter. -- Robert Kern I

Re: [Numpy-discussion] Numpy compilation error

2010-04-20 Thread Robert Kern
installed to. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy-Discussion mailing

Re: [Numpy-discussion] Numpy compilation error

2010-04-20 Thread Robert Kern
in PYTHONPATH -- if you install everything you need, you won't need to. When I'm using something under development, I use setuptools' setup.py develop He does not have root. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our

Re: [Numpy-discussion] trim_zeros in more than one dimension?

2010-04-21 Thread Robert Kern
, justl like trim_zeros() does for 1D arrays. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] trim_zeros in more than one dimension?

2010-04-22 Thread Robert Kern
On Wed, Apr 21, 2010 at 10:34, Bruce Southey bsout...@gmail.com wrote: On 04/21/2010 08:36 AM, Robert Kern wrote: On Tue, Apr 20, 2010 at 18:45, Charles R Harris charlesr.har...@gmail.com  wrote: On Tue, Apr 20, 2010 at 7:03 AM, Andreas Hilbollli...@hilboll.de  wrote: Hi

Re: [Numpy-discussion] Aggregate memmap

2010-04-25 Thread Robert Kern
([('delimiter', '|V8'), ('slice', np.float32, (N, M))]) -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] Aggregate memmap

2010-04-25 Thread Robert Kern
will behave as a regular 3D array. However, that will make a main-memory copy of everything, presumably what he is trying to avoid. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had

Re: [Numpy-discussion] trim_zeros in more than one dimension?

2010-04-25 Thread Robert Kern
On Thu, Apr 22, 2010 at 16:23, Bruce Southey bsout...@gmail.com wrote: On 04/21/2010 02:45 PM, Robert Kern wrote: On Wed, Apr 21, 2010 at 10:34, Bruce Southeybsout...@gmail.com  wrote: If the sum of axis to be removed equals zero then you can conditionally remove that axis. No. Negative

Re: [Numpy-discussion] trim_zeros in more than one dimension?

2010-04-25 Thread Robert Kern
On Sun, Apr 25, 2010 at 16:17, Robert Kern robert.k...@gmail.com wrote: On Thu, Apr 22, 2010 at 16:23, Bruce Southey bsout...@gmail.com wrote: On 04/21/2010 02:45 PM, Robert Kern wrote: On Wed, Apr 21, 2010 at 10:34, Bruce Southeybsout...@gmail.com  wrote: If the sum of axis to be removed

Re: [Numpy-discussion] proposing a beware of [as]matrix() warning

2010-04-28 Thread Robert Kern
operators would be a huge incentive to the NumPy community to move to Python 3. Anybody willing to lead the charge with the Python developers? There is currently a moratorium on language changes. This will have to wait. -- Robert Kern I have come to believe that the whole world is an enigma

Re: [Numpy-discussion] proposing a beware of [as]matrix() warning

2010-04-28 Thread Robert Kern
On Wed, Apr 28, 2010 at 15:50, Travis Oliphant oliph...@enthought.com wrote: On Apr 28, 2010, at 11:19 AM, Robert Kern wrote: On Wed, Apr 28, 2010 at 11:05, Travis Oliphant oliph...@enthought.com wrote: On Apr 26, 2010, at 7:19 PM, David Warde-Farley wrote: Trying to debug code written

Re: [Numpy-discussion] put with increment ?

2010-04-29 Thread Robert Kern
. Currently I have a little C extension which does the job, but I'm lazy to fix it up for all the various dtypes etc. Am I missing a more general way? total = np.bincount(indices, values) -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made

Re: [Numpy-discussion] Question about numpy.arange()

2010-05-02 Thread Robert Kern
greater than `stop`. You probably want linspace() instead. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] efficient way to manage a set of floats?

2010-05-12 Thread Robert Kern
, comparison must necessarily be by exact equality because fuzzy equality is not transitive. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] efficient way to manage a set of floats?

2010-05-12 Thread Robert Kern
On Wed, May 12, 2010 at 21:37, josef.p...@gmail.com wrote: On Wed, May 12, 2010 at 9:27 PM, Robert Kern robert.k...@gmail.com wrote: On Wed, May 12, 2010 at 20:09, Dr. Phillip M. Feldman pfeld...@verizon.net wrote: Warren Weckesser-3 wrote: A couple questions: How many floats will you

Re: [Numpy-discussion] default behavior of argsort

2010-05-14 Thread Robert Kern
)                      8 array([[0],       [0],       [0],       [0]]) |9 argsort(x,axis=0)                      9 array([[0],       [2],       [1],       [3]]) Sorry, but I don't think we are going to add a special case for this. -- Robert Kern I have come to believe that the whole world is an enigma

Re: [Numpy-discussion] default behavior of argsort

2010-05-14 Thread Robert Kern
On Fri, May 14, 2010 at 17:29, Eric Firing efir...@hawaii.edu wrote: On 05/14/2010 11:03 AM, Dr. Phillip M. Feldman wrote: Robert Kern-2 wrote: On Wed, May 12, 2010 at 20:19, Dr. Phillip M. Feldman pfeld...@verizon.net  wrote: When operating on an array whose last dimension is unity

Re: [Numpy-discussion] Problems creating numpy.array with a dtype

2010-05-15 Thread Robert Kern
that numpy.array() can do. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy

Re: [Numpy-discussion] Numpy doc string license

2010-05-20 Thread Robert Kern
a Simplifed BSD license, if that matters. That should work just fine. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] Summation of large float32/float64 arrays

2010-05-21 Thread Robert Kern
intermediate sums such that you are usually adding together numbers roughly in the same regime as each other, so you don't lose as much precision. Use a.sum(dtype=np.float64) to use a float64 accumulator. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma

Re: [Numpy-discussion] [SciPy-Dev] numpy and the Google App Engine

2010-05-26 Thread Robert Kern
. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy-Discussion mailing list NumPy

Re: [Numpy-discussion] How to distinguish between number and string dypes

2010-05-27 Thread Robert Kern
or not string. Maybe this is as good as it gets. The dtypes have a hierarchy. In [2]: np.issubdtype(float, np.number) Out[2]: True In [3]: np.issubdtype(str, np.number) Out[3]: False -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible

Re: [Numpy-discussion] ix_ and copies

2010-05-29 Thread Robert Kern
On Sat, May 29, 2010 at 12:27, Keith Goodman kwgood...@gmail.com wrote: Will making changes to arr2 never change arr1 if arr2 = arr1[np.ix_(*lists)] where lists is a list of (index) lists? np.ix_ returns a tuple of arrays so I'm guessing (and hoping) the answer is yes. Correct. -- Robert

Re: [Numpy-discussion] shuffle a slice

2010-05-29 Thread Robert Kern
(10) np.random.shuffle(l[:-1]) l   [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] This behavior does match the doc-string. l[:-1] creates a new list unconnected to the original list. np.random.shuffle() then shuffles that new list in-place. Is there any way for numpy to catch this? Nope. -- Robert Kern I

Re: [Numpy-discussion] typo in docs

2010-06-09 Thread Robert Kern
(or record) arrays. In general usage, that is true. However, we have more or less settled on consistently using structured array in the documentation in order to avoid confusion with recarrays. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made

Re: [Numpy-discussion] PutSum?

2010-06-11 Thread Robert Kern
lying around. Is there? numpy.bincount() -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] Serializing numpy record array

2010-06-13 Thread Robert Kern
=[('a', '|S6'), ('b', 'i4'), ('c', 'f8')]) In [5]: x.astype(np.dtype([('a', object), ('b', object), ('c', object)])) Out[5]: rec.array([('string', 10, 15.5)], dtype=[('a', '|O4'), ('b', '|O4'), ('c', '|O4')]) -- Robert Kern I have come to believe that the whole world is an enigma, a harmless

Re: [Numpy-discussion] Serializing numpy record array

2010-06-13 Thread Robert Kern
the .tolist() method. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy-Discussion mailing

Re: [Numpy-discussion] numpy for jython

2010-06-13 Thread Robert Kern
. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy-Discussion mailing list NumPy

Re: [Numpy-discussion] Fastest way to save a dictionary of numpy record arrays

2010-06-14 Thread Robert Kern
of arrays out to a .zip file. Each key/value pair will map to a file in the .zip file with a file name corresponding to the key. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had

Re: [Numpy-discussion] Fastest way to save a dictionary of numpy record arrays

2010-06-14 Thread Robert Kern
On Mon, Jun 14, 2010 at 19:27, Warren Weckesser warren.weckes...@enthought.com wrote: Robert Kern wrote: On Mon, Jun 14, 2010 at 19:00, Vishal Rana ranavis...@gmail.com wrote: Hi, I have dictionary of numpy record arrays, what could be fastest way to save/load to/from a disk. I tried

Re: [Numpy-discussion] Fastest way to save a dictionary of numpy record arrays

2010-06-15 Thread Robert Kern
and not all the data is loaded to the memory? Correct. The data is loaded lazily, on request. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] f2py with 4.1 under snow leopard

2010-06-16 Thread Robert Kern
Python extension are lost. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy-Discussion

Re: [Numpy-discussion] Trimming the np arrays

2010-06-16 Thread Robert Kern
On Wed, Jun 16, 2010 at 12:15, Vishal Rana ranavis...@gmail.com wrote: Hi, I have a list of np arrays from which I create a np record array, but they all of of different length! How can I trim them all in place (for example I want to get last 10 elements of each)? x = x[-10:] -- Robert

Re: [Numpy-discussion] Trimming the np arrays

2010-06-16 Thread Robert Kern
On Wed, Jun 16, 2010 at 12:30, Vishal Rana ranavis...@gmail.com wrote: Robert, Do I have to repeat it for each element in the list or is there a way I can iterate the list and do it? new_list = [x[-10:] for x in old_list] -- Robert Kern I have come to believe that the whole world

Re: [Numpy-discussion] f2py with 4.1 under snow leopard

2010-06-16 Thread Robert Kern
and is not ideal. But IIRC, no one has yet put in the effort to implement ways to do both things. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco

Re: [Numpy-discussion] Building Numpy: could not read symbols Bad value error

2010-06-16 Thread Robert Kern
returned 1 exit status This means that your ATLAS library was compiled without the appropriate flags for inclusion in a shared library like an extension module. Consult the ATLAS installation instructions for how to compile it as relocatable code using the -fPIC flag. -- Robert Kern I have come

Re: [Numpy-discussion] reading big-endian uint16 into array on little-endian machine

2010-06-17 Thread Robert Kern
On Thu, Jun 17, 2010 at 09:29, greg whittier gre...@gmail.com wrote: I have files (from an external source) that contain ~10 GB of big-endian uint16's that I need to read into a series of arrays. np.fromfile(filename, dtype='i2') -- Robert Kern I have come to believe that the whole world

Re: [Numpy-discussion] reading big-endian uint16 into array on little-endian machine

2010-06-17 Thread Robert Kern
have an unpack_farray version like xdrlib does.  I also thought of using the array module and .byteswap() but the help says it only work on 4 and 8 byte arrays. Maybe is a problem with docs. I think he was talking about the standard library array module. -- Robert Kern I have come to believe

Re: [Numpy-discussion] distutils and Framework

2010-06-17 Thread Robert Kern
package with a trivial setup.py. Try it both with from distutils.core import setup and from numpy.distutils.core import setup. See where they each install to. Both work identically for me. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible

Re: [Numpy-discussion] reading big-endian uint16 into array on little-endian machine

2010-06-18 Thread Robert Kern
? It does come with the tradeoff that math will be a little bit slower on it. A quick .astype(np.uint16) will fix that. That said, the cost of creating the memory for the new native array will probably wipe away those gains unless if the data is reused a number of times for calculations. -- Robert

Re: [Numpy-discussion] checking for array type in C extension

2010-06-18 Thread Robert Kern
to int also. It is referring to the Python int type, not the C int type. Python ints are actually C longs underneath. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had

Re: [Numpy-discussion] checking for array type in C extension

2010-06-18 Thread Robert Kern
-- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy-Discussion mailing list NumPy

Re: [Numpy-discussion] reduce array by computing min/max every n samples

2010-06-19 Thread Robert Kern
be useful. I have often wanted one. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy

Re: [Numpy-discussion] Numpy save / load

2010-06-21 Thread Robert Kern
). -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy-Discussion mailing list NumPy

Re: [Numpy-discussion] stacking record arrays

2010-06-21 Thread Robert Kern
of records. 1-D vectors are primarily treated as row vectors by things that care about horizontal and vertical for all dtypes, both records and normal scalars. It just gets a bit confusing because one often thinks of 1-D arrays of records as being rows and columns. -- Robert Kern I have come

Re: [Numpy-discussion] indexing question

2010-06-21 Thread Robert Kern
=0,879) C = A[b, np.arange(880)] -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy

<    7   8   9   10   11   12   13   14   15   16   >