Re: [Numpy-discussion] tofile problems

2010-07-28 Thread Christopher Barker
Paul Probert wrote: >I'm trying to write numpy arrays as binary data, to support a legacy > file format. So I open a file and write to it: > > fp = open('somefile','w') > ... > oldpos = fp.tell() > somenumpyarray.tofile(fp) > newpos = fp.tell() > diff = newpos - oldpos - somenumpyarray.nbyte

[Numpy-discussion] tofile problems

2010-07-28 Thread Paul Probert
All, I'm trying to write numpy arrays as binary data, to support a legacy file format. So I open a file and write to it: fp = open('somefile','w') ... oldpos = fp.tell() somenumpyarray.tofile(fp) newpos = fp.tell() diff = newpos - oldpos - somenumpyarray.nbytes if diff != 0: print 'ahhah!

Re: [Numpy-discussion] Problem with importing numpy in Ubuntu

2010-07-28 Thread Fernando Perez
On Wed, Jul 28, 2010 at 12:36 PM, Fernando Perez wrote: > The official Python 2.x unicode story is well explained here: > http://docs.python.org/howto/unicode.html > > and here is the corresponding document for 3.x: > http://docs.python.org/release/3.1.2/howto/unicode.html Just in case you're sti

Re: [Numpy-discussion] str == int puzzlement

2010-07-28 Thread Sturla Molden
> >> I'll call this a bug in NumPy's broadcasting. "x == 1" should have >> returned: > > This is probably related: > > > In [22]: a = np.array(['a','b']) > > In [23]: a + 'c' > --- > TypeError Tr

Re: [Numpy-discussion] str == int puzzlement

2010-07-28 Thread Sturla Molden
> I'll call this a bug in NumPy's broadcasting. "x == 1" should have > returned: This is probably related: In [22]: a = np.array(['a','b']) In [23]: a + 'c' --- TypeError Traceback (most rec

Re: [Numpy-discussion] str == int puzzlement

2010-07-28 Thread Sturla Molden
> In [15]: x = np.array(['a', 'b']) > > In [16]: x == 'a' # this was what I expected > Out[16]: array([ True, False], dtype=bool) > > In [17]: x == 1 # this was strange to me > Out[17]: False > > Is it easy to explain why this is? I'll call this a bug in NumPy's broadcasting. "x == 1" should ha

Re: [Numpy-discussion] str == int puzzlement

2010-07-28 Thread John Salvatier
I think this is just Python behavior; comparing python ints and strs also gives False: In [45]: 8 == 'L' Out[45]: False On Wed, Jul 28, 2010 at 6:42 PM, Matthew Brett wrote: > Hi, > > Please forgive me if this is obvious, but this surprised me: > > In [15]: x = np.array(['a', 'b']) > > In [16]:

[Numpy-discussion] str == int puzzlement

2010-07-28 Thread Matthew Brett
Hi, Please forgive me if this is obvious, but this surprised me: In [15]: x = np.array(['a', 'b']) In [16]: x == 'a' # this was what I expected Out[16]: array([ True, False], dtype=bool) In [17]: x == 1 # this was strange to me Out[17]: False Is it easy to explain why this is? Thanks a lot,

Re: [Numpy-discussion] Numpy 1.4.1 fails to build on (Debian) alpha and powepc

2010-07-28 Thread David Cournapeau
On Wed, Jul 28, 2010 at 12:36 AM, Sandro Tosi wrote: > On Tue, Jul 27, 2010 at 14:52, Sandro Tosi wrote: >> Hi, >> >> On Tue, Jul 27, 2010 at 12:28, David Cournapeau wrote: >>> On Tue, Jul 20, 2010 at 3:44 AM, Sandro Tosi wrote: >>> ah if you say so, I trust you :) >>> >>> Could you try th

Re: [Numpy-discussion] Subclassing ndarray in C: getitem ?

2010-07-28 Thread Pierre GM
On Jul 28, 2010, at 7:52 PM, Pauli Virtanen wrote: > Wed, 28 Jul 2010 18:43:30 -0400, Pierre GM wrote: > [clip] >> Mmh. I did create a PyMappingMethod structure called MyArray_as_mapping, >> and MyArray_as_mapping.mp_subscript points to the function that I want >> to use. However, I'd like the My

Re: [Numpy-discussion] 1.5 release schedule proposal

2010-07-28 Thread Sturla Molden
> Mon, 26 Jul 2010 23:58:11 +0800, Ralf Gommers wrote: > Is the current algorithm in the trunk the ziggurat one, or the previous > one? IIRC, the problem was that the ziggurat broke reproducibility of > random numbers with a given seed. Ziggurat (in Enthought) did not break reproducibility but ba

Re: [Numpy-discussion] Subclassing ndarray in C: getitem ?

2010-07-28 Thread Pauli Virtanen
Wed, 28 Jul 2010 18:43:30 -0400, Pierre GM wrote: [clip] > Mmh. I did create a PyMappingMethod structure called MyArray_as_mapping, > and MyArray_as_mapping.mp_subscript points to the function that I want > to use. However, I'd like the MyArray_as_mapping.length and > MyArray.mp_ass_subscript to po

Re: [Numpy-discussion] ceil returns real ?

2010-07-28 Thread Pauli Virtanen
Thu, 29 Jul 2010 01:16:14 +0200, Sturla Molden wrote: [clip] >> Makes sense. But couldn't a ``dtype`` argument still be useful? > > np.ceil(some_array).astype(int) That's one temporary more. The dtype= argument for all ufuncs wouldn't probably hurt too much. -- Pauli Virtanen ___

Re: [Numpy-discussion] ceil returns real ?

2010-07-28 Thread Sturla Molden
>> Wed, 28 Jul 2010 14:26:36 +0200, Mark Bakker wrote: >>> > I don't understand why ceil and floor return real values [snip] >>> > Wouldn't an integer make more sense? > > > On 7/28/2010 9:39 AM, Pauli Virtanen wrote: >> Which integer? Only arbitrary-size integers (Python longs) are able to >> sp

Re: [Numpy-discussion] Subclassing ndarray in C: getitem ?

2010-07-28 Thread Pierre GM
On Jul 28, 2010, at 5:52 PM, Travis Oliphant wrote: > > On Jul 26, 2010, at 11:58 AM, Pierre GM wrote: > >> All, >> I'm teaching myself how to subclass ndarrays in C (not in Cython, just plain >> C). It's slowly coming together, but I'm now running into a problem: I need >> to overwrite __get

Re: [Numpy-discussion] Subclassing ndarray in C: getitem ?

2010-07-28 Thread Travis Oliphant
On Jul 26, 2010, at 11:58 AM, Pierre GM wrote: > All, > I'm teaching myself how to subclass ndarrays in C (not in Cython, just plain > C). It's slowly coming together, but I'm now running into a problem: I need > to overwrite __getitem__ and I'm not sure how to do it. I was thinking about > us

Re: [Numpy-discussion] 1.5 release schedule proposal

2010-07-28 Thread Robert Kern
On Wed, Jul 28, 2010 at 16:21, Pauli Virtanen wrote: > Mon, 26 Jul 2010 23:58:11 +0800, Ralf Gommers wrote: > [clip] >> If you have urgent tickets, please let's hear those as well. My small >> laundry list is pasted below. > > Was something done to the Gaussian random generator? > > Is the current

Re: [Numpy-discussion] 1.5 release schedule proposal

2010-07-28 Thread Pauli Virtanen
Mon, 26 Jul 2010 23:58:11 +0800, Ralf Gommers wrote: [clip] > If you have urgent tickets, please let's hear those as well. My small > laundry list is pasted below. Was something done to the Gaussian random generator? Is the current algorithm in the trunk the ziggurat one, or the previous one? II

Re: [Numpy-discussion] Is there anyway to read raw binary file via pytable?

2010-07-28 Thread Robert Kern
2010/7/28 Ken Watford : > 2010/7/28 脑关生命科学仪器 : >> it seems like pytable only support HDF5. I had some 500GB numerical arrays >> to process. Pytable claims to have some advance feature to enhance >> processing speed and largely reduce physical memory requirement. However, I >> do not wanna touch the

Re: [Numpy-discussion] Is there anyway to read raw binary file via pytable?

2010-07-28 Thread Ken Watford
2010/7/28 脑关生命科学仪器 : > it seems like pytable only support HDF5. I had some 500GB numerical arrays > to process. Pytable claims to have some advance feature to enhance > processing speed and largely reduce physical memory requirement. However, I > do not wanna touch the raw data I had. Simply becaus

Re: [Numpy-discussion] Is there anyway to read raw binary file via pytable?

2010-07-28 Thread Christopher Barker
Francesc Alted wrote: > A Wednesday 28 July 2010 18:05:11 脑关(BrainGateway)生命科学仪器 escrigué: >> I had some 500GB numerical arrays >> to process. Pytable claims to have some advance feature to enhance >> processing speed and largely reduce physical memory requirement. However, I >> do not wanna touch

Re: [Numpy-discussion] Problem with importing numpy in Ubuntu

2010-07-28 Thread Fernando Perez
On Tue, Jul 27, 2010 at 7:42 AM, Sebastian Haase wrote: > The origin of this problem is the fact that Python supports (at least) > 2 types of Unicode: > 2 bytes and/or 4 bytes per character. It only supports those two, and that's purely an internal implementation detail. Python can encode unicod

Re: [Numpy-discussion] Problem with importing numpy in Ubuntu

2010-07-28 Thread Robert Faryabi
Thanks, I did almost the same yesterday and now everything works fine. On Wed, Jul 28, 2010 at 4:29 AM, Sebastian Haase wrote: > You should be allowed to remove anything in /usr/local without fear to > kill your operation system. > In case you miss python2.5 afterwards, you should be able to just

Re: [Numpy-discussion] ceil returns real ?

2010-07-28 Thread Robert Kern
On Wed, Jul 28, 2010 at 11:48, Alan G Isaac wrote: >> Wed, 28 Jul 2010 14:26:36 +0200, Mark Bakker wrote: >>> >  I don't understand why ceil and floor return real values [snip] >>> >  Wouldn't an integer make more sense? > > On 7/28/2010 9:39 AM, Pauli Virtanen wrote: >> Which integer? Only arbitr

Re: [Numpy-discussion] how to add columns

2010-07-28 Thread wheres pythonmonks
Thank you -- just what I was looking for. On Wed, Jul 28, 2010 at 11:39 AM, Benjamin Root wrote: > On Wed, Jul 28, 2010 at 7:43 AM, wheres pythonmonks > wrote: >> >> I have a rec array and I want to add an additional column. >> >> I've seen at least two solutions to this problem: >> >> mlab.re

Re: [Numpy-discussion] ceil returns real ?

2010-07-28 Thread Alan G Isaac
> Wed, 28 Jul 2010 14:26:36 +0200, Mark Bakker wrote: >> > I don't understand why ceil and floor return real values [snip] >> > Wouldn't an integer make more sense? On 7/28/2010 9:39 AM, Pauli Virtanen wrote: > Which integer? Only arbitrary-size integers (Python longs) are able to > span the wh

Re: [Numpy-discussion] Is there anyway to read raw binary file via pytable?

2010-07-28 Thread Francesc Alted
A Wednesday 28 July 2010 18:05:11 脑关(BrainGateway)生命科学仪器 escrigué: > it seems like pytable only support HDF5. I had some 500GB numerical arrays > to process. Pytable claims to have some advance feature to enhance > processing speed and largely reduce physical memory requirement. However, I > do not

Re: [Numpy-discussion] Is there anyway to read raw binary file via pytable?

2010-07-28 Thread Robert Kern
2010/7/28 脑关生命科学仪器 : > it seems like pytable only support HDF5. I had some 500GB numerical arrays > to process. Pytable claims to have some advance feature to enhance > processing speed and largely reduce physical memory requirement. However, I > do not wanna touch the raw data I had. Simply becaus

[Numpy-discussion] Is there anyway to read raw binary file via pytable?

2010-07-28 Thread BrainGateway
it seems like pytable only support HDF5. I had some 500GB numerical arrays to process. Pytable claims to have some advance feature to enhance processing speed and largely reduce physical memory requirement. However, I do not wanna touch the raw data I had. Simply because I do not have doubled disks

Re: [Numpy-discussion] how to add columns

2010-07-28 Thread Benjamin Root
On Wed, Jul 28, 2010 at 7:43 AM, wheres pythonmonks < wherespythonmo...@gmail.com> wrote: > I have a rec array and I want to add an additional column. > > I've seen at least two solutions to this problem: > > mlab.rec_append_fields (matplotlib) > > And append_field from > http://mail.scipy.org/pip

Re: [Numpy-discussion] ceil returns real ?

2010-07-28 Thread Pauli Virtanen
Wed, 28 Jul 2010 14:26:36 +0200, Mark Bakker wrote: > I don't understand why ceil and floor return real values, while the doc > string says: > > The ceil of the scalar `x` is the smallest integer `i` > > Wouldn't an integer make more sense? Which integer? Only arbitrary-size integers (Python lon

Re: [Numpy-discussion] ceil returns real ?

2010-07-28 Thread Alan G Isaac
On 7/28/2010 8:26 AM, Mark Bakker wrote: > I don't understand why ceil and floor return real values The same for ``round``. (Note that Python 3 rounds to int.) Furthermore, it would be nice if each took a ``dtype`` argument. Alan Isaac ___ NumPy-Discus

Re: [Numpy-discussion] ceil returns real ?

2010-07-28 Thread Sebastian Haase
On Wed, Jul 28, 2010 at 2:26 PM, Mark Bakker wrote: > Hello list, > > I don't understand why ceil and floor return real values, while the doc > string says: > > The ceil of the scalar `x` is the smallest integer `i` > > Wouldn't an integer make more sense? > > Numpy version 1.3.0. > > Thanks, > Hi

Re: [Numpy-discussion] how to add columns

2010-07-28 Thread Pauli Virtanen
Wed, 28 Jul 2010 08:43:25 -0400, wheres pythonmonks wrote: [clip] > Is there a best solution? I don't like the matplotlib solution b/c of > the "dll-hell" anti-pattern. But the pure numpy solution looks like it > has too many copies. You cannot avoid making copies, since adding a new field chang

[Numpy-discussion] how to add columns

2010-07-28 Thread wheres pythonmonks
I have a rec array and I want to add an additional column. I've seen at least two solutions to this problem: mlab.rec_append_fields (matplotlib) And append_field from http://mail.scipy.org/pipermail/numpy-discussion/2007-September/029357.html In [19]: def append_field(rec, name, arr, dtype=None

[Numpy-discussion] ceil returns real ?

2010-07-28 Thread Mark Bakker
Hello list, I don't understand why ceil and floor return real values, while the doc string says: The ceil of the scalar `x` is the smallest integer `i` Wouldn't an integer make more sense? Numpy version 1.3.0. Thanks, Mark ___ NumPy-Discussion maili

Re: [Numpy-discussion] First shot at svn->git conversion

2010-07-28 Thread David
On 07/28/2010 05:45 PM, Pauli Virtanen wrote: > Wed, 28 Jul 2010 12:17:27 +0900, David Cournapeau wrote: > [clip] > http://github.com/numpy/numpy_svn >> >> I put a new repostory (same location) > > Some more notes: > > - 1.1.x branch is missing. > >This is maybe because in SVN something ugl

Re: [Numpy-discussion] First shot at svn->git conversion

2010-07-28 Thread Pauli Virtanen
Wed, 28 Jul 2010 12:17:27 +0900, David Cournapeau wrote: [clip] http://github.com/numpy/numpy_svn > > I put a new repostory (same location) Compared this against git-svn produced repository. There are a number of commits missing from the early history, apparently because numpy trunk was mo

Re: [Numpy-discussion] First shot at svn->git conversion

2010-07-28 Thread Pauli Virtanen
Wed, 28 Jul 2010 12:17:27 +0900, David Cournapeau wrote: [clip] http://github.com/numpy/numpy_svn > > I put a new repostory (same location) Some more notes: - 1.1.x branch is missing. This is maybe because in SVN something ugly was done with this branch? - Something is still funny with

Re: [Numpy-discussion] Problem with importing numpy in Ubuntu

2010-07-28 Thread Sebastian Haase
You should be allowed to remove anything in /usr/local without fear to kill your operation system. In case you miss python2.5 afterwards, you should be able to just install it with apt-get install python2.5 at any time - it would go to /usr/lib + /usr/bin + ... NOT /usr/local. It is unlikely that