Changeset a2c38de in sasview


Ignore:
Timestamp:
Jan 19, 2009 10:20:14 AM (15 years ago)
Author:
Jae Cho <jhjcho@…>
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:
ffd23b5
Parents:
3dc83be
Message:

Cursors for AnnulusSlicer? rings are now located at + or - x-axis where it has more space for the cursors to move around.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/local_perspectives/plotting/AnnulusSlicer.py

    rbd1d9d9 ra2c38de  
    66# 
    77 
    8  
     8  
    99# Debug printout 
    1010from sans.guicomm.events import StatusEvent  
     
    2626        self.markers = [] 
    2727        self.axes = axes 
    28         self.qmax = self.base.data2D.xmax 
     28        self.base= base 
     29        self.qmax = min(math.fabs(self.base.data2D.xmax),math.fabs(self.base.data2D.xmin))  #must be positive 
    2930        self.connect = self.base.connect 
    3031         
     32 
    3133        ## Number of points on the plot 
    3234        self.nbins = 20 
    33  
     35         
     36        #Cursor position of Rings (Left(-1) or Right(1)) 
     37        self.xmaxd=self.base.data2D.xmax 
     38        self.xmind=self.base.data2D.xmin 
     39 
     40        #self.sign=1 
     41         
     42        if (self.xmaxd+self.xmind)>0: 
     43            self.sign=1 
     44        else: 
     45            self.sign=-1 
     46                  
    3447        # Inner circle 
    35         self.inner_circle = RingInteractor(self, self.base.subplot, zorder=zorder, r=self.qmax/2.0) 
     48        self.inner_circle = RingInteractor(self, self.base.subplot, zorder=zorder, r=self.qmax/2.0,sign=self.sign) 
    3649        self.inner_circle.qmax = self.qmax 
    37         self.outer_circle = RingInteractor(self, self.base.subplot, zorder=zorder+1, r=self.qmax/1.8) 
     50        self.outer_circle = RingInteractor(self, self.base.subplot, zorder=zorder+1, r=self.qmax/1.8,sign=self.sign) 
    3851        self.outer_circle.qmax = self.qmax*1.2 
    3952        #self.outer_circle.set_cursor(self.base.qmax/1.8, 0) 
     
    4558        # Bind to slice parameter events 
    4659        self.base.parent.Bind(SlicerParameters.EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
    47  
     60         
    4861 
    4962    def _onEVT_SLICER_PARS(self, event): 
     
    107120         
    108121        from DataLoader.manipulations import SectorPhi 
    109         radius = math.sqrt(math.pow(self.qmax,2)+math.pow(self.qmax,2)) 
    110         rmin= self.inner_circle.get_radius() 
    111         rmax = self.outer_circle.get_radius() 
     122        radius = self.qmax#math.sqrt(math.pow(self.qmax,2)+math.pow(self.qmax,2)) 
     123        rmin= math.fabs(self.inner_circle.get_radius()) 
     124        rmax = math.fabs(self.outer_circle.get_radius()) 
    112125        phi_min=-math.pi 
    113126        phi_max=math.pi 
     
    208221         Select an annulus through a 2D plot 
    209222    """ 
    210     def __init__(self,base,axes,color='black', zorder=5, r=1.0): 
     223    def __init__(self,base,axes,color='black', zorder=5, r=1.0,sign=1): 
    211224         
    212225        _BaseInteractor.__init__(self, base, axes, color=color) 
     
    218231        self._inner_save_y  = 0 
    219232        self.scale = 10.0 
    220          
     233        self.base= base 
     234        self.sign=sign 
     235          
     236         
     237        print "sign",self.sign,self.sign*math.fabs(self._inner_mouse_x) 
     238                                                     
    221239        try: 
    222240            # Inner circle marker 
    223             self.inner_marker = self.axes.plot([self._inner_mouse_x],[0], linestyle='', 
     241            self.inner_marker = self.axes.plot([self.sign*math.fabs(self._inner_mouse_x)],[0], linestyle='', 
    224242                                          marker='s', markersize=10, 
    225243                                          color=self.color, alpha=0.6, 
     
    228246                                          visible=True)[0] 
    229247        except: 
    230             self.inner_marker = self.axes.plot([self._inner_mouse_x],[0], linestyle='', 
     248            self.inner_marker = self.axes.plot([self.sign*math.fabs(self._inner_mouse_x)],[0], linestyle='', 
    231249                                          marker='s', markersize=10, 
    232250                                          color=self.color, alpha=0.6, 
     
    283301            x.append(xval) 
    284302            y.append(yval) 
    285          
    286         self.inner_marker.set(xdata=[self._inner_mouse_x],ydata=[0]) 
     303             
     304        self.inner_marker.set(xdata=[self.sign*math.fabs(self._inner_mouse_x)],ydata=[0]) 
    287305        self.inner_circle.set_data(x, y)         
    288306 
     
    321339    def get_params(self): 
    322340        params = {} 
    323         params["radius"] = self._inner_mouse_x 
     341        params["radius"] = math.fabs(self._inner_mouse_x) 
    324342        return params 
    325343     
Note: See TracChangeset for help on using the changeset viewer.