HOPS
HOPS class reference
exam_gnuplot.h
Go to the documentation of this file.
1 /*
2  * Output a file of data formatted for handling by gnuplot
3  * Per base-pol data is captured in exdata->edata[bno]
4  * and we here finish up for a scan_boundary. This file
5  * contains templates for the gnuplot commands.
6  */
7 #ifndef __exam_gnuplot_h__
8 #define __exam_gnuplot_h__
9 
10 /* lower left and upper right */
11 #define KEYTBL 7
12 #define KEYBOT "inside bottom left vertical reverse Left"
13 #define KEYTOP "inside top right vertical Right"
14 
15 /* holds label and object data */
16 typedef struct labobj {
17  double x, y, lft,bot,rgt,top, dens;
18  char *fc;
20 
21 /* pdfcairo terminal setup */
22 #define GNUPLOT_PDFILE "\
23 set term pdfcairo size %lf,%lf font '%s,%d'\n\
24 set output '%s'\n\
25 "
26 #define GNUPLOT_PDFILE_BASE 100
27 
28 /* variable stuff that changes per data file */
29 #define GNUPLOT_PERBNO "\
30 # begin with the variable stuff that changes per data file\n\
31 if (%d) { fringe='{/:Bold %s}'; }\n\
32 else { fringe='%s'; }\n\
33 df='%s'\n\
34 set xrange [%lf:%lf]\n\
35 ampn=%lf; ampx=%lf; snrn=%lf; snrx=%lf\n\
36 ampcoh=%lf # 95%% coherence seg. time\n\
37 snrcoh=%lf # max snr seg. time\n\
38 "
39 #define GNUPLOT_PERBNO_BASE 300
40 
41 /* a swath of choices that make makes something sensible */
42 #define GNUPLOT_LINETYPES 9
43 #define GNUPLOT_SETTINGS "\
44 ampytics='%%5.2f' # must be same width so boxes line up\n\
45 snrytics='%%5.0f' # must be same width so boxes line up\n\
46 #\n\
47 set xtics border mirror in scale 1,0.5\n\
48 set ytics border mirror in scale 1,0.5\n\
49 set mxtics default\n\
50 set mytics 5\n\
51 set grid xtics ytics nomxtics nomytic\n\
52 \n\
53 # override linetypes for clarity below\n\
54 # 1:amp 2:fitaps 3:fitapo 4:fitaso\n\
55 # 5:snr 6:fitsnr 7:fit2p8 8:fit2p7\n\
56 set lt 1 lw %d %s ps 1 pt 22 lc rgb '%s'\n\
57 set lt 2 lw %d %s ps 1 pt 0 lc rgb '%s'\n\
58 set lt 3 lw %d %s ps 1 pt 22 lc rgb '%s'\n\
59 set lt 4 lw %d %s ps 1 pt 0 lc rgb '%s'\n\
60 set lt 5 lw %d %s ps 1 pt 22 lc rgb '%s'\n\
61 set lt 6 lw %d %s ps 1 pt 0 lc rgb '%s'\n\
62 set lt 7 lw %d %s ps 1 pt 0 lc rgb '%s'\n\
63 set lt 8 lw %d %s ps 1 pt 0 lc rgb '%s'\n\
64 #\n\
65 "
66 #define GNUPLOT_SETTINGS_BASE 900
67 
68 /* these generate a two-panel plot similar to what PGPLOT does */
69 #define GNUPLOT_TWOPANEL_HEAD_BLK "\
70 #\n\
71 set multiplot title fringe\n\
72 set log x\n\
73 #\n\
74 set origin 0,0.00\n\
75 set size 1.00,0.53\n\
76 set key %s\n\
77 unset object; unset label\n\
78 if (%d&&snrcoh>0) {# labels\n\
79 set label 1 'SNR Max. %.1lf' at %lf,%lf left front tc rgb '%s'\n\
80 set object 1 rect from %lf,%lf to %lf,%lf fc rgb '%s' fs solid %lf\\\n\
81  border rgb '%s'\n\
82 }\n\
83 set ylabel 'SNR'\n\
84 set yrange [snrn:snrx]\n\
85 set xlabel 'Segmentation Time (sec)'\n\
86 set xtics format '%%3.0f'\n\
87 set ytics format snrytics\n\
88 #\n\
89 "
90 #define GNUPLOT_TWOPANEL_HEAD_BLK_BASE 500
91 #define GNUPLOT_TWOPANEL_PLOT_SNR "\
92 plot df u 1:10 w line %s, \\\n\
93  df u 1:11 w line %s, \\\n\
94  df u 1:12 w line %s, \\\n\
95  df u 1:5:6 w yerrorlines lt 5 tit 'SNR data'\n\
96 #\n\
97 "
98 #define GNUPLOT_TWOPANEL_PLOT_SNR_BASE 300
99 #define GNUPLOT_TWOPANEL_MID_BLCK "\
100 set origin 0,0.48\n\
101 set size 1.00,0.49\n\
102 set key %s\n\
103 unset object; unset label\n\
104 if (%d&&ampcoh>0) {# labels and when plateau-slope best\n\
105 set label 2 'Amp. B.P. %.1lf' at %lf,%lf right front tc rgb '%s'\n\
106 set object 2 rect from %lf,%lf to %lf,%lf fc rgb '%s' fs solid %lf\\\n\
107  border rgb '%s'\n\
108 }\n\
109 if (%d&&ampcoh>0) {# labels\n\
110 set label 3 'Amp. Coh. %.1lf' at %lf,%lf left front tc rgb '%s'\n\
111 set object 3 rect from %lf,%lf to %lf,%lf fc rgb '%s' fs solid %lf\\\n\
112  border rgb '%s'\n\
113 }\n\
114 set ylabel 'Amplitude'\n\
115 unset xlabel\n\
116 set yrange [ampn:ampx]\n\
117 set xtics format ''\n\
118 set ytics format ampytics\n\
119 set log x\n\
120 #\n\
121 "
122 #define GNUPLOT_TWOPANEL_MID_BLCK_BASE 700
123 #define GNUPLOT_TWOPANEL_PLOT_AMP "\
124 plot df u 1:7 w line %s, \\\n\
125  df u 1:8 w line %s, \\\n\
126  df u 1:9 w line %s, \\\n\
127  df u 1:3:4 w yerrorlines lt 1 tit 'Amp data'\n\
128 #\n\
129 "
130 #define GNUPLOT_TWOPANEL_PLOT_AMP_BASE 300
131 
132 /* so the human knows this is all there is */
133 #define GNUPLOT_CODA "\
134 unset multiplot\n\
135 set output\n\
136 #\n\
137 # eof\n\
138 #\n\
139 "
140 #define GNUPLOT_CODA_BASE 100
141 
142 #endif /* __exam_gnuplot_h__ */
143 /*
144  * eof vim:nospell
145  */
double bot
Definition: exam_gnuplot.h:17
double lft
Definition: exam_gnuplot.h:17
double dens
Definition: exam_gnuplot.h:17
double x
Definition: exam_gnuplot.h:17
char * fc
Definition: exam_gnuplot.h:18
double rgt
Definition: exam_gnuplot.h:17
struct labobj labobj
double top
Definition: exam_gnuplot.h:17
double y
Definition: exam_gnuplot.h:17
Definition: exam_gnuplot.h:16