Changeset ed2276f in sasview for src/sas/sasgui/perspectives/fitting
- Timestamp:
- Apr 4, 2017 12:00:18 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:
- 7b15990
- Parents:
- 9a5097c (diff), 571bf4b (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. - git-author:
- Andrew Jackson <andrew.jackson@…> (04/04/17 12:00:18)
- git-committer:
- GitHub <noreply@…> (04/04/17 12:00:18)
- Location:
- src/sas/sasgui/perspectives/fitting
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
r9a5097c red2276f 1449 1449 self.state_change = True 1450 1450 self._draw_model() 1451 # Time delay has been introduced to prevent _handle error1452 # on Windows1453 # This part of code is executed when model is selected and1454 # it's parameters are changed (with respect to previously1455 # selected model). There are two Iq evaluations occuring one1456 # after another and therefore there may be compilation error1457 # if model is calculated for the first time.1458 # This seems to be Windows only issue - haven't tested on Linux1459 # though.The proper solution (other than time delay) requires1460 # more fundemental code refatoring1461 # Wojtek P. Nov 7, 20161462 if not ON_MAC:1463 time.sleep(0.1)1464 1451 self.Refresh() 1465 1452 … … 2609 2596 Layout is called after fitting. 2610 2597 """ 2611 self._sleep4sec()2612 2598 self.Layout() 2613 2599 return 2614 2615 def _sleep4sec(self):2616 """2617 sleep for 1 sec only applied on Mac2618 Note: This 1sec helps for Mac not to crash on self.2619 Layout after self._draw_model2620 """2621 if ON_MAC:2622 time.sleep(1)2623 2600 2624 2601 def _find_polyfunc_selection(self, disp_func=None): -
src/sas/sasgui/perspectives/fitting/fitpage.py
r9a5097c red2276f 1809 1809 self.onSmear(None) 1810 1810 1811 def _mac_sleep(self, sec=0.2):1812 """1813 Give sleep to MAC1814 """1815 if self.is_mac:1816 time.sleep(sec)1817 1818 1811 def get_view_mode(self): 1819 1812 """ … … 2188 2181 self.save_current_state() 2189 2182 2190 if not self.is_mac:2191 self.Layout()2192 self.Refresh()2193 self._mac_sleep(0.1)2194 2183 # plot model ( when drawing, do not update chisqr value again) 2195 2184 self._draw_model(update_chisqr=False, source='fit') -
src/sas/sasgui/perspectives/fitting/fitting.py
r9a5097c red2276f 876 876 qmin=qmin, qmax=qmax, weight=weight) 877 877 878 def _mac_sleep(self, sec=0.2):879 """880 Give sleep to MAC881 """882 if ON_MAC:883 time.sleep(sec)884 885 878 def draw_model(self, model, page_id, data=None, smearer=None, 886 879 enable1D=True, enable2D=False, … … 1030 1023 manager=self, 1031 1024 improvement_delta=0.1) 1032 self._mac_sleep(0.2)1033 1025 1034 1026 # batch fit … … 1270 1262 :param elapsed: time spent at the fitting level 1271 1263 """ 1272 self._mac_sleep(0.2)1273 1264 uid = page_id[0] 1274 1265 if uid in self.fit_thread_list.keys(): … … 1520 1511 page_id = [] 1521 1512 ## fit more than 1 model at the same time 1522 self._mac_sleep(0.2)1523 1513 try: 1524 1514 index = 0 … … 1755 1745 data_id="Data " + data.name + " unsmeared", 1756 1746 dy=unsmeared_error) 1757 1758 if sq_model is not None and pq_model is not None: 1759 self.create_theory_1D(x, sq_model, page_id, model, data, state, 1760 data_description=model.name + " S(q)", 1761 data_id=str(page_id) + " " + data.name + " S(q)") 1762 self.create_theory_1D(x, pq_model, page_id, model, data, state, 1763 data_description=model.name + " P(q)", 1764 data_id=str(page_id) + " " + data.name + " P(q)") 1765 1747 # Comment this out until we can get P*S models with correctly populated parameters 1748 #if sq_model is not None and pq_model is not None: 1749 # self.create_theory_1D(x, sq_model, page_id, model, data, state, 1750 # data_description=model.name + " S(q)", 1751 # data_id=str(page_id) + " " + data.name + " S(q)") 1752 # self.create_theory_1D(x, pq_model, page_id, model, data, state, 1753 # data_description=model.name + " P(q)", 1754 # data_id=str(page_id) + " " + data.name + " P(q)") 1766 1755 1767 1756 current_pg = self.fit_panel.get_page_by_id(page_id) -
src/sas/sasgui/perspectives/fitting/pagestate.py
r9a5097c red2276f 819 819 820 820 attr = newdoc.createAttribute("version") 821 import sasview821 from sas import sasview 822 822 attr.nodeValue = sasview.__version__ 823 823 # attr.nodeValue = '1.0' -
src/sas/sasgui/perspectives/fitting/model_thread.py
rc1c9929 r9a5097c 4 4 5 5 import time 6 import numpy 6 import numpy as np 7 7 import math 8 8 from sas.sascalc.data_util.calcthread import CalcThread … … 68 68 69 69 # Define matrix where data will be plotted 70 radius = n umpy.sqrt((self.data.qx_data * self.data.qx_data) + \70 radius = np.sqrt((self.data.qx_data * self.data.qx_data) + \ 71 71 (self.data.qy_data * self.data.qy_data)) 72 72 … … 75 75 index_model = (self.qmin <= radius) & (radius <= self.qmax) 76 76 index_model = index_model & self.data.mask 77 index_model = index_model & n umpy.isfinite(self.data.data)77 index_model = index_model & np.isfinite(self.data.data) 78 78 79 79 if self.smearer is not None: … … 91 91 self.data.qy_data[index_model] 92 92 ]) 93 output = n umpy.zeros(len(self.data.qx_data))93 output = np.zeros(len(self.data.qx_data)) 94 94 # output default is None 95 95 # This method is to distinguish between masked … … 163 163 """ 164 164 self.starttime = time.time() 165 output = n umpy.zeros((len(self.data.x)))165 output = np.zeros((len(self.data.x))) 166 166 index = (self.qmin <= self.data.x) & (self.data.x <= self.qmax) 167 167 … … 175 175 self.qmax) 176 176 mask = self.data.x[first_bin:last_bin+1] 177 unsmeared_output = n umpy.zeros((len(self.data.x)))177 unsmeared_output = np.zeros((len(self.data.x))) 178 178 unsmeared_output[first_bin:last_bin+1] = self.model.evalDistribution(mask) 179 179 self.smearer.model = self.model … … 183 183 # Check that the arrays are compatible. If we only have a model but no data, 184 184 # the length of data.y will be zero. 185 if isinstance(self.data.y, n umpy.ndarray) and output.shape == self.data.y.shape:186 unsmeared_data = n umpy.zeros((len(self.data.x)))187 unsmeared_error = n umpy.zeros((len(self.data.x)))185 if isinstance(self.data.y, np.ndarray) and output.shape == self.data.y.shape: 186 unsmeared_data = np.zeros((len(self.data.x))) 187 unsmeared_error = np.zeros((len(self.data.x))) 188 188 unsmeared_data[first_bin:last_bin+1] = self.data.y[first_bin:last_bin+1]\ 189 189 * unsmeared_output[first_bin:last_bin+1]\ … … 209 209 210 210 if p_model is not None and s_model is not None: 211 sq_values = n umpy.zeros((len(self.data.x)))212 pq_values = n umpy.zeros((len(self.data.x)))211 sq_values = np.zeros((len(self.data.x))) 212 pq_values = np.zeros((len(self.data.x))) 213 213 sq_values[index] = s_model.evalDistribution(self.data.x[index]) 214 214 pq_values[index] = p_model.evalDistribution(self.data.x[index]) -
src/sas/sasgui/perspectives/fitting/utils.py
rd85c194 r9a5097c 2 2 Module contains functions frequently used in this package 3 3 """ 4 import numpy 4 import numpy as np 5 5 6 6 … … 19 19 data = data.y 20 20 if flag == 0: 21 weight = n umpy.ones_like(data)21 weight = np.ones_like(data) 22 22 elif flag == 1: 23 23 weight = dy_data 24 24 elif flag == 2: 25 weight = n umpy.sqrt(numpy.abs(data))25 weight = np.sqrt(np.abs(data)) 26 26 elif flag == 3: 27 weight = n umpy.abs(data)27 weight = np.abs(data) 28 28 return weight
Note: See TracChangeset
for help on using the changeset viewer.