HOPS
HOPS class reference
splotemp.h
Go to the documentation of this file.
1 /*
2  * This file holds templates used to construct the
3  * eventual gnuplot splot command; the idea is similar
4  * to what is done in cohfit, but it is a simpler plot.
5  */
6 #if BIGGER
7 #ifndef __splotemp_h__
8 #define __splotemp_h__
9 
10 /* pdfcairo terminal setup */
11 #define GNUPLOT_PDFILE "\
12 # comment-out the next two lines and you can load into gnuplot and\n\
13 # then also comment out both 'set output' lines around the splot cmd\n\
14 trmsize=%lf; xtrmsize=trmsize*%lf; ytrmsize=trmsize*%lf\n\
15 set term pdfcairo size xtrmsize,ytrmsize font '%s,%d'\n\
16 set title \"Fringe: %s\\n%s\" font '%s,%d' offset 0,1\n\
17 "
18 
19 /* gnuplot appears to consider the x and y indices to refer to the lower-left
20  * corner of a grid box. PGPLOT appears to have had a different convention.
21  * these offsets produce the correct appearance in the regression test
22  * comparison, but this should be confirmed in a careful examination of code.*/
23 #define X_COORD_SHIFT 0.5 /* shift rate for map */
24 #define Y_COORD_SHIFT 0.5 /* shift delay for map */
25 
26 /* pre-command configuration */
27 #define GNUPLOT_CONFIG "\
28 #\n\
29 set key off\n\
30 set view map\n\
31 set isosamples %d\n\
32 set dgrid3d %d,%d %s %d # N,M values\n\
33 set contour base\n\
34 set cntrparam bspline order %d\n\
35 set cntrparam firstlinetype 7\n\
36 if (%d == 2) {\n\
37 set cntrparam levels incremental %lf, %lf\n\
38 } else {\n\
39 set cntrparam levels auto\n\
40 }\n\
41 set pm3d at b\n\
42 # function for linear in t from mn to mx in nn steps\n\
43 ldr(sf, t, mn,pk,mx,nn) = \\\n\
44  sf*((mn-pk)*((nn-1-t)/(nn-1)) + (mx-pk)*(t/(nn-1)))\n\
45 f(x) = ldr(%lf, x-%lf, %lf,%lf,%lf,%d) # rate scaling function on 0:N-1\n\
46 g(y) = ldr(%lf, y-%lf, %lf,%lf,%lf,%d) # delay scaling function on 0:M-1\n\
47 set xrange [f(0):f(%d)] noextend\n\
48 set xlabel 'Resid.Rate (%s) from Peak Rate (at %.3f %s)'\n\
49 set yrange [g(0):g(%d)] noextend\n\
50 set ylabel 'Resid.Delay (%s) from Peak Delay (at %.3f %s)'\n\
51 set zrange [%lf:%lf]\n\
52 set cblabel '%s'\n\
53 set palette %s %s\n\
54 #\n\
55 "
56 
57 /* splot command */
58 #define GNUPLOT_SPLOT "\
59 set output '%s'\n\
60 # disable drawing the lines of the surface which is flat\n\
61 unset surface\n\
62 set object 1 rect from graph 0,0 to graph 1,1 behind fc rgb '%s'\n\
63 set object 2 circle center %lf,%lf size screen %lf \\\n\
64  front fc rgb '%s' fs transparent solid %lf noborder\n\
65 splot '%s' using (f($1)):(g($2)):3 with lines\n\
66 set output\n\
67 #\n\
68 # eof\n\
69 #\n\
70 "
71 
72 #endif /* __splotemp_h__ */
73 #endif /* BIGGER */
74 /*
75  * end vim:nospell
76  */