numpy arange with multiple intervals
- by Heiko Westermann
Hi,
i have an numpy array which represents multiple x-intervals of a function:
In [137]: x_foo
Out[137]:
array([211, 212, 213, 214, 215, 216, 217, 218, 940, 941, 942, 943, 944,
945, 946, 947, 948, 949, 950])
as you can see, in x_foo are two intervals: one from 211 to 218, and one from 940 to 950. these are intervals, which i want to interpolate with scipy. for this, i need to adjust the spacing, e.g "211.0 211.1 211.2 ..." which you would normaly do with:
arange( x_foo[0], x_foo[-1], 0.1 )
in the case of multiple intervals, this is not possible. so heres my question: is there a numpy-thonic way to do this in array-style? or do i need to write a function which loops over the whole array and split if the difference is 1?
thanks!