Ignore:
Timestamp:
Mar 5, 2015 2:37:00 PM (9 years ago)
Author:
Mathieu Doucet <doucetm@…>
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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
b40ad40
Parents:
090e07e
Message:

pylint fixes

File:
1 moved

Legend:

Unmodified
Added
Removed
  • src/sas/guiframe/local_perspectives/plotting/sector_mask.py

    r79492222 rc039589  
    1  
     1""" 
     2    Sector mask interactor 
     3""" 
    24import math 
    35import wx 
     
    1820        ## Class initialization 
    1921        self.markers = [] 
    20         self.axes = axes    
     22        self.axes = axes 
    2123        self.is_inside = side 
    22         ## connect the plot to event  
     24        ## connect the plot to event 
    2325        self.connect = self.base.connect 
    24          
    25         ## compute qmax limit to reset the graph      
    26         x = math.pow(max(self.base.data.xmax,  
     26 
     27        ## compute qmax limit to reset the graph 
     28        x = math.pow(max(self.base.data.xmax, 
    2729                         math.fabs(self.base.data.xmin)), 2) 
    28         y = math.pow(max(self.base.data.ymax,  
     30        y = math.pow(max(self.base.data.ymax, 
    2931                         math.fabs(self.base.data.ymin)), 2) 
    3032        self.qmax = math.sqrt(x + y) 
     
    3234        self.nbins = 20 
    3335        ## Angle of the middle line 
    34         self.theta2 = math.pi/3 
     36        self.theta2 = math.pi / 3 
    3537        ## Absolute value of the Angle between the middle line and any side line 
    36         self.phi = math.pi/12 
    37          
     38        self.phi = math.pi / 12 
     39 
    3840        ## Middle line 
    3941        self.main_line = LineInteractor(self, self.base.subplot, color='blue', 
    40                                 zorder=zorder, r=self.qmax, theta=self.theta2) 
     42                                        zorder=zorder, r=self.qmax, theta=self.theta2) 
    4143        self.main_line.qmax = self.qmax 
    4244        ## Right Side line 
    4345        self.right_line = SideInteractor(self, self.base.subplot, color='gray', 
    44                             zorder=zorder, r=self.qmax, phi= -1*self.phi, 
    45                                                             theta2=self.theta2) 
     46                                         zorder=zorder, r=self.qmax, phi=-1 * self.phi, 
     47                                         theta2=self.theta2) 
    4648        self.right_line.qmax = self.qmax 
    47         ## Left Side line  
    48         self.left_line = SideInteractor(self, self.base.subplot, color='gray',  
    49                                     zorder=zorder, r=self.qmax, phi= self.phi, 
    50                                                         theta2=self.theta2) 
     49        ## Left Side line 
     50        self.left_line = SideInteractor(self, self.base.subplot, color='gray', 
     51                                        zorder=zorder, r=self.qmax, phi=self.phi, 
     52                                        theta2=self.theta2) 
    5153        self.left_line.qmax = self.qmax 
    52         ## draw the sector                
     54        ## draw the sector 
    5355        self.update() 
    5456        self._post_data() 
    55          
     57 
    5658    def clear(self): 
    5759        """ 
     
    6365        self.right_line.clear() 
    6466        self.base.connect.clearall() 
    65         #self.base.Unbind(EVT_SLICER_PARS) 
    66          
     67 
    6768    def update(self): 
    6869        """ 
     
    7071        resetting the widgets. 
    7172        """ 
    72         # Update locations   
    73         ## Check if the middle line was dragged and  
    74         #update the picture accordingly      
     73        # Update locations 
     74        ## Check if the middle line was dragged and 
     75        #update the picture accordingly 
    7576        if self.main_line.has_move: 
    7677            self.main_line.update() 
    77             self.right_line.update(delta=-self.left_line.phi/2, 
    78                                     mline=self.main_line.theta) 
    79             self.left_line.update(delta=self.left_line.phi/2, 
     78            self.right_line.update(delta=-self.left_line.phi / 2, 
    8079                                   mline=self.main_line.theta) 
    81         ## Check if the left side has moved and update the slicer accordingly   
     80            self.left_line.update(delta=self.left_line.phi / 2, 
     81                                  mline=self.main_line.theta) 
     82        ## Check if the left side has moved and update the slicer accordingly 
    8283        if self.left_line.has_move: 
    8384            self.main_line.update() 
    84             self.left_line.update(phi=None, delta=None, mline=self.main_line , 
    85                                   side=True, left=True ) 
     85            self.left_line.update(phi=None, delta=None, mline=self.main_line, 
     86                                  side=True, left=True) 
    8687            self.right_line.update(phi=self.left_line.phi, delta=None, 
    87                                      mline=self.main_line, side=True, 
    88                                      left=False, right=True) 
    89         ## Check if the right side line has moved and  
     88                                   mline=self.main_line, side=True, 
     89                                   left=False, right=True) 
     90        ## Check if the right side line has moved and 
    9091        #update the slicer accordingly 
    9192        if self.right_line.has_move: 
     
    9495                                   side=True, left=False, right=True) 
    9596            self.left_line.update(phi=self.right_line.phi, delta=None, 
    96                                     mline=self.main_line, side=True, left=False) 
     97                                  mline=self.main_line, side=True, left=False) 
    9798        #if self.is_inside != None: 
    9899        out = self._post_data() 
     
    118119        if data == None: 
    119120            return 
    120  
    121         mask = data.mask 
    122121        ## Averaging 
    123122        from sas.dataloader.manipulations import Sectorcut 
    124         radius = self.qmax  
    125         phimin =  -self.left_line.phi + self.main_line.theta 
     123        phimin = -self.left_line.phi + self.main_line.theta 
    126124        phimax = self.left_line.phi + self.main_line.theta 
    127           
     125 
    128126        mask = Sectorcut(phi_min=phimin, phi_max=phimax) 
    129127        if self.is_inside: 
     
    131129        else: 
    132130            out = (mask(data)) 
    133         #self.base.data.mask=out 
    134         return out        
     131        return out 
    135132 
    136133    def moveend(self, ev): 
    137134        """ 
    138         Called a dragging motion ends.Get slicer event  
     135        Called a dragging motion ends.Get slicer event 
    139136        """ 
    140137        self.base.thaw_axes() 
     
    146143        wx.PostEvent(self.base, event) 
    147144        self._post_data() 
    148              
     145 
    149146    def restore(self): 
    150147        """ 
     
    160157        """ 
    161158        pass 
    162          
     159 
    163160    def set_cursor(self, x, y): 
    164161        pass 
    165          
     162 
    166163    def get_params(self): 
    167164        """ 
    168165        Store a copy of values of parameters of the slicer into a dictionary. 
    169          
     166 
    170167        :return params: the dictionary created 
    171          
     168 
    172169        """ 
    173170        params = {} 
    174         ## Always make sure that the left and the right line are at phi  
     171        ## Always make sure that the left and the right line are at phi 
    175172        ## angle of the middle line 
    176173        if math.fabs(self.left_line.phi) != math.fabs(self.right_line.phi): 
    177174            msg = "Phi left and phi right are " 
    178             msg += "different %f, %f" % (self.left_line.phi,  
     175            msg += "different %f, %f" % (self.left_line.phi, 
    179176                                         self.right_line.phi) 
    180177            raise ValueError, msg 
     
    182179        params["Delta_Phi"] = math.fabs(self.left_line.phi) 
    183180        return params 
    184      
     181 
    185182    def set_params(self, params): 
    186183        """ 
    187         Receive a dictionary and reset the slicer with values contained  
     184        Receive a dictionary and reset the slicer with values contained 
    188185        in the values of the dictionary. 
    189          
    190         :param params: a dictionary containing name of slicer parameters and  
     186 
     187        :param params: a dictionary containing name of slicer parameters and 
    191188            values the user assigned to the slicer. 
    192189        """ 
    193         main = params["Phi"]  
     190        main = params["Phi"] 
    194191        phi = math.fabs(params["Delta_Phi"]) 
    195          
     192 
    196193        self.main_line.theta = main 
    197194        ## Reset the slicer parameters 
     
    203200        ## post the new corresponding data 
    204201        self._post_data() 
    205          
     202 
    206203    def freeze_axes(self): 
    207204        """ 
    208205        """ 
    209206        self.base.freeze_axes() 
    210          
     207 
    211208    def thaw_axes(self): 
    212209        """ 
     
    218215        """ 
    219216        self.base.update() 
    220          
Note: See TracChangeset for help on using the changeset viewer.