Changeset f7ef313 in sasview for fittingview/src
- Timestamp:
- Sep 8, 2011 3:26:53 PM (13 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:
- 36288ca
- Parents:
- 5637362
- Location:
- fittingview/src/sans/perspectives/fitting
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
fittingview/src/sans/perspectives/fitting/basepage.py
r55bb249c rf7ef313 1785 1785 if not self.disable_smearer.GetValue(): 1786 1786 temp_smear= self.current_smearer 1787 weight = self.get_weight() 1787 # compute weight for the current data 1788 from .utils import get_weight 1789 flag = self.get_weight_flag() 1790 weight = get_weight(data=self.data, is2d=self._is_2D(), flag=flag) 1788 1791 toggle_mode_on = self.model_view.IsEnabled() 1789 1792 self._manager.draw_model(self.model, -
fittingview/src/sans/perspectives/fitting/fitpage.py
ra0106ac rf7ef313 1109 1109 self._manager.schedule_for_fit(uid=self.uid,value=1) 1110 1110 self._manager.set_fit_weight(uid=self.uid, 1111 weight=self.get_weight(),1111 flag=self.get_weight_flag(), 1112 1112 is2d = self._is_2D()) 1113 1113 self._manager.set_fit_range(uid=self.uid,qmin=self.qmin_x, … … 1118 1118 self.bind_fit_button() 1119 1119 1120 def get_weight (self):1121 """ 1122 Get weighting dI data1120 def get_weight_flag(self): 1121 """ 1122 Get flag corresponding to a given weighting dI data. 1123 1123 """ 1124 1124 button_list = [self.dI_noweight, … … 1126 1126 self.dI_sqrdata, 1127 1127 self.dI_idata] 1128 if self._is_2D(): 1129 dy_data = self.data.err_data 1130 data = self.data.data 1131 else: 1132 dy_data = self.data.dy 1133 data = self.data.y 1134 dy = dy_data 1128 flag = 1 1135 1129 for item in button_list: 1136 1130 if item.GetValue(): 1137 1131 if button_list.index(item) == 0: 1138 dy = numpy.ones_like(dy_data)1132 flag = 0 #dy = numpy.ones_like(dy_data) 1139 1133 elif button_list.index(item) == 1: 1140 dy = dy_data1134 flag = 1 #dy = dy_data 1141 1135 elif button_list.index(item) == 2: 1142 dy = numpy.sqrt(numpy.abs(data))1136 flag = 2 #dy = numpy.sqrt(numpy.abs(data)) 1143 1137 elif button_list.index(item) == 3: 1144 dy = numpy.abs(data)1138 flag = 3 # dy = numpy.abs(data) 1145 1139 break 1146 return dy1140 return flag 1147 1141 1148 1142 def bind_fit_button(self): -
fittingview/src/sans/perspectives/fitting/fitproblem.py
r55bb249c rf7ef313 88 88 :return: fitting range 89 89 """ 90 def set_weight(self, weight=None):90 def set_weight(self, flag=None): 91 91 """ 92 92 set fitting range … … 330 330 return self[fid].get_range() 331 331 332 def set_weight(self, weight, is2d, fid=None):332 def set_weight(self, is2d, flag=None, fid=None): 333 333 """ 334 334 fit weight … … 336 336 if fid is None: 337 337 for value in self.itervalues(): 338 value.set_weight( weight,is2d)339 else: 340 if fid in self.iterkeys(): 341 self[fid]. value.set_weight(weight,is2d)338 value.set_weight(flag=flag, is2d=is2d) 339 else: 340 if fid in self.iterkeys(): 341 self[fid].set_weight(flag=flag, is2d=is2d) 342 342 343 343 def get_weight(self, fid=None): … … 487 487 """ 488 488 self.fit_data = copy.deepcopy(data) 489 489 490 490 def get_fit_data(self): 491 491 """ … … 494 494 return self.fit_data 495 495 496 def set_weight(self, weight, is2d): 497 """ 498 Set weight array 499 """ 500 self.weight = weight 496 def set_weight(self, is2d, flag=None): 497 """ 498 Received flag and compute error on data. 499 :param flag: flag to transform error of data. 500 :param is2d: flag to distinguish 1D to 2D Data 501 """ 502 from .utils import get_weight 503 self.weight = get_weight(data=self.fit_data, is2d=is2d, flag=flag) 501 504 if is2d: 502 505 self.fit_data.err_data = self.weight -
fittingview/src/sans/perspectives/fitting/fitting.py
r55bb249c rf7ef313 432 432 self.state_reader.write(filename=filepath, fitstate=fitstate) 433 433 434 def set_fit_weight(self, uid, weight, is2d=False, fid=None):434 def set_fit_weight(self, uid, flag, is2d=False, fid=None): 435 435 """ 436 436 Set the fit weights of a given page for all … … 442 442 """ 443 443 if uid in self.page_finder.keys(): 444 self.page_finder[uid].set_weight( weight=weight, is2d=is2d)444 self.page_finder[uid].set_weight(flag=flag, is2d=is2d) 445 445 446 446 def set_fit_range(self, uid, qmin, qmax, fid=None): … … 698 698 name = str(element[1]) 699 699 pars.append(name) 700 701 700 for fitproblem in value.get_fit_problem(): 702 701 if sim_fitter is None: 703 702 fitter = Fit(self._fit_engine) 703 print "onfit id ", id(fitproblem) 704 704 self._fit_helper(fitproblem, pars, fitter, fit_id) 705 705 fitter_list.append(fitter) … … 793 793 if data_list is None: 794 794 data_list = [] 795 795 796 self.page_finder[uid].set_fit_data(data=data_list) 796 797 if caption is not None: 797 798 self.page_finder[uid].set_fit_tab_caption(caption=caption) 798 799 799 800 def on_add_new_page(self, event=None): 800 801 """ … … 848 849 self.parent.update_data(prev_data=theory_data, 849 850 new_data=data) 850 851 851 self.store_data(uid=page.uid, data_list=page.get_data_list(), 852 852 caption=page.window_caption)
Note: See TracChangeset
for help on using the changeset viewer.