- Timestamp:
- Apr 14, 2010 12:29:30 PM (15 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:
- 6318298
- Parents:
- c5874f2
- Location:
- sansview/perspectives/fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
rda3f24c r51a71a3 1002 1002 use : _check_value_enter 1003 1003 """ 1004 # Flag to register when a parameter has changed. 1004 # Flag to register when a parameter has changed. 1005 1005 is_modified = False 1006 self.fitrange =True 1007 is_2Ddata = False 1006 1008 #self._undo.Enable(True) 1009 # check if 2d data 1010 if self.data.__class__.__name__ !="Data1D": 1011 is_2Ddata = True 1007 1012 if self.model !=None: 1008 1013 try: … … 1026 1031 self.qmax_x = tempmax 1027 1032 is_modified = True 1028 self.fitrange = True 1033 1034 if is_2Ddata: 1035 # set mask 1036 is_modified = self._validate_Npts() 1037 1029 1038 else: 1030 self.fitrange = False 1031 if self.npts != None: 1032 if check_float(self.npts): 1033 temp_npts = float(self.npts.GetValue()) 1034 if temp_npts != self.num_points: 1035 self.num_points = temp_npts 1036 is_modified = True 1037 else: 1038 msg= "Cannot Plot :Must enter a number!!! " 1039 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 1040 1041 1039 self.fitrange = False 1040 1042 1041 ## if any value is modify draw model with new value 1043 if is_modified: 1042 if not self.fitrange: 1043 self.btFit.Disable() 1044 if is_2Ddata: self.btEditMask.Disable() 1045 else: 1046 self.btFit.Enable(True) 1047 if is_2Ddata: self.btEditMask.Enable(True) 1048 1049 if is_modified and self.fitrange: 1044 1050 self.state_change= True 1045 1051 self._draw_model() … … 1053 1059 #flag for qmin qmax check values 1054 1060 flag = True 1061 self.fitrange = True 1055 1062 is_modified = False 1063 is_2Ddata = False 1064 1065 # check if 2d data 1066 if self.data.__class__.__name__ !="Data1D": 1067 is_2Ddata = True 1068 1056 1069 ##So make sure that update param values on_Fit. 1057 1070 #self._undo.Enable(True) … … 1066 1079 # If qmin and qmax have been modified, update qmin and qmax and 1067 1080 # set the is_modified flag to True 1068 if self._validate_qrange(self.qmin, self.qmax): 1081 self.fitrange = self._validate_qrange(self.qmin, self.qmax) 1082 if self.fitrange: 1069 1083 tempmin = float(self.qmin.GetValue()) 1070 1084 if tempmin != self.qmin_x: … … 1085 1099 self.manager.set_smearer(smearer=temp_smearer, qmin= float(self.qmin_x), 1086 1100 qmax= float(self.qmax_x)) 1087 elif self.data.__class__.__name__ !="Data2D":1101 elif not is_2Ddata: 1088 1102 self.manager.set_smearer(smearer=temp_smearer, qmin= float(self.qmin_x), 1089 1103 qmax= float(self.qmax_x)) 1104 index_data = ((self.qmin_x <= self.data.x)&(self.data.x <= self.qmax_x)) 1105 self.Npts_fit.SetValue(str(len(self.data.x[index_data==True]))) 1106 flag = True 1107 if is_2Ddata: 1108 # only 2D case set mask 1109 flag = self._validate_Npts() 1110 if not flag: 1111 return flag 1090 1112 else: flag = False 1091 1113 else: 1092 1114 flag = False 1115 1116 #For invalid q range, disable the mask editor and fit button, vs. 1117 if not self.fitrange: 1118 self.btFit.Disable() 1119 self.btEditMask.Disable() 1120 else: 1121 self.btFit.Enable(True) 1122 self.btEditMask.Enable(True) 1123 1093 1124 1094 1125 if not flag: 1095 msg= "Cannot Fit :Must select a model or Fitting range is not valid!!! "1126 msg= "Cannot Plot or Fit :Must select a model or Fitting range is not valid!!! " 1096 1127 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 1097 1128 1098 1129 self.save_current_state() 1130 1099 1131 return flag 1100 1132 … … 1597 1629 self.structurebox.Enable() 1598 1630 self.text2.Enable() 1599 if self.data.__class__.__name__ =="Data2D":1631 if self.data.__class__.__name__ !="Data1D": 1600 1632 self.smear_description_2d.Show(True) 1601 1633 … … 1652 1684 return False 1653 1685 return True 1654 1686 1687 def _validate_Npts(self): 1688 """ 1689 Validate the number of points for fitting is more than 10 points. 1690 If valid, setvalues Npts_fit otherwise post msg. 1691 """ 1692 #default flag 1693 flag = True 1694 1695 # q value from qx and qy 1696 radius= numpy.sqrt( self.data.qx_data*self.data.qx_data + self.data.qy_data*self.data.qy_data ) 1697 #get unmasked index 1698 index_data = (float(self.qmin.GetValue()) <= radius)&(radius<= float(self.qmax.GetValue())) 1699 index_data = (index_data)&(self.data.mask) 1700 index_data = (index_data)&(numpy.isfinite(self.data.data)) 1701 1702 if len(index_data[index_data]) < 10: 1703 # change the color pink. 1704 self.qmin.SetBackgroundColour("pink") 1705 self.qmin.Refresh() 1706 self.qmax.SetBackgroundColour("pink") 1707 self.qmax.Refresh() 1708 msg= "Cannot Plot :No or too little npts in that data range!!! " 1709 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 1710 self.fitrange = False 1711 flag = False 1712 else: 1713 self.Npts_fit.SetValue(str(len(self.data.mask[index_data==True]))) 1714 self.fitrange = True 1715 1716 return flag 1717 1655 1718 def _check_value_enter(self, list, modified): 1656 1719 """ … … 1664 1727 for item in list: 1665 1728 #skip angle parameters for 1D 1666 if self.data.__class__.__name__ !="Data 2D":1729 if self.data.__class__.__name__ !="Data1D": 1667 1730 if item in self.orientation_params: 1668 1731 continue … … 1930 1993 self.disp_cb_dict[p] = wx.RadioButton(self, -1, p, (10, 10)) 1931 1994 self.state.disp_cb_dict[p]= self.disp_cb_dict[p].GetValue() 1932 if not (self.enable2D or self.data.__class__.__name__ =="Data2D"):1995 if not (self.enable2D or self.data.__class__.__name__ !="Data1D"): 1933 1996 self.disp_cb_dict[p].Hide() 1934 1997 else: … … 1974 2037 Fill the Q range sizer 1975 2038 """ 2039 #2D data? default 2040 is_2Ddata = False 2041 2042 #check if it is 2D data 2043 if self.data.__class__.__name__ != 'Data1D': 2044 is_2Ddata = True 2045 1976 2046 self.sizer5.Clear(True) 1977 2047 #-------------------------------------------------------------- … … 1994 2064 1995 2065 id = wx.NewId() 1996 self.reset_qrange =wx.Button(self,id,'Reset',size=(7 0,23))2066 self.reset_qrange =wx.Button(self,id,'Reset',size=(77,20)) 1997 2067 1998 2068 self.reset_qrange.Bind(wx.EVT_BUTTON, self.on_reset_clicked,id=id) … … 2000 2070 2001 2071 sizer_horizontal=wx.BoxSizer(wx.HORIZONTAL) 2002 sizer= wx.GridSizer(3, 3,2, 5) 2003 2072 sizer= wx.GridSizer(2, 4,2, 6) 2073 2074 self.btEditMask = wx.Button(self,wx.NewId(),'Editor', size=(88,23)) 2075 self.btEditMask.Bind(wx.EVT_BUTTON, self._onMask,id= self.btEditMask.GetId()) 2076 self.btEditMask.SetToolTipString("Edit Mask.") 2077 self.EditMask_title = wx.StaticText(self, -1, ' Masking(2D)') 2078 2004 2079 sizer.Add(wx.StaticText(self, -1, ' Q range')) 2005 sizer.Add(wx.StaticText(self, -1, ' Min')) 2006 sizer.Add(wx.StaticText(self, -1, ' Max')) 2080 sizer.Add(wx.StaticText(self, -1, ' Min[1/A]')) 2081 sizer.Add(wx.StaticText(self, -1, ' Max[1/A]')) 2082 sizer.Add(self.EditMask_title) 2007 2083 sizer.Add(self.reset_qrange) 2008 2084 2009 2085 sizer.Add(self.qmin) 2010 2086 sizer.Add(self.qmax) 2011 sizer_horizontal.Add(sizer) 2087 sizer.Add(self.btEditMask) 2088 2089 if object1!=None: 2090 2091 boxsizer1.Add(object1) 2092 boxsizer1.Add((10,10)) 2093 boxsizer1.Add(sizer) 2012 2094 if object!=None: 2013 sizer_horizontal.Add(object) 2014 2015 if object1!=None: 2016 boxsizer1.Add(object1) 2017 boxsizer1.Add((10,10)) 2018 boxsizer1.Add(sizer_horizontal) 2095 boxsizer1.Add((10,15)) 2096 boxsizer1.Add(object) 2097 if not is_2Ddata: 2098 self.btEditMask.Disable() 2099 self.EditMask_title.Disable() 2019 2100 ## save state 2020 2101 self.save_current_state() … … 2077 2158 return 2078 2159 ##For 3 different cases: Data2D, Data1D, and theory 2079 if self.data.__class__.__name__ == "Data2D":2160 if self.data.__class__.__name__ != "Data1D": 2080 2161 data_min= 0 2081 2162 x= max(math.fabs(self.data.xmin), math.fabs(self.data.xmax)) … … 2105 2186 msg= "Cannot Plot :Must enter a number!!! " 2106 2187 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 2188 else: 2189 # set relative text ctrs. 2190 self.qmin.SetValue(str(self.qmin_x)) 2191 self.qmax.SetValue(str(self.qmax_x)) 2192 self.set_npts2fit() 2193 # At this point, some button and variables satatus (disabled?) should be checked 2194 # such as color that should be reset to white in case that it was pink. 2195 self._onparamEnter_helper() 2196 2107 2197 2108 2198 self.save_current_state() -
sansview/perspectives/fitting/fitpage.py
r6747217 r51a71a3 12 12 from sans.guicomm.events import StatusEvent 13 13 from sans.guiframe.utils import format_number,check_float 14 #from sans.guiframe.local_perspectives.plotting.Masking import ModelPanel2D as panel2D 14 15 15 16 ## event to post model to fit to fitting plugins … … 44 45 Initialization of the Panel 45 46 """ 46 ## fit page does not content npts txtcrtl47 ## total number of point: float 47 48 self.npts=None 48 49 ## thread for compute Chisqr … … 77 78 if self.smearer ==None: 78 79 self.enable_smearer.Disable() 79 #self.disable_smearer.Disable() 80 if self.data.__class__.__name__ =="Data2D": 81 if self.model != None: 82 self.smear_description_2d.Show(True) 83 self.npts = len(self.data.data) 84 else: 85 self.npts = len(self.data.x) 86 80 87 81 88 self.disp_cb_dict = {} … … 169 176 add access to npts 170 177 """ 178 is_2Ddata = False 179 180 # Check if data is 2D 181 if self.data.__class__.__name__ != 'Data1D': 182 is_2Ddata = True 183 171 184 title = "Fitting" 172 185 #smear messages & titles … … 180 193 smear_message_slit_height_title = "Slit height[1/A]:" 181 194 smear_message_slit_width_title = "Slit width[1/A]:" 195 #Fit button 196 self.btFit = wx.Button(self,wx.NewId(),'Fit', size=(88,25)) 197 self.btFit.Bind(wx.EVT_BUTTON, self._onFit,id= self.btFit.GetId()) 198 self.btFit.SetToolTipString("Start fitting.") 182 199 183 200 self._get_smear_info() 184 201 202 #Sizers 185 203 box_description_range = wx.StaticBox(self, -1,str(title)) 186 boxsizer_range = wx.StaticBoxSizer(box_description_range, wx.VERTICAL) 187 188 sizer_fit = wx.GridSizer(1, 1,0, 0) 189 190 self.btFit = wx.Button(self,wx.NewId(),'Fit', size=(80,23)) 191 self.btFit.Bind(wx.EVT_BUTTON, self._onFit,id= self.btFit.GetId()) 192 self.btFit.SetToolTipString("Perform fit.") 193 194 195 204 boxsizer_range = wx.StaticBoxSizer(box_description_range, wx.VERTICAL) 196 205 self.sizer_set_smearer = wx.BoxSizer(wx.VERTICAL) 197 206 sizer_smearer = wx.BoxSizer(wx.HORIZONTAL) … … 247 256 sizer_smearer.Add((10,10)) 248 257 249 # static box for chi2 250 box_description= wx.StaticBox(self, -1,'Chi2/dof') 251 boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 252 boxsizer1.SetMinSize((70,40)) 253 254 255 256 # StaticText for chi2 and smear 257 self.tcChi = wx.StaticText(self, -1, "-", style=wx.ALIGN_LEFT) 258 # StaticText for chi2, N(for fitting), Npts 259 self.tcChi = BGTextCtrl(self, -1, "-", size=(75,20), style=0) 260 self.tcChi.SetToolTipString("Chi2/Npts") 261 self.Npts_fit = BGTextCtrl(self, -1, "-", size=(75,20), style=0) 262 self.Npts_fit.SetToolTipString(" Npts : number of points selected for fitting") 263 self.Npts_total = BGTextCtrl(self, -1, "-", size=(75,20), style=0) 264 self.Npts_total.SetValue(str(self.npts)) 265 self.Npts_total.SetToolTipString(" Total Npts : total number of data points") 266 box_description_1= wx.StaticText(self, -1,' Chi2/Npts') 267 box_description_2= wx.StaticText(self, -1,' Npts') 268 box_description_3= wx.StaticText(self, -1,' Total Npts') 269 box_description_4= wx.StaticText(self, -1,' ') 270 271 sizer_fit = wx.GridSizer(2, 4,2,6) 272 sizer_fit.Add(box_description_1,0,0) 273 sizer_fit.Add(box_description_2,0,0) 274 sizer_fit.Add(box_description_3,0,0) 275 sizer_fit.Add(box_description_4,0,0) 276 sizer_fit.Add(self.tcChi,0,0) 277 sizer_fit.Add(self.Npts_fit ,0,0) 278 sizer_fit.Add(self.Npts_total,0,0) 279 sizer_fit.Add(self.btFit,0,0) 280 281 # StaticText for smear 282 #self.tcChi = wx.StaticText(self, -1, "-", style=wx.ALIGN_LEFT) 258 283 self.smear_description_none = wx.StaticText(self, -1, smear_message_none , style=wx.ALIGN_LEFT) 259 284 self.smear_description_dqdata = wx.StaticText(self, -1, smear_message_dqdata , style=wx.ALIGN_LEFT) … … 271 296 272 297 #arrange sizers 273 boxsizer1.Add( self.tcChi )298 #boxsizer1.Add( self.tcChi ) 274 299 self.sizer_set_smearer.Add(sizer_smearer ) 275 300 self.sizer_set_smearer.Add((10,10)) … … 297 322 self.sizer_set_smearer.Add( self.sizer_new_smear,0, wx.CENTER, 10 ) 298 323 299 # add all to chi2 sizer 300 301 sizer_smearer_box.Add(self.sizer_set_smearer) 302 324 # add all to chi2 sizer 325 sizer_smearer_box.Add(self.sizer_set_smearer) 303 326 sizer_chi2.Add(sizer_smearer_box) 304 327 sizer_chi2.Add((-1,5)) 305 self.sizer_set_masking.Add((305,-1)) 306 #self.sizer_set_masking.Add(boxsizer1,0, wx.RIGHT, 10) 307 sizer_chi2.Add(self.sizer_set_masking ) 308 309 sizer_fit.Add(boxsizer1,0, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 63) 310 #sizer_fit.Add((-1,1),0, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 1) 311 sizer_fit.Add(self.btFit,0, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 63) 312 sizer_fit.Layout() 313 #sizer_smearer_box.Add(sizer_chi2) 328 314 329 # hide all smear messages and textctrl 315 330 self._hide_all_smear_info() … … 320 335 # Show only the relevant smear messages, etc 321 336 if self.current_smearer == None: 322 if self.data.__class__.__name__ != 'Data2D':337 if not is_2Ddata: 323 338 self.smear_description_none.Show(True) 324 339 self.enable_smearer.Disable() … … 329 344 self.enable_smearer.Disable() 330 345 else: self._show_smear_sizer() 331 346 boxsizer_range.Add(self.sizer_set_masking) 332 347 333 348 #Set sizer for Fitting section … … 814 829 when enter value on panel redraw model according to changed 815 830 """ 831 #default flag 816 832 flag = False 833 self.fitrange = True 834 #get event object 817 835 tcrtl= event.GetEventObject() 818 836 … … 822 840 823 841 if check_float(tcrtl): 824 flag = self._onparamEnter_helper() 825 temp_smearer = None 826 if not self.disable_smearer.GetValue(): 827 temp_smearer= self.current_smearer 828 ## set smearing value whether or not the data contain the smearing info 829 if self.slit_smearer.GetValue(): 830 flag1 = self.update_slit_smear() 831 flag = flag or flag1 832 elif self.pinhole_smearer.GetValue(): 833 flag1 = self.update_pinhole_smear() 834 flag = flag or flag1 835 elif self.data.__class__.__name__ !="Data2D": 836 self.manager.set_smearer(smearer=temp_smearer, qmin= float(self.qmin_x), 837 qmax= float(self.qmax_x)) 838 if flag: 839 self.compute_chisqr(smearer= temp_smearer) 840 841 ## new state posted 842 if self.state_change: 843 #self._undo.Enable(True) 844 event = PageInfoEvent(page = self) 845 wx.PostEvent(self.parent, event) 846 self.state_change= False 842 flag = self._onparamEnter_helper() 843 if self.fitrange: 844 temp_smearer = None 845 if not self.disable_smearer.GetValue(): 846 temp_smearer= self.current_smearer 847 ## set smearing value whether or not the data contain the smearing info 848 if self.slit_smearer.GetValue(): 849 flag1 = self.update_slit_smear() 850 flag = flag or flag1 851 elif self.pinhole_smearer.GetValue(): 852 flag1 = self.update_pinhole_smear() 853 flag = flag or flag1 854 elif self.data.__class__.__name__ !="Data2D": 855 self.manager.set_smearer(smearer=temp_smearer, qmin= float(self.qmin_x), 856 qmax= float(self.qmax_x)) 857 if flag: 858 self.compute_chisqr(smearer= temp_smearer) 859 860 ## new state posted 861 if self.state_change: 862 #self._undo.Enable(True) 863 event = PageInfoEvent(page = self) 864 wx.PostEvent(self.parent, event) 865 self.state_change= False 866 else: 867 return # invalid fit range: do nothing here: msg already displayed in validate 847 868 else: 848 869 self.save_current_state() … … 923 944 return 924 945 #Check if # of points for theory model are valid(>0). 925 if self.npts != None: 926 if check_float(self.npts): 927 temp_npts = float(self.npts.GetValue()) 928 if temp_npts != self.num_points: 929 self.num_points = temp_npts 930 is_modified = True 946 # check for 2d 947 if self.data.__class__.__name__ =="Data2D": 948 # set mask 949 radius= numpy.sqrt( self.data.qx_data*self.data.qx_data + self.data.qy_data*self.data.qy_data ) 950 index_data = ((self.qmin <= radius)&(radius<= self.qmax)) 951 index_data = (index_data)&(self.data.mask) 952 index_data = (index_data)&(numpy.isfinite(self.data.data)) 953 if len(index_data[index_data]) < 10: 954 msg= "Cannot Plot :No or too little npts in that data range!!! " 955 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 956 return 931 957 else: 932 msg= "Cannot Plot :No npts in that Qrange!!! " 933 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 958 self.data.mask = index_data 959 self.Npts_fit.Setvalue(str(len(self.data.mask))) 960 else: 961 index_data = ((self.qmin <= self.data.x)&(self.data.x <= self.qmax)) 962 self.Npts_fit.SetValue(str(len(self.data.x[index_data]))) 934 963 935 964 else: … … 945 974 self.state_change= False 946 975 self._draw_model() 947 976 return 948 977 def _clear_Err_on_Fit(self): 949 978 """ … … 1086 1115 self.smear_message_new_s.Hide() 1087 1116 1117 def _onMask(self, event): 1118 """ 1119 Build a panel to allow to edit Mask 1120 """ 1121 1122 from sans.guiframe.local_perspectives.plotting.masking import MaskPanel as MaskDialog 1123 1124 self.panel = MaskDialog(self, data=self.data,id =-1 ) 1125 self.panel.Bind(wx.EVT_CLOSE, self._draw_masked_model) 1126 self.panel.ShowModal() 1127 #wx.PostEvent(self.parent, event) 1128 1129 def _draw_masked_model(self,event): 1130 event.Skip() 1131 1132 is_valid_qrange = self._update_paramv_on_fit() 1133 if is_valid_qrange: 1134 self._draw_model() 1135 self.panel.Destroy() # frame 1136 self.set_npts2fit() 1137 else: 1138 msg = ' Please consider your Q range.' 1139 self.panel.ShowMessage(msg) 1088 1140 1089 1141 def set_data(self, data): … … 1092 1144 """ 1093 1145 self.data = data 1146 1147 1094 1148 if self.data is None: 1095 1149 data_min = "" … … 1105 1159 else: 1106 1160 self.enable_smearer.Enable() 1107 1161 1108 1162 # more disables for 2D 1109 1163 if self.data.__class__.__name__ =="Data2D": … … 1113 1167 self.pinhole_smearer.Disable() 1114 1168 self.slit_smearer.Disable() 1169 self.default_mask = copy.deepcopy(self.data.mask) 1115 1170 1116 1171 … … 1124 1179 # Maximum value of data 1125 1180 data_max = max(self.data.x) 1181 #number of total data points 1182 self.Npts_total.SetValue(str(len(self.data.x))) 1183 #default:number of data points selected to fit 1184 self.Npts_fit.SetValue(str(len(self.data.x))) 1126 1185 else: 1127 1186 ## Minimum value of data … … 1131 1190 ## Maximum value of data 1132 1191 data_max = math.sqrt(x*x + y*y) 1133 1192 #number of total data points 1193 self.Npts_total.SetValue(str(len(self.data.data))) 1194 #default:number of data points selected to fit 1195 self.Npts_fit.SetValue(str(len(self.data.data))) 1196 1134 1197 self.dataSource.SetValue(data_name) 1135 1198 self.qmin_x = data_min … … 1177 1240 npts2fit = 0 1178 1241 qmin,qmax = self.get_range() 1179 if self.data.__class__.__name__ =="Data2D": 1180 npts2fit = len(self.data.data[self.mask]) 1242 if self.data.__class__.__name__ =="Data2D": 1243 radius= numpy.sqrt( self.data.qx_data*self.data.qx_data + self.data.qy_data*self.data.qy_data ) 1244 index_data = (self.qmin_x <= radius)&(radius<= self.qmax_x) 1245 index_data= (index_data)&(self.data.mask) 1246 index_data = (index_data)&(numpy.isfinite(self.data.data)) 1247 npts2fit = len(self.data.data[index_data]) 1181 1248 else: 1182 1249 for qx in self.data.x: … … 1185 1252 return npts2fit 1186 1253 1187 1254 def set_npts2fit(self): 1255 """ 1256 setValue Npts for fitting 1257 """ 1258 self.Npts_fit.SetValue(str(self.get_npts2fit())) 1259 1260 1188 1261 def get_chi2(self): 1189 1262 """ -
sansview/perspectives/fitting/model_thread.py
r43e685d r51a71a3 81 81 # so that must be mulitified by sqrt(2) to get actual max for 2d 82 82 index_model = ((self.qmin <= radius)&(radius<= self.qmax)) 83 self.mask= (index_model)&(self.mask)84 self.mask = (self.mask)&(numpy.isfinite(self.I_data))83 index_model = (index_model)&(self.mask) 84 index_model = (index_model)&(numpy.isfinite(self.I_data)) 85 85 if self.data ==None: 86 86 # Only qmin value will be consider for the detector 87 self.mask= index_data87 index_model = index_data 88 88 89 value = self.model.evalDistribution([self.qx_data[ self.mask],self.qy_data[self.mask]] )89 value = self.model.evalDistribution([self.qx_data[index_model],self.qy_data[index_model]] ) 90 90 91 output = numpy.zeros(len(self. mask))91 output = numpy.zeros(len(self.qx_data)) 92 92 93 93 # output default is None … … 95 95 output = output/output 96 96 # set value for self.mask==True, else still None to Plottools 97 output[self.mask] = value 98 97 output[index_model] = value 99 98 elapsed = time.time()-self.starttime 100 99 self.complete( image = output,
Note: See TracChangeset
for help on using the changeset viewer.