Re: efficient running median

2009-10-15 Thread Janto Dreijer
On Oct 15, 12:41 pm, Raymond Hettinger pyt...@rcn.com wrote: [Janto Dreijer] I found a PDF by Soumya D. Mohanty entitled Efficient Algorithm for computing a Running Median (2003) by Googling. It has code snippets at the end, but it's not going to be a simple cut-and-paste job

Re: efficient running median

2009-10-14 Thread Janto Dreijer
On Oct 13, 6:33 pm, Paul Rubin http://phr...@nospam.invalid wrote: Janto Dreijer jan...@gmail.com writes: I'm looking for code that will calculate the running median of a sequence, efficiently. (I'm trying to subtract the running median from a signal to correct for gradual drift

Re: efficient running median

2009-10-14 Thread Janto Dreijer
On Oct 13, 7:37 pm, Ethan Furman et...@stoneleaf.us wrote: Janto Dreijer wrote: I'm looking for code that will calculate the running median of a sequence, efficiently. (I'm trying to subtract the running median from a signal to correct for gradual drift). My naive attempt (taking

Re: efficient running median

2009-10-14 Thread Janto Dreijer
On Oct 14, 12:13 am, Paul Rubin http://phr...@nospam.invalid wrote: Janto Dreijer jan...@gmail.com writes: Well, I don't have a lot of theoretical reasoning behind wanting to use a median filter. I have some experience applying it to images with very good results, so that was the first

Re: efficient running median

2009-10-14 Thread Janto Dreijer
On Oct 14, 4:53 pm, Peter Otten __pete...@web.de wrote: Some numbers: 10.197 seconds for running_median_scipy_medfilt 25.043 seconds for running_median_python 13.040 seconds for running_median_python_msort 14.280 seconds for running_median_python_scipy_median 4.024 seconds for

efficient running median

2009-10-13 Thread Janto Dreijer
I'm looking for code that will calculate the running median of a sequence, efficiently. (I'm trying to subtract the running median from a signal to correct for gradual drift). My naive attempt (taking the median of a sliding window) is unfortunately too slow as my sliding windows are quite large

Re: efficient running median

2009-10-13 Thread Janto Dreijer
On Oct 13, 6:12 pm, Peter Otten __pete...@web.de wrote: Janto Dreijer wrote: I'm looking for code that will calculate the running median of a sequence, efficiently. (I'm trying to subtract the running median from a signal to correct for gradual drift). My naive attempt (taking the median

Re: Reverse zip() ?

2008-12-03 Thread Janto Dreijer
I'd like to point out that since your where thinking in terms of matplotlib, you might actually find numpy's own transpose useful, instead of using zip(*seq) :) untested: t = linspace(0,2*pi*3) seq = asarray(zip(t, sin(t))) t, y = seq.T # or seq.transpose() or numpy.transpose(seq)

eval modifies passed dict

2008-04-14 Thread Janto Dreijer
It seems eval is modifying the passed in locals/globals. This is behaviour I did not expect and is really messing up my web.py app. Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type help, copyright, credits or license for

Re: eval modifies passed dict

2008-04-14 Thread Janto Dreijer
On Apr 14, 5:48 pm, [EMAIL PROTECTED] wrote: On 14 avr, 17:23, Janto Dreijer [EMAIL PROTECTED] wrote: It seems eval is modifying the passed in locals/globals. This is behaviour I did not expect and is really messing up my web.py app. Python 2.5.1 (r251:54863, Mar  7 2008, 04:10:12) [GCC

Re: Fast kNN from python

2007-08-15 Thread Janto Dreijer
On Aug 14, 9:27 pm, Sean Davis [EMAIL PROTECTED] wrote: On Aug 14, 6:16 am, Janto Dreijer [EMAIL PROTECTED] wrote: Hi! I am looking for a Python implementation or bindings to a library that can quickly find k-Nearest Neighbors given an arbitrary distance metric between objects

Fast kNN from python

2007-08-14 Thread Janto Dreijer
Hi! I am looking for a Python implementation or bindings to a library that can quickly find k-Nearest Neighbors given an arbitrary distance metric between objects. Specifically, I have an edit distance between objects that is written in Python. I haven't looked at the methods in detail but I

Re: Fast kNN from python

2007-08-14 Thread Janto Dreijer
On Aug 14, 3:11 pm, Tim Churches [EMAIL PROTECTED] wrote: Janto Dreijer wrote: I am looking for a Python implementation or bindings to a library that can quickly find k-Nearest Neighbors given an arbitrary distance metric between objects. Specifically, I have an edit distance between

Re: Fast kNN from python

2007-08-14 Thread Janto Dreijer
On Aug 14, 8:44 pm, Miki [EMAIL PROTECTED] wrote: Hello, I am looking for a Python implementation or bindings to a library that can quickly find k-Nearest Neighbors given an arbitrary distance metric between objects. Specifically, I have an edit distance between objects that is written

threading and iterator crashing interpreter

2007-03-11 Thread Janto Dreijer
I have been having problems with the Python 2.4 and 2.5 interpreters on both Linux and Windows crashing on me. Unfortunately it's rather complex code and difficult to pin down the source. So I've been trying to reduce the code. In the process it's started to crash in different ways. I'm not sure

Re: threading and iterator crashing interpreter

2007-03-11 Thread Janto Dreijer
On Mar 11, 2:20 pm, Bjoern Schliessmann usenet- [EMAIL PROTECTED] wrote: Janto Dreijer wrote: I have been having problems with the Python 2.4 and 2.5 interpreters on both Linux and Windows crashing on me. I don't understand -- does the interpreter crash (segfault) or is just your program

Re: threading and iterator crashing interpreter

2007-03-11 Thread Janto Dreijer
On Mar 11, 1:46 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Sun, 11 Mar 2007 07:32:04 -0300, Janto Dreijer [EMAIL PROTECTED] escribió: I have been having problems with the Python 2.4 and 2.5 interpreters on both Linux and Windows crashing on me. Unfortunately it's rather complex

Re: threading and iterator crashing interpreter

2007-03-11 Thread Janto Dreijer
On Mar 11, 3:27 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Sun, 11 Mar 2007 09:47:34 -0300, Janto Dreijer [EMAIL PROTECTED] escribió: As far as I can tell I'm not running it from restricted mode explicitly. This error is rather strange then: RuntimeError: instance.__dict__

multiple content-types break cgi.py

2007-03-04 Thread Janto Dreijer
Hi! The Nokia Java SDK allows one to define multiple content-types in a single HTTP header field. I'm not sure if it's standard, but it's happening from some Java-enabled phones. This breaks the FieldStorage class in cgi.py by not causing self.read_urlencoded() to be called at object init.

Re: multiple content-types break cgi.py

2007-03-04 Thread Janto Dreijer
On Mar 4, 12:29 pm, Jon Ribbens [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Janto Dreijer wrote: The Nokia Java SDK allows one to define multiple content-types in a single HTTP header field. I'm not sure if it's standard, but it's happening from some Java-enabled phones

Re: UDP packets to PC behind NAT

2006-09-16 Thread Janto Dreijer
Steve Holden wrote: Note that TCP and UDP port spaces are disjoint, so there's no way for TCP and UDP to use the same port - they can, however, use the same port number. Basically the TCP and UDP spaces have nothing to do with each other. Most dynamic NAT gateways will respond to an outgoing

UDP packets to PC behind NAT

2006-09-15 Thread Janto Dreijer
This is probably more of a networking question than a Python one, but it would be nice to know if someone has done this with Python's socket module. And besides one usually gets more information from c.l.py than anywhere else :) I have a server with a static public IP and a client behind a NAT. I

Re: UDP packets to PC behind NAT

2006-09-15 Thread Janto Dreijer
Awesome! I haven't tested it on the actual server but I think it works. Thanks! I prefer a TCP connection solution and will post one if it works. server.py from socket import * print listening UDPSock = socket(AF_INET, SOCK_DGRAM) UDPSock.bind((localhost, 1234)) # visibility to outside

Re: UDP packets to PC behind NAT

2006-09-15 Thread Janto Dreijer
Oops. That second UDPSock = socket(...) in the server.py shouldn't be there. Janto Dreijer wrote: Awesome! I haven't tested it on the actual server but I think it works. Thanks! I prefer a TCP connection solution and will post one if it works. server.py from socket import * print

Re: UDP packets to PC behind NAT

2006-09-15 Thread Janto Dreijer
Grant Edwards wrote: On 2006-09-15, Christophe [EMAIL PROTECTED] wrote: Initiate an UDP connection from the client to the server and have the server send back the UDP packets to the address you get in the recvfrom result. There's no such thing as a UDP connection, so I don't understand

Re: UDP packets to PC behind NAT

2006-09-15 Thread Janto Dreijer
Grant Edwards wrote: On 2006-09-15, Janto Dreijer [EMAIL PROTECTED] wrote: ... Would it be a reasonable solution to initiate a TCP connection from the client to the server and somehow (?) let the server figure out how the client is connecting? And then send UDP to client over the same (IP

ntp in python

2006-08-29 Thread Janto Dreijer
I want to measure the packet delivery delays over various network links. For this I need to synchronise the times of the sender and receiver, either against NTP or eachother. Unfortunately I won't necessarily have root priviledges to change the PCs' clocks. So I'm looking for a way I can

Re: ntp in python

2006-08-29 Thread Janto Dreijer
Jeremy Sanders wrote: Janto Dreijer wrote: I want to measure the packet delivery delays over various network links. For this I need to synchronise the times of the sender and receiver, either against NTP or eachother. Couldn't you just use NTP itself to get the delivery delay? You can

Re: ntp in python

2006-08-29 Thread Janto Dreijer
Janto Dreijer wrote: Jeremy Sanders wrote: Janto Dreijer wrote: I want to measure the packet delivery delays over various network links. For this I need to synchronise the times of the sender and receiver, either against NTP or eachother. Couldn't you just use NTP itself to get

embedding console in wxpython app

2006-08-06 Thread Janto Dreijer
I'm writing a Linux filemanager using wxPython. I'd like to embed a bash console inside it. I have found the Logilab pyqonsole (http://www.logilab.org/projects/pyqonsole), but it uses PyQT. Does anyone know how to do this from wx? Is it possible to embed a PyQT widget inside wxPython? Thanks!

Re: testing array of logicals

2006-08-05 Thread Janto Dreijer
John Henry wrote: Simon Forman wrote: False not in logflags Or, if your values aren't already bools False not in (bool(n) for n in logflags) Very intriguing use of not in... Is there a reason why you didn't write True in (bool(n) for n in logflags) --

Re: testing array of logicals

2006-08-05 Thread Janto Dreijer
Janto Dreijer wrote: John Henry wrote: Simon Forman wrote: False not in logflags Or, if your values aren't already bools False not in (bool(n) for n in logflags) Very intriguing use of not in... Is there a reason why you didn't write True in (bool(n) for n