How to use plottr - 10 common examples

To help you get started, we’ve selected a few plottr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github data-plottr / plottr / test / gui / dimension_assignment_widgets.py View on Github external
def _makeSlider(self, value=0):
        npts = 5
        w = QtGui.QSlider(0x01)
        w.setMinimum(0)
        w.setMaximum(npts-1)
        w.setSingleStep(1)
        w.setPageStep(1)
        w.setTickInterval(10)
        w.setTickPosition(QtGui.QSlider.TicksBelow)
        w.setValue(value)
        return w
github data-plottr / plottr / test / apps / custom_app.py View on Github external
def main():
    app = QtGui.QApplication([])

    # flowchart and window
    nodes = makeNodeList()
    win, fc = makeFlowchartWithPlotWindow(nodes)
    win.show()

    # feed in data
    data = makeData()
    fc.setInput(dataIn=data)

    return app.exec_()
github data-plottr / plottr / test / gui / dimension_assignment_widgets.py View on Github external
def _makeSlider(self, value=0):
        npts = 5
        w = QtGui.QSlider(0x01)
        w.setMinimum(0)
        w.setMaximum(npts-1)
        w.setSingleStep(1)
        w.setPageStep(1)
        w.setTickInterval(10)
        w.setTickPosition(QtGui.QSlider.TicksBelow)
        w.setValue(value)
        return w
github data-plottr / plottr / test / gui / correct_offset.py View on Github external
)
    data.validate()

    x = np.arange(11) - 5.
    y = np.linspace(0, 10, 51)
    xx, yy = np.meshgrid(x, y, indexing='ij')
    zz = np.sin(yy) + xx
    data2 = MeshgridDataDict(
        reps=dict(values=xx),
        y=dict(values=yy),
        z=dict(values=zz, axes=['reps', 'y'])
    )
    data2.validate()

    # make app and gui, fc
    app = QtGui.QApplication([])
    win, fc = flowchartAutoPlot([
        ('sub', SubtractAverage)
    ])
    win.show()

    # feed in data
    fc.setInput(dataIn=data)
    fc.setInput(dataIn=data2)

    return app.exec_()
github data-plottr / plottr / test / gui / lineplot.py View on Github external
def processData(self):
        _data = self.getInputData()

        data = DataDict()
        for k in self.traceNames:
            data[k] = _data.get(k)
        if self.xaxisName in _data:
            data[self.xaxisName] = _data[self.xaxisName]

        return data
github data-plottr / plottr / test / gui / test_data.py View on Github external
def two_compatible_noisy_2d_sets(nx=10, ny=10):
    x = np.linspace(0, 10, nx)
    y = np.arange(ny)

    xx, yy = np.meshgrid(x, y, indexing='ij')
    dd = np.cos(xx) + (-0.05 + 0.1 * np.random.rand(*yy.shape))
    dd2 = np.sin(xx) + (-0.5 + 1 * np.random.rand(*yy.shape))

    d = DataDict(
        x = dict(values=xx.reshape(-1)),
        y = dict(values=yy.reshape(-1)),
        cos_data = dict(values=dd.reshape(-1), axes=['x', 'y']),
        sin_data = dict(values=dd2.reshape(-1), axes=['x', 'y']),
    )
    return d
github data-plottr / plottr / test / pytest / test_data_dict.py View on Github external
def test_shape_guessing_simple():
    """test whether we can infer shapes correctly"""

    a = np.linspace(0, 1, 11)
    b = np.arange(5)
    aa, bb = np.meshgrid(a, b, indexing='ij')
    zz = aa * bb

    dd = DataDict(
        a=dict(values=aa.reshape(-1)),
        b=dict(values=bb.reshape(-1)),
        z=dict(values=zz.reshape(-1), axes=['a', 'b'])
    )

    assert guess_shape_from_datadict(dd) == dict(z=(['a', 'b'], (11, 5)))

    dd['a']['values'][5] = None
    dd['a']['values'][10] = np.nan
    assert guess_shape_from_datadict(dd) == dict(z=(['a', 'b'], (11, 5)))

    # non-uniform
    # noise on the coordinates should not result in failing as long as it
    # keeps monotonicity in the sweep axes
    dd['a']['values'] = (aa + np.random.rand(a.size).reshape(a.size, 1)
                         * 1e-3).reshape(-1)
github data-plottr / plottr / test / gui / test_data.py View on Github external
def three_compatible_3d_sets(nx=3, ny=3, nz=3, rand_factor=1):
    x = np.linspace(0, 10, nx)
    y = np.linspace(-5, 5, ny)
    z = np.arange(nz)
    xx, yy, zz = np.meshgrid(x, y, z, indexing='ij')
    dd = np.cos(xx) * np.sin(yy) + rand_factor * np.random.rand(*zz.shape)
    dd2 = np.sin(xx) * np.cos(yy) + rand_factor * np.random.rand(*zz.shape)
    dd3 = np.cos(xx)**2 * np.cos(yy)**2 + rand_factor * np.random.rand(*zz.shape)

    d = DataDict(
        x = dict(values=xx.reshape(-1), unit='mA'),
        y = dict(values=yy.reshape(-1), unit='uC'),
        z = dict(values=zz.reshape(-1), unit='nF'),
        data = dict(values=dd.reshape(-1), axes=['x', 'y', 'z'], unit='kW'),
        more_data = dict(values=dd2.reshape(-1), axes=['x', 'y', 'z'], unit='MV'),
        different_data = dict(values=dd3.reshape(-1), axes=['x', 'y', 'z'], unit='TS')
    )
    return d
github data-plottr / plottr / test / pytest / test_ddh5.py View on Github external
def test_basic_storage_and_retrieval():
    x = np.arange(3)
    y = np.repeat(np.linspace(0, 1, 5).reshape(1, -1), 3, 0)
    z = np.arange(y.size).reshape(y.shape)

    data = dd.DataDict(
        x=dict(values=x, unit='A',
               __info__='careful!',
               __moreinfo__='more words in here'),
        y=dict(values=y, unit='B'),
        z=dict(values=z, axes=['x', 'y'], unit='C'),
        __desc__='some description',
    )
    assert data.validate()

    dds.datadict_to_hdf5(data, FN, append_mode=dds.AppendMode.none)
    datafromfile = dds.datadict_from_hdf5(FN)

    # hdf5 saving added a few extra metas that we need to ignore when
    # comparing
    datafromfile = _clean_from_file(datafromfile)
    assert(data == datafromfile)
github data-plottr / plottr / plottr / utils / testdata.py View on Github external
def one_2d_set(nx=10, ny=10):
    x = np.linspace(0, 10, nx)
    y = np.arange(ny)

    xx, yy = np.meshgrid(x, y, indexing='ij')
    dd = np.cos(xx) + (-0.05 + 0.1 * np.random.rand(*yy.shape))

    d = DataDict(
        x=dict(values=xx.reshape(-1)),
        y=dict(values=yy.reshape(-1)),
        cos_data=dict(values=dd.reshape(-1), axes=['x', 'y']),
    )
    d.validate()
    return d