Changes in / [3cb3a51:9e6aeaf] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/simfitpage.py
r24d9e84 r00f7ff1 199 199 param = item.pop('param_cbox') 200 200 equality = item.pop('egal_txt') 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) 201 for key, value in model_map.iteritems(): 202 model_cbox.replace(key, value) 203 constraint_value.replace(key, value) 207 204 208 205 self.constraints_list[index][0].SetValue(model_cbox) … … 1108 1105 cbox.Append(name, value) 1109 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.