Changeset cb190a19 in sasview for sansview/perspectives/fitting/fitpage.py
- Timestamp:
- May 24, 2010 9:56:13 AM (14 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:
- 75a8723
- Parents:
- 5cc7001
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage.py
r4708f3a rcb190a19 1963 1963 except: 1964 1964 pass 1965 1966 def complete_chisqr(self, output, elapsed=None):1967 """1968 print result chisqr1969 """1970 try:1971 if output ==None:1972 output= "-"1973 1974 self.tcChi.SetValue(str(format_number(output)))1975 1976 self.state.tcChi =self.tcChi1977 1978 except:1979 pass1980 1981 1982 def compute_chisqr1D(self, smearer=None):1983 """1984 Compute chisqr for 1D1985 """1986 try:1987 self.qmin_x = float(self.qmin.GetValue())1988 self.qmax_x = float(self.qmax.GetValue())1989 ##return residuals within self.qmin_x and self.qmax_x1990 from gui_thread import CalcChisqr1D1991 ## If a thread is already started, stop it1992 if self.calc_Chisqr!= None and self.calc_Chisqr.isrunning():1993 self.calc_Chisqr.stop()1994 1995 self.calc_Chisqr= CalcChisqr1D( data1d= self.data,1996 model= self.model,1997 smearer=smearer,1998 qmin=self.qmin_x,1999 qmax=self.qmax_x,2000 completefn = self.complete_chisqr,2001 updatefn = None)2002 2003 self.calc_Chisqr.queue()2004 2005 except:2006 raise ValueError," Could not compute Chisqr for %s Model 2D: "%self.model.name2007 2008 2009 2010 2011 2012 def compute_chisqr2D(self,smearer=None):2013 """2014 compute chi square given a model and data 2D and set the value2015 to the tcChi txtcrl2016 """2017 try:2018 self.qmin_x = float(self.qmin.GetValue())2019 self.qmax_x = float(self.qmax.GetValue())2020 2021 ##return residuals within self.qmin_x and self.qmax_x2022 from gui_thread import CalcChisqr2D2023 ## If a thread is already started, stop it2024 if self.calc_Chisqr!= None and self.calc_Chisqr.isrunning():2025 self.calc_Chisqr.stop()2026 if smearer !=None:2027 smearer.set_accuracy(accuracy = self.smear2d_accuracy)2028 self.calc_Chisqr= CalcChisqr2D( data2d= self.data,2029 model= self.model,2030 smearer=smearer,2031 qmin= self.qmin_x,2032 qmax = self.qmax_x,2033 completefn = self.complete_chisqr,2034 updatefn = None)2035 2036 self.calc_Chisqr.queue()2037 2038 except:2039 raise2040 2041 2042 def compute_chisqr(self ,output=None, smearer=None):2043 """2044 compute chi square given a model and data 1D and set the value2045 to the tcChi txtcrl2046 """2047 flag = self._validate_qrange( self.qmin, self.qmax)2048 if flag== True:2049 try:2050 if hasattr(self.data,"data"):2051 self.compute_chisqr2D(smearer=smearer)2052 return2053 else:2054 self.compute_chisqr1D(smearer=smearer)2055 return2056 except:2057 wx.PostEvent(self.parent.parent, StatusEvent(status=\2058 "Chisqr Error: %s"% sys.exc_value))2059 return2060 1965 2061 1966
Note: See TracChangeset
for help on using the changeset viewer.