- Timestamp:
- Jan 15, 2018 7: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 19:41:47)
- git-committer:
- GitHub <noreply@…> (01/15/18 19:41:47)
- Location:
- src/sas
- Files:
-
- 1 deleted
- 6 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") -
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
Note: See TracChangeset
for help on using the changeset viewer.