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 =
Hello,
I am trying to learn how to create ufuncs, and I got a ufunc to compile
correctly with the signature int - double, but I can't get it to accept any
arguments. My function is testfunc and I used NPY_INT as the first signature
and NPY_DOUBLE as the second signature. What should I look at to
Thu, 22 Jul 2010 08:49:09 -0700, John Salvatier wrote:
I am trying to learn how to create ufuncs, and I got a ufunc to compile
correctly with the signature int - double, but I can't get it to accept
any arguments. My function is testfunc and I used NPY_INT as the first
signature and NPY_DOUBLE
Oh, ok. That makes sense. Thanks for the speedy help.
John
On Thu, Jul 22, 2010 at 9:14 AM, Pauli Virtanen p...@iki.fi wrote:
Thu, 22 Jul 2010 08:49:09 -0700, John Salvatier wrote:
I am trying to learn how to create ufuncs, and I got a ufunc to compile
correctly with the signature int -
This did end up solving my problem. Thanks!
On Thu, Jul 22, 2010 at 9:25 AM, John Salvatier
jsalv...@u.washington.eduwrote:
Oh, ok. That makes sense. Thanks for the speedy help.
John
On Thu, Jul 22, 2010 at 9:14 AM, Pauli Virtanen p...@iki.fi wrote:
Thu, 22 Jul 2010 08:49:09 -0700, John
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
I'm trying to understand numpy.subtract.reduce. The documentation
doesn't seem to match the behavior. The documentation claims
For a one-dimensional array, reduce produces results equivalent to:
r = op.identity
for i in xrange(len(A)):
r = op(r,A[i])
return r
However,
I get the same result on 1.4.1
On Thu, Jul 22, 2010 at 1:00 PM, Johann Hibschman
jhibschman+nu...@gmail.com jhibschman%2bnu...@gmail.com wrote:
I'm trying to understand numpy.subtract.reduce. The documentation
doesn't seem to match the behavior. The documentation claims
For a
John Salvatier wrote:
I get the same result on 1.4.1
On Thu, Jul 22, 2010 at 1:00 PM, Johann Hibschman
jhibschman+nu...@gmail.com mailto:jhibschman%2bnu...@gmail.com wrote:
I'm trying to understand numpy.subtract.reduce. The documentation
doesn't seem to match the behavior. The
Thu, 22 Jul 2010 15:00:50 -0500, Johann Hibschman wrote:
[clip]
Now, I'm on an older version (1.3.0), which might be the problem, but
which is correct here, the code or the docs?
The documentation is incorrect.
--
Pauli Virtanen
___
Hi,
any idea why the simple code below is so slow ?
import numpy as n
from time import time as t
dims = (640,480)
m = n.random.random( dims )
l=[]
for i in range(200):
l.append(m)
t0=t()
b=n.array(l)
print t()-t0
To convert the list into an array takes about 5 sec ...
Thanks,
On Thu, Jul 22, 2010 at 2:09 PM, marco cammarata marcoca...@gmail.comwrote:
To convert the list into an array takes about 5 sec ...
Not too familiar with typical speeds, but at a guess, perhaps because it
must convert 61.4 million (640*480*200) values? Just to *count* that high
with xrange
Pauli Virtanen p...@iki.fi writes:
The documentation is incorrect.
Thanks. The observed behavior is more like:
if len(A) == 0:
return op.identity
else:
r = A[0]
for i in xrange(1, len(A):
r = op(r, A[i])
return r
-Johann
On Thu, Jul 22, 2010 at 5:09 PM, marco cammarata marcoca...@gmail.com wrote:
Hi,
any idea why the simple code below is so slow ?
import numpy as n
from time import time as t
dims = (640,480)
m = n.random.random( dims )
l=[]
for i in range(200):
l.append(m)
t0=t()
What is the easiest way to give a custom ufunc an axis argument? I have
looked around the UFunc API, but I have not seen anything related to this.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
I should add that it is for ufuncs with number of arguments larger than 2.
On Thu, Jul 22, 2010 at 2:47 PM, John Salvatier
jsalv...@u.washington.eduwrote:
What is the easiest way to give a custom ufunc an axis argument? I have
looked around the UFunc API, but I have not seen anything related
2010/7/20 Vincent Schut sc...@sarvision.nl:
slope_bin_edges = [0, 3, 15, 35]
landuse_bin_edges = [0, 1, 2, 3]
crosstab = numpy.histogram2d(landuse, slope, bins=(landuse_bin_edges,
slope_bin_edges))
I like it! I guess the actual bins are [0, 3), [3, 15) and [15, 35)?
From the docs, that is
Hi,
So, I'm working on a radiosity renderer, and it's basically finished. I'm
now trying to optimize it. Currently, by far the most computationally
expensive operation is visibility testing, where pixels are counted by the
type of patch that was drawn on them. Here's my current code, which I'm
Hi again,
I've condensed the problem down a lot, because I both presented it in an
overcomplicated way, and did not explain it particularly well.
Condensed problem:
a = np.zeros(num_patches)
b = np.array(...) #created, and is size 512^512 = 262,144
#Each value in b is an index into a.
#For each
On Thu, Jul 22, 2010 at 9:59 PM, Ian Mallett geometr...@gmail.com wrote:
Hi again,
I've condensed the problem down a lot, because I both presented it in an
overcomplicated way, and did not explain it particularly well.
Condensed problem:
a = np.zeros(num_patches)
b = np.array(...)
On Thu, Jul 22, 2010 at 10:05 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
Is that what you want, or do you just want to know how many unique indices
there are? As to encoding the RGB, unless there is a existing program your
best bet is probably to use a dot product, i.e., if
26 matches
Mail list logo