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

Home » Public Forums » archive » Bug in IDL {alpha OSF unix 4.0.1} SMOOTH()
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Bug in IDL {alpha OSF unix 4.0.1} SMOOTH() [message #7468] Tue, 19 November 1996 00:00
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
I think I just stumbled over a strange bug in IDL's SMOOTH function (if this is
not a bug, then there is a bug in my brain, and I'd be quite happy to have
someone debug it, thank you).

For some reason, the smoothing introduces non-zero values in the result array along
one column, and I cannot understand why..

I don't have the time to figure out exactly what kind of input is *necessary*
to provoke the error, but at least I managed to isolate one case (they're not
*that* hard to find, I've got many of them) in a program (thank heaven for emacs'
macros..)

Haven't tested on any other platforms, it would be nice if someone could check. The
problem is that during the smoothing, quite a lot of pixels in column 14 are set
to 2.12873741e-09 for some reason or another....

The program included below should demonstrate it quite clearly.

Cheers,

Stein Vidar H. Haugan

PRO bug

diffmap = $
[$
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],$
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],$
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],$
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],$
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],$
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],$
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],$
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],$
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],$
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],$
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],$
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0] ]

window,0
!P.multi = [0,4,1]

smoth = 7
kernel = replicate(1,smoth,smoth)

smoot = smooth(float(diffmap),smoth,/edge_truncate) gt 0
conv = convol(float(diffmap),kernel,/edge_truncate,center=smoth/2) GT 0

tvscl,rebin(diffmap,45,286,/sample),0,0
tvscl,rebin(smoot,45,286,/sample),50,0
tvscl,rebin(conv,45,286,/sample),100,0
tvscl,rebin(smoot-conv,45,286,/sample),150,0
stop
END
Re: Bug in IDL {alpha OSF unix 4.0.1} SMOOTH() [message #7469 is a reply to message #7468] Tue, 19 November 1996 00:00 Go to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
> For some reason, the smoothing introduces non-zero values in the result array along
> one column, and I cannot understand why..

Here I go, following up my post after only a few minutes... I just realized that SMOOTH
is probably using some kind of FFT convolution to perform the smoothing operation,
even though the /edge_truncate was set. With fourier transforms back and forth, (numerical)
errors of this magnitude are not uncommon, one should even *expect* them (and therefore
treat the results with care, like checking "smooth(...) gt 1e-3" rather than "... gt 0").

So, it's a *feature*, not a bug, I guess :-)

Funny thing, what tipped me off was that when I rewrote my program to use CONVOL instead
of SMOOTH, the speed went way down.

Stein Vidar H. Haugan
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: >>> ARE YOU READY FOR LOVE? <<<
Next Topic: Re: Phase Unwrapping Algorithms?

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

Current Time: Wed Oct 08 17:43:05 PDT 2025

Total time taken to generate the page: 0.00508 seconds