Changeset 41661a0 in sasview for fittingview/src/sans/perspectives/fitting
- Timestamp:
- Oct 5, 2011 11:14:09 AM (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:
- 634ca14
- Parents:
- 0f17dd9
- Location:
- fittingview/src/sans/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fittingview/src/sans/perspectives/fitting/fitproblem.py
rf64a4b7 r41661a0 135 135 Get graph_id 136 136 """ 137 def set_result(self, result): 138 """ 139 """ 140 141 def get_result(self): 142 """ 143 get result 144 """ 145 137 146 138 147 class FitProblemDictionary(FitProblemComponent, dict): … … 419 428 return self.itervalues() 420 429 421 def set_result(self, batch_inputs, batch_outputs): 430 def set_result(self, result, fid): 431 """ 432 """ 433 if fid in self.iterkeys(): 434 self[fid].set_result(result) 435 436 def set_batch_result(self, batch_inputs, batch_outputs): 422 437 """ 423 438 set a list of result … … 425 440 self.batch_inputs = batch_inputs 426 441 self.batch_outputs = batch_outputs 427 428 def get_result(self): 442 443 def get_result(self, fid): 444 """ 445 get result 446 """ 447 if fid in self.iterkeys(): 448 return self[fid].get_result() 449 450 def get_batch_result(self): 429 451 """ 430 452 get result … … 689 711 """ 690 712 return self.graph_id 691 713 714 def set_result(self, result): 715 """ 716 """ 717 self.result = result 718 719 def get_result(self): 720 """ 721 get result 722 """ 723 return self.result -
fittingview/src/sans/perspectives/fitting/fitting.py
r31469d50 r41661a0 761 761 pars.append(name) 762 762 fitproblem_list = value.values() 763 fitproblem_list.sort()764 763 for fitproblem in fitproblem_list: 765 764 if sim_fitter is None: … … 999 998 listOfConstraint.append((item[0],item[1])) 1000 999 new_model = model#deepcopy(model) 1001 fitter.set_model(new_model, fit_id, pars, constraints=listOfConstraint) 1000 fitter.set_model(new_model, fit_id, pars, data=data, 1001 constraints=listOfConstraint) 1002 1002 fitter.set_data(data=data, id=fit_id, smearer=smearer, qmin=qmin, 1003 1003 qmax=qmax) … … 1035 1035 print "update_fit result", result 1036 1036 1037 1038 1037 1039 def _batch_single_fit_complete_helper(self, result, pars, page_id, 1038 1040 batch_outputs, batch_inputs, elapsed=None): … … 1048 1050 wx.PostEvent(self.parent, StatusEvent(status=msg, info="info", 1049 1051 type="stop")) 1052 pid = page_id[0] 1050 1053 if batch_outputs is None: 1051 1054 batch_outputs = {} … … 1079 1082 item = res.stderr[index] 1080 1083 batch_inputs["error on %s" % pars[index]].append(item) 1081 pid = page_id[0] 1082 self.page_finder[pid].set_result(batch_inputs=batch_inputs, 1083 batch_outputs=batch_outputs) 1084 count = len(self.page_finder[pid].keys()) 1085 for pid in page_id: 1084 1085 1086 self.page_finder[pid].set_batch_result(batch_inputs=batch_inputs, 1087 batch_outputs=batch_outputs) 1086 1088 cpage = self.fit_panel.get_page_by_id(pid) 1087 1089 cpage._on_fit_complete() 1088 fitproblem_list = self.page_finder[pid].values() 1089 fitproblem_list.sort() 1090 for fitproblem in fitproblem_list: 1091 data = fitproblem.get_fit_data() 1092 model = fitproblem.get_model() 1093 smearer = fitproblem.get_smearer() 1094 qmin, qmax = fitproblem.get_range() 1095 weight = fitproblem.get_weight() 1096 flag = issubclass(data.__class__, Data2D) 1097 self.draw_model(model=model, 1098 page_id=pid, 1099 data=data, 1100 smearer=smearer, 1101 enable1D=not flag, 1102 enable2D=flag, 1103 state=None, 1104 toggle_mode_on=False, 1105 fid=data.id, 1106 qmin=qmin, qmax=qmax, 1107 update_chisqr=False, 1108 weight=weight) 1109 1110 1111 1112 1090 model, data = res.inputs[0] 1091 self.page_finder[pid][data.id].set_result(res) 1092 fitproblem = self.page_finder[pid][data.id] 1093 smearer = fitproblem.get_smearer() 1094 qmin, qmax = fitproblem.get_range() 1095 weight = fitproblem.get_weight() 1096 flag = issubclass(data.__class__, Data2D) 1097 self.draw_model(model=model, 1098 page_id=pid, 1099 data=data, 1100 smearer=smearer, 1101 enable1D=not flag, 1102 enable2D=flag, 1103 state=None, 1104 toggle_mode_on=False, 1105 fid=data.id, 1106 qmin=qmin, qmax=qmax, 1107 update_chisqr=False, 1108 weight=weight) 1109 1113 1110 def on_set_batch_result(self, page_id, fid, batch_outputs, batch_inputs): 1114 1111 """ … … 1262 1259 #Separate result in to data corresponding to each page 1263 1260 for p in result.parameters: 1261 #print "simul ----", p , p.__class__, p.model.name, p.data.name 1264 1262 model_name, param_name = self.split_string(p.name) 1265 1263 if model.name == model_name: … … 1793 1791 m = self.page_finder[page_id].nbr_residuals_computed 1794 1792 flag = False 1795 batch_inputs, batch_outputs = self.page_finder[page_id].get_ result()1793 batch_inputs, batch_outputs = self.page_finder[page_id].get_batch_result() 1796 1794 1797 1795 if self.page_finder[page_id].nbr_residuals_computed == -1:
Note: See TracChangeset
for help on using the changeset viewer.