Hello,
being quite new to NumPy and having used previously PDL in Perl, I am
currently migrating one of my PDL projects into NumPy.
Most of the functions can be migrated without problems and there are
functions in NumPy that allow me to do things in much clearer way than
in PDL. However, I
On Wed, Mar 17, 2010 at 2:07 AM, Pierre GM pgmdevl...@gmail.com wrote:
All,
As you're probably aware, the current test suite for numpy.ma raises some
nagging warnings such as invalid value in These warnings are only
issued when a standard numpy ufunc (eg., np.sqrt) is called on a
josef.p...@gmail.com wrote:
On Wed, Mar 17, 2010 at 7:12 AM, Miroslav Sedivy wrote:
There are two 2D arrays with dimensions: A[1,1000] and B[1,100].
The first dimension of both arrays corresponds to a list of 1 objects.
The array A contains for each of 1 objects 1000 integer
On Wed, Mar 17, 2010 at 9:36 AM, Miroslav Sedivy
miroslav.sed...@weather-consult.com wrote:
josef.p...@gmail.com wrote:
On Wed, Mar 17, 2010 at 7:12 AM, Miroslav Sedivy wrote:
There are two 2D arrays with dimensions: A[1,1000] and B[1,100].
The first dimension of both arrays
Is the zero-fill intentional?
If so, it is documented?
(NumPy 1.3)
Alan Isaac
a = np.arange(5)
b = a.copy()
c = np.resize(a, (5,2))
b.resize((5,2))
c # as expected
array([[0, 1],
[2, 3],
[4, 0],
[1, 2],
[3, 4]])
b # surprise!
array([[0, 1],
[2, 3],
On Wed, Mar 17, 2010 at 7:19 AM, Darren Dale dsdal...@gmail.com wrote:
Is this general enough for your use case? I haven't tried to think
about how to change some global state at one point and change it back
at another, that seems like a bad idea and difficult to support.
Sounds like the
On Wed, Mar 17, 2010 at 10:08 AM, Alan G Isaac ais...@american.edu wrote:
Is the zero-fill intentional?
If so, it is documented?
(NumPy 1.3)
Alan Isaac
a = np.arange(5)
b = a.copy()
c = np.resize(a, (5,2))
b.resize((5,2))
c # as expected
array([[0, 1],
[2, 3],
[4, 0],
On Wed, Mar 17, 2010 at 10:11 AM, Ryan May rma...@gmail.com wrote:
On Wed, Mar 17, 2010 at 7:19 AM, Darren Dale dsdal...@gmail.com wrote:
Is this general enough for your use case? I haven't tried to think
about how to change some global state at one point and change it back
at another, that
I would like to know a simple way to know the size of a given dimension of a
numpy array.
Example
A = numpy.zeros((10,20,30),float)
The size of the second dimension of the array A is 20.
Thanks.
--
View this message in context:
Hi,
A.shape[1]
2010/3/17 gerardo.berbeglia gberbeg...@gmail.com:
I would like to know a simple way to know the size of a given dimension of a
numpy array.
Example
A = numpy.zeros((10,20,30),float)
The size of the second dimension of the array A is 20.
Thanks.
--
View this message
On 3/17/2010 10:16 AM, josef.p...@gmail.com wrote:
numpy.resize(a, new_shape)
Return a new array with the specified shape.
If the new array is larger than the original array, then the new array
is filled with repeated copied of a. Note that this behavior is
different from a.resize(new_shape)
On Wed, Mar 17, 2010 at 6:19 AM, Darren Dale dsdal...@gmail.com wrote:
On Wed, Mar 17, 2010 at 2:07 AM, Pierre GM pgmdevl...@gmail.com wrote:
All,
As you're probably aware, the current test suite for numpy.ma raises
some nagging warnings such as invalid value in These warnings are
On 03/17/2010 01:07 AM, Pierre GM wrote:
All,
As you're probably aware, the current test suite for numpy.ma raises some
nagging warnings such as invalid value in These warnings are only
issued when a standard numpy ufunc (eg., np.sqrt) is called on a MaskedArray,
instead of its
On Wed, Mar 17, 2010 at 9:20 AM, Darren Dale dsdal...@gmail.com wrote:
On Wed, Mar 17, 2010 at 10:11 AM, Ryan May rma...@gmail.com wrote:
On Wed, Mar 17, 2010 at 7:19 AM, Darren Dale dsdal...@gmail.com wrote:
Is this general enough for your use case? I haven't tried to think
about how to
On Wed, Mar 17, 2010 at 10:45 AM, Charles R Harris
charlesr.har...@gmail.com wrote:
On Wed, Mar 17, 2010 at 6:19 AM, Darren Dale dsdal...@gmail.com wrote:
On Wed, Mar 17, 2010 at 2:07 AM, Pierre GM pgmdevl...@gmail.com wrote:
All,
As you're probably aware, the current test suite for
n0 = 5 # number of rows
B = np.ones((n0,3))*np.arange(3)
A = np.random.randint(3,size=(n0,3))
C = B[np.arange(n0)[:,None],A]
assert (A == C).all()
A
array([[2, 0, 1],
[2, 0, 1],
[2, 1, 2],
[0, 0, 2],
[2, 0, 0]])
C
array([[ 2., 0., 1.],
[ 2., 0.,
How can i modified all the values of a numpy array whose value is smaller
than a given epsilon to zero?
Example
epsilon=0.01
a = [[0.003,2][23,0.0001]]
output:
[[0,2][23,0]]
--
View this message in context:
http://old.nabble.com/Setting-small-numbers-to-zero.-tp27933569p27933569.html
Sent
On Wed, Mar 17, 2010 at 8:51 AM, gerardob gberbeg...@gmail.com wrote:
How can i modified all the values of a numpy array whose value is smaller
than a given epsilon to zero?
Example
epsilon=0.01
a = [[0.003,2][23,0.0001]]
output:
[[0,2][23,0]]
Give this a try:
import numpy as np
On Wed, Mar 17, 2010 at 8:51 AM, gerardob gberbeg...@gmail.com wrote:
How can i modified all the values of a numpy array whose value is smaller
than a given epsilon to zero?
Example
epsilon=0.01
a = [[0.003,2][23,0.0001]]
output:
[[0,2][23,0]]
Here's one way:
a =
On Wed, Mar 17, 2010 at 11:56 AM, Keith Goodman kwgood...@gmail.com wrote:
On Wed, Mar 17, 2010 at 8:51 AM, gerardob gberbeg...@gmail.com wrote:
How can i modified all the values of a numpy array whose value is smaller
than a given epsilon to zero?
Example
epsilon=0.01
a =
Code:
import numpy
import time
a = numpy.random.random((2000, 2000))
start = time.time()
a[abs(a) 10] = 0
stop = time.time()
print stop - start
a = numpy.random.random((2000, 2000))
start = time.time()
a = a * (abs(a) = 10)
stop = time.time()
print stop - start
a =
Let A and B be two n x n matrices.
I would like to have another n x n matrix C such that
C_ij = min {A_ij, B_ij}
Example:
A = numpy.array([[2,3],[10,12]])
B = numpy.array([[1,4],[9,13]])
Output
C = [[1,3],[9,12]]
The function min(axis) of numpy seems to be only unary.
Thanks.
--
View
import numpy
A = numpy.array([[2,3],[10,12]])
B = numpy.array([[1,4],[9,13]])
C = numpy.array([A,B])
numpy.min(C,0)
array([[ 1, 3],
[ 9, 12]])
Ian
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
17/03/10 @ 11:47 (-0700), thus spake gerardob:
Let A and B be two n x n matrices.
I would like to have another n x n matrix C such that
C_ij = min {A_ij, B_ij}
Example:
A = numpy.array([[2,3],[10,12]])
B = numpy.array([[1,4],[9,13]])
Output
C = [[1,3],[9,12]]
The function
On Wed, Mar 17, 2010 at 11:47 AM, gerardob gberbeg...@gmail.com wrote:
Let A and B be two n x n matrices.
I would like to have another n x n matrix C such that
C_ij = min {A_ij, B_ij}
Example:
A = numpy.array([[2,3],[10,12]])
B = numpy.array([[1,4],[9,13]])
Output
C = [[1,3],[9,12]]
gerardob wrote:
Let A and B be two n x n matrices.
I would like to have another n x n matrix C such that
C_ij = min {A_ij, B_ij}
Example:
A = numpy.array([[2,3],[10,12]])
B = numpy.array([[1,4],[9,13]])
Output
C = [[1,3],[9,12]]
The function min(axis) of numpy seems to be only
Friedrich Romstedt wrote:
Code:
import numpy
import time
a = numpy.random.random((2000, 2000))
start = time.time()
a[abs(a) 10] = 0
stop = time.time()
I highly recommend ipython and its timeit function --much better for this.
And numpy.clip() may be helpful here, though last I
gerardob wrote:
Let A and B be two n x n matrices.
I would like to have another n x n matrix C such that
C_ij = min {A_ij, B_ij}
In [30]: A = numpy.array([[2,3],[10,12]])
In [31]: B = numpy.array([[1,4],[9,13]])
In [32]: numpy.minimum(A,B)
Out[32]:
array([[ 1, 3],
[ 9, 12]])
On Wed, Mar 17, 2010 at 14:04, Christopher Barker chris.bar...@noaa.gov wrote:
Friedrich Romstedt wrote:
Code:
import numpy
import time
a = numpy.random.random((2000, 2000))
start = time.time()
a[abs(a) 10] = 0
stop = time.time()
I highly recommend ipython and its timeit function
On Wed, Mar 17, 2010 at 12:04 PM, Christopher Barker
chris.bar...@noaa.gov wrote:
Friedrich Romstedt wrote:
Code:
import numpy
import time
a = numpy.random.random((2000, 2000))
start = time.time()
a[abs(a) 10] = 0
stop = time.time()
I highly recommend ipython and its timeit function
Eric Firing wrote:
My motivation for going
to the C level was speed and control; many ma operations are very slow
compared to their numpy counterparts, and moving the mask handling to C
can erase nearly all of this penalty.
really? very cool. I was thinking about this the other day, and
On Wed, Mar 17, 2010 at 3:01 PM, Robert Kern robert.k...@gmail.com wrote:
On Wed, Mar 17, 2010 at 14:04, Christopher Barker chris.bar...@noaa.gov
wrote:
Friedrich Romstedt wrote:
Code:
import numpy
import time
a = numpy.random.random((2000, 2000))
start = time.time()
a[abs(a) 10] = 0
On Wed, Mar 17, 2010 at 14:03, Keith Goodman kwgood...@gmail.com wrote:
On Wed, Mar 17, 2010 at 12:04 PM, Christopher Barker
chris.bar...@noaa.gov wrote:
Friedrich Romstedt wrote:
Code:
import numpy
import time
a = numpy.random.random((2000, 2000))
start = time.time()
a[abs(a) 10] = 0
Christopher Barker wrote:
In [32]: numpy.minimum(A,B)
wow! fifth to answer that one -- darn I'm slow!
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/ORR(206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA
On Wed, Mar 17, 2010 at 14:07, josef.p...@gmail.com wrote:
On Wed, Mar 17, 2010 at 3:01 PM, Robert Kern robert.k...@gmail.com wrote:
On Wed, Mar 17, 2010 at 14:04, Christopher Barker chris.bar...@noaa.gov
wrote:
Friedrich Romstedt wrote:
Code:
import numpy
import time
a =
Robert Kern wrote:
On Wed, Mar 17, 2010 at 14:04, Christopher Barker chris.bar...@noaa.gov
wrote:
though last I checked, it's
written in Python,
No, it isn't.
and thus not all that fast.
No, it's reasonably performant.
nice to know -- a good while back, I wrote a small collection
On Wed, Mar 17, 2010 at 3:12 PM, Christopher Barker
chris.bar...@noaa.gov wrote:
Eric Firing wrote:
My motivation for going
to the C level was speed and control; many ma operations are very slow
compared to their numpy counterparts, and moving the mask handling to C
can erase nearly all of
On Wed, Mar 17, 2010 at 12:08 PM, Robert Kern robert.k...@gmail.com wrote:
On Wed, Mar 17, 2010 at 14:03, Keith Goodman kwgood...@gmail.com wrote:
On Wed, Mar 17, 2010 at 12:04 PM, Christopher Barker
chris.bar...@noaa.gov wrote:
Friedrich Romstedt wrote:
Code:
import numpy
import time
a
On Wed, Mar 17, 2010 at 3:11 PM, Robert Kern robert.k...@gmail.com wrote:
On Wed, Mar 17, 2010 at 14:07, josef.p...@gmail.com wrote:
On Wed, Mar 17, 2010 at 3:01 PM, Robert Kern robert.k...@gmail.com wrote:
On Wed, Mar 17, 2010 at 14:04, Christopher Barker chris.bar...@noaa.gov
wrote:
On Wed, Mar 17, 2010 at 14:18, Keith Goodman kwgood...@gmail.com wrote:
On Wed, Mar 17, 2010 at 12:08 PM, Robert Kern robert.k...@gmail.com wrote:
On Wed, Mar 17, 2010 at 14:03, Keith Goodman kwgood...@gmail.com wrote:
On Wed, Mar 17, 2010 at 12:04 PM, Christopher Barker
chris.bar...@noaa.gov
On Mar 17, 2010, at 8:19 AM, Darren Dale wrote:
I started thinking about a third method called __input_prepare__ that
would be called on the way into the ufunc, which would allow you to
intercept the input and pass a somehow modified copy back to the
ufunc. The total flow would be:
1)
Hi,
You are running rather old numpy version (1.0.1).
Try upgrading numpy as at least recent numpy from svn detects
this compiler fine.
Regards,
Pearu
Peter Brady wrote:
Hello all,
The version of f2py that's installed on our system doesn't appear to
handle version numbers correctly. I've
On Wed, Mar 17, 2010 at 4:48 PM, Pierre GM pgmdevl...@gmail.com wrote:
On Mar 17, 2010, at 8:19 AM, Darren Dale wrote:
I started thinking about a third method called __input_prepare__ that
would be called on the way into the ufunc, which would allow you to
intercept the input and pass a
On Wed, Mar 17, 2010 at 3:13 PM, Darren Dale dsdal...@gmail.com wrote:
On Wed, Mar 17, 2010 at 4:48 PM, Pierre GM pgmdevl...@gmail.com wrote:
On Mar 17, 2010, at 8:19 AM, Darren Dale wrote:
I started thinking about a third method called __input_prepare__ that
would be called on the way
On Wed, Mar 17, 2010 at 8:42 AM, Alan G Isaac ais...@american.edu wrote:
On 3/17/2010 10:16 AM, josef.p...@gmail.com wrote:
numpy.resize(a, new_shape)
Return a new array with the specified shape.
If the new array is larger than the original array, then the new array
is filled with
On Wed, Mar 17, 2010 at 5:43 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
On Wed, Mar 17, 2010 at 3:13 PM, Darren Dale dsdal...@gmail.com wrote:
On Wed, Mar 17, 2010 at 4:48 PM, Pierre GM pgmdevl...@gmail.com wrote:
On Mar 17, 2010, at 8:19 AM, Darren Dale wrote:
I started
On Wed, Mar 17, 2010 at 5:26 PM, Darren Dale dsdal...@gmail.com wrote:
On Wed, Mar 17, 2010 at 5:43 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
On Wed, Mar 17, 2010 at 3:13 PM, Darren Dale dsdal...@gmail.com wrote:
On Wed, Mar 17, 2010 at 4:48 PM, Pierre GM pgmdevl...@gmail.com
On Wed, Mar 17, 2010 at 8:22 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
On Wed, Mar 17, 2010 at 5:26 PM, Darren Dale dsdal...@gmail.com wrote:
On Wed, Mar 17, 2010 at 5:43 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
On Wed, Mar 17, 2010 at 3:13 PM, Darren Dale
On Wed, Mar 17, 2010 at 7:39 PM, Darren Dale dsdal...@gmail.com wrote:
On Wed, Mar 17, 2010 at 8:22 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
On Wed, Mar 17, 2010 at 5:26 PM, Darren Dale dsdal...@gmail.com wrote:
On Wed, Mar 17, 2010 at 5:43 PM, Charles R Harris
49 matches
Mail list logo