Re: [Numpy-discussion] Trick for fast

2012-02-03 Thread Sebastian Berg
I guess Einsum is much cleaner, but I already had started with this and maybe someone likes it, this is fully vectorized and uses a bit of funny stuff too: # The dot product(s), written using broadcasting rules: a = -(x.reshape(-1,1,3) * x[...,None]) # Magic, to avoid the eye thing, takes all

Re: [Numpy-discussion] Data cube optimization for combination

2012-03-06 Thread Sebastian Berg
Hello, On Tue, 2012-03-06 at 13:00 +0100, Jose Miguel Ibáñez wrote: Hello everyone, does anyone know of an efficient implementation (maybe using numpy.where statement) of the next code for data cube (3d array) combining ? You use the axis keyword/argument to sum, at which point you want

Re: [Numpy-discussion] Bug in as_strided/reshape

2012-08-09 Thread Sebastian Berg
://mail.scipy.org/mailman/listinfo/numpy-discussion From eed2abca6144e16c5d9ca208ef90dd01f7dd6009 Mon Sep 17 00:00:00 2001 From: Sebastian Berg sebast...@sipsolutions.net Date: Thu, 9 Aug 2012 17:17:32 +0200 Subject: [PATCH] Fix reshaping of arrays with stride 0 in a dimension with size of more then 1

Re: [Numpy-discussion] Multidimensional neighbours

2012-08-16 Thread Sebastian Berg
Hello, Just to throw it in, if you do not mind useing scipy, you can use its multidimensional correlate method instead: stamp = np.ones((3,3,3)) stamp[1,1,1] = 0 num_neighbours = scipy.ndimage.correlate(x, stamp, mode='wrap')) In the link np.roll is used to implement periodic boundaries

[Numpy-discussion] Functions for stride manipulations

2012-08-19 Thread Sebastian Berg
Hey, Inspired by an existing PR into numpy, I created two functions based on stride_tricks which I thought might be useful inside numpy. So if I get any feedback/pointers, I would add some tests and create a PR. The first function rolling_window is to create for every point of the original

Re: [Numpy-discussion] Difference between np.loadtxt depending on whether you supply a file object or a filename

2012-08-20 Thread Sebastian Berg
Hello, On Mo, 2012-08-20 at 20:55 +1000, Andrew Nelson wrote: Dear list, I observe a difference when I try to load a 2D numpy array from a file object compared to if I supply a filename viz: np.version.version '1.5.1' f=open('fit_theoretical.txt') a=np.loadtxt(f) a.shape (1000,)

Re: [Numpy-discussion] how is y += x computed when y.strides = (0, 8) and x.strides=(16, 8) ?

2012-09-05 Thread Sebastian Berg
Hey, No idea if this is simply not support or just a bug, though I am guessing that such usage simply is not planned. However, this also has to do with buffering, so unless the behaviour is substantially changed, I would not expect even predictable results. I have used things like a[1:] += a[:-1]

Re: [Numpy-discussion] numpy.ma.MaskedArray.min() makes a copy?

2012-09-18 Thread Sebastian Berg
On Tue, 2012-09-18 at 08:42 -1000, Eric Firing wrote: On 2012/09/18 7:40 AM, Benjamin Root wrote: On Fri, Sep 7, 2012 at 12:05 PM, Nathaniel Smith n...@pobox.com mailto:n...@pobox.com wrote: On 7 Sep 2012 14:38, Benjamin Root ben.r...@ou.edu mailto:ben.r...@ou.edu wrote:

[Numpy-discussion] np.delete fix

2012-09-20 Thread Sebastian Berg
Hey, I have written a small PR, to fix np.delete, since it would change the behavior a little (to the better IMO) I think I should also write to the list? So here is the problem with np.delete: 1. When using slices with negative strides, it does not work (best case) or give even wrong results.

Re: [Numpy-discussion] ZeroRank memmap behavior?

2012-09-21 Thread Sebastian Berg
Hey, this is indirectly related (I think it might fix many of these memmap oddities though?)... Why does the memmap object not implement: def __array_wrap__(self, obj): if self is obj: return obj return np.array(obj, copy=False, subok=False) By doing so if we

[Numpy-discussion] Ignore axes with dimension==1 for contiguous flags

2012-09-22 Thread Sebastian Berg
Hey, Numpy currently assumes that if ndim 1 then it is impossible for any array to be both C- and F-contiguous, however an axes of dimension 1 does have no effect on the memory layout. I think I have made most important changes (actually really very few), though I bet some parts of numpy still

[Numpy-discussion] np.array execution path

2012-09-22 Thread Sebastian Berg
Hi, I have a bit of trouble figuring this out. I would have expected np.asarray(array) to go through ctors, PyArray_NewFromArray, but it seems to me it does not, so which execution path is exactly taken here? The reason I am asking is that I want to figure out this behavior/bug, and I really am

Re: [Numpy-discussion] np.array execution path

2012-09-22 Thread Sebastian Berg
(on a mobile) 512-826-7480 On Sep 22, 2012, at 1:01 PM, Sebastian Berg sebast...@sipsolutions.net wrote: Hi, I have a bit of trouble figuring this out. I would have expected np.asarray(array) to go through ctors, PyArray_NewFromArray, but it seems to me it does not, so which

Re: [Numpy-discussion] np.array execution path

2012-09-23 Thread Sebastian Berg
On Sat, 2012-09-22 at 13:12 -0500, Travis Oliphant wrote: Check to see if this expression is true no is o In the first case no and o are the same object Travis -- Travis Oliphant (on a mobile) 512-826-7480 On Sep 22, 2012, at 1:01 PM, Sebastian Berg sebast

Re: [Numpy-discussion] np.array execution path

2012-09-23 Thread Sebastian Berg
On Sun, 2012-09-23 at 18:54 +0100, Nathaniel Smith wrote: On Sat, Sep 22, 2012 at 10:24 PM, Sebastian Berg sebast...@sipsolutions.net wrote: In case you are interested, the second (real odditiy), is caused by ISFORTRAN and IS_F_CONTIGUOUS mixup, I have found three occurances where I think

Re: [Numpy-discussion] ANN: NumPy 1.7.0b2 release

2012-10-01 Thread Sebastian Berg
Hey, About the imaginary part being ignored for all/any function... snip The all method fails also. In [1]: a = zeros(5, complex) In [2]: a.imag = 1 In [3]: a.all() Out[3]: False Chuck I believe this diff fixes the issue (also posted on Tracker), I doubt its the best way to fix

Re: [Numpy-discussion] ANN: NumPy 1.7.0b2 release

2012-10-01 Thread Sebastian Berg
On Mon, 2012-10-01 at 10:59 -0600, Charles R Harris wrote: On Mon, Oct 1, 2012 at 10:09 AM, Sebastian Berg sebast...@sipsolutions.net wrote: Hey, About the imaginary part being ignored for all/any function... snip

Re: [Numpy-discussion] Fwd: [numpy] ENH: Initial implementation of a 'neighbor' calculation (#303)

2012-10-11 Thread Sebastian Berg
On Wed, 2012-10-10 at 12:55 -0400, Cera, Tim wrote: On Wed, Oct 10, 2012 at 1:58 AM, Travis E. Oliphant notificati...@github.com wrote: I'm not sure what to make of no comments on this PR. This seems like a useful addition. @timcera are you still interested in having

Re: [Numpy-discussion] copy/deepcopy pull request, Travis build failure

2012-10-25 Thread Sebastian Berg
On Thu, 2012-10-25 at 17:48 -0400, David Warde-Farley wrote: I submitted a pull request and one of the Travis builds is failing: https://travis-ci.org/#!/numpy/numpy/jobs/2933551 Don't worry about that failure on Travis... It happens randomly on at the moment and its unrelated to

Re: [Numpy-discussion] copy/deepcopy pull request, Travis build failure

2012-10-26 Thread Sebastian Berg
Hey On Thu, 2012-10-25 at 19:27 -0600, Charles R Harris wrote: Hi Sebastian, snip You seem to becoming more involved in the code maintenance. Would you be interested in gaining commit rights at some point? Maybe, but honestly I am not sure if I will keep following numpy very closely in

Re: [Numpy-discussion] Regression in mpl: AttributeError: incompatible shape for a non-contiguous array

2012-10-29 Thread Sebastian Berg
Hey, On Mon, 2012-10-29 at 09:54 -0400, Benjamin Root wrote: This error started showing up in the test suite for mpl when using numpy master. AttributeError: incompatible shape for a non-contiguous array The tracebacks all point back to various code points where we are trying to set the

Re: [Numpy-discussion] Regression in mpl: AttributeError: incompatible shape for a non-contiguous array

2012-10-29 Thread Sebastian Berg
the problem to this commit: https://github.com/numpy/numpy/commit/c48156dfdc408f0a1e59ef54ac490cccbd6b8d73 Patrick.Marsh@buxton numpy git bisect good c48156dfdc408f0a1e59ef54ac490cccbd6b8d73 is the first bad commit commit c48156dfdc408f0a1e59ef54ac490cccbd6b8d73 Author: Sebastian Berg

Re: [Numpy-discussion] using numpy.argmax to index into another array

2012-10-31 Thread Sebastian Berg
Hey, On Wed, 2012-10-31 at 20:22 -0400, David Warde-Farley wrote: On Wed, Oct 31, 2012 at 7:23 PM, Moroney, Catherine M (388D) catherine.m.moro...@jpl.nasa.gov wrote: Hello Everybody, I have the following problem that I would be interested in finding an easy/elegant solution to. I've

Re: [Numpy-discussion] using numpy.argmax to index into another array

2012-10-31 Thread Sebastian Berg
On Thu, 2012-11-01 at 01:30 +0100, Sebastian Berg wrote: Hey, On Wed, 2012-10-31 at 20:22 -0400, David Warde-Farley wrote: On Wed, Oct 31, 2012 at 7:23 PM, Moroney, Catherine M (388D) catherine.m.moro...@jpl.nasa.gov wrote: Hello Everybody, I have the following problem that I

Re: [Numpy-discussion] Scipy dot

2012-11-08 Thread Sebastian Berg
Hey, On Thu, 2012-11-08 at 14:44 -0800, Nicolas SCHEFFER wrote: Well, hinted by what Fabien said, I looked at the C level dot function. Quite verbose! But starting line 757, we can see that it shouldn't be too much work to fix that bug (well there is even a comment there that states just

Re: [Numpy-discussion] Scipy dot

2012-11-08 Thread Sebastian Berg
On Fri, 2012-11-09 at 00:24 +0100, Sebastian Berg wrote: Hey, On Thu, 2012-11-08 at 14:44 -0800, Nicolas SCHEFFER wrote: Well, hinted by what Fabien said, I looked at the C level dot function. Quite verbose! But starting line 757, we can see that it shouldn't be too much work to fix

Re: [Numpy-discussion] Scipy dot

2012-11-09 Thread Sebastian Berg
On Fri, 2012-11-09 at 14:52 -0800, Nicolas SCHEFFER wrote: Ok: comparing apples to apples. I'm clueless on my observations and would need input from you guys. Using ATLAS 3.10, numpy with and without my changes, I'm getting these timings and comparisons. # #I. Generate matrices using

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-12 Thread Sebastian Berg
Hey, On Mon, 2012-11-12 at 08:48 -0500, Alan G Isaac wrote: On 11/9/2012 12:21 PM, Nathaniel Smith wrote: you might want to double-check that the np.random.choice in 1.7 actually*does* give an error if the input array is not 1-d Any idea where I can look at the code? I browsed

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-12 Thread Sebastian Berg
On Mon, 2012-11-12 at 17:52 +0100, Nathaniel Smith wrote: On Mon, Nov 12, 2012 at 5:31 PM, Alan G Isaac alan.is...@gmail.com wrote: In a comment on the issue https://github.com/numpy/numpy/issues/2724 Sebastian notes: it could also be reasonable to have size=None as default and have it

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-12 Thread Sebastian Berg
On Mon, 2012-11-12 at 18:36 -0500, Alan G Isaac wrote: On 11/12/2012 5:46 PM, Nathaniel Smith wrote: Want to make a pull request? Well, I'd be happy to help Sebastien to change the code, but I'm not a git user. I have created a pull request, but tests are still needed... If you like it

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-13 Thread Sebastian Berg
On Mon, 2012-11-12 at 22:44 -0500, Alan G Isaac wrote: On 11/12/2012 8:18 PM, Sebastian Berg wrote: I have created a pull request This is still a bit different than I thought you intended. With `size=None` we don't get an element, but rather a 0d array. You are right, it should

Re: [Numpy-discussion] Crash using reshape...

2012-11-21 Thread Sebastian Berg
Hey, On Wed, 2012-11-21 at 01:12 -0800, Terry J. Ligocki wrote: I am having a problem with reshape crashing: python Python 2.6.4 (r264:75706, Jan 16 2010, 21:11:47) [GCC 4.3.2] on linux2 Type help, copyright, credits or license for more information.

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-22 Thread Sebastian Berg
On Wed, 2012-11-21 at 22:58 -0500, josef.p...@gmail.com wrote: On Wed, Nov 21, 2012 at 10:35 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Nov 21, 2012 at 7:45 PM, josef.p...@gmail.com wrote: On Wed, Nov 21, 2012 at 9:22 PM, Olivier Delalleau sh...@keba.be wrote:

Re: [Numpy-discussion] the mean, var, std of empty arrays

2012-11-22 Thread Sebastian Berg
On Thu, 2012-11-22 at 16:05 +0100, Daπid wrote: On Thu, Nov 22, 2012 at 3:54 PM, josef.p...@gmail.com wrote: Why don't operations on empty arrays not return empty arrays? Because functions like mean or std are expected to return a scalar. Functions that are piecewiese can (and should)

Re: [Numpy-discussion] When are 0-d arrays writeable?

2012-11-23 Thread Sebastian Berg
On Fri, 2012-11-23 at 10:49 +, Nathaniel Smith wrote: On 23 Nov 2012 03:34, Charles R Harris charlesr.har...@gmail.com wrote: Examples, In [13]: ones(()).flags.writeable Out[13]: True In [14]: (-ones(())).flags.writeable Out[14]: False In [15]:

Re: [Numpy-discussion] result shape from dot for 0d, 1d, 2d scalar

2012-11-27 Thread Sebastian Berg
On Mon, 2012-11-26 at 13:54 -0500, Skipper Seabold wrote: I discovered this because scipy.optimize.fmin_powell appears to squeeze 1d argmin to 0d unlike the other optimizers, but that's a different story. I would expect the 0d array to behave like the 1d array not the 2d as it does below.

Re: [Numpy-discussion] result shape from dot for 0d, 1d, 2d scalar

2012-11-28 Thread Sebastian Berg
On Wed, 2012-11-28 at 11:11 -0500, Skipper Seabold wrote: On Tue, Nov 27, 2012 at 11:16 AM, Sebastian Berg sebast...@sipsolutions.net wrote: On Mon, 2012-11-26 at 13:54 -0500, Skipper Seabold wrote: I discovered this because scipy.optimize.fmin_powell appears

[Numpy-discussion] Allowing 0-d arrays in np.take

2012-12-04 Thread Sebastian Berg
Hey, Maybe someone has an opinion about this (since in fact it is new behavior, so it is undefined). `np.take` used to not allow 0-d/scalar input but did allow any other dimensions for the indices. Thinking about changing this, meaning that: np.take(np.arange(5), 0) works. I was wondering if

[Numpy-discussion] Numpy's definition of contiguous arrays

2012-12-04 Thread Sebastian Berg
Hi, maybe someone has an opinion about how this can be handled and was not yet aware of this. In current numpy master (probably being reverted), the definition for contiguous arrays is changed such that it means Contiguous in memory and nothing more. What this means is this: 1. An array of size

Re: [Numpy-discussion] non-integer index misfeature?

2012-12-12 Thread Sebastian Berg
On Wed, 2012-12-12 at 20:48 +, Nathaniel Smith wrote: On Wed, Dec 12, 2012 at 8:20 PM, Ralf Gommers ralf.gomm...@gmail.com wrote: On Tue, Dec 11, 2012 at 5:44 PM, Neal Becker ndbeck...@gmail.com wrote: I think it's a misfeature that a floating point is silently accepted as an index.

[Numpy-discussion] Howto bisect old commits correctly

2013-01-04 Thread Sebastian Berg
Hey, this is probably just because I do not have any experience with bisect and the like, but when I try running a bisect keep running into: ImportError: /home/sebastian/.../lib/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: PyDataMem_NEW or: RuntimeError: module compiled

Re: [Numpy-discussion] Howto bisect old commits correctly

2013-01-04 Thread Sebastian Berg
On Sat, 2013-01-05 at 00:17 +0100, Sebastian Berg wrote: Hey, this is probably just because I do not have any experience with bisect and the like, but when I try running a bisect keep running into: Nevermind that. Probably I just stumbled on some bad versions... ImportError: /home

Re: [Numpy-discussion] Rank-0 arrays - reprise

2013-01-06 Thread Sebastian Berg
On Sun, 2013-01-06 at 08:58 +0100, Dag Sverre Seljebotn wrote: On 01/05/2013 10:31 PM, Nathaniel Smith wrote: On 5 Jan 2013 12:16, Matthew Brett matthew.br...@gmail.com wrote: Hi, Following on from Nathaniel's explorations of the scalar - array casting rules, some resources on rank-0

[Numpy-discussion] high dimensional array - python scalar/index

2013-01-06 Thread Sebastian Berg
Question for everyone, is this really reasonable: import numpy as np from operator import index index(np.array([[5]])) 5 int(np.array([[5]])) 5 [0,1,2,3][np.array([[2]])] 2 To me, this does not make sense, why should we allow to use a high dimensional object like a normal scalar (its ok for

Re: [Numpy-discussion] high dimensional array - python scalar/index

2013-01-06 Thread Sebastian Berg
On Sun, 2013-01-06 at 13:28 -0500, josef.p...@gmail.com wrote: On Sun, Jan 6, 2013 at 12:57 PM, Sebastian Berg sebast...@sipsolutions.net wrote: Question for everyone, is this really reasonable: import numpy as np from operator import index index(np.array([[5]])) 5 int(np.array([[5

Re: [Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

2013-01-08 Thread Sebastian Berg
On Tue, 2013-01-08 at 19:59 +, Nathaniel Smith wrote: On 8 Jan 2013 17:24, Andrew Collette andrew.colle...@gmail.com wrote: Hi, I think you are voting strongly for the current casting rules, because they make it less obvious to the user that scalars are different from arrays.

Re: [Numpy-discussion] int and long issues

2013-01-10 Thread Sebastian Berg
On Thu, 2013-01-10 at 11:32 +0100, Mads Ipsen wrote: Hi, I find this to be a little strange: x = numpy.arange(10) isinstance(x[0],int) gives True y = numpy.where(x 5)[0] isinstance(y[0],int) gives False isinstance(y[0],long) Check what

Re: [Numpy-discussion] int and long issues

2013-01-10 Thread Sebastian Berg
On Thu, 2013-01-10 at 11:32 +0100, Mads Ipsen wrote: Hi, I find this to be a little strange: x = numpy.arange(10) isinstance(x[0],int) gives True y = numpy.where(x 5)[0] isinstance(y[0],int) gives False isinstance(y[0],long) Check what

Re: [Numpy-discussion] return index of maximum value in an array easily?

2013-01-11 Thread Sebastian Berg
On Sat, 2013-01-12 at 00:26 +0100, Chao YUE wrote: Hi, I don't know how others think about this. Like you point out, one can use np.nonzero(a==np.max(a)) as a workaround. For the second point, in case I have an array: a = np.arange(24.).reshape(2,3,4) suppose I want to find the

Re: [Numpy-discussion] Subclassing ndarray with concatenate

2013-01-22 Thread Sebastian Berg
Hey, On Tue, 2013-01-22 at 10:21 +0100, Todd wrote: I am trying to create a subclass of ndarray that has additional attributes. These attributes are maintained with most numpy functions if __array_finalize__ is used. You can cover a bit more if you also implement `__array_wrap__`, though

Re: [Numpy-discussion] Subclassing ndarray with concatenate

2013-01-22 Thread Sebastian Berg
On Tue, 2013-01-22 at 13:44 +0100, Sebastian Berg wrote: Hey, On Tue, 2013-01-22 at 10:21 +0100, Todd wrote: I am trying to create a subclass of ndarray that has additional attributes. These attributes are maintained with most numpy functions if __array_finalize__ is used. You can

Re: [Numpy-discussion] numpythonically getting elements with the minimum sum

2013-01-29 Thread Sebastian Berg
On Tue, 2013-01-29 at 14:53 +0100, Lluís wrote: Gregor Thalhammer writes: Am 28.1.2013 um 23:15 schrieb Lluís: Hi, I have a somewhat convoluted N-dimensional array that contains information of a set of experiments. The last dimension has as many entries as iterations in the

Re: [Numpy-discussion] Subclassing ndarray with concatenate

2013-01-30 Thread Sebastian Berg
On Wed, 2013-01-30 at 10:24 +0100, Todd wrote: On Tue, Jan 22, 2013 at 1:44 PM, Sebastian Berg sebast...@sipsolutions.net wrote: Hey, On Tue, 2013-01-22 at 10:21 +0100, Todd wrote: The main exception I have found is concatenate

Re: [Numpy-discussion] Issues to fix for 1.7.0rc2.

2013-02-06 Thread Sebastian Berg
On Wed, 2013-02-06 at 10:18 +0100, Dag Sverre Seljebotn wrote: On 02/06/2013 08:41 AM, Charles R Harris wrote: On Tue, Feb 5, 2013 at 11:50 PM, Jason Grout jason-s...@creativetrax.com mailto:jason-s...@creativetrax.com wrote: On 2/6/13 12:46 AM, Charles R Harris wrote: if

Re: [Numpy-discussion] Building numpy for python3.3: No _numpyconfig.h

2013-02-06 Thread Sebastian Berg
On Wed, 2013-02-06 at 13:31 +, gk230-free...@yahoo.de wrote: Hi, I'm currently trying to build numpy 1.6.2 for python python 3.3 from ports on FreeBSD. Unfortunately, the setup.py execution fails because some [1] gcc command trying to access _numpyconfig.h fails since _numpyconfig.h is

Re: [Numpy-discussion] Where's that function?

2013-02-06 Thread Sebastian Berg
On Wed, 2013-02-06 at 13:08 -0500, josef.p...@gmail.com wrote: I'm convinced that I saw a while ago a function that uses a list of interval boundaries to index into an array, either to iterate or to take. I thought that's very useful, but didn't make a note. Now, I have no idea where I saw

Re: [Numpy-discussion] np.percentile docstring

2013-02-17 Thread Sebastian Berg
Hey, On Sun, 2013-02-17 at 11:50 +0100, Andreas Hilboll wrote: In my numpy 1.6.1 (from Ubuntu 12.04LTS repository), the docstring of np.percentile is wrong. I'm not just submitting a PR because I don't understand something. in the Notes and Examples sections, there seems to be some

Re: [Numpy-discussion] Array accumulation in numpy

2013-02-19 Thread Sebastian Berg
On Tue, 2013-02-19 at 10:00 -0500, Tony Ladd wrote: I want to accumulate elements of a vector (x) to an array (f) based on an index list (ind). For example: x=[1,2,3,4,5,6] ind=[1,3,9,3,4,1] f=np.zeros(10) What I want would be produced by the loop for i=range(6):

[Numpy-discussion] What should np.ndarray.__contains__ do

2013-02-25 Thread Sebastian Berg
Hello all, currently the `__contains__` method or the `in` operator on arrays, does not return what the user would expect when in the operation `a in b` the `a` is not a single element (see In [3]-[4] below). The first solution coming to mind might be checking `all()` for all dimensions given in

Re: [Numpy-discussion] What should np.ndarray.__contains__ do

2013-02-25 Thread Sebastian Berg
On Mon, 2013-02-25 at 16:33 +, Nathaniel Smith wrote: On Mon, Feb 25, 2013 at 3:10 PM, Sebastian Berg sebast...@sipsolutions.net wrote: Hello all, currently the `__contains__` method or the `in` operator on arrays, does not return what the user would expect when in the operation

Re: [Numpy-discussion] What should np.ndarray.__contains__ do

2013-02-25 Thread Sebastian Berg
on the other hand it would only do something reasonable when otherwise an error would be thrown and it definitely is useful and compatible to what anyone else might expect. On Feb 25, 2013 5:34 PM, Nathaniel Smith n...@pobox.com wrote: On Mon, Feb 25, 2013 at 3:10 PM, Sebastian Berg

Re: [Numpy-discussion] Adding .abs() method to the array object

2013-02-25 Thread Sebastian Berg
On Mon, 2013-02-25 at 10:50 -0500, Skipper Seabold wrote: On Mon, Feb 25, 2013 at 10:43 AM, Till Stensitzki mail.t...@gmx.de wrote: First, sorry that i didnt search for an old thread, but because i disagree with conclusion i would at least address my reason: I don't like

Re: [Numpy-discussion] What should np.ndarray.__contains__ do

2013-02-26 Thread Sebastian Berg
On Mon, 2013-02-25 at 16:33 +, Nathaniel Smith wrote: On Mon, Feb 25, 2013 at 3:10 PM, Sebastian Berg sebast...@sipsolutions.net wrote: Hello all, currently the `__contains__` method or the `in` operator on arrays, does not return what the user would expect when in the operation

Re: [Numpy-discussion] Array indexing and repeated indices

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 08:30 +0100, Nicolas Rougier wrote: Hi, I'm trying to increment an array using indexing and a second array for increment values (since it might be a little tedious to explain, see below for a short example). Using direct indexing, the values in the example are

[Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
Hi, there has been a request on the issue tracker for a step parameter to linspace. This is of course tricky with the imprecision of floating point numbers. As a trade off, I was thinking of a step parameter that is used to calculate the integer number of steps. However to be certain that it

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 12:33 +, Henry Gomersall wrote: On Fri, 2013-03-01 at 13:25 +0100, Sebastian Berg wrote: there has been a request on the issue tracker for a step parameter to linspace. This is of course tricky with the imprecision of floating point numbers. How

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 13:34 +, Nathaniel Smith wrote: On Fri, Mar 1, 2013 at 12:33 PM, Henry Gomersall h...@cantab.net wrote: On Fri, 2013-03-01 at 13:25 +0100, Sebastian Berg wrote: there has been a request on the issue tracker for a step parameter to linspace. This is of course tricky

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 15:07 +, Henry Gomersall wrote: On Fri, 2013-03-01 at 10:01 -0500, Alan G Isaac wrote: On 3/1/2013 9:32 AM, Henry Gomersall wrote: there should be an equivalent for floats that unambiguously returns a range for the half open interval If I've understood

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 10:49 -0500, Alan G Isaac wrote: One motivation of this thread was that adding a step parameter to linspace might make things easier for beginners. I claim this thread has put the lie to that, starting with the initial post. So what is the persuasive case for the

Re: [Numpy-discussion] aligned / unaligned structured dtype behavior (was: GSOC 2013)

2013-03-06 Thread Sebastian Berg
On Wed, 2013-03-06 at 12:42 -0600, Kurt Smith wrote: On Wed, Mar 6, 2013 at 12:12 PM, Kurt Smith kwmsm...@gmail.com wrote: On Wed, Mar 6, 2013 at 4:29 AM, Francesc Alted franc...@continuum.io wrote: I would not run too much. The example above takes 9 bytes to host the structure, while

[Numpy-discussion] Compile time flag for numpy

2013-03-09 Thread Sebastian Berg
Hey, how would I go about making a compile time flag for numpy to use as a macro? The reason is: https://github.com/numpy/numpy/pull/2735 so that it would be possible to compile numpy differently for debugging if software depending on numpy is broken by this change. Regards, Sebastian

Re: [Numpy-discussion] Compile time flag for numpy

2013-03-09 Thread Sebastian Berg
On Sat, 2013-03-09 at 17:17 +0100, Sebastian Berg wrote: Hey, how would I go about making a compile time flag for numpy to use as a macro? To be clear I mean an environment variable. The reason is: https://github.com/numpy/numpy/pull/2735 so that it would be possible to compile numpy

Re: [Numpy-discussion] NumPy/SciPy participation in GSoC 2013

2013-03-24 Thread Sebastian Berg
On Thu, 2013-03-21 at 22:20 +0100, Ralf Gommers wrote: Hi all, It is the time of the year for Google Summer of Code applications. If we want to participate with Numpy and/or Scipy, we need two things: enough mentors and ideas for projects. If we get those, we'll apply under the PSF

Re: [Numpy-discussion] Raveling, reshape order keyword unnecessarily confuses index and memory ordering

2013-03-30 Thread Sebastian Berg
On Fri, 2013-03-29 at 19:08 -0700, Matthew Brett wrote: Hi, We were teaching today, and found ourselves getting very confused about ravel and shape in numpy. Summary -- There are two separate ideas needed to understand ordering in ravel and reshape: Idea 1): ravel /

Re: [Numpy-discussion] Raveling, reshape order keyword unnecessarily confuses index and memory ordering

2013-03-30 Thread Sebastian Berg
On Sat, 2013-03-30 at 12:45 -0700, Matthew Brett wrote: Hi, On Sat, Mar 30, 2013 at 11:55 AM, Sebastian Berg sebast...@sipsolutions.net wrote: On Fri, 2013-03-29 at 19:08 -0700, Matthew Brett wrote: Hi, We were teaching today, and found ourselves getting very confused about ravel

Re: [Numpy-discussion] Raveling, reshape order keyword unnecessarily confuses index and memory ordering

2013-04-01 Thread Sebastian Berg
On Sun, 2013-03-31 at 14:04 -0700, Matthew Brett wrote: Hi, On Sun, Mar 31, 2013 at 1:43 PM, josef.p...@gmail.com wrote: On Sun, Mar 31, 2013 at 3:54 PM, Matthew Brett matthew.br...@gmail.com wrote: Hi, On Sat, Mar 30, 2013 at 10:38 PM, josef.p...@gmail.com wrote: On Sun, Mar

Re: [Numpy-discussion] Raveling, reshape order keyword unnecessarily confuses index and memory ordering

2013-04-04 Thread Sebastian Berg
On Thu, 2013-04-04 at 12:40 -0700, Matthew Brett wrote: Hi, snip So - to restate in other words - this : np.reshape(a, (3, 4), order='F') could reasonably mean one of two orthogonal things 1) Retrieve data from the array using first-to-last indexing, return any memory layout you

Re: [Numpy-discussion] einsum and broadcasting

2013-04-05 Thread Sebastian Berg
On Thu, 2013-04-04 at 16:56 +0300, Jaakko Luttinen wrote: I don't quite understand how einsum handles broadcasting. I get the following error, but I don't understand why: In [8]: import numpy as np In [9]: A = np.arange(12).reshape((4,3)) In [10]: B = np.arange(6).reshape((3,2)) In [11]:

Re: [Numpy-discussion] OpenOpt Suite release 0.45

2013-04-10 Thread Sebastian Berg
On Wed, 2013-04-10 at 11:45 +0200, Sebastian Berg wrote: On Wed, 2013-04-10 at 11:54 +0300, Dmitrey wrote: On 04/10/2013 10:31 AM, Robert Kern wrote: snip This is all good and nice, but Robert is still right. For dictionaries to work predictable you need to ensure two things. First

Re: [Numpy-discussion] OpenOpt Suite release 0.45

2013-04-10 Thread Sebastian Berg
On Wed, 2013-04-10 at 11:45 +0200, Sebastian Berg wrote: On Wed, 2013-04-10 at 11:54 +0300, Dmitrey wrote: On 04/10/2013 10:31 AM, Robert Kern wrote: You think comparing tracked bug counts across different projects means anything? That's adorable. I admire your diligence at addressing

Re: [Numpy-discussion] Scheduling the 1.7.1 and 1.8 releases

2013-04-11 Thread Sebastian Berg
On Wed, 2013-03-06 at 11:43 -0700, Charles R Harris wrote: Hi All, snip The development branch has been accumulating stuff since last summer, I suggest we look to get it out in May, branching at the end of this month. Hey, maybe it is a bit early, but I was wondering. What are the things

Re: [Numpy-discussion] Random number generation and testing across different OS's.

2013-04-12 Thread Sebastian Berg
On Fri, 2013-04-12 at 10:50 -0400, Andrew Nelson wrote: I have written a differential evolution optimiser that i use for curvefitting. As a genetic optimisation technique it is stochastic and relies heavily on random number generators to do the minimisation. As part of the

[Numpy-discussion] Non-Integer deprecations

2013-04-12 Thread Sebastian Berg
Hey all, just revisiting non-integer (index) deprecations (basically https://github.com/numpy/numpy/pull/2891). I believe for all natural integer arguments, it is correct to do a deprecation if the input is not an integer. (Technically most of these go through PyArray_PyIntAsIntp, and if not

[Numpy-discussion] MapIter api

2013-04-15 Thread Sebastian Berg
Hey, the MapIter API has only been made public in master right? So it is no problem at all to change at least the mapiter struct, right? I got annoyed at all those special cases that make things difficult to get an idea where to put i.e. to fix the boolean array-like stuff. So actually started

Re: [Numpy-discussion] MapIter api

2013-04-15 Thread Sebastian Berg
On Mon, 2013-04-15 at 11:16 -0600, Charles R Harris wrote: On Mon, Apr 15, 2013 at 10:29 AM, Sebastian Berg sebast...@sipsolutions.net wrote: Hey, the MapIter API has only been made public in master right? So it is no problem at all to change

Re: [Numpy-discussion] MapIter api

2013-04-16 Thread Sebastian Berg
On Mon, 2013-04-15 at 13:36 -0600, Charles R Harris wrote: On Mon, Apr 15, 2013 at 1:27 PM, Sebastian Berg sebast...@sipsolutions.net wrote: On Mon, 2013-04-15 at 11:16 -0600, Charles R Harris wrote: On Mon, Apr 15, 2013 at 10:29 AM, Sebastian Berg

Re: [Numpy-discussion] datetime64 1970 issue

2013-04-17 Thread Sebastian Berg
On Wed, 2013-04-17 at 09:07 -0700, Chris Barker - NOAA Federal wrote: On Wed, Apr 17, 2013 at 9:04 AM, Chris Barker - NOAA Federal chris.bar...@noaa.gov wrote: On Tue, Apr 16, 2013 at 8:23 PM, Zachary Ploskey zplos...@gmail.com wrote: I'd say we need some more unit-tests! speaking of

[Numpy-discussion] Index Parsing redo

2013-04-18 Thread Sebastian Berg
Hey, so I ignored trying to redo MapIter (likely it is lobotomized at this time though). But actually got a working new index parsing (still needs cleanup, etc.). Also some of the fast paths are not yet put back. For most pure integer indices it got a bit slower, if it actually gets too much one

Re: [Numpy-discussion] numpy scalars and savez -- bug?

2013-04-19 Thread Sebastian Berg
On Fri, 2013-04-19 at 08:03 -0700, Chris Barker - NOAA Federal wrote: On Apr 18, 2013, at 11:33 PM, Nathaniel Smith n...@pobox.com wrote: On 18 Apr 2013 01:29, Chris Barker - NOAA Federal chris.bar...@noaa.gov wrote: This has been annoying, particular as rank-zero scalars are kind

Re: [Numpy-discussion] numpy scalars and savez -- bug?

2013-04-19 Thread Sebastian Berg
On Fri, 2013-04-19 at 23:02 +0530, Robert Kern wrote: On Fri, Apr 19, 2013 at 9:40 PM, Sebastian Berg sebast...@sipsolutions.net wrote: Fun fact, array[()] will convert a 0-d array to a scalar, but do nothing (or currently create a view) for other arrays. Which is actually a good

[Numpy-discussion] KeepDims flag?

2013-04-21 Thread Sebastian Berg
Hi, just something that has been spooking around in my mind. Considering that matrix indexing does not really support fancy indexing, I was wondering about introducing a KeepDims flag. Maybe it is not worth it, at least not unless other subclasses could make use of it, too. And a big reason for

Re: [Numpy-discussion] MapIter api

2013-04-23 Thread Sebastian Berg
that you don't remove the part that we use for the next 1.8 release. thanks Frédéric On Tue, Apr 16, 2013 at 9:54 AM, Nathaniel Smith n...@pobox.com wrote: On Mon, Apr 15, 2013 at 5:29 PM, Sebastian Berg sebast...@sipsolutions.net wrote: Hey

Re: [Numpy-discussion] Vectorized percentile function in Numpy (PR #2970)

2013-04-23 Thread Sebastian Berg
moved to enhancing the Numpy version with Pull Request 2970 [3]. With some input from Sebastian Berg the percentile function was rewritten with further vectorization, but neither of us felt fully comfortable with the final product. Can someone look at implementation in the PR and suggest

Re: [Numpy-discussion] Vectorized percentile function in Numpy (PR #2970)

2013-04-24 Thread Sebastian Berg
On Tue, 2013-04-23 at 23:33 -0400, josef.p...@gmail.com wrote: On Tue, Apr 23, 2013 at 6:16 PM, Sebastian Berg sebast...@sipsolutions.net wrote: On Tue, 2013-04-23 at 12:13 -0500, Jonathan Helmus wrote: Back in December it was pointed out on the scipy-user list[1] that numpy has

Re: [Numpy-discussion] 1.8 release

2013-04-25 Thread Sebastian Berg
On Thu, 2013-04-25 at 09:16 -0600, Charles R Harris wrote: Hi All, I think it is time to start the runup to the 1.8 release. I don't know of any outstanding blockers but if anyone has a PR/issue that they feel needs to be in the next Numpy release now is the time to make it known. Sounds

Re: [Numpy-discussion] Proposal of new function: iteraxis()

2013-04-25 Thread Sebastian Berg
On Thu, 2013-04-25 at 14:04 -0600, Charles R Harris wrote: On Thu, Apr 25, 2013 at 1:51 PM, josef.p...@gmail.com wrote: On Thu, Apr 25, 2013 at 3:40 PM, Robert Kern robert.k...@gmail.com wrote: On Thu, Apr 25, 2013 at 8:21 PM, Andrew Giessel

Re: [Numpy-discussion] int to binary

2013-04-29 Thread Sebastian Berg
On Mon, 2013-04-29 at 11:15 -0400, josef.p...@gmail.com wrote: Is there a available function to convert an int to binary representation as sequence of 0 and 1? Maybe unpackbits/packbits? It only supports the uint8 type, but you can view anything as that (being aware of endianess where

Re: [Numpy-discussion] could anyone check on a 32bit system?

2013-05-01 Thread Sebastian Berg
On Tue, 2013-04-30 at 22:20 -0700, Matthew Brett wrote: Hi, On Tue, Apr 30, 2013 at 9:16 PM, Matthew Brett matthew.br...@gmail.com wrote: Hi, On Tue, Apr 30, 2013 at 8:08 PM, Yaroslav Halchenko li...@onerussian.com wrote: could anyone on 32bit system with fresh numpy (1.7.1) test

Re: [Numpy-discussion] could anyone check on a 32bit system?

2013-05-01 Thread Sebastian Berg
On Wed, 2013-05-01 at 15:29 -0400, Yaroslav Halchenko wrote: just for completeness... I haven't yet double checked if I have done it correctly but here is the bisected commit: aed9925a9d5fe9a407d0ca2c65cb577116c4d0f1 is the first bad commit commit aed9925a9d5fe9a407d0ca2c65cb577116c4d0f1

Re: [Numpy-discussion] could anyone check on a 32bit system?

2013-05-01 Thread Sebastian Berg
On Wed, 2013-05-01 at 16:37 -0400, Yaroslav Halchenko wrote: On Wed, 01 May 2013, Sebastian Berg wrote: There really is no point discussing here, this has to do with numpy doing iteration order optimization, and you actually *want* this. Lets for a second assume that the old behavior

  1   2   3   4   5   >