Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
There's more than one way to do things
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Sounds like you need a high-pass filter. Specifying the cut-off as a percentage and normalising the values should allow for variable s/n ratios.

#! perl -slw use strict; use List::Util qw[ max ]; sub islands { my( $percent, $dataRef ) = @_; my $max = max @$dataRef; my $filtered = join '', map{ ( $_ / $max ) > $percent ? 1 : 0 } @$dataRef; printf "%4.2f : %s\n", $percent, $filtered; } my @data = split ' ', do{ local $/; <DATA> }; islands $_, \@data for map{ $_ / 20 } 1 .. 20; =comment c:\test>545901 0.05 : 0000000111111111100001 0.10 : 0000000011111111000000 0.15 : 0000000001111111000000 0.20 : 0000000001111110000000 0.25 : 0000000000111110000000 0.30 : 0000000000111110000000 0.35 : 0000000000111110000000 0.40 : 0000000000111100000000 0.45 : 0000000000111100000000 0.50 : 0000000000111100000000 0.55 : 0000000000111100000000 0.60 : 0000000000111100000000 0.65 : 0000000000011000000000 0.70 : 0000000000011000000000 0.75 : 0000000000011000000000 0.80 : 0000000000011000000000 0.85 : 0000000000011000000000 0.90 : 0000000000011000000000 0.95 : 0000000000010000000000 1.00 : 0000000000000000000000 =cut __DATA__ 101 203 321 45 67 156 203 502 899 2003 5007 8020 7301 5030 3045 1243 567 321 234 45 123 453

You could enhance that by adding a minimum width to exclude transient spikes like the one shown at the end of the 5% line. Turning the 0s & 1s back into either groups of values or index ranges is fairly easy depending upon what you need to do with the islands once isolated.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: How do I find peaks in noisy data? by BrowserUk
in thread How do I find peaks in noisy data? by tamaguchi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (6)
    As of 2014-04-20 14:37 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (485 votes), past polls