Gnuplot-to-graph-tag-events
From PTAGISWiki
Nov 16, 2005 How to graph the time series events in a log file
The linkcheck.pl program uses the following procedure to look for anomalies in test tag data.
Start with an interrogation file (tag.dat) with data like this:
~01-8 11/15/05 09:00:09 INFO MESSAGE: Single-shot test with Test Tag. ~01-8 11/15/05 09:00:09 INFO PROBLEM: Test Tag Failed ~03-10 11/15/05 09:00:14 INFO MESSAGE: Single-shot test with Test Tag. | 0A 11/15/05 09:00:15 3E7.0000001D03 XX 03 ~03-10 11/15/05 09:00:15 INFO MESSAGE: Test Tag Found.
Many events like this are described in the files. Finding a missing event is difficult by simply browsing the files. We want to graph the events so that the events are easier to see.
Make a file that contains only the desired events:
grep "Single-shot test" tag.dat > tag1.dat
Remove the ~ and - so that the columns are plottable numbers.
perl -p -i -e "s/^~//g" tag1.dat perl -p -i -e "s/-\d+//g" tag1.dat
Sort the file by coil ID
sort tag1.dat > tag2.dat
Remove the unwanted coils
vi tag2.dat (remove lines for coils 51, 52, A1, A2, A3)
The file should now have data that looks like this:
06 11/03/05 14:38:17 INFO MESSAGE: Single-shot test with Test Tag. 06 11/03/05 14:39:17 INFO MESSAGE: Single-shot test with Test Tag. 06 11/03/05 14:40:17 INFO MESSAGE: Single-shot test with Test Tag. 06 11/03/05 14:41:17 INFO MESSAGE: Single-shot test with Test Tag. 06 11/03/05 14:42:17 INFO MESSAGE: Single-shot test with Test Tag.
Plot the data in gnuplot using these settings:
set xdata time set timefmt "%m/%d/%y %H:%M:%S" plot [] [0:7] "tag2.dat" using 2:1
The numbers in brackets set the scale. The empty brackets leave the xscale unchanged. The [0:7] sets the yscale to make it easier to see the coils 1 through 6.
2:1 means that column 2 is the beginning of the date/time and column 1 is the coil ID.
The full program that generates the graph is Tagplot.pl which is called as a helper by linkcheck.pl when a user wants to graphically inspect a series of events.
The finished product can be seen at http://www.ptagis.org/cgi-bin/linkcheck.pl and follow one of the links in the total events column on that page.
The output looks like the image below:

