Changeset fdd3ba1 in sasview


Ignore:
Timestamp:
Aug 19, 2016 7:21:28 AM (8 years ago)
Author:
lewis
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.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
c476457
Parents:
d3e1870 (diff), 4abcc93a (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.
Message:

Merge branch 'master' into file-converter

Files:
17 added
11 edited

Legend:

Unmodified
Added
Removed
  • build_tools/sasview_deploy_test.au3

    r1cecc91 r55bbe0b2  
    66; 
    77; 0 - OK 
    8 ; 1 - Download failure 
    9 ; 2 - Installer failure 
    10 ; 3 - Problems running SasView (simple fitting) 
    11 ; 4 - Uninstaller failure 
     8; 1 - Installer failure 
     9; 2 - Problems running SasView (simple fitting) 
     10; 3 - Uninstaller failure 
    1211 
    1312#include <Constants.au3> 
    1413#include <FileConstants.au3> 
    1514#include <MsgBoxConstants.au3> 
    16 #include <InetConstants.au3> 
    1715#include <WinAPIFiles.au3> 
    1816 
    19 ; Custom error handler 
    20 ;Global $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") 
    21  
    2217; Modifiable globals 
    23 if $CmdLine[0] == 0 Then 
    24    ; Expected command line with the build number as argument 
    25    Exit (-1) 
     18Global $fInstallerLocation = @TempDir & "\setupSasView.exe" 
     19if $CmdLine[0] > 0 Then 
     20   ; If argument present - use it as local download path 
     21   $fInstallerLocation = $CmdLine[1] 
    2622EndIf 
    2723 
    28 Local $lBuildNumber = $CmdLine[1] 
    29 ;Global $fInstallerLocation = "C:\util\setupSasView.exe" ; debug and testing location 
    30 Global $fInstallerLocation = @TempDir & "\setupSasView.exe" 
    31 Global $fRemoteInstallerLocation = "https://jenkins.esss.dk/sasview/job/SasView_Win7_Test/" & $lBuildNumber & "/artifact/sasview/dist/setupSasView.exe" 
    3224Global $fUninstallerLocation = "C:\Program Files (x86)\SasView\unins000.exe" 
    3325Global $lTimeout = 10          ; 10 sec timeout for waiting on windows 
     
    3729Global $installerPID = 0 
    3830 
    39  
    4031;; MAIN SCRIPT 
    41 Download() 
    4232Install() 
    4333RunSasView() 
    4434Uninstall() 
    45  
    4635Exit(0) 
    4736 
    4837;============================================================== 
    49 Func Download() 
    50    ; Download the file in the background with the selected option of 'force a reload from the remote site.' 
    51    ConsoleWrite("Downloading...." & @CRLF) 
    52    Local $iFailFlag = 1 
    53    Local $hDownload = InetGet($fRemoteInstallerLocation, $fInstallerLocation, $INET_FORCERELOAD) 
    54  
    55     ; Close the handle returned by InetGet. 
    56     InetClose($hDownload) 
    57         Assert($hDownload, $iFailFlag) 
    58         ConsoleWrite("Installer downloaded successfully to " & $fInstallerLocation & @CRLF) 
    59  
    60 EndFunc 
    6138 
    6239Func Install() 
    6340   ;;;;; APPLICATION INSTALLED ;;;;;;; 
    6441   Local $sSetupWindow = "Setup - SasView" 
    65    Local $iFailFlag = 2 
     42   Local $iFailFlag = 1 
    6643   ; Run setup 
    6744   if FileExists($fInstallerLocation) Then 
     
    7552 
    7653   ; License click through 
    77    WinActivate($sSetupWindow) ; <-- REQUIRED when connecting from another host 
     54   WinActivate($sSetupWindow) 
    7855   Local $test = WinWaitActive($sSetupWindow, "License Agreement", $lTimeout) 
    7956   ;ConsoleWrite("license agreement: " & $test) 
  • sasview/installer_generator.py

    r6a698c0 r09afe90  
    199199    msg += """Source: "dist\plugin_models\*";\tDestDir: "{userdesktop}\..\.sasview\plugin_models";\t""" 
    200200    msg += """Flags: recursesubdirs createallsubdirs\n"""  
    201     msg += """Source: "dist\compiled_models\*";\tDestDir: "{userdesktop}\..\.sasmodels\compiled_models";\t""" 
    202     msg += """Flags: recursesubdirs createallsubdirs\n""" 
    203201    msg += """Source: "dist\config\custom_config.py";\tDestDir: "{userdesktop}\..\.sasview\config";\t"""  
    204202    msg += """Flags: recursesubdirs createallsubdirs\n""" 
  • sasview/sasview.py

    r7f71637 rfdd3ba1  
    100100 
    101101from matplotlib import backend_bases 
    102 backend_bases._default_filetypes.pop('pgf', None) 
     102backend_bases.FigureCanvasBase.filetypes.pop('pgf', None) 
    103103 
    104104class SasView(): 
  • sasview/setup_exe.py

    r98d89df r09afe90  
    209209data_files += guiframe.data_files() 
    210210 
    211 # precompile sas models into the sasview build path; doesn't matter too much 
    212 # where it is so long as it is a place that will get cleaned up afterwards. 
    213 import sasmodels.core 
    214 dll_path = os.path.join(build_path, 'compiled_models') 
    215 compiled_dlls = sasmodels.core.precompile_dlls(dll_path, dtype='double') 
    216  
    217 # include the compiled models as data; coordinate the target path for the 
    218 # data with installer_generator.py 
    219 data_files.append(('compiled_models', compiled_dlls)) 
    220  
    221211import sasmodels 
    222212data_files += sasmodels.data_files() 
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    r7f71637 rfdd3ba1  
    206206        # Go through each child in the parent element 
    207207        for node in dom: 
     208            attr = node.attrib 
     209            name = attr.get("name", "") 
     210            type = attr.get("type", "") 
    208211            # Get the element name and set the current names level 
    209212            tagname = node.tag.replace(self.base_ns, "") 
     
    223226                ## Recursion step to access data within the group 
    224227                self._parse_entry(node) 
     228                if tagname == "SASsample": 
     229                    self.current_datainfo.sample.name = name 
     230                elif tagname == "beam_size": 
     231                    self.current_datainfo.source.beam_size_name = name 
     232                elif tagname == "SAScollimation": 
     233                    self.collimation.name = name 
     234                elif tagname == "aperture": 
     235                    self.aperture.name = name 
     236                    self.aperture.type = type 
    225237                self.add_intermediate() 
    226238            else: 
     
    229241                ## If this is a dataset, store the data appropriately 
    230242                if tagname == 'Run': 
     243                    self.current_datainfo.run_name[data_point] = name 
    231244                    self.current_datainfo.run.append(data_point) 
    232245                elif tagname == 'Title': 
     
    369382                    self.process.notes.append(data_point) 
    370383                elif tagname == 'term' and self.parent_class == 'SASprocess': 
    371                     self.process.term.append(data_point) 
     384                    unit = attr.get("unit", "") 
     385                    dic = {} 
     386                    dic["name"] = name 
     387                    dic["value"] = data_point 
     388                    dic["unit"] = unit 
     389                    self.process.term.append(dic) 
    372390 
    373391                ## Transmission Spectrum 
     
    531549            self.current_datainfo.collimation.append(self.collimation) 
    532550            self.collimation = Collimation() 
    533         elif self.parent_class == 'SASaperture': 
     551        elif self.parent_class == 'aperture': 
    534552            self.collimation.aperture.append(self.aperture) 
    535553            self.aperture = Aperture() 
     
    646664        err_msg = None 
    647665        default_unit = None 
    648         if 'unit' in attr and attr.get('unit') is not None and not self.ns_list.ns_optional: 
     666        if not isinstance(node_value, float): 
     667            node_value = float(node_value) 
     668        if 'unit' in attr and attr.get('unit') is not None: 
    649669            try: 
    650670                local_unit = attr['unit'] 
    651                 if not isinstance(node_value, float): 
    652                     node_value = float(node_value) 
    653671                unitname = self.ns_list.current_level.get("unit", "") 
    654672                if "SASdetector" in self.names: 
     
    907925                self.write_node(point, "I", datainfo.y[i], 
    908926                                {'unit': datainfo.y_unit}) 
    909             if datainfo.dy != None and len(datainfo.dy) > i: 
     927            if datainfo.dy is not None and len(datainfo.dy) > i: 
    910928                self.write_node(point, "Idev", datainfo.dy[i], 
    911929                                {'unit': datainfo.y_unit}) 
    912             if datainfo.dx != None and len(datainfo.dx) > i: 
     930            if datainfo.dx is not None and len(datainfo.dx) > i: 
    913931                self.write_node(point, "Qdev", datainfo.dx[i], 
    914932                                {'unit': datainfo.x_unit}) 
    915             if datainfo.dxw != None and len(datainfo.dxw) > i: 
     933            if datainfo.dxw is not None and len(datainfo.dxw) > i: 
    916934                self.write_node(point, "dQw", datainfo.dxw[i], 
    917935                                {'unit': datainfo.x_unit}) 
    918             if datainfo.dxl != None and len(datainfo.dxl) > i: 
     936            if datainfo.dxl is not None and len(datainfo.dxl) > i: 
    919937                self.write_node(point, "dQl", datainfo.dxl[i], 
    920938                                {'unit': datainfo.x_unit}) 
     
    11841202                if isinstance(term, list): 
    11851203                    value = term['value'] 
     1204                    del term['value'] 
     1205                elif isinstance(term, dict): 
     1206                    value = term.get("value") 
    11861207                    del term['value'] 
    11871208                else: 
  • test/sasdataloader/test/utest_abs_reader.py

    rb699768 r5f26aa4  
    176176         
    177177        self.assertEqual(self.data.run[0], "1234") 
    178         self.assertEqual(self.data.meta_data['loader'], "CanSAS 1D") 
    179         self.assertEqual(len(self.data.errors), 0) 
     178        self.assertEqual(self.data.meta_data['loader'], "CanSAS XML 1D") 
    180179         
    181180        # Data 
     
    198197        self.assertEqual(self.data.sample.name, "my sample") 
    199198        self.assertEqual(self.data.sample.thickness_unit, 'mm') 
    200         self.assertEqual(self.data.sample.thickness, 1.03) 
    201          
    202         self.assertEqual(self.data.sample.transmission, 0.327) 
     199        self.assertAlmostEqual(self.data.sample.thickness, 1.03) 
     200         
     201        self.assertAlmostEqual(self.data.sample.transmission, 0.327) 
    203202         
    204203        self.assertEqual(self.data.sample.temperature_unit, 'C') 
     
    233232         
    234233        self.assertEqual(self.data.source.wavelength_max_unit, "nm") 
    235         self.assertEqual(self.data.source.wavelength_max, 1.0) 
     234        self.assertAlmostEqual(self.data.source.wavelength_max, 1.0) 
    236235        self.assertEqual(self.data.source.wavelength_min_unit, "nm") 
    237         self.assertEqual(self.data.source.wavelength_min, 0.22) 
     236        self.assertAlmostEqual(self.data.source.wavelength_min, 0.22) 
    238237        self.assertEqual(self.data.source.wavelength_spread_unit, "percent") 
    239238        self.assertEqual(self.data.source.wavelength_spread, 14.3) 
     
    248247            self.assertEqual(item.size_unit,'mm') 
    249248            self.assertEqual(item.distance_unit,'mm') 
    250              
     249 
    251250            if item.size.x==50 \ 
    252251                and item.distance==11000.0 \ 
     
    294293            self.assertTrue(item.date in ['04-Sep-2007 18:35:02', 
    295294                                          '03-SEP-2006 11:42:47']) 
     295            print item.term 
    296296            for t in item.term: 
    297297                if t['name']=="ABS:DSTAND" \ 
     
    345345        self.assertEqual(self.data.filename, filename) 
    346346        # The followed should not have been loaded 
    347         self.assertEqual(self.data.sample.thickness, 0.00103) 
     347        self.assertAlmostEqual(self.data.sample.thickness, 0.00103) 
    348348        # This one should 
    349         self.assertEqual(self.data.sample.transmission, 0.327) 
    350          
    351         self.assertEqual(self.data.meta_data['loader'], "CanSAS 1D") 
     349        self.assertAlmostEqual(self.data.sample.transmission, 0.327) 
     350         
     351        self.assertEqual(self.data.meta_data['loader'], "CanSAS XML 1D") 
    352352        print self.data.errors 
    353353        self.assertEqual(len(self.data.errors), 1) 
     
    385385 
    386386if __name__ == '__main__': 
    387     unittest.main(testRunner=unittest.TextTestRunner(verbosity=2)) 
     387    unittest.main() 
  • .gitignore

    re04f87b rdf332d8  
    88# generated. 
    99# 
    10 # Feel free to add more stuff to this as and when it becomes an issue.  
     10# Feel free to add more stuff to this as and when it becomes an issue. 
    1111 
    1212.project 
     
    5050/test/sasdataloader/test/plugins.zip 
    5151/test/sasdataloader/test/test_log.txt 
     52/test/sasdataloader/test/isis_1_0_write_test.xml 
     53/test/sasdataloader/test/isis_1_1_write_test.xml 
     54/test/sasdataloader/test/write_test.xml 
    5255 
    5356# autogenerated scripts 
    5457/sasview/installer.iss 
    55  
  • docs/sphinx-docs/source/user/tools.rst

    r8f46df7 reb8da5f  
    88 
    99   Data Operations Utility <sasgui/perspectives/calculator/data_operator_help> 
    10        
     10 
    1111   Density/Volume Calculator <sasgui/perspectives/calculator/density_calculator_help> 
    12     
     12 
    1313   Generic SANS Calculator <sasgui/perspectives/calculator/sas_calculator_help> 
    14     
     14 
    1515   Image Viewer <sasgui/perspectives/calculator/image_viewer_help> 
    16     
     16 
    1717   Kiessig Thickness Calculator <sasgui/perspectives/calculator/kiessig_calculator_help> 
    18     
     18 
    1919   SLD Calculator <sasgui/perspectives/calculator/sld_calculator_help> 
    20     
     20 
    2121   Slit Size Calculator <sasgui/perspectives/calculator/slit_calculator_help> 
    22     
     22 
    2323   Q Resolution Estimator <sasgui/perspectives/calculator/resolution_calculator_help> 
    24     
     24 
    2525   Python Shell <sasgui/perspectives/calculator/python_shell_help> 
    26     
     26 
     27   File Converter <sasgui/perspectives/file_converter/file_converter_help> 
  • run.py

    r832fea2 r18e7309  
    7272    platform = '%s-%s'%(get_platform(),sys.version[:3]) 
    7373    build_path = joinpath(root, 'build','lib.'+platform) 
    74      
    75     # Notify the help menu that the Sphinx documentation is in a different  
     74 
     75    # Notify the help menu that the Sphinx documentation is in a different 
    7676    # place than it otherwise would be. 
    7777    os.environ['SASVIEW_DOC_PATH'] = joinpath(build_path, "doc") 
     
    123123    # Compiled modules need to be pulled from the build directory. 
    124124    # Some packages are not where they are needed, so load them explicitly. 
     125    import sas.sascalc.file_converter 
     126    sas.sascalc.file_converter.core = import_package('sas.sascalc.file_converter.core', 
     127                                  joinpath(build_path, 'sas', 'sascalc', 'file_converter', 'core'))                     
     128 
     129    # Compiled modules need to be pulled from the build directory. 
     130    # Some packages are not where they are needed, so load them explicitly. 
    125131    import sas.sascalc.calculator 
    126132    sas.sascalc.calculator.core = import_package('sas.sascalc.calculator.core', 
  • setup.py

    rdb74ee8 r18e7309  
    99from distutils.command.build_ext import build_ext 
    1010from distutils.core import Command 
     11import numpy 
    1112 
    1213# Manage version number ###################################### 
     
    5455        print "Removing existing build directory", SASVIEW_BUILD, "for a clean build" 
    5556        shutil.rmtree(SASVIEW_BUILD) 
    56                      
     57 
    5758# 'sys.maxsize' and 64bit: Not supported for python2.5 
    5859is_64bits = False 
    5960if sys.version_info >= (2, 6): 
    6061    is_64bits = sys.maxsize > 2**32 
    61      
     62 
    6263enable_openmp = False 
    6364 
     
    118119        c = self.compiler.compiler_type 
    119120        print "Compiling with %s (64bit=%s)" % (c, str(is_64bits)) 
    120          
     121 
    121122        # OpenMP build options 
    122123        if enable_openmp: 
     
    127128                for e in self.extensions: 
    128129                    e.extra_link_args = lopt[ c ] 
    129                      
     130 
    130131        # Platform-specific build options 
    131132        if platform_lopt.has_key(c): 
     
    205206) 
    206207 
    207      
     208 
    208209# sas.sascalc.pr 
    209210srcdir  = os.path.join("src", "sas", "sascalc", "pr", "c_extensions") 
     
    217218                              include_dirs=[], 
    218219                              ) ) 
    219          
     220 
     221# sas.sascalc.file_converter 
     222mydir = os.path.join("src", "sas", "sascalc", "file_converter", "c_ext") 
     223package_dir["sas.sascalc.file_converter.core"] = mydir 
     224package_dir["sas.sascalc.file_converter"] = os.path.join("src","sas", "sascalc", "file_converter") 
     225packages.extend(["sas.sascalc.file_converter","sas.sascalc.file_converter.core"]) 
     226ext_modules.append( Extension("sas.sascalc.file_converter.core.bsl_loader", 
     227                              sources = [os.path.join(mydir, "bsl_loader.c")], 
     228                              include_dirs=[numpy.get_include()], 
     229                              ) ) 
     230 
    220231# sas.sascalc.fit 
    221232package_dir["sas.sascalc.fit"] = os.path.join("src", "sas", "sascalc", "fit") 
     
    239250packages.extend(["sas.sasgui.perspectives", "sas.sasgui.perspectives.calculator"]) 
    240251package_data['sas.sasgui.perspectives.calculator'] = ['images/*', 'media/*'] 
    241      
     252 
    242253# Data util 
    243254package_dir["sas.sascalc.data_util"] = os.path.join("src", "sas", "sascalc", "data_util") 
     
    294305                               'test/2d_data/*', 
    295306                               'test/save_states/*', 
    296                                'test/upcoming_formats/*',  
     307                               'test/upcoming_formats/*', 
    297308                                 'default_categories.json'] 
    298309packages.append("sas.sasview") 
     
    316327    required.extend(['pillow']) 
    317328 
    318 # Set up SasView     
     329# Set up SasView 
    319330setup( 
    320331    name="sasview", 
     
    341352                'docs': BuildSphinxCommand, 
    342353                'disable_openmp': DisableOpenMPCommand} 
    343     )    
     354    ) 
  • src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py

    ra4deca6 r995f4eb  
    7676                ## Add the last data set to the list of outputs 
    7777                self.add_data_set() 
     78                ## Close the data file 
     79                self.raw_data.close() 
    7880        ## Return data set(s) 
    7981        return self.output 
     
    189191 
    190192                    ## Sample Information 
    191                     elif key == u'Title' and self.parent_class == u'SASsample': 
     193                    elif key == u'Title' and self.parent_class == u'SASsample': # CanSAS 2.0 format 
     194                        self.current_datainfo.sample.name = data_point 
     195                    elif key == u'name' and self.parent_class == u'SASsample': # NXcanSAS format 
    192196                        self.current_datainfo.sample.name = data_point 
    193197                    elif key == u'thickness' and self.parent_class == u'SASsample': 
     
    213217                    elif key == u'name' and self.parent_class == u'SASprocess': 
    214218                        self.process.name = data_point 
    215                     elif key == u'Title' and self.parent_class == u'SASprocess': 
     219                    elif key == u'Title' and self.parent_class == u'SASprocess': # CanSAS 2.0 format 
     220                        self.process.name = data_point 
     221                    elif key == u'name' and self.parent_class == u'SASprocess': # NXcanSAS format 
    216222                        self.process.name = data_point 
    217223                    elif key == u'description' and self.parent_class == u'SASprocess': 
     
    376382        self.current_datainfo = DataInfo() 
    377383 
     384 
    378385    def _initialize_new_data_set(self, parent_list = None): 
    379386        """ 
Note: See TracChangeset for help on using the changeset viewer.