コード例 #1
0
ファイル: sector_mask.py プロジェクト: mcbeaker/sasview
    def __init__(self, base, axes, color='gray', zorder=3, side=False):
        """
        """
        _BaseInteractor.__init__(self, base, axes, color=color)
        ## Class initialization
        self.markers = []
        self.axes = axes
        self.is_inside = side
        ## connect the plot to event
        self.connect = self.base.connect

        ## compute qmax limit to reset the graph
        x = math.pow(max(self.base.data.xmax, math.fabs(self.base.data.xmin)),
                     2)
        y = math.pow(max(self.base.data.ymax, math.fabs(self.base.data.ymin)),
                     2)
        self.qmax = math.sqrt(x + y)
        ## Number of points on the plot
        self.nbins = 20
        ## Angle of the middle line
        self.theta2 = math.pi / 3
        ## Absolute value of the Angle between the middle line and any side line
        self.phi = math.pi / 12

        ## Middle line
        self.main_line = LineInteractor(self,
                                        self.base.subplot,
                                        color='blue',
                                        zorder=zorder,
                                        r=self.qmax,
                                        theta=self.theta2)
        self.main_line.qmax = self.qmax
        ## Right Side line
        self.right_line = SideInteractor(self,
                                         self.base.subplot,
                                         color='gray',
                                         zorder=zorder,
                                         r=self.qmax,
                                         phi=-1 * self.phi,
                                         theta2=self.theta2)
        self.right_line.qmax = self.qmax
        ## Left Side line
        self.left_line = SideInteractor(self,
                                        self.base.subplot,
                                        color='gray',
                                        zorder=zorder,
                                        r=self.qmax,
                                        phi=self.phi,
                                        theta2=self.theta2)
        self.left_line.qmax = self.qmax
        ## draw the sector
        self.update()
        self._post_data()