Re: achieving performance using C/C++

2007-11-05 Thread Filip Wasilewski
On Nov 5, 7:40 am, sandipm [EMAIL PROTECTED] wrote: I did fair amount of programming in python but never used c/c++ as mentioned below. any good tutorials for using C/C++ to optimize python codebase for performance? how widely do they use such kind of mixed coding practices? [...] Since you

Re: Using msvcrt (in Windows), how to catch Enter key?

2007-10-29 Thread Filip Wasilewski
On Oct 29, 11:26 am, Dick Moores [EMAIL PROTECTED] wrote: Windows XP Pro, Python 2.5.1 import msvcrt while True: if msvcrt.kbhit(): key = msvcrt.getch() if key == 'Enter' do something Is there a way to catch the pressing of the 'Enter' key? Yes there is.

Re: About alternatives to Matlab

2006-12-14 Thread Filip Wasilewski
Jon Harrop wrote: Filip Wasilewski wrote: Jon Harrop wrote: Filip Wasilewski wrote: Jon, both Python and Matlab implementations discussed here use the lifting scheme, while yours is a classic convolution based approach. I've done both in OCaml. The results are basically the same

Re: About alternatives to Matlab

2006-12-13 Thread Filip Wasilewski
Jon Harrop wrote: Filip Wasilewski wrote: Jon, both Python and Matlab implementations discussed here use the lifting scheme, while yours is a classic convolution based approach. I've done both in OCaml. The results are basically the same. Have you tried taking advantage of the 50

Re: About alternatives to Matlab

2006-12-12 Thread Filip Wasilewski
Jon Harrop wrote: Filip Wasilewski wrote: Besides of that this code is irrelevant to the original one and your further conclusions may not be perfectly correct. Please learn first about the topic of your benchmark and different variants of wavelet transform, namely difference between

Re: About alternatives to Matlab

2006-12-04 Thread Filip Wasilewski
Jon Harrop wrote: [...] I first wrote an OCaml translation of the Python and wrote my own little slice implementation. I have since looked up a C++ solution and translated that into OCaml instead: let rec d4_aux a n = let n2 = n lsr 1 in let tmp = Array.make n 0. in for i=0 to n2-2

Re: About alternatives to Matlab

2006-11-19 Thread Filip Wasilewski
sturlamolden wrote: [...] Here is the correct explanation: The factorization of the polyphase matrix is not unique. There are several valid factorizations. Our implementations corresponds to different factorizations of the analysis and synthesis poyphase matrices, and both are in a sence

Re: About alternatives to Matlab

2006-11-19 Thread Filip Wasilewski
sturlamolden wrote: Actually, there was a typo in the original code. I used d1[l-1] where I should have used d1[l+1]. Arrgh. Here is the corrected version, the Matlab code must be changed similarly. It has no relevance for the performance timings though. def D4_Transform(x, s1=None,

Re: numpy: frequencies

2006-11-18 Thread Filip Wasilewski
robert wrote: I have an integer array with values limited to range(a,b) like: ia=array([1,2,3,3,3,4,...2,0,1]) and want to speedly count the frequencies of the integers into get a density matrix. Is this possible without looping? See numpy.bincount (for integers = 0) if you mean 'without

Re: About alternatives to Matlab

2006-11-17 Thread Filip Wasilewski
sturlamolden wrote: Boris wrote: Hi, is there any alternative software for Matlab? Although Matlab is powerful popular among mathematical engineering guys, it still costs too much not publicly open. So I wonder if there's similar software/lang that is open with comparable

Re: Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

2006-11-03 Thread Filip Wasilewski
robert wrote: I'd like to use multiple CPU cores for selected time consuming Python computations (incl. numpy/scipy) in a frictionless manner. Interprocess communication is tedious and out of question, so I thought about simply using a more Python interpreter instances (Py_NewInterpreter)

Re: xmlrpc, extract data from http headers

2006-09-19 Thread Filip Wasilewski
Milos Prudek wrote: A better solution would be to extract cookies from headers in the request method and return them with response (see the code below). I Full solution! Wow! Thank you very much. I certainly do not deserve such kindness. Thanks a lot Filip! Glad to help. All in all this is

Re: xmlrpc, extract data from http headers

2006-09-16 Thread Filip Wasilewski
Milos Prudek wrote: Overload the _parse_response method of Transport in your BasicAuthTransport and extract headers from raw response. See the source of xmlrpclib.py in the standard library for details. Thank you. I am a bit of a false beginner in Python. I have written only short

Re: Searching for patterns on the screen

2006-09-15 Thread Filip Wasilewski
Jerry Hill wrote: Hello all, I have a piece of code I could use some help optimizing. What I'm attempting to do is periodically grab a screenshot, and search for 2D patterns of black pixels in it. I don't care about any color other than black. Here's some simple code that simulates my

Re: xmlrpc, extract data from http headers

2006-09-15 Thread Filip Wasilewski
Milos Prudek wrote: I perform a XML-RPC call by calling xmlrpclibBasicAuth which in turn calls xmlrpclib. This call of course sends a HTTP request with correct HTTP headers. The response is correctly parsed by xmlrpclib, and I get my desired values. However, I also need to get the raw HTTP

Re: How to build extensions on Windows?

2006-09-07 Thread Filip Wasilewski
Kevin D. Smith wrote: I've written a simple Python extension for UNIX, but I need to get it working on Windows now. I'm having some difficulties figuring out how to do this. I've seen web pages that say that MS Visual Studio is required, and other that say that's not true, that MinGW will

Re: How to build extensions on Windows?

2006-09-07 Thread Filip Wasilewski
Jarek Zgoda wrote: Filip Wasilewski napisa³(a): There is an easy way to build Python extensions on Windows with MinGW and it works fine for me. Just follow these steps: It was brougt to my attention that mingw-compiled extensions for Python 2.4 use other malloc() that Python 2.4

Re: String negative indices?

2006-06-25 Thread Filip Wasilewski
Steven D'Aprano wrote: On Sat, 24 Jun 2006 05:36:17 -0700, Filip Wasilewski wrote: Steven D'Aprano wrote: On Fri, 23 Jun 2006 02:17:39 -0700, Filip Wasilewski wrote: [EMAIL PROTECTED] wrote: Logically, I should be able to enter x[-2:-0] to get the last and next to last

Re: String negative indices?

2006-06-24 Thread Filip Wasilewski
Steven D'Aprano wrote: On Fri, 23 Jun 2006 02:17:39 -0700, Filip Wasilewski wrote: [EMAIL PROTECTED] wrote: Logically, I should be able to enter x[-2:-0] to get the last and next to last characters. However, since Python doesn't distinguish between positive and negative zero

Re: String negative indices?

2006-06-23 Thread Filip Wasilewski
[EMAIL PROTECTED] wrote: Logically, I should be able to enter x[-2:-0] to get the last and next to last characters. However, since Python doesn't distinguish between positive and negative zero, this doesn't work. Instead, I have to enter x[-2:]. Hooray! Logically there is no such thing as

Re: Update on Memory problem with NumPy arrays

2006-06-21 Thread Filip Wasilewski
sonjaa wrote: Hi last week I posted a problem with running out of memory when changing values in NumPy arrays. Since then I have tried many different approaches and work-arounds but to no avail. [...] Based on the numpy-discussion this seems to be fixed in the SVN now(?). Anyway, you can

Re: python socket proxy

2006-06-06 Thread Filip Wasilewski
[EMAIL PROTECTED] wrote: Hi all I am trying to create a lighweight tcp proxy server. [...] There is a bunch of nice recipies in the Python Cookbook on port forwarding. In the [1] and [2] case it should be fairly simple to add an extra authentication step with pyOpenSSL. [1]