예제 #1
0
def simple_2d_plot():
    app = QtGui.QApplication([])
    win = PlotWindow()
    plot = AutoPlot(parent=win)
    win.plot.setPlotWidget(plot)
    win.show()

    # plotting 1d traces
    if False:
        logger.info(f"1D trace")
        t0 = time.perf_counter()
        nsamples = 30
        for i in range(nsamples):
            data = datadict_to_meshgrid(
                testdata.get_1d_scalar_cos_data(201, 2)
            )
            win.plot.setData(data)
        t1 = time.perf_counter()
        fps = nsamples/(t1-t0)
        logger.info(f"Performance: {fps} FPS")

    # plotting images
    if True:
        logger.info(f"2D image")
        t0 = time.perf_counter()
        nsamples = 30
        for i in range(nsamples):
            data = datadict_to_meshgrid(
                testdata.get_2d_scalar_cos_data(201, 101, 1)
            )
            win.plot.setData(data)
        t1 = time.perf_counter()
        fps = nsamples/(t1-t0)
        logger.info(f"Performance: {fps} FPS")

    # plotting 2d scatter
    if False:
        logger.info(f"2D scatter")
        t0 = time.perf_counter()
        nsamples = 30
        for i in range(nsamples):
            data = testdata.get_2d_scalar_cos_data(21, 21, 1)
            win.plot.setData(data)
        t1 = time.perf_counter()
        fps = nsamples/(t1-t0)
        logger.info(f"Performance: {fps} FPS")

    return app.exec_()
예제 #2
0
def main():
    fc = linearFlowchart(('dummy', DummyNode))
    node = fc.nodes()['dummy']
    dialog = widgetDialog(node.ui, title='dummy node')
    data = testdata.get_2d_scalar_cos_data(2, 2, 1)
    fc.setInput(dataIn=data)
    return dialog, fc
예제 #3
0
    def data(self) -> Iterable[DataDictBase]:
        fulldata = testdata.get_2d_scalar_cos_data(self.nrows, self.ncols)
        idx = 0
        size = self.nrows * self.ncols
        if size == 0:
            raise ValueError('Data has size zero.')

        data = fulldata.structure(same_type=True)
        assert isinstance(data, DataDictBase)

        while idx < size:
            idx += self.chunksize
            if idx >= size:
                idx = size
            for k, v in fulldata.data_items():
                data[k]['values'] = fulldata.data_vals(k)[:idx]
            yield data
        yield data
예제 #4
0
 def data(self) -> Iterable[DataDictBase]:
     for i in range(self.nreps):
         yield testdata.get_2d_scalar_cos_data(self.nx, self.nx, self.nsets)