Changeset 6a455cd3 in sasview for src/sas/sasgui/perspectives/fitting/fitpage.py
- Timestamp:
- Jul 24, 2017 8:27:05 AM (7 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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 146c669
- Parents:
- b61bd57 (diff), bc04647 (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/fitpage.py
r7143065 r6a455cd3 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 … … 1426 1426 key = event.GetKeyCode() 1427 1427 length = len(self.data.x) 1428 indx = (n umpy.abs(self.data.x - x_data)).argmin()1428 indx = (np.abs(self.data.x - x_data)).argmin() 1429 1429 # return array.flat[idx] 1430 1430 if key == wx.WXK_PAGEUP or key == wx.WXK_NUMPAD_PAGEUP: … … 1481 1481 self.enable2D: 1482 1482 # set mask 1483 radius = n umpy.sqrt(self.data.qx_data * self.data.qx_data +1483 radius = np.sqrt(self.data.qx_data * self.data.qx_data + 1484 1484 self.data.qy_data * self.data.qy_data) 1485 1485 index_data = ((self.qmin_x <= radius) & (radius <= self.qmax_x)) 1486 1486 index_data = (index_data) & (self.data.mask) 1487 index_data = (index_data) & (n umpy.isfinite(self.data.data))1487 index_data = (index_data) & (np.isfinite(self.data.data)) 1488 1488 if len(index_data[index_data]) < 10: 1489 1489 msg = "Cannot Plot :No or too little npts in" … … 1602 1602 and data.dqx_data.any() != 0: 1603 1603 self.smear_type = "Pinhole2d" 1604 self.dq_l = format_number(n umpy.average(data.dqx_data))1605 self.dq_r = format_number(n umpy.average(data.dqy_data))1604 self.dq_l = format_number(np.average(data.dqx_data)) 1605 self.dq_r = format_number(np.average(data.dqy_data)) 1606 1606 return 1607 1607 else: 1608 1608 return 1609 1609 # check if it is pinhole smear and get min max if it is. 1610 if data.dx is not None and n umpy.any(data.dx):1610 if data.dx is not None and np.any(data.dx): 1611 1611 self.smear_type = "Pinhole" 1612 1612 self.dq_l = data.dx[0] … … 1616 1616 elif data.dxl is not None or data.dxw is not None: 1617 1617 self.smear_type = "Slit" 1618 if data.dxl is not None and n umpy.all(data.dxl, 0):1618 if data.dxl is not None and np.all(data.dxl, 0): 1619 1619 self.dq_l = data.dxl[0] 1620 if data.dxw is not None and n umpy.all(data.dxw, 0):1620 if data.dxw is not None and np.all(data.dxw, 0): 1621 1621 self.dq_r = data.dxw[0] 1622 1622 # return self.smear_type,self.dq_l,self.dq_r … … 1812 1812 if not flag: 1813 1813 self.onSmear(None) 1814 1815 def _mac_sleep(self, sec=0.2):1816 """1817 Give sleep to MAC1818 """1819 if self.is_mac:1820 time.sleep(sec)1821 1814 1822 1815 def get_view_mode(self): … … 1925 1918 self.default_mask = copy.deepcopy(self.data.mask) 1926 1919 if self.data.err_data is not None \ 1927 and n umpy.any(self.data.err_data):1920 and np.any(self.data.err_data): 1928 1921 di_flag = True 1929 1922 if self.data.dqx_data is not None \ 1930 and n umpy.any(self.data.dqx_data):1923 and np.any(self.data.dqx_data): 1931 1924 dq_flag = True 1932 1925 else: 1933 1926 self.slit_smearer.Enable(True) 1934 1927 self.pinhole_smearer.Enable(True) 1935 if self.data.dy is not None and n umpy.any(self.data.dy):1928 if self.data.dy is not None and np.any(self.data.dy): 1936 1929 di_flag = True 1937 if self.data.dx is not None and n umpy.any(self.data.dx):1930 if self.data.dx is not None and np.any(self.data.dx): 1938 1931 dq_flag = True 1939 elif self.data.dxl is not None and n umpy.any(self.data.dxl):1932 elif self.data.dxl is not None and np.any(self.data.dxl): 1940 1933 dq_flag = True 1941 1934 … … 2071 2064 if self.data.__class__.__name__ == "Data2D" or \ 2072 2065 self.enable2D: 2073 radius = n umpy.sqrt(self.data.qx_data * self.data.qx_data +2066 radius = np.sqrt(self.data.qx_data * self.data.qx_data + 2074 2067 self.data.qy_data * self.data.qy_data) 2075 2068 index_data = (self.qmin_x <= radius) & (radius <= self.qmax_x) 2076 2069 index_data = (index_data) & (self.data.mask) 2077 index_data = (index_data) & (n umpy.isfinite(self.data.data))2070 index_data = (index_data) & (np.isfinite(self.data.data)) 2078 2071 npts2fit = len(self.data.data[index_data]) 2079 2072 else: … … 2108 2101 # make sure stop button to fit button all the time 2109 2102 self._on_fit_complete() 2110 if out is None or not n umpy.isfinite(chisqr):2103 if out is None or not np.isfinite(chisqr): 2111 2104 raise ValueError, "Fit error occured..." 2112 2105 … … 2119 2112 2120 2113 # Check if chi2 is finite 2121 if chisqr is not None and n umpy.isfinite(chisqr):2114 if chisqr is not None and np.isfinite(chisqr): 2122 2115 # format chi2 2123 2116 chi2 = format_number(chisqr, True) … … 2171 2164 2172 2165 if cov[ind] is not None: 2173 if n umpy.isfinite(float(cov[ind])):2166 if np.isfinite(float(cov[ind])): 2174 2167 val_err = format_number(cov[ind], True) 2175 2168 item[4].SetForegroundColour(wx.BLACK) … … 2192 2185 self.save_current_state() 2193 2186 2194 if not self.is_mac:2195 self.Layout()2196 self.Refresh()2197 self._mac_sleep(0.1)2198 2187 # plot model ( when drawing, do not update chisqr value again) 2199 2188 self._draw_model(update_chisqr=False, source='fit') … … 2295 2284 self.smear_type = 'Pinhole2d' 2296 2285 len_data = len(data.data) 2297 data.dqx_data = n umpy.zeros(len_data)2298 data.dqy_data = n umpy.zeros(len_data)2286 data.dqx_data = np.zeros(len_data) 2287 data.dqy_data = np.zeros(len_data) 2299 2288 else: 2300 2289 self.smear_type = 'Pinhole' 2301 2290 len_data = len(data.x) 2302 data.dx = n umpy.zeros(len_data)2291 data.dx = np.zeros(len_data) 2303 2292 data.dxl = None 2304 2293 data.dxw = None … … 2473 2462 try: 2474 2463 self.dxl = float(self.smear_slit_height.GetValue()) 2475 data.dxl = self.dxl * n umpy.ones(data_len)2464 data.dxl = self.dxl * np.ones(data_len) 2476 2465 self.smear_slit_height.SetBackgroundColour(wx.WHITE) 2477 2466 except: 2478 2467 self.dxl = None 2479 data.dxl = n umpy.zeros(data_len)2468 data.dxl = np.zeros(data_len) 2480 2469 if self.smear_slit_height.GetValue().lstrip().rstrip() != "": 2481 2470 self.smear_slit_height.SetBackgroundColour("pink") … … 2486 2475 self.dxw = float(self.smear_slit_width.GetValue()) 2487 2476 self.smear_slit_width.SetBackgroundColour(wx.WHITE) 2488 data.dxw = self.dxw * n umpy.ones(data_len)2477 data.dxw = self.dxw * np.ones(data_len) 2489 2478 except: 2490 2479 self.dxw = None 2491 data.dxw = n umpy.zeros(data_len)2480 data.dxw = np.zeros(data_len) 2492 2481 if self.smear_slit_width.GetValue().lstrip().rstrip() != "": 2493 2482 self.smear_slit_width.SetBackgroundColour("pink") … … 2616 2605 if event is None: 2617 2606 output = "-" 2618 elif not n umpy.isfinite(event.output):2607 elif not np.isfinite(event.output): 2619 2608 output = "-" 2620 2609 else:
Note: See TracChangeset
for help on using the changeset viewer.