Changeset 07eb396 in sasview


Ignore:
Timestamp:
Jul 19, 2012 9:07:32 AM (12 years ago)
Author:
Jae Cho <jhjcho@…>
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:
3df5ecf
Parents:
80ff71e
Message:

Invaraint freeze fix

Files:
2 edited

Legend:

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

    r699df7f r07eb396  
    478478                wx.PostEvent(self.parent, StatusEvent(status=msg, 
    479479                                                      type="stop")) 
     480                raise 
    480481        else: 
    481482            try: 
     
    515516                        msg = "Expect float for power at low q, " 
    516517                        msg += " got %s" % (power_low) 
    517                         raise ValueError, msg 
     518                        wx.PostEvent(self.parent, StatusEvent(status=msg,  
     519                                                  info="error", 
     520                                                  type="stop")) 
    518521        
    519522        #Get the number of points to extrapolated 
     
    525528                msg = "Expect float for number of points at low q," 
    526529                msg += " got %s" % (npts_low) 
    527                 raise ValueError, msg 
     530                wx.PostEvent(self.parent, StatusEvent(status=msg,  
     531                                                  info="error", 
     532                                                  type="stop")) 
    528533        #Set the invariant calculator 
    529534        inv.set_extrapolation(range="low", npts=npts_low, 
     
    551556                    msg = "Expect float for power at high q," 
    552557                    msg += " got %s" % (power_high) 
    553                     raise ValueError, msg 
     558                    wx.PostEvent(self.parent, StatusEvent(status=msg,  
     559                                                  info="error", 
     560                                                  type="stop")) 
    554561                           
    555562        npts_high = self.npts_high_tcl.GetValue().lstrip().rstrip()    
     
    560567                msg = "Expect float for number of points at high q," 
    561568                msg += " got %s" % (npts_high) 
    562                 raise ValueError, msg 
     569                wx.PostEvent(self.parent, StatusEvent(status=msg,  
     570                                                  info="error", 
     571                                                  type="stop")) 
    563572        inv.set_extrapolation(range="high", npts=npts_high, 
    564573                                   function=function_high, power=power_high) 
     
    638647            return 
    639648        self.Show(False) 
    640         #Compute qstar extrapolated to low q range  
    641         self.get_low_qstar(inv=inv, npts_low=npts_low, low_q=low_q) 
    642         #Compute qstar extrapolated to high q range  
    643         self.get_high_qstar(inv=inv, high_q=high_q) 
    644         #Compute qstar extrapolated to total q range and set value to txtcrtl 
    645         self.get_total_qstar(inv=inv, extrapolation=extrapolation) 
    646         # Parse additional parameters 
    647         porod_const = self.get_porod_const()         
    648         contrast = self.get_contrast() 
    649          
     649        r_msg = '' 
     650        try: 
     651            r_msg = 'Low Q: ' 
     652            #Compute qstar extrapolated to low q range  
     653            self.get_low_qstar(inv=inv, npts_low=npts_low, low_q=low_q) 
     654            r_msg = 'High Q: ' 
     655            #Compute qstar extrapolated to high q range  
     656            self.get_high_qstar(inv=inv, high_q=high_q) 
     657            r_msg = '' 
     658            #Compute qstar extrapolated to total q range  
     659            #and set value to txtcrtl 
     660            self.get_total_qstar(inv=inv, extrapolation=extrapolation) 
     661            # Parse additional parameters 
     662            porod_const = self.get_porod_const()         
     663            contrast = self.get_contrast() 
     664        except: 
     665            msg = r_msg + "Error occurred computing invariant: %s" % \ 
     666                                                            sys.exc_value 
     667            wx.PostEvent(self.parent, StatusEvent(status=msg,  
     668                                                  info="error", 
     669                                                  type="stop")) 
    650670        try: 
    651671            #Compute volume and set value to txtcrtl 
  • sansinvariant/src/sans/invariant/invariant.py

    r3fc01c5 r07eb396  
    132132        """ 
    133133        self.scale = math.exp(constant) 
     134        if slope > 0: 
     135            slope = 0.0 
    134136        self.radius = math.sqrt(-3 * slope) 
    135          
    136137        # Errors 
    137138        self.dscale = math.exp(constant)*dconstant 
    138         self.dradius = -3.0/2.0/math.sqrt(-3 * slope)*dslope 
     139        if slope == 0.0: 
     140            n_zero = -1.0e-24 
     141            self.dradius = -3.0/2.0/math.sqrt(-3 * n_zero)*dslope 
     142        else: 
     143            self.dradius = -3.0/2.0/math.sqrt(-3 * slope)*dslope 
    139144         
    140145        return [self.radius, self.scale], [self.dradius, self.dscale] 
Note: See TracChangeset for help on using the changeset viewer.