Changes in src/sas/sasgui/perspectives/fitting/basepage.py [463e7ffc:9a5097c] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
r463e7ffc r9a5097c 5 5 import os 6 6 import wx 7 import numpy 7 import numpy as np 8 8 import time 9 9 import copy … … 34 34 from sas.sasgui.guiframe.documentation_window import DocumentationWindow 35 35 36 logger = logging.getLogger(__name__)37 36 38 37 (PageInfoEvent, EVT_PAGE_INFO) = wx.lib.newevent.NewEvent() … … 101 100 self.graph_id = None 102 101 # Q range for data set 103 self.qmin_data_set = n umpy.inf102 self.qmin_data_set = np.inf 104 103 self.qmax_data_set = None 105 104 self.npts_data_set = 0 … … 279 278 280 279 """ 281 x = n umpy.linspace(start=self.qmin_x, stop=self.qmax_x,280 x = np.linspace(start=self.qmin_x, stop=self.qmax_x, 282 281 num=self.npts_x, endpoint=True) 283 282 self.data = Data1D(x=x) … … 296 295 """ 297 296 if self.qmin_x >= 1.e-10: 298 qmin = n umpy.log10(self.qmin_x)297 qmin = np.log10(self.qmin_x) 299 298 else: 300 299 qmin = -10. 301 300 302 301 if self.qmax_x <= 1.e10: 303 qmax = n umpy.log10(self.qmax_x)302 qmax = np.log10(self.qmax_x) 304 303 else: 305 304 qmax = 10. 306 305 307 x = n umpy.logspace(start=qmin, stop=qmax,306 x = np.logspace(start=qmin, stop=qmax, 308 307 num=self.npts_x, endpoint=True, base=10.0) 309 308 self.data = Data1D(x=x) … … 342 341 qstep = self.npts_x 343 342 344 x = n umpy.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True)345 y = n umpy.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True)343 x = np.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 344 y = np.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True) 346 345 # use data info instead 347 new_x = n umpy.tile(x, (len(y), 1))348 new_y = n umpy.tile(y, (len(x), 1))346 new_x = np.tile(x, (len(y), 1)) 347 new_y = np.tile(y, (len(x), 1)) 349 348 new_y = new_y.swapaxes(0, 1) 350 349 # all data reuire now in 1d array 351 350 qx_data = new_x.flatten() 352 351 qy_data = new_y.flatten() 353 q_data = n umpy.sqrt(qx_data * qx_data + qy_data * qy_data)352 q_data = np.sqrt(qx_data * qx_data + qy_data * qy_data) 354 353 # set all True (standing for unmasked) as default 355 mask = n umpy.ones(len(qx_data), dtype=bool)354 mask = np.ones(len(qx_data), dtype=bool) 356 355 # store x and y bin centers in q space 357 356 x_bins = x … … 359 358 360 359 self.data.source = Source() 361 self.data.data = n umpy.ones(len(mask))362 self.data.err_data = n umpy.ones(len(mask))360 self.data.data = np.ones(len(mask)) 361 self.data.err_data = np.ones(len(mask)) 363 362 self.data.qx_data = qx_data 364 363 self.data.qy_data = qy_data … … 783 782 except Exception: 784 783 # Skip non-data lines 785 logg er.error(traceback.format_exc())786 return n umpy.array(angles), numpy.array(weights)784 logging.error(traceback.format_exc()) 785 return np.array(angles), np.array(weights) 787 786 except: 788 787 raise … … 1305 1304 [state.values, state.weights] 1306 1305 except Exception: 1307 logg er.error(traceback.format_exc())1306 logging.error(traceback.format_exc()) 1308 1307 selection = self._find_polyfunc_selection(disp_model) 1309 1308 for list in self.fittable_param: … … 1322 1321 list[6].Disable() 1323 1322 except Exception: 1324 logg er.error(traceback.format_exc())1323 logging.error(traceback.format_exc()) 1325 1324 # For array, disable all fixed params 1326 1325 if selection == 1: … … 1331 1330 item[2].Disable() 1332 1331 except Exception: 1333 logg er.error(traceback.format_exc())1332 logging.error(traceback.format_exc()) 1334 1333 1335 1334 def _selectDlg(self): … … 1465 1464 self.Refresh() 1466 1465 1467 # logg er.info("is_modified flag set to %g",is_modified)1466 # logging.info("is_modified flag set to %g",is_modified) 1468 1467 return is_modified 1469 1468 … … 1570 1569 self.save_current_state() 1571 1570 except Exception: 1572 logg er.error(traceback.format_exc())1571 logging.error(traceback.format_exc()) 1573 1572 1574 1573 return flag, is_modified … … 2121 2120 for data in self.data_list: 2122 2121 # q value from qx and qy 2123 radius = n umpy.sqrt(data.qx_data * data.qx_data +2122 radius = np.sqrt(data.qx_data * data.qx_data + 2124 2123 data.qy_data * data.qy_data) 2125 2124 # get unmasked index … … 2127 2126 (radius <= float(self.qmax.GetValue())) 2128 2127 index_data = (index_data) & (data.mask) 2129 index_data = (index_data) & (n umpy.isfinite(data.data))2128 index_data = (index_data) & (np.isfinite(data.data)) 2130 2129 2131 2130 if len(index_data[index_data]) < 10: … … 2162 2161 index_data = (float(self.qmin.GetValue()) <= radius) & \ 2163 2162 (radius <= float(self.qmax.GetValue())) 2164 index_data = (index_data) & (n umpy.isfinite(data.y))2163 index_data = (index_data) & (np.isfinite(data.y)) 2165 2164 2166 2165 if len(index_data[index_data]) < 5: … … 2234 2233 2235 2234 # Check that min is less than max 2236 low = -n umpy.inf if min_str == "" else float(min_str)2237 high = n umpy.inf if max_str == "" else float(max_str)2235 low = -np.inf if min_str == "" else float(min_str) 2236 high = np.inf if max_str == "" else float(max_str) 2238 2237 if high < low: 2239 2238 min_ctrl.SetBackgroundColour("pink") … … 2385 2384 self.model.set_dispersion(p, disp_model) 2386 2385 except Exception: 2387 logg er.error(traceback.format_exc())2386 logging.error(traceback.format_exc()) 2388 2387 2389 2388 # save state into … … 2500 2499 self.Refresh() 2501 2500 except Exception: 2502 logg er.error(traceback.format_exc())2501 logging.error(traceback.format_exc()) 2503 2502 # Error msg 2504 2503 msg = "Error occurred:" … … 2601 2600 del self.state.model._persistency_dict[name.split('.')[0]] 2602 2601 except Exception: 2603 logg er.error(traceback.format_exc())2602 logging.error(traceback.format_exc()) 2604 2603 2605 2604 def _lay_out(self): … … 2655 2654 self.qmin_x = data_min 2656 2655 self.qmax_x = math.sqrt(x * x + y * y) 2657 # self.data.mask = n umpy.ones(len(self.data.data),dtype=bool)2656 # self.data.mask = np.ones(len(self.data.data),dtype=bool) 2658 2657 # check smearing 2659 2658 if not self.disable_smearer.GetValue(): … … 2743 2742 except Exception: 2744 2743 # Not for control panels 2745 logg er.error(traceback.format_exc())2744 logging.error(traceback.format_exc()) 2746 2745 # Make sure the resduals plot goes to the last 2747 2746 if res_item is not None: … … 3076 3075 disfunc = str(item[7].GetValue()) 3077 3076 except Exception: 3078 logg er.error(traceback.format_exc())3077 logging.error(traceback.format_exc()) 3079 3078 3080 3079 # 2D … … 3119 3118 disfunc += ' ' + str(weight) 3120 3119 except Exception: 3121 logg er.error(traceback.format_exc())3120 logging.error(traceback.format_exc()) 3122 3121 content += name + ',' + str(check) + ',' + value + disfunc + ',' + \ 3123 3122 bound_lo + ',' + bound_hi + ':' … … 3367 3366 3368 3367 if value[1] == 'array': 3369 pd_vals = n umpy.array(value[2])3370 pd_weights = n umpy.array(value[3])3368 pd_vals = np.array(value[2]) 3369 pd_weights = np.array(value[3]) 3371 3370 if len(pd_vals) == 0 or len(pd_vals) != len(pd_weights): 3372 3371 msg = ("bad array distribution parameters for %s" … … 3390 3389 3391 3390 except Exception: 3392 logg er.error(traceback.format_exc())3391 logging.error(traceback.format_exc()) 3393 3392 print "Error in BasePage._paste_poly_help: %s" % \ 3394 3393 sys.exc_info()[1]
Note: See TracChangeset
for help on using the changeset viewer.