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

Home » Public Forums » archive » Re: MEDIAN filtering and why it's not working
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: MEDIAN filtering and why it's not working [message #12073 is a reply to message #12061] Wed, 10 June 1998 00:00 Go to previous message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
T Bowers wrote:
>
> Hi,
> How come
>
> print, median([0.0,1.0,1.5,2.0,5.0,6.0], 3, /EVEN)
>
> prints
> 0.00000 1.00000 1.50000 2.00000 5.00000 6.00000
>
> instead of
> 1.00000 1.00000 1.00000 5.00000 5.00000 5.00000
>
> Doesn't look like it's filtering anything to me, no matter what
> I set the filter width to.
>
> Actually, I'd really like it to print
> 1.00000 5.00000
> just the median of each filter width. I'm trying to filter spikes in
> time series data.
> I'm using IDL 5.02 and win95

Check the Online help for info on MEDIAN(), because you are a bit
confused as to how it works. For example, the median of [1.0,1.5,2.0]
is 1.5, not 1.0 as you suggest. With a width of 3, each element
of your median array will be the median of itself and its two
neighbors. Since your array is monotonically increasing, each
element will be it's "own" median value.

If you want only the median values from every 3 elements, then you
can use:

index = lindgen(n_elements(array))
ind3 = where(index mod 3 eq 0)

median3 = (median(array, 3))[ind3]

Hope this helps.

Dave

>
> tia,
> todd bowers

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: buttons on exclusive base
Next Topic: color postscript files

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

Current Time: Thu Oct 09 21:47:11 PDT 2025

Total time taken to generate the page: 0.64102 seconds