[SciPy-dev] Numerical Recipes (was tagging 0.7rc1 this weekend?)

Thouis (Ray) Jones thouis at broad.mit.edu
Thu Dec 18 12:20:35 EST 2008


On Wed, Dec 17, 2008 at 16:25, Jarrod Millman <millman at berkeley.edu> wrote:
> On Tue, Dec 16, 2008 at 6:50 PM, Thouis (Ray) Jones
> <thouis at broad.mit.edu> wrote:
>> Here's a slightly better version (clearer, about 10% faster).
>
> It looks good to me.  Did you take a look at whether medfilter2 was
> from NR as well?  If not, I would appreciate it if you would take a
> quick look.  It would also be nice if you would be willing to rewrite
> the medfilter2s as a single macro which expands for the
> float/double/byte cases like you did for the quick select.
>
> Could you also provide some tests for medfilt2 in test_signaltools.py:
>  trunk/scipy/signal/tests/test_signaltools.py

The medfilter2 is not from NR (NR doesn't include median filtering, as
far as I can tell).

I've attached the patch against the latest SVN.  It includes the following:
* new quickselect (from scratch) in medianfilter.c
* new macros for {f,d,b}_medfilt2 in medianfilter.c
* modified test for medfilt and medfilt2 (larger array, non-square filter).


The N-d order filter (called by medfilt) works by filling a buffer,
then calling qsort, then extracting the desired index.  It could
easily take advantage of a qselect() function based on the one in
medianfilter.c (except without .  I'll file an enhancement request, as
I doubt you want such a change in 0.7.

Also, medfilt2d should fall back to medfilt (nD version) when handed a
type not in its special cases (float, double, unsigned char).

Ray Jones
-------------- next part --------------
A non-text attachment was scrubbed...
Name: medfilt.patch
Type: application/octet-stream
Size: 18411 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20081218/8d605e5e/attachment.obj>


More information about the SciPy-Dev mailing list