Re: [Numpy-discussion] indexing, searchsorting, ...

2010-01-26 Thread Jan Strube
Hi Neil, sure...I aeh, knew this...of course...[?] I'm using shuffle with a list of indices now... Thanks, Jan <<330.gif>>___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] indexing, searchsorting, ...

2010-01-26 Thread Jan Strube
Dear Josef and Keith, thank you both for your suggestions. I think intersect would be what I want for it makes clean code. I have, however, spotted the problem: I was mistakenly under the assumption that random_integers returns unique entries, which is of course not guaranteed, so that the random

[Numpy-discussion] indexing, searchsorting, ...

2010-01-25 Thread Jan Strube
Dear List, I'm trying to speed up a piece of code that selects a subsample based on some criteria: Setup: I have two samples, raw and cut. Cut is a pure subset of raw, all elements in cut are also in raw, and cut is derived from raw by applying some cuts. Now I would like to select a random subs

Re: [Numpy-discussion] numpy : your experiences?

2007-11-21 Thread Jan Strube
> >> a) Can you guys tell me briefly about the kind of problems you are >> tackling with numpy and scipy? > > I'm using python with numpy,scipy, pytables and matplotlib for data > analysis in the field of high energy particle physics. Most of the > work is histograming millions of events, fitting

Re: [Numpy-discussion] dtype confusion

2007-03-26 Thread Jan Strube
I'm afraid I'm not quite done with this, yet. There's still more I am confused about, even after reading the manual (again). There is something fundamentally weird about record arrays, that doesn't seem to click with me. Please have a look at this piece of code: import numpy as N newtype = N.dtyp

Re: [Numpy-discussion] dtype confusion

2007-03-25 Thread Jan Strube
Thanks Stefan and Travis for their explanations. First a request: Could both explanations be added to the manual, please? Thanks. So the problem I was having was that I thought this difference in behavior would be caused by two different types: recarray and ndarray. I feel that there is still som

[Numpy-discussion] dtype confusion

2007-03-25 Thread Jan Strube
There seems to be a fundamental lack of understanding on my behalf when it comes to dtypes and record arrays. Please consider the following snippet: import numpy as N newtype = N.dtype([('x', N.float64), ('y', N.float64), ('z', N.float64)]) a = N.random.random((100,3)) a.dtype=newtype b = N.colum

[Numpy-discussion] array multiplication with different dtypes

2007-03-25 Thread Jan Strube
I'm having a difficult time understanding the following behavior: import numpy as N # create a new array 4 rows, 3 columns x = N.random.random((4, 3)) # elementwise multiplication x*x newtype = N.dtype([('x', N.float64), ('y', N.float64), ('z', N.float64)]) # interpret the array as an array of

[Numpy-discussion] assignment to array.dtype

2007-03-22 Thread Jan Strube
Hi list, maybe this is a really stupid idea, and I don't want to advertise this, but what actually happens when I reassign the dtype of an object? Does it return the same as array.view? say I have the following code In [64]: b Out[64]: array([[ 0, 1, 2], [ 3, 4, 5], [ 6, 7, 8],

Re: [Numpy-discussion] setmember1d memory leak?

2007-01-25 Thread Jan Strube
> For instance > > In [7]: def countmembers(a1, a2) : > ...: a = sort(a2) > ...: il = a.searchsorted(a1, side='l') > ...: ir = a.searchsorted(a1, side='r') > ...: return ir - il > ...: > > In [8]: a2 = random.randint(0,10,(100,)) > > In [9]: a1 = arange(11) > > In [11]:

Re: [Numpy-discussion] setmember1d memory leak?

2007-01-22 Thread Jan Strube
I would also like to see a method that doesn't have the unique members requirement. If setmember1d cannot be modified to do that, is there another method that doesn't have these restrictions. Or could one be added? Thanks, Jan ___ Numpy-discussion mai