Changeset f6518f8 in sasview for invariantview/src/sans/perspectives
- Timestamp:
- Oct 21, 2011 12:18:39 PM (13 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:
- 6dad639
- Parents:
- 81a7b6c
- Location:
- invariantview/src/sans/perspectives/invariant
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
invariantview/src/sans/perspectives/invariant/invariant_details.py
r7f14996 rf6518f8 2 2 import wx 3 3 import sys 4 4 5 import numpy 5 6 from sans.guiframe.utils import format_number … … 116 117 self.existing_warning = True 117 118 msg = 'Error occurred when computing invariant from data.\n ' 118 119 if self.qstar_percent > 1: 120 self.existing_warning = True 121 msg += "Invariant Q contribution is greater " 122 msg += "than 100% .\n" 119 123 if self.qstar_low_percent == 'error': 120 124 self.existing_warning = True 121 125 msg = "Error occurred when computing extrapolated invariant" 122 126 msg += " at low-Q region.\n" 123 elif self.qstar_low_percent is not None and \ 124 self.qstar_low_percent >= 0.05: 125 self.existing_warning = True 126 msg += "Extrapolated contribution at Low Q is higher " 127 msg += "than 5% of the invariant.\n" 127 elif self.qstar_low_percent is not None : 128 if self.qstar_low_percent >= 0.05: 129 self.existing_warning = True 130 msg += "Extrapolated contribution at Low Q is higher " 131 msg += "than 5% of the invariant.\n" 132 elif self.qstar_low_percent < 0: 133 self.existing_warning = True 134 msg += "Extrapolated contribution at Low Q < 0.\n" 135 elif self.qstar_low_percent > 1: 136 self.existing_warning = True 137 msg += "Extrapolated contribution at Low Q is greater " 138 msg += "than 100% .\n" 128 139 if self.qstar_high_percent == 'error': 129 140 self.existing_warning = True 130 141 msg += 'Error occurred when computing extrapolated' 131 142 msg += ' invariant at high-Q region.\n' 132 elif self.qstar_high_percent is not None and \ 133 self.qstar_high_percent >= 0.05: 134 self.existing_warning = True 135 msg += "Extrapolated contribution at High Q is higher " 136 msg += "than 5% of the invariant.\n" 143 elif self.qstar_high_percent is not None: 144 if self.qstar_high_percent >= 0.05: 145 self.existing_warning = True 146 msg += "Extrapolated contribution at High Q is higher " 147 msg += "than 5% of the invariant.\n" 148 elif self.qstar_high_percent < 0: 149 self.existing_warning = True 150 msg += "Extrapolated contribution at High Q < 0.\n" 151 elif self.qstar_high_percent > 1: 152 self.existing_warning = True 153 msg += "Extrapolated contribution at High Q is greater " 154 msg += "than 100% .\n" 137 155 if (self.qstar_low_percent not in [None, "error"]) and \ 138 156 (self.qstar_high_percent not in [None, "error"])\ … … 181 199 self.extrapolation_color_low = wx.Colour(169, 169, 168, 128) 182 200 self.extrapolation_color_high = wx.Colour(169, 169, 168, 128) 201 self.invariant_color = wx.Colour(67, 208, 128, 128) 183 202 #change color of high and low bar when necessary 184 203 self.set_color_bar() … … 386 405 scale = RECTANGLE_SCALE 387 406 return scale 388 scale = float(percentage) 407 elif percentage < 0: 408 scale = RECTANGLE_SCALE 409 return scale 410 scale = float(percentage) 389 411 except: 390 412 scale = RECTANGLE_SCALE … … 398 420 Change the color for low and high bar when necessary 399 421 """ 422 ERROR_COLOR = wx.Colour(255, 0, 0, 128) 400 423 #warning to the user when the extrapolated invariant is greater than %5 401 if self.low_scale >= 0.05: 402 self.extrapolation_color_low = wx.Colour(255, 0, 0, 128) 403 if self.high_scale >= 0.05: 404 self.extrapolation_color_high = wx.Colour(255, 0, 0, 128) 424 if self.low_scale >= 0.05 or self.low_scale > 1 or self.low_scale < 0: 425 self.extrapolation_color_low = ERROR_COLOR 426 if self.high_scale >= 0.05 or self.high_scale > 1 or self.high_scale < 0: 427 self.extrapolation_color_high = ERROR_COLOR 428 if self.inv_scale >= 0.05 or self.inv_scale > 1 or self.inv_scale < 0: 429 self.invariant_color = ERROR_COLOR 405 430 406 431 def on_close(self, event): … … 434 459 #Draw low rectangle 435 460 gc.PushState() 436 label = "Q* from Low-Q "461 label = "Q* from Low-Q " 437 462 PathFunc = gc.DrawPath 438 463 w, h = gc.GetTextExtent(label) … … 460 485 gc.PushState() # save it again 461 486 y_origine += 20 462 gc.DrawText("Q* from Data ", x_origine, y_origine)487 gc.DrawText("Q* from Data ", x_origine, y_origine) 463 488 # offset to the lower part of the window 464 489 x_center = x_origine + RECTANGLE_WIDTH * self.inv_scale/2 + w + 10 … … 466 491 gc.Translate(x_center, y_center) 467 492 # 128 == half transparent 468 gc.SetBrush(wx.Brush( wx.Colour(67, 208, 128, 128)))493 gc.SetBrush(wx.Brush(self.invariant_color)) 469 494 # Increase width by self.inv_scale 470 495 if self.inv_percent is None: … … 484 509 gc.PushState() 485 510 y_origine += 20 486 gc.DrawText("Q* from High-Q ", x_origine, y_origine)511 gc.DrawText("Q* from High-Q ", x_origine, y_origine) 487 512 #define the position of the new rectangle 488 513 x_center = x_origine + RECTANGLE_WIDTH * self.high_scale/2 + w + 10 -
invariantview/src/sans/perspectives/invariant/invariant_panel.py
rc4ae1c2 rf6518f8 163 163 if self.inv_container.existing_warning: 164 164 msg = "Warning! Computations on invariant require your " 165 msg += "attention.\n 165 msg += "attention.\nPlease click on Details button." 166 166 self.hint_msg_txt.SetForegroundColour("red") 167 167 … … 174 174 StatusEvent(status=msg,info="info")) 175 175 self.hint_msg_txt.SetLabel(msg) 176 176 self.Layout() 177 177 178 178 def set_manager(self, manager):
Note: See TracChangeset
for help on using the changeset viewer.