CMS 3D CMS Logo

TkAlMapDesign_phase0_cfg.py
Go to the documentation of this file.
1 
2 M_X = 1.
3 M_Y = 2.5
4 M_T = .2
5 
6 PIX_D_W = 10.
7 #PIX_L_W = 20.
8 #PIX_L_H = 10.
9 PIX_L_W = 24.
10 PIX_L_H = 12.
11 
12 STR_D_W = 10.
13 STR_TID_D_W = 5.5
14 STR_L_W = 24.
15 STR_L_H = 12.
16 
17 TkMap_GEO = {
18  'pixel' : {
19  'BPIX': {
20  'L1': {
21  'file': 'Relative_TPolyLine_Pixel_BPIX_L1.txt',
22  'x_off': -PIX_L_W - M_X - M_X,
23  'y_off': -PIX_L_H - M_Y - PIX_L_H/2. + M_Y/2.,
24  'x_scale': PIX_L_W,
25  'y_scale': PIX_L_H,
26  },
27  'L2': {
28  'file': 'Relative_TPolyLine_Pixel_BPIX_L2.txt',
29  'x_off': -PIX_L_W - M_X - M_X,
30  'y_off': -PIX_L_H/2. + M_Y/2.,
31  'x_scale': PIX_L_W,
32  'y_scale': PIX_L_H,
33  },
34  'L3': {
35  'file': 'Relative_TPolyLine_Pixel_BPIX_L3.txt',
36  'x_off': -PIX_L_W - M_X - M_X,
37  'y_off': PIX_L_H/2. + M_Y + M_Y/2.,
38  'x_scale': PIX_L_W,
39  'y_scale': PIX_L_H,
40  },
41  },
42  'FPIX-': {
43  '-1': {
44  'file': 'Relative_TPolyLine_Pixel_FPIX_-1.txt',
45  'x_off': -PIX_L_W - M_X - M_X,
46  #'x_off': -2*PIX_L_W - 2*M_X,
47  'y_off': -PIX_L_H - M_Y - PIX_L_H/2. + M_Y/2. - M_Y - PIX_D_W,
48  #'y_off': -PIX_L_H - M_Y - PIX_D_W,
49  'x_scale': PIX_D_W,
50  'y_scale': PIX_D_W,
51  },
52  '-2': {
53  'file': 'Relative_TPolyLine_Pixel_FPIX_-2.txt',
54  'x_off': -PIX_D_W - M_X - M_X,
55  #'x_off': -PIX_L_W - M_X - PIX_L_W/4. - M_X/2.,
56  'y_off': -PIX_L_H - M_Y - PIX_L_H/2. + M_Y/2. - M_Y - PIX_D_W,
57  #'y_off': -PIX_L_H - M_Y - PIX_D_W,
58  'x_scale': PIX_D_W,
59  'y_scale': PIX_D_W,
60  },
61  },
62  'FPIX+': {
63  '+1': {
64  'file': 'Relative_TPolyLine_Pixel_FPIX_+1.txt',
65  'x_off': -PIX_L_W - M_X - M_X,
66  #'x_off': -2*PIX_L_W - 2*M_X,
67  'y_off': PIX_L_H/2. + M_Y + M_Y/2. + PIX_L_H + M_Y,
68  #'y_off': PIX_L_H + 2*M_Y,
69  'x_scale': PIX_D_W,
70  'y_scale': PIX_D_W,
71  },
72  '+2': {
73  'file': 'Relative_TPolyLine_Pixel_FPIX_+2.txt',
74  'x_off': -PIX_D_W - M_X - M_X,
75  #'x_off': -PIX_L_W - M_X - PIX_L_W/4. - M_X/2.,
76  'y_off': PIX_L_H/2. + M_Y + M_Y/2. + PIX_L_H + M_Y,
77  #'y_off': PIX_L_H + 2*M_Y,
78  'x_scale': PIX_D_W,
79  'y_scale': PIX_D_W,
80  },
81  },
82  },
83  'strips': {
84  'TIB': {
85  'L1': {
86  'file': 'Relative_TPolyLine_Strips_TIB_L1.txt',
87  'x_off': M_X,
88  'y_off': -STR_L_H,
89  'x_scale': STR_L_W,
90  'y_scale': STR_L_H,
91  },
92  'L2': {
93  'file': 'Relative_TPolyLine_Strips_TIB_L2.txt',
94  'x_off': 2*M_X + STR_L_W,
95  'y_off': -STR_L_H,
96  'x_scale': STR_L_W,
97  'y_scale': STR_L_H,
98  },
99  'L3': {
100  'file': 'Relative_TPolyLine_Strips_TIB_L3.txt',
101  'x_off': M_X,
102  'y_off': M_Y,
103  'x_scale': STR_L_W,
104  'y_scale': STR_L_H,
105  },
106  'L4': {
107  'file': 'Relative_TPolyLine_Strips_TIB_L4.txt',
108  'x_off': 2*M_X + STR_L_W,
109  'y_off': M_Y,
110  'x_scale': STR_L_W,
111  'y_scale': STR_L_H,
112  },
113  },
114  'TOB': {
115  'L1': {
116  'file': 'Relative_TPolyLine_Strips_TOB_L1.txt',
117  'x_off': 3*M_X + 2*STR_L_W,
118  'y_off': -STR_L_H - M_Y - STR_L_H/2. + M_Y/2.,
119  'x_scale': STR_L_W,
120  'y_scale': STR_L_H,
121  },
122  'L2': {
123  'file': 'Relative_TPolyLine_Strips_TOB_L2.txt',
124  'x_off': 4*M_X + 3*STR_L_W,
125  'y_off': -STR_L_H - M_Y - STR_L_H/2. + M_Y/2.,
126  'x_scale': STR_L_W,
127  'y_scale': STR_L_H,
128  },
129  'L3': {
130  'file': 'Relative_TPolyLine_Strips_TOB_L3.txt',
131  'x_off': 3*M_X + 2*STR_L_W,
132  'y_off': - STR_L_H/2. + M_Y/2.,
133  'x_scale': STR_L_W,
134  'y_scale': STR_L_H,
135  },
136  'L4': {
137  'file': 'Relative_TPolyLine_Strips_TOB_L4.txt',
138  'x_off': 4*M_X + 3*STR_L_W,
139  'y_off': - STR_L_H/2. + M_Y/2.,
140  'x_scale': STR_L_W,
141  'y_scale': STR_L_H,
142  },
143  'L5': {
144  'file': 'Relative_TPolyLine_Strips_TOB_L5.txt',
145  'x_off': 3*M_X + 2*STR_L_W,
146  'y_off': STR_L_H/2. + M_Y + M_Y/2.,
147  'x_scale': STR_L_W,
148  'y_scale': STR_L_H,
149  },
150  'L6': {
151  'file': 'Relative_TPolyLine_Strips_TOB_L6.txt',
152  'x_off': 4*M_X + 3*STR_L_W,
153  'y_off': STR_L_H/2. + M_Y + M_Y/2.,
154  'x_scale': STR_L_W,
155  'y_scale': STR_L_H,
156  },
157  },
158  'TID-': {
159  '-1': {
160  'file': 'Relative_TPolyLine_Strips_TID_-1.txt',
161  'x_off': M_X + (STR_L_W + M_X)/2.,
162  'y_off': - STR_L_H - M_Y - STR_TID_D_W,
163  'x_scale': STR_TID_D_W,
164  'y_scale': STR_TID_D_W,
165  },
166  '-2': {
167  'file': 'Relative_TPolyLine_Strips_TID_-2.txt',
168  'x_off': M_X + STR_L_W/2. - STR_TID_D_W/2. + (STR_L_W + M_X)/2.,
169  'y_off': - STR_L_H - M_Y - STR_TID_D_W,
170  'x_scale': STR_TID_D_W,
171  'y_scale': STR_TID_D_W,
172  },
173  '-3': {
174  'file': 'Relative_TPolyLine_Strips_TID_-3.txt',
175  'x_off': M_X + STR_L_W - STR_TID_D_W + (STR_L_W + M_X)/2.,
176  'y_off': - STR_L_H - M_Y - STR_TID_D_W,
177  'x_scale': STR_TID_D_W,
178  'y_scale': STR_TID_D_W,
179  },
180  },
181  'TID+': {
182  '+1': {
183  'file': 'Relative_TPolyLine_Strips_TID_+1.txt',
184  'x_off': M_X + (STR_L_W + M_X)/2.,
185  'y_off': STR_L_H +2*M_Y,
186  'x_scale': STR_TID_D_W,
187  'y_scale': STR_TID_D_W,
188  },
189  '+2': {
190  'file': 'Relative_TPolyLine_Strips_TID_+2.txt',
191  'x_off': M_X + STR_L_W/2. - STR_TID_D_W/2. + (STR_L_W + M_X)/2.,
192  'y_off': STR_L_H +2*M_Y,
193  'x_scale': STR_TID_D_W,
194  'y_scale': STR_TID_D_W,
195  },
196  '+3': {
197  'file': 'Relative_TPolyLine_Strips_TID_+3.txt',
198  'x_off': M_X + STR_L_W - STR_TID_D_W + (STR_L_W + M_X)/2.,
199  'y_off': STR_L_H +2*M_Y,
200  'x_scale': STR_TID_D_W,
201  'y_scale': STR_TID_D_W,
202  },
203  },
204  'TEC-': {
205  '-1': {
206  'file': 'Relative_TPolyLine_Strips_TEC_-1.txt',
207  'x_off': M_X,
208  'y_off': -STR_L_H - M_Y - STR_L_H/2. + M_Y/2. - M_Y - STR_D_W,
209  'x_scale': STR_D_W,
210  'y_scale': STR_D_W,
211  },
212  '-2': {
213  'file': 'Relative_TPolyLine_Strips_TEC_-2.txt',
214  'x_off': M_X +((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
215  'y_off': -STR_L_H - M_Y - STR_L_H/2. + M_Y/2. - M_Y - STR_D_W,
216  'x_scale': STR_D_W,
217  'y_scale': STR_D_W,
218  },
219  '-3': {
220  'file': 'Relative_TPolyLine_Strips_TEC_-3.txt',
221  'x_off': M_X + 2*((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
222  'y_off': -STR_L_H - M_Y - STR_L_H/2. + M_Y/2. - M_Y - STR_D_W,
223  'x_scale': STR_D_W,
224  'y_scale': STR_D_W,
225  },
226  '-4': {
227  'file': 'Relative_TPolyLine_Strips_TEC_-4.txt',
228  'x_off': M_X + 3*((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
229  'y_off': -STR_L_H - M_Y - STR_L_H/2. + M_Y/2. - M_Y - STR_D_W,
230  'x_scale': STR_D_W,
231  'y_scale': STR_D_W,
232  },
233  '-5': {
234  'file': 'Relative_TPolyLine_Strips_TEC_-5.txt',
235  'x_off': M_X + 4*((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
236  'y_off': -STR_L_H - M_Y - STR_L_H/2. + M_Y/2. - M_Y - STR_D_W,
237  'x_scale': STR_D_W,
238  'y_scale': STR_D_W,
239  },
240  '-6': {
241  'file': 'Relative_TPolyLine_Strips_TEC_-6.txt',
242  'x_off': M_X + 5*((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
243  'y_off': -STR_L_H - M_Y - STR_L_H/2. + M_Y/2. - M_Y - STR_D_W,
244  'x_scale': STR_D_W,
245  'y_scale': STR_D_W,
246  },
247  '-7': {
248  'file': 'Relative_TPolyLine_Strips_TEC_-7.txt',
249  'x_off': M_X + 6*((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
250  'y_off': -STR_L_H - M_Y - STR_L_H/2. + M_Y/2. - M_Y - STR_D_W,
251  'x_scale': STR_D_W,
252  'y_scale': STR_D_W,
253  },
254  '-8': {
255  'file': 'Relative_TPolyLine_Strips_TEC_-8.txt',
256  'x_off': M_X + 7*((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
257  'y_off': -STR_L_H - M_Y - STR_L_H/2. + M_Y/2. - M_Y - STR_D_W,
258  'x_scale': STR_D_W,
259  'y_scale': STR_D_W,
260  },
261  '-9': {
262  'file': 'Relative_TPolyLine_Strips_TEC_-9.txt',
263  'x_off': M_X + 8*((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
264  'y_off': -STR_L_H - M_Y - STR_L_H/2. + M_Y/2. - M_Y - STR_D_W,
265  'x_scale': STR_D_W,
266  'y_scale': STR_D_W,
267  },
268  },
269  'TEC+': {
270  '+1': {
271  'file': 'Relative_TPolyLine_Strips_TEC_+1.txt',
272  'x_off': M_X,
273  'y_off': STR_L_H + STR_L_H/2. + M_Y/2. + 2*M_Y,
274  'x_scale': STR_D_W,
275  'y_scale': STR_D_W,
276  },
277  '+2': {
278  'file': 'Relative_TPolyLine_Strips_TEC_+2.txt',
279  'x_off': M_X + ((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
280  'y_off': STR_L_H + STR_L_H/2. + M_Y/2. + 2*M_Y,
281  'x_scale': STR_D_W,
282  'y_scale': STR_D_W,
283  },
284  '+3': {
285  'file': 'Relative_TPolyLine_Strips_TEC_+3.txt',
286  'x_off': M_X + 2*((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
287  'y_off': STR_L_H + STR_L_H/2. + M_Y/2. + 2*M_Y,
288  'x_scale': STR_D_W,
289  'y_scale': STR_D_W,
290  },
291  '+4': {
292  'file': 'Relative_TPolyLine_Strips_TEC_+4.txt',
293  'x_off': M_X + 3*((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
294  'y_off': STR_L_H + STR_L_H/2. + M_Y/2. + 2*M_Y,
295  'x_scale': STR_D_W,
296  'y_scale': STR_D_W,
297  },
298  '+5': {
299  'file': 'Relative_TPolyLine_Strips_TEC_+5.txt',
300  'x_off': M_X + 4*((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
301  'y_off': STR_L_H + STR_L_H/2. + M_Y/2. + 2*M_Y,
302  'x_scale': STR_D_W,
303  'y_scale': STR_D_W,
304  },
305  '+6': {
306  'file': 'Relative_TPolyLine_Strips_TEC_+6.txt',
307  'x_off': M_X + 5*((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
308  'y_off': STR_L_H + STR_L_H/2. + M_Y/2. + 2*M_Y,
309  'x_scale': STR_D_W,
310  'y_scale': STR_D_W,
311  },
312  '+7': {
313  'file': 'Relative_TPolyLine_Strips_TEC_+7.txt',
314  'x_off': M_X + 6*((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
315  'y_off': STR_L_H + STR_L_H/2. + M_Y/2. + 2*M_Y,
316  'x_scale': STR_D_W,
317  'y_scale': STR_D_W,
318  },
319  '+8': {
320  'file': 'Relative_TPolyLine_Strips_TEC_+8.txt',
321  'x_off': M_X + 7*((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
322  'y_off': STR_L_H + STR_L_H/2. + M_Y/2. + 2*M_Y,
323  'x_scale': STR_D_W,
324  'y_scale': STR_D_W,
325  },
326  '+9': {
327  'file': 'Relative_TPolyLine_Strips_TEC_+9.txt',
328  'x_off': M_X + 8*((4*STR_L_W + 3*M_X - 9*STR_D_W)/8. + STR_D_W),
329  'y_off': STR_L_H + STR_L_H/2. + M_Y/2. + 2*M_Y,
330  'x_scale': STR_D_W,
331  'y_scale': STR_D_W,
332  },
333  },
334  },
335 }
336 
337 # Add text
338 for layer in TkMap_GEO['pixel']['BPIX']:
339  TkMap_GEO['pixel']['BPIX'][layer]['latex'] = {
340  'text': 'BPIX '+layer,
341  'x': TkMap_GEO['pixel']['BPIX'][layer]['x_off'],
342  'y': TkMap_GEO['pixel']['BPIX'][layer]['y_off'] + PIX_L_H + M_T,
343  'alignment': 11,
344  }
345 
346 for z in ['-', '+']:
347  TkMap_GEO['pixel']['FPIX'+z]['latex'] = {
348  'text': 'FPIX',
349  'x': TkMap_GEO['pixel']['FPIX'+z][z+'1']['x_off'],
350  'y': TkMap_GEO['pixel']['FPIX'+z][z+'1']['y_off'] + PIX_D_W + M_T,
351  'alignment': 11,
352  }
353  for disc in TkMap_GEO['pixel']['FPIX'+z]:
354  if disc == 'latex': continue
355  TkMap_GEO['pixel']['FPIX'+z][disc]['latex'] = {
356  'text': disc,
357  'x': TkMap_GEO['pixel']['FPIX'+z][disc]['x_off'] + PIX_D_W,
358  'y': TkMap_GEO['pixel']['FPIX'+z][disc]['y_off'] + PIX_D_W,
359  #'alignment': 33,
360  'alignment': 23,
361  }
362 for det in ['TIB', 'TOB']:
363  for layer in TkMap_GEO['strips'][det]:
364  TkMap_GEO['strips'][det][layer]['latex'] = {
365  'text': det+' '+layer,
366  'x': TkMap_GEO['strips'][det][layer]['x_off'],
367  'y': TkMap_GEO['strips'][det][layer]['y_off'] + STR_L_H + M_T,
368  'alignment': 11,
369  }
370 
371 for z in ['-', '+']:
372  TkMap_GEO['strips']['TEC'+z]['latex'] = {
373  'text': 'TEC',
374  'x': TkMap_GEO['strips']['TEC'+z][z+'1']['x_off'],
375  'y': TkMap_GEO['strips']['TEC'+z][z+'1']['y_off'] + STR_D_W + M_T,
376  'alignment': 11,
377  }
378  for disc in TkMap_GEO['strips']['TEC'+z]:
379  if disc == 'latex': continue
380  TkMap_GEO['strips']['TEC'+z][disc]['latex'] = {
381  'text': disc,
382  'x': TkMap_GEO['strips']['TEC'+z][disc]['x_off'] + STR_D_W,
383  'y': TkMap_GEO['strips']['TEC'+z][disc]['y_off'] + STR_D_W,
384  #'alignment': 33,
385  'alignment': 23,
386  }
387 
388 # TID
389 for z in ['-', '+']:
390  TkMap_GEO['strips']['TID'+z]['latex'] = {
391  'text': 'TID',
392  #'x': TkMap_GEO['strips']['TID'+z][z+'1']['x_off'],
393  'x': TkMap_GEO['strips']['TID'+z][z+'1']['x_off'] - 2*M_T,
394  #'y': TkMap_GEO['strips']['TID'+z][z+'1']['y_off'] + STR_TID_D_W + M_T,
395  'y': TkMap_GEO['strips']['TID'+z][z+'1']['y_off'] + STR_TID_D_W/2.,
396  #'alignment': 11,
397  'alignment': 32,
398  }
399  for disc in TkMap_GEO['strips']['TID'+z]:
400  if disc == 'latex': continue
401  TkMap_GEO['strips']['TID'+z][disc]['latex'] = {
402  'text': disc,
403  'x': TkMap_GEO['strips']['TID'+z][disc]['x_off'] + STR_TID_D_W,
404  'y': TkMap_GEO['strips']['TID'+z][disc]['y_off'] + STR_TID_D_W,
405  'alignment': 13,
406  }
407 
408 def read_TPLfile(file_name):
409  o_file = open(file_name, 'r')
410  lines = o_file.readlines()
411  o_file.close()
412 
413  TPL_dict = {}
414  for line in lines:
415  if '#' in line: continue
416  splt_line = line.replace('\n', '').split(' ')
417  det_id = int(splt_line[0])
418  x = []
419  y = []
420  for idx,coo in enumerate(splt_line[1:]):
421  #print(coo)
422  try:
423  val = float(coo)
424  if (idx%2) == 0:
425  y.append(val)
426  else:
427  x.append(val)
428  except ValueError:
429  continue
430  TPL_dict[det_id] = {}
431  TPL_dict[det_id]['x'] = x
432  TPL_dict[det_id]['y'] = y
433  return TPL_dict
434 
435 
436 
437 if __name__ == '__main__':
438  import ROOT
439  from array import array
440  #TPL_dict = read_TPLfile('Relative_TPolyLine_Pixel_phase1_BPIX_L1.txt')
441  #print(TPL_dict)
442 
443  def test_draw(w, h):
444  canvas = ROOT.TCanvas('canvas', 'detector canvas', w, h)
445 
446  # Load all modules in absolute positions
447  # Find max x and y to rescale later for window
448  all_modules = {}
449  all_text = {}
450  x_max = -9999.
451  y_max = -9999.
452  x_min = 9999.
453  y_min = 9999.
454  for det in TkMap_GEO:
455  for sub in TkMap_GEO[det]:
456  for part in TkMap_GEO[det][sub]:
457  if part == 'latex':
458  all_text[det+'_'+sub] = TkMap_GEO[det][sub][part]
459  continue
460  if 'latex' in TkMap_GEO[det][sub][part]:
461  all_text[det+'_'+sub+'_'+part] = TkMap_GEO[det][sub][part]['latex']
462  TPL_dict = read_TPLfile(TkMap_GEO[det][sub][part]['file'])
463  for module in TPL_dict:
464  x_canv = []
465  y_canv = []
466  for idx in range(len(TPL_dict[module]['x'])):
467  x_canv.append(TPL_dict[module]['x'][idx]*TkMap_GEO[det][sub][part]['x_scale'] + TkMap_GEO[det][sub][part]['x_off'])
468  y_canv.append(TPL_dict[module]['y'][idx]*TkMap_GEO[det][sub][part]['y_scale'] + TkMap_GEO[det][sub][part]['y_off'])
469  if max(x_canv) > x_max: x_max = max(x_canv)
470  if max(y_canv) > y_max: y_max = max(y_canv)
471  if min(x_canv) < x_min: x_min = min(x_canv)
472  if min(y_canv) < y_min: y_min = min(y_canv)
473  TPL_dict[module]['x'] = x_canv
474  TPL_dict[module]['y'] = y_canv
475  all_modules.update(TPL_dict)
476 
477  r_margin = 1
478  l_margin = 1
479  t_margin = 1
480  b_margin = 1
481 
482  x_max += r_margin
483  x_min -= l_margin
484  y_max += t_margin
485  y_min -= b_margin
486 
487  x_range = x_max - x_min
488  y_range = y_max - y_min
489  if (x_range + 0.)/(w + 0.) > (y_range + 0.)/(h + 0.):
490  x_scale = x_range
491  y_scale = (h + 0.)/(w + 0.)*x_range
492  else:
493  y_scale = y_range
494  x_scale = (w + 0.)/(h + 0.)*y_range
495  TPL = {}
496  for module in all_modules:
497  x = array('d', [])
498  y = array('d', [])
499  for idx in range(len(all_modules[module]['x'])):
500  x.append((all_modules[module]['x'][idx] - x_min + 0.)/(x_scale + 0.))
501  y.append((all_modules[module]['y'][idx] - y_min + 0.)/(y_scale + 0.))
502  # Begin point is end point
503  x.append((all_modules[module]['x'][0] - x_min + 0.)/(x_scale + 0.))
504  y.append((all_modules[module]['y'][0] - y_min + 0.)/(y_scale + 0.))
505  #print(x, y)
506  TPL[module] = ROOT.TPolyLine(len(x), x, y)
507  #TPL[module].SetFillColor(1)
508  TPL[module].SetLineColor(1)
509  TPL[module].Draw('f')
510  TPL[module].Draw()
511  TL = ROOT.TLatex()
512  TL.SetTextSize(0.025)
513  for key in all_text:
514  x = (all_text[key]['x'] - x_min + 0.)/(x_scale + 0.)
515  y = (all_text[key]['y'] - y_min + 0.)/(y_scale + 0.)
516  TL.SetTextAlign(all_text[key]['alignment'])
517  TL.DrawLatex(x, y, all_text[key]['text'])
518  #TL.SetTextSize(0.025)
519  #TL.SetTextAlign(11)
520  #TL.DrawLatex(0.1, 0.1, 'bottom')
521  #TL.SetTextAlign(13)
522  #TL.DrawLatex(0.1, 0.1, 'top')
523  canvas.Update()
524  raw_input('exit')
525 
526  test_draw(1500, 750)
527  #test_draw(125, 500)
528  #test_draw(500, 500)
529  #raw_input('exit')
530 
531