Re: [Numpy-discussion] pareto docstring

2010-05-10 Thread josef . pktd
On Mon, May 10, 2010 at 2:14 PM, T J wrote: > On Sun, May 9, 2010 at 4:49 AM,   wrote: >> >> I think this is the same point, I was trying to make last year. >> >> Instead of renormalizing, my conclusion was the following, >> (copied from the mailinglist August last year) >> >> """ >> my conclusion

Re: [Numpy-discussion] efficient way to manage a set of floats?

2010-05-10 Thread Anne Archibald
On 10 May 2010 21:56, Dr. Phillip M. Feldman wrote: > > > Anne Archibald-2 wrote: >> >> on a 32-bit machine, >> the space overhead is roughly a 32-bit object pointer or two for each >> float, plus about twice the number of floats times 32-bit pointers for >> the table. >> > > Hello Anne, > > I'm a

Re: [Numpy-discussion] efficient way to manage a set of floats?

2010-05-10 Thread Warren Weckesser
Dr. Phillip M. Feldman wrote: > Anne Archibald-2 wrote: > >> on a 32-bit machine, >> the space overhead is roughly a 32-bit object pointer or two for each >> float, plus about twice the number of floats times 32-bit pointers for >> the table. >> >> > > Hello Anne, > > I'm a bit confused by

Re: [Numpy-discussion] efficient way to manage a set of floats?

2010-05-10 Thread Dr. Phillip M. Feldman
Anne Archibald-2 wrote: > > on a 32-bit machine, > the space overhead is roughly a 32-bit object pointer or two for each > float, plus about twice the number of floats times 32-bit pointers for > the table. > Hello Anne, I'm a bit confused by the above. It sounds as though the hash table app

Re: [Numpy-discussion] efficient way to manage a set of floats?

2010-05-10 Thread Anne Archibald
On 10 May 2010 18:53, Dr. Phillip M. Feldman wrote: > > I have an application that involves managing sets of floats.  I can use > Python's built-in set type, but a data structure that is optimized for > fixed-size objects that can be compared without hashing should be more > efficient than a more

[Numpy-discussion] efficient way to manage a set of floats?

2010-05-10 Thread Dr. Phillip M. Feldman
I have an application that involves managing sets of floats. I can use Python's built-in set type, but a data structure that is optimized for fixed-size objects that can be compared without hashing should be more efficient than a more general set construct. Is something like this available? --

Re: [Numpy-discussion] chararray stripping trailing whitespace a bug?

2010-05-10 Thread Neil Crighton
> This inconsistency is fixed in Numpy 1.4 (which included a major > overhaul of chararrays). in1d will perform the auto > whitespace-stripping on chararrays, but not on regular ndarrays of strings. Great, thanks. > Pyfits continues to use chararray since not doing so would break > existing c

Re: [Numpy-discussion] check for inequalities on a list

2010-05-10 Thread Alan G Isaac
On 5/10/2010 5:42 PM, gerardob wrote: > I would like to check whether lower_bound[i]<= x[i]<= upper_bound[i] for > all i in range(len(x)) >>> import numpy as np >>> l, m, u = np.arange(12).reshape((3,4)) >>> (l <= m) & (m <= u) array([ True, True, True, True], dtype=bool) >>> l[3]=9 >>> (l <=

[Numpy-discussion] check for inequalities on a list

2010-05-10 Thread gerardob
I have three lists of floats of equal lenght: upper_bound, lower_bound and x. I would like to check whether lower_bound[i]<= x[i] <= upper_bound[i] for all i in range(len(x)) Which is the best way to do this? Thanks. -- View this message in context: http://old.nabble.com/check-for-inequalit

Re: [Numpy-discussion] pareto docstring

2010-05-10 Thread David Goldsmith
On Mon, May 10, 2010 at 11:14 AM, T J wrote: > On Sun, May 9, 2010 at 4:49 AM, wrote: > > > > I think this is the same point, I was trying to make last year. > > > > Instead of renormalizing, my conclusion was the following, > > (copied from the mailinglist August last year) > > > > """ > > my

Re: [Numpy-discussion] chararray stripping trailing whitespace a bug?

2010-05-10 Thread Michael Droettboom
Also from the docstring: """ .. note:: The `chararray` class exists for backwards compatibility with Numarray, it is not recommended for new development. Starting from numpy 1.4, if one needs arrays of strings, it is recommended to use arrays of `dtype` `object_`, `string_` or `unicode

Re: [Numpy-discussion] Another masked array question

2010-05-10 Thread Pierre GM
On May 8, 2010, at 9:51 PM, Gökhan Sever wrote: > > > > On Sat, May 8, 2010 at 9:29 PM, Eric Firing wrote: > On 05/08/2010 04:16 PM, Ryan May wrote: > > On Sat, May 8, 2010 at 7:52 PM, Gökhan Sever wrote: > >> > >> AttributeError: can't set attribute > >> > >> Why this assignment fails? I want

Re: [Numpy-discussion] pareto docstring

2010-05-10 Thread T J
On Sun, May 9, 2010 at 4:49 AM, wrote: > > I think this is the same point, I was trying to make last year. > > Instead of renormalizing, my conclusion was the following, > (copied from the mailinglist August last year) > > """ > my conclusion: > - > What numpy.random.pareto ac

Re: [Numpy-discussion] chararray stripping trailing whitespace a bug?

2010-05-10 Thread Neil Crighton
> > This is an intentional "feature", not a bug. > > Chris > Ah, ok, thanks. I missed the explanation in the doc string because I'm using version 1.3 and forgot to check the web docs. For the record, this was my bug: I read a fits binary table with pyfits. One of the table fields was a chara

Re: [Numpy-discussion] Question about numpy.ma masking

2010-05-10 Thread Gökhan Sever
On Sun, May 9, 2010 at 2:42 PM, Eric Firing wrote: > > The mask attribute can be a full array, or it can be a scalar to > indicate that nothing is masked. This is an optimization in masked > arrays; it adds complexity, but it can save space and/or processing > time. You can always access a full

Re: [Numpy-discussion] chararray stripping trailing whitespace a bug?

2010-05-10 Thread Christopher Hanley
On Mon, May 10, 2010 at 11:23 AM, Neil Crighton wrote: > I've been working with pyfits, which uses numpy chararrays. I've discovered > the > hard way that chararrays silently remove trailing whitespace: > a = np.array(['a ']) b = a.view(np.chararray) a[0] > 'a ' b[0] > 'a' > >

Re: [Numpy-discussion] chararray stripping trailing whitespace a bug?

2010-05-10 Thread Warren Weckesser
From the chararray docstring: Versus a regular Numpy array of type `str` or `unicode`, this class adds the following functionality: 1) values automatically have whitespace removed from the end when indexed So I guess it is a feature, not a bug. :) Warren Neil Crig

[Numpy-discussion] chararray stripping trailing whitespace a bug?

2010-05-10 Thread Neil Crighton
I've been working with pyfits, which uses numpy chararrays. I've discovered the hard way that chararrays silently remove trailing whitespace: >>> a = np.array(['a ']) >>> b = a.view(np.chararray) >>> a[0] 'a ' >>> b[0] 'a' Note the string values stored in memory are unchanged. This behaviour ca