コード例 #1
0
ファイル: python_examples.py プロジェクト: pjmahoney/nutmeg
def _testBasic():
    print "Init"
    Nutmeg.init()
    print "Sending Figure"
    fig = Nutmeg.figure('fig', "figure1.qml")
    print "Sending Data"
    fig.set('ax[1].red.y', np.random.standard_normal(10))
コード例 #2
0
ファイル: python_examples.py プロジェクト: pjmahoney/nutmeg
def _testFonts():
    Nutmeg.init()
    fig = Nutmeg.figure('fig', 'figureFont.qml')
    fig.set('ax[1].red.y', np.random.standard_normal(10))
    # fig.set('ax[1].title', "Axis2")
    for i in range(3):
        fig.set('ax[' + str(i) + '].title', "Axis" + str(i+1))
コード例 #3
0
ファイル: python_examples.py プロジェクト: pjmahoney/nutmeg
def _testImages():
    import cv2
    Nutmeg.init()
    fig = Nutmeg.figure('fig', "figureIm.qml")

    im = open("img.jpg")
    imData = im.read()
    fig.set('ax.im.binary', imData)
コード例 #4
0
ファイル: python_examples.py プロジェクト: pjmahoney/nutmeg
def _testButton():
    Nutmeg.init()
    fig = Nutmeg.figure('fig', 'figure_single.qml')
    fig.setGui('gui1.qml')

    print (fig.parameters)
    time.sleep(0.1)
    buttonParam = fig.parameter("button")

    while True:
        if buttonParam.changed:
            changes = buttonParam.changed
            print("Button: %d (clicked %d times)" % (changes, buttonParam.read()))
            break
        time.sleep(0.1)
コード例 #5
0
ファイル: python_examples.py プロジェクト: pjmahoney/nutmeg
def _testParams():
    Nutmeg.init()
    fig = Nutmeg.figure('fig', 'figure1.qml')

    print "Sending GUI..."
    success = fig.setGui('gui1.qml')

    N = 100
    data = np.random.standard_normal((3, N*10))
    data2 = np.random.standard_normal((3, N))

    update = lambda params: applyBlur(data, params['sigma'])
    update2 = lambda params: applyBlur(data2, params['sigma'])

    fig.set('ax[:].blue.x', np.arange(N*10,dtype=float)/10)
    fig.set('ax[:].red.x', np.arange(N, dtype=float))
    fig.set('ax[:].blue.y', Updater(['sigma'], update=update))
    fig.set('ax[:].red.y', Updater(['sigma'], update=update2))
    # for i in range(100):
    #     fig.set('ax[:].red', update2({'sigma': i*0.05}))
    #     time.sleep(0.025)
    print("Data set")
コード例 #6
0
def customAdvancedBar():
    fig = Nutmeg.figure('customAdvancedBar', 'customAdvancedBarPlot.qml')
    fig.set('ax.barPlot', data=[[1,2,3, -2,0.5,6,1],[-0.5,7]], barWidth=1)
    fig.set('legend', labels=["Hey", "There", "Labels", "I", "Love", "Lamp"])
コード例 #7
0
ファイル: python_examples.py プロジェクト: pjmahoney/nutmeg
def _testGrid():
    Nutmeg.init()
    fig = Nutmeg.figure('fig', 'figureGrid.qml')
    fig.set('ax[1].red.y', np.random.standard_normal(10))
コード例 #8
0
ファイル: python_examples.py プロジェクト: pjmahoney/nutmeg
def _testDelta():
    Nutmeg.init()
    fig = Nutmeg.figure('fig', 'figure1.qml')
    fig.set('ax[1].red.y', np.random.standard_normal(10))
    fig.set('ax[1].red.y[5]', -10)
コード例 #9
0
ファイル: basic02.py プロジェクト: pjmahoney/nutmeg
# Code starts
import Nutmeg
import numpy as np

# Initialise the Nutmeg module. This connects to the core.
Nutmeg.init()

# Create the figure from a qml file
fig = Nutmeg.figure('basic02', "figure_triple.qml")

# Set the data
randomData = np.random.standard_normal(10)
fig.set('ax[1].red.y', randomData)

x = np.r_[0:10.:0.01]
ySin = np.sin(x)
fig.set('ax[0].green', {'x': x, 'y': ySin})

yTan = np.tan(x)
fig.set('ax[2].blue', {'x': x, 'y': yTan})
コード例 #10
0
import Nutmeg


def basics():
    Nutmeg.figure('basicCanvas', 'canvasPlotBasic.qml')


def customBar():
    fig = Nutmeg.figure('customBar', 'customBarPlot.qml')
    fig.set('ax.barPlot', data=[1, 2, 3, -0.5, 7], barWidth=1.5, spacing=3)


def customAdvancedBar():
    fig = Nutmeg.figure('customAdvancedBar', 'customAdvancedBarPlot.qml')
    fig.set('ax.barPlot',
            data=[[1, 2, 3, -2, 0.5, 6, 1], [-0.5, 7]],
            barWidth=1)
    fig.set('legend', labels=["Hey", "There", "Labels", "I", "Love", "Lamp"])


if __name__ == '__main__':
    Nutmeg.init()

    # basics()
    # customBar()
    customAdvancedBar()
コード例 #11
0
ファイル: basic.py プロジェクト: pjmahoney/nutmeg
import Nutmeg
from numpy import sin, cos, pi, r_

# Assuming the core is on port 43686 (default)
Nutmeg.init()

x = r_[0:1:0.01]
y1 = sin(10*pi*x)
y2 = 10*pi*cos(10*pi*x)

fig = Nutmeg.figure("myFigure", "myFigure.qml")

fig.set("axis1.data", x=x, y=y1)
fig.set("axis2.data", x=x, y=y2)
コード例 #12
0
ファイル: python_examples.py プロジェクト: pjmahoney/nutmeg
def _testValidateHandle():
    Nutmeg.init()
    fig = Nutmeg.figure('fig', 'figure_single.qml')
    print(Nutmeg.isValidHandle('fig.ax.redPlot'))
コード例 #13
0
ファイル: basic01.py プロジェクト: pjmahoney/nutmeg
# Code starts
import Nutmeg
import numpy as np

# Initialise the Nutmeg module. This connects to the core.
Nutmeg.init()

# Create the figure from a qml file
fig = Nutmeg.figure('basic01', "figure_single.qml")

# Set the data
randomData = np.random.standard_normal(10)
fig.set('ax.redPlot.bars', randomData)

x = np.r_[0:10.:0.01]
ySin = np.sin(x)
fig.set('ax.greenPlot', {'x': x, 'y': ySin})

yTan = np.tan(x)
fig.set('ax.bluePlot', {'x': x, 'y': yTan})
コード例 #14
0
import Nutmeg


def basics():
    Nutmeg.figure('basicCanvas', 'canvasPlotBasic.qml')


def customBar():
    fig = Nutmeg.figure('customBar', 'customBarPlot.qml')
    fig.set('ax.barPlot', data=[1,2,3,-0.5,7], barWidth=1.5, spacing=3)


def customAdvancedBar():
    fig = Nutmeg.figure('customAdvancedBar', 'customAdvancedBarPlot.qml')
    fig.set('ax.barPlot', data=[[1,2,3, -2,0.5,6,1],[-0.5,7]], barWidth=1)
    fig.set('legend', labels=["Hey", "There", "Labels", "I", "Love", "Lamp"])

if __name__ == '__main__':
    Nutmeg.init()

    # basics()
    # customBar()
    customAdvancedBar()
コード例 #15
0
ファイル: basic.py プロジェクト: pjmahoney/nutmeg
# Code starts
import Nutmeg
import numpy as np

# Initialise the Nutmeg module. This connects to the core.
Nutmeg.init()

# Create the figure from a qml file
fig = Nutmeg.figure('fig', "figure1.qml")

# Set the data
randomData = np.random.standard_normal(10)
fig.set('ax[1].red.y', randomData)

x = np.r_[0:10.:0.01]
ySin = np.sin(x)
fig.set('ax[0].green', {'x': x, 'y': ySin})

yTan = np.tan(x)
fig.set('ax[2].blue', {'x': x, 'y': yTan})
コード例 #16
0
def customBar():
    fig = Nutmeg.figure('customBar', 'customBarPlot.qml')
    fig.set('ax.barPlot', data=[1, 2, 3, -0.5, 7], barWidth=1.5, spacing=3)
コード例 #17
0
def basics():
    Nutmeg.figure('basicCanvas', 'canvasPlotBasic.qml')
コード例 #18
0
def customAdvancedBar():
    fig = Nutmeg.figure('customAdvancedBar', 'customAdvancedBarPlot.qml')
    fig.set('ax.barPlot',
            data=[[1, 2, 3, -2, 0.5, 6, 1], [-0.5, 7]],
            barWidth=1)
    fig.set('legend', labels=["Hey", "There", "Labels", "I", "Love", "Lamp"])
コード例 #19
0
def basics():
    Nutmeg.figure('basicCanvas', 'canvasPlotBasic.qml')
コード例 #20
0
def customBar():
    fig = Nutmeg.figure('customBar', 'customBarPlot.qml')
    fig.set('ax.barPlot', data=[1,2,3,-0.5,7], barWidth=1.5, spacing=3)
コード例 #21
0
ファイル: syncParam.py プロジェクト: pjmahoney/nutmeg
import Nutmeg
import time

from scipy import ndimage
import numpy as np

# Init the figure
Nutmeg.init()
fig = Nutmeg.figure('paramExample', 'figure1.qml')

# Set the GUI as described in the qml file
success = fig.setGui('gui1.qml')
sigmaParam = fig.parameter("sigma")

N = 100
data = np.random.standard_normal((3, N*10))


def applyBlur(dataIn, sigma):
    return ndimage.gaussian_filter1d(dataIn, sigma, axis=1)


while True:
    if sigmaParam.changed:
        sigma = sigmaParam.read()
        print "Sigma Changed:", sigma

        dataBlur = applyBlur(data, sigma)

        fig.set('ax.blue', y=dataBlur)
コード例 #22
0
ファイル: basicImage.py プロジェクト: pjmahoney/nutmeg
import Nutmeg


Nutmeg.init()
fig = Nutmeg.figure('imageExample', "figureIm.qml")

im = open("img.jpg")
imData = im.read()
fig.set('ax.im.binary', imData)

fig.set('ax.data', {'x': [0, 1, 2, 800, 1500], 'y': [0, 500, 100, 800, 1000]})

# fig.set('ax.data2', {'x': [0, 1, 2, 800, 1500], 'y': [0, 300, 200, 900, 1000]})