Changeset 9a5097c in sasview for src/sas/sasgui/perspectives/fitting/fitpage.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/fitpage.py
rd85f1d8a r9a5097c 6 6 import wx 7 7 import wx.lib.newevent 8 import numpy 8 import numpy as np 9 9 import copy 10 10 import math … … 1115 1115 if item.GetValue(): 1116 1116 if button_list.index(item) == 0: 1117 flag = 0 # dy = n umpy.ones_like(dy_data)1117 flag = 0 # dy = np.ones_like(dy_data) 1118 1118 elif button_list.index(item) == 1: 1119 1119 flag = 1 # dy = dy_data 1120 1120 elif button_list.index(item) == 2: 1121 flag = 2 # dy = n umpy.sqrt(numpy.abs(data))1121 flag = 2 # dy = np.sqrt(np.abs(data)) 1122 1122 elif button_list.index(item) == 3: 1123 flag = 3 # dy = n umpy.abs(data)1123 flag = 3 # dy = np.abs(data) 1124 1124 break 1125 1125 return flag … … 1422 1422 key = event.GetKeyCode() 1423 1423 length = len(self.data.x) 1424 indx = (n umpy.abs(self.data.x - x_data)).argmin()1424 indx = (np.abs(self.data.x - x_data)).argmin() 1425 1425 # return array.flat[idx] 1426 1426 if key == wx.WXK_PAGEUP or key == wx.WXK_NUMPAD_PAGEUP: … … 1477 1477 self.enable2D: 1478 1478 # set mask 1479 radius = n umpy.sqrt(self.data.qx_data * self.data.qx_data +1479 radius = np.sqrt(self.data.qx_data * self.data.qx_data + 1480 1480 self.data.qy_data * self.data.qy_data) 1481 1481 index_data = ((self.qmin_x <= radius) & (radius <= self.qmax_x)) 1482 1482 index_data = (index_data) & (self.data.mask) 1483 index_data = (index_data) & (n umpy.isfinite(self.data.data))1483 index_data = (index_data) & (np.isfinite(self.data.data)) 1484 1484 if len(index_data[index_data]) < 10: 1485 1485 msg = "Cannot Plot :No or too little npts in" … … 1598 1598 and data.dqx_data.any() != 0: 1599 1599 self.smear_type = "Pinhole2d" 1600 self.dq_l = format_number(n umpy.average(data.dqx_data))1601 self.dq_r = format_number(n umpy.average(data.dqy_data))1600 self.dq_l = format_number(np.average(data.dqx_data)) 1601 self.dq_r = format_number(np.average(data.dqy_data)) 1602 1602 return 1603 1603 else: 1604 1604 return 1605 1605 # check if it is pinhole smear and get min max if it is. 1606 if data.dx is not None and n umpy.any(data.dx):1606 if data.dx is not None and np.any(data.dx): 1607 1607 self.smear_type = "Pinhole" 1608 1608 self.dq_l = data.dx[0] … … 1612 1612 elif data.dxl is not None or data.dxw is not None: 1613 1613 self.smear_type = "Slit" 1614 if data.dxl is not None and n umpy.all(data.dxl, 0):1614 if data.dxl is not None and np.all(data.dxl, 0): 1615 1615 self.dq_l = data.dxl[0] 1616 if data.dxw is not None and n umpy.all(data.dxw, 0):1616 if data.dxw is not None and np.all(data.dxw, 0): 1617 1617 self.dq_r = data.dxw[0] 1618 1618 # return self.smear_type,self.dq_l,self.dq_r … … 1921 1921 self.default_mask = copy.deepcopy(self.data.mask) 1922 1922 if self.data.err_data is not None \ 1923 and n umpy.any(self.data.err_data):1923 and np.any(self.data.err_data): 1924 1924 di_flag = True 1925 1925 if self.data.dqx_data is not None \ 1926 and n umpy.any(self.data.dqx_data):1926 and np.any(self.data.dqx_data): 1927 1927 dq_flag = True 1928 1928 else: 1929 1929 self.slit_smearer.Enable(True) 1930 1930 self.pinhole_smearer.Enable(True) 1931 if self.data.dy is not None and n umpy.any(self.data.dy):1931 if self.data.dy is not None and np.any(self.data.dy): 1932 1932 di_flag = True 1933 if self.data.dx is not None and n umpy.any(self.data.dx):1933 if self.data.dx is not None and np.any(self.data.dx): 1934 1934 dq_flag = True 1935 elif self.data.dxl is not None and n umpy.any(self.data.dxl):1935 elif self.data.dxl is not None and np.any(self.data.dxl): 1936 1936 dq_flag = True 1937 1937 … … 2067 2067 if self.data.__class__.__name__ == "Data2D" or \ 2068 2068 self.enable2D: 2069 radius = n umpy.sqrt(self.data.qx_data * self.data.qx_data +2069 radius = np.sqrt(self.data.qx_data * self.data.qx_data + 2070 2070 self.data.qy_data * self.data.qy_data) 2071 2071 index_data = (self.qmin_x <= radius) & (radius <= self.qmax_x) 2072 2072 index_data = (index_data) & (self.data.mask) 2073 index_data = (index_data) & (n umpy.isfinite(self.data.data))2073 index_data = (index_data) & (np.isfinite(self.data.data)) 2074 2074 npts2fit = len(self.data.data[index_data]) 2075 2075 else: … … 2104 2104 # make sure stop button to fit button all the time 2105 2105 self._on_fit_complete() 2106 if out is None or not n umpy.isfinite(chisqr):2106 if out is None or not np.isfinite(chisqr): 2107 2107 raise ValueError, "Fit error occured..." 2108 2108 … … 2115 2115 2116 2116 # Check if chi2 is finite 2117 if chisqr is not None and n umpy.isfinite(chisqr):2117 if chisqr is not None and np.isfinite(chisqr): 2118 2118 # format chi2 2119 2119 chi2 = format_number(chisqr, True) … … 2167 2167 2168 2168 if cov[ind] is not None: 2169 if n umpy.isfinite(float(cov[ind])):2169 if np.isfinite(float(cov[ind])): 2170 2170 val_err = format_number(cov[ind], True) 2171 2171 item[4].SetForegroundColour(wx.BLACK) … … 2291 2291 self.smear_type = 'Pinhole2d' 2292 2292 len_data = len(data.data) 2293 data.dqx_data = n umpy.zeros(len_data)2294 data.dqy_data = n umpy.zeros(len_data)2293 data.dqx_data = np.zeros(len_data) 2294 data.dqy_data = np.zeros(len_data) 2295 2295 else: 2296 2296 self.smear_type = 'Pinhole' 2297 2297 len_data = len(data.x) 2298 data.dx = n umpy.zeros(len_data)2298 data.dx = np.zeros(len_data) 2299 2299 data.dxl = None 2300 2300 data.dxw = None … … 2469 2469 try: 2470 2470 self.dxl = float(self.smear_slit_height.GetValue()) 2471 data.dxl = self.dxl * n umpy.ones(data_len)2471 data.dxl = self.dxl * np.ones(data_len) 2472 2472 self.smear_slit_height.SetBackgroundColour(wx.WHITE) 2473 2473 except: 2474 2474 self.dxl = None 2475 data.dxl = n umpy.zeros(data_len)2475 data.dxl = np.zeros(data_len) 2476 2476 if self.smear_slit_height.GetValue().lstrip().rstrip() != "": 2477 2477 self.smear_slit_height.SetBackgroundColour("pink") … … 2482 2482 self.dxw = float(self.smear_slit_width.GetValue()) 2483 2483 self.smear_slit_width.SetBackgroundColour(wx.WHITE) 2484 data.dxw = self.dxw * n umpy.ones(data_len)2484 data.dxw = self.dxw * np.ones(data_len) 2485 2485 except: 2486 2486 self.dxw = None 2487 data.dxw = n umpy.zeros(data_len)2487 data.dxw = np.zeros(data_len) 2488 2488 if self.smear_slit_width.GetValue().lstrip().rstrip() != "": 2489 2489 self.smear_slit_width.SetBackgroundColour("pink") … … 2612 2612 if event is None: 2613 2613 output = "-" 2614 elif not n umpy.isfinite(event.output):2614 elif not np.isfinite(event.output): 2615 2615 output = "-" 2616 2616 else:
Note: See TracChangeset
for help on using the changeset viewer.