Changeset dcd6efd in sasview for src/sas/sasgui
- Timestamp:
- Jan 2, 2019 3:57:45 PM (5 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249
- Children:
- ef74a8b, a13c41b, 462e019
- Parents:
- cb9640f (diff), d96744de (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 Butler <butlerpd@…> (01/02/19 15:57:45)
- git-committer:
- GitHub <noreply@…> (01/02/19 15:57:45)
- Location:
- src/sas/sasgui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/gui_manager.py
r47be5a1 rdcd6efd 46 46 from sas.sasgui.guiframe.CategoryManager import CategoryManager 47 47 from sas.sascalc.dataloader.loader import Loader 48 from sas.sascalc.file_converter.nxcansas_writer import NXcanSASWriter 48 49 from sas.sasgui.guiframe.proxy import Connection 49 50 … … 2407 2408 default_name = fname 2408 2409 wildcard = "Text files (*.txt)|*.txt|"\ 2409 "CanSAS 1D files(*.xml)|*.xml" 2410 path = None 2410 "CanSAS 1D files (*.xml)|*.xml|"\ 2411 "NXcanSAS files (*.h5)|*.h5|" 2412 options = [".txt", ".xml",".h5"] 2411 2413 dlg = wx.FileDialog(self, "Choose a file", 2412 2414 self._default_save_location, … … 2418 2420 # This is MAC Fix 2419 2421 ext_num = dlg.GetFilterIndex() 2420 if ext_num == 0: 2421 ext_format = '.txt' 2422 else: 2423 ext_format = '.xml' 2422 2423 ext_format = options[ext_num] 2424 2424 path = os.path.splitext(path)[0] + ext_format 2425 2425 mypath = os.path.basename(path) 2426 2427 # Instantiate a loader 2428 loader = Loader() 2429 ext_format = ".txt" 2430 if os.path.splitext(mypath)[1].lower() == ext_format: 2426 fName = os.path.splitext(path)[0] + ext_format 2427 2428 if os.path.splitext(mypath)[1].lower() == options[0]: 2431 2429 # Make sure the ext included in the file name 2432 2430 # especially on MAC 2433 fName = os.path.splitext(path)[0] + ext_format2434 2431 self._onsaveTXT(data, fName) 2435 ext_format = ".xml" 2436 if os.path.splitext(mypath)[1].lower() == ext_format: 2432 elif os.path.splitext(mypath)[1].lower() == options[1]: 2437 2433 # Make sure the ext included in the file name 2438 2434 # especially on MAC 2439 fName = os.path.splitext(path)[0] + ext_format 2435 # Instantiate a loader 2436 loader = Loader() 2440 2437 loader.save(fName, data, ext_format) 2438 elif os.path.splitext(mypath)[1].lower() == options[2]: 2439 nxcansaswriter = NXcanSASWriter() 2440 nxcansaswriter.write([data], fName) 2441 2441 try: 2442 2442 self._default_save_location = os.path.dirname(path) … … 2465 2465 if has_errors: 2466 2466 if data.dx is not None and data.dx != []: 2467 out.write("<X> <Y> <dY><dX>\n")2467 out.write("<X>\t<Y>\t<dY>\t<dX>\n") 2468 2468 else: 2469 out.write("<X> <Y><dY>\n")2469 out.write("<X>\t<Y>\t<dY>\n") 2470 2470 else: 2471 out.write("<X> 2471 out.write("<X>\t<Y>\n") 2472 2472 2473 2473 for i in range(len(data.x)): … … 2513 2513 text += 'dY_min = %s: dY_max = %s\n' % (min(data.dy), max(data.dy)) 2514 2514 text += '\nData Points:\n' 2515 x_st = "X" 2515 text += "<index> \t<X> \t<Y> \t<dY> " 2516 text += "\t<dXl> \t<dXw>\n" if(data.dxl is not None and 2517 data.dxw is not None) else "\t<dX>\n" 2516 2518 for index in range(len(data.x)): 2517 2519 if data.dy is not None and len(data.dy) > index: … … 2524 2526 dx_val = 0.0 2525 2527 if data.dxl is not None and len(data.dxl) > index: 2526 if index == 0:2527 x_st = "Xl"2528 2528 dx_val = data.dxl[index] 2529 elif data.dxw is not None and len(data.dxw) > index: 2530 if index == 0: 2531 x_st = "Xw" 2532 dx_val = data.dxw[index] 2533 2534 if index == 0: 2535 text += "<index> \t<X> \t<Y> \t<dY> \t<d%s>\n" % x_st 2529 if data.dxw is not None and len(data.dxw) > index: 2530 dx_val = "%s \t%s" % (data.dxl[index], data.dxw[index]) 2531 2536 2532 text += "%s \t%s \t%s \t%s \t%s\n" % (index, 2537 2533 data.x[index], … … 2550 2546 """ 2551 2547 default_name = fname 2552 wildcard = "IGOR/DAT 2D file in Q_map (*.dat)|*.DAT" 2548 wildcard = "IGOR/DAT 2D file in Q_map (*.dat)|*.DAT|"\ 2549 "NXcanSAS files (*.h5)|*.h5|" 2553 2550 dlg = wx.FileDialog(self, "Choose a file", 2554 2551 self._default_save_location, … … 2562 2559 if ext_num == 0: 2563 2560 ext_format = '.dat' 2561 elif ext_num == 1: 2562 ext_format = '.h5' 2564 2563 else: 2565 2564 ext_format = '' … … 2569 2568 # Instantiate a loader 2570 2569 loader = Loader() 2571 2572 ext_format = ".dat" 2573 if os.path.splitext(mypath)[1].lower() == ext_format: 2570 ext = os.path.splitext(mypath)[1].lower() 2571 if ext == '.dat': 2574 2572 # Make sure the ext included in the file name 2575 2573 # especially on MAC 2576 2574 fileName = os.path.splitext(path)[0] + ext_format 2577 2575 loader.save(fileName, data, ext_format) 2576 elif ext == '.h5': 2577 # Make sure the ext included in the file name 2578 # especially on MAC 2579 fileName = os.path.splitext(path)[0] + ext_format 2580 nxcansaswriter = NXcanSASWriter() 2581 nxcansaswriter.write([data], fileName) 2578 2582 try: 2579 2583 self._default_save_location = os.path.dirname(path) -
src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py
r9c7e2b8 r5218180 205 205 except NoKnownLoaderException as e: 206 206 exception_occurred = True 207 error_message = "Loading data failed! " + e.message207 error_message = "Loading data failed!\n" + e.message 208 208 file_errors[basename] = [error_message] 209 209 except Exception as e: … … 224 224 for message in error_array: 225 225 error_message += message + "\n" 226 error_message = error_message[:-1] 226 227 self.load_complete(output=output, 227 228 message=error_message, … … 231 232 self.load_complete(output=output, message="Loading data complete!", 232 233 info="info") 233 else:234 self.load_complete(output=None, message=error_message, info="error")235 234 236 235 def load_update(self, message="", info="warning"): -
src/sas/sasgui/perspectives/calculator/model_editor.py
r9bf40e7 r1752f38 965 965 out_f.write(' """Absolute scattering"""\n') 966 966 if "scipy." in func_str: 967 out_f.write(' import scipy ')967 out_f.write(' import scipy\n') 968 968 if "numpy." in func_str: 969 out_f.write(' import numpy ')969 out_f.write(' import numpy\n') 970 970 if "np." in func_str: 971 out_f.write(' import numpy as np ')971 out_f.write(' import numpy as np\n') 972 972 for func_line in func_str.split('\n'): 973 973 out_f.write('%s%s\n' % (' ', func_line)) -
src/sas/sasgui/perspectives/fitting/fitting.py
raba4559 ra5cffe5 776 776 :param weight: current dy data 777 777 """ 778 # If we are not dealing with a specific fit problem, then 779 # there is no point setting the weights. 780 if fid is None: 781 return 778 # Note: this is used to set the data weights for the fit based on 779 # the weight selection in the GUI. 782 780 if uid in self.page_finder.keys(): 783 781 self.page_finder[uid].set_weight(flag=flag, is2d=is2d) -
src/sas/sasgui/perspectives/fitting/gpu_options.py
r8e109f9 r895703d 23 23 import sasmodels 24 24 import sasmodels.model_test 25 import sasmodels. kernelcl25 import sasmodels.sasview_model 26 26 27 27 from sas.sasgui.guiframe.documentation_window import DocumentationWindow … … 239 239 if "SAS_OPENCL" in os.environ: 240 240 del os.environ["SAS_OPENCL"] 241 sasmodels. kernelcl.reset_environment()241 sasmodels.sasview_model.reset_environment() 242 242 event.Skip() 243 243 … … 265 265 if "SAS_OPENCL" in os.environ: 266 266 del os.environ["SAS_OPENCL"] 267 sasmodels. kernelcl.reset_environment()267 sasmodels.sasview_model.reset_environment() 268 268 269 269 try:
Note: See TracChangeset
for help on using the changeset viewer.