Changeset dceff6e in sasview for src/sas/sasgui/perspectives/fitting
- Timestamp:
- Aug 31, 2016 11:21:55 AM (8 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- ce94504
- Parents:
- ec30905 (diff), 4036cb0 (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. - Location:
- src/sas/sasgui/perspectives/fitting
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
rcb4ef58 ree4b3cb 12 12 import json 13 13 import logging 14 import traceback 15 14 16 from collections import defaultdict 15 17 from wx.lib.scrolledpanel import ScrolledPanel 18 19 import sasmodels.sasview_model 16 20 from sas.sasgui.guiframe.panel_base import PanelBase 17 21 from sas.sasgui.guiframe.utils import format_number, check_float, IdList … … 198 202 self.state_change = False 199 203 ## save customized array 200 self.values = []201 self.weights = []204 self.values = {} # type: Dict[str, List[float, ...]] 205 self.weights = {} # type: Dict[str, List[float, ...]] 202 206 ## retrieve saved state 203 207 self.number_saved_state = 0 … … 852 856 angles.append(angle) 853 857 weights.append(weight) 854 except :858 except Exception: 855 859 # Skip non-data lines 856 logging.error( sys.exc_info()[1])860 logging.error(traceback.format_exc()) 857 861 return numpy.array(angles), numpy.array(weights) 858 862 except: … … 1393 1397 self.model._persistency_dict[key] = \ 1394 1398 [state.values, state.weights] 1395 except :1396 logging.error( sys.exc_info()[1])1399 except Exception: 1400 logging.error(traceback.format_exc()) 1397 1401 selection = self._find_polyfunc_selection(disp_model) 1398 1402 for list in self.fittable_param: … … 1410 1414 list[5].Disable() 1411 1415 list[6].Disable() 1412 except :1413 logging.error( sys.exc_info()[1])1416 except Exception: 1417 logging.error(traceback.format_exc()) 1414 1418 # For array, disable all fixed params 1415 1419 if selection == 1: … … 1419 1423 try: 1420 1424 item[2].Disable() 1421 except :1422 logging.error( sys.exc_info()[1])1425 except Exception: 1426 logging.error(traceback.format_exc()) 1423 1427 1424 1428 # Make sure the check box updated when all checked … … 1500 1504 is_2Ddata = True 1501 1505 if self.model != None: 1502 try: 1503 is_modified = self._check_value_enter(self.fittable_param, 1504 is_modified) 1505 is_modified = self._check_value_enter(self.fixed_param, 1506 is_modified) 1507 is_modified = self._check_value_enter(self.parameters, 1508 is_modified) 1509 except: 1510 logging.error(sys.exc_info()[1]) 1506 is_modified = (self._check_value_enter(self.fittable_param) 1507 or self._check_value_enter(self.fixed_param) 1508 or self._check_value_enter(self.parameters)) 1511 1509 1512 1510 # Here we should check whether the boundaries have been modified. … … 1557 1555 flag = True 1558 1556 self.fitrange = True 1559 is_modified = False1560 1557 1561 1558 #wx.PostEvent(self._manager.parent, StatusEvent(status=" \ … … 1570 1567 [self.data]) 1571 1568 ##Check the values 1572 self._check_value_enter(self.fittable_param , is_modified)1573 self._check_value_enter(self.fixed_param , is_modified)1574 self._check_value_enter(self.parameters , is_modified)1569 self._check_value_enter(self.fittable_param) 1570 self._check_value_enter(self.fixed_param) 1571 self._check_value_enter(self.parameters) 1575 1572 1576 1573 # If qmin and qmax have been modified, update qmin and qmax and … … 1651 1648 try: 1652 1649 self.save_current_state() 1653 except :1654 logging.error( sys.exc_info()[1])1650 except Exception: 1651 logging.error(traceback.format_exc()) 1655 1652 1656 1653 return flag 1657 1658 def _is_modified(self, is_modified):1659 """1660 return to self._is_modified1661 """1662 return is_modified1663 1654 1664 1655 def _reset_parameters_state(self, listtorestore, statelist): … … 1895 1886 if mod_cat == custom_model: 1896 1887 for model in self.model_list_box[mod_cat]: 1897 if 'sasmodels.sasview_model.' in str(model): 1898 str_m = model.id 1899 else: 1900 str_m = str(model).split(".")[0] 1901 #self.model_box.Append(str_m) 1888 str_m = model.id if hasattr(model, 'id') else model.name 1902 1889 m_list.append(self.model_dict[str_m]) 1903 1890 else: … … 1910 1897 # wx.PostEvent(self.parent.parent, 1911 1898 # StatusEvent(status=msg, info="error")) 1912 except :1913 msg = "%s\n" % (sys.exc_info()[1])1899 except Exception: 1900 msg = traceback.format_exc() 1914 1901 wx.PostEvent(self._manager.parent, 1915 1902 StatusEvent(status=msg, info="error")) … … 1964 1951 wx.PostEvent(self.parent, StatusEvent(status=msg)) 1965 1952 # Flag to register when a parameter has changed. 1966 #is_modified = False1967 1953 if tcrtl.GetValue().lstrip().rstrip() != "": 1968 1954 try: … … 1994 1980 if temp_npts != self.num_points: 1995 1981 self.num_points = temp_npts 1996 #is_modified = True1997 1982 else: 1998 1983 msg = "Cannot plot: No points in Q range!!! " … … 2146 2131 self.temp_multi_functional = True 2147 2132 elif form_factor != None: 2148 self.model = form_factor(self.multi_factor) 2133 if self.multi_factor is not None: 2134 self.model = form_factor(self.multi_factor) 2135 else: 2136 # old style plugin models do not accept a multiplicity argument 2137 self.model = form_factor() 2149 2138 else: 2150 2139 self.model = None … … 2165 2154 self.on_set_focus(None) 2166 2155 self.Layout() 2156 2167 2157 2168 2158 def _validate_qrange(self, qmin_ctrl, qmax_ctrl): … … 2272 2262 return flag 2273 2263 2274 def _check_value_enter(self, list , modified):2264 def _check_value_enter(self, list): 2275 2265 """ 2276 2266 :param list: model parameter and panel info … … 2282 2272 parameter's maximum value , 2283 2273 parameter's units] 2284 """ 2285 is_modified = modified2286 if len(list) == 0:2287 return is_modified2274 2275 Returns True if the model parameters have changed. 2276 """ 2277 is_modified = False 2288 2278 for item in list: 2289 2279 #skip angle parameters for 1D 2290 if not self.enable2D: 2291 if item in self.orientation_params: 2292 continue 2293 #try: 2280 if not self.enable2D and item in self.orientation_params: 2281 continue 2282 2294 2283 name = str(item[1]) 2295 2296 if string.find(name, ".npts") == -1 and \ 2297 string.find(name, ".nsigmas") == -1: 2298 ## check model parameters range 2299 param_min = None 2300 param_max = None 2301 2302 ## check minimun value 2303 if item[5] != None and item[5] != "": 2304 if item[5].GetValue().lstrip().rstrip() != "": 2305 try: 2306 param_min = float(item[5].GetValue()) 2307 if not self._validate_qrange(item[5], item[2]): 2308 if numpy.isfinite(param_min): 2309 item[2].SetValue(format_number(param_min)) 2310 2311 item[5].SetBackgroundColour(wx.WHITE) 2312 item[2].SetBackgroundColour(wx.WHITE) 2313 2314 except: 2315 msg = "Wrong fit parameter range entered" 2316 wx.PostEvent(self._manager.parent, 2317 StatusEvent(status=msg)) 2318 raise ValueError, msg 2319 is_modified = True 2320 ## check maximum value 2321 if item[6] != None and item[6] != "": 2322 if item[6].GetValue().lstrip().rstrip() != "": 2323 try: 2324 param_max = float(item[6].GetValue()) 2325 if not self._validate_qrange(item[2], item[6]): 2326 if numpy.isfinite(param_max): 2327 item[2].SetValue(format_number(param_max)) 2328 2329 item[6].SetBackgroundColour(wx.WHITE) 2330 item[2].SetBackgroundColour(wx.WHITE) 2331 except: 2332 msg = "Wrong Fit parameter range entered " 2333 wx.PostEvent(self._manager.parent, 2334 StatusEvent(status=msg)) 2335 raise ValueError, msg 2336 is_modified = True 2337 2338 if param_min != None and param_max != None: 2339 if not self._validate_qrange(item[5], item[6]): 2340 msg = "Wrong Fit range entered for parameter " 2341 msg += "name %s of model %s " % (name, self.model.name) 2342 wx.PostEvent(self._manager.parent, 2343 StatusEvent(status=msg)) 2344 2345 if name in self.model.details.keys(): 2346 self.model.details[name][1:3] = param_min, param_max 2347 is_modified = True 2348 else: 2349 self.model.details[name] = ["", param_min, param_max] 2350 is_modified = True 2351 try: 2352 # Check if the textctr is enabled 2353 if item[2].IsEnabled(): 2354 value = float(item[2].GetValue()) 2355 item[2].SetBackgroundColour("white") 2356 # If the value of the parameter has changed, 2357 # +update the model and set the is_modified flag 2358 if value != self.model.getParam(name) and \ 2359 numpy.isfinite(value): 2360 self.model.setParam(name, value) 2361 except: 2362 item[2].SetBackgroundColour("pink") 2363 msg = "Wrong Fit parameter value entered " 2364 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2284 if name.endswith(".npts") or name.endswith(".nsigmas"): 2285 continue 2286 2287 # Check that min, max and value are floats 2288 value_ctrl, min_ctrl, max_ctrl = item[2], item[5], item[6] 2289 min_str = min_ctrl.GetValue().strip() 2290 max_str = max_ctrl.GetValue().strip() 2291 value_str = value_ctrl.GetValue().strip() 2292 validity = check_float(value_ctrl) 2293 if min_str != "": 2294 validity = validity and check_float(min_ctrl) 2295 if max_str != "": 2296 validity = validity and check_float(max_ctrl) 2297 if not validity: 2298 continue 2299 2300 # Check that min is less than max 2301 low = -numpy.inf if min_str == "" else float(min_str) 2302 high = numpy.inf if max_str == "" else float(max_str) 2303 if high < low: 2304 min_ctrl.SetBackgroundColour("pink") 2305 min_ctrl.Refresh() 2306 max_ctrl.SetBackgroundColour("pink") 2307 max_ctrl.Refresh() 2308 #msg = "Invalid fit range for %s: min must be smaller than max"%name 2309 #wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2310 continue 2311 2312 # Force value between min and max 2313 value = float(value_str) 2314 if value < low: 2315 value = low 2316 value_ctrl.SetValue(format_number(value)) 2317 elif value > high: 2318 value = high 2319 value_ctrl.SetValue(format_number(value)) 2320 2321 # Update value in model if it has changed 2322 if value != self.model.getParam(name): 2323 self.model.setParam(name, value) 2324 is_modified = True 2325 2326 if name not in self.model.details.keys(): 2327 self.model.details[name] = ["", None, None] 2328 old_low, old_high = self.model.details[name][1:3] 2329 if old_low != low or old_high != high: 2330 # The configuration has changed but it won't change the 2331 # computed curve so no need to set is_modified to True 2332 #is_modified = True 2333 self.model.details[name][1:3] = low, high 2365 2334 2366 2335 return is_modified … … 2474 2443 try: 2475 2444 self.model.set_dispersion(p, disp_model) 2476 except :2477 logging.error( sys.exc_info()[1])2445 except Exception: 2446 logging.error(traceback.format_exc()) 2478 2447 2479 2448 ## save state into … … 2588 2557 self._draw_model() 2589 2558 self.Refresh() 2590 except: 2559 except Exception: 2560 logging.error(traceback.format_exc()) 2591 2561 # Error msg 2592 2562 msg = "Error occurred:" … … 2680 2650 # Try to delete values and weight of the names array dic if exists 2681 2651 try: 2682 del self.values[name] 2683 del self.weights[name] 2684 # delete all other dic 2685 del self.state.values[name] 2686 del self.state.weights[name] 2687 del self.model._persistency_dict[name.split('.')[0]] 2688 del self.state.model._persistency_dict[name.split('.')[0]] 2689 except: 2690 logging.error(sys.exc_info()[1]) 2652 if name in self.values: 2653 del self.values[name] 2654 del self.weights[name] 2655 # delete all other dic 2656 del self.state.values[name] 2657 del self.state.weights[name] 2658 del self.model._persistency_dict[name.split('.')[0]] 2659 del self.state.model._persistency_dict[name.split('.')[0]] 2660 except Exception: 2661 logging.error(traceback.format_exc()) 2691 2662 2692 2663 def _lay_out(self): … … 2832 2803 graphs.append(item2.figure) 2833 2804 canvases.append(item2.canvas) 2834 except :2805 except Exception: 2835 2806 # Not for control panels 2836 logging.error( sys.exc_info()[1])2807 logging.error(traceback.format_exc()) 2837 2808 # Make sure the resduals plot goes to the last 2838 2809 if res_item != None: … … 2936 2907 """ 2937 2908 2938 _TreeLocation = "user/ sasgui/perspectives/fitting/mag_help.html"2909 _TreeLocation = "user/magnetism.html" 2939 2910 _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "", 2940 2911 "Polarized Beam/Magnetc Help") … … 3167 3138 if item[7].__class__.__name__ == 'ComboBox': 3168 3139 disfunc = str(item[7].GetValue()) 3169 except :3170 logging.error( sys.exc_info()[1])3140 except Exception: 3141 logging.error(traceback.format_exc()) 3171 3142 3172 3143 # 2D … … 3174 3145 try: 3175 3146 check = item[0].GetValue() 3176 except :3147 except Exception: 3177 3148 check = None 3178 3149 name = item[1] … … 3202 3173 for weight in self.weights[name]: 3203 3174 disfunc += ' ' + str(weight) 3204 except :3205 logging.error( sys.exc_info()[1])3175 except Exception: 3176 logging.error(traceback.format_exc()) 3206 3177 content += name + ',' + str(check) + ',' + value + disfunc + ':' 3207 3178 … … 3403 3374 weights=pd_weights) 3404 3375 is_array = True 3405 except :3406 logging.error( sys.exc_info()[1])3376 except Exception: 3377 logging.error(traceback.format_exc()) 3407 3378 if not is_array: 3408 3379 self._disp_obj_dict[name] = disp_model … … 3418 3389 self.state.weights] 3419 3390 3420 except :3421 logging.error( sys.exc_info()[1])3391 except Exception: 3392 logging.error(traceback.format_exc()) 3422 3393 print "Error in BasePage._paste_poly_help: %s" % \ 3423 3394 sys.exc_info()[1] -
src/sas/sasgui/perspectives/fitting/batchfitpage.py
rfc18690 ree4b3cb 256 256 # if self.model != None: 257 257 # ##Check the values 258 # self._check_value_enter( self.fittable_param , is_modified)259 # self._check_value_enter( self.fixed_param , is_modified)260 # self._check_value_enter( self.parameters , is_modified)258 # self._check_value_enter( self.fittable_param) 259 # self._check_value_enter( self.fixed_param) 260 # self._check_value_enter( self.parameters) 261 261 # 262 262 # # If qmin and qmax have been modified, update qmin and qmax and -
src/sas/sasgui/perspectives/fitting/fitpage.py
r934ce649 ree4b3cb 1365 1365 try: 1366 1366 tcrtl.SetBackgroundColour(wx.WHITE) 1367 self._check_value_enter(self.fittable_param , is_modified)1368 self._check_value_enter(self.parameters , is_modified)1367 self._check_value_enter(self.fittable_param) 1368 self._check_value_enter(self.parameters) 1369 1369 except: 1370 1370 tcrtl.SetBackgroundColour("pink") -
src/sas/sasgui/perspectives/fitting/fitting.py
r934ce649 r7673ecd 273 273 wx.PostEvent(self.parent, evt) 274 274 break 275 except: 275 except Exception: 276 import traceback; traceback.print_exc() 276 277 msg = 'Delete Error: \nCould not delete the file; Check if in use.' 277 278 wx.MessageBox(msg, 'Error') … … 579 580 _, theory_state = item 580 581 self.fit_panel.set_model_state(theory_state) 581 except :582 except Exception: 582 583 msg = "Fitting: cannot deal with the theory received" 583 584 evt = StatusEvent(status=msg, info="error") -
src/sas/sasgui/perspectives/fitting/media/fitting_help.rst
r20846be rb64b87c 15 15 16 16 17 Fitting Perspective18 ======= ============17 Fitting 18 ======= 19 19 20 20 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ … … 24 24 25 25 To fit some data you must first load some data, activate one or more data sets, 26 send those data sets to the fitting perspective, and select a model to fit to 27 each data set. 26 send those data sets to fitting, and select a model to fit to each data set. 28 27 29 28 Instructions on how to load and activate data are in the section :ref:`Loading_data`. … … 331 330 This mode fits one data set. 332 331 333 When data is sent to the fitting perspective it is plotted in a graph window as 334 markers. 332 When data is sent to the fitting it is plotted in a graph window as markers. 335 333 336 334 If a graph does not appear, or a graph window appears but is empty, then the data -
src/sas/sasgui/perspectives/fitting/media/pd_help.rst
r7805458 rb64b87c 105 105 106 106 The median value for the distribution will be the value given for the respective 107 size parameter in the *Fit ting Perspective*, for example, radius = 60.107 size parameter in the *FitPage*, for example, radius = 60. 108 108 109 109 The polydispersity is given by |sigma| … … 172 172 173 173 SasView only uses these array values during the computation, therefore any mean 174 value of the parameter represented by *x* present in the *Fit ting Perspective*174 value of the parameter represented by *x* present in the *FitPage* 175 175 will be ignored. 176 176 -
src/sas/sasgui/perspectives/fitting/models.py
r6afc14b rdceff6e 2 2 Utilities to manage models 3 3 """ 4 import imp4 import traceback 5 5 import os 6 6 import sys … … 8 8 # Time is needed by the log method 9 9 import time 10 import datetime 10 11 import logging 11 12 import py_compile … … 20 21 21 22 PLUGIN_DIR = 'plugin_models' 23 PLUGIN_LOG = os.path.join(os.path.expanduser("~"), '.sasview', PLUGIN_DIR, 24 "plugins.log") 22 25 23 26 def get_model_python_path(): … … 28 31 29 32 30 def log(message):33 def plugin_log(message): 31 34 """ 32 35 Log a message in a file located in the user's home directory 33 36 """ 34 dir = os.path.join(os.path.expanduser("~"), '.sasview', PLUGIN_DIR) 35 out = open(os.path.join(dir, "plugins.log"), 'a') 36 out.write("%10g: %s\n" % (time.clock(), message)) 37 out = open(PLUGIN_LOG, 'a') 38 now = time.time() 39 stamp = datetime.datetime.fromtimestamp(now).strftime('%Y-%m-%d %H:%M:%S') 40 out.write("%s: %s\n" % (stamp, message)) 37 41 out.close() 38 42 … … 51 55 if not issubclass(model, Model1DPlugin): 52 56 msg = "Plugin %s must be of type Model1DPlugin \n" % str(name) 53 log(msg)57 plugin_log(msg) 54 58 return None 55 59 if model.__name__ != "Model": 56 60 msg = "Plugin %s class name must be Model \n" % str(name) 57 log(msg)61 plugin_log(msg) 58 62 return None 59 63 try: … … 63 67 str(sys.exc_type), 64 68 sys.exc_info()[1]) 65 log(msg)69 plugin_log(msg) 66 70 return None 67 71 … … 72 76 msg = "Plugin %s: error writing function \n\t :%s %s\n " % \ 73 77 (str(name), str(sys.exc_type), sys.exc_info()[1]) 74 log(msg)78 plugin_log(msg) 75 79 return None 76 80 else: 77 81 msg = "Plugin %s needs a method called function \n" % str(name) 78 log(msg)82 plugin_log(msg) 79 83 return None 80 84 return model … … 132 136 """ 133 137 def __nonzero__(self): 134 type, value, t raceback= sys.exc_info()138 type, value, tb = sys.exc_info() 135 139 if type is not None and issubclass(type, py_compile.PyCompileError): 136 140 print "Problem with", repr(value) 137 raise type, value, t raceback141 raise type, value, tb 138 142 return 1 139 143 … … 155 159 156 160 def _findModels(dir): 161 """ 162 Find custom models 163 """ 157 164 # List of plugin objects 158 plugins = {}159 165 dir = find_plugins_dir() 160 166 # Go through files in plug-in directory 161 #always recompile the folder plugin162 167 if not os.path.isdir(dir): 163 msg = "SasView couldn't locate Model plugin folder." 164 msg += """ "%s" does not exist""" % dir 168 msg = "SasView couldn't locate Model plugin folder %r." % dir 165 169 logging.warning(msg) 166 return plugins 167 else: 168 log("looking for models in: %s" % str(dir)) 169 compile_file(dir) 170 logging.info("plugin model dir: %s" % str(dir)) 171 try: 172 list = os.listdir(dir) 173 for item in list: 174 toks = os.path.splitext(os.path.basename(item)) 175 if toks[1] == '.py' and not toks[0] == '__init__': 176 name = toks[0] 177 path = [os.path.abspath(dir)] 178 file = None 179 try: 180 (file, path, info) = imp.find_module(name, path) 181 module = imp.load_module(name, file, item, info) 182 if hasattr(module, "Model"): 183 try: 184 if _check_plugin(module.Model, name) != None: 185 plugins[name] = module.Model 186 except: 187 msg = "Error accessing Model" 188 msg += "in %s\n %s %s\n" % (name, 189 str(sys.exc_type), 190 sys.exc_info()[1]) 191 log(msg) 192 else: 193 filename = os.path.join(dir, item) 194 plugins[name] = load_custom_model(filename) 195 196 except: 197 msg = "Error accessing Model" 198 msg += " in %s\n %s %s \n" % (name, 199 str(sys.exc_type), 200 sys.exc_info()[1]) 201 log(msg) 202 finally: 203 204 if not file == None: 205 file.close() 206 except: 207 # Don't deal with bad plug-in imports. Just skip. 208 msg = "Could not import model plugin: %s" % sys.exc_info()[1] 209 log(msg) 210 170 return {} 171 172 plugin_log("looking for models in: %s" % str(dir)) 173 #compile_file(dir) #always recompile the folder plugin 174 logging.info("plugin model dir: %s" % str(dir)) 175 176 plugins = {} 177 for filename in os.listdir(dir): 178 name, ext = os.path.splitext(filename) 179 if ext == '.py' and not name == '__init__': 180 path = os.path.abspath(os.path.join(dir, filename)) 181 try: 182 model = load_custom_model(path) 183 plugins[model.name] = model 184 except Exception: 185 msg = traceback.format_exc() 186 msg += "\nwhile accessing model in %r" % path 187 plugin_log(msg) 188 logging.warning("Failed to load plugin %r. See %s for details" 189 % (path, PLUGIN_LOG)) 190 211 191 return plugins 212 192 -
src/sas/sasgui/perspectives/fitting/pagestate.py
rc10d9d6c r7673ecd 19 19 import logging 20 20 import numpy 21 import string21 import traceback 22 22 23 23 import xml.dom.minidom … … 473 473 try: 474 474 value = content[1] 475 except :476 logging.error( sys.exc_value)475 except Exception: 476 logging.error(traceback.format_exc()) 477 477 if name.count("State created"): 478 478 repo_time = "" + value … … 515 515 title = content[2] + " [" + repo_time + "]" 516 516 title_name = HEADER % title 517 except :518 logging.error( sys.exc_value)517 except Exception: 518 logging.error(traceback.format_exc()) 519 519 if name == "model name ": 520 520 try: … … 530 530 q_name = ("Q Range: " + q_range) 531 531 q_range = CENTRE % q_name 532 except :533 logging.error( sys.exc_value)532 except Exception: 533 logging.error(traceback.format_exc()) 534 534 paramval = "" 535 535 for lines in param_string.split(":"): … … 864 864 attribute = getattr(self, item[1]) 865 865 attribute[name] = com_name 866 except :867 logging.error( sys.exc_value)866 except Exception: 867 logging.error(traceback.format_exc()) 868 868 869 869 # get self.values and self.weights dic. if exists … … 880 880 val = float(line) 881 881 value_list.append(val) 882 except :882 except Exception: 883 883 # pass if line is empty (it happens) 884 logging.error( sys.exc_value)884 logging.error(traceback.format_exc()) 885 885 dic[name] = numpy.array(value_list) 886 886 setattr(self, item[1], dic) … … 1293 1293 if len(note_value) > 0: 1294 1294 data_info.notes.append(note_value) 1295 except :1295 except Exception: 1296 1296 err_mess = "cansas_reader.read: error processing entry notes\n %s" % sys.exc_value 1297 1297 self.errors.append(err_mess) … … 1315 1315 if len(detail_value) > 0: 1316 1316 data_info.sample.details.append(detail_value) 1317 except :1317 except Exception: 1318 1318 err_mess = "cansas_reader.read: error processing sample details\n %s" % sys.exc_value 1319 1319 self.errors.append(err_mess)
Note: See TracChangeset
for help on using the changeset viewer.