Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread Tony Yu
On Wed, Jul 16, 2014 at 1:47 PM, Ralf Gommers ralf.gomm...@gmail.com wrote: On Wed, Jul 16, 2014 at 6:37 AM, Tony Yu tsy...@gmail.com wrote: Is there any reason why the defaults for `allclose` and `assert_allclose` differ? This makes debugging a broken test much more difficult. More

[Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-16 Thread Tony Yu
Is there any reason why the defaults for `allclose` and `assert_allclose` differ? This makes debugging a broken test much more difficult. More importantly, using an absolute tolerance of 0 causes failures for some common cases. For example, if two values are very close to zero, a test will fail:

Re: [Numpy-discussion] New (old) function proposal.

2014-02-18 Thread Tony Yu
On Tue, Feb 18, 2014 at 11:11 AM, Jaime Fernández del Río jaime.f...@gmail.com wrote: On Tue, Feb 18, 2014 at 9:03 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Tue, Feb 18, 2014 at 9:40 AM, Nathaniel Smith n...@pobox.com wrote: On 18 Feb 2014 11:05, Charles R Harris

[Numpy-discussion] ANN: scikits-image 0.7.0 release

2012-09-30 Thread Tony Yu
Announcement: scikits-image 0.7.0 = We're happy to announce the 7th version of scikits-image! Scikits-image is an image processing toolbox for SciPy that includes algorithms for segmentation, geometric transformations, color space manipulation, analysis,

Re: [Numpy-discussion] Synonym standards

2012-07-27 Thread Tony Yu
On Fri, Jul 27, 2012 at 11:39 AM, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: On 27.07.2012, at 3:27PM, Benjamin Root wrote: I would prefer not to use: from xxx import *, because of the name pollution. The name convention that I copied above facilitates avoiding

Re: [Numpy-discussion] convert any non square matrix in to square matrix using numpy

2012-06-18 Thread Tony Yu
On Mon, Jun 18, 2012 at 11:55 AM, bob tnur bobtnu...@gmail.com wrote: Hi, how I can convert (by adding zero) of any non-square numpy matrix in to square matrix using numpy? then how to find the minimum number in each row except the zeros added(for making square matrix)? ;)

Re: [Numpy-discussion] why not zerodivision error?

2012-05-20 Thread Tony Yu
On Sun, May 20, 2012 at 3:47 AM, eat e.antero.ta...@gmail.com wrote: Hi, On Sun, May 20, 2012 at 10:21 AM, Chao YUE chaoyue...@gmail.com wrote: Dear all, could anybody give one sentence about this? why in the loop I didn't get zerodivision error by when I explicitly do this, I get a

Re: [Numpy-discussion] Status of np.bincount

2012-05-03 Thread Tony Yu
On Thu, May 3, 2012 at 9:57 AM, Robert Kern robert.k...@gmail.com wrote: On Thu, May 3, 2012 at 2:50 PM, Robert Elsner ml...@re-factory.de wrote: Am 03.05.2012 15:45, schrieb Robert Kern: On Thu, May 3, 2012 at 2:24 PM, Robert Elsner ml...@re-factory.de wrote: Hello Everybody, is

Re: [Numpy-discussion] (no subject)

2012-04-20 Thread Tony Yu
On Fri, Apr 20, 2012 at 2:15 PM, Andre Martel soucoupevola...@yahoo.comwrote: What would be the best way to remove the maximum from a cube and collapse the remaining elements along the z-axis ? For example, I want to reduce Cube to NewCube: Cube array([[[ 13, 2, 3, 42], [

Re: [Numpy-discussion] adding a cut function to numpy

2012-04-16 Thread Tony Yu
On Mon, Apr 16, 2012 at 5:27 PM, Skipper Seabold jsseab...@gmail.comwrote: Hi, I have a pull request here [1] to add a cut function similar to R's [2]. It seems there are often requests for similar functionality. It's something I'm making use of for my own work and would like to use in

Re: [Numpy-discussion] adding a cut function to numpy

2012-04-16 Thread Tony Yu
On Mon, Apr 16, 2012 at 6:01 PM, Skipper Seabold jsseab...@gmail.comwrote: On Mon, Apr 16, 2012 at 5:51 PM, Tony Yu tsy...@gmail.com wrote: On Mon, Apr 16, 2012 at 5:27 PM, Skipper Seabold jsseab...@gmail.com wrote: Hi, I have a pull request here [1] to add a cut function similar

Re: [Numpy-discussion] Slice specified axis

2012-04-09 Thread Tony Yu
On Mon, Apr 9, 2012 at 12:22 PM, Benjamin Root ben.r...@ou.edu wrote: On Mon, Apr 9, 2012 at 12:14 PM, Jonathan T. Niehof jnie...@lanl.govwrote: On 04/06/2012 06:54 AM, Benjamin Root wrote: Take a peek at how np.gradient() does it. It creates a list of None with a length equal to the

Re: [Numpy-discussion] Slice specified axis

2012-04-06 Thread Tony Yu
On Fri, Apr 6, 2012 at 8:54 AM, Benjamin Root ben.r...@ou.edu wrote: On Friday, April 6, 2012, Val Kalatsky wrote: The only slicing short-cut I can think of is the Ellipsis object, but it's not going to help you much here. The alternatives that come to my mind are (1) manipulation of

[Numpy-discussion] Slice specified axis

2012-04-05 Thread Tony Yu
Is there a way to slice an nd-array along a specified axis? It's easy to slice along a fixed axis, e.g.: axis = 0: array[start:end] axis = 1: array[:, start:end] ... But I need to do this inside of a function that accepts arrays of any dimension, and the user can operate on any axis of the

Re: [Numpy-discussion] how to cite 1Xn array as nX1 array?

2012-01-27 Thread Tony Yu
On Fri, Jan 27, 2012 at 9:28 AM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On 27. jan. 2012, at 14:52, Chao YUE wrote: Dear all, suppose I have a ndarray a: In [66]: a Out[66]: array([0, 1, 2, 3, 4]) how can use it as 5X1 array without doing a=a.reshape(5,1)?

Re: [Numpy-discussion] Counting the Colors of RGB-Image

2012-01-15 Thread Tony Yu
On Sun, Jan 15, 2012 at 10:45 AM, a...@pdauf.de wrote: Counting the Colors of RGB-Image, nameit im0 with im0.shape = 2500,3500,3 with this code: tab0 = zeros( (256,256,256) , dtype=int) tt = im0.view() tt.shape = -1,3 for r,g,b in tt: tab0[r,g,b] += 1 Question: Is there a faster

Re: [Numpy-discussion] idea of optimisation?

2011-12-06 Thread Tony Yu
On Tue, Dec 6, 2011 at 2:51 AM, Xavier Barthelemy xab...@gmail.com wrote: ok let me be more precise I have an Z array which is the elevation from this I extract a discrete array of Zero Crossing, and another discrete array of Crests. len(crest) is different than len(Xzeros). I have a

Re: [Numpy-discussion] Reading automatically all the parameters from a file

2011-11-30 Thread Tony Yu
On Wed, Nov 30, 2011 at 1:49 PM, Neal Becker ndbeck...@gmail.com wrote: My suggestion is: don't. It's easier to script runs if you read parameters from the command line. I recommend argparse. I think setting parameters in a config file and setting them on the command line both have their

[Numpy-discussion] Type checking inconsistency

2011-10-16 Thread Tony Yu
Hi, I noticed a type-checking inconsistency between assignments using slicing and fancy-indexing. The first will happily cast on assignment (regardless of type), while the second will throw a type error if there's reason to believe the casting will be unsafe. I'm not sure which would be the

Re: [Numpy-discussion] Type checking inconsistency

2011-10-16 Thread Tony Yu
On Sun, Oct 16, 2011 at 12:39 PM, Tony Yu tsy...@gmail.com wrote: Hi, I noticed a type-checking inconsistency between assignments using slicing and fancy-indexing. The first will happily cast on assignment (regardless of type), while the second will throw a type error if there's reason

Re: [Numpy-discussion] Type checking inconsistency

2011-10-16 Thread Tony Yu
On Sun, Oct 16, 2011 at 12:49 PM, Pauli Virtanen p...@iki.fi wrote: (16.10.2011 18:39), Tony Yu wrote: import numpy as np a = np.arange(10) b = np.ones(10, dtype=np.uint8) # this runs without error b[:5] = a[:5] mask = a 5 b[mask] = b[mask] TypeError: array

Re: [Numpy-discussion] question about subtraction and shape

2011-09-01 Thread Tony Yu
On Thu, Sep 1, 2011 at 5:33 PM, Jonas Wallin jonas.walli...@gmail.comwrote: Hello, I implemented the following line of code: Gami[~index0].shape (100,) sigma.shape (1,1) Gami[~index0] = Gam[~index0] - sigma**2 I get the error message: *** ValueError: array is not

[Numpy-discussion] Numpydoc warnings for methods

2011-07-17 Thread Tony Yu
I'm building documentation using Sphinx, and it seems that numpydoc is raising a lot of warnings. Specifically, the warnings look like failed to import method_name, toctree references unknown document u'method_name', toctree contains reference to nonexisting document 'method_name'---for each

Re: [Numpy-discussion] Numpydoc warnings for methods

2011-07-17 Thread Tony Yu
On Sun, Jul 17, 2011 at 3:35 PM, Ralf Gommers ralf.gomm...@googlemail.comwrote: On Sun, Jul 17, 2011 at 7:15 PM, Tony Yu tsy...@gmail.com wrote: Am I doing something wrong here? You're not, it's a Sphinx bug that Pauli already has a fix for. See http://projects.scipy.org/numpy/ticket/1772

Re: [Numpy-discussion] Using interpolate with zero-rank array raises error

2009-07-17 Thread Tony Yu
Date: Thu, 16 Jul 2009 23:37:58 -0400 From: Ralf Gommers ralf.gomm...@googlemail.com It seems to me that there are quite a few other functions that will give errors with 0-D arrays (apply_along/over_axis are two that come to mind). There is nothing to interpolate so I'm not surprised.

Re: [Numpy-discussion] Using interpolate with zero-rank array raises error

2009-07-17 Thread Tony Yu
Date: Fri, 17 Jul 2009 13:27:25 -0400 From: Ralf Gommers ralf.gomm...@googlemail.com Subject: Re: [Numpy-discussion] Using interpolate with zero-rank array raises error [snip] If it works with scalars it should work with 0-D arrays I think. So you should probably open a ticket and

Re: [Numpy-discussion] Using interpolate with zero-rank array raises error

2009-07-16 Thread Tony Yu
Sorry, I don't know if its proper mailing-list-etiquette to bump my own post... Are there any comments on whether this interp error is expected behavior? Thanks, -Tony Date: Mon, 13 Jul 2009 13:50:50 -0400 From: Tony Yu tsy...@gmail.com Subject: [Numpy-discussion] Using interpolate

[Numpy-discussion] Using interpolate with zero-rank array raises error

2009-07-13 Thread Tony Yu
(Sorry if this is a duplicate; I think sent this from the wrong email the first time) When using interpolate with a zero-rank array, I get ValueError: object of too small depth for desired array. The following code reproduces this issue import numpy as np x0 = np.array(0.1) x =

[Numpy-discussion] array += masked_array gives a normal array, not masked array

2008-06-01 Thread Tony Yu
Ok, so you guys shot down my last attempt at finding a bug :). Here's another attempt. array + masked_array outputs a masked array array += masked_array outputs an array. I'm actually not sure if this is a bug (works the same for both the old and new masked arrays), but I

[Numpy-discussion] Strange behavior in setting masked array values in Numpy 1.1.0

2008-05-31 Thread Tony Yu
for your help. -Tony Yu Example: In [1]: import numpy In [2]: masked = numpy.ma.masked_array([[1, 2, 3, 4, 5]], mask=False) In [3]: masked[:] = numpy.fliplr(masked.copy()) In [4]: print masked [[5 4 3 2 1]] In [5]: masked[:] = numpy.fliplr(masked) In [6]: print masked [[1 2 3 2 1

Re: [Numpy-discussion] Strange behavior in setting masked array values in Numpy 1.1.0

2008-05-31 Thread Tony Yu
. Copying seems inefficient. -Tony Matthieu 2008/5/31 Tony Yu [EMAIL PROTECTED]: Great job getting numpy 1.1.0 out and thanks for including the old API of masked arrays. I've been playing around with some software using numpy 1.0.4 and took a crack at upgrading it to numpy 1.1.0, but I ran