Changeset 9c0f3c17 in sasview for src/sas/sasgui/perspectives/fitting/basepage.py
- Timestamp:
- Apr 4, 2017 12:50:04 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:
- f2940c4
- Parents:
- 463e7ffc (diff), 1779e72 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
r463e7ffc r9c0f3c17 5 5 import os 6 6 import wx 7 import numpy 7 import numpy as np 8 8 import time 9 9 import copy … … 101 101 self.graph_id = None 102 102 # Q range for data set 103 self.qmin_data_set = n umpy.inf103 self.qmin_data_set = np.inf 104 104 self.qmax_data_set = None 105 105 self.npts_data_set = 0 … … 279 279 280 280 """ 281 x = n umpy.linspace(start=self.qmin_x, stop=self.qmax_x,281 x = np.linspace(start=self.qmin_x, stop=self.qmax_x, 282 282 num=self.npts_x, endpoint=True) 283 283 self.data = Data1D(x=x) … … 296 296 """ 297 297 if self.qmin_x >= 1.e-10: 298 qmin = n umpy.log10(self.qmin_x)298 qmin = np.log10(self.qmin_x) 299 299 else: 300 300 qmin = -10. 301 301 302 302 if self.qmax_x <= 1.e10: 303 qmax = n umpy.log10(self.qmax_x)303 qmax = np.log10(self.qmax_x) 304 304 else: 305 305 qmax = 10. 306 306 307 x = n umpy.logspace(start=qmin, stop=qmax,307 x = np.logspace(start=qmin, stop=qmax, 308 308 num=self.npts_x, endpoint=True, base=10.0) 309 309 self.data = Data1D(x=x) … … 342 342 qstep = self.npts_x 343 343 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)344 x = np.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 345 y = np.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True) 346 346 # use data info instead 347 new_x = n umpy.tile(x, (len(y), 1))348 new_y = n umpy.tile(y, (len(x), 1))347 new_x = np.tile(x, (len(y), 1)) 348 new_y = np.tile(y, (len(x), 1)) 349 349 new_y = new_y.swapaxes(0, 1) 350 350 # all data reuire now in 1d array 351 351 qx_data = new_x.flatten() 352 352 qy_data = new_y.flatten() 353 q_data = n umpy.sqrt(qx_data * qx_data + qy_data * qy_data)353 q_data = np.sqrt(qx_data * qx_data + qy_data * qy_data) 354 354 # set all True (standing for unmasked) as default 355 mask = n umpy.ones(len(qx_data), dtype=bool)355 mask = np.ones(len(qx_data), dtype=bool) 356 356 # store x and y bin centers in q space 357 357 x_bins = x … … 359 359 360 360 self.data.source = Source() 361 self.data.data = n umpy.ones(len(mask))362 self.data.err_data = n umpy.ones(len(mask))361 self.data.data = np.ones(len(mask)) 362 self.data.err_data = np.ones(len(mask)) 363 363 self.data.qx_data = qx_data 364 364 self.data.qy_data = qy_data … … 784 784 # Skip non-data lines 785 785 logger.error(traceback.format_exc()) 786 return n umpy.array(angles), numpy.array(weights)786 return np.array(angles), np.array(weights) 787 787 except: 788 788 raise … … 1450 1450 self.state_change = True 1451 1451 self._draw_model() 1452 # Time delay has been introduced to prevent _handle error1453 # on Windows1454 # This part of code is executed when model is selected and1455 # it's parameters are changed (with respect to previously1456 # selected model). There are two Iq evaluations occuring one1457 # after another and therefore there may be compilation error1458 # if model is calculated for the first time.1459 # This seems to be Windows only issue - haven't tested on Linux1460 # though.The proper solution (other than time delay) requires1461 # more fundemental code refatoring1462 # Wojtek P. Nov 7, 20161463 if not ON_MAC:1464 time.sleep(0.1)1465 1452 self.Refresh() 1466 1453 … … 2121 2108 for data in self.data_list: 2122 2109 # q value from qx and qy 2123 radius = n umpy.sqrt(data.qx_data * data.qx_data +2110 radius = np.sqrt(data.qx_data * data.qx_data + 2124 2111 data.qy_data * data.qy_data) 2125 2112 # get unmasked index … … 2127 2114 (radius <= float(self.qmax.GetValue())) 2128 2115 index_data = (index_data) & (data.mask) 2129 index_data = (index_data) & (n umpy.isfinite(data.data))2116 index_data = (index_data) & (np.isfinite(data.data)) 2130 2117 2131 2118 if len(index_data[index_data]) < 10: … … 2162 2149 index_data = (float(self.qmin.GetValue()) <= radius) & \ 2163 2150 (radius <= float(self.qmax.GetValue())) 2164 index_data = (index_data) & (n umpy.isfinite(data.y))2151 index_data = (index_data) & (np.isfinite(data.y)) 2165 2152 2166 2153 if len(index_data[index_data]) < 5: … … 2234 2221 2235 2222 # 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)2223 low = -np.inf if min_str == "" else float(min_str) 2224 high = np.inf if max_str == "" else float(max_str) 2238 2225 if high < low: 2239 2226 min_ctrl.SetBackgroundColour("pink") … … 2610 2597 Layout is called after fitting. 2611 2598 """ 2612 self._sleep4sec()2613 2599 self.Layout() 2614 2600 return 2615 2616 def _sleep4sec(self):2617 """2618 sleep for 1 sec only applied on Mac2619 Note: This 1sec helps for Mac not to crash on self.2620 Layout after self._draw_model2621 """2622 if ON_MAC:2623 time.sleep(1)2624 2601 2625 2602 def _find_polyfunc_selection(self, disp_func=None): … … 2655 2632 self.qmin_x = data_min 2656 2633 self.qmax_x = math.sqrt(x * x + y * y) 2657 # self.data.mask = n umpy.ones(len(self.data.data),dtype=bool)2634 # self.data.mask = np.ones(len(self.data.data),dtype=bool) 2658 2635 # check smearing 2659 2636 if not self.disable_smearer.GetValue(): … … 3367 3344 3368 3345 if value[1] == 'array': 3369 pd_vals = n umpy.array(value[2])3370 pd_weights = n umpy.array(value[3])3346 pd_vals = np.array(value[2]) 3347 pd_weights = np.array(value[3]) 3371 3348 if len(pd_vals) == 0 or len(pd_vals) != len(pd_weights): 3372 3349 msg = ("bad array distribution parameters for %s"
Note: See TracChangeset
for help on using the changeset viewer.