Ejemplo n.º 1
0
    def imshow(self, x, y, data, title=None, cmap="RdYlGn"):
        """
        Create 2D xyimage for guiqwt image dialog



        Returns
        --------
        plot : guiqwt.image.ImagePlot
          Plot widget in guiqwt ImageDialog
        image : guiqwt.image.XYImageItem
           Newly created image object
        """
        from guiqwt.builder import make
        image = make.xyimage(
            x,
            y,
            data,
            interpolation="nearest",
            title=title,
        )
        plot = self.win.get_plot()
        plot.add_item(image)
        plot.do_autoscale()
        plot.replot()
        image.set_color_map(cmap)
        image.measurement = None

        return plot, image
Ejemplo n.º 2
0
    def replot_measurement(self):
        """
        Recreate theimage for the currently selected image. Taking into account
        any changed operations. Called when operations_widget.operations_changed
        is emitted
        """
        plot_item, plot_item_idx = self._get_current_plot_item()
        if plot_item is None:
            return False

        m = plot_item.measurement
        m.operations = self.operations_widget.get_operations()
        m.process()

        # recreate the image (this handles sorting of data and other bla)
        from guiqwt.builder import make
        image = make.xyimage(m.X[:, 0],
                             m.Y[0, :],
                             m.Z.T,
                             interpolation="nearest",
                             title=m.metadata["title"])

        # update image to the new data values
        plot_item.set_data(image.data)
        plot_item.set_xy(image.x, image.y)
        plot_item.plot().replot()
Ejemplo n.º 3
0
    def setup_widget(self):

        self.plot = ImagePlot(self)
        self.image = make.xyimage(self.x, self.y, self.data, colormap='jet')
        self.plot.add_item(self.image)
        self.plot.set_antialiasing(True)

        vlayout = QVBoxLayout()
        vlayout.addWidget(self.plot)
        self.setLayout(vlayout)
Ejemplo n.º 4
0
def imshow( x, y, data ):
    win = ImageDialog(edit=False, toolbar=True,
                      wintitle="Image with custom X/Y axes scales",
                      options=dict(xlabel="x (a.u.)", ylabel="y (a.u.)",
                                   yreverse=False))
    item = make.xyimage(x, y, data)
    plot = win.get_plot()
    plot.add_item(item)
    win.show()
    win.exec_()
Ejemplo n.º 5
0
def imshow(x, y, data, filter_area, yreverse=True):
    win = ImageDialog(edit=False, toolbar=True, wintitle="Image filter demo",
                      options=dict(xlabel="x (cm)", ylabel="y (cm)",
                                   yreverse=yreverse))
    image = make.xyimage(x, y, data)
    plot = win.get_plot()
    plot.add_item(image)
    xmin, xmax, ymin, ymax = filter_area
    flt = make.imagefilter(xmin, xmax, ymin, ymax, image,
                           filter=lambda x, y, data: gaussian_filter(data, 5))
    plot.add_item(flt, z=1)
    plot.replot()
    win.show()
    win.exec_()
Ejemplo n.º 6
0
def xyimagebug(offset):
    from guiqwt.plot import ImageDialog
    from guiqwt.builder import make
    import numpy
    import guidata
    app = guidata.qapplication()
    data = numpy.random.rand(100, 100)
    x = numpy.arange(100)+offset 
    y = numpy.arange(100)
    image = make.xyimage(x, y, data=data)
    win = ImageDialog()
    plot = win.get_plot()
    plot.add_item(image)
    plot.select_item(image) #this helps in seeing where the image should be
    win.exec_()
Ejemplo n.º 7
0
def xyimagebug(offset):
    from guiqwt.plot import ImageDialog
    from guiqwt.builder import make
    import numpy
    import guidata
    app = guidata.qapplication()
    data = numpy.random.rand(100, 100)
    x = numpy.arange(100)+offset 
    y = numpy.arange(100)
    image = make.xyimage(x, y, data=data)
    win = ImageDialog()
    plot = win.get_plot()
    plot.add_item(image)
    plot.select_item(image) #this helps in seeing where the image should be
    win.exec_()
Ejemplo n.º 8
0
def plotImage(x,y,z,wintitle="Contour Plot",options={"lock_aspect_ratio":False,"yreverse":False}):
    options.update(dict(show_xsection=True, show_ysection=True))
    """Test"""
    # -- Create QApplication    
    _app = guidata.qapplication()
    # --
    win = ImageDialog(edit=True, toolbar=True, wintitle=wintitle,
                      options=options)
    win.resize(1500, 1000)
    item = make.xyimage(x, y, z,interpolation="linear")    
    plot = win.get_plot()
    plot.add_item(item)        
    win.plot_widget.xcsw_splitter.setSizes([400,600])
    win.show()
    return win
Ejemplo n.º 9
0
    def setup_widget(self):

        self.plot = ImagePlot(self)
        self.image = make.xyimage(self.x, self.y, self.data, colormap='jet')
        self.plot.add_item(self.image)
        self.plot.set_antialiasing(True)
        #--- levels ?
        for i in range(8):
            x = self.level_xy[i][0]
            y = self.level_xy[i][1]
            self.levels.append(make.curve(x, y, color="w"))
            self.plot.add_item(self.levels[-1])
        #----------------------
        vlayout = QVBoxLayout()
        vlayout.addWidget(self.plot)
        self.setLayout(vlayout)
        self.plot.adjustSize()
Ejemplo n.º 10
0
def imshow(x, y, data, filter_area, yreverse=True):
    win = ImageDialog(edit=False,
                      toolbar=True,
                      wintitle="Image filter demo",
                      options=dict(xlabel="x (cm)",
                                   ylabel="y (cm)",
                                   yreverse=yreverse))
    image = make.xyimage(x, y, data)
    plot = win.get_plot()
    plot.add_item(image)
    xmin, xmax, ymin, ymax = filter_area
    flt = make.imagefilter(xmin,
                           xmax,
                           ymin,
                           ymax,
                           image,
                           filter=lambda x, y, data: gaussian_filter(data, 5))
    plot.add_item(flt, z=1)
    plot.replot()
    win.show()
    win.exec_()
Ejemplo n.º 11
0
def plotImage(x,
              y,
              z,
              wintitle="Contour Plot",
              options={
                  "lock_aspect_ratio": False,
                  "yreverse": False
              }):
    options.update(dict(show_xsection=True, show_ysection=True))
    """Test"""
    # -- Create QApplication
    _app = guidata.qapplication()
    # --
    win = ImageDialog(edit=True,
                      toolbar=True,
                      wintitle=wintitle,
                      options=options)
    win.resize(1500, 1000)
    item = make.xyimage(x, y, z, interpolation="linear")
    plot = win.get_plot()
    plot.add_item(item)
    win.plot_widget.xcsw_splitter.setSizes([400, 600])
    win.show()
    return win