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

Home » Public Forums » archive » Avoiding a for cicle
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: Avoiding a for cicle [message #19711 is a reply to message #19664] Wed, 12 April 2000 00:00 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Craig Markwardt (craigmnet@cow.physics.wisc.edu) writes:

> "J.D. Smith" <jdsmith@astro.cornell.edu> writes:
>
>>> Alright code slingers... new challenge... find location of all peaks in a region
>>> of n points (n odd), monotonically decreasing away from the peak. I.e. find
>>> peaks of width n.
>>>
>>
>> Since noone will take my challenge I'm forced to claim the prize for myself:
>>
>> wh=where(d gt ((m=median(d,3))) and smooth((d eq m)*(n-2),n-2) eq n-3)
>
> Slow down there whipper-snapper! Gotta let these things stew for a
> while. Though multiline, this is my best effort:
>
> dd = d(1:*)-d
> nh = (n-1)/2
> wh = where(convol((dd GT 0) AND (dd(nh:*) LT 0), bytarr(nh)+1, nh) EQ 1, ct)+1
>
> For the goobledy-gook impaired (aka DF :-),
> dd is the first difference of the data
> nh is the half-width of the peak
> (dd GT 0) AND (dd(nh:*) LT 0) locates up-going followed by down-going points
> convol(...) locates runs of length nh
>
> This one does exactly what was requested, which I'm not sure of about
> your solution, J.D. On the other hand, your solution may be more
> physically meaningful since it involves smoothing.

Alright, now that Craig has oriented me a little bit,
I find that I, uh..., have a *need* for this sort of thing. :-)

I presume you gentlemen are testing these little theories of yours
on a test data set. Could you supply such a data set for the
rest of us to fool around with? And if you gave us just a little
hint about how such a thing might be useful to *you*, that might
help too. I might even take a stab at writing an article about
it all, especially if I feel like it has been a day or two since
I really embarrassed myself.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Q: IDL and endianness issues
Next Topic: Dissect SAVE files, and more!

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

Current Time: Fri Oct 10 17:52:29 PDT 2025

Total time taken to generate the page: 0.47988 seconds