On 07/22/2010 06:47 AM, Robin Kraft wrote:
Hello all,
The short version: For a given NxN array, is there an efficient way to use a
moving window to collect a summary statistic on a chunk of the array, and
insert it into another array?
Hi Robin,
been wrestling with similar stuff myself,
Thu, 22 Jul 2010 00:47:20 -0400, Robin Kraft wrote:
[clip]
Let's say the image looks like this: np.random.randint(0,2,
16).reshape(4,4)
array([[0, 0, 0, 1],
[0, 0, 1, 1],
[1, 1, 0, 0],
[0, 0, 0, 0]])
I want to use a square, non-overlapping moving window for
Pauli Virtanen wrote:
Thu, 22 Jul 2010 00:47:20 -0400, Robin Kraft wrote:
[clip]
Let's say the image looks like this: np.random.randint(0,2,
16).reshape(4,4)
array([[0, 0, 0, 1],
[0, 0, 1, 1],
[1, 1, 0, 0],
[0, 0, 0, 0]])
I want to use a square, non-overlapping
On Thu, Jul 22, 2010 at 7:48 AM, Warren Weckesser
warren.weckes...@enthought.com wrote:
Actually, because of the use of reshape(3,3,4), your second
example does make a copy.
When does reshape return a view and when does it return a copy?
Here's a simple example that returns a view:
x =
Vincent, Pauli,
From: Vincent Schut sc...@sarvision.nl
- an other option would be some smart reshaping, which finally gives you
a [y//2, x//2, 2, 2] array, which you could then reduce to calculate
stats (mean, std, etc) on the last two axes. I *think* you'd have to
first reshape both x
Keith Goodman wrote:
On Thu, Jul 22, 2010 at 7:48 AM, Warren Weckesser
warren.weckes...@enthought.com wrote:
Actually, because of the use of reshape(3,3,4), your second
example does make a copy.
When does reshape return a view and when does it return a copy?
According to the
On Thu, Jul 22, 2010 at 10:35 AM, Warren Weckesser
warren.weckes...@enthought.com wrote:
Keith Goodman wrote:
On Thu, Jul 22, 2010 at 7:48 AM, Warren Weckesser
warren.weckes...@enthought.com wrote:
Actually, because of the use of reshape(3,3,4), your second
example does make a copy.
When
Hello all,
The short version: For a given NxN array, is there an efficient way to use a
moving window to collect a summary statistic on a chunk of the array, and
insert it into another array?
The long version: I am trying to resample an image loaded with GDAL into an NxN
array. Note that this