in reply to Re: comparing numbers from previous lines in a file?
in thread comparing numbers from previous lines in a file?
But -- I think -- even the averaging technique demonstrated is still subject to data variability (ie, variances less than the extreme example in OP; already critiqued in responses above) and ordering. Consider outcomes like
temp2 == 25.29 (c.f. 27.53) in line 1
for data where one line's variation is outside OP's 0.5C range but close to another line in which the data departs by an even smaller amount from OP's limit:
__DATA__ A16 26.68 767 25.29 4.3 # T is outside 0.5 allowed A16 26.68 767 28.01 4.3 # T is also outside the permitted range A15 26.62 765 27.30 4.3 A11 26.63 763 27.28 4.2 A12 26.68 767 27.29 4.3 A16 26.64 768 27.30 4.2 A11 26.62 761 27.31 4.1 A15 26.62 765 27.30 4.3 A15 26.63 763 27.28 4.2 A17 26.64 768 27.30 4.2 A18 26.62 761 27.31 4.1
Further, assume data variance which is only marginally outside the spec:
__DATA__ A16 26.68 767 26.79 4.3 A16 26.68 767 27.81 4.3 A15 26.62 765 27.30 4.3 A11 26.63 763 27.28 4.2 A12 26.68 767 27.29 4.3 A16 26.64 768 27.30 4.2 A11 26.62 761 27.31 4.1 A15 26.62 765 27.30 4.3 A15 26.63 763 27.28 4.2 A17 26.64 768 27.30 4.2 A18 26.62 761 27.31 4.1
-----------------
Not tested, but I suspect the OP's window = 3 is too narrow; that for complete reliability (with data close-to-but-outside-the-spec and for certain orderings of the non-spec items in the overall data, one might need to average over the overall data (or at least over a window which takes in a majority of the items *1 , rather than over a narrower window.
*1 Even this -- I speculate -- would rely on finding the anomalous data scattered thru the set, rather than grouped and having few enough out-of-spec items as to minimize the impact of the "bad data" on whatever range of items is used for the window.
--------
Yes, there's lottsa' handwaving above -- but defining such terms as 'minimize', 'narrower', 'close-to-but..." and so forth would entail (for /me, anyway, hours of thought (hard) and testing (consuming time I don't have today). OTOH, I do hope the above isn't utterly worthless because I hit a blind spot earlier.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: comparing numbers from previous lines in a file?
by coding1227 (Novice) on Nov 22, 2013 at 19:53 UTC | |
by coding1227 (Novice) on Nov 22, 2013 at 20:26 UTC | |
by ww (Archbishop) on Nov 23, 2013 at 03:45 UTC | |
by coding1227 (Novice) on Nov 26, 2013 at 20:13 UTC |