Re: [Numpy-discussion] tofile speed

2007-07-25 Thread Lars Friedrich
Hello, I tried the following: ### start code a = N.random.rand(100) myFile = file('test.bin', 'wb') for i in range(100): a.tofile(myFile) myFile.close() ### end code And this gives roughly 50 MB/s on my office-machine but only 6.5 MB/s on the machine that I was

Re: [Numpy-discussion] tofile speed

2007-07-25 Thread Charles R Harris
On 7/25/07, Lars Friedrich [EMAIL PROTECTED] wrote: Hello, I tried the following: ### start code a = N.random.rand(100) myFile = file('test.bin', 'wb') for i in range(100): a.tofile(myFile) myFile.close() ### end code And this gives roughly 50 MB/s on my

Re: [Numpy-discussion] tofile speed

2007-07-24 Thread Lars Friedrich
Hello everyone, thank you for the replies. Sebastian, the chunk size is roughly 4*10^6 samples, with two byte per sample, this is about 8MB. I can vary this size, but increasing it only helps for much smaller values. For example, when I use a size of 100 Samples, I am much too slow. It gets

Re: [Numpy-discussion] tofile speed

2007-07-24 Thread Sebastian Haase
So you are saying that a given tofile() call returns only after 2 seconds !? Can you measure the getData() call time (just comment the tofile out for a while- I that doesn't use 100% CPU ..) ? (timeit module is needed - I think) Maybe multithreading might help - so that tofile() and GetData()

Re: [Numpy-discussion] tofile speed

2007-07-24 Thread Sebastian Haase
Your are not generating text files - right? On 7/24/07, Sebastian Haase [EMAIL PROTECTED] wrote: So you are saying that a given tofile() call returns only after 2 seconds !? Can you measure the getData() call time (just comment the tofile out for a while- I that doesn't use 100% CPU ..) ?

[Numpy-discussion] tofile speed

2007-07-23 Thread Lars Friedrich
Hello everyone, I am using array.tofile successfully for a data-acqusition-streaming application. I mean that I do the following: for a long time: temp = dataAcquisisionDevice.getData() temp.tofile(myDataFile) temp is a numpy array that is used for storing the data temporarily.

Re: [Numpy-discussion] tofile speed

2007-07-23 Thread Sebastian Haase
Just a guess out of my hat: there might be a buffer class in the standard python library... I'm thinking of a class that implements file-I/O and collects input up to a maximum buffer size before it copies the same byte stream to it's output. Since I/O is more efficient if larger chunks are written

Re: [Numpy-discussion] tofile speed

2007-07-23 Thread Charles R Harris
On 7/23/07, Lars Friedrich [EMAIL PROTECTED] wrote: Hello everyone, I am using array.tofile successfully for a data-acqusition-streaming application. I mean that I do the following: for a long time: temp = dataAcquisisionDevice.getData() temp.tofile(myDataFile) temp is a