[SciPy-dev] slicing vs. advanced selection -- can be there smth in the middle? ; -)

Yaroslav Halchenko lists@onerussian....
Mon Jan 14 19:58:12 CST 2008

Hi Anne,

First of all -- thank you for your feedback on this question! 

> If you're willing to be a little awkward, you can also make lists:
Sure thing we could do some awkwarding with lists to stay with
views instead of copying, but I guess (since I've not tried yet) most of
our processing might break terribly since in many places we rely at
least on few methods/properties of ndarrays (e.g. shape).

> If I understand you correctly, your selections tend to be
> "all-but-one" selections, though maybe in both dimensions. In this
> case, you can get arrays that are two contiguous parts:
> v = (a[:n],a[n+1:])
not really all-but-one, but often it is all-but-one-block, ie may be
smth like v=(a[:n],a[n+b:]) where b is the size of that block.

Unfortunately it would have the same consequences as above... but if I
become desperate I indeed might look in one of this methods (first one
with lists seems to be of preference since it seems to be more generic).

> Alternatively, if your need is simply to keep the selections around
> for later analysis, remember that selection is a fast process, so you
> can keep only the selection indices:
> b = a[l1, l2]
> analyze(b)
> keep((l1,l2))
hm... or out of desparation we might simply rely on another level on top
of numpy's arrays which would provide us this 'logical array manager'
(logical is just after LVM's first word). We will see...

Thanks once again

Yaroslav Halchenko
Research Assistant, Psychology Department, Rutgers-Newark
Student  Ph.D. @ CS Dept. NJIT
Office: (973) 353-5440x263 | FWD: 82823 | Fax: (973) 353-1171
        101 Warren Str, Smith Hall, Rm 4-105, Newark NJ 07102
WWW:     http://www.linkedin.com/in/yarik        

More information about the Scipy-dev mailing list