[Numpy-discussion] reading binary Fortran

2009-02-03 Thread Catherine Moroney
I've noticed a lot of discussion on how to read binary files written out from Fortran, and nobody seems to have mentioned how to modify your Fortran code so it writes out a file that can be read with numpy.fromfile() in a single line. For example, to write out a NLINE x NSMP array of floats in For

[Numpy-discussion] difficulties with numpy.tofile()

2008-11-16 Thread Catherine Moroney
Hello, I'm having problems writing a 2-dimensional numpy array out to a binary file using the "tofile" method. The call to "tofile" appears to succeed, but when I check the length of the binary file I find that it's longer than what is expected, given the calculation of nrows*ncolumns*nbytes.

[Numpy-discussion] array indexing question

2008-11-13 Thread Catherine Moroney
Hello, I know that there must be a fast way of solving this problem, but I don't know what it is. I have three arrays, with dimensions: A[np] L[np] S[np] where L and S indicate the line, smp co-ordinates for each of the "np" rows. I want to reconstruct the contents of [A] as a 2-dimensional

[Numpy-discussion] f2py questions

2008-11-12 Thread Catherine Moroney
Hello, I'm not sure if this is the right list for this question, but attempts to subscribe myself to f2py-users fail, as I never get an email back asking me to confirm my subscription request. Is that list no longer active? I'm trying to compile a medium-short Fortran90 code using f2py, and ge

[Numpy-discussion] problem calling SD.SDim.setname in pyhdf

2008-09-29 Thread Catherine Moroney
Hi, I recently upgraded pyhdf from 0.7-3 to 0.8-2, and have noticed some problems with the SD.SDim interface. Specifically, the short test code attached works fine with version 0.7-3 and fails with version 0.8-2 when it's trying to assign a name to the dimension. I get the following error (below

Re: [Numpy-discussion] Numpy-discussion Digest, Vol 24, Issue 32

2008-09-11 Thread Catherine Moroney
I'm able to remove the file using python's "os" module, but I still get an error when trying to create the file using pyhdf, this time specifiying "SD.SDC.CREATE|SD.SDC.WRITE" on the file-create line. It's still complaining that it can't open the path, even though the specified filename is valid.

[Numpy-discussion] creating or truncating SD files in pyhdf

2008-09-11 Thread Catherine Moroney
What is the correct way to create an SD file (if it doesn't already exist), or truncate and then rewrite an existing one? Does it matter which order the file-access options are set? For instance, here's my code: self.flhdf_stereo = SD.SD(flname_stereo, \ SD.SDC.TRU

Re: [Numpy-discussion] subsampling array without loops

2008-08-25 Thread Catherine Moroney
This almost works. Is there a way to do some masking on tiles, for instance taking the maximum height of each 2x2 square that is an odd number? I've tried playing around with masking and where, but they don't return an array of the original size and shape of "tiles" below. Catherine > Perhaps

[Numpy-discussion] subsampling array without loops

2008-08-22 Thread Catherine Moroney
I'm looking for a way to acccomplish the following task without lots of loops involved, which are really slowing down my code. I have a 128x512 array which I want to break down into 2x2 squares. Then, for each 2x2 square I want to do some simple calculations such as finding the maximum value, whic

Re: [Numpy-discussion] Numpy-discussion Digest, Vol 22, Issue 33

2008-07-09 Thread Catherine Moroney
> > > 2008/7/9 Catherine Moroney <[EMAIL PROTECTED]>: > > > >> I have a question about performing element-wise logical operations > >> on numpy arrays. > >> > >> If "a", "b" and "c" are numpy arrays of the same

Re: [Numpy-discussion] Numpy-discussion Digest, Vol 22, Issue 32

2008-07-09 Thread Catherine Moroney
cal Python" > Subject: Re: [Numpy-discussion] element-wise logical operations on > numpy arrays > Reply-To: Discussion of Numerical Python > > > 2008/7/9 Catherine Moroney <[EMAIL PROTECTED]>: > >> I have a question about performing element-wise logical operatio

[Numpy-discussion] element-wise logical operations on numpy arrays

2008-07-09 Thread Catherine Moroney
Hello, I have a question about performing element-wise logical operations on numpy arrays. If "a", "b" and "c" are numpy arrays of the same size, does the following syntax work? mask = (a > 1.0) & ((b > 3.0) | (c > 10.0)) It seems to be performing correctly, but the documentation that I've