Beautiful! That should do the trick. Now let's see how this performs against
the
list comprehension...
Thanks a lot!
Raik
Rick White wrote:
> Here's a technique that works:
>
> Python 2.4.2 (#5, Nov 21 2005, 23:08:11)
> [GCC 4.0.0 20041026 (Apple Computer, Inc. build 4061)] on darwin
> Type "h
Here's a technique that works:
Python 2.4.2 (#5, Nov 21 2005, 23:08:11)
[GCC 4.0.0 20041026 (Apple Computer, Inc. build 4061)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> a = np.array([0,4,0,11])
>>> b = np.array([-1,11,4,15])
>>>
On Jan 30, 2009, at 1:53 PM, Raik Gruenberg wrote:
> Pierre GM wrote:
>> On Jan 30, 2009, at 1:11 PM, Raik Gruenberg wrote:
>>
>>> Mhm, I got this far. But how do I get from here to a single index
>>> array
>>>
>>> [ 4, 5, 6, ... 10, 0, 1, 2, 3, 11, 12, 13, 14 ] ?
>>
>> np.concatenate([np.arange(
Pierre GM wrote:
> On Jan 30, 2009, at 1:11 PM, Raik Gruenberg wrote:
>
>> Mhm, I got this far. But how do I get from here to a single index
>> array
>>
>> [ 4, 5, 6, ... 10, 0, 1, 2, 3, 11, 12, 13, 14 ] ?
>
> np.concatenate([np.arange(aa,bb) for (aa,bb) in zip(a,b)])
exactly! Now, the questio
On Jan 30, 2009, at 1:11 PM, Raik Gruenberg wrote:
>
> Mhm, I got this far. But how do I get from here to a single index
> array
>
> [ 4, 5, 6, ... 10, 0, 1, 2, 3, 11, 12, 13, 14 ] ?
np.concatenate([np.arange(aa,bb) for (aa,bb) in zip(a,b)])
___
Nump
Raik Gruenberg wrote:
Jim Vickroy wrote:
Raik Gruenberg wrote:
Hi there,
perhaps someone has a bright idea for this one:
I want to concatenate ranges of numbers into a single array (for indexing). So I
have generated an array "a" with starting positions, for example:
a = [4, 0, 11]
Jim Vickroy wrote:
> Raik Gruenberg wrote:
>> Hi there,
>>
>> perhaps someone has a bright idea for this one:
>>
>> I want to concatenate ranges of numbers into a single array (for indexing).
>> So I
>> have generated an array "a" with starting positions, for example:
>>
>> a = [4, 0, 11]
>>
>> I
Raik Gruenberg wrote:
> Hi there,
>
> perhaps someone has a bright idea for this one:
>
> I want to concatenate ranges of numbers into a single array (for indexing).
> So I
> have generated an array "a" with starting positions, for example:
>
> a = [4, 0, 11]
>
> I have an array b with stop positi
Hi there,
perhaps someone has a bright idea for this one:
I want to concatenate ranges of numbers into a single array (for indexing). So I
have generated an array "a" with starting positions, for example:
a = [4, 0, 11]
I have an array b with stop positions:
b = [11, 4, 15]
and I would like t