Changeset 9a5097c in sasview for src/sas/sasgui/perspectives/fitting/basepage.py
- Timestamp:
- Mar 26, 2017 11:33:16 PM (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:
- ed2276f
- Parents:
- 9146ed9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
rb301db9 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 … … 100 100 self.graph_id = None 101 101 # Q range for data set 102 self.qmin_data_set = n umpy.inf102 self.qmin_data_set = np.inf 103 103 self.qmax_data_set = None 104 104 self.npts_data_set = 0 … … 278 278 279 279 """ 280 x = n umpy.linspace(start=self.qmin_x, stop=self.qmax_x,280 x = np.linspace(start=self.qmin_x, stop=self.qmax_x, 281 281 num=self.npts_x, endpoint=True) 282 282 self.data = Data1D(x=x) … … 295 295 """ 296 296 if self.qmin_x >= 1.e-10: 297 qmin = n umpy.log10(self.qmin_x)297 qmin = np.log10(self.qmin_x) 298 298 else: 299 299 qmin = -10. 300 300 301 301 if self.qmax_x <= 1.e10: 302 qmax = n umpy.log10(self.qmax_x)302 qmax = np.log10(self.qmax_x) 303 303 else: 304 304 qmax = 10. 305 305 306 x = n umpy.logspace(start=qmin, stop=qmax,306 x = np.logspace(start=qmin, stop=qmax, 307 307 num=self.npts_x, endpoint=True, base=10.0) 308 308 self.data = Data1D(x=x) … … 341 341 qstep = self.npts_x 342 342 343 x = n umpy.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True)344 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) 345 345 # use data info instead 346 new_x = n umpy.tile(x, (len(y), 1))347 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)) 348 348 new_y = new_y.swapaxes(0, 1) 349 349 # all data reuire now in 1d array 350 350 qx_data = new_x.flatten() 351 351 qy_data = new_y.flatten() 352 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) 353 353 # set all True (standing for unmasked) as default 354 mask = n umpy.ones(len(qx_data), dtype=bool)354 mask = np.ones(len(qx_data), dtype=bool) 355 355 # store x and y bin centers in q space 356 356 x_bins = x … … 358 358 359 359 self.data.source = Source() 360 self.data.data = n umpy.ones(len(mask))361 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)) 362 362 self.data.qx_data = qx_data 363 363 self.data.qy_data = qy_data … … 783 783 # Skip non-data lines 784 784 logging.error(traceback.format_exc()) 785 return n umpy.array(angles), numpy.array(weights)785 return np.array(angles), np.array(weights) 786 786 except: 787 787 raise … … 2120 2120 for data in self.data_list: 2121 2121 # q value from qx and qy 2122 radius = n umpy.sqrt(data.qx_data * data.qx_data +2122 radius = np.sqrt(data.qx_data * data.qx_data + 2123 2123 data.qy_data * data.qy_data) 2124 2124 # get unmasked index … … 2126 2126 (radius <= float(self.qmax.GetValue())) 2127 2127 index_data = (index_data) & (data.mask) 2128 index_data = (index_data) & (n umpy.isfinite(data.data))2128 index_data = (index_data) & (np.isfinite(data.data)) 2129 2129 2130 2130 if len(index_data[index_data]) < 10: … … 2161 2161 index_data = (float(self.qmin.GetValue()) <= radius) & \ 2162 2162 (radius <= float(self.qmax.GetValue())) 2163 index_data = (index_data) & (n umpy.isfinite(data.y))2163 index_data = (index_data) & (np.isfinite(data.y)) 2164 2164 2165 2165 if len(index_data[index_data]) < 5: … … 2233 2233 2234 2234 # Check that min is less than max 2235 low = -n umpy.inf if min_str == "" else float(min_str)2236 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) 2237 2237 if high < low: 2238 2238 min_ctrl.SetBackgroundColour("pink") … … 2654 2654 self.qmin_x = data_min 2655 2655 self.qmax_x = math.sqrt(x * x + y * y) 2656 # self.data.mask = n umpy.ones(len(self.data.data),dtype=bool)2656 # self.data.mask = np.ones(len(self.data.data),dtype=bool) 2657 2657 # check smearing 2658 2658 if not self.disable_smearer.GetValue(): … … 3366 3366 3367 3367 if value[1] == 'array': 3368 pd_vals = n umpy.array(value[2])3369 pd_weights = n umpy.array(value[3])3368 pd_vals = np.array(value[2]) 3369 pd_weights = np.array(value[3]) 3370 3370 if len(pd_vals) == 0 or len(pd_vals) != len(pd_weights): 3371 3371 msg = ("bad array distribution parameters for %s"
Note: See TracChangeset
for help on using the changeset viewer.