Changeset 24d9e84 in sasview
- Timestamp:
- Sep 25, 2017 5:38:15 PM (7 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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 69a6897, fca1f50
- Parents:
- 0315b63
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/simfitpage.py
r0315b63 r24d9e84 199 199 param = item.pop('param_cbox') 200 200 equality = item.pop('egal_txt') 201 for key, value in model_map.iteritems(): 202 model_cbox.replace(key, value) 203 constraint_value.replace(key, value) 201 for key, value in init_map.items(): 202 model_cbox = model_cbox.replace(key, value) 203 constraint_value = constraint_value.replace(key, value) 204 for key, value in final_map.items(): 205 model_cbox = model_cbox.replace(key, value) 206 constraint_value = constraint_value.replace(key, value) 204 207 205 208 self.constraints_list[index][0].SetValue(model_cbox) … … 1105 1108 cbox.Append(name, value) 1106 1109 cbox.SetStringSelection(selected) 1107 <<<<<<< HEAD1108 =======1109 1110 1111 class SimFitPageState:1112 """1113 State of the simultaneous fit page for saving purposes1114 """1115 1116 def __init__(self):1117 # Sim Fit Page Number1118 self.fit_page_no = None1119 # Select all data1120 self.select_all = False1121 # Data sets sent to fit page1122 self.model_list = []1123 # Data sets to be fit1124 self.model_to_fit = []1125 # Number of constraints1126 self.no_constraint = 01127 # Dictionary of constraints1128 self.constraint_dict = {}1129 # List of constraints1130 self.constraints_list = []1131 1132 def load_from_save_state(self, fit):1133 """1134 Load in a simultaneous/constrained fit from a save state1135 :param fit: Fitpanel object1136 :return: None1137 """1138 1139 init_map = {}1140 final_map = {}1141 if fit.fit_panel.sim_page is None:1142 fit.fit_panel.add_sim_page()1143 sim_page = fit.fit_panel.sim_page1144 1145 # Process each model and associate old M# with new M#1146 i = 01147 for model in sim_page.model_list:1148 model_id = self._format_id(model[1].keys()[0])1149 for saved_model in self.model_list:1150 save_id = saved_model.pop('name')1151 saved_model['name'] = save_id1152 save_id = self._format_id(save_id)1153 if save_id == model_id:1154 inter_id = str(i) + str(i) + str(i) + str(i) + str(i)1155 init_map[saved_model.pop('fit_page_source')] = inter_id1156 final_map[inter_id] = model[3].name1157 check = bool(saved_model.pop('checked'))1158 sim_page.model_list[i][0].SetValue(check)1159 break1160 i += 11161 sim_page.check_model_name(None)1162 1163 if len(self.constraints_list) > 0:1164 sim_page.hide_constraint.SetValue(False)1165 sim_page.show_constraint.SetValue(True)1166 sim_page._display_constraint(None)1167 1168 for index, item in enumerate(self.constraints_list):1169 model_cbox = item.pop('model_cbox')1170 if model_cbox != "":1171 constraint_value = item.pop('constraint')1172 param = item.pop('param_cbox')1173 equality = item.pop('egal_txt')1174 for key, value in init_map.items():1175 model_cbox = model_cbox.replace(key, value)1176 constraint_value = constraint_value.replace(key, value)1177 for key, value in final_map.items():1178 model_cbox = model_cbox.replace(key, value)1179 constraint_value = constraint_value.replace(key, value)1180 1181 sim_page.constraints_list[index][0].SetValue(model_cbox)1182 sim_page._on_select_model(None)1183 sim_page.constraints_list[index][1].SetValue(param)1184 sim_page.constraints_list[index][2].SetLabel(equality)1185 sim_page.constraints_list[index][3].SetValue(constraint_value)1186 sim_page._on_add_constraint(None)1187 sim_page._manager.sim_page = sim_page1188 1189 def _format_id(self, original_id):1190 original_id = original_id.rstrip('1234567890.')1191 new_id_list = original_id.split()1192 new_id = ' '.join(new_id_list)1193 return new_id1194 >>>>>>> ticket-887-reorg
Note: See TracChangeset
for help on using the changeset viewer.