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