Re: [Numpy-discussion] np.where: x and y need to have the same shape as condition ?

2013-01-29 Thread Benjamin Root
On Tue, Jan 29, 2013 at 6:16 AM, denis wrote: > Folks, > the doc for `where` says "x and y need to have the same shape as > condition" > http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.where.html > But surely > "where is equivalent to: > [xv if c else yv for (c,xv,yv) in z

Re: [Numpy-discussion] Issues to fix for 1.7.0rc2.

2013-02-06 Thread Benjamin Root
On Wed, Feb 6, 2013 at 4:18 AM, Dag Sverre Seljebotn < d.s.seljeb...@astro.uio.no> wrote: > On 02/06/2013 08:41 AM, Charles R Harris wrote: > > > > > > On Tue, Feb 5, 2013 at 11:50 PM, Jason Grout > > mailto:jason-s...@creativetrax.com>> > wrote: > > > > On 2/6/13 12:46 AM, Charles R Harris wr

Re: [Numpy-discussion] Dealing with the mode argument in qr.

2013-02-06 Thread Benjamin Root
On Tue, Feb 5, 2013 at 4:23 PM, Charles R Harris wrote: > Hi All, > > This post is to bring the discussion of PR > #2965to the attention of the list. > There are at least three issues in play here. > > 1) The PR adds modes 'big' and 'thin' to the current

Re: [Numpy-discussion] Where's that function?

2013-02-06 Thread Benjamin Root
On Wed, Feb 6, 2013 at 1:08 PM, wrote: > I'm convinced that I saw a while ago a function that uses a list of > interval boundaries to index into an array, either to iterate or to > take. > I thought that's very useful, but didn't make a note. > > Now, I have no idea where I saw this (I thought nu

Re: [Numpy-discussion] Array accumulation in numpy

2013-02-19 Thread Benjamin Root
On Tue, Feb 19, 2013 at 10:00 AM, Tony Ladd wrote: > I want to accumulate elements of a vector (x) to an array (f) based on > an index list (ind). > > For example: > > x=[1,2,3,4,5,6] > ind=[1,3,9,3,4,1] > f=np.zeros(10) > > What I want would be produced by the loop > > for i=range(6): > f[i

Re: [Numpy-discussion] Adding .abs() method to the array object

2013-02-23 Thread Benjamin Root
On Sat, Feb 23, 2013 at 8:20 PM, wrote: > On Sat, Feb 23, 2013 at 3:33 PM, Robert Kern > wrote: > > On Sat, Feb 23, 2013 at 7:25 PM, Nathaniel Smith wrote: > >> On Sat, Feb 23, 2013 at 3:38 PM, Till Stensitzki > wrote: > >>> Hello, > >>> i know that the array object is already crowded, but i w

Re: [Numpy-discussion] a question about freeze on numpy 1.7.0

2013-02-24 Thread Benjamin Root
On Sun, Feb 24, 2013 at 8:16 PM, Ondřej Čertík wrote: > Hi Gelin, > > On Sun, Feb 24, 2013 at 12:08 AM, Gelin Yan wrote: > > Hi All > > > > When I used numpy 1.7.0 with cx_freeze 4.3.1 on windows, I quickly > > found out even a simple "import numpy" may lead to program failed with > > follow

Re: [Numpy-discussion] drawing the line (was: Adding .abs() method to the array object)

2013-02-26 Thread Benjamin Root
On Mon, Feb 25, 2013 at 8:23 PM, Alan G Isaac wrote: > I'm hoping this discussion will return to the drawing the line question. > > http://stackoverflow.com/questions/8108688/in-python-when-should-i-use-a-function-instead-of-a-method > > Alan Isaac > Proposed line: Reduction methods only. Disc

Re: [Numpy-discussion] reshaping arrays

2013-03-04 Thread Benjamin Root
On Sat, Mar 2, 2013 at 11:35 PM, Sudheer Joseph wrote: > Hi Brad, > I am not getting the attribute reshape for the array, are > you having a different version of numpy than mine? > > I have > In [55]: np.__version__ > Out[55]: '1.7.0' > and detail of the shape > > details of variab

Re: [Numpy-discussion] Implementing a "find first" style function

2013-03-06 Thread Benjamin Root
On Tue, Mar 5, 2013 at 9:15 AM, Phil Elson wrote: > The ticket https://github.com/numpy/numpy/issues/2269 discusses the > possibility of implementing a "find first" style function which can > optimise the process of finding the first value(s) which match a predicate > in a given 1D array. For exa

Re: [Numpy-discussion] feature tracking in numpy/scipy

2013-03-07 Thread Benjamin Root
On Sat, Mar 2, 2013 at 5:32 PM, Scott Collis wrote: > Good afternoon list, > I am looking at feature tracking in a 2D numpy array, along the lines of > Dixon and Wiener 1993 (for tracking precipitating storms) > > Identifying features based on threshold is quite trivial using > ndimage.label > >

Re: [Numpy-discussion] Old tickets

2011-03-30 Thread Benjamin Root
On Wed, Mar 30, 2011 at 2:37 PM, Bruce Southey wrote: > Hi, > This followup on tickets that I had previously indicated. So I want to > thank Mark, Ralph and any people for going over those! > > For those that I followed I generally agreed with the outcome. > > Ticket 301: 'Make power and divide r

Re: [Numpy-discussion] Old tickets

2011-03-31 Thread Benjamin Root
On Thu, Mar 31, 2011 at 10:00 AM, Ralf Gommers wrote: > On Wed, Mar 30, 2011 at 11:52 PM, Derek Homeier > wrote: > > > > On 30 Mar 2011, at 23:26, Benjamin Root wrote: > > > >> Ticket 301: 'Make power and divide return floats from int inp

Re: [Numpy-discussion] np.histogramdd of empty data

2011-03-31 Thread Benjamin Root
On Thu, Mar 31, 2011 at 12:32 PM, Ralf Gommers wrote: > -- Forwarded message -- > From: Ralf Gommers > Date: Thu, Mar 31, 2011 at 7:31 PM > Subject: Re: [Numpy-discussion] np.histogramdd of empty data > To: Nils Becker > > > On Thu, Mar 31, 2011 at 12:33 PM, Nils Becker wrote: >

Re: [Numpy-discussion] Willing to contribute to SciPy & NumPy ...

2011-03-31 Thread Benjamin Root
On Thu, Mar 31, 2011 at 3:29 PM, Christopher Barker wrote: > On 3/31/11 12:04 PM, Anthony Scopatz wrote: > > > (with which I am inclined to agree), documentation is probably not the > > best way to get started. > > I agree as well. However, I think newbies can be a great help in > identifying hole

Re: [Numpy-discussion] nearing a milestone

2011-04-01 Thread Benjamin Root
Yeah, but they have been downhill since November... On Fri, Apr 1, 2011 at 1:19 PM, Darren Dale wrote: > Numpy is nearing a milestone: > > http://sourceforge.net/projects/numpy/files/NumPy/stats/timeline?dates=2007-09-25+to+2011-04-01 > ___ > NumPy-Dis

Re: [Numpy-discussion] nearing a milestone

2011-04-01 Thread Benjamin Root
pr 1, 2011 at 8:24 PM, Benjamin Root wrote: > > Yeah, but they have been downhill since November... > > > > On Fri, Apr 1, 2011 at 1:19 PM, Darren Dale wrote: > >> > >> Numpy is nearing a milestone: > >> > >> > http://sourceforge.net/

Re: [Numpy-discussion] Beginner's question

2011-04-16 Thread Benjamin Root
On Saturday, April 16, 2011, Laszlo Nagy wrote: > >   Hi All, > > I have this example program: > > import numpy as np > import numpy.random as rnd > > def dim_weight(X): >     weights = X[0] >     volumes = X[1]*X[2]*X[3] >     res = np.empty(len(volumes), dtype=np.double) >     for i,v in en

Re: [Numpy-discussion] general newbie question about applying an arbitrary function to all elements in a numpy array

2011-05-03 Thread Benjamin Root
On Tue, May 3, 2011 at 6:58 PM, Michael Katz wrote: > I have a basic question about applying functions to array elements. There > is a rambling introduction here and then I get to the ACTUAL QUESTION about > 2/3 of the way down. > > RAMBLING INTRODUCTION > > I was trying to do a simple mapping of

Re: [Numpy-discussion] ANN: Numpy 1.6.0 release candidate 2

2011-05-04 Thread Benjamin Root
On Tue, May 3, 2011 at 1:18 PM, Ralf Gommers wrote: > Hi, > > I am pleased to announce the availability of the second release > candidate of NumPy 1.6.0. > > Compared to the first release candidate, one segfault on (32-bit > Windows + MSVC) and several memory leaks were fixed. If no new > problems

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-04 Thread Benjamin Root
On Wed, May 4, 2011 at 7:54 PM, Derek Homeier < de...@astro.physik.uni-goettingen.de> wrote: > On 05.05.2011, at 2:40AM, Paul Anton Letnes wrote: > > > But: Isn't the numpy.atleast_2d and numpy.atleast_1d functions written > for this? Shouldn't we reuse them? Perhaps it's overkill, and perhaps it

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-05 Thread Benjamin Root
On Wed, May 4, 2011 at 11:08 PM, Paul Anton Letnes < paul.anton.let...@gmail.com> wrote: > > On 4. mai 2011, at 20.33, Benjamin Root wrote: > > > On Wed, May 4, 2011 at 7:54 PM, Derek Homeier < > de...@astro.physik.uni-goettingen.de> wrote: > > On 05.05.2011

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-05 Thread Benjamin Root
On Thu, May 5, 2011 at 10:49 AM, Benjamin Root wrote: > > > On Wed, May 4, 2011 at 11:08 PM, Paul Anton Letnes < > paul.anton.let...@gmail.com> wrote: > >> >> On 4. mai 2011, at 20.33, Benjamin Root wrote: >> >> > On Wed, May 4, 2011 at 7:

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-05 Thread Benjamin Root
On Thu, May 5, 2011 at 1:08 PM, Paul Anton Letnes < paul.anton.let...@gmail.com> wrote: > > On 5. mai 2011, at 08.49, Benjamin Root wrote: > > > > > > > On Wed, May 4, 2011 at 11:08 PM, Paul Anton Letnes < > paul.anton.let...@gmail.com> wrote: > > &

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-05 Thread Benjamin Root
On Thu, May 5, 2011 at 2:33 PM, Ralf Gommers wrote: > > > On Thu, May 5, 2011 at 9:18 PM, Benjamin Root wrote: > >> >> >> On Thu, May 5, 2011 at 1:08 PM, Paul Anton Letnes < >> paul.anton.let...@gmail.com> wrote: >> >>> >>> On 5.

Re: [Numpy-discussion] Linear assignment problem: Jonker-Volgenant algorithm

2011-05-17 Thread Benjamin Root
On Tue, May 17, 2011 at 12:49 PM, Gael Varoquaux < gael.varoqu...@normalesup.org> wrote: > On Tue, May 17, 2011 at 09:36:40AM -0700, Hoyt Koepke wrote: > > > OK, your input is making my motivation to fight with Jonker-Volgenant > go > > > down. I'll see with the other people involved if we still t

Re: [Numpy-discussion] loadtxt ndmin option

2011-05-31 Thread Benjamin Root
On Tue, May 31, 2011 at 10:33 AM, Bruce Southey wrote: > On 05/31/2011 10:18 AM, Pierre GM wrote: > > On May 31, 2011, at 4:53 PM, Derek Homeier wrote: > > > >> Hi Chris, > >> > >> On 31 May 2011, at 13:56, cgraves wrote: > >> > >>> I've downloaded the latest numpy (1.6.0) and loadtxt has the ndm

Re: [Numpy-discussion] New functions.

2011-05-31 Thread Benjamin Root
On Tue, May 31, 2011 at 8:18 PM, Warren Weckesser < warren.weckes...@enthought.com> wrote: > > > On Tue, May 31, 2011 at 8:08 PM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > >> Hi All, >> >> I've been contemplating new functions that could be added to numpy and >> thought I'd run them

Re: [Numpy-discussion] New functions.

2011-05-31 Thread Benjamin Root
On Tue, May 31, 2011 at 8:26 PM, Charles R Harris wrote: > > > On Tue, May 31, 2011 at 7:18 PM, Warren Weckesser < > warren.weckes...@enthought.com> wrote: > >> >> >> On Tue, May 31, 2011 at 8:08 PM, Charles R Harris < >> charlesr.har...@gmail.com> wrote: >> >>> Hi All, >>> >>> I've been contempl

Re: [Numpy-discussion] fixing up datetime

2011-06-02 Thread Benjamin Root
On Thu, Jun 2, 2011 at 11:42 AM, Mark Wiebe wrote: > On Thu, Jun 2, 2011 at 11:22 AM, Christopher Barker > wrote: > >> Charles R Harris wrote: >> > Good support for units and delta times is very useful, but >> > parsing dates and times and handling timezones, daylight savings, leap >> > seconds

Re: [Numpy-discussion] Current datetime pull requests ready for review

2011-06-08 Thread Benjamin Root
On Wednesday, June 8, 2011, Mark Wiebe wrote: > I've been trying to separate out the features I've been doing into separate > branches so I can split up into multiple pull, but the development I'm doing > works pretty poorly with this workflow. Nearly every step of development > builds on or us

[Numpy-discussion] numpy type mismatch

2011-06-10 Thread Benjamin Root
Came across an odd error while using numpy master. Note, my system is 32-bits. >>> import numpy as np >>> type(np.sum([1, 2, 3], dtype=np.int32)) == np.int32 False >>> type(np.sum([1, 2, 3], dtype=np.int64)) == np.int64 True >>> type(np.sum([1, 2, 3], dtype=np.float32)) == np.float32 True >>> typ

Re: [Numpy-discussion] numpy type mismatch

2011-06-10 Thread Benjamin Root
On Fri, Jun 10, 2011 at 3:02 PM, Charles R Harris wrote: > > > On Fri, Jun 10, 2011 at 1:50 PM, Benjamin Root wrote: > >> Came across an odd error while using numpy master. Note, my system is >> 32-bits. >> >> >>> import numpy as np >> >

Re: [Numpy-discussion] numpy type mismatch

2011-06-10 Thread Benjamin Root
On Friday, June 10, 2011, Olivier Delalleau wrote: > It's ok to have two different dtypes (in the sense that "d1 is not d2") such > that they represent the same kind of data (in the sense that d1 == d2). Note that the memory addresses for int64, float32 and float64 accumulators did match the exp

Re: [Numpy-discussion] numpy type mismatch

2011-06-10 Thread Benjamin Root
On Fri, Jun 10, 2011 at 3:24 PM, Charles R Harris wrote: > > > On Fri, Jun 10, 2011 at 2:17 PM, Benjamin Root wrote: > >> >> >> On Fri, Jun 10, 2011 at 3:02 PM, Charles R Harris < >> charlesr.har...@gmail.com> wrote: >> >>> >

Re: [Numpy-discussion] numpy type mismatch

2011-06-10 Thread Benjamin Root
On Fri, Jun 10, 2011 at 8:51 PM, Keith Goodman wrote: > On Fri, Jun 10, 2011 at 6:35 PM, Charles R Harris > wrote: > > On Fri, Jun 10, 2011 at 5:19 PM, Olivier Delalleau > wrote: > > >> But isn't it a bug if numpy.dtype('i') != numpy.dtype('l') on a 32 bit > >> computer where both are int32? >

Re: [Numpy-discussion] numpy type mismatch

2011-06-10 Thread Benjamin Root
On Fri, Jun 10, 2011 at 9:03 PM, Pauli Virtanen wrote: > On Fri, 10 Jun 2011 18:51:14 -0700, Keith Goodman wrote: > [clip] > > Maybe this is the same question, but are you maybe yes, maybe no on this > > too: > > > > >>> type(np.sum([1, 2, 3], dtype=np.int32)) == np.int32 > > False > > No

Re: [Numpy-discussion] numpy type mismatch

2011-06-10 Thread Benjamin Root
rles R Harris >>>> >>>>> >>>>> >>>>> On Fri, Jun 10, 2011 at 3:43 PM, Benjamin Root wrote: >>>>> >>>>>> >>>>>> >>>>>> On Fri, Jun 10, 2011 at 3:24 PM, Charles R Harris < >&

Re: [Numpy-discussion] numpy type mismatch

2011-06-10 Thread Benjamin Root
On Fri, Jun 10, 2011 at 10:34 PM, Olivier Delalleau wrote: > 2011/6/10 Benjamin Root > >> >> >> On Fri, Jun 10, 2011 at 9:29 PM, Olivier Delalleau wrote: >> >>> >>> 2011/6/10 Olivier Delalleau >>> >>>> 2011/6/10 Charles R Ha

Re: [Numpy-discussion] datetimes with date vs time units, local time, and time zones

2011-06-16 Thread Benjamin Root
On Wednesday, June 15, 2011, Mark Wiebe wrote: > Towards a reasonable behavior with regard to local times, I've made the > default repr for datetimes use the C standard library to print them in a > local ISO format. Combined with the ISO8601-prescribed behavior of > interpreting datetime string

[Numpy-discussion] unwrap for masked arrays?

2011-06-17 Thread Benjamin Root
It does not appear that unwrap works properly for masked arrays. First, it uses np.asarray() at the start of the function. However, that alone would not fix the problem given the nature of how unwrap works (performing diff operations). I tried a slightly modified version of unwrap, but I could n

Re: [Numpy-discussion] unwrap for masked arrays?

2011-06-17 Thread Benjamin Root
On Fri, Jun 17, 2011 at 1:26 PM, Eric Firing wrote: > On 06/17/2011 06:56 AM, Benjamin Root wrote: > > It does not appear that unwrap works properly for masked arrays. First, > > it uses np.asarray() at the start of the function. However, that alone > > would not fix

[Numpy-discussion] crash in multiarray

2011-06-17 Thread Benjamin Root
Using the master branch, I was running the scipy tests when a crash occurred. I believe the crash originates within numpy. The tests for numpy do pass on my machine (F15, x86_64, python 2.7). Below is the backtrace: *** glibc detected *** python: double free or corruption (!prev): 0x052

Re: [Numpy-discussion] crash in multiarray

2011-06-17 Thread Benjamin Root
On Fri, Jun 17, 2011 at 3:07 PM, Robert Kern wrote: > On Fri, Jun 17, 2011 at 15:03, Benjamin Root wrote: > > Using the master branch, I was running the scipy tests when a crash > > occurred. I believe the crash originates within numpy. The tests for > numpy > > do

Re: [Numpy-discussion] crash in multiarray

2011-06-17 Thread Benjamin Root
On Fri, Jun 17, 2011 at 3:48 PM, Pauli Virtanen wrote: > On Fri, 17 Jun 2011 15:39:21 -0500, Robert Kern wrote: > [clip] > >> File > >> > "/home/bvr/Programs/scipy/scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py", > >> line 378 in test_ticket_1459_arpack_crash > > > > Well, if it's testing

Re: [Numpy-discussion] argmax for top N elements

2011-06-22 Thread Benjamin Root
On Wed, Jun 22, 2011 at 2:08 PM, RadimRehurek wrote: > > Date: Wed, 22 Jun 2011 11:30:47 -0400 > > From: Alex Flint > > Subject: [Numpy-discussion] argmax for top N elements > > > > Is it possible to use argmax or something similar to find the locations > of > > the largest N elements in a matrix

Re: [Numpy-discussion] feedback request: proposal to add masks to the core ndarray

2011-06-23 Thread Benjamin Root
On Thu, Jun 23, 2011 at 7:28 PM, Pierre GM wrote: > Sorry y'all, I'm just commenting bits by bits: > > "One key problem is a lack of orthogonality with other features, for > instance creating a masked array with physical quantities can't be done > because both are separate subclasses of ndarray.

Re: [Numpy-discussion] feedback request: proposal to add masks to the core ndarray

2011-06-23 Thread Benjamin Root
On Thu, Jun 23, 2011 at 8:41 PM, Nathaniel Smith wrote: > Internally, there are > a bunch of different NA values -- for floats it's a particular NaN, > for integers it's INT_MIN, for booleans it's 2 (IIRC), etc. So, Bender runs on R? (Sorry, couldn't resist. Futurama season premiere is tonigh

Re: [Numpy-discussion] feedback request: proposal to add masks to the core ndarray

2011-06-24 Thread Benjamin Root
On Fri, Jun 24, 2011 at 10:40 AM, Mark Wiebe wrote: > On Thu, Jun 23, 2011 at 7:56 PM, Benjamin Root wrote: > >> On Thu, Jun 23, 2011 at 7:28 PM, Pierre GM wrote: >> >>> Sorry y'all, I'm just commenting bits by bits: >>> >>> "One key

Re: [Numpy-discussion] feedback request: proposal to add masks to the core ndarray

2011-06-24 Thread Benjamin Root
;> > wrote: >> >> >> >> Hi, >> >> >> >> On Fri, Jun 24, 2011 at 10:09 PM, Benjamin Root >> wrote: >> >> ... >> >> > Again, there are pros and cons either way and I see them very >> orthogonal >> >&g

Re: [Numpy-discussion] feedback request: proposal to add masks to the core ndarray

2011-06-24 Thread Benjamin Root
On Fri, Jun 24, 2011 at 8:11 PM, Nathaniel Smith wrote: > On Fri, Jun 24, 2011 at 2:09 PM, Benjamin Root wrote: > > Another example of how we use masks in matplotlib is in pcolor(). We > have > > to combine the possible masks of X, Y, and V in both the x and y > direc

Re: [Numpy-discussion] Concepts for masked/missing data

2011-06-25 Thread Benjamin Root
On Sat, Jun 25, 2011 at 11:26 AM, Matthew Brett wrote: > Hi, > > On Sat, Jun 25, 2011 at 5:05 PM, Nathaniel Smith wrote: > > So obviously there's a lot of interest in this question, but I'm > > losing track of all the different issues that've being raised in the > > 150-post thread of doom. I thi

Re: [Numpy-discussion] Concepts for masked/missing data

2011-06-25 Thread Benjamin Root
On Sat, Jun 25, 2011 at 12:05 PM, Nathaniel Smith wrote: > On Sat, Jun 25, 2011 at 9:26 AM, Matthew Brett > wrote: > > So far I see the difference between 1) and 2) being that you cannot > > unmask. So, if you didn't even know you could unmask data, then it > > would not matter that 1) was bein

Re: [Numpy-discussion] Concepts for masked/missing data

2011-06-25 Thread Benjamin Root
On Sat, Jun 25, 2011 at 12:17 PM, Wes McKinney wrote: > > Agree. My basic observation about numpy.ma is that it's a finely > crafted solution for a different set of problems than the ones I have. > I just don't want the same thing to happen here so I'm stuck writing > code (like I am now) that lo

Re: [Numpy-discussion] Concepts for masked/missing data

2011-06-25 Thread Benjamin Root
On Sat, Jun 25, 2011 at 1:57 PM, Nathaniel Smith wrote: > On Sat, Jun 25, 2011 at 11:50 AM, Eric Firing wrote: > > On 06/25/2011 07:05 AM, Nathaniel Smith wrote: > >> On Sat, Jun 25, 2011 at 9:26 AM, Matthew Brett > wrote: > >>> To clarify, you're proposing for: > >>> > >>> a = np.sum(np.array(

Re: [Numpy-discussion] Concepts for masked/missing data

2011-06-25 Thread Benjamin Root
On Sat, Jun 25, 2011 at 1:18 PM, Alan G Isaac wrote: > On 6/25/2011 2:06 PM, Benjamin Root wrote: > > Note that "np.sum([])" also returns 0.0. I think the > > reason why it has been returning zero instead of NaN was > > because there wasn't a NaN

Re: [Numpy-discussion] feedback request: proposal to add masks to the core ndarray

2011-06-25 Thread Benjamin Root
On Sat, Jun 25, 2011 at 9:21 AM, Charles R Harris wrote: > > I think he aims to support both. One complication with masks is keeping > them tied to the data on disk. With na values one file can contain both the > data and the missing data markers, whereas with masks, two files would be > required

Re: [Numpy-discussion] data type specification when using numpy.genfromtxt

2011-06-26 Thread Benjamin Root
On Sun, Jun 26, 2011 at 2:27 PM, Derek Homeier < de...@astro.physik.uni-goettingen.de> wrote: > On 26.06.2011, at 8:48PM, Chao YUE wrote: > > > I want to read a csv file with many (49) columns, the first column is > string and remaning can be float. > > how can I avoid type in like > > > > data=nu

[Numpy-discussion] histogram2d error with empty inputs

2011-06-27 Thread Benjamin Root
I found another empty input edge case. Somewhat recently, we fixed an issue with np.histogram() and empty inputs (so long as the bins are somehow known). >>> np.histogram([], bins=4) (array([0, 0, 0, 0]), array([ 0. , 0.25, 0.5 , 0.75, 1. ])) However, histogram2d needs the same treatment.

Re: [Numpy-discussion] Recommndations for an easy GUI

2011-06-27 Thread Benjamin Root
On Monday, June 27, 2011, Nadav Horesh wrote: > > > > > > > > I have an application which generates and displays RGB images as rate of > several frames/seconds (5-15). Currently I use Tkinter+PIL, but I have a > problem that it slows down the rate significantly. > I am looking for a fast and ea

Re: [Numpy-discussion] alterNEP - was: missing data discussion round 2

2011-07-01 Thread Benjamin Root
On Fri, Jul 1, 2011 at 11:00 AM, Matthew Brett wrote: > > > You can't switch between the two approaches without big changes in your > > code. > > > > Lluis provided a case, and it was obscure. That switch seems like a > rare or non-existent use-case that should not guide the API. > > Just to resp

Re: [Numpy-discussion] alterNEP - was: missing data discussion round 2

2011-07-01 Thread Benjamin Root
On Fri, Jul 1, 2011 at 11:20 AM, Matthew Brett wrote: > Hi, > > On Fri, Jul 1, 2011 at 5:17 PM, Benjamin Root wrote: > > > > > > On Fri, Jul 1, 2011 at 11:00 AM, Matthew Brett > > wrote: > >> > >> > You can't switch between t

Re: [Numpy-discussion] Moving lib.recfunctions?

2011-07-01 Thread Benjamin Root
On Fri, Jul 1, 2011 at 12:59 PM, Skipper Seabold wrote: > lib.recfunctions has never been fully advertised. The two bugs I just > discovered lead me to believe that it's not that well vetted, but it > is useful. I can't be the only one using these? > > Nope, you aren't the only one. I use them in

Re: [Numpy-discussion] conference call / gotomeeting to discuss the missing data design

2011-07-01 Thread Benjamin Root
On Fri, Jul 1, 2011 at 2:22 PM, Mark Wiebe wrote: > The missing data thread has gotten a bit heated, and after sitting down > with Travis to discuss the issues a bit, we've concluded that it would be > nice to do a call with everyone who's interested in the discussion with > better communication

Re: [Numpy-discussion] alterNEP - was: missing data discussion round 2

2011-07-02 Thread Benjamin Root
On Fri, Jul 1, 2011 at 11:40 PM, Nathaniel Smith wrote: > > I'm not sure what you mean here. If we have masked array support at > all (and some people seem to want it), then we have to say more than > "it's an array with a mask". Indexing such a beast has to do > *something*, so we need some kind

Re: [Numpy-discussion] Missing/accumulating data

2011-07-05 Thread Benjamin Root
On Tue, Jul 5, 2011 at 11:34 AM, Chris Barker wrote: > > Speaking of which, would we make the NA value be false? > > The NEP currently states that accessing np.NA as a boolean will act as an error. However, logical_and([NA, False]) == False and logical_or([NA, True]) will be special-cased. This

Re: [Numpy-discussion] NA/Missing Data Conference Call Summary

2011-07-05 Thread Benjamin Root
Thanks for these notes. Just a couple of thoughts as I looked over these notes. On Tue, Jul 5, 2011 at 6:46 PM, Christopher Jordan-Squire wrote: > 3. Using IGNORE to signal a jagged array. e.g., [ [1, 2, IGNORE], [IGNORE, > 3, 4] ] should behave exactly the same as [ [1 , 2] , [3 , 4] ]. Though

Re: [Numpy-discussion] using the same vocabulary for missing value ideas

2011-07-06 Thread Benjamin Root
On Wed, Jul 6, 2011 at 12:01 PM, Matthew Brett wrote: > Hi, > > On Wed, Jul 6, 2011 at 5:48 PM, Peter > wrote: > > On Wed, Jul 6, 2011 at 5:38 PM, Matthew Brett > wrote: > >> > >> Hi, > >> > >> On Wed, Jul 6, 2011 at 4:40 PM, Mark Wiebe wrote: > >>> It appears to me that one of the biggest reas

Re: [Numpy-discussion] histogram2d error with empty inputs

2011-07-06 Thread Benjamin Root
On Wednesday, July 6, 2011, Ralf Gommers wrote: > > > On Mon, Jun 27, 2011 at 9:38 PM, Benjamin Root wrote: > > I found another empty input edge case.  Somewhat recently, we fixed an issue > with np.histogram() and empty inputs (so long as the bins are somehow known). &

Re: [Numpy-discussion] using the same vocabulary for missing value ideas

2011-07-06 Thread Benjamin Root
On Wednesday, July 6, 2011, Dag Sverre Seljebotn wrote: > On 07/06/2011 08:25 PM, Christopher Barker wrote: >> Mark Wiebe wrote: >>> 1) NA vs IGNORE and bitpattern vs mask are completely independent. Any >>> combination of NA as bitpattern, NA as mask, IGNORE as bitpattern, and >>> IGNORE as mask

[Numpy-discussion] using the same vocabulary for missing value ideas

2011-07-06 Thread Benjamin Root
On Wednesday, July 6, 2011, Christopher Jordan-Squire wrote: > > > On Wed, Jul 6, 2011 at 5:03 PM, Benjamin Root wrote: > > On Wednesday, July 6, 2011, Dag Sverre Seljebotn > wrote: >> On 07/06/2011 08:25 PM, Christopher Barker wrote: >>> Mark Wiebe wrote: >&

[Numpy-discussion] type-casting differences for comparisons

2011-07-14 Thread Benjamin Root
I just came across a real-head scratcher that took me a bit to figure out. I don't know if it counts as a bug or not. I have an array with dtype "f4" and a separate python float. Some elements of this array gets assigned this numpy float64 scalar value. (I know, I should be better off with a mask,

[Numpy-discussion] Problem with boolean-indexing of structured arrays

2011-07-16 Thread Benjamin Root
Just a heads-up, I have uncovered a serious bug in one of my programs and traced it down to a boolean indexing of a structured array in the current master branch of numpy. While I am still investigating exactly what is happening, my initial suspicion is that data from another structured array is

Re: [Numpy-discussion] Problem with boolean-indexing of structured arrays

2011-07-16 Thread Benjamin Root
On Sat, Jul 16, 2011 at 2:12 PM, Benjamin Root wrote: > Just a heads-up, I have uncovered a serious bug in one of my programs and > traced it down to a boolean indexing of a structured array in the current > master branch of numpy. While I am still investigating exactly what is > h

Re: [Numpy-discussion] Array vectorization in numpy

2011-07-20 Thread Benjamin Root
On Wednesday, July 20, 2011, Carlos Becker wrote: > Those are very interesting examples. I think that pre-allocation is very > important, and something similar happens in Matlab if no pre-allocation is > done: it takes 3-4x longer than with pre-allocation.The main difference is > that Matlab is

Re: [Numpy-discussion] code review/build & test for datetime business day API

2011-07-25 Thread Benjamin Root
On Monday, July 25, 2011, Gael Varoquaux wrote: > On Mon, Jul 25, 2011 at 03:52:48PM -0500, Mark Wiebe wrote: >>Can't use numpy.datetime, since that conflicts with Python's datetime >>library, especially in pylab. > > I don't understand that: isn't the point of namespaces to avoid those >

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-29 Thread Benjamin Root
On Fri, Jul 29, 2011 at 10:07 AM, Mark Wiebe wrote: > On Thu, Jul 28, 2011 at 9:58 AM, Hans Meine < > me...@informatik.uni-hamburg.de> wrote: > >> Hi again! >> >> Am Donnerstag, 21. Juli 2011, 16:56:21 schrieb Hans Meine: >> > import numpy >> > >> > class Test(numpy.ndarray): >> > pass >> > >

Re: [Numpy-discussion] Quaternion dtype for NumPy - initial implementation available

2011-07-29 Thread Benjamin Root
On Fri, Jul 29, 2011 at 2:52 PM, Charles R Harris wrote: > > > On Fri, Jul 29, 2011 at 11:07 AM, Martin Ling wrote: > >> On Fri, Jul 29, 2011 at 09:14:00AM -0600, Charles R Harris wrote: >> > >> >Well, if the shuttle used a different definition then it was out >> there >> >somewhere. The

[Numpy-discussion] bug with assignment into an indexed array?

2011-08-10 Thread Benjamin Root
Came across this today when trying to determine what was wrong with my code: import numpy as np matched_to = np.array([-1] * 5) in_ellipse = np.array([False, True, True, True, False]) match = np.array([False, True, True]) matched_to[in_ellipse][match] = 3 I would expect matched_to to now be "arra

Re: [Numpy-discussion] bug with assignment into an indexed array?

2011-08-11 Thread Benjamin Root
On Thu, Aug 11, 2011 at 8:37 AM, Olivier Delalleau wrote: > Maybe confusing, but working as expected. > > > When you write: > matched_to[np.array([0, 1, 2])] = 3 > it calls __setitem__ on matched_to, with arguments (np.array([0, 1, 2]), > 3). So numpy understand you want to write 3 at these ind

Re: [Numpy-discussion] bug with assignment into an indexed array?

2011-08-11 Thread Benjamin Root
On Thu, Aug 11, 2011 at 10:33 AM, Olivier Delalleau wrote: > 2011/8/11 Benjamin Root > >> >> >> On Thu, Aug 11, 2011 at 8:37 AM, Olivier Delalleau wrote: >> >>> Maybe confusing, but working as expected. >>> >>> >>> When

Re: [Numpy-discussion] bug with assignment into an indexed array?

2011-08-17 Thread Benjamin Root
On Sat, Aug 13, 2011 at 7:17 PM, Mark Wiebe wrote: > On Thu, Aug 11, 2011 at 1:37 PM, Benjamin Root wrote: > >> On Thu, Aug 11, 2011 at 10:33 AM, Olivier Delalleau wrote: >> >>> 2011/8/11 Benjamin Root >>> >>>> >>>> &

[Numpy-discussion] Can't mix np.newaxis with boolean indexing

2011-08-19 Thread Benjamin Root
I could have sworn that this use to work: import numpy as np a = np.random.random((100,)) b = (a > 0.5) print a[b, np.newaxis] But instead, I get this error on the latest master: Traceback (most recent call last): File "", line 1, in TypeError: long() argument must be a string or a number, no

Re: [Numpy-discussion] Can't mix np.newaxis with boolean indexing

2011-08-20 Thread Benjamin Root
On Sat, Aug 20, 2011 at 2:47 AM, Olivier Verdier wrote: > Your syntax is not as intuitive as you may think. > > Suppose I take a matrix instead > > a = np.array([1,2,3,4]).reshape(2,2) > b = (a>1) # np.array([[False,True],[True,True]]) > > How would a[b,np.newaxis] be supposed to work? > > Note t

Re: [Numpy-discussion] Can't mix np.newaxis with boolean indexing

2011-08-21 Thread Benjamin Root
On Sunday, August 21, 2011, Torgil Svensson wrote: > Since the result is one-dimensional after using boolean indexing you > can always do: > > a[b][:, np.newaxis] > array([[2], > [3], > [4]]) > > a[b][np.newaxis, :] > array([[2, 3, 4]]) > > //Torgil Correct, which I already noted

Re: [Numpy-discussion] Functions for finding the relative extrema of numeric data

2011-09-13 Thread Benjamin Root
On Tue, Sep 13, 2011 at 3:34 PM, Ralf Gommers wrote: > Hi Jacob, > > On Fri, Sep 9, 2011 at 11:57 PM, Jacob Silterra wrote: > >> Hello all, >> >> I'd like to see functions for calculating the relative extrema in a set of >> data included in numpy. I use that functionality frequently, and always s

Re: [Numpy-discussion] load from text files Pull Request Review

2011-09-14 Thread Benjamin Root
On Wed, Sep 14, 2011 at 4:25 PM, Christopher Barker wrote: > On 9/14/11 1:01 PM, Christopher Barker wrote: > > numpy.ndarray.resize is a different method, and I'm pretty sure it > > should be as fast or faster that np.empty + np.append. > > My profile: > > In [25]: %timeit f1 # numpy.resize() > 10

[Numpy-discussion] can't use argmin for array of timedeltas

2011-09-15 Thread Benjamin Root
I encountered something similar back in April or so and that it was fixed. The problem was that the minimum function was implemented as max(0 - a), and so this fails for timedelta objects that can't do this. This was fixed for min(), but apparently not for argmin(). Ben Root _

Re: [Numpy-discussion] can't use argmin for array of timedeltas

2011-09-15 Thread Benjamin Root
On Thu, Sep 15, 2011 at 2:49 PM, Benjamin Root wrote: > I encountered something similar back in April or so and that it was fixed. > The problem was that the minimum function was implemented as max(0 - a), and > so this fails for timedelta objects that can't do this. This was f

[Numpy-discussion] Difficulty using special types like timedelta and Decimal

2011-09-16 Thread Benjamin Root
Certain numerical types in Python that support accurate fractional calculations such as timedelta and Decimal do not allow for multiplication or division by a floating point number, but do allow for use with an integer. This can cause difficulties with some functions such as np.gradient() which ha

Re: [Numpy-discussion] Indexing by label in 3rd dimension

2011-09-16 Thread Benjamin Root
On Friday, September 16, 2011, Benjamin Landenberger < benjamin.landenber...@imtek.uni-freiburg.de> wrote: > Hello list! > > I have an array *mask* of shape (a, b) and another array *intensities* > of shape (N, a, b), where the values in *mask* range from 0 to N-1. It > is somehow similar to label

Re: [Numpy-discussion] Indexing by label in 3rd dimension

2011-09-16 Thread Benjamin Root
On Friday, September 16, 2011, Benjamin Root wrote: > > > On Friday, September 16, 2011, Benjamin Landenberger < benjamin.landenber...@imtek.uni-freiburg.de> wrote: >> Hello list! >> >> I have an array *mask* of shape (a, b) and another array *intensities* >&g

Re: [Numpy-discussion] Difficulty using special types like timedelta and Decimal

2011-09-16 Thread Benjamin Root
On Friday, September 16, 2011, Charles R Harris wrote: > > > On Fri, Sep 16, 2011 at 9:11 AM, Benjamin Root wrote: >> >> Certain numerical types in Python that support accurate fractional calculations such as timedelta and Decimal do not allow for multiplication or divisio

Re: [Numpy-discussion] Difficulty using special types like timedelta and Decimal

2011-09-16 Thread Benjamin Root
On Fri, Sep 16, 2011 at 11:35 AM, Benjamin Root wrote: > > > On Friday, September 16, 2011, Charles R Harris > wrote: > > > > > > On Fri, Sep 16, 2011 at 9:11 AM, Benjamin Root wrote: > >> > >> Certain numerical types in Python that support accu

[Numpy-discussion] type-casting inconsistency with timedelta64

2011-09-16 Thread Benjamin Root
Came across an oddity when experimenting with the datetime64 and timedelta64 objects. a = np.zeros((10,), dtype='l') b = np.datetime64('2010-12-20T14:23:56-0600') c = np.datetime64('2010-12-20T21:27:09-0600') a[0:1] = c - b # This works fine a[0] = c - b # This does not The second assignm

[Numpy-discussion] datetime64 y2k38 bug

2011-09-18 Thread Benjamin Root
I was working on adding some test cases in numpy for the argmin/max functions with some datetime64s. I found that on my 32-bit machine, it fails to parse a date past the Y2.038k date. I find this odd because the datetime is supposed to be 64-bits, but I guess there is some arch-dependent code som

Re: [Numpy-discussion] datetime64 y2k38 bug

2011-09-18 Thread Benjamin Root
On Sunday, September 18, 2011, Charles R Harris wrote: > > > On Sun, Sep 18, 2011 at 6:32 PM, Benjamin Root wrote: >> >> I was working on adding some test cases in numpy for the argmin/max functions with some datetime64s. I found that on my 32-bit machine, it fails to

Re: [Numpy-discussion] what python module to modify NetCDF data?

2011-10-08 Thread Benjamin Root
On Saturday, October 8, 2011, Kiko wrote: > Quoting Chao YUE : >> >> > Dear all, >> > >> > I want to change some variable values in a series of NetCDF file. Did >> > anybody else did this before using python? >> > Now I use pupynere for reading data from NetCDF files and making plots. but >> > the

Re: [Numpy-discussion] abs for max negative integers - desired behavior?

2011-10-11 Thread Benjamin Root
On Tue, Oct 11, 2011 at 2:51 PM, Matthew Brett wrote: > Hi > > On Tue, Oct 11, 2011 at 3:16 PM, Charles R Harris > wrote: > > > > > > On Tue, Oct 11, 2011 at 12:23 PM, Matthew Brett > > > wrote: > >> > >> Hi, > >> > >> I recently ran into this: > >> > >> In [68]: arr = np.array(-128, np.int8) >

Re: [Numpy-discussion] Nice float -> integer conversion?

2011-10-11 Thread Benjamin Root
On Tue, Oct 11, 2011 at 2:06 PM, Derek Homeier < de...@astro.physik.uni-goettingen.de> wrote: > On 11 Oct 2011, at 20:06, Matthew Brett wrote: > > > Have I missed a fast way of doing nice float to integer conversion? > > > > By nice I mean, rounding to the nearest integer, converting NaN to 0, > >

<    1   2   3   4   5   6   7   >