1 # awk program to scan loopstats files and report errors/statistics
3 # usage: awk -f loop.awk loopstats
5 # format of loopstats record
6 # MJD sec time (s) freq (ppm) poll
7 # 49235 3.943 0.000016 22.4716 6
9 # format of output dataset (time values in milliseconds, freq in ppm)
11 # loop 1180, 0+/-11.0, rms 2.3, freq -24.45+/-0.045, var 0.019
14 loop_tmax = loop_fmax =
-1e9
15 loop_tmin = loop_fmin =
1e9
18 # scan all records in file
32 loop_time_rms
+= $
3 * $
3
34 loop_freq_rms
+= $
4 * $
4
38 loop_time
/= loop_count
39 loop_time_rms = sqrt
(loop_time_rms
/ loop_count
- loop_time
* loop_time
)
40 loop_freq
/= loop_count
41 loop_freq_rms = sqrt
(loop_freq_rms
/ loop_count
- loop_freq
* loop_freq
)
42 printf "loop %d, %.0f+/-%.1f, rms %.1f, freq %.2f+/-%0.3f, var %.3f\n", loop_count
, (loop_tmax
+ loop_tmin
) / 2 * 1e6
, (loop_tmax
- loop_tmin
) / 2 * 1e6
, loop_time_rms
* 1e6
, (loop_fmax
+ loop_fmin
) / 2, (loop_fmax
- loop_fmin
) / 2, loop_freq_rms