def __init__(self, base, axes, color='black', zorder=5, r=1.0, theta=math.pi / 4): """ """ _BaseInteractor.__init__(self, base, axes, color=color) self.markers = [] self.axes = axes self.save_theta = theta self.theta = theta self.radius = r self.scale = 10.0 # Inner circle x1 = self.radius * math.cos(self.theta) y1 = self.radius * math.sin(self.theta) x2 = -1 * self.radius * math.cos(self.theta) y2 = -1 * self.radius * math.sin(self.theta) # Inner circle marker self.inner_marker = self.axes.plot([x1 / 2.5], [y1 / 2.5], linestyle='', marker='s', markersize=10, color=self.color, alpha=0.6, pickradius=5, label="pick", zorder=zorder, visible=True)[0] self.line = self.axes.plot([x1, x2], [y1, y2], linestyle='-', marker='', color=self.color, visible=True)[0] self.npts = 20 self.has_move = False self.connect_markers([self.inner_marker, self.line]) self.update()
def __init__(self, base, axes, color='black', zorder=5, arc1=None, arc2=None, theta=math.pi / 8): """ """ _BaseInteractor.__init__(self, base, axes, color=color) self.markers = [] self.axes = axes self.r1 = arc1.get_radius() self.r2 = arc2.get_radius() self.theta = theta self.save_theta = theta self.move_stop = False self.theta_left = None self.theta_right = None self.arc1 = arc1 self.arc2 = arc2 x1 = self.r1 * math.cos(self.theta) y1 = self.r1 * math.sin(self.theta) x2 = self.r2 * math.cos(self.theta) y2 = self.r2 * math.sin(self.theta) self.line = self.axes.plot([x1, x2], [y1, y2], linestyle='-', marker='', color=self.color, visible=True)[0] self.phi = theta self.npts = 20 self.has_move = False self.connect_markers([self.line]) self.update()
def __init__(self, base, axes, color='grey', zorder=3, side=None): """ :param: the color of the line that defined the ring :param r: the radius of the ring :param sign: the direction of motion the the marker """ _BaseInteractor.__init__(self, base, axes, color=color) self.markers = [] self.axes = axes self.base = base self.is_inside = side self.qmax = min(math.fabs(self.base.data.xmax), math.fabs(self.base.data.xmin)) # must be positive self.connect = self.base.connect # Cursor position of Rings (Left(-1) or Right(1)) self.xmaxd = self.base.data.xmax self.xmind = self.base.data.xmin if (self.xmaxd + self.xmind) > 0: self.sign = 1 else: self.sign = -1 # Inner circle self.outer_circle = RingInteractor(self, self.base.subplot, 'blue', zorder=zorder + 1, r=self.qmax / 1.8, sign=self.sign) self.outer_circle.qmax = self.qmax * 1.2 self.update() self._post_data()
def __init__(self, base, axes, color='black', zorder=5, x=0.5, y=0.5, center_x=0.0, center_y=0.0): _BaseInteractor.__init__(self, base, axes, color=color) # # Initialization the class self.markers = [] self.axes = axes # # Center coordinates self.center_x = center_x self.center_y = center_y self.y1 = y + self.center_y self.save_y1 = self.y1 delta = self.y1 - self.center_y self.y2 = self.center_y - delta self.save_y2 = self.y2 self.x1 = x + self.center_x self.save_x1 = self.x1 delta = self.x1 - self.center_x self.x2 = self.center_x - delta self.save_x2 = self.x2 self.color = color self.half_height = math.fabs(y) self.save_half_height = math.fabs(y) self.half_width = math.fabs(x) self.save_half_width = math.fabs(x) self.top_marker = self.axes.plot([0], [self.y1], linestyle='', marker='s', markersize=10, color=self.color, alpha=0.6, pickradius=5, label="pick", zorder=zorder, visible=True)[0] # Define 2 horizotnal lines self.top_line = self.axes.plot([self.x1, -self.x1], [self.y1, self.y1], linestyle='-', marker='', color=self.color, visible=True)[0] self.bottom_line = self.axes.plot([self.x1, -self.x1], [self.y2, self.y2], linestyle='-', marker='', color=self.color, visible=True)[0] # # Flag to determine if the lines have moved self.has_move = False # # connection the marker and draw the pictures self.connect_markers([self.top_marker]) self.update()
def __init__(self, base, axes, color='black', zorder=5, x=0.5, y=0.5): """ """ _BaseInteractor.__init__(self, base, axes, color=color) self.markers = [] self.axes = axes self.x = math.fabs(x) self.save_x = self.x self.y = math.fabs(y) self.save_y = y # Inner circle marker self.inner_marker = self.axes.plot([self.x], [0], linestyle='', marker='s', markersize=10, color=self.color, alpha=0.6, pickradius=5, label="pick", zorder=zorder, visible=True)[0] self.right_line = self.axes.plot([self.x, self.x], [self.y, -self.y], linestyle='-', marker='', color=self.color, visible=True)[0] self.left_line = self.axes.plot([-self.x, -self.x], [self.y, -self.y], linestyle='-', marker='', color=self.color, visible=True)[0] self.has_move = False self.connect_markers([self.right_line, self.inner_marker]) self.update()
def __init__(self, base, axes, color='black', zorder=5, x=0.5, y=0.5): """ """ _BaseInteractor.__init__(self, base, axes, color=color) # #Class initialization self.markers = [] self.axes = axes # # Saving the end points of two lines self.x = x self.save_x = x self.y = y self.save_y = y # # Creating a marker # Inner circle marker self.inner_marker = self.axes.plot([0], [self.y], linestyle='', marker='s', markersize=10, color=self.color, alpha=0.6, pickradius=5, label="pick", zorder=zorder, visible=True)[0] # # Define 2 horizontal lines self.top_line = self.axes.plot([self.x, -self.x], [self.y, self.y], linestyle='-', marker='', color=self.color, visible=True)[0] self.bottom_line = self.axes.plot([self.x, -self.x], [-self.y, -self.y], linestyle='-', marker='', color=self.color, visible=True)[0] # # Flag to check the motion of the lines self.has_move = False # # Connecting markers to mouse events and draw self.connect_markers([self.top_line, self.inner_marker]) self.update()
def __init__(self, base, axes, color='black', zorder=5, center_x=0.0, center_y=0.0): """ """ _BaseInteractor.__init__(self, base, axes, color=color) # # Initialization the class self.markers = [] self.axes = axes # center coordinates self.x = center_x self.y = center_y # # saved value of the center coordinates self.save_x = center_x self.save_y = center_y # # Create a marker self.center_marker = self.axes.plot([self.x], [self.y], linestyle='', marker='s', markersize=10, color=self.color, alpha=0.6, pickradius=5, label="pick", zorder=zorder, visible=True)[0] # # Draw a point self.center = self.axes.plot([self.x], [self.y], linestyle='-', marker='', color=self.color, visible=True)[0] # # Flag to determine the motion this point self.has_move = False # # connecting the marker to allow them to move self.connect_markers([self.center_marker]) # # Update the figure self.update()
def __init__(self, base, axes, color='black', zorder=5, r=1.0, theta1=math.pi / 8, theta2=math.pi / 4): _BaseInteractor.__init__(self, base, axes, color=color) self.markers = [] self.axes = axes self._mouse_x = r self._mouse_y = 0 self._save_x = r self._save_y = 0 self.scale = 10.0 self.theta1 = theta1 self.theta2 = theta2 self.radius = r [self.arc] = self.axes.plot([], [], linestyle='-', marker='', color=self.color) self.npts = 20 self.has_move = False self.connect_markers([self.arc]) self.update()
def __init__(self, base, axes, color='black', zorder=3): _BaseInteractor.__init__(self, base, axes, color=color) self.markers = [] self.axes = axes self.base = base self.qmax = min(math.fabs(self.base.data2D.xmax), math.fabs(self.base.data2D.xmin)) # must be positive self.connect = self.base.connect # # Number of points on the plot self.nbins = 36 # Cursor position of Rings (Left(-1) or Right(1)) self.xmaxd = self.base.data2D.xmax self.xmind = self.base.data2D.xmin if (self.xmaxd + self.xmind) > 0: self.sign = 1 else: self.sign = -1 # Inner circle self.inner_circle = RingInteractor(self, self.base.subplot, zorder=zorder, r=self.qmax / 2.0, sign=self.sign) self.inner_circle.qmax = self.qmax self.outer_circle = RingInteractor(self, self.base.subplot, zorder=zorder + 1, r=self.qmax / 1.8, sign=self.sign) self.outer_circle.qmax = self.qmax * 1.2 self.update() self._post_data() # Bind to slice parameter events self.base.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
def __init__(self, base, axes, color='black', zorder=5, r=1.0, sign=1): """ :param: the color of the line that defined the ring :param r: the radius of the ring :param sign: the direction of motion the the marker """ _BaseInteractor.__init__(self, base, axes, color=color) self.markers = [] self.axes = axes # Current radius of the ring self._inner_mouse_x = r # Value of the center of the ring self._inner_mouse_y = 0 # previous value of that radius self._inner_save_x = r # Save value of the center of the ring self._inner_save_y = 0 # Class instantiating RingIterator class self.base = base # the direction of the motion of the marker self.sign = sign # # Create a marker try: # Inner circle marker x_value = [self.sign * math.fabs(self._inner_mouse_x)] self.inner_marker = self.axes.plot(x_value, [0], linestyle='', marker='s', markersize=10, color=self.color, alpha=0.6, pickradius=5, label="pick", zorder=zorder, visible=True)[0] except: x_value = [self.sign * math.fabs(self._inner_mouse_x)] self.inner_marker = self.axes.plot(x_value, [0], linestyle='', marker='s', markersize=10, color=self.color, alpha=0.6, label="pick", visible=True)[0] message = "\nTHIS PROTOTYPE NEEDS THE LATEST" message += " VERSION OF MATPLOTLIB\n" message += "Get the SVN version that is at " message += " least as recent as June 1, 2007" owner = self.base.base.parent wx.PostEvent(owner, StatusEvent(status="AnnulusSlicer: %s" % message)) # Draw a circle [self.inner_circle] = self.axes.plot([], [], linestyle='-', marker='', color=self.color) # the number of points that make the ring line self.npts = 40 self.connect_markers([self.inner_marker]) self.update()
def __init__(self, base, axes, color='black', zorder=3): _BaseInteractor.__init__(self, base, axes, color=color) ## Class initialization self.markers = [] self.axes = axes ## connect the plot to event self.connect = self.base.connect ## compute qmax limit to reset the graph x = math.pow( max(self.base.data2D.xmax, math.fabs(self.base.data2D.xmin)), 2) y = math.pow( max(self.base.data2D.ymax, math.fabs(self.base.data2D.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 # Binning base for log/lin binning self.bin_base = 0 ## 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='black', 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='black', 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() ## Bind to slice parameter events self.base.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
def __init__(self, base, axes, color='black', zorder=5, r=1.0, phi=math.pi / 4, theta2=math.pi / 3): """ """ _BaseInteractor.__init__(self, base, axes, color=color) ## Initialize the class self.markers = [] self.axes = axes ## compute the value of the angle between the current line and ## the x-axis self.save_theta = theta2 + phi self.theta = theta2 + phi ## the value of the middle line angle with respect to the x-axis self.theta2 = theta2 ## Radius to find polar coordinates this line's endpoints self.radius = r ## phi is the phase between the current line and the middle line self.phi = phi ## End points polar coordinates x1 = self.radius * math.cos(self.theta) y1 = self.radius * math.sin(self.theta) x2 = -1 * self.radius * math.cos(self.theta) y2 = -1 * self.radius * math.sin(self.theta) ## defining a new marker self.inner_marker = self.axes.plot([x1 / 2.5], [y1 / 2.5], linestyle='', marker='s', markersize=10, color=self.color, alpha=0.6, pickradius=5, label="pick", zorder=zorder, visible=True)[0] ## Defining the current line self.line = self.axes.plot([x1, x2], [y1, y2], linestyle='-', marker='', color=self.color, visible=True)[0] ## Flag to differentiate the left line from the right line motion self.left_moving = False ## Flag to define a motion self.has_move = False ## connecting markers and draw the picture self.connect_markers([self.inner_marker, self.line])
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()
def __init__(self, base, axes, color='black', zorder=5, x=0.5, y=0.5, center_x=0.0, center_y=0.0): """ """ _BaseInteractor.__init__(self, base, axes, color=color) # # Initialization the class self.markers = [] self.axes = axes # # Center coordinates self.center_x = center_x self.center_y = center_y # # defined end points vertical lignes and their saved values self.y1 = y + self.center_y self.save_y1 = self.y1 delta = self.y1 - self.center_y self.y2 = self.center_y - delta self.save_y2 = self.y2 self.x1 = x + self.center_x self.save_x1 = self.x1 delta = self.x1 - self.center_x self.x2 = self.center_x - delta self.save_x2 = self.x2 # # save the color of the line self.color = color # # the height of the rectangle self.half_height = math.fabs(y) self.save_half_height = math.fabs(y) # # the with of the rectangle self.half_width = math.fabs(self.x1 - self.x2) / 2 self.save_half_width = math.fabs(self.x1 - self.x2) / 2 # # Create marker self.right_marker = self.axes.plot([self.x1], [0], linestyle='', marker='s', markersize=10, color=self.color, alpha=0.6, pickradius=5, label="pick", zorder=zorder, visible=True)[0] # # define the left and right lines of the rectangle self.right_line = self.axes.plot([self.x1, self.x1], [self.y1, self.y2], linestyle='-', marker='', color=self.color, visible=True)[0] self.left_line = self.axes.plot([self.x2, self.x2], [self.y1, self.y2], linestyle='-', marker='', color=self.color, visible=True)[0] # # Flag to determine if the lines have moved self.has_move = False # # connection the marker and draw the pictures self.connect_markers([self.right_marker]) self.update()
def __init__(self, base, axes, color='black', zorder=3): """ """ _BaseInteractor.__init__(self, base, axes, color=color) self.markers = [] self.axes = axes self.qmax = self.base.data2D.xmax self.connect = self.base.connect # # Number of points on the plot self.nbins = 20 theta1 = 2 * math.pi / 3 theta2 = -2 * math.pi / 3 # Inner circle from Arc import ArcInteractor self.inner_circle = ArcInteractor(self, self.base.subplot, zorder=zorder, r=self.qmax / 2.0, theta1=theta1, theta2=theta2) self.inner_circle.qmax = self.qmax self.outer_circle = ArcInteractor(self, self.base.subplot, zorder=zorder + 1, r=self.qmax / 1.8, theta1=theta1, theta2=theta2) self.outer_circle.qmax = self.qmax * 1.2 # self.outer_circle.set_cursor(self.base.qmax/1.8, 0) from Edge import RadiusInteractor self.right_edge = RadiusInteractor(self, self.base.subplot, zorder=zorder + 1, arc1=self.inner_circle, arc2=self.outer_circle, theta=theta1) self.left_edge = RadiusInteractor(self, self.base.subplot, zorder=zorder + 1, arc1=self.inner_circle, arc2=self.outer_circle, theta=theta2) self.update() self._post_data() # Bind to slice parameter events self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
def __init__(self, base, axes, color='black', zorder=3): _BaseInteractor.__init__(self, base, axes, color=color) # # Class initialization self.markers = [] self.axes = axes # #connecting artist self.connect = self.base.connect # # which direction is the preferred interaction direction self.direction = None # # determine x y values self.x = 0.5 * min(math.fabs(self.base.data2D.xmax), math.fabs(self.base.data2D.xmin)) self.y = 0.5 * min(math.fabs(self.base.data2D.xmax), math.fabs(self.base.data2D.xmin)) # # when reach qmax reset the graph self.qmax = max(self.base.data2D.xmax, self.base.data2D.xmin, self.base.data2D.ymax, self.base.data2D.ymin) # # Number of points on the plot self.nbins = 30 # # If True, I(|Q|) will be return, otherwise, # negative q-values are allowed self.fold = True # # reference of the current Slab averaging self.averager = None # # Create vertical and horizaontal lines for the rectangle self.vertical_lines = VerticalLines(self, self.base.subplot, color='blue', zorder=zorder, y=self.y, x=self.x) self.vertical_lines.qmax = self.qmax self.horizontal_lines = HorizontalLines(self, self.base.subplot, color='green', zorder=zorder, x=self.x, y=self.y) self.horizontal_lines.qmax = self.qmax # # draw the rectangle and plost the data 1D resulting # # of averaging data2D self.update() self._post_data() # # Bind to slice parameter events self.base.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
def __init__(self, base, axes, color='black', zorder=3, id=''): """ """ _BaseInteractor.__init__(self, base, axes, color=color) self.zorder = zorder self.id = id self.color = color self.colorlist = ['b', 'g', 'r', 'c', 'm', 'y', 'k'] self.symbollist = ['o', 'x', '^', 'v', '<', '>', '+', 's', 'd', 'D', 'h', 'H', 'p', '-', '--', 'vline', 'step'] self.markersize = None self.marker = None self.marker2 = None self._button_down = False self._context_menu = False self._dragged = False self.connect_markers([self.axes])
def __init__(self, base, axes, color='black', zorder=3, id=''): """ """ _BaseInteractor.__init__(self, base, axes, color=color) self.zorder = zorder self.id = id self.color = color self.colorlist = ['b', 'g', 'r', 'c', 'm', 'y', 'k'] self.symbollist = [ 'o', 'x', '^', 'v', '<', '>', '+', 's', 'd', 'D', 'h', 'H', 'p', '-', '--', 'vline', 'step' ] self.markersize = None self.marker = None self.marker2 = None self._button_down = False self._context_menu = False self._dragged = False self.connect_markers([self.axes])
def __init__(self, base, axes, color='black', zorder=3): _BaseInteractor.__init__(self, base, axes, color=color) ## Class initialization self.markers = [] self.axes = axes ## connect the plot to event self.connect = self.base.connect ## compute qmax limit to reset the graph x = math.pow(max(self.base.data2D.xmax, math.fabs(self.base.data2D.xmin)), 2) y = math.pow(max(self.base.data2D.ymax, math.fabs(self.base.data2D.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='black', 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='black', 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() ## Bind to slice parameter events self.base.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
def __init__(self, base, axes, color='black', zorder=3, x_min=0.008, x_max=0.008, y_min=0.0025, y_max=0.0025): """ """ _BaseInteractor.__init__(self, base, axes, color=color) # # class initialization # # list of Boxsmun markers self.markers = [] self.axes = axes # # connect the artist for the motion self.connect = self.base.connect # # when qmax is reached the selected line is reset the its previous value self.qmax = min(self.base.data2D.xmax, self.base.data2D.xmin) # # Define the boxsum limits self.xmin = -1 * 0.5 * min(math.fabs(self.base.data2D.xmax), math.fabs(self.base.data2D.xmin)) self.ymin = -1 * 0.5 * min(math.fabs(self.base.data2D.xmax), math.fabs(self.base.data2D.xmin)) self.xmax = 0.5 * min(math.fabs(self.base.data2D.xmax), math.fabs(self.base.data2D.xmin)) self.ymax = 0.5 * min(math.fabs(self.base.data2D.xmax), math.fabs(self.base.data2D.xmin)) # # center of the boxSum self.center_x = 0.0002 self.center_y = 0.0003 # # Number of points on the plot self.nbins = 20 # # Define initial result the summation self.count = 0 self.error = 0 self.total = 0 self.totalerror = 0 self.points = 0 # # Flag to determine if the current figure has moved # # set to False == no motion , set to True== motion self.has_move = False # # Create Boxsum edges self.horizontal_lines = HorizontalDoubleLine(self, self.base.subplot, color='blue', zorder=zorder, y=self.ymax, x=self.xmax, center_x=self.center_x, center_y=self.center_y) self.horizontal_lines.qmax = self.qmax self.vertical_lines = VerticalDoubleLine(self, self.base.subplot, color='black', zorder=zorder, y=self.ymax, x=self.xmax, center_x=self.center_x, center_y=self.center_y) self.vertical_lines.qmax = self.qmax self.center = PointInteractor(self, self.base.subplot, color='grey', zorder=zorder, center_x=self.center_x, center_y=self.center_y) # # Save the name of the slicer panel associate with this slicer self.panel_name = "" # # Update and post slicer parameters self.update() self._post_data() # # Bind to slice parameter events self.base.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)