class TestPlugin(GUIPlugin):
    name = "catalogtest"

    def __init__(self):
        self.imageview = XArrayView()

        self.stages = {
            "Stage 1": GUILayout(self.imageview),
        }

        super(TestPlugin, self).__init__()

    def appendCatalog(self, runcatalog, **kwargs):
        xdata = runcatalog().primary.read()["random_img"][:, :, :, 0]  # The test data is 4-dimensional; ignoring last dim
        self.imageview.setImage(MetaXArray(xdata))

    def appendHeader(self):
        ...
Esempio n. 2
0
class CatalogViewerPlugin(GUIPlugin):
    name = 'Catalog Viewer'

    def __init__(self):
        self.imageview = XArrayView()

        self.stages = {
            'Viewer': GUILayout(self.imageview),
        }

        super(CatalogViewerPlugin, self).__init__()

    def appendCatalog(self, runcatalog, **kwargs):
        xdata = runcatalog().primary.to_dask()['fccd_image'].data[
            0, :, :, :]  # The test data is 4-dimensional; ignoring last dim
        self.imageview.setImage(MetaXArray(xdata))

    def appendHeader(self):
        ...
Esempio n. 3
0
def test_xarrayview(qtbot):
    from xicam.gui.widgets.imageviewmixins import XArrayView
    from xarray import DataArray
    import numpy as np

    data = np.random.random((
        100,
        10,
        10,
    ))
    xdata = DataArray(data,
                      dims=['E (eV)', 'y (μm)', 'x (μm)'],
                      coords=[
                          np.arange(100) * 100,
                          np.arange(10) / 10.,
                          np.arange(10) / 10.
                      ])

    w = XArrayView()

    w.setImage(xdata)

    w.show()