Re: [Numpy-discussion] NOOB Alert: Looping Through Text Files...

2011-01-16 Thread Jochen Schröder
different file. something like this: for fn in textlist: fp = open(fn, 'r') fp.close() s = fp.read() s += "I suck at Python and need help") fp_new = open(fn[:-4]+'_modified.txt','w') fp_new.write(s) fp_

Re: [Numpy-discussion] Here's what I've done to numpy.fft

2010-07-12 Thread Jochen Schröder
ve frequency closest to zero. > > Feedback welcome. > > DG > Hi David, great work. I agree with Travis leave the sampling out. This make things more confusing. I'd also suggest pointing to fftshift for converting the "standard" order to order "min frequency to max

Re: [Numpy-discussion] numpy.fft, yet again

2010-07-12 Thread Jochen Schröder
t; I'd say that a pointer to a discussion about normalization of ffts would be good here. The issue is that numpy is doing a normalization to len(x) for the inverse fft. However to make ffts unitary it should actually be that fft and ifft are normalized by sqrt(len(x)). And some fft impl

Re: [Numpy-discussion] Another reality check

2010-07-12 Thread Jochen Schröder
On 07/12/2010 12:36 PM, David Goldsmith wrote: > On Sun, Jul 11, 2010 at 6:18 PM, David Goldsmith > mailto:d.l.goldsm...@gmail.com>> wrote: > > In numpy.fft we find the following: > > "Then A[1:n/2] contains the positive-frequency terms, and A[n/2+1:] > contains the negative-frequency t

Re: [Numpy-discussion] Request for testing

2010-02-21 Thread Jochen Schroeder
No Warning for me: └─(08:26 $)─> python isinf.py True └─(08:26 $)─> python2.5 isinf.py True Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55) [GCC 4.4.1] on linux2 Python 2.5.4 (r254:67916, Jan 20 2010, 21:43:02) [GCC 4.4.1] on linux2 numpy.version.version '1.3.0' └─(08:33 $)─> uname -a Li

[Numpy-discussion] [ANN] pyfftw-0.2 released

2010-02-14 Thread Jochen Schroeder
ation at install time Note: Pyfftw moved to launchpad, new url is http://launchpad.net/pyfftw. Cheers Jochen ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Assigning complex values to a real array

2009-12-08 Thread Jochen Schroeder
> float. I'm not sure how much code is actually relying on the implicit downcast, but I'd argue that it's bad programming anyways. It is really difficult to spot if you reviewing someone else's code. As others mentioned it's also a bitch to track down a bug that has been accidentally introduced by this behaviour. Jochen ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] strange sin/cos performance

2009-08-04 Thread Jochen
loop In [54]: %timeit -n 10 np.sin(d) 10 loops, best of 3: 87.7 µs per loop In [55]: %timeit -n 10 np.sin(c.astype(np.float64)).astype(np.float32) 10 loops, best of 3: 891 µs per loop Cheers Jochen On Mon, 3 Aug 2009 15:45:56 +0200 Emmanuelle Gouillart wrote: > Hi Andrew, > >

Re: [Numpy-discussion] Interactive Shell/Editor/Workspace(variables)View/Plots

2009-06-08 Thread Jochen Schroeder
dded vim (although you can embed other editors as well I think). The website looks like development has been stale, but if you look at svn there've been commits lately. Cheers Jochen > > Gaël > ___ > Numpy-discussion mailing list > Nump

Re: [Numpy-discussion] view takes no keyword arguments exception

2009-05-20 Thread Jochen Schroeder
On 21/05/09 00:20, Stéfan van der Walt wrote: > Hi Jochen > > 2009/5/20 Jochen Schroeder : > > I'm trying to help someone out with some problems with pyfftw > > (pyfftw.berlios.de). He is seeing an exception, > > > > TypeError: view() takes no keyword argu

[Numpy-discussion] view takes no keyword arguments exception

2009-05-20 Thread Jochen Schroeder
File "", line 1, in TypeError: view() takes no keyword arguments I he's on Windows and sees this error both with numpy 1.1.1 and 1.3. I'm a bit lost anybody have an idea what could be the problem? Cheers Jochen

Re: [Numpy-discussion] Construct a large n-dimensional complex matrix

2009-04-07 Thread Jochen Schroeder
numpy? > > C = np.empty((n,m), dtype=complex) > C.real.flat[:] = real_values > C.imag.flat[:] = imag_values > Just a question, is there any advantage to doing C = 1.j *imag_values + real_values ? Cheers Jochen > -- > Robert Kern > > "I have come to believe tha

Re: [Numpy-discussion] Optical autocorrelation calculated with numpy is slow

2009-03-31 Thread Jochen S
On Tue, Mar 31, 2009 at 8:54 PM, Jochen S wrote: > On Tue, Mar 31, 2009 at 7:13 AM, João Luís Silva wrote: > >> Hi, >> > > >> I wrote a script to calculate the *optical* autocorrelation of an >> electric field. It's like the autocorrelation, but sums

Re: [Numpy-discussion] Optical autocorrelation calculated with numpy is slow

2009-03-31 Thread Jochen S
elation are you talking about. For instance SHG autocorrelation is an intensity autocorrelation thus the first line should be: FT_E = fft(abs(E)**2) HTH Jochen > with script appended at the end. It's too slow for my purposes (takes ~5 > seconds, and scales ~O(N**2)). numpy's corre

Re: [Numpy-discussion] numpy.ctypeslib.ndpointer and the restype attribute

2009-03-23 Thread Jochen Schroeder
oved from the documentation, it also cost me quite some time trying to get ndpointer to work with restype when I first tried it until I finally came to the conclusion that an approach like the above is necessary and ndpointer does not work with restype. Cheers Jochen ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] numpy ndarray questions

2009-01-27 Thread Jochen
On Tue, 2009-01-27 at 14:16 +0100, Sturla Molden wrote: > On 1/27/2009 12:37 PM, Sturla Molden wrote: > > > import ctypes > > import numpy > > > > fftw_malloc = ctypes.cdll.fftw.fftw_malloc > > fftw_malloc.argtypes = [ctypes.c_ulong,] > > fftw_malloc.restype = ctypes.c_ulong > > > > def aligned_

Re: [Numpy-discussion] numpy ndarray questions

2009-01-27 Thread Jochen
On Tue, 2009-01-27 at 12:37 +0100, Sturla Molden wrote: > On 1/27/2009 1:26 AM, Jochen wrote: > > > a = fftw3.AlignedArray(1024,complex) > > > > a = a+1 > > = used this way is not assignment, it is name binding. > > It is easy to use function's li

Re: [Numpy-discussion] numpy ndarray questions

2009-01-26 Thread Jochen
On Tue, 2009-01-27 at 14:46 +0900, David Cournapeau wrote: > Jochen wrote: > > On Tue, 2009-01-27 at 13:54 +0900, David Cournapeau wrote: > > > >> Jochen wrote: > >> > >>> On Tue, 2009-01-27 at 13:28 +0900, David Cournapeau wro

Re: [Numpy-discussion] numpy ndarray questions

2009-01-26 Thread Jochen
On Tue, 2009-01-27 at 13:54 +0900, David Cournapeau wrote: > Jochen wrote: > > On Tue, 2009-01-27 at 13:28 +0900, David Cournapeau wrote: > > > >> Jochen wrote: > >> > >>> On Tue, 2009-01-27 at 12:49 +0900, David Cournapeau wro

Re: [Numpy-discussion] numpy ndarray questions

2009-01-26 Thread Jochen
On Tue, 2009-01-27 at 13:28 +0900, David Cournapeau wrote: > Jochen wrote: > > On Tue, 2009-01-27 at 12:49 +0900, David Cournapeau wrote: > > > >> Jochen wrote: > >> > >>> Hi all, > >>> > >>> I just wrote ctypes bindin

Re: [Numpy-discussion] numpy ndarray questions

2009-01-26 Thread Jochen
On Tue, 2009-01-27 at 12:49 +0900, David Cournapeau wrote: > Jochen wrote: > > Hi all, > > > > I just wrote ctypes bindings to fftw3 (see > > http://projects.scipy.org/pipermail/scipy-user/2009-January/019557.html > > for the post to scipy). > > Now I h

Re: [Numpy-discussion] numpy ndarray questions

2009-01-26 Thread Jochen
On Mon, 2009-01-26 at 19:25 -0600, Ryan May wrote: > Jochen wrote: > > Hi all, > > > > I just wrote ctypes bindings to fftw3 (see > > http://projects.scipy.org/pipermail/scipy-user/2009-January/019557.html > > for the post to scipy). > > Now I h

[Numpy-discussion] numpy ndarray questions

2009-01-26 Thread Jochen
lt __new__ takes no parameters Am I correct in assuming that the documentation is incorrect and ndpointer can only be used for argtypes? Or am I missing something? Cheers Jochen ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects