Changeset 131791e in sasview


Ignore:
Timestamp:
Apr 7, 2017 7:47:34 AM (7 years ago)
Author:
Tim Snow <tim.snow@…>
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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
503eb52
Parents:
4b402a1 (diff), 861f1880 (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 ticket-869

Files:
14 edited

Legend:

Unmodified
Added
Removed
  • setup.py

    red2276f rf3bf622  
    5353    #             os.remove(file_path) 
    5454    if os.path.exists(SASVIEW_BUILD): 
    55         print "Removing existing build directory", SASVIEW_BUILD, "for a clean build" 
     55        print("Removing existing build directory", SASVIEW_BUILD, "for a clean build") 
    5656        shutil.rmtree(SASVIEW_BUILD) 
    5757 
     
    7474                enable_openmp = False 
    7575        except: 
    76             print "PROBLEM determining Darwin version" 
     76            print("PROBLEM determining Darwin version") 
    7777 
    7878# Options to enable OpenMP 
     
    9595            platform_copt = {'unix' : ['-Wno-error=unused-command-line-argument-hard-error-in-future']} 
    9696    except: 
    97         print "PROBLEM determining Darwin version" 
     97        print("PROBLEM determining Darwin version") 
    9898 
    9999class DisableOpenMPCommand(Command): 
     
    118118        # Get 64-bitness 
    119119        c = self.compiler.compiler_type 
    120         print "Compiling with %s (64bit=%s)" % (c, str(is_64bits)) 
     120        print("Compiling with %s (64bit=%s)" % (c, str(is_64bits))) 
    121121 
    122122        # OpenMP build options 
    123123        if enable_openmp: 
    124             if copt.has_key(c): 
     124            if c in copt: 
    125125                for e in self.extensions: 
    126126                    e.extra_compile_args = copt[ c ] 
    127             if lopt.has_key(c): 
     127            if c in lopt: 
    128128                for e in self.extensions: 
    129129                    e.extra_link_args = lopt[ c ] 
    130130 
    131131        # Platform-specific build options 
    132         if platform_lopt.has_key(c): 
     132        if c in platform_lopt: 
    133133            for e in self.extensions: 
    134134                e.extra_link_args = platform_lopt[ c ] 
    135135 
    136         if platform_copt.has_key(c): 
     136        if c in platform_copt: 
    137137            for e in self.extensions: 
    138138                e.extra_compile_args = platform_copt[ c ] 
  • src/sas/sascalc/realspace/VolumeCanvas.py

    rd85c194 r6435594  
    303303        self.shapecount += 1 
    304304 
    305         #model changed, need to recalculate P(r) 
     305        # model changed, need to recalculate P(r) 
    306306        self._model_changed() 
    307307 
     
    328328            id = "shape"+str(self.shapecount) 
    329329  
    330         #shapeDesc = ShapeDescriptor(shape.lower()) 
     330        # shapeDesc = ShapeDescriptor(shape.lower()) 
    331331        if shape.lower() in shape_dict: 
    332332            shapeDesc = shape_dict[shape.lower()]() 
     
    335335            shapeDesc = PDBDescriptor(shape) 
    336336        else: 
    337             raise ValueError, "VolumeCanvas.add: Unknown shape %s" % shape 
     337            raise ValueError("VolumeCanvas.add: Unknown shape %s" % shape) 
    338338         
    339339        return self.addObject(shapeDesc, id) 
     
    345345        """ 
    346346 
    347         if self.shapes.has_key(id): 
     347        if id in self.shapes: 
    348348            del self.shapes[id] 
    349349        else: 
    350             raise KeyError, "VolumeCanvas.delete: could not find shape ID" 
    351  
    352         #model changed, need to recalculate P(r) 
     350            raise KeyError("VolumeCanvas.delete: could not find shape ID") 
     351 
     352        # model changed, need to recalculate P(r) 
    353353        self._model_changed() 
    354354 
     
    379379        # If a shape identifier was given, look the shape up 
    380380        # in the dictionary 
    381         if len(toks)>1: 
    382             if toks[0] in self.shapes.keys(): 
     381        if len(toks): 
     382            if toks[0] in self.shapes: 
    383383                # The shape was found, now look for the parameter 
    384384                if toks[1] in self.shapes[toks[0]].params: 
     
    387387                    self._model_changed() 
    388388                else: 
    389                     raise ValueError, "Could not find parameter %s" % name 
     389                    raise ValueError("Could not find parameter %s" % name) 
    390390            else: 
    391                 raise ValueError, "Could not find shape %s" % toks[0] 
     391                raise ValueError("Could not find shape %s" % toks[0]) 
    392392         
    393393        else: 
     
    410410        if len(toks) == 1: 
    411411            try: 
    412                 self.params.has_key(toks[0]) 
     412                value = self.params[toks[0]] 
    413413            except KeyError: 
    414                 raise ValueError, \ 
    415                     "VolumeCanvas.getParam: Could not find %s" % name 
    416  
    417             value = self.params[toks[0]] 
     414                raise ValueError("VolumeCanvas.getParam: Could not find" 
     415                                 " %s" % name) 
    418416            if isinstance(value, ShapeDescriptor): 
    419                 raise ValueError, \ 
    420                     "VolumeCanvas.getParam: Cannot get parameter value."  
     417                raise ValueError("VolumeCanvas.getParam: Cannot get parameter" 
     418                                 " value.") 
    421419            else: 
    422420                return value 
     
    424422        elif len(toks) == 2: 
    425423            try: 
    426                 self.shapes.has_key(toks[0]) 
     424                shapeinstance = self.shapes[toks[0]] 
    427425            except KeyError: 
    428                 raise ValueError, \ 
    429                     "VolumeCanvas.getParam: Could not find %s" % name 
    430  
    431             shapeinstance = self.shapes[toks[0]] 
    432  
    433             try: 
    434                 shapeinstance.params.has_key(toks[1]) 
    435             except KeyError: 
    436                 raise ValueError, \ 
    437                     "VolumeCanvas.getParam: Could not find %s" % name 
     426                raise ValueError("VolumeCanvas.getParam: Could not find " 
     427                                 "%s" % name) 
     428 
     429            if not toks[1] in shapeinstance.params: 
     430                raise ValueError("VolumeCanvas.getParam: Could not find " 
     431                                 "%s" % name) 
    438432 
    439433            return shapeinstance.params[toks[1]] 
    440434 
    441435        else: 
    442             raise ValueError, \ 
    443                 "VolumeCanvas.getParam: Could not find %s" % name 
    444              
    445     def getParamList(self, shapeid = None): 
     436            raise ValueError("VolumeCanvas.getParam: Could not find %s" % name) 
     437             
     438    def getParamList(self, shapeid=None): 
    446439        """ 
    447440               return a full list of all available parameters from  
     
    455448 
    456449        param_list = [] 
    457         if shapeid == None:         
    458             for key1 in self.params.keys(): 
     450        if shapeid is None: 
     451            for key1 in self.params: 
    459452                #value1 = self.params[key1] 
    460453                param_list.append(key1) 
    461             for key2 in self.shapes.keys(): 
     454            for key2 in self.shapes: 
    462455                value2 = self.shapes[key2] 
    463456                header = key2 + '.' 
    464                 for key3 in value2.params.keys():    
     457                for key3 in value2.params: 
    465458                    fullname = header + key3                  
    466459                    param_list.append(fullname) 
    467460      
    468461        else: 
    469             try: 
    470                 self.shapes.has_key(shapeid) 
    471             except KeyError: 
    472                 raise ValueError, \ 
    473                     "VolumeCanvas: getParamList: Could not find %s" % shapeid 
     462            if not shapeid in self.shapes: 
     463                raise ValueError("VolumeCanvas: getParamList: Could not find " 
     464                                 "%s" % shapeid) 
     465 
    474466            header = shapeid + '.' 
    475             param_list = self.shapes[shapeid].params.keys()   
    476             for i in range(len(param_list)): 
    477                 param_list[i] = header + param_list[i] 
    478  
     467            param_list = [header + param for param in self.shapes[shapeid].params] 
    479468        return param_list 
    480469 
     
    490479            @param shapeDesc: shape description 
    491480        """ 
    492         #Create the object model 
     481        # Create the object model 
    493482        shapeDesc.create() 
    494483                     
     
    605594        # type we recognize 
    606595        else: 
    607             raise ValueError, "run(q): bad type for q" 
     596            raise ValueError("run(q): bad type for q") 
    608597     
    609598    def runXY(self, q = 0): 
     
    625614        # type we recognize 
    626615        else: 
    627             raise ValueError, "runXY(q): bad type for q" 
     616            raise ValueError("runXY(q): bad type for q") 
    628617     
    629618    def _create_modelObject(self): 
  • src/sas/sasgui/guiframe/gui_manager.py

    r64ca561 r49165488  
    21222122        """ 
    21232123        if custom_config is not None: 
    2124             sas_opencl = os.environ.get("SAS_OPENCL",None) 
     2124            sas_opencl = os.environ.get("SAS_OPENCL") 
    21252125            new_config_lines = [] 
    21262126            config_file = open(custom_config.__file__) 
  • src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py

    r463e7ffc rc1d5aea  
    9292        if dlg.ShowModal() == wx.ID_OK: 
    9393            file_list = dlg.GetPaths() 
    94             if len(file_list) >= 0 and not file_list[0] is None: 
     94            if len(file_list) >= 0 and file_list[0] is not None: 
    9595                self._default_save_location = os.path.dirname(file_list[0]) 
    9696                path = self._default_save_location 
  • src/sas/sasgui/guiframe/media/data_formats_help.rst

    r98c44f3 r76c4469  
    8686 
    8787- Spin echo length (z, in Angstroms) 
    88 - depolarization (:math:`log(P/P_0)/(lambda^2 * thickness)`, in Angstrom^-1 cm^-1) 
     88- depolarization (:math:`log(P/P_0)/(lambda^2 * thickness)`, in Angstrom :sup:`-1` cm :sup:`-1`\ ) 
    8989- depolarization error in the same unit) (measurement error) 
    9090- Spin echo length error (:math:`\Delta`\ z, in Angstroms) (experimental resolution) 
  • src/sas/sasgui/perspectives/calculator/image_viewer.py

    r25b9707a rc1d5aea  
    4242        """ 
    4343        parent = self.parent 
    44         if parent == None: 
     44        if parent is None: 
    4545            location = os.getcwd() 
    4646        else: 
    4747            location = parent._default_save_location 
    4848        path_list = self.choose_data_file(location=location) 
    49         if path_list == None: 
     49        if path_list is None: 
    5050            return 
    51         if len(path_list) >= 0 and not(path_list[0]is None): 
    52             if parent != None: 
     51        if len(path_list) >= 0 and path_list[0] is not None: 
     52            if parent is not None: 
    5353                parent._default_save_location = os.path.dirname(path_list[0]) 
    5454        err_msg = '' 
  • src/sas/sasgui/perspectives/pr/explore_dialog.py

    r9c0f3c17 rf3bf622  
    269269        # Note: by design, the output type should always be part of the 
    270270        #       results object. 
    271         if self.results.outputs.has_key(output_type): 
     271        if output_type in self.results.outputs: 
    272272            self.plotpanel.plot.x = self.results.d_max 
    273273            self.plotpanel.plot.y = self.results.outputs[output_type][2] 
  • src/sas/sasgui/perspectives/pr/inversion_panel.py

    r463e7ffc rc1d5aea  
    940940        Choose a new input file for I(q) 
    941941        """ 
    942         if not self._manager is None: 
     942        if self._manager is not None: 
    943943            self.plot_data.SetValue(str(data.name)) 
    944944            try: 
  • src/sas/sasgui/perspectives/pr/pr.py

    r9c0f3c17 r861f1880  
    329329 
    330330        # If we have a group ID, use it 
    331         if pr.info.has_key("plot_group_id"): 
     331        if 'plot_group_id' in pr.info: 
    332332            new_plot.group_id = pr.info["plot_group_id"] 
    333333        new_plot.id = IQ_FIT_LABEL 
     
    348348                except: 
    349349                    err[i] = 1.0 
    350                     print "Error getting error", value, x[i] 
     350                    print("Error getting error", value, x[i]) 
    351351 
    352352            new_plot = Data1D(x, y) 
     
    356356            new_plot.yaxis("\\rm{Intensity} ", "cm^{-1}") 
    357357            # If we have a group ID, use it 
    358             if pr.info.has_key("plot_group_id"): 
     358            if 'plot_group_id' in pr.info: 
    359359                new_plot.group_id = pr.info["plot_group_id"] 
    360360            new_plot.id = IQ_SMEARED_LABEL 
     
    10471047        try: 
    10481048            pr = self._create_file_pr(data) 
    1049             if not pr is None: 
     1049            if pr is not None: 
    10501050                self.pr = pr 
    10511051                self.perform_estimate() 
  • src/sas/sasgui/plottools/LineModel.py

    rdd5bf63 rec8886e  
    88function should disappear in a future iteration (see notes in fitDialog) 
    99 
    10                 -PDB   July 10, 2016 
     10PDB   July 10, 2016 
     11 
    1112""" 
    1213 
     
    7071        runXY is when the if statement is true. I however cannot see what that 
    7172        function is for.  It needs to be documented here or removed. 
    72         -PDB 7/10/16  
     73        PDB 7/10/16  
    7374 
    7475        :param x: simple value 
     
    9293        but the only difference between this and run is when the if  
    9394        statement is true. I however cannot see what that function 
    94         is for.  It needs to be documented here or removed. -PDB 7/10/16  
     95        is for.  It needs to be documented here or removed. PDB 7/10/16  
    9596 
    9697        :param x: simple value 
  • src/sas/sasgui/plottools/PlotPanel.py

    r9c0f3c17 rc1d5aea  
    14031403        if self.scale == 'log_{10}': 
    14041404            self.scale = 'linear' 
    1405             if not self.zmin_2D is None: 
     1405            if self.zmin_2D is not None: 
    14061406                zmin_2D_temp = math.pow(10, self.zmin_2D) 
    1407             if not self.zmax_2D is None: 
     1407            if self.zmax_2D is not None: 
    14081408                zmax_2D_temp = math.pow(10, self.zmax_2D) 
    14091409        else: 
    14101410            self.scale = 'log_{10}' 
    1411             if not self.zmin_2D is None: 
     1411            if self.zmin_2D is not None: 
    14121412                # min log value: no log(negative) 
    14131413                if self.zmin_2D <= 0: 
     
    14151415                else: 
    14161416                    zmin_2D_temp = math.log10(self.zmin_2D) 
    1417             if not self.zmax_2D is None: 
     1417            if self.zmax_2D is not None: 
    14181418                zmax_2D_temp = math.log10(self.zmax_2D) 
    14191419 
  • test/sasdataloader/test/testplugings.py

    rb699768 rf3bf622  
    3232        output = self.L.load('test_data.test') 
    3333        self.assertEqual(output.x[0], 1234.) 
    34         self.assertTrue(self.L.loaders.has_key('.test')) 
     34        self.assertTrue('.test' in self.L.loaders) 
    3535         
    3636class testZip(unittest.TestCase): 
     
    6161        output = self.L.load('test_data.test') 
    6262        self.assertEqual(output.x[0], 1234.) 
    63         self.assertTrue(self.L.loaders.has_key('.test')) 
     63        self.assertTrue('.test' in self.L.loaders) 
    6464         
    6565         
  • src/sas/sasgui/perspectives/fitting/basepage.py

    r9c0f3c17 r4b402a1  
    1313import traceback 
    1414 
     15from time import time 
     16from Queue import Queue 
     17from threading import Thread 
    1518from collections import defaultdict 
    1619from wx.lib.scrolledpanel import ScrolledPanel 
     
    239242        self.set_layout() 
    240243 
     244        # Setting up a thread for the fitting 
     245        self.threadedDrawQueue = Queue() 
     246 
     247        self.threadedDrawWorker = Thread(target = self._threaded_draw_worker, 
     248                                         args = (self.threadedDrawQueue,)) 
     249        self.threadedDrawWorker.setDaemon(True) 
     250        self.threadedDrawWorker.start() 
     251 
     252        # And a home for the thread submission times 
     253        self.lastTimeFitSubmitted = 0.00 
     254 
    241255    def set_index_model(self, index): 
    242256        """ 
     
    16911705        :param chisqr: update chisqr value [bool] 
    16921706        """ 
    1693         wx.CallAfter(self._draw_model_after, update_chisqr, source) 
     1707        # Get the time 
     1708        currentTime = time() 
     1709 
     1710        # When loading we slam a number of fits through here 
     1711        # let's filter these out to start with 
     1712        if currentTime > (self.lastTimeFitSubmitted + 0.1): 
     1713            # Submitting the rest 
     1714            self.threadedDrawQueue.put([update_chisqr, source]) 
     1715            print 'submitted!' 
     1716        else: 
     1717            pass 
     1718 
     1719        self.lastTimeFitSubmitted = currentTime 
     1720 
     1721    def _threaded_draw_worker(self, threadedDrawQueue): 
     1722        while True: 
     1723            # Check to see is a manager is running and a calc is running 
     1724            if ((self._manager.calc_1D is not None) and (self._manager.calc_1D.\ 
     1725                isrunning() == True)) or ((self._manager.calc_2D is not None)\ 
     1726                and (self._manager.calc_2D.isrunning() == True)): 
     1727                # If a manager is running a calculation  
     1728                # then trim the queue 
     1729                if self.threadedDrawQueue.qsize() > 1: 
     1730                    print '2' 
     1731                    for loopIter in range(threadedDrawQueue.qsize() - 1): 
     1732                        dump = self.threadedDrawQueue.get() 
     1733                        self.threadedDrawQueue.task_done() 
     1734                        print 'bounced' 
     1735                    print 'one element left' 
     1736            else: 
     1737                # Otherwise, just run 
     1738                inputVariables = threadedDrawQueue.get() 
     1739                self._draw_model_after(inputVariables[0], inputVariables[1]) 
     1740                wx.PostEvent(self._manager.parent, StatusEvent(status =  
     1741                            "Computation is in progress...", type = "progress")) 
     1742                threadedDrawQueue.task_done() 
     1743                print 'run'                 
    16941744 
    16951745    def _draw_model_after(self, update_chisqr=True, source='model'): 
     
    17141764            toggle_mode_on = self.model_view.IsEnabled() 
    17151765            is_2d = self._is_2D() 
     1766 
    17161767            self._manager.draw_model(self.model, 
    17171768                                     data=self.data, 
Note: See TracChangeset for help on using the changeset viewer.