[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coherence test implementation
- Subject: Re: coherence test implementation
- From: Dick Jackson <djackson(at)dfanning.com>
- Date: Thu, 13 May 1999 21:03:59 GMT
- Newsgroups: comp.lang.idl-pvwave
- Organization: Fanning Software Consulting
- References: <373A0D41.CC318A7F@aims.gov.au> <373B0C52.96D90B6B@dfanning.com>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:14733
(quick, before they wake up in Australia! :-)
Hi again,
Dick Jackson wrote:
>
> You piqued my curiosity, since you're right, there had to be a more
> efficient way! My attached coherence.pro should do the trick, and I
> clock it at about 60 times faster with a 300x300 test.
> [...]
> Generalizing coherence.pro to allow variable 'width' [...]
> wouldn't be hard
I looked at my code again, and realized I was duplicating the function of
the IDL CONVOL routine. That sure simplified things! (and in my 300x300
test, cut time in half yet again) Adding the 'width' idea was trivial. I
think writing helpful comments was the worst part. :-)
And, as with any Good Thing in IDL, it can be written in one line:
coh = Sqrt((Convol(array ^ 2.0, Replicate(1, width, width)) $
- (Convol(Float(array), Replicate(1, width, width))^2 $
/ (width ^ 2))) $
/ ((width ^ 2)-1))
(the attached .pro is much easier to read and understand)
Enjoy.
Cheers,
--
-Dick
Dick Jackson Fanning Software Consulting, Canadian Office
djackson@dfanning.com Calgary, Alberta Voice/Fax: (403) 242-7398
Coyote's Guide to IDL Programming: http://www.dfanning.com/
coherence.pro