Changeset 0c218d9 in sasview


Ignore:
Timestamp:
Feb 6, 2009 4:39:19 PM (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:
ae2d445
Parents:
0b92f4f4
Message:

Improved the behaviors of the sector average lines.
Removed some known bugs.

File:
1 edited

Legend:

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

    r7a28ba7 r0c218d9  
    2929        self.markers = [] 
    3030        self.axes = axes         
    31         self.qmax = math.sqrt(math.pow(max(self.base.data2D.xmax,abs(self.base.data2D.xmin)),2)+math.pow(max(self.base.data2D.xmax,abs(self.base.data2D.xmin)),2)) 
     31        self.qmax = math.sqrt(math.pow(max(self.base.data2D.xmax,math.fabs(self.base.data2D.xmin)),2)+math.pow(max(self.base.data2D.xmax,math.fabs(self.base.data2D.xmin)),2)) 
    3232        #print "sector qmax", self.qmax 
    3333        self.connect = self.base.connect 
     
    157157        #phimin = min(self.right_line.theta+math.pi,self.left_line.theta+math.pi) 
    158158        #phimax = max(self.right_line.theta+math.pi,self.left_line.theta+math.pi) 
    159         print "sector Q",phimin,phimax 
     159        #print "sector Q",phimin,phimax 
    160160        sect = SectorQ(r_min=0.0, r_max= radius , phi_min=phimin, phi_max=phimax) 
    161161        #sect = SectorQ(r_min=-1*radius , r_max= radius , phi_min=phimin, phi_max=phimax) 
     
    280280        try: 
    281281            # Inner circle marker 
    282             self.inner_marker = self.axes.plot([x1/2],[y1/2], linestyle='', 
     282            self.inner_marker = self.axes.plot([x1/2.5],[y1/2.5], linestyle='', 
    283283                                          marker='s', markersize=10, 
    284284                                          color=self.color, alpha=0.6, 
     
    287287                                          visible=True)[0] 
    288288        except: 
    289             self.inner_marker = self.axes.plot([x1/2],[y1/2], linestyle='', 
     289            self.inner_marker = self.axes.plot([x1/2.5],[y1/2.5], linestyle='', 
    290290                                          marker='s', markersize=10, 
    291291                                          color=self.color, alpha=0.6, 
     
    360360        y2= -1*self.radius*math.sin(self.theta + delta) 
    361361        
    362         self.inner_marker.set(xdata=[x1/2],ydata=[y1/2]) 
     362        self.inner_marker.set(xdata=[x1/2.5],ydata=[y1/2.5]) 
    363363        self.line.set(xdata=[x1,x2], ydata=[y1,y2])   
    364364         
     
    392392        self.theta= math.atan2(y,x) 
    393393        self.has_move=True 
     394         
     395        #ToDo: Simplify below 
    394396        if not self.left_moving: 
    395             if  self.theta >= self.theta2: 
    396                 print "my theta", self.theta 
    397                 self.restore() 
    398                 return  
    399             elif self.theta <= self.theta2 -math.pi/2: 
    400                 print "self theta encore" 
     397            if  self.theta2-self.theta <= 0 and self.theta2>0:#>= self.theta2: 
     398                #print "my theta", self.theta 
     399                self.restore() 
     400                return  
     401            elif self.theta2 < 0 and self.theta < 0 and self.theta-self.theta2 >= 0: 
     402                self.restore() 
     403                return                              
     404            elif  self.theta2 < 0 and self.theta > 0 and self.theta2+2*math.pi-self.theta >=math.pi/2: 
     405                #print "my theta", self.theta 
     406                self.restore() 
     407                return  
     408            elif  self.theta2 < 0 and self.theta < 0 and self.theta2-self.theta >=math.pi/2: 
     409                #print "my theta", self.theta 
     410                self.restore() 
     411                return  
     412            elif self.theta2>0 and (self.theta2-self.theta >= math.pi/2 or (self.theta2-self.theta >= math.pi/2)):#<= self.theta2 -math.pi/2: 
     413                #print "self theta encore" 
    401414                self.restore() 
    402415                return  
    403416        else: 
    404             print "left move" 
    405             if  self.theta <= self.theta2: 
    406                 print "my theta", self.theta 
    407                 self.restore() 
    408                 return  
    409             elif self.theta >= self.theta2 +math.pi/2: 
    410                 print "self theta encore" 
    411                 self.restore() 
    412                 return  
     417            #print "left move" 
     418            if  self.theta < 0 and self.theta+math.pi*2-self.theta2 <= 0: 
     419                self.restore() 
     420                return  
     421            elif self.theta2 < 0 and self.theta-self.theta2 <= 0: 
     422                self.restore() 
     423                return                              
     424            elif  self.theta > 0 and self.theta-self.theta2 <=0: 
     425                #print "my theta", self.theta 
     426                self.restore() 
     427                return  
     428            elif self.theta-self.theta2 >= math.pi/2 or  (self.theta+math.pi*2-self.theta2 >= math.pi/2 and self.theta<0 and self.theta2>0): 
     429                #print "self theta encore" 
     430                self.restore() 
     431                return  
     432             
    413433        self.phi= math.fabs(self.theta2 - self.theta) 
    414          
    415         print "move , self.phi, self.theta,", self.theta,self.theta2 -math.pi/2 
     434        if self.phi>math.pi: 
     435            self.phi= 2*math.pi-math.fabs(self.theta2 - self.theta) 
     436         
     437        #print "move , self.phi, self.theta,", self.theta*180/math.pi,self.theta2*180/math.pi,self.phi*180/math.pi 
    416438        
    417439             
     
    463485        try: 
    464486            # Inner circle marker 
    465             self.inner_marker = self.axes.plot([x1/2],[y1/2], linestyle='', 
     487            self.inner_marker = self.axes.plot([x1/2.5],[y1/2.5], linestyle='', 
    466488                                          marker='s', markersize=10, 
    467489                                          color=self.color, alpha=0.6, 
     
    470492                                          visible=True)[0] 
    471493        except: 
    472             self.inner_marker = self.axes.plot([x1/2],[y1/2], linestyle='', 
     494            self.inner_marker = self.axes.plot([x1/2.5],[y1/2.5], linestyle='', 
    473495                                          marker='s', markersize=10, 
    474496                                          color=self.color, alpha=0.6, 
     
    513535        Draw the new roughness on the graph. 
    514536        """ 
    515         print "update main line", self.theta 
     537        #print "update main line", self.theta 
    516538        if theta !=None: 
    517539            self.theta= theta 
     
    521543        y2= -1*self.radius*math.sin(self.theta) 
    522544         
    523         self.inner_marker.set(xdata=[x1/2],ydata=[y1/2]) 
     545        self.inner_marker.set(xdata=[x1/2.5],ydata=[y1/2.5]) 
    524546        self.line.set(xdata=[x1,x2], ydata=[y1,y2])   
    525547      
     
    551573         
    552574        self.theta= math.atan2(y,x) 
    553         print "main_line previous theta --- next theta ",math.degrees(self.save_theta),math.degrees(self.theta) 
     575        #print "main_line previous theta --- next theta ",math.degrees(self.save_theta),math.degrees(self.theta) 
    554576         
    555577        self.has_move=True 
     578         
    556579        self.base.base.update() 
    557580         
Note: See TracChangeset for help on using the changeset viewer.