looks ok, except that I don't want to sort out the output but keep the
right order depending on x0 and x1, so I have then to add the order I
wish for the output array, maybe with something like:
## init
x0 = -0.55
x1 = -0.1
min,max,step = 0., -1., -0.1
x=num.arange(min,max,step);
## getting the r
Hi Eric,
Well I think that you have the parts that you need.
Perhaps something like is what you want. Put x1 and x2 into an array and
sort it then access it from the sorted array.
x=N.arange(0.,-1.,-0.1);
xs=sort(array([-0.1, -0.55]));
sort(x[(x >= xs[0] )&(x<=xs[1])])
returns: [-0.5,-0.4,-0.3
Hi,
thanks for the answer, but I guess my request was not clear.
What I want is something which works in ALL cases so that
function(x, x1, x2) provides the output I mentioned... What you propose
(as far as I can see) depends on the values of x1, x2, their order and
the order of x (decreasing,
Hi Eric,
Here are ways of doing this.
starting with
import numpy as N
On 12/28/06, Eric Emsellem <[EMAIL PROTECTED]> wrote:
### Increasing order in x, and x1 <= x2 :
x = arange(0.,1.,0.1)
x1 = 0.1
x2 = 0.55
### the output I would like is simply: array([ 0.1, 0.2, 0.3, 0.4,
0.5])
How about th
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