Changeset e110cb0 in sasview
- Timestamp:
- Jan 15, 2018 9:41:47 PM (7 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 0863065, c99e717
- Parents:
- 6eb02a5 (diff), 58a8f76 (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:
- Paul Kienzle <pkienzle@…> (01/15/18 21:41:47)
- git-committer:
- GitHub <noreply@…> (01/15/18 21:41:47)
- Files:
-
- 2 added
- 1 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
reee94bf r58a8f76 2812 2812 if self.model is not None: 2813 2813 name = self.formfactorbox.GetValue() 2814 _TreeLocation = 'user/models/ ' + name.lower()+'.html'2814 _TreeLocation = 'user/models/%s.html' % name 2815 2815 _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, 2816 2816 "", name + " Help") -
.gitignore
r948484f r1b605fb 29 29 default_categories.json 30 30 /setup.cfg 31 Thumbs.db 31 32 32 33 # doc build -
installers/installer_generator.py
r460d3a1 ra0f4768 9 9 import sys 10 10 import string 11 12 is_64bit = sys.maxsize > 2**32 11 13 12 14 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) … … 25 27 AppSupportURL = local_config._homepage 26 28 AppUpdatesURL = local_config._homepage 29 ArchitecturesInstallIn64BitMode = 'x64' 27 30 ChangesEnvironment = 'true' 28 31 DefaultDirName = os.path.join("{pf}" , AppName+Dev) … … 343 346 TEMPLATE += "AppSupportURL=%s\n" % str(AppSupportURL) 344 347 TEMPLATE += "AppUpdatesURL=%s \n" % str(AppUpdatesURL) 348 if is_64bit: 349 TEMPLATE += "ArchitecturesInstallIn64BitMode=%s \n" % str(ArchitecturesInstallIn64BitMode) 345 350 TEMPLATE += "ChangesEnvironment=%s \n" % str(ChangesEnvironment) 346 351 TEMPLATE += "DefaultDirName=%s\n" % str(DefaultDirName) -
installers/sasview.spec
- Property mode changed from 100755 to 100644
-
installers/version.txt
- Property mode changed from 100755 to 100644
-
src/sas/sascalc/dataloader/file_reader_base_class.py
r3053a4a ra58b5a0 7 7 import os 8 8 import sys 9 import re9 import math 10 10 import logging 11 11 from abc import abstractmethod … … 25 25 def decode(s): 26 26 return s.decode() if isinstance(s, bytes) else s 27 28 # Data 1D fields for iterative purposes 29 FIELDS_1D = ('x', 'y', 'dx', 'dy', 'dxl', 'dxw') 30 # Data 2D fields for iterative purposes 31 FIELDS_2D = ('data', 'qx_data', 'qy_data', 'q_data', 'err_data', 32 'dqx_data', 'dqy_data', 'mask') 33 27 34 28 35 class FileReader(object): … … 102 109 self.current_dataset = None 103 110 self.filepath = None 111 self.ind = None 104 112 self.output = [] 105 113 … … 159 167 # Sort data by increasing x and remove 1st point 160 168 ind = np.lexsort((data.y, data.x)) 161 data.x = np.asarray([data.x[i] for i in ind]).astype(np.float64)162 data.y = np.asarray([data.y[i] for i in ind]).astype(np.float64)169 data.x = self._reorder_1d_array(data.x, ind) 170 data.y = self._reorder_1d_array(data.y, ind) 163 171 if data.dx is not None: 164 172 if len(data.dx) == 0: 165 173 data.dx = None 166 174 continue 167 data.dx = np.asarray([data.dx[i] for i in ind]).astype(np.float64)175 data.dx = self._reorder_1d_array(data.dx, ind) 168 176 if data.dxl is not None: 169 data.dxl = np.asarray([data.dxl[i] for i in ind]).astype(np.float64)177 data.dxl = self._reorder_1d_array(data.dxl, ind) 170 178 if data.dxw is not None: 171 data.dxw = np.asarray([data.dxw[i] for i in ind]).astype(np.float64)179 data.dxw = self._reorder_1d_array(data.dxw, ind) 172 180 if data.dy is not None: 173 181 if len(data.dy) == 0: 174 182 data.dy = None 175 183 continue 176 data.dy = np.asarray([data.dy[i] for i in ind]).astype(np.float64)184 data.dy = self._reorder_1d_array(data.dy, ind) 177 185 if data.lam is not None: 178 data.lam = np.asarray([data.lam[i] for i in ind]).astype(np.float64)186 data.lam = self._reorder_1d_array(data.lam, ind) 179 187 if data.dlam is not None: 180 data.dlam = np.asarray([data.dlam[i] for i in ind]).astype(np.float64) 188 data.dlam = self._reorder_1d_array(data.dlam, ind) 189 data = self._remove_nans_in_data(data) 181 190 if len(data.x) > 0: 182 191 data.xmin = np.min(data.x) … … 184 193 data.ymin = np.min(data.y) 185 194 data.ymax = np.max(data.y) 195 196 @staticmethod 197 def _reorder_1d_array(array, ind): 198 """ 199 Reorders a 1D array based on the indices passed as ind 200 :param array: Array to be reordered 201 :param ind: Indices used to reorder array 202 :return: reordered array 203 """ 204 array = np.asarray(array, dtype=np.float64) 205 return array[ind] 206 207 @staticmethod 208 def _remove_nans_in_data(data): 209 """ 210 Remove data points where nan is loaded 211 :param data: 1D or 2D data object 212 :return: data with nan points removed 213 """ 214 if isinstance(data, Data1D): 215 fields = FIELDS_1D 216 elif isinstance(data, Data2D): 217 fields = FIELDS_2D 218 else: 219 return data 220 # Make array of good points - all others will be removed 221 good = np.isfinite(getattr(data, fields[0])) 222 for name in fields[1:]: 223 array = getattr(data, name) 224 if array is not None: 225 # Update good points only if not already changed 226 good &= np.isfinite(array) 227 if not np.all(good): 228 for name in fields: 229 array = getattr(data, name) 230 if array is not None: 231 setattr(data, name, array[good]) 232 return data 186 233 187 234 def sort_two_d_data(self): … … 214 261 dataset.x_bins = dataset.qx_data[:int(n_cols)] 215 262 dataset.data = dataset.data.flatten() 263 dataset = self._remove_nans_in_data(dataset) 216 264 if len(dataset.data) > 0: 217 265 dataset.xmin = np.min(dataset.qx_data) -
src/sas/sasgui/perspectives/fitting/fitting.py
- Property mode changed from 100755 to 100644
-
src/sas/sasview/images/dls_logo.png
- Property mode changed from 100755 to 100644
-
src/sas/sasview/images/tudelft_logo.png
- Property mode changed from 100755 to 100644
-
src/sas/sasview/test/1d_data/saxess_example.pdh
- Property mode changed from 100755 to 100644
-
test/sasdataloader/test/utest_ascii.py
rf53d684 rdb5196d 5 5 import os.path 6 6 import warnings 7 import math 7 8 warnings.simplefilter("ignore") 8 9 … … 110 111 self.assertEqual(f, None) 111 112 113 def test_nan_values(self): 114 """ 115 Test loading an ascii data file with nan values saved in x, y, or dy. 116 """ 117 f_1d = self.loader.load(find("nans_in_1d_data.dat"))[0] 118 f_2d = self.loader.load(find("nans_in_2d_data.DAT"))[0] 119 for i in range(0, len(f_1d.x) - 1): 120 self.assertFalse(math.isnan(f_1d.x[i])) 121 self.assertFalse(math.isnan(f_1d.y[i])) 122 self.assertFalse(math.isnan(f_1d.dy[i])) 123 f_2d.data = f_2d.data.flatten() 124 f_2d.qx_data = f_2d.qx_data.flatten() 125 f_2d.qy_data = f_2d.qy_data.flatten() 126 for i in range(0, len(f_2d.data) - 1): 127 self.assertFalse(math.isnan(f_2d.data[i])) 128 self.assertFalse(math.isnan(f_2d.qx_data[i])) 129 self.assertFalse(math.isnan(f_2d.qy_data[i])) 130 131 112 132 if __name__ == '__main__': 113 133 unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.