Re: [Numpy-discussion] arr.dtype.byteorder == '=' --- is this "good code"

2007-07-03 Thread Sebastian Haase
Thanks for the reply. Rethinking the question ... wasn't there an attribute named something like: is_native() ?? The a.dtype.str[0] is certainly better than nothing ... just doesn't look very good ;-) -Sebastian On 7/3/07, Francesc Altet <[EMAIL PROTECTED]> wrote: > El d

Re: [Numpy-discussion] Should bool_ subclass int?

2007-07-10 Thread Sebastian Haase
lready lost ... I don't think this can be done in a consistent way. In other words: a "+" operator would also need a corresponding "-" operator, and that will just look funny. I think if you want algebra, you should restrict yourself to "|" (or) and "&" (and) My two cents, Sebastian ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] numpy.where

2007-07-14 Thread Sebastian Haase
argument "dtype" in numpy.where()? Otherwise I would have to always write code like this: a = N.where( arr>x, 1.0, 0.0) a = a.astype(N.float32) I use N.__version__ == '1.0.1' Thanks, Sebastian Haase ___ Numpy-discussion mailin

Re: [Numpy-discussion] numpy.where

2007-07-15 Thread Sebastian Haase
On 7/14/07, Robert Kern <[EMAIL PROTECTED]> wrote: > Sebastian Haase wrote: > > Hi. > > Two things. > > 1) The doc-string of numpy.where() states that transpose(where(cond, > > x,y)) whould always return a 2d-array. How can this be true?? It also > > says (b

[Numpy-discussion] optimization of arr**-2

2007-07-15 Thread Sebastian Haase
he pow routine. Can this be fixed for the **-2 case ? Thanks, Sebastian Haase ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] numpy.where

2007-07-15 Thread Sebastian Haase
On 7/15/07, Robert Kern <[EMAIL PROTECTED]> wrote: > Sebastian Haase wrote: > > On 7/14/07, Robert Kern <[EMAIL PROTECTED]> wrote: > >> Sebastian Haase wrote: > > >>> 2) Could we have another optional argument "dtype" in numpy.where()? >

Re: [Numpy-discussion] numpy.where

2007-07-15 Thread Sebastian Haase
On 7/15/07, Robert Kern <[EMAIL PROTECTED]> wrote: > Sebastian Haase wrote: > > On 7/14/07, Robert Kern <[EMAIL PROTECTED]> wrote: > >> Sebastian Haase wrote: > > >>> 2) Could we have another optional argument "dtype" in numpy.where()? >

Re: [Numpy-discussion] tofile speed

2007-07-23 Thread Sebastian Haase
re written this should improve the overall performance. How large are your data-chunks per write ? (IOW: what is len(temp.data)) HTH, Sebastian Haase On 7/23/07, Lars Friedrich <[EMAIL PROTECTED]> wrote: > Hello everyone, > > I am using array.tofile successfully for a

Re: [Numpy-discussion] tofile speed

2007-07-24 Thread Sebastian Haase
tData() can overlap. But 2 sec is really slow -S. On 7/24/07, Lars Friedrich <[EMAIL PROTECTED]> wrote: > Hello everyone, > > thank you for the replies. > > Sebastian, the chunk size is roughly 4*10^6 samples, with two byte per > sample, this is about 8MB. I can vary this

Re: [Numpy-discussion] tofile speed

2007-07-24 Thread Sebastian Haase
Your are not generating text files - right? On 7/24/07, Sebastian Haase <[EMAIL PROTECTED]> wrote: > So you are saying that a given tofile() call returns only after 2 seconds !? > Can you measure the getData() call time (just comment the tofile out > for a while- I that doesn

Re: [Numpy-discussion] Build external C functions that take numpy arrays as parameters and return numpy arrays

2007-07-29 Thread Sebastian Haase
Note also that there was essentially the very same question on this list just a few days ago. At the time, there were many answers and quite a discussion... Hope you can find the list archive at scipy.org. -Sebastian On 7/29/07, Matthieu Brucher <[EMAIL PROTECTED]> wrote: > Hi, > &g

Re: [Numpy-discussion] Build external C functions that take numpy arrays as parameters and return numpy arrays

2007-07-29 Thread Sebastian Haase
On 7/29/07, Robert Kern <[EMAIL PROTECTED]> wrote: > Sebastian Haase wrote: > > Note also that there was essentially the very same question on this > > list just a few days ago. At the time, there were many answers and > > quite a discussion... > > The OP is the

[Numpy-discussion] epydoc documentation of numpy package

2007-07-30 Thread Sebastian Haase
Or a link? Comments? -Sebastian Haase ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] column_stack with mixed data types

2007-07-31 Thread Sebastian Haase
rd about this yet. Where does he say this ? Just for reference Thanks, Sebastian ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] column_stack with mixed data types

2007-07-31 Thread Sebastian Haase
On 7/31/07, Robert Kern <[EMAIL PROTECTED]> wrote: > Sebastian Haase wrote: > > On 7/31/07, Robert Kern <[EMAIL PROTECTED]> wrote: > >> Ryan Krauss wrote: > >>> I just tend to think in terms of lists rather than tuples. Why is a > >>> tu

Re: [Numpy-discussion] reading 10 bit raw data into an array

2007-08-01 Thread Sebastian Haase
ust use 16 bit for each pixel. (All you had to know if it uses the left or the right part of those. In other words, you might have to divide (or use bit shifting) the data by 16.) Wasteful yes, but much simpler to handel !? -Sebastian Haase ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] rant against from numpy import * / from pylab import *

2007-08-02 Thread Sebastian Haase
ith __version__ = '0.90.0' __revision__ = '$Revision: 3003 $' __date__ = '$Date: 2007-02-06 22:24:06 -0500 (Tue, 06 Feb 2007) $' Any hint how to further reduce the number of names in "P" ? My ideal would be that the "P" module (short for pylab)

[Numpy-discussion] pyOpenGL with numpy support

2007-08-24 Thread Sebastian Haase
play medical/microscopy images on mutli-color, color-maps using 2d-textures. It works very fast. Thanks, Sebastian ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] arange and floating point arguments

2007-09-14 Thread Sebastian Haase
past time) here are the actual numbers I get in my PyShell: >>> 0.6 == (0.4+0.2) False >>> `.6` '0.59998' >>> `.4` '0.40002' >>> `.2` '0.20001' >>> `.2+.4` '0.60009'

Re: [Numpy-discussion] [SciPy-dev] adopting Python Style Guide for classes

2007-10-03 Thread Sebastian Haase
rray(), zeros(), ones(), arange(), etc.? > Just to express my worries: I hope that numpy stays "easily typable" as a numerical and interactive (!) environment. What I'm trying to say: IMHO, "arange" should stay lower case, like "range", even if it might be (internally) implemented as a class. Similarly, many functions/objects/classes have a functional "feeling" to them, even tough they be implemented as classes. My 2 cents. -Sebastian Haase ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] numpy/Windows shared arrays between processes?

2007-10-09 Thread Sebastian Haase
xplaintion look up the microsoft site for the mmap documentation. And/or the Python-doc for mmap. (( I have to mention, that I could crash a process while testing this ... )) If anyone here would know an equivalent way of doing this on Linux/OS-X we were back to a cross-platfrom function. H

Re: [Numpy-discussion] numpy/Windows shared arrays between processes?

2007-10-09 Thread Sebastian Haase
On 10/9/07, David Cournapeau <[EMAIL PROTECTED]> wrote: > Sebastian Haase wrote: > > Hi! > > I was in fact experimenting with this. The solution seemed to lie in > > "simple" memmap as it is implemented in Windows: > > > > import num

Re: [Numpy-discussion] numpy/Windows shared arrays between processes?

2007-10-09 Thread Sebastian Haase
ng > distutil modules with the new MS SDK and having them work at all with > 2.4 were very mixed. I also tried GCC and had a litany of other > errors with the posh. > > >Sebastian Haase added: > >I was in fact experimenting with this. The solution seemed to lie in > >"

Re: [Numpy-discussion] setting the attributes of an array of object

2007-10-16 Thread Sebastian Haase
at you CAN attach attributes to it. Be carefull that some (many / most ?) operations on that array will return you a normal numpy array again. I don't understand the reasons behind all of this. HTH, Sebastian Haase On 9/29/07, jelle <[EMAIL PROTECTED]> wrote: > Hi, > > I'

Re: [Numpy-discussion] vectorizing loops

2007-10-26 Thread Sebastian Haase
cently". Did you know about numexpr - David ? Cheers, Sebastian Haase ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] SWIGed function does not like my boolean array

2007-11-07 Thread Sebastian Haase
. In C a boolean is just an integer of 0 or 1 (quasi, by definition). Could you explain what you mean ? Thanks, Sebastian > > 2007/11/7, Sebastian Haase < [EMAIL PROTECTED]>: > > O.K., so sizeof(bool) is 1. > > But I already have a function instantiation for uint8. > &g

Re: [Numpy-discussion] SWIGed function does not like my boolean array

2007-11-07 Thread Sebastian Haase
ternal arithmetic of CPUs today. Also the "bit-values" of a boolean array (in memory) are set this way already anyway ! How can I simply call my functions looking at these bit values ? (essentially interpreting a boolean true as 1 and false as 0) -Sebastian ___

Re: [Numpy-discussion] SWIGed function does not like my boolean array

2007-11-07 Thread Sebastian Haase
ctly like an integer of same byte-width. How can I have numpy (or is SWIG the problem ??) use my existing integer function for a bool-type array ? (Without making a differently-typed copy of course ...) Thanks, Sebastian PS: I'm not using the C++ std library. On Nov 7, 2007 2:54 PM,

[Numpy-discussion] SWIGed function does not like my boolean array

2007-11-07 Thread Sebastian Haase
ing function for overloaded 'mmms' What should I do ? Preferably I would avoid having to add another type-instantiation into the library (it looks already quite bloated having 6+ versions of every function). Isn't bool just a synonym for int32 ? Than

Re: [Numpy-discussion] SWIGed function does not like my boolean array

2007-11-08 Thread Sebastian Haase
On Nov 7, 2007 6:46 PM, Timothy Hochberg <[EMAIL PROTECTED]> wrote: > > > > > On Nov 7, 2007 10:35 AM, Sebastian Haase <[EMAIL PROTECTED]> wrote: > > > > On Nov 7, 2007 5:23 PM, Matthieu Brucher <[EMAIL PROTECTED]> > wrote: > > > > >

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 w

Re: [Numpy-discussion] Should arr.diagonal() return a copy or a view? (1.7 compatibility issue)

2012-05-13 Thread Sebastian Haase
+1 On Sun, May 13, 2012 at 4:28 AM, Travis Oliphant wrote: > Another approach would be to introduce a method: > > a.diag(copy=False) > > and leave a.diagonal() alone.  Then, a.diagonal() could be deprecated over > 2-3 releases. > > -Travis > > > On May 12, 2012, at 8:31 AM, Ralf Gommers wrote: >

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

2012-08-09 Thread Sebastian Berg
dimension has more then size 1. Likely there is a better way to fix it, but the attached diff should do it. Regards, Sebastian On Do, 2012-08-09 at 13:06 +, Dave Hirschfeld wrote: > Dave Hirschfeld gmail.com> writes: > > > > > It seems that reshape doesn't work c

Re: [Numpy-discussion] Multidimensional neighbours

2012-08-16 Thread Sebastian Berg
ries (mode='wrap' when using correlate), if you want constant boundary conditions padding is probably simplest. Maybe someone else has some trick to avoid so much code duplication without using scipy... Regards, Sebastian On Do, 2012-08-16 at 18:46 +0100, Jose Gomez-Dans wrote: > Hi,

[Numpy-discussion] Functions for stride manipulations

2012-08-19 Thread Sebastian Berg
30) A copy is created when necessary, this basically allows to do multiple swap_axes and a reshape in a single call. I hope this might be useful... Regards, Sebastian import numpy as np def rolling_window(array, window=(0,), asteps=None, wsteps=None, axes=None, intersperse=False): "

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

2012-08-20 Thread Sebastian Berg
e with open(..., 'U'), which means that newlines might be interpreted differently (because of difference between linux/windows/mac newlines using \n, \r, etc. So the problem is that newlines are interpreted wrong for you if you open with just the defau

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

2012-08-31 Thread Sebastian Walter
ncrements y[1] v[2,0] += u[2,0] # increments y[0] v[2,1] += u[2,1] # increments y[1] yielding the result y = [6,12] but instead one obtains y = [4, 6] which could be the result of v[2,0] += u[2,0] # increments y[0] v[2,1] += u[2,1] # increments y[1] Is this the intended behavior? regards, Se

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

2012-09-05 Thread Sebastian Berg
], [5998, 6000]]) On Thu, 2012-09-06 at 01:55 +0200, Friedrich Romstedt wrote: > Poor Sebastian, you make the mistake of asking difficult questions. > > I noticed that it should be [6, 10] not [6, 12], and in fact is with > numpy-1.4.1; while I observe the [4, 6] result with

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 > > wrote: > > > > On 7 Sep 2012 14:38, "Benjamin Root" > > wrote: > > > > >

[Numpy-discussion] np.delete fix

2012-09-20 Thread Sebastian Berg
matter to deletion), however I consider that a feature. And a small example how badly its wrong with slices: In [1]: arr = np.arange(4) In [2]: set(arr) - set(arr[1::-1]) Out[2]: set([2, 3]) In [3]: np.delete(arr, np.s_[1::-1]) Out[3]: array([3, 3]) Regards, Sebastian

Re: [Numpy-discussion] ZeroRank memmap behavior?

2012-09-21 Thread Sebastian Berg
ype (which is not generally wanted for memmaps). May make a PR for this... Regards, Sebastian On Fri, 2012-09-21 at 14:59 +0200, Wim Bakker wrote: > I'm deeply puzzled by the recently changed behavior of zero-rank > memmaps. I think this change happened from version 1.6.0 to 1.6.1,

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

2012-09-22 Thread Sebastian Berg
Any comments if this is the right idea? And if where would more changes be needed? Regards, Sebastian ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] np.array execution path

2012-09-22 Thread Sebastian Berg
CONTIGUOUS : True OWNDATA : True WRITEABLE : True ALIGNED : True UPDATEIFCOPY : False In [74]: no = np.asarray(o, order='F') In [75]: no[:] = 11 In [76]: o # Here asarray actually returned a real copy! Out[76]: array([ 10., 10., 10.])

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

2012-09-22 Thread Sebastian Berg
Travis > > -- > Travis Oliphant > (on a mobile) > 512-826-7480 > > > On Sep 22, 2012, at 1:01 PM, Sebastian Berg > wrote: > > > Hi, > > > > I have a bit of trouble figuring this out. I would have expected > > np.asarray(array) to go thr

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

2012-09-22 Thread Sebastian Haase
Oh, is this actually documented - I knew that np.array would (by default) only create copies as need ... but I never knew it would - if all fits - even just return the original Python-object... Thanks, Sebastian Haase On Sat, Sep 22, 2012 at 8:12 PM, Travis Oliphant wrote: > Check to see

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

2012-09-23 Thread Sebastian Berg
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 ISFORTRAN should be replaced by the latter. Check also: https://github.com/seberg/numpy/commit/4d2713ce8f2107d225fe291f5da6c6a75436647e Sebastian

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 > 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 > >

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

2012-09-24 Thread Sebastian Haase
On Mon, Sep 24, 2012 at 7:09 PM, Chris Barker wrote: > On Sat, Sep 22, 2012 at 1:00 PM, Sebastian Haase wrote: >> Oh, >> is this actually documented - I knew that np.array would (by default) >> only create copies as need ... but I never knew it would - if all fits >

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

2012-10-01 Thread Sebastian Berg
endif #else # if @is_complex2@ Regards, Sebastian > > > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy

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 > wrote: > Hey, > > About the imaginary part being ignored for all/any function... > > > >

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 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 this PR merged? >

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

2012-10-17 Thread Sebastian Walter
t? Respectively, could someone point me to some documentation where the (folder/file) structure of the numpy sources is explained? Sebastian On Thu, Sep 6, 2012 at 2:58 PM, Nathaniel Smith wrote: > On Thu, Sep 6, 2012 at 1:41 AM, Sebastian Berg > wrote: >> Hey, >> >> N

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

2012-10-25 Thread Sebastian Berg
uld seem sensible that copy.copy(array) does basically the same as np.copy(array) and not as the method .copy, though ideally maybe the differences could be removed in the long run I guess. Regards, Sebastian > Given my changes, > > > https:

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, > > > 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 num

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

2012-10-29 Thread Sebastian Berg
in some corner cases on master? Regards, Sebastian > Those lines haven't changed in a couple of years, and was intended to > be done this way to raise an error when reshaping would result in a > copy (since we needed to use the original in those places). I don't > know

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

2012-10-29 Thread Sebastian Berg
6dfdc408f0a1e59ef54ac490cccbd6b8d73 > Author: Sebastian Berg > Date: Sun Oct 21 18:50:28 2012 +0200 > > > API: Change Flags Updateing to allow C-/F-contiguous arrays > > This changes UpdateFlags to ignore 1-dimensional axis when &

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) > wrote: > > Hello Everybody, > > > > I have the following problem that I would be interested in finding an > > easy/elegant solution to. > > I've got it working, but

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) > > wrote: > > > Hello Everybody, > > > > > > I have

Re: [Numpy-discussion] Scipy dot

2012-11-08 Thread Sebastian Berg
ther C- or F-Contiguous, in which case you need a copy in any case. So it would probably be more like: if (PyArray_IS_C_CONTIGUOUS(ap1)) { Trans1 = CblasNoTrans; } else if (PyArray_IS_F_CONTIGUOUS(ap1)) { Trans1 = CblasTrans; } else { Trans1 = CblasNoTrans; PyObject *new = PyArray_Co

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

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 us

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

2012-11-12 Thread Sebastian Berg
hange the current behavior very little, it would stop give an error anymore for none 1-d arrays though. Regards, Sebastian > Which remind me: it would be nice if the > docs linked to the source. > > Thanks, > Alan > ___ > Nu

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 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

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

2012-11-12 Thread Sebastian Berg
I doubt its worth special casing. If someone cares a lot about speed they probably should not use it to get single values anyway. Also for this case of random numbers, it would be a bad idea since you would use a different random number generator and a different seed! Regards, Sebastian > Alan >

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 0

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

2012-11-21 Thread Sebastian Berg
in the underlying code there > is a signed 32-bit integer being used for an index/pointer offset > (this is running on a 64-bit machine). yes, int is used for npy_intp in one occasione. I have created a PR that fixes the issue:

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

2012-11-22 Thread Sebastian Berg
reasonable result for these operations (reduce like operations that do not have an identity). Though actually reduce operations without an identity throw a ValueError (ie. `np.minimum.reduce([])`), but then mean/std/var seem special enough to be different from other reduce operations (for example their

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, 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) return an empty arr

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

2012-11-23 Thread Sebastian Berg
s. 0-d array), since all input is converted to an array normally, which means that most (all?) functions either return 0-d arrays or scalars and are never aware if the original input was a scalar or an array. Maybe there could be a np.asarray_or_scalar or such so that its easier to give the s

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

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 > wrote: > On Mon, 2012-11-26 at 13:54 -0500, Skipper Seabold wrote: > > I discovered this because scipy.optimize.fmin_powell appears > to >

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

2012-12-04 Thread Sebastian Berg
here. Regards, Sebastian ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

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

2012-12-04 Thread Sebastian Berg
ms found yet since typically if you want to use the fact that an array is contiguous, you use this kind of command to make sure it is. But I guess it is likely too dangerous to assume that nobody only checks the flags and then continuous to do unwanted assumptions about

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

2012-12-12 Thread Sebastian Berg
* Let's use it for indexing! * * Unfortunately, SciPy and possibly other code seems to rely * on the lenient coercion. :( */ #if 0 /*PY_VERSION_HEX >= 0x0205*/ PyObject *ind = PyNumber_Index(op); if (ind != NULL) { value = PyArray_PyIntAsIntp(ind); Py_

[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...

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" wrote: > >> > >> Hi, > >> > >> Following on from Nathaniel's explorations of the scalar - array > >> casting rules, some resources on rank-0 arra

[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 scal

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 > wrote: > > Question for everyone, is this really reasonable: > > > >>>> import numpy as np > >>>> from operator import index > &g

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

2013-01-08 Thread Sebastian Berg
and. > > 1.6, your proposal: in a binary operation, if one operand has ndim==0 > and the other has ndim>0, downcast the ndim==0 item to the smallest > width that is consistent with its value and the other operand's type. > Well, that leaves the maybe not quite implausible

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 t

Re: [Numpy-discussion] int and long issues

2013-01-10 Thread Sebastian Berg
never really know (there may be some nice trick for that, but not sure). And if you want to allow for rare 0d arrays as well (well they are very rare admittingly)... it gets even a bit hairier. Regards, Sebastian > gives True > > Specs: Pyt

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

Re: [Numpy-discussion] Subclassing ndarray with concatenate

2013-01-22 Thread Sebastian Berg
ay to subclass ndarray in such a way that concatenate > can be handled properly? > Quite simply, no. If you compare masked arrays, they also provide their own concatenate for this reason. I hope that helps a bit... Regards, Sebastian > I have been looking extensively online, but have n

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

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 ent

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 > wrote: > Hey, > > On Tue, 2013-01-22 at 10:21 +0100, Todd wrote: > > > > The main exception I have found is concat

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

2013-02-06 Thread Sebastian Berg
python return forcibly a bool as one would expect. So probably logical_and.reduce and all should simply not be the same thing, at least for objects. Though it is a bit weird that objects do something different from other types, so maybe it would be OK to say that numpy just differs from python here, sinc

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

2013-02-06 Thread Sebastian Berg
bit longer for 1.7rc2 or even the final release), which supports python 3.3. Note that when 1.6.2 was released python 3.3 did not exist. Regards, Sebastian > -- > -- Gereon > > [1] > # gcc46 -DNDEBUG -O2 -pipe -fno-strict-aliasing -O2 -pipe > -Wl,-rpath=/usr/local/lib/gcc46 -fn

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

2013-02-06 Thread Sebastian Berg
ctionality: In [1]: a = np.arange(10) In [2]: a[2:5].sum(), a[5:9].sum(), a[9:].sum() Out[2]: (9, 26, 9) In [3]: np.add.reduceat(a, [2, 5, 9]) Out[3]: array([ 9, 26, 9]) Regards, Sebastian > Thanks, > > Josef > ___ > NumPy

Re: [Numpy-discussion] np.percentile docstring

2013-02-17 Thread Sebastian Berg
nd such issues. There is some work right now going on for percentile, but please just do your pull request. Regards, Sebastian > > Cheers, Andreas. > ___ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.or

Re: [Numpy-discussion] Array accumulation in numpy

2013-02-19 Thread Sebastian Berg
using loops? I would have thought so but I cannot > find anything in the documentation. > You might be interested in this: https://github.com/numpy/numpy/pull/2821 But anyway, you should however be able to do what you want to do using np.bincount with the weights keyword argument. Regards,

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

2013-02-25 Thread Sebastian Berg
, but arrays are not list of lists... As a side note, since for loop, etc. use "for item in array", I do not think that vectorizing along `a` as np.in1d does is reasonable. `in` should return a single boolean. I have opened an issue for it: https://github.com/numpy/numpy/issues/3016#i

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 > wrote: > > Hello all, > > > > currently the `__contains__` method or the `in` operator on arrays, does > > not return what the user would expect when in the

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

2013-02-25 Thread Sebastian Berg
e true. I am not sure if this kind of matching should be part of the in operator or not, though 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, &quo

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 > 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 > >> np.abs(arr)

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

2013-02-26 Thread Sebastian Berg
On Mon, 2013-02-25 at 22:04 -0500, josef.p...@gmail.com wrote: > On Mon, Feb 25, 2013 at 9:58 PM, wrote: > > On Mon, Feb 25, 2013 at 9:20 PM, Sebastian Berg > > wrote: > >> On Mon, 2013-02-25 at 10:50 -0500, Skipper Seabold wrote: > >>> On Mon, Feb 2

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 > wrote: > > Hello all, > > > > currently the `__contains__` method or the `in` operator on arrays, does > > not return what the user would expect when in the

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

2013-02-26 Thread Sebastian Berg
On Tue, 2013-02-26 at 11:16 +0100, Todd wrote: > On Tue, Feb 26, 2013 at 10:58 AM, Sebastian Berg > wrote: > On Mon, 2013-02-25 at 22:04 -0500, josef.p...@gmail.com wrote: > > On Mon, Feb 25, 2013 at 9:58 PM, > wrote: > > > On M

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

2013-03-01 Thread Sebastian Berg
m.randint(0, n, p) > links['target'] = np.random.randint(0, n, p) > > targets = links['target'] # Indices can be repeated > K = np.ones(len(targets)) # Note K could be anything > > # Direct indexing > nodes['value'] = 0 > nodes['value'][targ

<    1   2   3   4   5   6   7   8   9   >