Example #1
0
    def _delete_nearest(self, x, y):
        """Deletes point nearest to (x, y) (actually ignores the y)"""

        sp = self._spectrum
        if sp is not None:
            pp = self._points

            if len(pp) < 3:
                self.add_log_error("Need at least two points")
                return

            xx, _ = zip(*pp)
            index = a99.index_nearest(xx, x)
            del pp[index]

            self._update_gui()
Example #2
0
    def _delete_nearest(self, x, y):
        """Deletes point nearest to (x, y) (actually ignores the y)"""

        cuum = self._get_continuum()
        if cuum is None:
            return
        pp = cuum["points"]

        if len(pp) == 0:
            return

        xx, _ = zip(*pp)
        index = a99.index_nearest(xx, x)
        del pp[index]

        self._draw()
        self.changed.emit()
Example #3
0
    def _on_plot_click(self, event):
        print('%s click: button=%d, x=%d, y=%d, xdata=%f, ydata=%f' %
              ('double' if event.dblclick else 'single', event.button, event.x,
               event.y, event.xdata, event.ydata))

        x, y = event.xdata, event.ydata
        sp = self.spectrum
        print("XXXXXXXXX {} YYYYYYYYYY {}".format(x, y))

        if sp is not None:

            idx = a99.index_nearest(sp.x, x)
            print("Lambda is actually {}".format(sp.x[idx]))

        if event.button == 1:
            self._insert_point(x, y)
        elif event.button == 3:
            self._delete_nearest(x, y)
Example #4
0
    def _on_plot_click(self, event):
        print('{} click: button={}, x={}, y={}, xdata={}, ydata={}'.format(
              'double' if event.dblclick else 'single', event.button,
               event.x, event.y, event.xdata, event.ydata))

        x, y = event.xdata, event.ydata

        if x is None:
            return

        sp = self.spectrum
        if sp is not None:
            idx = a99.index_nearest(sp.x, x)
            print("Lambda is actually {}".format(sp.x[idx]))

        if event.button == 1:
            self._insert_point(x, y)
        elif event.button == 3:
            self._delete_nearest(x, y)
Example #5
0
 def on_plot_click(self, event):
     lambda_ = event.xdata
     if lambda_ is not None and self.form_lines is not None:
         idx = a99.index_nearest(self.atom.lambda_, lambda_)
         self.form_lines.set_row(idx)