Changeset 0315b63 in sasview for src/sas/sasgui/perspectives/fitting/simfitpage.py
- Timestamp:
- Sep 25, 2017 5:24:46 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:
- 24d9e84, fca1f50
- Parents:
- b277220 (diff), 66000ae (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/simfitpage.py
r69363c7 r0315b63 163 163 :return: None 164 164 """ 165 model_map = {} 165 init_map = {} 166 final_map = {} 166 167 # Process each model and associate old M# with new M# 167 168 i = 0 … … 175 176 model_map[saved_model.pop('fit_page_source')] = \ 176 177 model[3].name 178 check = bool(saved_model.pop('checked')) 179 self.model_list[i][0].SetValue(check) 180 inter_id = str(i)*5 181 init_map[saved_model.pop('fit_page_source')] = inter_id 182 final_map[inter_id] = model[3].name 177 183 check = bool(saved_model.pop('checked')) 178 184 self.model_list[i][0].SetValue(check) … … 1099 1105 cbox.Append(name, value) 1100 1106 cbox.SetStringSelection(selected) 1107 <<<<<<< HEAD 1108 ======= 1109 1110 1111 class SimFitPageState: 1112 """ 1113 State of the simultaneous fit page for saving purposes 1114 """ 1115 1116 def __init__(self): 1117 # Sim Fit Page Number 1118 self.fit_page_no = None 1119 # Select all data 1120 self.select_all = False 1121 # Data sets sent to fit page 1122 self.model_list = [] 1123 # Data sets to be fit 1124 self.model_to_fit = [] 1125 # Number of constraints 1126 self.no_constraint = 0 1127 # Dictionary of constraints 1128 self.constraint_dict = {} 1129 # List of constraints 1130 self.constraints_list = [] 1131 1132 def load_from_save_state(self, fit): 1133 """ 1134 Load in a simultaneous/constrained fit from a save state 1135 :param fit: Fitpanel object 1136 :return: None 1137 """ 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_page 1144 1145 # Process each model and associate old M# with new M# 1146 i = 0 1147 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_id 1152 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_id 1156 final_map[inter_id] = model[3].name 1157 check = bool(saved_model.pop('checked')) 1158 sim_page.model_list[i][0].SetValue(check) 1159 break 1160 i += 1 1161 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_page 1188 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_id 1194 >>>>>>> ticket-887-reorg
Note: See TracChangeset
for help on using the changeset viewer.