Changeset e23a20c in sasview


Ignore:
Timestamp:
Jan 12, 2009 2:21:12 PM (16 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:
92c2345
Parents:
fb198a9
Message:

Some bugs in SectorSlicer?.py are removed.
: fixed update problem when the sector lines move below the horizon.
: fixed the unit of x-axis.
: fixed error when moving left (right)lines every other times.
: made the sector lines longer enough to cover whole region of 2D data (in q space).

File:
1 edited

Legend:

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

    r116da060 re23a20c  
    2727        self.markers = [] 
    2828        self.axes = axes 
    29         self.qmax = self.base.qmax 
     29        self.qmax = math.sqrt(2)*self.base.qmax 
    3030        self.connect = self.base.connect 
    3131         
     
    3737        #self.theta3= 2*self.theta2 -self.theta1 
    3838        # Inner circle 
    39         self.main_line = LineInteractor(self, self.base.subplot,color='blue', zorder=zorder, r=self.qmax, 
     39        self.main_line = LineInteractor(self, self.base.subplot,color='green', zorder=zorder, r=self.qmax, 
    4040                                           theta= self.theta2) 
    41         self.main_line.qmax = self.base.qmax 
     41        self.main_line.qmax = math.sqrt(2)*self.base.qmax 
    4242        #self.left_line = SectionInteractor(self, self.base.subplot, zorder=zorder+1, r=self.qmax, 
    4343        #                                   theta1= self.theta1, theta2= self.theta2) 
     
    4747                                           phi= -1*self.phi, 
    4848                                           theta2=self.theta2) 
    49         self.right_line.qmax = self.base.qmax 
    50         self.left_line= SideInteractor(self, self.base.subplot,color='green', zorder=zorder, 
     49        self.right_line.qmax = math.sqrt(2)*self.base.qmax 
     50        self.left_line= SideInteractor(self, self.base.subplot,color='blue', zorder=zorder, 
    5151                                     r=self.qmax, 
    5252                                           phi= self.phi, 
    5353                                           theta2=self.theta2) 
    54         self.left_line.qmax = self.base.qmax 
     54        self.left_line.qmax = math.sqrt(2)*self.base.qmax 
    5555        #self.outer_circle.set_cursor(self.base.qmax/1.8, 0) 
    5656         
     
    116116            print "left line has moved --->" 
    117117            self.main_line.update() 
    118             self.left_line.update(phi=None,delta=None, mline=self.main_line,side=True) 
     118            self.left_line.update(phi=None,delta=None, mline=self.main_line,side=True, left=True) 
    119119            #self.right_line.update(-1*delta,linem=self.main_line,linel=self.left_line) 
    120             self.right_line.update(phi=-1*self.left_line.phi,delta=None, mline=self.main_line,side=True) 
     120            self.right_line.update(phi=-1*self.left_line.phi,delta=None, mline=self.main_line,side=True, left=True) 
    121121        if self.right_line.has_move: 
    122122            print "right line has moved --->" 
    123123            
    124124            self.main_line.update() 
    125             self.right_line.update(phi=None,delta=None, mline=self.main_line,side=True) 
     125            self.right_line.update(phi=None,delta=None, mline=self.main_line,side=True, right=True) 
    126126            #self.right_line.update(-1*delta,linem=self.main_line,linel=self.left_line) 
    127             self.left_line.update(phi=-1*self.right_line.phi,delta=None, mline=self.main_line,side=True) 
     127            self.left_line.update(phi=-1*self.right_line.phi,delta=None, mline=self.main_line,side=True, left=True) 
    128128    
    129129     
     
    151151        phimin = self.right_line.theta+math.pi 
    152152        phimax = self.left_line.theta+math.pi 
    153         #sect = SectorQ(r_min=0.000001, r_max= radius , phi_min=phimin, phi_max=phimax) 
    154         sect = SectorQ(r_min=-1*radius , r_max= radius , phi_min=phimin, phi_max=phimax) 
     153 
     154        sect = SectorQ(r_min=0.000001, r_max= radius , phi_min=phimin, phi_max=phimax) 
     155        #sect = SectorQ(r_min=-1*radius , r_max= radius , phi_min=phimin, phi_max=phimax) 
    155156        if nbins!=None: 
    156157            sect.nbins = nbins 
     
    179180        new_plot.detector =self.base.data2D.detector 
    180181        # If the data file does not tell us what the axes are, just assume... 
    181         new_plot.xaxis("\\rm{Q}", 'rad') 
     182        new_plot.xaxis("\\rm{Q}", 'A^{-1}') 
    182183        new_plot.yaxis("\\rm{Intensity} ","cm^{-1}") 
    183184        new_plot.group_id = "SectorQ"+self.base.data2D.name 
     
    219220        if math.fabs(self.left_line.phi) != math.fabs(self.right_line.phi): 
    220221            raise ValueError,"Phi left and phi right are different %f, %f"%(self.left_line.phi, self.right_line.phi) 
    221         params["left_phi"] = self.left_line.phi 
     222        params["left_phi"] = math.fabs(self.left_line.phi) 
    222223        params["nbins"] = self.nbins 
    223224        return params 
     
    301302        return self.theta - self.save_theta 
    302303         
    303     def update(self,phi=None,delta=None, mline=None,side=False): 
     304    def update(self,phi=None,delta=None, mline=None,side=False, left= False, right=False): 
    304305        """ 
    305306        Draw the new roughness on the graph. 
     
    311312        if delta==None: 
    312313            delta = 0 
    313         if side== True: 
     314        if side: 
    314315            self.theta=  mline.theta + self.phi 
     316             
     317             
    315318        if mline!=None: 
    316319            self.theta2 = mline.theta 
     320            #self.phi= math.fabs(self.theta2 - (self.theta+delta)) 
    317321        #print "U:for line side theta2, phi, theta",math.degrees(self.theta2),math.degrees(self.phi),math.degrees(self.theta)  
    318322        #if self.theta2 >= self.theta and self.theta>=0: 
     
    355359         
    356360        self.theta= math.atan2(y,x) 
    357         self.phi= self.theta2 - self.theta 
     361         
     362        self.phi= math.fabs(self.theta2 - self.theta) 
    358363         
    359364        print "move left or right phi ---theta--thetaM", self.phi, self.theta, self.theta2 
Note: See TracChangeset for help on using the changeset viewer.