overview_plot.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:BRITE-data-reduction-tool 作者: Ashoka42 项目源码 文件源码
def on_pick(self, event):
        # Checks the lenght of the event.ind (how much points are selected)
        N = len(event.ind)
        # If nothing was selected - exits function
        if not N:
            return True
        # If multiple points were selected (overlapping of the circles) - informs
        # the user and exits function - needs to exit function, because not a
        # unique datapoints can be (or was) selected - so no informations can
        # be displayed - also throws an exception/error!
        if N > 1:
            print
            "Multiple objects lie within selection range. Zoome in to select a single object!"
            return True

            # Gets the location of that click
        x = event.mouseevent.xdata
        y = event.mouseevent.ydata

        # Calculates the distance - hypothenuse
        distances = np.hypot(x - self.c[event.ind[0]], y - self.d[event.ind[0]])
        # Returns the indices of the minimum values along an axis
        indmin = distances.argmin()
        # Gets the data index of the selected data
        dataind = event.ind[indmin]

        # If CTRL is pressed
        if self.ctrl_on == True:
            # Sets the index of the data which should be removed
            self.remi = dataind
        else:
            # Updates the variable if no change was made
            self.lastind = dataind

        # Calls the update function and sets the removal variable afterwards
        self.update()
        self.remi = -1

    # Updating the plot
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号