Changeset f6518f8 in sasview


Ignore:
Timestamp:
Oct 21, 2011 12:18:39 PM (13 years ago)
Author:
Gervaise Alina <gervyh@…>
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
Message:

edit invariant panel for negative percentage

Location:
invariantview/src/sans/perspectives/invariant
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • invariantview/src/sans/perspectives/invariant/invariant_details.py

    r7f14996 rf6518f8  
    22import wx 
    33import sys 
     4 
    45import numpy 
    56from sans.guiframe.utils import format_number 
     
    116117            self.existing_warning = True 
    117118            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" 
    119123        if self.qstar_low_percent == 'error': 
    120124            self.existing_warning = True 
    121125            msg = "Error occurred when computing extrapolated invariant" 
    122126            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" 
    128139        if self.qstar_high_percent == 'error': 
    129140            self.existing_warning = True 
    130141            msg += 'Error occurred when computing extrapolated' 
    131142            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" 
    137155        if (self.qstar_low_percent not in [None, "error"]) and \ 
    138156            (self.qstar_high_percent not in [None, "error"])\ 
     
    181199        self.extrapolation_color_low = wx.Colour(169,  169, 168, 128) 
    182200        self.extrapolation_color_high = wx.Colour(169,  169, 168, 128) 
     201        self.invariant_color = wx.Colour(67,  208,  128, 128) 
    183202        #change color of high and low bar when necessary 
    184203        self.set_color_bar() 
     
    386405                 scale = RECTANGLE_SCALE 
    387406                 return scale 
    388             scale = float(percentage)  
     407            elif percentage < 0: 
     408                scale = RECTANGLE_SCALE 
     409                return scale 
     410            scale = float(percentage) 
    389411        except: 
    390412            scale = RECTANGLE_SCALE 
     
    398420        Change the color for low and high bar when necessary 
    399421        """ 
     422        ERROR_COLOR = wx.Colour(255,  0, 0, 128) 
    400423        #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   
    405430             
    406431    def on_close(self, event): 
     
    434459        #Draw low rectangle 
    435460        gc.PushState()         
    436         label = "Q* from Low-Q" 
     461        label = "Q* from Low-Q " 
    437462        PathFunc = gc.DrawPath 
    438463        w, h = gc.GetTextExtent(label) 
     
    460485        gc.PushState()    # save it again 
    461486        y_origine += 20          
    462         gc.DrawText("Q* from Data", x_origine, y_origine) 
     487        gc.DrawText("Q* from Data ", x_origine, y_origine) 
    463488        # offset to the lower part of the window 
    464489        x_center = x_origine + RECTANGLE_WIDTH * self.inv_scale/2 + w + 10 
     
    466491        gc.Translate(x_center, y_center) 
    467492        # 128 == half transparent 
    468         gc.SetBrush(wx.Brush(wx.Colour(67,  208,  128, 128)))  
     493        gc.SetBrush(wx.Brush(self.invariant_color))  
    469494        # Increase width by self.inv_scale 
    470495        if self.inv_percent is None: 
     
    484509        gc.PushState()  
    485510        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)  
    487512        #define the position of the new rectangle 
    488513        x_center = x_origine + RECTANGLE_WIDTH * self.high_scale/2 + w + 10 
  • invariantview/src/sans/perspectives/invariant/invariant_panel.py

    rc4ae1c2 rf6518f8  
    163163            if self.inv_container.existing_warning: 
    164164                msg = "Warning! Computations on invariant require your " 
    165                 msg += "attention.\n Please click on Details button." 
     165                msg += "attention.\nPlease click on Details button." 
    166166                self.hint_msg_txt.SetForegroundColour("red") 
    167167     
     
    174174                             StatusEvent(status=msg,info="info")) 
    175175            self.hint_msg_txt.SetLabel(msg) 
    176              
     176        self.Layout() 
    177177        
    178178    def set_manager(self, manager): 
Note: See TracChangeset for help on using the changeset viewer.