[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

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

2013-01-05 Thread Nathaniel Smith
On Sat, Jan 5, 2013 at 2:15 PM, Eric Emsellem eric.emsel...@eso.org wrote: 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 =

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

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

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

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

2013-01-05 Thread Nathaniel Smith
On Sat, Jan 5, 2013 at 10:07 PM, Eric Emsellem eric.emsel...@eso.org wrote: 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