Changeset ba8d326 in sasview
- Timestamp:
- Jun 23, 2017 4:16:29 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:
- 98e3f24
- Parents:
- 81b35396
- git-author:
- Paul Kienzle <pkienzle@…> (06/21/17 12:38:48)
- git-committer:
- Paul Kienzle <pkienzle@…> (06/23/17 16:16:29)
- Location:
- src/sas
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/fit/pagestate.py
r81b35396 rba8d326 1 1 """ 2 2 Class that holds a fit page state 3 3 """ 4 4 # TODO: Refactor code so we don't need to use getattr/setattr … … 40 40 # Information to read/write state as xml 41 41 FITTING_NODE_NAME = 'fitting_plug_in' 42 CANSAS_NS = "cansas1d/1.0"42 CANSAS_NS = {"ns": "cansas1d/1.0"} 43 43 44 44 CUSTOM_MODEL = 'Plugin Models' … … 83 83 ["weights", "weights"]] 84 84 85 DISPERSION_LIST = [["disp_obj_dict", " _disp_obj_dict", "string"]]85 DISPERSION_LIST = [["disp_obj_dict", "disp_obj_dict", "string"]] 86 86 87 87 LIST_OF_STATE_PARAMETERS = [["parameters", "parameters"], … … 154 154 self.timestamp = time.time() 155 155 # Data member to store the dispersion object created 156 self. _disp_obj_dict = {}156 self.disp_obj_dict = {} 157 157 # ------------------------ 158 158 # Data used for fitting … … 271 271 # store value of chisqr 272 272 self.tcChi = None 273 self.version = (1, 0,0)273 self.version = (1, 0, 0) 274 274 275 275 def clone(self): … … 315 315 obj.tcChi = self.tcChi 316 316 317 if len(self. _disp_obj_dict) > 0:318 for k, v in self. _disp_obj_dict.iteritems():319 obj. _disp_obj_dict[k] = v317 if len(self.disp_obj_dict) > 0: 318 for k, v in self.disp_obj_dict.iteritems(): 319 obj.disp_obj_dict[k] = v 320 320 if len(self.disp_cb_dict) > 0: 321 321 for k, v in self.disp_cb_dict.iteritems(): … … 847 847 inputs.appendChild(element) 848 848 849 # Create doc for the dictionary of self. _disp_obj_dic849 # Create doc for the dictionary of self.disp_obj_dic 850 850 for tagname, varname, tagtype in DISPERSION_LIST: 851 851 element = newdoc.createElement(tagname) … … 928 928 """ 929 929 for item in node: 930 try: 931 name = item.get('name') 932 except: 933 name = None 934 try: 935 value = item.get('value') 936 except: 937 value = None 938 try: 939 selected_to_fit = (item.get('selected_to_fit') == "True") 940 except: 941 selected_to_fit = None 942 try: 943 error_displayed = (item.get('error_displayed') == "True") 944 except: 945 error_displayed = None 946 try: 947 error_value = item.get('error_value') 948 except: 949 error_value = None 950 try: 951 minimum_displayed = (item.get('minimum_displayed') == "True") 952 except: 953 minimum_displayed = None 954 try: 955 minimum_value = item.get('minimum_value') 956 except: 957 minimum_value = None 958 try: 959 maximum_displayed = (item.get('maximum_displayed') == "True") 960 except: 961 maximum_displayed = None 962 try: 963 maximum_value = item.get('maximum_value') 964 except: 965 maximum_value = None 966 try: 967 unit = item.get('unit') 968 except: 969 unit = None 930 name = item.get('name') 931 value = item.get('value') 932 selected_to_fit = (item.get('selected_to_fit') == "True") 933 error_displayed = (item.get('error_displayed') == "True") 934 error_value = item.get('error_value') 935 minimum_displayed = (item.get('minimum_displayed') == "True") 936 minimum_value = item.get('minimum_value') 937 maximum_displayed = (item.get('maximum_displayed') == "True") 938 maximum_value = item.get('maximum_value') 939 unit = item.get('unit') 970 940 list.append([selected_to_fit, name, value, "+/-", 971 941 [error_displayed, error_value], … … 1033 1003 list=getattr(self, item[1])) 1034 1004 1035 # Recover _disp_obj_dict from xml file1036 self. _disp_obj_dict = {}1005 # Recover disp_obj_dict from xml file 1006 self.disp_obj_dict = {} 1037 1007 for tagname, varname, tagtype in DISPERSION_LIST: 1038 1008 node = get_content("ns:%s" % tagname, entry) … … 1048 1018 except Exception: 1049 1019 base = "unable to load distribution %r for %s" 1050 logger.error(base % (value, parameter))1020 logger.error(base, value, parameter) 1051 1021 continue 1052 _disp_obj_dict = getattr(self, varname)1053 _disp_obj_dict[parameter] = value1022 disp_obj_dict = getattr(self, varname) 1023 disp_obj_dict[parameter] = value 1054 1024 1055 1025 # get self.values and self.weights dic. if exists … … 1074 1044 setattr(self, varname, dic) 1075 1045 1076 class SimFitPageState :1046 class SimFitPageState(object): 1077 1047 """ 1078 1048 State of the simultaneous fit page for saving purposes … … 1095 1065 self.constraints_list = [] 1096 1066 1067 def __repr__(self): 1068 # TODO: should use __str__, not __repr__ (similarly for PageState) 1069 # TODO: could use a nicer representation 1070 repr = """\ 1071 fit page number : %(fit_page_no)s 1072 select all : %(select_all)s 1073 model_list : %(model_list)s 1074 model to fit : %(model_to_fit)s 1075 number of construsts : %(no_constraint)s 1076 constraint dict : %(constraint_dict)s 1077 constraints list : %(constraints_list)s 1078 """%self.__dict__ 1079 return repr 1080 1097 1081 class Reader(CansasReader): 1098 1082 """ … … 1152 1136 try: 1153 1137 nodes = entry.xpath('ns:%s' % FITTING_NODE_NAME, 1154 namespaces= {'ns': CANSAS_NS})1138 namespaces=CANSAS_NS) 1155 1139 if nodes: 1156 1140 # Create an empty state … … 1158 1142 state.from_xml(node=nodes[0]) 1159 1143 1160 except :1144 except Exception: 1161 1145 logger.info("XML document does not contain fitting information.\n" 1162 1146 + traceback.format_exc()) 1163 1147 1164 1148 return state … … 1171 1155 """ 1172 1156 nodes = entry.xpath('ns:%s' % FITTING_NODE_NAME, 1173 namespaces= {'ns': CANSAS_NS})1157 namespaces=CANSAS_NS) 1174 1158 if nodes: 1175 1159 simfitstate = nodes[0].xpath('ns:simultaneous_fit', 1176 namespaces= {'ns': CANSAS_NS})1160 namespaces=CANSAS_NS) 1177 1161 if simfitstate: 1178 1162 sim_fit_state = SimFitPageState() 1179 1163 simfitstate_0 = simfitstate[0] 1180 1164 all = simfitstate_0.xpath('ns:select_all', 1181 namespaces= {'ns': CANSAS_NS})1165 namespaces=CANSAS_NS) 1182 1166 atts = all[0].attrib 1183 1167 checked = atts.get('checked') 1184 1168 sim_fit_state.select_all = bool(checked) 1185 1169 model_list = simfitstate_0.xpath('ns:model_list', 1186 namespaces= {'ns': CANSAS_NS})1170 namespaces=CANSAS_NS) 1187 1171 model_list_items = model_list[0].xpath('ns:model_list_item', 1188 namespaces={'ns': 1189 CANSAS_NS}) 1172 namespaces=CANSAS_NS) 1190 1173 for model in model_list_items: 1191 1174 attrs = model.attrib … … 1193 1176 1194 1177 constraints = simfitstate_0.xpath('ns:constraints', 1195 namespaces={'ns': CANSAS_NS})1178 namespaces=CANSAS_NS) 1196 1179 constraint_list = constraints[0].xpath('ns:constraint', 1197 namespaces={'ns': CANSAS_NS})1180 namespaces=CANSAS_NS) 1198 1181 for constraint in constraint_list: 1199 1182 attrs = constraint.attrib … … 1213 1196 1214 1197 """ 1215 node = dom.xpath('ns:data_class', namespaces= {'ns': CANSAS_NS})1198 node = dom.xpath('ns:data_class', namespaces=CANSAS_NS) 1216 1199 return_value, _ = self._parse_entry(dom) 1217 1200 return return_value, _ … … 1242 1225 root = tree.getroot() 1243 1226 entry_list = root.xpath('ns:SASentry', 1244 namespaces= {'ns': CANSAS_NS})1227 namespaces=CANSAS_NS) 1245 1228 for entry in entry_list: 1246 1229 try: … … 1266 1249 return None 1267 1250 else: 1268 for ind in range(len(output)):1251 for data in output: 1269 1252 # Call back to post the new state 1270 state = output[ind].meta_data['fitstate']1253 state = data.meta_data['fitstate'] 1271 1254 t = time.localtime(state.timestamp) 1272 1255 time_str = time.strftime("%b %d %H:%M", t) … … 1279 1262 1280 1263 if state is not None and state.is_data is not None: 1281 output[ind].is_data = state.is_data1282 1283 output[ind].filename = state.file1284 state.data = output[ind]1285 state.data.name = output[ind].filename # state.data_name1264 data.is_data = state.is_data 1265 1266 data.filename = state.file 1267 state.data = data 1268 state.data.name = data.filename # state.data_name 1286 1269 state.data.id = state.data_id 1287 1270 if state.is_data is not None: 1288 1271 state.data.is_data = state.is_data 1289 if output[ind].run_name is not None\1290 and len(output[ind].run_name) != 0:1291 if isinstance(output[ind].run_name, dict):1292 name = output[ind].run_name.keys()[0]1272 if data.run_name is not None and len(data.run_name) != 0: 1273 if isinstance(data.run_name, dict): 1274 # Note: key order in dict is not guaranteed, so sort 1275 name = data.run_name.keys()[0] 1293 1276 else: 1294 name = output[ind].run_name1277 name = data.run_name 1295 1278 else: 1296 1279 name = original_fname … … 1298 1281 state.version = fitstate.version 1299 1282 # store state in fitting 1300 self.call_back(state=state, 1301 datainfo=output[ind], format=ext) 1283 self.call_back(state=state, datainfo=data, format=ext) 1302 1284 self.state = state 1303 1285 simfitstate = self._parse_simfit_state(entry) -
src/sas/sasgui/perspectives/fitting/basepage.py
r81b35396 rba8d326 285 285 """ 286 286 x = np.linspace(start=self.qmin_x, stop=self.qmax_x, 287 287 num=self.npts_x, endpoint=True) 288 288 self.data = Data1D(x=x) 289 289 self.data.xaxis('\\rm{Q}', "A^{-1}") … … 311 311 312 312 x = np.logspace(start=qmin, stop=qmax, 313 313 num=self.npts_x, endpoint=True, base=10.0) 314 314 self.data = Data1D(x=x) 315 315 self.data.xaxis('\\rm{Q}', "A^{-1}") … … 904 904 if len(self._disp_obj_dict) > 0: 905 905 for k, v in self._disp_obj_dict.iteritems(): 906 self.state. _disp_obj_dict[k] = v.type906 self.state.disp_obj_dict[k] = v.type 907 907 908 908 self.state.values = copy.deepcopy(self.values) … … 922 922 self.state.str_parameters) 923 923 self._copy_parameters_state(self.orientation_params, 924 924 self.state.orientation_params) 925 925 self._copy_parameters_state(self.orientation_params_disp, 926 926 self.state.orientation_params_disp) … … 976 976 try: 977 977 self.state.disp_cb_dict[k] = v.GetValue() 978 except :978 except Exception: 979 979 self.state.disp_cb_dict[k] = None 980 980 if len(self._disp_obj_dict) > 0: 981 981 for k, v in self._disp_obj_dict.iteritems(): 982 self.state. _disp_obj_dict[k] = v.type982 self.state.disp_obj_dict[k] = v.type 983 983 984 984 self.state.values = copy.deepcopy(self.values) … … 1022 1022 # to support older version 1023 1023 category_pos = int(state.categorycombobox) 1024 except :1024 except Exception: 1025 1025 category_pos = 0 1026 1026 for ind_cat in range(self.categorybox.GetCount()): … … 1034 1034 # to support older version 1035 1035 formfactor_pos = int(state.formfactorcombobox) 1036 except :1036 except Exception: 1037 1037 formfactor_pos = 0 1038 1038 for ind_form in range(self.formfactorbox.GetCount()): … … 1047 1047 # to support older version 1048 1048 structfactor_pos = int(state.structurecombobox) 1049 except :1049 except Exception: 1050 1050 structfactor_pos = 0 1051 1051 for ind_struct in range(self.structurebox.GetCount()): … … 1284 1284 self.dI_sqrdata.SetValue(state.dI_sqrdata) 1285 1285 self.dI_idata.SetValue(state.dI_idata) 1286 except :1286 except Exception: 1287 1287 # to support older state file formats 1288 1288 self.dI_noweight.SetValue(False) … … 1340 1340 self.weights = copy.deepcopy(state.weights) 1341 1341 1342 for key, disp_type in state. _disp_obj_dict.iteritems():1342 for key, disp_type in state.disp_obj_dict.iteritems(): 1343 1343 # disp_model = disp 1344 1344 disp_model = POLYDISPERSITY_MODELS[disp_type]() … … 1574 1574 try: 1575 1575 self.npts_x = float(self.Npts_total.GetValue()) 1576 except :1576 except Exception: 1577 1577 flag = False 1578 1578 return flag … … 1615 1615 return 1616 1616 1617 for j in range(len(listtorestore)):1617 for item_page in listtorestore: 1618 1618 for param in statelist: 1619 if param[1] == listtorestore[j][1]: 1620 item_page = listtorestore[j] 1619 if param[1] == item_page[1]: 1621 1620 item_page_info = param 1622 1621 if (item_page_info[1] == "theta" or item_page_info[1] == … … 1664 1663 listtorestore = copy.deepcopy(statelist) 1665 1664 1666 for j in range(len(listtorestore)): 1667 item_page = listtorestore[j] 1668 item_page_info = statelist[j] 1665 for item_page, item_page_info in zip(listtorestore, statelist): 1669 1666 # change the state of the check box for simple parameters 1670 1671 1667 if item_page[0] is not None: 1672 1668 item_page[0].SetValue(format_number(item_page_info[0], True)) … … 1921 1917 wx.PostEvent(self.parent, StatusEvent(status=msg)) 1922 1918 return 1923 except :1919 except Exception: 1924 1920 tcrtl.SetBackgroundColour("pink") 1925 1921 msg = "Model Error: wrong value entered: %s" % sys.exc_info()[1] … … 1978 1974 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1979 1975 return 1980 except :1976 except Exception: 1981 1977 tcrtl.SetBackgroundColour("pink") 1982 1978 msg = "Model Error: wrong value entered: %s" % sys.exc_info()[1] … … 2156 2152 # q value from qx and qy 2157 2153 radius = np.sqrt(data.qx_data * data.qx_data + 2158 2154 data.qy_data * data.qy_data) 2159 2155 # get unmasked index 2160 2156 index_data = (float(self.qmin.GetValue()) <= radius) & \ … … 2385 2381 put gaussian dispersity into current model 2386 2382 """ 2387 if len(self.param_toFit) > 0:2383 if self.param_toFit: 2388 2384 for item in self.fittable_param: 2389 2385 if item in self.param_toFit: … … 2402 2398 # from sas.models.dispersion_models import GaussianDispersion 2403 2399 from sasmodels.weights import GaussianDispersion 2404 if len(self.disp_cb_dict) == 0: 2405 self.save_current_state() 2400 if not self.disp_cb_dict: 2406 2401 self.sizer4_4.Clear(True) 2407 self.Layout() 2408 return 2409 if (len(self.disp_cb_dict) > 0): 2402 else: 2410 2403 for p in self.disp_cb_dict: 2411 2404 # The parameter was un-selected. … … 2480 2473 self._disp_obj_dict[name1] = disp_model 2481 2474 self.model.set_dispersion(param_name, disp_model) 2482 self.state. _disp_obj_dict[name1] = disp_model.type2475 self.state.disp_obj_dict[name1] = disp_model.type 2483 2476 2484 2477 value1 = str(format_number(self.model.getParam(name1), True)) … … 2595 2588 self._disp_obj_dict[name] = disp 2596 2589 self.model.set_dispersion(name.split('.')[0], disp) 2597 self.state. _disp_obj_dict[name] = disp.type2590 self.state.disp_obj_dict[name] = disp.type 2598 2591 self.values[name] = values 2599 2592 self.weights[name] = weights … … 2953 2946 # go through the parameters 2954 2947 strings = self._get_copy_helper(self.parameters, 2955 self.orientation_params)2948 self.orientation_params) 2956 2949 content += strings 2957 2950 2958 2951 # go through the fittables 2959 2952 strings = self._get_copy_helper(self.fittable_param, 2960 self.orientation_params_disp)2953 self.orientation_params_disp) 2961 2954 content += strings 2962 2955 2963 2956 # go through the fixed params 2964 2957 strings = self._get_copy_helper(self.fixed_param, 2965 self.orientation_params_disp)2958 self.orientation_params_disp) 2966 2959 content += strings 2967 2960 2968 2961 # go through the str params 2969 2962 strings = self._get_copy_helper(self.str_parameters, 2970 self.orientation_params)2963 self.orientation_params) 2971 2964 content += strings 2972 2965 return content … … 3027 3020 Get the string copies of the param names and values in the tap 3028 3021 """ 3029 content = '\\begin{table}'3030 content += '\\begin{tabular}[h]'3022 content = r'\begin{table}' 3023 content += r'\begin{tabular}[h]' 3031 3024 3032 3025 crlf = chr(13) + chr(10) … … 3039 3032 for param in self.parameters: 3040 3033 content += 'l|l|' 3041 content += '}\hline'3034 content += r'}\hline' 3042 3035 content += crlf 3043 3036 3044 3037 for index, param in enumerate(self.parameters): 3045 content += param[1].replace('_', '\_') # parameter name3038 content += param[1].replace('_', r'\_') # parameter name 3046 3039 content += ' & ' 3047 content += param[1].replace('_', '\_') + "\_err"3040 content += param[1].replace('_', r'\_') + r'\_err' 3048 3041 if index < len(self.parameters) - 1: 3049 3042 content += ' & ' 3050 content += '\\\\ \\hline'3043 content += r'\\ \hline' 3051 3044 content += crlf 3052 3045 … … 3058 3051 if index < len(self.parameters) - 1: 3059 3052 content += ' & ' 3060 content += '\\\\ \\hline'3053 content += r'\\ \hline' 3061 3054 content += crlf 3062 3055 3063 content += '\\end{tabular}'3064 content += '\\end{table}'3056 content += r'\end{tabular}' 3057 content += r'\end{table}' 3065 3058 return content 3066 3059 else: … … 3320 3313 if name.endswith('.npts'): 3321 3314 pd = int(pd) 3322 except :3315 except Exception: 3323 3316 # continue 3324 3317 if not pd and pd != '': … … 3406 3399 self._disp_obj_dict[name] = disp_model 3407 3400 self.model.set_dispersion(param_name, disp_model) 3408 self.state. _disp_obj_dict[name] = disp_model.type3401 self.state.disp_obj_dict[name] = disp_model.type 3409 3402 # TODO: It's not an array, why update values and weights? 3410 3403 self.model._persistency_dict[param_name] = \ … … 3512 3505 3513 3506 else: 3514 for (model, enabled)in sorted(self.master_category_dict[category],3515 3516 if (enabled):3507 for model, enabled in sorted(self.master_category_dict[category], 3508 key=lambda name: name[0]): 3509 if enabled: 3517 3510 self.model_box.Append(model) 3518 3511 … … 3755 3748 self.Bind(wx.EVT_SET_FOCUS, self._on_set_focus) 3756 3749 self.Bind(wx.EVT_KILL_FOCUS, self._silent_kill_focus 3757 if kill_focus_callback is None else kill_focus_callback)3750 if kill_focus_callback is None else kill_focus_callback) 3758 3751 self.Bind(wx.EVT_TEXT_ENTER, parent._onparamEnter 3759 if text_enter_callback is None else text_enter_callback)3752 if text_enter_callback is None else text_enter_callback) 3760 3753 if not ON_MAC: 3761 3754 self.Bind(wx.EVT_LEFT_UP, self._highlight_text 3762 if mouse_up_callback is None else mouse_up_callback)3755 if mouse_up_callback is None else mouse_up_callback) 3763 3756 3764 3757 def _on_set_focus(self, event): -
src/sas/sasgui/perspectives/fitting/fit_thread.py
r959eb01 rba8d326 29 29 worktime=0.03, 30 30 reset_flag=False): 31 CalcThread.__init__(self, 32 completefn, 33 updatefn, 34 yieldtime, 35 worktime) 31 CalcThread.__init__(self, completefn, updatefn, yieldtime, worktime) 36 32 self.handler = handler 37 33 self.fitter = fn … … 93 89 # Real code should not print, but this is an example... 94 90 #print "keyboard exception" 95 #Stop on exception during fitting. Todo: need to put 91 #Stop on exception during fitting. Todo: need to put 96 92 #some mssg and reset progress bar. 97 93 … … 100 96 if self.handler is not None: 101 97 self.handler.stop(msg=msg) 102 except: 98 except: # catch-all: show every exception which stops the thread 103 99 import traceback 104 100 if self.handler is not None: -
src/sas/sasgui/perspectives/fitting/model_thread.py
r7432acb rba8d326 1 1 """ 2 2 Calculation thread for modeling 3 3 """ 4 4 … … 28 28 worktime=0.04, 29 29 exception_handler=None, 30 30 ): 31 31 CalcThread.__init__(self, completefn, updatefn, yieldtime, worktime, 32 32 exception_handler=exception_handler) … … 57 57 if self.qmax is None: 58 58 if self.data is not None: 59 newx = math.pow(max(math.fabs(self.data.xmax), 60 math.fabs(self.data.xmin)), 2) 61 newy = math.pow(max(math.fabs(self.data.ymax), 62 math.fabs(self.data.ymin)), 2) 63 self.qmax = math.sqrt(newx + newy) 59 newx = max(math.fabs(self.data.xmax), math.fabs(self.data.xmin)) 60 newy = max(math.fabs(self.data.ymax), math.fabs(self.data.ymin)) 61 self.qmax = math.sqrt(newx**2 + newy**2) 64 62 65 63 if self.data is None: … … 68 66 69 67 # Define matrix where data will be plotted 70 radius = np.sqrt((self.data.qx_data * self.data.qx_data) + \ 71 (self.data.qy_data * self.data.qy_data)) 72 73 # For theory, qmax is based on 1d qmax 68 radius = np.sqrt(self.data.qx_data**2 + self.data.qy_data**2) 69 70 # For theory, qmax is based on 1d qmax 74 71 # so that must be mulitified by sqrt(2) to get actual max for 2d 75 72 index_model = (self.qmin <= radius) & (radius <= self.qmax) 76 index_model = index_model &self.data.mask77 index_model = index_model &np.isfinite(self.data.data)73 index_model &= self.data.mask 74 index_model &= np.isfinite(self.data.data) 78 75 79 76 if self.smearer is not None: … … 100 97 elapsed = time.time() - self.starttime 101 98 self.complete(image=output, 102 103 104 105 106 107 108 109 110 111 112 113 114 115 99 data=self.data, 100 page_id=self.page_id, 101 model=self.model, 102 state=self.state, 103 toggle_mode_on=self.toggle_mode_on, 104 elapsed=elapsed, 105 index=index_model, 106 fid=self.fid, 107 qmin=self.qmin, 108 qmax=self.qmax, 109 weight=self.weight, 110 #qstep=self.qstep, 111 update_chisqr=self.update_chisqr, 112 source=self.source) 116 113 117 114 … … 137 134 worktime=0.01, 138 135 exception_handler=None, 139 136 ): 140 137 """ 141 138 """ … … 192 189 * unsmeared_output[first_bin:last_bin+1]\ 193 190 / output[first_bin:last_bin+1] 194 unsmeared_output =unsmeared_output[index]195 unsmeared_data =unsmeared_data[index]196 unsmeared_error =unsmeared_error191 unsmeared_output = unsmeared_output[index] 192 unsmeared_data = unsmeared_data[index] 193 unsmeared_error = unsmeared_error 197 194 else: 198 195 output[index] = self.model.evalDistribution(self.data.x[index]) -
src/sas/sasgui/perspectives/fitting/models.py
r8cec26b rba8d326 68 68 try: 69 69 new_instance = model() 70 except :70 except Exception: 71 71 msg = "Plugin %s error in __init__ \n\t: %s %s\n" % (str(name), 72 72 str(sys.exc_type), … … 78 78 try: 79 79 value = new_instance.function() 80 except :80 except Exception: 81 81 msg = "Plugin %s: error writing function \n\t :%s %s\n " % \ 82 82 (str(name), str(sys.exc_type), sys.exc_info()[1]) … … 102 102 103 103 # Find paths needed 104 # TODO: remove unneeded try/except block 104 105 try: 105 106 # For source … … 108 109 else: 109 110 raise 110 except :111 except Exception: 111 112 # Check for data path next to exe/zip file. 112 113 #Look for maximum n_dir up of the current dir to find plugins dir … … 158 159 compileall.compile_dir(dir=dir, ddir=dir, force=0, 159 160 quiet=report_problem) 160 except :161 except Exception: 161 162 return sys.exc_info()[1] 162 163 return None … … 177 178 plugin_log("looking for models in: %s" % str(directory)) 178 179 # compile_file(directory) #always recompile the folder plugin 179 logger.info("plugin model dir: %s" %str(directory))180 logger.info("plugin model dir: %s", str(directory)) 180 181 181 182 plugins = {} … … 192 193 msg += "\nwhile accessing model in %r" % path 193 194 plugin_log(msg) 194 logger.warning("Failed to load plugin %r. See %s for details" 195 % (path, PLUGIN_LOG))195 logger.warning("Failed to load plugin %r. See %s for details", 196 path, PLUGIN_LOG) 196 197 197 198 return plugins … … 230 231 231 232 232 class ModelManagerBase :233 class ModelManagerBase(object): 233 234 """ 234 235 Base class for the model manager … … 265 266 if self.is_changed(): 266 267 return _find_models() 267 logger.info("plugin model : %s" %str(temp))268 logger.info("plugin model : %s", str(temp)) 268 269 return temp 269 270 … … 297 298 for name, plug in self.stored_plugins.iteritems(): 298 299 self.model_dictionary[name] = plug 299 300 300 301 self._get_multifunc_models() 301 302
Note: See TracChangeset
for help on using the changeset viewer.