[Numpy-discussion] fancy view question

josef.pktd@gmai... josef.pktd@gmai...
Tue Feb 17 09:08:56 CST 2009


On Tue, Feb 17, 2009 at 10:01 AM, Gael Varoquaux
<gael.varoquaux@normalesup.org> wrote:
> On Tue, Feb 17, 2009 at 04:58:57PM +0200, Stéfan van der Walt wrote:
>> 2009/2/17 Gael Varoquaux <gael.varoquaux@normalesup.org>:
>> > That's handy, you should commit this somewhere. Actually, it would be
>> > even cooler if you could have different zoom factor in different
>> > direction :).
>
>> Something like this:
>
>> a = np.array([[1, 2, 3],
>>               [4, 5, 6]])
>> print a
>> print zoom(a, x=2, y=3)
>
> Exactly, but with a signature that accepts a integer, or a tuple of
> integers. And commiting this in eg stride_tricks.
>
> Gaël

I think rows and columns are in wrong sequence (axis=0, axis=1) ?

>>> zoom(a, 2,3)
array([[1, 1, 2, 2, 3, 3],
       [1, 1, 2, 2, 3, 3],
       [1, 1, 2, 2, 3, 3],
       [4, 4, 5, 5, 6, 6],
       [4, 4, 5, 5, 6, 6],
       [4, 4, 5, 5, 6, 6]])

>>> zoom(a, 3,2)
array([[1, 1, 1, 2, 2, 2, 3, 3, 3],
       [1, 1, 1, 2, 2, 2, 3, 3, 3],
       [4, 4, 4, 5, 5, 5, 6, 6, 6],
       [4, 4, 4, 5, 5, 5, 6, 6, 6]])

Josef


More information about the Numpy-discussion mailing list