Hi Pierre,
I'm a bit surprised, though. Here's what I tried
np.version.version
1.7.0
x = np.ma.array([1,2,3], mask=[0,1,0])
x.flags.writeable=False
x[0]=-1
ValueError: assignment destination is read-only
Thanks, it works perfectly =) Sorry, probably have overlooked this
simple
On Jul 15, 2013, at 10:04 , Gregorio Bastardo gregorio.basta...@gmail.com
wrote:
Hi Pierre,
I'm a bit surprised, though. Here's what I tried
np.version.version
1.7.0
x = np.ma.array([1,2,3], mask=[0,1,0])
x.flags.writeable=False
x[0]=-1
ValueError: assignment destination is
Hi Pierre,
Note as well that hardening the mask only prevents unmasking: you can still
grow the mask, which may not be what you want. Use
`x.mask.flags.writeable=False` to make the mask really read-only.
I ran into an unmasking problem with the suggested approach:
np.version.version
Python itself doesn't raise an exception in such cases :
(3,4) != (2, 3, 4)
True
(3,4) == (2, 3, 4)
False
Should numpy behave differently ?
Bruno.
2013/7/12 Frédéric Bastien no...@nouiz.org
I also don't like that idea, but I'm not able to come to a good reasoning
like Benjamin.
I
Hi,
On Mon, Jun 10, 2013 at 3:47 PM, Nathaniel Smith n...@pobox.com wrote:
Hi all,
Is there anyone out there using numpy masked arrays, who has an
opinion on how empty_like (and its friends ones_like, zeros_like)
should handle the mask?
Right now apparently if you call np.ma.empty_like on
On Sun, Jul 14, 2013 at 3:35 PM, Charles R Harris charlesr.har...@gmail.com
wrote:
On Sun, Jul 14, 2013 at 2:55 PM, Warren Weckesser
warren.weckes...@gmail.com wrote:
On 7/14/13, Charles R Harris charlesr.har...@gmail.com wrote:
Some corner cases in the mean, var, std.
*Empty
On Mon, Jul 15, 2013 at 2:09 PM, bruno Piguet bruno.pig...@gmail.com wrote:
Python itself doesn't raise an exception in such cases :
(3,4) != (2, 3, 4)
True
(3,4) == (2, 3, 4)
False
Should numpy behave differently ?
The numpy equivalent to Python's scalar == is called array_equal,
and
On Mon, 2013-07-15 at 15:09 +0200, bruno Piguet wrote:
Python itself doesn't raise an exception in such cases :
(3,4) != (2, 3, 4)
True
(3,4) == (2, 3, 4)
False
Should numpy behave differently ?
Yes, because Python tests whether the tuple is different, not whether
the elements are:
This is going to need to be heavily documented with doctests. Also, just to
clarify, are we talking about a ValueError for doing a nansum on an empty
array as well, or will that now return a zero?
Ben Root
On Mon, Jul 15, 2013 at 9:52 AM, Charles R Harris charlesr.har...@gmail.com
wrote:
On Mon, 2013-07-15 at 07:52 -0600, Charles R Harris wrote:
On Sun, Jul 14, 2013 at 3:35 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
snip
For nansum, I would expect 0 even in the case of all
nans. The point
On Mon, Jul 15, 2013 at 8:25 AM, Benjamin Root ben.r...@ou.edu wrote:
This is going to need to be heavily documented with doctests. Also, just
to clarify, are we talking about a ValueError for doing a nansum on an
empty array as well, or will that now return a zero?
I was going to leave
On Mon, Jul 15, 2013 at 8:34 AM, Sebastian Berg
sebast...@sipsolutions.netwrote:
On Mon, 2013-07-15 at 07:52 -0600, Charles R Harris wrote:
On Sun, Jul 14, 2013 at 3:35 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
snip
For nansum, I would expect 0 even
Just a question, should == behave like a ufunc or like python == for tuple?
I think that all ndarray comparision (==, !=, =, ...) should behave the
same. If they don't (like it was said), making them consistent is good.
What is the minimal change to have them behave the same? From my
On Mon, Jul 15, 2013 at 8:34 AM, Sebastian Berg
sebast...@sipsolutions.netwrote:
On Mon, 2013-07-15 at 07:52 -0600, Charles R Harris wrote:
On Sun, Jul 14, 2013 at 3:35 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
snip
For nansum, I would expect 0 even
Thank-you for your explanations.
So, if the operator == applied to np.arrays is a shorthand for the
ufunc np.equal, it should definitly behave exactly as np.equal(), and raise
an error.
One side question about style : In case you would like to protect a x ==
y test by a try/except clause,
On Jul 12, 2013, at 8:51 PM, Brady McCary brady.mcc...@gmail.com wrote:
something to do with an alpha channel being present.
I'd check and see how PIL is storing the alpha channel. If it's RGBA,
then I'd expect it to work.
But I'd PIL is storing the alpha channel as a separate band, then I'm
2013/7/15 Frédéric Bastien no...@nouiz.org
Just a question, should == behave like a ufunc or like python == for tuple?
That's what I was also wondering.
I see the advantage of consistency for newcomers.
I'm not experienced enough to see if this is a problem for numerical
practitionners Maybe
On Jul 15, 2013, at 14:40 , Gregorio Bastardo gregorio.basta...@gmail.com
wrote:
Hi Pierre,
Note as well that hardening the mask only prevents unmasking: you can still
grow the mask, which may not be what you want. Use
`x.mask.flags.writeable=False` to make the mask really read-only.
On Mon, Jul 15, 2013 at 8:58 AM, Charles R Harris charlesr.har...@gmail.com
wrote:
On Mon, Jul 15, 2013 at 8:34 AM, Sebastian Berg
sebast...@sipsolutions.net wrote:
On Mon, 2013-07-15 at 07:52 -0600, Charles R Harris wrote:
On Sun, Jul 14, 2013 at 3:35 PM, Charles R Harris
On Jul 15, 2013 11:47 AM, Charles R Harris charlesr.har...@gmail.com
wrote:
On Mon, Jul 15, 2013 at 8:58 AM, Charles R Harris
charlesr.har...@gmail.com wrote:
On Mon, Jul 15, 2013 at 8:34 AM, Sebastian Berg
sebast...@sipsolutions.net wrote:
On Mon, 2013-07-15 at 07:52 -0600, Charles
On Mon, 2013-07-15 at 08:47 -0600, Charles R Harris wrote:
On Mon, Jul 15, 2013 at 8:34 AM, Sebastian Berg
sebast...@sipsolutions.net wrote:
On Mon, 2013-07-15 at 07:52 -0600, Charles R Harris wrote:
On Sun, Jul 14, 2013 at 3:35 PM, Charles R Harris
On Mon, 2013-07-15 at 17:12 +0200, bruno Piguet wrote:
2013/7/15 Frédéric Bastien no...@nouiz.org
Just a question, should == behave like a ufunc or like python
== for tuple?
That's what I was also wondering.
I am not sure I understand the question. Of
Dear Brady
On Fri, 12 Jul 2013 22:00:08 -0500, Brady McCary wrote:
I want to load images with PIL and then operate on them with NumPy.
According to the PIL and NumPy documentation, I would expect the
following to work, but it is not.
Reading images as PIL is a little bit trickier than one
Ouch…
Quick workaround: use `x.harden_mask()` *then* `x.mask.flags.writeable=False`
Thanks for the update and the detailed explanation. I'll try this trick.
This may change in the future, depending on a yet-to-be-achieved consensus on
the definition of 'least-surprising behaviour'. Right
On Mon, Jul 15, 2013 at 9:55 AM, Sebastian Berg
sebast...@sipsolutions.netwrote:
On Mon, 2013-07-15 at 08:47 -0600, Charles R Harris wrote:
On Mon, Jul 15, 2013 at 8:34 AM, Sebastian Berg
sebast...@sipsolutions.net wrote:
On Mon, 2013-07-15 at 07:52 -0600, Charles R Harris
On Mon, Jul 15, 2013 at 6:29 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
Let me try to summarize. To begin with, the environment of the nan functions
is rather special.
1) if the array is of not of inexact type, they punt to the non-nan
versions.
2) if the array is of inexact type,
On Mon, Jul 15, 2013 at 2:55 PM, Nathaniel Smith n...@pobox.com wrote:
On Mon, Jul 15, 2013 at 6:29 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
Let me try to summarize. To begin with, the environment of the nan functions
is rather special.
1) if the array is of not of inexact type,
On Mon, Jul 15, 2013 at 4:24 PM, josef.p...@gmail.com wrote:
On Mon, Jul 15, 2013 at 2:55 PM, Nathaniel Smith n...@pobox.com wrote:
On Mon, Jul 15, 2013 at 6:29 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
Let me try to summarize. To begin with, the environment of the nan functions
On Mon, Jul 15, 2013 at 2:44 PM, josef.p...@gmail.com wrote:
On Mon, Jul 15, 2013 at 4:24 PM, josef.p...@gmail.com wrote:
On Mon, Jul 15, 2013 at 2:55 PM, Nathaniel Smith n...@pobox.com wrote:
On Mon, Jul 15, 2013 at 6:29 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
Let me try
On Mon, Jul 15, 2013 at 5:34 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
On Mon, Jul 15, 2013 at 2:44 PM, josef.p...@gmail.com wrote:
On Mon, Jul 15, 2013 at 4:24 PM, josef.p...@gmail.com wrote:
On Mon, Jul 15, 2013 at 2:55 PM, Nathaniel Smith n...@pobox.com wrote:
On Mon, Jul
On Mon, Jul 15, 2013 at 3:57 PM, josef.p...@gmail.com wrote:
On Mon, Jul 15, 2013 at 5:34 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
On Mon, Jul 15, 2013 at 2:44 PM, josef.p...@gmail.com wrote:
On Mon, Jul 15, 2013 at 4:24 PM, josef.p...@gmail.com wrote:
On Mon, Jul 15,
On Mon, 15 Jul 2013 08:33:47 -0600, Charles R Harris wrote:
On Mon, Jul 15, 2013 at 8:25 AM, Benjamin Root ben.r...@ou.edu wrote:
This is going to need to be heavily documented with doctests. Also, just
to clarify, are we talking about a ValueError for doing a nansum on an
empty array as
On Mon, Jul 15, 2013 at 6:22 PM, Stéfan van der Walt ste...@sun.ac.zawrote:
On Mon, 15 Jul 2013 08:33:47 -0600, Charles R Harris wrote:
On Mon, Jul 15, 2013 at 8:25 AM, Benjamin Root ben.r...@ou.edu wrote:
This is going to need to be heavily documented with doctests. Also,
just
to
On Mon, 15 Jul 2013 18:46:33 -0600, Charles R Harris wrote:
So nansum should return zeros rather than the current NaNs?
Yes, my feeling is that nansum([]) should be 0.
Stéfan
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
To add a bit of context to the question of nansum on empty results, we
currently differ from MATLAB and R in this respect, they return zero no
matter what. Personally, I think it should return zero, but our current
behavior of returning nans has existed for a long time.
Personally, I think we
I know that there's an easy way to solve this problem, but I'm not sufficiently
knowledgeable
about numpy indexing to figure it out.
Here is the problem:
Take a 2-d array a, of any size.
Sort it in ascending order using, I presume, argsort.
Step through the sorted array in order, and for each
On 7/15/13, Moroney, Catherine M (398D)
catherine.m.moro...@jpl.nasa.gov wrote:
I know that there's an easy way to solve this problem, but I'm not
sufficiently knowledgeable
about numpy indexing to figure it out.
Here is the problem:
Take a 2-d array a, of any size.
Sort it in ascending
On Mon, Jul 15, 2013 at 6:58 PM, Benjamin Root ben.r...@ou.edu wrote:
To add a bit of context to the question of nansum on empty results, we
currently differ from MATLAB and R in this respect, they return zero no
matter what. Personally, I think it should return zero, but our current
behavior
On Tue, Jul 16, 2013 at 3:50 AM, Charles R Harris charlesr.har...@gmail.com
wrote:
On Mon, Jul 15, 2013 at 6:58 PM, Benjamin Root ben.r...@ou.edu wrote:
To add a bit of context to the question of nansum on empty results, we
currently differ from MATLAB and R in this respect, they return
39 matches
Mail list logo