Changeset 78a205a in sasview for src/sas/perspectives/invariant/invariant_details.py
- Timestamp:
- Mar 5, 2015 10:29:42 AM (10 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- dca6188
- Parents:
- 74f419d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/perspectives/invariant/invariant_details.py
r79492222 r78a205a 8 8 from invariant_widgets import OutputTextCtrl 9 9 # Dimensions related to chart 10 RECTANGLE_WIDTH = 400.010 RECTANGLE_WIDTH = 400.0 11 11 RECTANGLE_HEIGHT = 20 12 # Invariant panel size12 # Invariant panel size 13 13 _BOX_WIDTH = 76 14 14 15 # scale to use for a bar of value zero16 RECTANGLE_SCALE 17 DEFAULT_QSTAR = 1.0 18 15 # scale to use for a bar of value zero 16 RECTANGLE_SCALE = 0.0001 17 DEFAULT_QSTAR = 1.0 18 19 19 if sys.platform.count("win32") > 0: 20 20 _STATICBOX_WIDTH = 450 … … 27 27 PANEL_HEIGHT = 430 28 28 FONT_VARIANT = 1 29 30 ERROR_COLOR = wx.Colour(255, 31 EXTRAPOLATION_COLOR = wx.Colour(169, 32 INVARIANT_COLOR = wx.Colour(67, 208, 128, 128)33 34 29 30 ERROR_COLOR = wx.Colour(255, 0, 0, 128) 31 EXTRAPOLATION_COLOR = wx.Colour(169, 169, 168, 128) 32 INVARIANT_COLOR = wx.Colour(67, 208, 128, 128) 33 34 35 35 class InvariantContainer(wx.Object): 36 36 """ 37 37 This class stores some values resulting resulting from invariant 38 calculations. Given the value of total invariant, this class can also 38 calculations. Given the value of total invariant, this class can also 39 39 determine the percentage of invariants resulting from extrapolation. 40 40 """ 41 41 def __init__(self): 42 # invariant at low range42 # invariant at low range 43 43 self.qstar_low = None 44 # invariant at low range error44 # invariant at low range error 45 45 self.qstar_low_err = None 46 # invariant46 # invariant 47 47 self.qstar = None 48 # invariant error48 # invariant error 49 49 self.qstar_err = None 50 # invariant at high range50 # invariant at high range 51 51 self.qstar_high = None 52 # invariant at high range error52 # invariant at high range error 53 53 self.qstar_high_err = None 54 # invariant total54 # invariant total 55 55 self.qstar_total = None 56 # invariant error56 # invariant error 57 57 self.qstar_total_err = None 58 # scale58 # scale 59 59 self.qstar_low_percent = None 60 60 self.qstar_high_percent = None … … 63 63 self.existing_warning = False 64 64 self.warning_msg = "No Details on calculations available...\n" 65 65 66 66 def compute_percentage(self): 67 67 """ … … 73 73 self.qstar_high = None 74 74 self.check_values() 75 return 76 77 # compute invariant percentage75 return 76 77 # compute invariant percentage 78 78 if self.qstar is None: 79 79 self.qstar_percent = None 80 80 else: 81 81 try: 82 self.qstar_percent = float(self.qstar) /float(self.qstar_total)82 self.qstar_percent = float(self.qstar) / float(self.qstar_total) 83 83 except: 84 84 self.qstar_percent = 'error' 85 # compute low q invariant percentage85 # compute low q invariant percentage 86 86 if self.qstar_low is None: 87 87 self.qstar_low_percent = None … … 89 89 try: 90 90 self.qstar_low_percent = float(self.qstar_low)\ 91 / float(self.qstar_total)91 / float(self.qstar_total) 92 92 except: 93 93 self.qstar_low_percent = 'error' 94 # compute high q invariant percentage94 # compute high q invariant percentage 95 95 if self.qstar_high is None: 96 96 self.qstar_high_percent = None … … 98 98 try: 99 99 self.qstar_high_percent = float(self.qstar_high)\ 100 / float(self.qstar_total)100 / float(self.qstar_total) 101 101 except: 102 102 self.qstar_high_percent = 'error' 103 103 wx.CallAfter(self.check_values) 104 104 105 105 def check_values(self): 106 106 """ … … 109 109 if self.qstar_total is None and self.qstar is None: 110 110 self.warning_msg = "Invariant not calculated.\n" 111 return 111 return 112 112 if self.qstar_total == 0: 113 113 self.existing_warning = True … … 115 115 self.warning_msg += "The calculations are likely " 116 116 self.warning_msg += "to be unreliable!\n" 117 return 118 # warning to the user when the extrapolated invariant is greater than %5117 return 118 # warning to the user when the extrapolated invariant is greater than %5 119 119 msg = '' 120 120 if self.qstar_percent == 'error': … … 135 135 msg += "Error occurred when computing extrapolated invariant" 136 136 msg += " at low-Q region.\n" 137 elif self.qstar_low_percent is not None 137 elif self.qstar_low_percent is not None: 138 138 if self.qstar_low_percent >= 0.05: 139 139 self.existing_warning = True … … 172 172 msg += "The sum of all extrapolated contributions is higher " 173 173 msg += "than 5% of the invariant.\n" 174 174 175 175 if self.existing_warning: 176 176 self.warning_msg = '' 177 self.warning_msg += msg 177 self.warning_msg += msg 178 178 self.warning_msg += "The calculations are likely to be" 179 179 self.warning_msg += " unreliable!\n" 180 180 else: 181 181 self.warning_msg = "No Details on calculations available...\n" 182 182 183 183 class InvariantDetailsPanel(wx.Dialog): 184 184 """ 185 This panel describes proportion of invariants 185 This panel describes proportion of invariants 186 186 """ 187 def __init__(self, parent=None, id=-1, qstar_container=None, 188 189 187 def __init__(self, parent=None, id=-1, qstar_container=None, 188 title="Invariant Details", 189 size=(PANEL_WIDTH, PANEL_HEIGHT)): 190 190 wx.Dialog.__init__(self, parent=parent, id=id, title=title, size=size) 191 192 # Font size191 192 # Font size 193 193 self.SetWindowVariant(variant=FONT_VARIANT) 194 194 self.parent = parent 195 # self.qstar_container195 # self.qstar_container 196 196 self.qstar_container = qstar_container 197 # warning message197 # warning message 198 198 self.warning_msg = self.qstar_container.warning_msg 199 200 # Define scale of each bar199 200 # Define scale of each bar 201 201 self.low_inv_percent = self.qstar_container.qstar_low_percent 202 202 self.low_scale = self.get_scale(percentage=self.low_inv_percent, 203 203 scale_name="Extrapolated at Low Q") 204 204 self.inv_percent = self.qstar_container.qstar_percent 205 self.inv_scale = self.get_scale(percentage=self.inv_percent, 206 205 self.inv_scale = self.get_scale(percentage=self.inv_percent, 206 scale_name="Inv in Q range") 207 207 self.high_inv_percent = self.qstar_container.qstar_high_percent 208 208 self.high_scale = self.get_scale(percentage=self.high_inv_percent, 209 209 scale_name="Extrapolated at High Q") 210 211 # Default color the extrapolation bar is grey210 211 # Default color the extrapolation bar is grey 212 212 self.extrapolation_color_low = EXTRAPOLATION_COLOR 213 213 self.extrapolation_color_high = EXTRAPOLATION_COLOR 214 214 self.invariant_color = INVARIANT_COLOR 215 # change color of high and low bar when necessary215 # change color of high and low bar when necessary 216 216 self.set_color_bar() 217 # draw the panel itself217 # draw the panel itself 218 218 self._do_layout() 219 219 self.set_values() 220 220 221 221 def _define_structure(self): 222 222 """ 223 223 Define main sizers needed for this panel 224 224 """ 225 # Box sizers must be defined first before defining buttons/textctrls225 # Box sizers must be defined first before defining buttons/textctrls 226 226 # (MAC). 227 227 self.main_sizer = wx.BoxSizer(wx.VERTICAL) 228 # Sizer related to chart228 # Sizer related to chart 229 229 chart_box = wx.StaticBox(self, -1, "Invariant Chart") 230 230 self.chart_sizer = wx.StaticBoxSizer(chart_box, wx.VERTICAL) 231 231 self.chart_sizer.SetMinSize((PANEL_WIDTH - 50, 110)) 232 # Sizer related to invariant values233 self.invariant_sizer = 232 # Sizer related to invariant values 233 self.invariant_sizer = wx.GridBagSizer(4, 4) 234 234 invariant_box = wx.StaticBox(self, -1, "Numerical Values") 235 self.invariant_box_sizer = wx.StaticBoxSizer(invariant_box, 236 wx.HORIZONTAL) 235 self.invariant_box_sizer = wx.StaticBoxSizer(invariant_box, wx.HORIZONTAL) 237 236 238 237 self.invariant_box_sizer.SetMinSize((PANEL_WIDTH - 50, -1)) 239 # Sizer related to warning message238 # Sizer related to warning message 240 239 warning_box = wx.StaticBox(self, -1, "Warning") 241 240 self.warning_sizer = wx.StaticBoxSizer(warning_box, wx.VERTICAL) 242 self.warning_sizer.SetMinSize((PANEL_WIDTH -50, -1))243 # Sizer related to button241 self.warning_sizer.SetMinSize((PANEL_WIDTH - 50, -1)) 242 # Sizer related to button 244 243 self.button_sizer = wx.BoxSizer(wx.HORIZONTAL) 245 244 246 245 def _layout_shart(self): 247 246 """ … … 250 249 self.panel_chart = wx.Panel(self) 251 250 self.panel_chart.Bind(wx.EVT_PAINT, self.on_paint) 252 self.chart_sizer.Add(self.panel_chart, 1, wx.EXPAND |wx.ALL, 0)253 251 self.chart_sizer.Add(self.panel_chart, 1, wx.EXPAND | wx.ALL, 0) 252 254 253 def _layout_invariant(self): 255 254 """ 256 255 Draw widgets related to invariant 257 256 """ 258 uncertainty = "+/-" 257 uncertainty = "+/-" 259 258 unit_invariant = '[1/(cm * A^3)]' 260 259 261 260 invariant_txt = wx.StaticText(self, -1, 'Q* from Data ') 262 261 invariant_txt.SetToolTipString("Invariant in the data set's Q range.") … … 270 269 hint_msg = "Unit of the invariant from data's Q range" 271 270 invariant_units_txt.SetToolTipString(hint_msg) 272 271 273 272 invariant_low_txt = wx.StaticText(self, -1, 'Q* from Low-Q') 274 273 hint_msg = "Extrapolated invariant from low-Q range." … … 284 283 hint_msg = "Unit of the extrapolated invariant from low-Q range" 285 284 invariant_low_units_txt.SetToolTipString(hint_msg) 286 285 287 286 invariant_high_txt = wx.StaticText(self, -1, 'Q* from High-Q') 288 287 hint_msg = "Extrapolated invariant from high-Q range" … … 299 298 hint_msg = "Unit of the extrapolated invariant from high-Q range" 300 299 invariant_high_units_txt.SetToolTipString(hint_msg) 301 302 # Invariant low300 301 # Invariant low 303 302 iy = 0 304 ix = 0 303 ix = 0 305 304 self.invariant_sizer.Add(invariant_low_txt, (iy, ix), (1, 1), 306 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)305 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 307 306 ix += 1 308 307 self.invariant_sizer.Add(self.invariant_low_tcl, (iy, ix), (1, 1), 309 wx.EXPAND|wx.ADJUST_MINSIZE, 0)310 ix += 1 311 self.invariant_sizer.Add( 312 (iy, ix), (1, 1),wx.EXPAND|wx.ADJUST_MINSIZE, 0)308 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 309 ix += 1 310 self.invariant_sizer.Add(wx.StaticText(self, -1, uncertainty), 311 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 313 312 ix += 1 314 313 self.invariant_sizer.Add(self.invariant_low_err_tcl, (iy, ix), (1, 1), 315 wx.EXPAND|wx.ADJUST_MINSIZE, 0)316 ix += 1 317 self.invariant_sizer.Add(invariant_low_units_txt 318 ,(iy, ix), (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)319 # Invariant314 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 315 ix += 1 316 self.invariant_sizer.Add(invariant_low_units_txt, 317 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 318 # Invariant 320 319 iy += 1 321 ix = 0 320 ix = 0 322 321 self.invariant_sizer.Add(invariant_txt, (iy, ix), (1, 1), 323 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)322 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 324 323 ix += 1 325 324 self.invariant_sizer.Add(self.invariant_tcl, (iy, ix), (1, 1), 326 wx.EXPAND|wx.ADJUST_MINSIZE, 0)325 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 327 326 ix += 1 328 327 self.invariant_sizer.Add(wx.StaticText(self, -1, uncertainty), 329 (iy, ix), (1, 1),wx.EXPAND|wx.ADJUST_MINSIZE, 0)328 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 330 329 ix += 1 331 330 self.invariant_sizer.Add(self.invariant_err_tcl, (iy, ix), (1, 1), 332 wx.EXPAND|wx.ADJUST_MINSIZE, 0)333 ix += 1334 self.invariant_sizer.Add(invariant_units_txt 335 ,(iy, ix), (1, 1),wx.EXPAND|wx.ADJUST_MINSIZE, 0)336 # Invariant high331 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 332 ix += 1 333 self.invariant_sizer.Add(invariant_units_txt, 334 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 335 # Invariant high 337 336 iy += 1 338 ix = 0 337 ix = 0 339 338 self.invariant_sizer.Add(invariant_high_txt, (iy, ix), (1, 1), 340 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)339 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 341 340 ix += 1 342 341 self.invariant_sizer.Add(self.invariant_high_tcl, (iy, ix), (1, 1), 343 wx.EXPAND|wx.ADJUST_MINSIZE, 0)342 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 344 343 ix += 1 345 344 self.invariant_sizer.Add(wx.StaticText(self, -1, uncertainty), 346 (iy, ix), (1, 1),wx.EXPAND|wx.ADJUST_MINSIZE, 0)345 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 347 346 ix += 1 348 347 self.invariant_sizer.Add(self.invariant_high_err_tcl, (iy, ix), (1, 1), 349 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 350 ix += 1 351 self.invariant_sizer.Add(invariant_high_units_txt 352 ,(iy, ix), (1, 1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) 353 self.invariant_box_sizer.Add(self.invariant_sizer, 0, 354 wx.TOP|wx.BOTTOM, 10) 355 348 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 349 ix += 1 350 self.invariant_sizer.Add(invariant_high_units_txt, 351 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 352 self.invariant_box_sizer.Add(self.invariant_sizer, 0, wx.TOP | wx.BOTTOM, 10) 353 356 354 def _layout_warning(self): 357 355 """ 358 356 Draw widgets related to warning 359 357 """ 360 # Warning [string]361 self.warning_msg_txt = wx.StaticText(self, -1, self.warning_msg) 358 # Warning [string] 359 self.warning_msg_txt = wx.StaticText(self, -1, self.warning_msg) 362 360 if self.qstar_container.existing_warning: 363 self.warning_msg_txt.SetForegroundColour('red') 361 self.warning_msg_txt.SetForegroundColour('red') 364 362 self.warning_sizer.AddMany([(self.warning_msg_txt, 0, 365 wx.LEFT |wx.EXPAND|wx.ADJUST_MINSIZE, 10)])366 363 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 10)]) 364 367 365 def _layout_button(self): 368 366 """ 369 367 Draw widgets related to button 370 368 """ 371 # Close button369 # Close button 372 370 id = wx.NewId() 373 371 button_ok = wx.Button(self, id, "Ok") 374 372 button_ok.SetToolTipString("Give Details on Computation") 375 373 self.Bind(wx.EVT_BUTTON, self.on_close, id=id) 376 self.button_sizer.AddMany([((20, 20), 0 377 (button_ok, 0 374 self.button_sizer.AddMany([((20, 20), 0, wx.LEFT, 350), 375 (button_ok, 0, wx.RIGHT, 10)]) 378 376 def _do_layout(self): 379 377 """ … … 386 384 self._layout_button() 387 385 self.main_sizer.AddMany([(self.chart_sizer, 0, wx.ALL, 10), 388 ( 389 390 386 (self.invariant_box_sizer, 0, wx.ALL, 10), 387 (self.warning_sizer, 0, wx.ALL, 10), 388 (self.button_sizer, 0, wx.ALL, 10)]) 391 389 self.SetSizer(self.main_sizer) 392 393 390 391 394 392 def set_values(self): 395 393 """ … … 399 397 self.invariant_tcl.SetValue(value) 400 398 value = format_number(self.qstar_container.qstar_err) 401 self.invariant_err_tcl.SetValue(value) 399 self.invariant_err_tcl.SetValue(value) 402 400 value = format_number(self.qstar_container.qstar_low) 403 401 self.invariant_low_tcl.SetValue(value) 404 402 value = format_number(self.qstar_container.qstar_low_err) 405 self.invariant_low_err_tcl.SetValue(value) 403 self.invariant_low_err_tcl.SetValue(value) 406 404 value = format_number(self.qstar_container.qstar_high) 407 405 self.invariant_high_tcl.SetValue(value) 408 406 value = format_number(self.qstar_container.qstar_high_err) 409 self.invariant_high_err_tcl.SetValue(value) 407 self.invariant_high_err_tcl.SetValue(value) 410 408 411 409 def get_scale(self, percentage, scale_name='scale'): 412 410 """ 413 Check scale receive in this panel. 411 Check scale receive in this panel. 414 412 """ 415 413 scale = RECTANGLE_SCALE 416 try: 414 try: 417 415 if percentage in [None, 0.0, "error"]: 418 419 416 scale = RECTANGLE_SCALE 417 return scale 420 418 elif percentage < 0: 421 419 scale = RECTANGLE_SCALE … … 427 425 self.warning_msg += "check this value : %s\n" % str(percentage) 428 426 return scale 429 427 430 428 def set_color_bar(self): 431 429 """ … … 435 433 self.extrapolation_color_high = EXTRAPOLATION_COLOR 436 434 self.invariant_color = INVARIANT_COLOR 437 # warning to the user when the extrapolated invariant is greater than %5435 # warning to the user when the extrapolated invariant is greater than %5 438 436 if self.low_scale >= 0.05 or self.low_scale > 1 or self.low_scale < 0: 439 self.extrapolation_color_low = ERROR_COLOR 437 self.extrapolation_color_low = ERROR_COLOR 440 438 if self.high_scale >= 0.05 or self.high_scale > 1 or self.high_scale < 0: 441 self.extrapolation_color_high = ERROR_COLOR 439 self.extrapolation_color_high = ERROR_COLOR 442 440 if self.inv_scale > 1 or self.inv_scale < 0: 443 self.invariant_color = ERROR_COLOR 444 441 self.invariant_color = ERROR_COLOR 442 445 443 def on_close(self, event): 446 444 """ … … 448 446 """ 449 447 self.Close() 450 448 451 449 def on_paint(self, event): 452 450 """ … … 461 459 dc.DrawText(msg, 25, 25) 462 460 return 463 # Start the drawing461 # Start the drawing 464 462 font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) 465 463 font.SetWeight(wx.BOLD) … … 467 465 # Draw a rectangle 468 466 path = gc.CreatePath() 469 path.AddRectangle(-RECTANGLE_WIDTH /2,-RECTANGLE_HEIGHT/2,470 RECTANGLE_WIDTH /2,RECTANGLE_HEIGHT/2)467 path.AddRectangle(-RECTANGLE_WIDTH / 2, -RECTANGLE_HEIGHT / 2, 468 RECTANGLE_WIDTH / 2, RECTANGLE_HEIGHT / 2) 471 469 x_origine = 20 472 470 y_origine = 15 473 # Draw low rectangle474 gc.PushState() 471 # Draw low rectangle 472 gc.PushState() 475 473 label = "Q* from Low-Q " 476 474 PathFunc = gc.DrawPath 477 475 w, h = gc.GetTextExtent(label) 478 476 gc.DrawText(label, x_origine, y_origine) 479 # Translate the rectangle480 x_center = x_origine + RECTANGLE_WIDTH * self.low_scale /2 + w +10477 # Translate the rectangle 478 x_center = x_origine + RECTANGLE_WIDTH * self.low_scale / 2 + w + 10 481 479 y_center = y_origine + h 482 gc.Translate(x_center, y_center) 480 gc.Translate(x_center, y_center) 483 481 gc.SetPen(wx.Pen("black", 1)) 484 482 gc.SetBrush(wx.Brush(self.extrapolation_color_low)) … … 488 486 low_percent = 'Error' 489 487 else: 490 low_percent = format_number(self.low_inv_percent *100)+ '%'488 low_percent = format_number(self.low_inv_percent * 100) + '%' 491 489 x_center = 20 492 490 y_center = -h 493 491 gc.DrawText(low_percent, x_center, y_center) 494 492 # Increase width by self.low_scale 495 gc.Scale(self.low_scale, 1.0) 493 gc.Scale(self.low_scale, 1.0) 496 494 PathFunc(path) 497 gc.PopState() 498 # Draw rectangle for invariant499 gc.PushState() 500 y_origine += 20 495 gc.PopState() 496 # Draw rectangle for invariant 497 gc.PushState() # save it again 498 y_origine += 20 501 499 gc.DrawText("Q* from Data ", x_origine, y_origine) 502 500 # offset to the lower part of the window 503 x_center = x_origine + RECTANGLE_WIDTH * self.inv_scale /2 + w + 10501 x_center = x_origine + RECTANGLE_WIDTH * self.inv_scale / 2 + w + 10 504 502 y_center = y_origine + h 505 503 gc.Translate(x_center, y_center) 506 504 # 128 == half transparent 507 gc.SetBrush(wx.Brush(self.invariant_color)) 505 gc.SetBrush(wx.Brush(self.invariant_color)) 508 506 # Increase width by self.inv_scale 509 507 if self.inv_percent is None: … … 512 510 inv_percent = 'Error' 513 511 else: 514 inv_percent = format_number(self.inv_percent *100)+ '%'515 x_center = 20 512 inv_percent = format_number(self.inv_percent * 100) + '%' 513 x_center = 20 516 514 y_center = -h 517 515 gc.DrawText(inv_percent, x_center, y_center) 518 gc.Scale(self.inv_scale, 1.0) 516 gc.Scale(self.inv_scale, 1.0) 519 517 gc.DrawPath(path) 520 518 gc.PopState() 521 519 # restore saved state 522 # Draw rectangle for high invariant523 gc.PushState() 524 y_origine += 20 525 gc.DrawText("Q* from High-Q ", x_origine, y_origine) 526 # define the position of the new rectangle527 x_center = x_origine + RECTANGLE_WIDTH * self.high_scale /2 + w + 10520 # Draw rectangle for high invariant 521 gc.PushState() 522 y_origine += 20 523 gc.DrawText("Q* from High-Q ", x_origine, y_origine) 524 # define the position of the new rectangle 525 x_center = x_origine + RECTANGLE_WIDTH * self.high_scale / 2 + w + 10 528 526 y_center = y_origine + h 529 527 gc.Translate(x_center, y_center) 530 gc.SetBrush(wx.Brush(self.extrapolation_color_high)) 528 gc.SetBrush(wx.Brush(self.extrapolation_color_high)) 531 529 # increase scale by self.high_scale 532 530 if self.high_inv_percent is None: … … 535 533 high_percent = 'Error' 536 534 else: 537 high_percent = format_number(self.high_inv_percent *100)+ '%'535 high_percent = format_number(self.high_inv_percent * 100) + '%' 538 536 x_center = 20 539 537 y_center = -h 540 538 gc.DrawText(high_percent, x_center, y_center) 541 542 gc.Scale(self.high_scale, 1.0) 539 540 gc.Scale(self.high_scale, 1.0) 543 541 gc.DrawPath(path) 544 542 gc.PopState()
Note: See TracChangeset
for help on using the changeset viewer.