local_mins.rb

7th August 2019 at 9:01am
Word Count: 118

This page needs some descriptive text, possibly a new name (or not), some tags, and should be linked in to dNm: data cleaning test. Max

ave = 0

last_min = 0
y_m2, y_m1 = 0,0
File.readlines("test12_wet.dat").each { |datum|
    x,y = datum.split(/ /).map(&:to_i)
    ave = 0.95*ave + 0.05*y
    y = ave
    if y_m2 > y_m1 && y > y_m1
        print "  ",(x-last_min)
        last_min = x
      end
    y_m2 = y_m1
    y_m1 = y
  }
  69  13  7  6  7  7  6  6  7  6  7  6  6  7  7  6  7  6  6  7  7  6  6  7  6  7  7  6  6  7  7  6  7  6  7  7  6  6  6  7  7  6  6  8  6  6