Example #1
0
    def setup_method(self, method):

        self.setup_data()

        session = simple_session()
        session.data_collection.append(self.data)

        self.image = ImageWidget(session)
        self.image.add_data(self.data)
        self.image.data = self.data
        self.image.attribute = self.data.id['x']
        self.mode = self.image.toolbar.tools['spectrum']
        self.tool = self.mode._tool
        self.tool.show = lambda *args: None
Example #2
0
    def setup_method(self, method):

        self.setup_data()

        session = simple_session()
        session.data_collection.append(self.data)

        self.image = ImageWidget(session)
        self.image.add_data(self.data)
        self.image.data = self.data
        self.image.attribute = self.data.id['x']
        for tool in self.image._tools:
            if isinstance(tool, SpectrumTool):
                self.tool = tool
                break
        else:
            raise Exception("SpectrumTool not found")
        self.tool.show = lambda *args: None
Example #3
0
class BaseTestSpectrumTool(object):
    def setup_data(self):
        self.data = Data(x=np.zeros((3, 3, 3)))

    def setup_method(self, method):

        self.setup_data()

        session = simple_session()
        session.data_collection.append(self.data)

        self.image = ImageWidget(session)
        self.image.add_data(self.data)
        self.image.data = self.data
        self.image.attribute = self.data.id['x']
        self.mode = self.image.toolbar.tools['spectrum']
        self.tool = self.mode._tool
        self.tool.show = lambda *args: None
Example #4
0
class BaseTestSpectrumTool(object):

    def setup_data(self):
        self.data = Data(x=np.zeros((3, 3, 3)))

    def setup_method(self, method):

        self.setup_data()

        session = simple_session()
        session.data_collection.append(self.data)

        self.image = ImageWidget(session)
        self.image.add_data(self.data)
        self.image.data = self.data
        self.image.attribute = self.data.id['x']
        self.mode = self.image.toolbar.tools['spectrum']
        self.tool = self.mode._tool
        self.tool.show = lambda *args: None
Example #5
0
def test_resample_on_zoom():

    # For images where the aspect ratio of pixels is fixed to be square, when
    # the user zooms in, the limits of the axes are actually changed twice by
    # matplotlib - a second time when the aspect ratio is enforced. So we need
    # to make sure that we update the modest_image when this is the case.

    session = simple_session()

    np.random.seed(12345)

    data = Data(x=np.random.random((2048, 2048)), label='image')
    session.data_collection.append(data)

    image = ImageWidget(session=session)
    image.add_data(data)

    image.show()

    image.axes.figure.canvas.key_press_event('o')
    image.axes.figure.canvas.button_press_event(200, 200, 1)
    image.axes.figure.canvas.motion_notify_event(400, 210)
    image.axes.figure.canvas.button_release_event(400, 210, 1)

    return image.axes.figure
Example #6
0
class BaseTestSpectrumTool(object):
    def setup_data(self):
        self.data = Data(x=np.zeros((3, 3, 3)))

    def setup_method(self, method):

        self.setup_data()

        session = simple_session()
        session.data_collection.append(self.data)

        self.image = ImageWidget(session)
        self.image.add_data(self.data)
        self.image.data = self.data
        self.image.attribute = self.data.id["x"]
        for tool in self.image._tools:
            if isinstance(tool, SpectrumTool):
                self.tool = tool
                break
        else:
            raise Exception("SpectrumTool not found")
        self.tool.show = lambda *args: None
Example #7
0
    def setup_method(self, method):

        self.setup_data()

        session = simple_session()
        session.data_collection.append(self.data)

        self.image = ImageWidget(session)
        self.image.add_data(self.data)
        self.image.data = self.data
        self.image.attribute = self.data.id['x']
        self.mode = self.image.toolbar.tools['spectrum']
        self.tool = self.mode._tool
        self.tool.show = lambda *args: None
Example #8
0
    def setup_method(self, method):

        self.setup_data()

        session = simple_session()
        session.data_collection.append(self.data)

        self.image = ImageWidget(session)
        self.image.add_data(self.data)
        self.image.data = self.data
        self.image.attribute = self.data.id['x']
        for tool in self.image._tools:
            if isinstance(tool, SpectrumTool):
                self.tool = tool
                break
        else:
            raise Exception("SpectrumTool not found")
        self.tool.show = lambda *args: None