Changes in / [9a5097c:ed2276f] in sasview
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
check_packages.py
r131d94b rf433e6a 2 2 Checking and reinstalling the external packages 3 3 """ 4 import os 4 from __future__ import print_function 5 5 6 import sys 6 7 … … 14 15 sys.modules['Image'] = PIL.Image 15 16 17 if sys.version_info[0] > 2: 18 print("To use the sasview GUI you must use Python 2\n") 16 19 17 20 common_required_package_list = { 18 'setuptools': {'version':'0.6c11','import_name':'setuptools','test':'__version__'},19 'pyparsing': {'version':'1.5.5','import_name':'pyparsing','test':'__version__'},20 'html5lib': {'version':'0.95','import_name':'html5lib','test':'__version__'},21 'reportlab': {'version':'2.5','import_name':'reportlab','test':'Version'},22 'h5py': {'version':'2.5','import_name':'h5py','test':'__version__'},23 'lxml': {'version':'2.3','import_name':'lxml.etree','test':'LXML_VERSION'},24 'PIL': {'version':'1.1.7','import_name':'Image','test':'VERSION'},25 'pylint': {'version':None,'import_name':'pylint','test':None},26 'periodictable': {'version':'1.3.0','import_name':'periodictable','test':'__version__'},27 'bumps': {'version':'0.7.5.9','import_name':'bumps','test':'__version__'},28 'numpy': {'version':'1.7.1','import_name':'numpy','test':'__version__'},29 'scipy': {'version':'0.18.0','import_name':'scipy','test':'__version__'},30 'wx': {'version':'2.8.12.1','import_name':'wx','test':'__version__'},31 'matplotlib': {'version':'1.1.0','import_name':'matplotlib','test':'__version__'},32 'xhtml2pdf': {'version':'3.0.33','import_name':'xhtml2pdf','test':'__version__'},33 'sphinx': {'version':'1.2.1','import_name':'sphinx','test':'__version__'},34 'unittest-xml-reporting': {'version':'1.10.0','import_name':'xmlrunner','test':'__version__'},35 'pyopencl': {'version':'2015.1','import_name':'pyopencl','test':'VERSION_TEXT'},21 'setuptools': {'version': '0.6c11', 'import_name': 'setuptools', 'test': '__version__'}, 22 'pyparsing': {'version': '1.5.5', 'import_name': 'pyparsing', 'test': '__version__'}, 23 'html5lib': {'version': '0.95', 'import_name': 'html5lib', 'test': '__version__'}, 24 'reportlab': {'version': '2.5', 'import_name': 'reportlab', 'test': 'Version'}, 25 'h5py': {'version': '2.5', 'import_name': 'h5py', 'test': '__version__'}, 26 'lxml': {'version': '2.3', 'import_name': 'lxml.etree', 'test': 'LXML_VERSION'}, 27 'PIL': {'version': '1.1.7', 'import_name': 'Image', 'test': 'VERSION'}, 28 'pylint': {'version': None, 'import_name': 'pylint', 'test': None}, 29 'periodictable': {'version': '1.3.0', 'import_name': 'periodictable', 'test': '__version__'}, 30 'bumps': {'version': '0.7.5.9', 'import_name': 'bumps', 'test': '__version__'}, 31 'numpy': {'version': '1.7.1', 'import_name': 'numpy', 'test': '__version__'}, 32 'scipy': {'version': '0.18.0', 'import_name': 'scipy', 'test': '__version__'}, 33 'wx': {'version': '2.8.12.1', 'import_name': 'wx', 'test': '__version__'}, 34 'matplotlib': {'version': '1.1.0', 'import_name': 'matplotlib', 'test': '__version__'}, 35 'xhtml2pdf': {'version': '3.0.33', 'import_name': 'xhtml2pdf', 'test': '__version__'}, 36 'sphinx': {'version': '1.2.1', 'import_name': 'sphinx', 'test': '__version__'}, 37 'unittest-xml-reporting': {'version': '1.10.0', 'import_name': 'xmlrunner', 'test': '__version__'}, 38 'pyopencl': {'version': '2015.1', 'import_name': 'pyopencl', 'test': 'VERSION_TEXT'}, 36 39 } 37 40 win_required_package_list = { 38 'comtypes': {'version':'0.6.2','import_name':'comtypes','test':'__version__'},39 'pywin': {'version':'217','import_name':'pywin','test':'__version__'},40 'py2exe': {'version':'0.6.9','import_name':'py2exe','test':'__version__'},41 'comtypes': {'version': '0.6.2', 'import_name': 'comtypes', 'test': '__version__'}, 42 'pywin': {'version': '217', 'import_name': 'pywin', 'test': '__version__'}, 43 'py2exe': {'version': '0.6.9', 'import_name': 'py2exe', 'test': '__version__'}, 41 44 } 42 45 mac_required_package_list = { 43 'py2app': {'version':None,'import_name':'py2app','test':'__version__'},46 'py2app': {'version': None, 'import_name': 'py2app', 'test': '__version__'}, 44 47 } 45 48 46 49 deprecated_package_list = { 47 'pyPdf': {'version':'1.13','import_name':'pyPdf','test':'__version__'},50 'pyPdf': {'version': '1.13', 'import_name': 'pyPdf', 'test': '__version__'}, 48 51 } 49 52 50 print "Checking Required Package Versions...."51 print 52 print "Common Packages" 53 for package_name, test_vals in common_required_package_list.iteritems():53 print("Checking Required Package Versions....\n") 54 print("Common Packages") 55 56 for package_name, test_vals in common_required_package_list.items(): 54 57 try: 55 i = __import__(test_vals['import_name'], fromlist=[''])58 i = __import__(test_vals['import_name'], fromlist=['']) 56 59 if test_vals['test'] == None: 57 print "%s Installed (Unknown version)" % package_name60 print("%s Installed (Unknown version)" % package_name) 58 61 elif package_name == 'lxml': 59 verstring = str(getattr(i, 'LXML_VERSION'))60 print "%s Version Installed: %s"% (package_name,verstring.replace(', ','.').lstrip('(').rstrip(')'))62 verstring = str(getattr(i, 'LXML_VERSION')) 63 print("%s Version Installed: %s"% (package_name, verstring.replace(', ', '.').lstrip('(').rstrip(')'))) 61 64 else: 62 print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test']))63 except :64 print '%s NOT INSTALLED'% package_name65 print("%s Version Installed: %s"% (package_name, getattr(i, test_vals['test']))) 66 except ImportError: 67 print('%s NOT INSTALLED'% package_name) 65 68 66 69 if sys.platform == 'win32': 67 print 68 print "Windows Specific Packages:"69 for package_name, test_vals in win_required_package_list.iteritems():70 print("") 71 print("Windows Specific Packages:") 72 for package_name, test_vals in win_required_package_list.items(): 70 73 try: 71 74 if package_name == "pywin": 72 75 import win32api 73 fixed_file_info = win32api.GetFileVersionInfo(win32api.__file__, '\\')74 print "%s Version Installed: %s"% (package_name,fixed_file_info['FileVersionLS'] >> 16)76 fixed_file_info = win32api.GetFileVersionInfo(win32api.__file__, '\\') 77 print("%s Version Installed: %s"% (package_name, fixed_file_info['FileVersionLS'] >> 16)) 75 78 else: 76 i = __import__(test_vals['import_name'], fromlist=[''])77 print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test']))78 except :79 print '%s NOT INSTALLED'% package_name79 i = __import__(test_vals['import_name'], fromlist=['']) 80 print("%s Version Installed: %s"% (package_name, getattr(i, test_vals['test']))) 81 except ImportError: 82 print('%s NOT INSTALLED'% package_name) 80 83 81 84 if sys.platform == 'darwin': 82 print 83 print "MacOS Specific Packages:"84 for package_name, test_vals in mac_required_package_list.iteritems():85 print("") 86 print("MacOS Specific Packages:") 87 for package_name, test_vals in mac_required_package_list.items(): 85 88 try: 86 i = __import__(test_vals['import_name'], fromlist=[''])87 print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test']))88 except :89 print '%s NOT INSTALLED'% package_name89 i = __import__(test_vals['import_name'], fromlist=['']) 90 print("%s Version Installed: %s"% (package_name, getattr(i, test_vals['test']))) 91 except ImportError: 92 print('%s NOT INSTALLED'% package_name) 90 93 91 94 92 print 93 print "Deprecated Packages"94 print "You can remove these unless you need them for other reasons!"95 for package_name, test_vals in deprecated_package_list.iteritems():95 print("") 96 print("Deprecated Packages") 97 print("You can remove these unless you need them for other reasons!") 98 for package_name, test_vals in deprecated_package_list.items(): 96 99 try: 97 i = __import__(test_vals['import_name'], fromlist=[''])100 i = __import__(test_vals['import_name'], fromlist=['']) 98 101 if package_name == 'pyPdf': 99 # pyPdf doesn't have the version number internally100 print 'pyPDF Installed (Version unknown)'102 # pyPdf doesn't have the version number internally 103 print('pyPDF Installed (Version unknown)') 101 104 else: 102 print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test']))103 except :104 print '%s NOT INSTALLED'% package_name105 print("%s Version Installed: %s"% (package_name, getattr(i, test_vals['test']))) 106 except ImportError: 107 print('%s NOT INSTALLED'% package_name) -
setup.py
r9a5097c r27109e5 315 315 'test/1d_data/*', 316 316 'test/2d_data/*', 317 'test/convertible_files/*', 318 'test/coordinate_data/*', 319 'test/image_data/*', 320 'test/media/*', 321 'test/other_files/*', 317 322 'test/save_states/*', 318 'test/ upcoming_formats/*',319 'default_categories.json']323 'test/sesans_data/*' 324 ] 320 325 packages.append("sas.sasview") 321 326 -
src/sas/sascalc/dataloader/manipulations.py
r9a5097c r9a5097c 80 80 81 81 """ 82 if data2d.data == None or data2d.x_bins == None or data2d.y_bins ==None:82 if data2d.data is None or data2d.x_bins is None or data2d.y_bins is None: 83 83 raise ValueError, "Can't convert this data: data=None..." 84 84 new_x = np.tile(data2d.x_bins, (len(data2d.y_bins), 1)) … … 92 92 if data2d.err_data == None or np.any(data2d.err_data <= 0): 93 93 new_err_data = np.sqrt(np.abs(new_data)) 94 94 95 else: 95 96 new_err_data = data2d.err_data.flatten() -
src/sas/sascalc/dataloader/readers/IgorReader.py
r9a5097c r9a5097c 13 13 ############################################################################# 14 14 import os 15 15 16 import numpy as np 16 17 import math 17 18 #import logging 19 18 20 from sas.sascalc.dataloader.data_info import Data2D 19 21 from sas.sascalc.dataloader.data_info import Detector … … 40 42 """ Read file """ 41 43 if not os.path.isfile(filename): 42 raise ValueError, \ 43 "Specified file %s is not a regular file" % filename 44 45 # Read file 46 f = open(filename, 'r') 47 buf = f.read() 48 49 # Instantiate data object 44 raise ValueError("Specified file %s is not a regular " 45 "file" % filename) 46 50 47 output = Data2D() 48 51 49 output.filename = os.path.basename(filename) 52 50 detector = Detector() 53 if len(output.detector) > 0:54 print str(output.detector[0])51 if len(output.detector): 52 print(str(output.detector[0])) 55 53 output.detector.append(detector) 56 57 # Get content 58 dataStarted = False 59 60 lines = buf.split('\n') 61 itot = 0 62 x = [] 63 y = [] 64 65 ncounts = 0 66 67 xmin = None 68 xmax = None 69 ymin = None 70 ymax = None 71 72 i_x = 0 73 i_y = -1 74 i_tot_row = 0 75 76 isInfo = False 77 isCenter = False 78 79 data_conv_q = None 80 data_conv_i = None 81 82 if has_converter == True and output.Q_unit != '1/A': 54 55 data_conv_q = data_conv_i = None 56 57 if has_converter and output.Q_unit != '1/A': 83 58 data_conv_q = Converter('1/A') 84 59 # Test it 85 60 data_conv_q(1.0, output.Q_unit) 86 61 87 if has_converter == Trueand output.I_unit != '1/cm':62 if has_converter and output.I_unit != '1/cm': 88 63 data_conv_i = Converter('1/cm') 89 64 # Test it 90 65 data_conv_i(1.0, output.I_unit) 91 66 92 67 for line in lines: 93 68 … … 120 95 output.data = np.zeros([size_x, size_y]) 121 96 output.err_data = np.zeros([size_x, size_y]) 122 123 #Read Header and 2D data 124 for line in lines: 125 # Find setup info line 126 if isInfo: 127 isInfo = False 128 line_toks = line.split() 129 # Wavelength in Angstrom 130 try: 131 wavelength = float(line_toks[1]) 132 except: 133 msg = "IgorReader: can't read this file, missing wavelength" 134 raise ValueError, msg 135 # Distance in meters 136 try: 137 distance = float(line_toks[3]) 138 except: 139 msg = "IgorReader: can't read this file, missing distance" 140 raise ValueError, msg 141 142 # Distance in meters 143 try: 144 transmission = float(line_toks[4]) 145 except: 146 msg = "IgorReader: can't read this file, " 147 msg += "missing transmission" 148 raise ValueError, msg 149 150 if line.count("LAMBDA") > 0: 151 isInfo = True 152 153 # Find center info line 154 if isCenter: 155 isCenter = False 156 line_toks = line.split() 157 158 # Center in bin number: Must substrate 1 because 159 #the index starts from 1 160 center_x = float(line_toks[0]) - 1 161 center_y = float(line_toks[1]) - 1 162 163 if line.count("BCENT") > 0: 164 isCenter = True 165 166 # Find data start 167 if line.count("***")>0: 168 dataStarted = True 169 170 # Check that we have all the info 171 if wavelength == None \ 172 or distance == None \ 173 or center_x == None \ 174 or center_y == None: 175 msg = "IgorReader:Missing information in data file" 176 raise ValueError, msg 177 178 if dataStarted == True: 179 try: 180 value = float(line) 181 except: 182 # Found a non-float entry, skip it 183 continue 184 185 # Get bin number 186 if math.fmod(itot, i_tot_row) == 0: 187 i_x = 0 188 i_y += 1 189 else: 190 i_x += 1 191 192 output.data[i_y][i_x] = value 193 ncounts += 1 194 195 # Det 640 x 640 mm 196 # Q = 4pi/lambda sin(theta/2) 197 # Bin size is 0.5 cm 198 #REmoved +1 from theta = (i_x-center_x+1)*0.5 / distance 199 # / 100.0 and 200 #REmoved +1 from theta = (i_y-center_y+1)*0.5 / 201 # distance / 100.0 202 #ToDo: Need complete check if the following 203 # covert process is consistent with fitting.py. 204 theta = (i_x - center_x) * 0.5 / distance / 100.0 205 qx = 4.0 * math.pi / wavelength * math.sin(theta/2.0) 206 207 if has_converter == True and output.Q_unit != '1/A': 208 qx = data_conv_q(qx, units=output.Q_unit) 209 210 if xmin == None or qx < xmin: 211 xmin = qx 212 if xmax == None or qx > xmax: 213 xmax = qx 214 215 theta = (i_y - center_y) * 0.5 / distance / 100.0 216 qy = 4.0 * math.pi / wavelength * math.sin(theta / 2.0) 217 218 if has_converter == True and output.Q_unit != '1/A': 219 qy = data_conv_q(qy, units=output.Q_unit) 220 221 if ymin == None or qy < ymin: 222 ymin = qy 223 if ymax == None or qy > ymax: 224 ymax = qy 225 226 if not qx in x: 227 x.append(qx) 228 if not qy in y: 229 y.append(qy) 230 231 itot += 1 232 233 97 98 data_row = 0 99 wavelength = distance = center_x = center_y = None 100 dataStarted = isInfo = isCenter = False 101 102 with open(filename, 'r') as f: 103 for line in f: 104 data_row += 1 105 # Find setup info line 106 if isInfo: 107 isInfo = False 108 line_toks = line.split() 109 # Wavelength in Angstrom 110 try: 111 wavelength = float(line_toks[1]) 112 except ValueError: 113 msg = "IgorReader: can't read this file, missing wavelength" 114 raise ValueError(msg) 115 # Distance in meters 116 try: 117 distance = float(line_toks[3]) 118 except ValueError: 119 msg = "IgorReader: can't read this file, missing distance" 120 raise ValueError(msg) 121 122 # Distance in meters 123 try: 124 transmission = float(line_toks[4]) 125 except: 126 msg = "IgorReader: can't read this file, " 127 msg += "missing transmission" 128 raise ValueError(msg) 129 130 if line.count("LAMBDA"): 131 isInfo = True 132 133 # Find center info line 134 if isCenter: 135 isCenter = False 136 line_toks = line.split() 137 138 # Center in bin number: Must subtract 1 because 139 # the index starts from 1 140 center_x = float(line_toks[0]) - 1 141 center_y = float(line_toks[1]) - 1 142 143 if line.count("BCENT"): 144 isCenter = True 145 146 # Find data start 147 if line.count("***"): 148 # now have to continue to blank line 149 dataStarted = True 150 151 # Check that we have all the info 152 if (wavelength is None 153 or distance is None 154 or center_x is None 155 or center_y is None): 156 msg = "IgorReader:Missing information in data file" 157 raise ValueError(msg) 158 159 if dataStarted: 160 if len(line.rstrip()): 161 continue 162 else: 163 break 164 165 # The data is loaded in row major order (last index changing most 166 # rapidly). However, the original data is in column major order (first 167 # index changing most rapidly). The swap to column major order is done 168 # in reader2D_converter at the end of this method. 169 data = np.loadtxt(filename, skiprows=data_row) 170 size_x = size_y = int(np.rint(np.sqrt(data.size))) 171 output.data = np.reshape(data, (size_x, size_y)) 172 output.err_data = np.zeros_like(output.data) 173 174 # Det 640 x 640 mm 175 # Q = 4 * pi/lambda * sin(theta/2) 176 # Bin size is 0.5 cm 177 # Removed +1 from theta = (i_x - center_x + 1)*0.5 / distance 178 # / 100.0 and 179 # Removed +1 from theta = (i_y - center_y + 1)*0.5 / 180 # distance / 100.0 181 # ToDo: Need complete check if the following 182 # convert process is consistent with fitting.py. 183 184 # calculate qx, qy bin centers of each pixel in the image 185 theta = (np.arange(size_x) - center_x) * 0.5 / distance / 100. 186 qx = 4 * np.pi / wavelength * np.sin(theta/2) 187 188 theta = (np.arange(size_y) - center_y) * 0.5 / distance / 100. 189 qy = 4 * np.pi / wavelength * np.sin(theta/2) 190 191 if has_converter and output.Q_unit != '1/A': 192 qx = data_conv_q(qx, units=output.Q_unit) 193 qy = data_conv_q(qx, units=output.Q_unit) 194 195 xmax = np.max(qx) 196 xmin = np.min(qx) 197 ymax = np.max(qy) 198 ymin = np.min(qy) 199 200 # calculate edge offset in q. 234 201 theta = 0.25 / distance / 100.0 235 xstep = 4.0 * math.pi / wavelength * math.sin(theta / 2.0)202 xstep = 4.0 * np.pi / wavelength * np.sin(theta / 2.0) 236 203 237 204 theta = 0.25 / distance / 100.0 238 ystep = 4.0 * math.pi/ wavelength * math.sin(theta / 2.0)205 ystep = 4.0 * np.pi/ wavelength * np.sin(theta / 2.0) 239 206 240 207 # Store all data ###################################### 241 208 # Store wavelength 242 if has_converter == Trueand output.source.wavelength_unit != 'A':209 if has_converter and output.source.wavelength_unit != 'A': 243 210 conv = Converter('A') 244 211 wavelength = conv(wavelength, units=output.source.wavelength_unit) … … 246 213 247 214 # Store distance 248 if has_converter == Trueand detector.distance_unit != 'm':215 if has_converter and detector.distance_unit != 'm': 249 216 conv = Converter('m') 250 217 distance = conv(distance, units=detector.distance_unit) … … 254 221 output.sample.transmission = transmission 255 222 256 # Store pixel size 223 # Store pixel size (mm) 257 224 pixel = 5.0 258 if has_converter == Trueand detector.pixel_size_unit != 'mm':225 if has_converter and detector.pixel_size_unit != 'mm': 259 226 conv = Converter('mm') 260 227 pixel = conv(pixel, units=detector.pixel_size_unit) … … 267 234 268 235 # Store limits of the image (2D array) 269 xmin = xmin -xstep / 2.0270 xmax = xmax +xstep / 2.0271 ymin = ymin -ystep / 2.0272 ymax = ymax +ystep / 2.0273 if has_converter == Trueand output.Q_unit != '1/A':236 xmin -= xstep / 2.0 237 xmax += xstep / 2.0 238 ymin -= ystep / 2.0 239 ymax += ystep / 2.0 240 if has_converter and output.Q_unit != '1/A': 274 241 xmin = data_conv_q(xmin, units=output.Q_unit) 275 242 xmax = data_conv_q(xmax, units=output.Q_unit) … … 282 249 283 250 # Store x and y axis bin centers 284 output.x_bins = x285 output.y_bins = y251 output.x_bins = qx.tolist() 252 output.y_bins = qy.tolist() 286 253 287 254 # Units -
src/sas/sascalc/dataloader/readers/cansas_reader.py
rc221349 r8434365 930 930 self._write_data(datainfo, entry_node) 931 931 # Transmission Spectrum Info 932 self._write_trans_spectrum(datainfo, entry_node) 932 # TODO: fix the writer to linearize all data, including T_spectrum 933 # self._write_trans_spectrum(datainfo, entry_node) 933 934 # Sample info 934 935 self._write_sample_info(datainfo, entry_node) -
src/sas/sasgui/perspectives/fitting/basepage.py
r9a5097c r9a5097c 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 r9a5097c 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 r4c5098c 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 r27109e5 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' -
test/corfunc/test/utest_corfunc.py
racefa2b r253eb6c6 8 8 from sas.sascalc.corfunc.corfunc_calculator import CorfuncCalculator 9 9 from sas.sascalc.dataloader.data_info import Data1D 10 import matplotlib.pyplot as plt 10 11 11 12 12 class TestCalculator(unittest.TestCase): … … 69 69 self.assertLess(abs(params['max']-75), 2.5) # L_p ~= 75 70 70 71 72 71 # Ensure tests are ran in correct order; 73 72 # Each test depends on the one before it -
test/sasdataloader/test/utest_abs_reader.py
r9a5097c r9a5097c 4 4 5 5 import unittest 6 7 import math 6 8 import numpy as np 7 from sas.sascalc.dataloader.loader import Loader 9 from sas.sascalc.dataloader.loader import Loader 10 from sas.sascalc.dataloader.readers.IgorReader import Reader as IgorReader 8 11 from sas.sascalc.dataloader.data_info import Data1D 9 12 … … 85 88 86 89 def setUp(self): 87 self.data = Loader().load("MAR07232_rest.ASC") 88 90 # the IgorReader should be able to read this filetype 91 # if it can't, stop here. 92 reader = IgorReader() 93 self.data = reader.read("MAR07232_rest.ASC") 94 89 95 def test_igor_checkdata(self): 90 96 """ … … 107 113 108 114 self.assertEqual(self.data.detector[0].beam_center_unit, 'mm') 109 center_x = (68.76 -1)*5.0110 center_y = (62.47 -1)*5.0115 center_x = (68.76 - 1)*5.0 116 center_y = (62.47 - 1)*5.0 111 117 self.assertEqual(self.data.detector[0].beam_center.x, center_x) 112 118 self.assertEqual(self.data.detector[0].beam_center.y, center_y) 113 119 114 120 self.assertEqual(self.data.I_unit, '1/cm') 115 self.assertEqual(self.data.data[0], 0.279783) 116 self.assertEqual(self.data.data[1], 0.28951) 117 self.assertEqual(self.data.data[2], 0.167634) 118 121 # 3 points should be suffcient to check that the data is in column 122 # major order. 123 np.testing.assert_almost_equal(self.data.data[0:3], 124 [0.279783, 0.28951, 0.167634]) 125 np.testing.assert_almost_equal(self.data.qx_data[0:3], 126 [-0.01849072, -0.01821785, -0.01794498]) 127 np.testing.assert_almost_equal(self.data.qy_data[0:3], 128 [-0.01677435, -0.01677435, -0.01677435]) 129 130 def test_generic_loader(self): 131 # the generic loader should direct the file to IgorReader as well 132 data = Loader().load("MAR07232_rest.ASC") 133 self.assertEqual(data.meta_data['loader'], "IGOR 2D") 134 135 119 136 class danse_reader(unittest.TestCase): 120 137
Note: See TracChangeset
for help on using the changeset viewer.