Rev 8584 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | !if $wims_read_parm!=slib_header |
13594 | bpr | 2 | !goto proc |
20 | reyssat | 3 | !endif |
4162 | bpr | 4 | |
4351 | bpr | 5 | slib_author=Georges, Khaznadar |
4162 | bpr | 6 | |
20 | reyssat | 7 | slib_example= ,,,,,,,,,[],0,0,1.2,1.5,2.4,3.2\ |
7692 | bpr | 8 | 12,8,0,0,1 max t (ms),1 max U (V),blue,red,[255,128,128],[0,0,1.3,1.4,2.5,3],0,0,1.2,1.5,2.4,3.2 |
9 | |||
20 | reyssat | 10 | !exit |
11 | |||
12 | :proc |
||
13 | |||
14 | !reset slib_xd, slib_yd, slib_bg, slib_lc, slib_dc, slib_point, slib_xo, slib_yo, slib_xs, slib_ys, slib_correct, slib_labx, slib_laby, slib_maxx, slib_maxy |
||
15 | |||
16 | slib_parm=!item 1 to 10 of $wims_read_parm |
||
17 | !distribute item $slib_parm into slib_xd, slib_yd, slib_xo, slib_yo, slib_xs, slib_ys, slib_bg, slib_lc, slib_dc, slib_correct |
||
18 | |||
19 | slib_point=!item 11 to -1 of $wims_read_parm |
||
20 | |||
21 | |||
22 | !default slib_xd=8 |
||
23 | !default slib_yd=8 |
||
24 | !default slib_xo=1 |
||
25 | !default slib_yo=1 |
||
26 | !default slib_xs=1 |
||
27 | !default slib_ys=1 |
||
28 | !default slib_correct=[] |
||
29 | |||
30 | slib_labx=!word 2 to -1 of $slib_xs |
||
31 | slib_laby=!word 2 to -1 of $slib_ys |
||
32 | slib_xs=!word 1 of $slib_xs |
||
33 | slib_ys=!word 1 of $slib_ys |
||
34 | |||
35 | slib_maxx=!word 1 of $slib_labx |
||
36 | !if $slib_maxx = max |
||
37 | slib_labx = !word 2 to -1 of $slib_labx |
||
38 | !! we need to compute the X step slib_xs, given the values |
||
39 | !! of the total width slib_xd, abscissa of origin slib_xo |
||
40 | !! and knowing that slib_xs currently means a maximum value. |
||
41 | !! slib_xd-slib_xo must be be sufficient to display ticks greater |
||
42 | !! than the current value of slib_xs, the tick step being a multiple |
||
43 | !! of 1, 2 or 5. |
||
44 | slib_log=$[log10($slib_xs/($slib_xd-$slib_xo))] |
||
45 | slib_logint=$[floor($slib_log)] |
||
46 | slib_logmant=$[$slib_log-$slib_logint] |
||
47 | !if $slib_logmant > $[log10(5)] |
||
13594 | bpr | 48 | slib_xs=1e$[$slib_logint+1] |
20 | reyssat | 49 | !else |
50 | !if $slib_logmant > $[log10(2)] |
||
51 | slib_xs=5e$slib_logint |
||
52 | !else |
||
53 | slib_xs=2e$slib_logint |
||
54 | !endif |
||
55 | !endif |
||
56 | !else |
||
57 | slib_maxx=$empty |
||
58 | !endif |
||
59 | |||
60 | slib_maxy=!word 1 of $slib_laby |
||
61 | !if $slib_maxy = max |
||
62 | slib_laby = !word 2 to -1 of $slib_laby |
||
63 | !! we need to compute the Y step slib_ys, given the values |
||
64 | !! of the total height slib_yd, ordinate of origin slib_yo |
||
65 | !! and knowing that slib_ys currently means a maximum value. |
||
66 | !! slib_yd-slib_yo must be be sufficient to display ticks greater |
||
67 | !! than the current value of slib_ys, the tick step being a multiple |
||
68 | !! of 1, 2 or 5. |
||
69 | slib_log=$[log10($slib_ys/($slib_yd-$slib_yo))] |
||
70 | slib_logint=$[floor($slib_log)] |
||
71 | slib_logmant=$[$slib_log-$slib_logint] |
||
72 | !if $slib_logmant > $[log10(5)] |
||
13594 | bpr | 73 | slib_ys=1e$[$slib_logint+1] |
20 | reyssat | 74 | !else |
75 | !if $slib_logmant > $[log10(2)] |
||
76 | slib_ys=5e$slib_logint |
||
77 | !else |
||
78 | slib_ys=2e$slib_logint |
||
79 | !endif |
||
80 | !endif |
||
81 | !else |
||
82 | slib_maxy=$empty |
||
83 | !endif |
||
84 | |||
85 | slib_dc=!declosing $slib_dc |
||
86 | |||
87 | slib_correct=!declosing $slib_correct |
||
88 | slib_point=!declosing $slib_point |
||
89 | |||
90 | slib_bg=!declosing $slib_bg |
||
91 | !default slib_bg=240,233,255 |
||
92 | |||
93 | slib_lc=!declosing $slib_lc |
||
94 | !default slib_lc=255,220,180 |
||
95 | |||
96 | slib_dc=!declosing $slib_dc |
||
97 | !default slib_dc=10,10,10 |
||
98 | |||
99 | !!!!!!!!!!!!!!!!! begin grid !!!!!!!!!!!!!!!!!!!!!!!!! |
||
100 | |||
101 | slib_grey=128,128,128 |
||
102 | |||
103 | slib_dessin = new 60*$slib_xd,60*$slib_yd\ |
||
104 | xrange -0.5, 10*$slib_xd-0.5\ |
||
105 | yrange -0.5, 10*$slib_yd-0.5\ |
||
106 | fill 1,1,$slib_bg |
||
107 | |||
108 | !! traits fins tous les millimetres |
||
109 | slib_dessin=$slib_dessin\ |
||
110 | linewidth 1\ |
||
111 | parallel 0, 0, 0, 10*$slib_yd, 1, 0, 10*$slib_xd+1, $slib_lc\ |
||
112 | parallel 0, 0, 10*$slib_xd, 0, 0, 1, 10*$slib_yd+1, $slib_lc |
||
113 | |||
114 | !! traits gros tous les centimetres |
||
115 | slib_dessin=$slib_dessin\ |
||
116 | linewidth 3\ |
||
117 | parallel 0, 0, 0, 10*$slib_yd, 10, 0, $slib_xd+1, $slib_lc\ |
||
118 | parallel 0, 0, 10*$slib_xd, 0, 0, 10, $slib_yd+1, $slib_lc |
||
119 | |||
120 | !! axe_x |
||
121 | slib_dessin=$slib_dessin\ |
||
122 | linewidth 3\ |
||
123 | hline 0, $[10*$slib_yo], $slib_grey\ |
||
8584 | bpr | 124 | segment $[10*$slib_xd-3],$[10*$slib_yo-1],$[10*$slib_xd-1],$[10*$slib_yo], $slib_grey\ |
125 | segment $[10*$slib_xd-3],$[10*$slib_yo+1],$[10*$slib_xd-1],$[10*$slib_yo], $slib_grey\ |
||
20 | reyssat | 126 | parallel 0,$[10*$slib_yo+1],0,$[10*$slib_yo-1], 10, 0, $slib_xd+1, $slib_grey |
127 | |||
128 | slib_val=$[-$slib_xo*$slib_xs] |
||
129 | slib_dessin=$slib_dessin\ |
||
130 | linewidth 1 |
||
131 | !for slib_x from 0 to 10*$slib_xd step 10 |
||
13594 | bpr | 132 | slib_dessin=$slib_dessin\ |
133 | text blue,$[$slib_x+1],$[10*$slib_yo-1],medium,$slib_val |
||
134 | slib_val=$[$slib_val+$slib_xs] |
||
20 | reyssat | 135 | !next slib_x |
136 | !if $slib_labx != $empty |
||
137 | slib_dessin=$slib_dessin\ |
||
138 | text blue,$[$slib_x-20],$[10*$slib_yo-6],medium,$slib_labx |
||
139 | !endif |
||
140 | |||
141 | !! axe_y |
||
142 | slib_dessin=$slib_dessin\ |
||
143 | linewidth 3\ |
||
144 | vline $[10*$slib_xo],0, $slib_grey\ |
||
8584 | bpr | 145 | segment $[10*$slib_xo-1],$[10*$slib_yd-3],$[10*$slib_xo],$[10*$slib_yd-1], $slib_grey\ |
146 | segment $[10*$slib_xo+1],$[10*$slib_yd-3],$[10*$slib_xo],$[10*$slib_yd-1], $slib_grey\ |
||
20 | reyssat | 147 | parallel $[10*$slib_xo+1],0,$[10*$slib_xo-1], 0, 0, 10, $slib_yd+1, $slib_grey |
148 | |||
149 | slib_val=$[-$slib_yo*$slib_ys] |
||
150 | slib_dessin=$slib_dessin\ |
||
151 | linewidth 1 |
||
152 | !for slib_y from 0 to 10*$slib_yd step 10 |
||
13594 | bpr | 153 | slib_dessin=$slib_dessin\ |
154 | text blue,$[10*$slib_xo+1],$[$slib_y-1],medium,$slib_val |
||
155 | slib_val=$[$slib_val+$slib_ys] |
||
20 | reyssat | 156 | !next slib_y |
157 | !if $slib_laby != $empty |
||
158 | slib_dessin=$slib_dessin\ |
||
159 | text blue,$[10*$slib_xo-9],$[$slib_y-10],medium,$slib_laby |
||
160 | !endif |
||
161 | |||
162 | !!!!!!!!!!!!!!!!! end grid !!!!!!!!!!!!!!!!!!!!!!!!! |
||
163 | |||
164 | !! red dots : the correct list |
||
165 | n1=!itemcnt $slib_correct |
||
166 | !for i from 1 to $n1 step 2 |
||
13594 | bpr | 167 | !if $i < $n1 |
168 | slib_x=!item $i of $slib_correct |
||
169 | slib_x=$[10*$slib_x/$slib_xs] |
||
170 | slib_y=!item $[$i+1] of $slib_correct |
||
171 | slib_y=$[10*$slib_y/$slib_ys] |
||
172 | slib_x1=$[10*$slib_xo+$slib_x-0.6] |
||
173 | slib_x2=$[10*$slib_xo+$slib_x+0.6] |
||
174 | slib_y1=$[10*$slib_yo+$slib_y-0.6] |
||
175 | slib_y2=$[10*$slib_yo+$slib_y+0.6] |
||
176 | !! add one red dot |
||
177 | slib_dessin=$slib_dessin\ |
||
178 | linewidth 2\ |
||
179 | segment $slib_x1,$slib_y1,$slib_x2,$slib_y2,red\ |
||
180 | segment $slib_x2,$slib_y1,$slib_x1,$slib_y2,red |
||
181 | !endif $i < $n1 |
||
20 | reyssat | 182 | !next i |
183 | |||
184 | !! black dots |
||
185 | n2=!itemcnt $slib_point |
||
186 | !for i from 1 to $n2 step 2 |
||
13594 | bpr | 187 | !if $i < $n2 |
188 | slib_x=!item $i of $slib_point |
||
189 | slib_x=$[10*$slib_x/$slib_xs] |
||
190 | slib_y=!item $[$i+1] of $slib_point |
||
191 | slib_y=$[10*$slib_y/$slib_ys] |
||
192 | slib_x1=$[10*$slib_xo+$slib_x-0.6] |
||
193 | slib_x2=$[10*$slib_xo+$slib_x+0.6] |
||
194 | slib_y1=$[10*$slib_yo+$slib_y-0.6] |
||
195 | slib_y2=$[10*$slib_yo+$slib_y+0.6] |
||
196 | !! add one '$slib_dc' dot |
||
197 | slib_dessin=$slib_dessin\ |
||
198 | linewidth 2\ |
||
199 | segment $slib_x1,$slib_y1,$slib_x2,$slib_y2,$slib_dc\ |
||
200 | segment $slib_x2,$slib_y1,$slib_x1,$slib_y2,$slib_dc |
||
201 | !endif $i < $n2 |
||
20 | reyssat | 202 | !next i |
203 | |||
204 | slib_out= $slib_dessin |