Changeset 53b6b74 in sasview for invariantview


Ignore:
Timestamp:
Mar 4, 2010 8:00:09 PM (14 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
f5fda87
Parents:
d5f0dcb9
Message:

invariantview: fixed bad call to invariant module, fixed inverted logic for surface and volume fraction.

Location:
invariantview/perspectives/invariant
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • invariantview/perspectives/invariant/invariant.py

    r272d91e r53b6b74  
    2828        """ 
    2929        ## Plug-in name. It will appear on the application menu. 
    30         self.sub_menu = "invariant" 
     30        self.sub_menu = "Invariant" 
    3131         
    3232        ## Reference to the parent window. Filled by get_panels() below. 
  • invariantview/perspectives/invariant/invariant_panel.py

    rd5f0dcb9 r53b6b74  
    157157            if low_q: 
    158158                try:  
    159                     qstar_low = inv.get_qstar_low() 
     159                    qstar_low, qstar_low_err = inv.get_qstar_low() 
    160160                    self.invariant_low_ctl.SetValue(format_number(qstar_low)) 
    161161                    #plot data 
     
    172172            if high_q: 
    173173                try:  
    174                     qstar_high = inv.get_qstar_high() 
     174                    qstar_high, qstar_high_err = inv.get_qstar_high() 
    175175                    self.invariant_high_ctl.SetValue(format_number(qstar_high)) 
    176176                    #plot data 
     
    195195                wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop"))   
    196196             
    197             porod_const = self.porod_const_ctl.GetValue().lstrip().rstrip() 
    198             if porod_const == "": 
    199                 porod_const = None 
    200             if not (porod_const is None): 
    201                 if check_float(self.porod_const_ctl): 
    202                     porod_const = float(porod_const) 
    203                     try: 
    204                         v, dv = inv.get_volume_fraction_with_error(contrast=contrast) 
    205                         self.volume_ctl.SetValue(format_number(v)) 
    206                         self.volume_err_ctl.SetValue(format_number(dv)) 
    207                     except: 
    208                         msg= "Error occurs for volume fraction: %s"%sys.exc_value 
    209                         wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 
    210             contrast = self.contrast_ctl.GetValue().lstrip().rstrip() 
    211             if contrast == "": 
    212                 contrast = None 
    213             if not (contrast is None): 
    214                 if check_float(self.contrast_ctl): 
    215                     contrast = float(contrast) 
    216                     try: 
    217                         if not (porod_const is None): 
    218                             s, ds = inv.get_surface_with_error(contrast=contrast, 
    219                                                     porod_const=porod_const) 
    220                             self.surface_ctl.SetValue(format_number(s)) 
    221                             self.surface_err_ctl.SetValue(format_number(ds)) 
    222                     except: 
    223                         msg= "Error occurs for surface: %s"%sys.exc_value 
    224                         wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 
     197            # Parse additional parameters 
     198            par_str = self.porod_const_ctl.GetValue().strip() 
     199            porod_const = None 
     200            if len(par_str)>0 and check_float(self.porod_const_ctl): 
     201                porod_const = float(par_str) 
     202                     
     203            par_str = self.contrast_ctl.GetValue().strip() 
     204            contrast = None 
     205            if len(par_str)>0 and check_float(self.contrast_ctl): 
     206                contrast = float(par_str) 
     207                 
     208            if contrast is not None: 
     209                try: 
     210                    v, dv = inv.get_volume_fraction_with_error(contrast=contrast) 
     211                    self.volume_ctl.SetValue(format_number(v)) 
     212                    self.volume_err_ctl.SetValue(format_number(dv)) 
     213                except: 
     214                    msg= "Error occurs for volume fraction: %s"%sys.exc_value 
     215                    wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 
     216 
     217            if contrast is not None and porod_const is not None: 
     218                try: 
     219                    s, ds = inv.get_surface_with_error(contrast=contrast, 
     220                                            porod_const=porod_const) 
     221                    self.surface_ctl.SetValue(format_number(s)) 
     222                    self.surface_err_ctl.SetValue(format_number(ds)) 
     223                except: 
     224                    msg= "Error occurs for surface: %s"%sys.exc_value 
     225                    wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 
    225226                         
    226227        else: 
Note: See TracChangeset for help on using the changeset viewer.