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 #12061 is a reply to message #12046] Thu, 11 June 1998 00:00 Go to previous messageGo to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
"T Bowers" <tbowers@nrlssc.navy.mil> writes:

> 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

One of the oddities of the median filter program is that it doesn't filter
points near the edges of the array. It doesn't filter points if there aren't
enough points on either side. In your example, with a filter width of three,
then it won't filter the points on either end, because it needs one point
before and one point after for each point it filters.

If I understand you correctly, I think you want to do something like the
following. It would require that array be evenly divisible by the filter
width.

array = [0.0,1.0,1.5,2.0,5.0,6.0]
n = n_elements(array) / 3
array = reform(array, 3, n, /overwrite)
for i=0,n-1 do array(*,i) = median(array(*,i))
array = reform(array, 3*n, /overwrite)

This would give you

1.00000 1.00000 1.00000 5.00000 5.00000 5.00000

as you request. However, the last step would probably be better implemented as

array = reform(array(0,*), /overwrite)

to remove the repeated entries. This would give you simply

1.00000 5.00000

William Thompson
[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:42 PDT 2025

Total time taken to generate the page: 0.00651 seconds