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

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

[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 wrote: >> >>> On 18 Feb 2014 11:05, "Charles R Ha

[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, filtering,

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 fac

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 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 wrote: > Hi, > > On Sun, May 20, 2012 at 10:21 AM, Chao YUE 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 zerodivision >> error? thanks. >> >> I

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

2012-05-03 Thread Tony Yu
On Thu, May 3, 2012 at 9:57 AM, Robert Kern wrote: > On Thu, May 3, 2012 at 2:50 PM, Robert Elsner wrote: > > > > Am 03.05.2012 15:45, schrieb Robert Kern: > >> On Thu, May 3, 2012 at 2:24 PM, Robert Elsner > wrote: > >>> Hello Everybody, > >>> > >>> is there any news on the status of np.bincou

Re: [Numpy-discussion] (no subject)

2012-04-20 Thread Tony Yu
On Fri, Apr 20, 2012 at 2:15 PM, Andre Martel wrote: > 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], > [ 5, 100, 7,

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 wrote: > On Mon, Apr 16, 2012 at 5:51 PM, Tony Yu wrote: > > > > > > On Mon, Apr 16, 2012 at 5:27 PM, Skipper Seabold > > wrote: > >> > >> Hi, > >> > >> I have a pull request here [1

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 wrote: > 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 > statstmodels and i

Re: [Numpy-discussion] Slice specified axis

2012-04-09 Thread Tony Yu
On Mon, Apr 9, 2012 at 12:22 PM, Benjamin Root wrote: > > > On Mon, Apr 9, 2012 at 12:14 PM, Jonathan T. Niehof wrote: > >> 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 number of dimensions

Re: [Numpy-discussion] Slice specified axis

2012-04-06 Thread Tony Yu
On Fri, Apr 6, 2012 at 8:54 AM, Benjamin Root 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 shape >>

[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 t

Re: [Numpy-discussion] numpy.arange() error?

2012-02-09 Thread Tony Yu
On Thu, Feb 9, 2012 at 2:47 PM, Eric Firing wrote: > On 02/09/2012 09:20 AM, Drew Frank wrote: > > Eric Firing hawaii.edu> writes: > > > >> > >> On 02/08/2012 09:31 PM, teomat wrote: > >>> > >>> Hi, > >>> > >>> Am I wrong or the numpy.arange() function is not correct 100%? > >>> > >>> Try to do

Re: [Numpy-discussion] hstack

2012-02-08 Thread Tony Yu
On Wed, Feb 8, 2012 at 11:32 AM, Stephanie Cooke wrote: > Hello, > > When I try to use the command hstack, I am given the error message > "TypeError: hstack() takes exactly 1 argument (2 given)". I have a 9X1 > array (called array) that I would like to concatenate to a 9X2 matrix > (called matrix)

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.

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

2012-01-15 Thread Tony Yu
On Sun, Jan 15, 2012 at 10:45 AM, 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 wa

Re: [Numpy-discussion] idea of optimisation?

2011-12-06 Thread Tony Yu
On Tue, Dec 6, 2011 at 2:51 AM, Xavier Barthelemy 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 threshold method

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 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 merits. I like

Re: [Numpy-discussion] Type checking inconsistency

2011-10-16 Thread Tony Yu
On Sun, Oct 16, 2011 at 12:49 PM, Pauli Virtanen 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 > >

Re: [Numpy-discussion] Type checking inconsistency

2011-10-16 Thread Tony Yu
On Sun, Oct 16, 2011 at 12:39 PM, Tony Yu 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 rea

[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 "corre

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 wrote: > 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 broadcastable

Re: [Numpy-discussion] Numpydoc warnings for methods

2011-07-17 Thread Tony Yu
On Sun, Jul 17, 2011 at 3:35 PM, Ralf Gommers wrote: > > On Sun, Jul 17, 2011 at 7:15 PM, Tony Yu 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

[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 ", "toctree references unknown document u''", "toctree contains reference to nonexisting document ''---for each method defined. The example below

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 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 attach your patch. Thanks f

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 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. Hmm, I don't quite understand

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 > 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) >>>

Re: [Numpy-discussion] array with named columns (or record arrays with homogenous types)

2008-09-22 Thread Tony Yu
> > Message: 8 > Date: Mon, 22 Sep 2008 19:28:50 -0400 > From: Pierre GM <[EMAIL PROTECTED]> > Subject: Re: [Numpy-discussion] array with named columns (or record > arrays with homogenous types) > To: Discussion of Numerical Python > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plai

[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 thoug

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

2008-05-31 Thread Tony Yu
f an array. 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 n

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

2008-05-31 Thread Tony Yu
? Thanks in advance 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]: prin