Exemplo n.º 1
0
 def test_plot_line2d_roi(self, space):
     im = self.im
     objs = _transpose_space(im=im, space=space)
     p = roi.Line2DROI(x1=0.01, y1=0.01, x2=0.1, y2=0.03)
     p.add_widget(signal=objs["im"], axes=objs["axes"], color="cyan")
     p2 = roi.Line2DROI(x1=0.03, y1=0.015, x2=0.3, y2=0.03, linewidth=0.2)
     with pytest.raises(ValueError):
         p2.add_widget(signal=objs["im"], axes=objs["axes"])
     return objs["figure"]
Exemplo n.º 2
0
def test_snapping_axis_values(snap):
    s = Signal2D(np.arange(100).reshape(10, 10))
    s.axes_manager[0].offset = 5

    r = roi.Line2DROI(x1=6, y1=0, x2=12, y2=4, linewidth=0)
    s.plot()
    _ = r.interactive(s, snap=snap)
Exemplo n.º 3
0
    def test_plot_line2d_roi_linewidth(self):
        im = self.im
        for axis in im.axes_manager.signal_axes:
            axis.scale = 0.1
        objs = _transpose_space(im=im, space='signal')
        p = roi.Line2DROI(x1=0.3, y1=0.5, x2=6.0, y2=3.0, linewidth=0.5)
        p.add_widget(signal=objs["im"], axes=objs["axes"])

        p2 = roi.Line2DROI(x1=2.0, y1=0.5, x2=8.0, y2=3.0, linewidth=0.1)
        p2.add_widget(signal=objs["im"], axes=objs["axes"])
        widget2 = list(p2.widgets)[0]
        widget2.decrease_size()
        assert widget2.size == (0.0, )
        widget2.increase_size()
        assert widget2.size == (0.1, )

        p3 = roi.Line2DROI(x1=3.5, y1=0.5, x2=9.5, y2=3.0, linewidth=0.1)
        p3.add_widget(signal=objs["im"], axes=objs["axes"])
        widget3 = list(p3.widgets)[0]
        widget3.decrease_size()
        assert widget3.size == (0.0, )

        return objs["figure"]
Exemplo n.º 4
0
 def test_plot_line2d_roi(self, space):
     objs = _transpose_space(im=self.im, space=space)
     p = roi.Line2DROI(x1=0.01, y1=0.01, x2=0.1, y2=0.03)
     p.add_widget(signal=objs["im"], axes=objs["axes"], color="cyan")
     return objs["figure"]