Changeset 7bd6cfae in sasview for fittingview/src/sans
- Timestamp:
- Oct 3, 2011 7:21:52 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:
- 63dc6e5
- Parents:
- 5425990
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fittingview/src/sans/perspectives/fitting/fitting.py
r029e4d3 r7bd6cfae 732 732 name = str(element[1]) 733 733 pars.append(name) 734 for fitproblem in value.get_fit_problem(): 734 fitproblem_list = value.values() 735 fitproblem_list.sort() 736 for fitproblem in fitproblem_list: 735 737 if sim_fitter is None: 736 738 fitter = Fit(self._fit_engine) … … 967 969 if item[0] != None and item[1] != None: 968 970 listOfConstraint.append((item[0],item[1])) 969 for param in model.getParamList():970 if param not in pars:971 if param not in batch_inputs.keys():972 batch_inputs[param] = []973 if param not in model.non_fittable:974 batch_inputs[param].append(model.getParam(param))975 971 new_model = model#deepcopy(model) 976 972 fitter.set_model(new_model, fit_id, pars, constraints=listOfConstraint) … … 978 974 qmax=qmax) 979 975 fitter.select_problem_for_fit(id=fit_id, value=1) 980 #fill batch result information 981 if "Data" not in batch_outputs.keys(): 982 batch_outputs["Data"] = [] 983 batch_outputs["Data"].append(data.name) 984 for key, value in data.meta_data.iteritems(): 985 if key not in batch_inputs.keys(): 986 batch_inputs[key] = [] 987 batch_inputs[key].append(value) 988 param = "temperature" 989 if hasattr(data.sample, param): 990 if param not in batch_inputs.keys(): 991 batch_inputs[param] = [] 992 batch_inputs[param].append(data.sample.temperature) 976 993 977 994 978 def _onSelect(self,event): … … 1046 1030 if res is None: 1047 1031 null_value = numpy.nan 1048 batch_outputs["Chi2"].append(null_value) 1032 from sans.guiframe.data_processor import BatchCell 1033 cell = BatchCell() 1034 cell.label = null_value 1035 cell.value = null_value 1036 batch_outputs["Chi2"].append(cell) 1049 1037 for index in range(len(pars)): 1050 1038 batch_outputs[pars[index]].append(null_value) … … 1052 1040 batch_inputs["error on %s" % pars[index]].append(item) 1053 1041 else: 1054 batch_outputs["Chi2"].append(res.fitness) 1042 from sans.guiframe.data_processor import BatchCell 1043 cell = BatchCell() 1044 cell.label = res.fitness 1045 cell.value = res.fitness 1046 batch_outputs["Chi2"].append(cell) 1055 1047 for index in range(len(pars)): 1056 1048 batch_outputs[pars[index]].append(res.pvec[index]) … … 1060 1052 self.page_finder[pid].set_result(result=batch_outputs) 1061 1053 1062 """1063 draw_model(self, model, page_id, data=None, smearer=None,1064 enable1D=True, enable2D=False,1065 state=None,1066 toggle_mode_on=False,1067 qmin=None, qmax=None,1068 update_chisqr=True, weight=None):1069 """1070 1054 for pid in page_id: 1071 1055 cpage = self.fit_panel.get_page_by_id(pid) … … 1089 1073 update_chisqr=False, 1090 1074 weight=weight) 1075 #get theory data and residuals of each data then send all values 1076 # to the grid 1077 wx.CallAfter(self.on_set_batch_result, page_id, pars, batch_outputs, 1078 batch_inputs) 1091 1079 1092 self.parent.on_set_batch_result(data_outputs=batch_outputs, 1080 def on_set_batch_result(self, page_id, pars, batch_outputs, batch_inputs): 1081 """ 1082 """ 1083 for pid in page_id: 1084 fitproblem_list = self.page_finder[pid].values() 1085 fitproblem_list.sort() 1086 index = 0 1087 for fitproblem in fitproblem_list: 1088 residuals = fitproblem.get_residuals() 1089 theory_data = fitproblem.get_theory_data() 1090 data = fitproblem.get_fit_data() 1091 model = fitproblem.get_model() 1092 #fill batch result information 1093 if "Data" not in batch_outputs.keys(): 1094 batch_outputs["Data"] = [] 1095 from sans.guiframe.data_processor import BatchCell 1096 cell = BatchCell() 1097 cell.label = data.name 1098 cell.value = index 1099 cell.object = [data, theory_data] 1100 1101 for param in model.getParamList(): 1102 if param not in pars: 1103 if param not in batch_inputs.keys(): 1104 batch_inputs[param] = [] 1105 if param not in model.non_fittable: 1106 batch_inputs[param].append(model.getParam(param)) 1107 batch_outputs["Data"].append(cell) 1108 for key, value in data.meta_data.iteritems(): 1109 if key not in batch_inputs.keys(): 1110 batch_inputs[key] = [] 1111 batch_inputs[key].append(value) 1112 param = "temperature" 1113 if hasattr(data.sample, param): 1114 if param not in batch_inputs.keys(): 1115 batch_inputs[param] = [] 1116 batch_inputs[param].append(data.sample.temperature) 1117 # associate residuals plot 1118 batch_outputs["Chi2"][index].object = residuals 1119 1120 self.parent.on_set_batch_result(data_outputs=batch_outputs, 1093 1121 data_inputs=batch_inputs, 1094 1122 plugin_name=self.sub_menu) … … 1151 1179 wx.PostEvent(self.parent, StatusEvent(status=msg)) 1152 1180 except ValueError: 1181 raise 1153 1182 self._update_fit_button(page_id) 1154 1183 msg = "Single Fitting did not converge!!!" … … 1156 1185 type="stop")) 1157 1186 except: 1187 raise 1158 1188 self._update_fit_button(page_id) 1159 1189 msg = "Single Fit completed but Following"
Note: See TracChangeset
for help on using the changeset viewer.