Re: [Numpy-discussion] Invalid value encoutered : how to, prevent numpy.where to do this?

2013-01-05 Thread Eric Emsellem
Thanks! This makes sense of course. And yes the operation I am trying to do is rather complicated so I need to rely on a prior selection. Now I would need to optimise this for large arrays and the code does go through these command line many many times. When I have to operate on the two differ

Re: [Numpy-discussion] Invalid value encoutered : how to, prevent numpy.where to do this?

2013-01-05 Thread Eric Emsellem
Thanks! This makes sense of course. And yes the operation I am trying to do is rather complicated so I need to rely on a prior selection. Now I would need to optimise this for large arrays and the code does go through these command line many many times. When I have to operate on the two differ

Re: [Numpy-discussion] Invalid value encoutered : how to, prevent numpy.where to do this?

2013-01-05 Thread Eric Emsellem
Thanks! This makes sense of course. And yes the operation I am trying to do is rather complicated so I need to rely on a prior selection. Now I would need to optimise this for large arrays and the code does go through these command line many many times. When I have to operate on the two differ

[Numpy-discussion] Invalid value encoutered : how to prevent numpy.where to do this?

2013-01-05 Thread Eric Emsellem
Dear all, I have a code using lots of "numpy.where" to make some constrained calculations as in: data = arange(10) result = np.where(data == 0, 0., 1./data) # or data1 = arange(10) data2 = arange(10)+1.0 result = np.where(data1 > data2, np.sqrt(data1-data2), np.sqrt(data2-data2)) which then pr

Re: [Numpy-discussion] Efficient way of binning points and, applying functions to these groups

2012-12-26 Thread Eric Emsellem
Thanks Ralf! this module looks great in fact. I didn't know it existed, and in fact It is only available in Scipy 0.11.0 (had to install from source since an Ubuntu 12.04 bin is not available). Too bad that the User-defined function only accepts one single array. If that function should take m

[Numpy-discussion] Efficient way of binning points and applying functions to these groups

2012-12-26 Thread Eric Emsellem
Hi! I am looking for an efficient way of doing some simple binning of points and then applying some functions to points within each bin. I have tried several ways, including crude looping over the indices, or using digitize (see below) but I cannot manage to get it as efficient as I need it to

[Numpy-discussion] Test if one element of string array is in a defined list

2010-03-22 Thread Eric Emsellem
Hi I would like to test whether strings in a numpy S array are in a given list but I don't manage to do so. Any hint is welcome. === # So here is an example of what I would like to do # I have a String numpy array: import numpy as num Sarray =

Re: [Numpy-discussion] Complex slicing and take

2009-12-30 Thread Eric Emsellem
Thanks! will try that and see how the performance varies depending on the size of my arrays. thanks again! Eric > Constructing big intermediate arrays, might not improve performance > compared to a loop > >>> np.arange(30).reshape(6,5) > array([[ 0, 1, 2, 3, 4], >[ 5, 6, 7, 8

Re: [Numpy-discussion] Complex slicing and take

2009-12-30 Thread Eric Emsellem
Hi thanks for the tips. Unfortunately this is not what I am after. >> > ? import numpy as num >> > ? startarray = random((1000,100)) >> > ? take_sample = [1,2,5,6,1,2] >> > ? temp = num.take(startarray,take_sample,axis=1) > Would it help to make temp a 1000x4 array instead of 1000x6? Could you >

[Numpy-discussion] Complex slicing and take

2009-12-29 Thread Eric Emsellem
Hi (sorry if you receive this twice, but I did not see the first post appear) I have a nagging problem which I think could be solved nicely with numpy indexing but I cannot find the solution, except by invoking a stupid loop. I would like to do this with some numpy item. Problem I have a

[Numpy-discussion] /usr/bin/python: double free or corruption

2008-04-17 Thread Eric Emsellem
Hi, I just installed a new openSuse 10.3, python, numpy, etc, on a 32 bit PC (using the rpm provide on the science Suse repository) When using numpy.fromfile, I get a glibc error when it tries to read something which is not there (end of the file). So for example with a file "tmp" which has nothi

[Numpy-discussion] simple problem with arange / roundoff

2007-07-31 Thread Eric Emsellem
Hi, I discovered a bug in one of my program probably due to a round-off problem in a "arange" statement. I use something like: step = (end - start) / (npix - 1.) gridX = num.arange(start-step/2., end+step/2., step) where I wish to get a simple 1D array with npix+1 numbers going from (start-step/

[Numpy-discussion] problem with installation of numpy: undefined symbols

2007-02-01 Thread Eric Emsellem
Hi, after trying to solve an installation problem with scipy, I had to reinstall everything from scratch, and so I now turned back to numpy the installation of which does not work for me (which may in fact explain the pb I had with scipy). To be clear on what I do: - I install blas first, and cr

Re: [Numpy-discussion] extracting values from an array

2006-12-28 Thread Eric Emsellem
gt; x=N.arange(0.,1.,0.1); > xs=sort(array([0.1, 0.55])); > sort(x[(x >= xs[0] )&(x<=xs[1])]) > > returns: [ 0.1, 0.2, 0.3, 0.4, 0.5,] -- Eric Emsellem [EMAIL PROTECTED]

Re: [Numpy-discussion] extracting values from an array

2006-12-28 Thread Eric Emsellem
, increasing)... if you have a hint on how to do this without TESTING how x is ordered (dec, inc) and which of x1 or x2 is larger... thanks Eric Greg Willden wrote: Hi Eric, Here are ways of doing this. starting with import numpy as N On 12/28/06, Eric Emsellem < [EMAIL PROTECTED]>

[Numpy-discussion] extracting values from an array

2006-12-28 Thread Eric Emsellem
Hi, I have a simple problem of extracting a subarray from a bigger one, for which I don't find an elegant/easy solution. I tried using searchsorted, or other tricks but I always end up with many "if" statements, testing all cases (also because searchsorted does not work on arrays which are sorted

Re: [Numpy-discussion] mysql -> record array

2006-11-19 Thread Eric Emsellem
Hi Travis, sorry to bother you with that, but who's responsible with the numpy list? I am receiving ALL numpy-list emails directly now (although I always opted for the bundle option and checked that it is still on). I sent a mail about this, but no answer so far. Anything wrong with the list? Som

Re: [Numpy-discussion] mysql -> record array

2006-11-17 Thread Eric Emsellem
Hi, I am getting all the individual emails from the numpy discussion (and not the bundles), directly from their authors: something is wrong with the new list I think. cheers Eric ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://project