stellar_parameters.py 文件源码

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

项目:smhr 作者: andycasey 项目源码 文件源码
def figure_mouse_pick(self, event):
        """
        Trigger for when the mouse is used to select an item in the figure.

        :param event:
            The matplotlib event.
        """

        ycol = "abundance"
        xcol = {
            self.ax_excitation_twin: "expot",
            self.ax_line_strength_twin: "reduced_equivalent_width"
        }[event.inaxes]

        xscale = np.ptp(event.inaxes.get_xlim())
        yscale = np.ptp(event.inaxes.get_ylim())
        try:
            distance = np.sqrt(
                    ((self._state_transitions[ycol] - event.ydata)/yscale)**2 \
                +   ((self._state_transitions[xcol] - event.xdata)/xscale)**2)
        except AttributeError:
            # Stellar parameters have not been measured yet
            return None

        index = np.nanargmin(distance)

        # Because the state transitions are linked to the parent source model of
        # the table view, we will have to get the proxy index.
        proxy_index = self.table_view.model().mapFromSource(
            self.proxy_spectral_models.sourceModel().createIndex(index, 0)).row()

        self.table_view.selectRow(proxy_index)
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号