Re: [Numpy-discussion] Naming a slice index?

2007-10-02 Thread Michael Hoffman
Eagle Jones wrote:
> New to python and numpy; hopefully I'm missing something obvious. I'd
> like to be able to slice an array with a name. For example:
> 
> _T = 6:10
> _R = 10:15

from numpy import index_exp

_T = index_exp[6:10]
_R = index_exp[10:15]

> A = identity(20)
> foo = A[_T, _R]

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Naming a slice index?

2007-10-01 Thread Robert Cimrman
Eagle Jones wrote:
> New to python and numpy; hopefully I'm missing something obvious. I'd
> like to be able to slice an array with a name. For example:
> 
> _T = 6:10

_T = slice( 6, 10 )

...

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Naming a slice index?

2007-10-01 Thread Timothy Hochberg
On 10/1/07, Eagle Jones <[EMAIL PROTECTED]> wrote:
>
> New to python and numpy; hopefully I'm missing something obvious. I'd
> like to be able to slice an array with a name. For example:
>
> _T = 6:10
> _R = 10:15
> A = identity(20)
> foo = A[_T, _R]
>
> This doesn't work. Nor does _T=range(6:10); _R = range(10:15). Any ideas?


Try slice(10,15)


Thanks,
> Eagle
> ___
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>



-- 
.  __
.   |-\
.
.  [EMAIL PROTECTED]
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Naming a slice index?

2007-10-01 Thread Eagle Jones
New to python and numpy; hopefully I'm missing something obvious. I'd
like to be able to slice an array with a name. For example:

_T = 6:10
_R = 10:15
A = identity(20)
foo = A[_T, _R]

This doesn't work. Nor does _T=range(6:10); _R = range(10:15). Any ideas?

Thanks,
Eagle
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion