comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Local max filter
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Local max filter [message #26343 is a reply to message #26339] Wed, 22 August 2001 10:16 Go to previous messageGo to previous message
John-David T. Smith is currently offline  John-David T. Smith
Messages: 384
Registered: January 2000
Senior Member
Craig Markwardt wrote:
>
> rkj@dukebar.crml.uab.edu (R. Kyle Justice) writes:
>> I am trying to implement a local max filter
>> without loops. Has this been done?
>>
>> (Given an array and a filter width, return an
>> array containing the array value if it is
>> a local max, 0 if not)
>>
>> For instance,
>>
>> 3 4 7 2 6 4 9 8 3
>>
>> would be
>>
>> 0 0 7 0 0 0 9 0 0
>>
>> for a width of 5.
>
> JD and I had a contest doing this kind of thing -- finding maxima -- a
> year or so ago. Of course I popped his socks off, but he will tell
> you a different story :-)

Hmmmph... from my posting before of April 2000:

"Nice entry Craig. But unfortunatly it doesn't *alway* do exactly what
was
requested. It works fine for n=5, but for n>5 (7,9,...), the index is
off..."

So it looks like your method owes me at least a bit of bug fixing ;)

This is the thread for those interested:

http://groups.google.com/groups?hl=en&safe=off&th=f2 0f62ee42b51402,20&start=0

The bottom line of my method was, for simple 3 pt maxima:

>>>>
maxes = where(arr gt median(arr,3))
<<<<

which I guess when compared with Craig's:

>>>> >>
arr2 = arr(2:*) ;; Center points
b = (arr2 GE arr(0:*)) AND (arr2 GE arr(1:*)) AND $
(arr2 GE arr(3:*)) AND (arr2 GE arr(4:*)) ;; Compare against
neighbors
result = [0, 0, b*arr2, 0, 0] ;; Replace boundaries
<<<<<<

does get its socked knocked off, at least in terms of amount of typing
required, space used on disk, or impressive complex subscripts to more
quickly glaze the boss's eyes over ;)

As for variable width, n-point maxima (n odd), I came up with:

wh=where(d gt ((m=median(d,3))) and smooth((d eq m)*(n-2),n-2) eq n-3)

Not a for loop (or a histogram) in there! For the interested, the
details of this technique were well described (a.k.a. "How the hell does
that work?").

JD

P.S. Craig, now that I have your attention, I have an unrelated
question, the answer to which might be of general interest. How do you
feel about your excellent fitting/minimization routines being
distributed with a large scale freely available system for scientific
reduction and analysis?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: is this a managed usegroup or not ?
Next Topic: Dataminer and mySQL?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 23:33:57 PDT 2025

Total time taken to generate the page: 0.16105 seconds