예제 #1
0
    def __init__(self, stateSpace):        
        super(TrajectoryViewer, self).__init__()
        
        self.stateSpace = stateSpace
        
        # Define colors for plotting
        self.colors = itertools.cycle(['g', 'b', 'c', 'm', 'k', 'y'])
                
        self.plotLines = deque()
        
        # Combo Boxes for selecting displaced state space dimensions
        self.comboBox1 = QtGui.QComboBox(self)
        self.comboBox1.addItems(sorted(stateSpace.keys()))
        self.comboBox2 = QtGui.QComboBox(self)
        self.comboBox2.addItems(sorted(stateSpace.keys()))
        self.comboBox2.setCurrentIndex(1)
        self.dimension1 = sorted(self.stateSpace.keys())[0]
        self.dimension2 = sorted(self.stateSpace.keys())[1]
        self.connect(self.comboBox1, QtCore.SIGNAL('currentIndexChanged (int)'), 
                     self._dimension1Changed)
        self.connect(self.comboBox2, QtCore.SIGNAL('currentIndexChanged (int)'), 
                     self._dimension2Changed)
        
        # Slider for controlling the number of Trajectories
        self.maxLines = 5
        self.numberTrajectoriesSlider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        self.numberTrajectoriesSlider.setValue(self.maxLines)
        self.numberTrajectoriesSlider.setMinimum(1)
        self.numberTrajectoriesSlider.setMaximum(20)
        self.numberTrajectoriesSlider.setTickInterval(5)
        self.numberTrajectoriesSlider.setTickPosition(QtGui.QSlider.TicksBelow)
        
        self.connect(self.numberTrajectoriesSlider, QtCore.SIGNAL('sliderReleased()'), 
                     self._changeNumTrajectories)
        
        # Checkbox for dis-/enabling trajectory plotting
        self.plottingEnabled = True
        self.enabledCheckBox = QtGui.QCheckBox("Plotting Enabled")
        self.enabledCheckBox.setChecked(self.plottingEnabled)
        self.connect(self.enabledCheckBox, QtCore.SIGNAL('stateChanged(int)'), 
                     self._enablingPlotting)
        
        # Some labels
        self.dimension1Label = QtGui.QLabel("Dimension X Axis")
        self.dimension2Label = QtGui.QLabel("Dimension Y Axis")
        self.numTrajectoriesLabel = QtGui.QLabel("Trajectories shown")
        
        # Create matplotlib widgets
        plotWidgetTrajectory = QtGui.QWidget(self)
        plotWidgetTrajectory.setMinimumSize(800, 500)
 
        self.figTrajectory = Figure((8.0, 5.0), dpi=100)
        self.axisTrajectory = self.figTrajectory .gca()
        self.canvasTrajectory = FigureCanvas(self.figTrajectory)
        self.canvasTrajectory .setParent(plotWidgetTrajectory )
        
        # Initialize plotting
        self._reinitializePlot()
        
        # Create layout
        self.vlayout = QtGui.QVBoxLayout()
        self.hlayout1 = QtGui.QHBoxLayout()
        self.hlayout1.addWidget(self.dimension1Label)
        self.hlayout1.addWidget(self.comboBox1)
        self.hlayout2 = QtGui.QHBoxLayout()
        self.hlayout2.addWidget(self.dimension2Label)
        self.hlayout2.addWidget(self.comboBox2)
        self.hlayout3 = QtGui.QHBoxLayout()
        self.hlayout3.addWidget(self.numTrajectoriesLabel)
        self.hlayout3.addWidget(self.numberTrajectoriesSlider)
        
        self.vlayout.addLayout(self.hlayout1)
        self.vlayout.addLayout(self.hlayout2)
        self.vlayout.addLayout(self.hlayout3)
        self.vlayout.addWidget(self.enabledCheckBox)
        
        self.hlayout = QtGui.QHBoxLayout()
        self.hlayout.addWidget(plotWidgetTrajectory)
        self.hlayout.addLayout(self.vlayout)
        self.setLayout(self.hlayout)
        
        # Connect to trajectory observable
        self.trajectoryObservable = \
                OBSERVABLES.getAllObservablesOfType(TrajectoryObservable)[0]
        self.trajectoryObservableCallback = \
             lambda *transition: self.addTransition(*transition)
        self.trajectoryObservable.addObserver(self.trajectoryObservableCallback)
예제 #2
0
    def __init__(self, stateSpace):        
        super(MountainCarPolicyViewer, self).__init__()
        self.stateSpace = stateSpace
        self.actions = []
        self.colors = ['r','g','b', 'c', 'y']
        
        self.lock = threading.Lock()
        
        # Add a combobox for selecting the policy observable
        self.policyObservableLabel = QtGui.QLabel("Policy Observable")
        self.policyObservableComboBox = QtGui.QComboBox(self)
        policyObservables = \
            OBSERVABLES.getAllObservablesOfType(FunctionOverStateSpaceObservable)
        self.policyObservableComboBox.addItems([policyObservable.title 
                                                 for policyObservable in policyObservables])
        self.selectedPolicyObservable = None
        if len(policyObservables) > 0:
            self.selectedPolicyObservable = policyObservables[0].title
        
        self.connect(self.policyObservableComboBox,
                     QtCore.SIGNAL('activated (const QString&)'), 
                     self._policyObservableChanged) 
        
        # Automatically update policy observable combobox when new observables 
        # are created during runtime
        def updatePolicyObservableBox(viewer, action):
            self.policyObservableComboBox.clear()
            policyObservables = OBSERVABLES.getAllObservablesOfType(FunctionOverStateSpaceObservable)
            self.policyObservableComboBox.addItems([policyObservable.title 
                                                for policyObservable in policyObservables])
            if len(policyObservables) > 0:
                self.selectedPolicyObservable = policyObservables[0].title
            else: 
                self.selectedPolicyObservable = None
            
        OBSERVABLES.addObserver(updatePolicyObservableBox)
        
        # Get trajectory observable which is required for informing about end of episode
        self.trajectoryObservable = \
                OBSERVABLES.getAllObservablesOfType(TrajectoryObservable)[0]
        self.episodeTerminated = False

        # Slider that controls the granularity of the plot-grid
        self.gridNodesPerDim = 25        
        self.gridNodesSlider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        self.gridNodesSlider.setValue(self.gridNodesPerDim)
        self.gridNodesSlider.setMinimum(0)
        self.gridNodesSlider.setMaximum(100)
        self.gridNodesSlider.setTickInterval(10)
        self.gridNodesSlider.setTickPosition(QtGui.QSlider.TicksBelow)
        self.connect(self.gridNodesSlider, QtCore.SIGNAL('sliderReleased()'), 
                     self._changeGridNodes)
        self.gridNodesLabel = QtGui.QLabel("Grid Nodes Per Dimension: %s" 
                                           % self.gridNodesPerDim )
                
        # Create matplotlib widgets
        plotWidget = QtGui.QWidget(self)
        plotWidget.setMinimumSize(600, 500)
        plotWidget.setWindowTitle("Policy")
 
        self.fig = Figure((6.0, 5.0), dpi=100)
        self.axis = self.fig.gca()
        self.canvas = FigureCanvas(self.fig)
        self.canvas.setParent(plotWidget)    
        
        # Small text in plot legend
        matplotlib.rcParams.update({'legend.fontsize': 6})
        
        self.hlayout = QtGui.QHBoxLayout()
        self.hlayout.addWidget(plotWidget)
        self.vlayout = QtGui.QVBoxLayout()
        self.vlayout.addWidget(self.policyObservableLabel)
        self.vlayout.addWidget(self.policyObservableComboBox)
        self.vlayout.addWidget(self.gridNodesLabel)
        self.vlayout.addWidget(self.gridNodesSlider)
        self.hlayout.addLayout(self.vlayout)
        
        self.setLayout(self.hlayout)
        
        # Connect to observer (has to be the last thing!!)
        self.trajectoryObservableCallback = \
             lambda *transition: self.updateSamples(*transition)
        self.trajectoryObservable.addObserver(self.trajectoryObservableCallback)
        
        self.policyObservable = None
        if self.selectedPolicyObservable:
            self.policyObservable = OBSERVABLES.getObservable(self.selectedPolicyObservable,
                                                              FunctionOverStateSpaceObservable)
            self.policyObservableCallback = \
                 lambda policyEvalFunction: self.updatePolicy(policyEvalFunction)
            self.policyObservable.addObserver(self.policyObservableCallback)
예제 #3
0
    def __init__(self, tableModel, parent):  
        super(PlotExperimentWindow, self).__init__(parent)
            
        self.tableModel = tableModel
        # Colors used for different configurations in plots
        self.colors = cycle(["b", "g", "r", "c", "m", "y", "k"])
        self.colorMapping = defaultdict(lambda : self.colors.next())
        # The length of the moving window average 
        self.mwaSize = 2**0
        # Whether we plot each run separately or only their mean
        self.linePlotTypes = ["Each Run", "Average"]
        self.linePlot = self.linePlotTypes[0]
        
        # The central widget
        self.centralWidget = QtGui.QWidget(self)
        
        # Create matplotlib widget
        self.plotWidget = QtGui.QWidget(self.centralWidget)
        self.plotWidget.setMinimumSize(800, 500)
 
        self.fig = Figure((8.0, 5.0), dpi=100)
        self.canvas = FigureCanvas(self.fig)
        self.canvas.setParent(self.plotWidget)
        self.axis = self.fig.gca()
        
        self.mplToolbar = NavigationToolbar(self.canvas, self.centralWidget)
        
        self.mwaLabel = QtGui.QLabel("Moving Window Average: %s" % self.mwaSize)        
        # Slider for controlling the moving average window
        self.mwaSlider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        self.mwaSlider.setValue(0)
        self.mwaSlider.setMinimum(0)
        self.mwaSlider.setMaximum(10)
        self.mwaSlider.setTickInterval(10)
        self.mwaSlider.setTickPosition(QtGui.QSlider.TicksBelow)
        
        self.connect(self.mwaSlider, QtCore.SIGNAL('sliderReleased()'), 
                     self._changeMWA)
        
        self.lineLabel = QtGui.QLabel("Plot of agent: ")
        # Combo Box for selecting the observable
        self.lineComboBox = QtGui.QComboBox(self)
        self.lineComboBox.addItems(["Each Run", "Average"])
        self.connect(self.lineComboBox, QtCore.SIGNAL('currentIndexChanged (int)'), 
                     self._linePlotChanged)
    
        # Add a button for replotting
        self.replotButton = QtGui.QPushButton("Update")
        self.connect(self.replotButton, QtCore.SIGNAL('clicked()'), 
                     self._plot)
        
        # Add a button for saving a plot
        self.saveButton = QtGui.QPushButton("Save")
        self.connect(self.saveButton, QtCore.SIGNAL('clicked()'), 
                     self._save)
        
        # Set layout
        self.topLinelayout = QtGui.QHBoxLayout()
        self.topLinelayout.addWidget(self.mwaLabel)
        self.topLinelayout.addWidget(self.mwaSlider)
        self.topLinelayout.addWidget(self.lineLabel)
        self.topLinelayout.addWidget(self.lineComboBox)
        self.topLinelayout.addWidget(self.replotButton)
        self.topLinelayout.addWidget(self.saveButton)
        self.vlayout = QtGui.QVBoxLayout()
        self.vlayout.addLayout(self.topLinelayout)
        self.vlayout.addWidget(self.plotWidget)
        self.vlayout.addWidget(self.mplToolbar)
        self.centralWidget.setLayout(self.vlayout)
        
        self.setCentralWidget(self.centralWidget)
        self.setWindowTitle("Current experiment's results")
        
        # Plot the results once upon creation
        self._plot()
예제 #4
0
    def __init__(self, maze, stateSpace):
        super(Maze2DFunctionViewer, self).__init__()

        self.maze = maze
        self.stateSpace = stateSpace

        self.updateCounter = 0
        self.updatePlotNow = False
        self.evalFunction = None

        self.lock = threading.Lock()

        # Create matplotlib widgets
        plotWidget = QtGui.QWidget(self)
        plotWidget.setMinimumSize(600, 500)
        plotWidget.setWindowTitle("Maze2D")

        self.fig = Figure((6.0, 5.0), dpi=100)
        self.axis = self.fig.gca()
        self.axis.clear()
        self.maze.drawIntoAxis(self.axis)
        self.canvas = FigureCanvas(self.fig)
        self.canvas.setParent(plotWidget)
        self.canvas.draw()

        self.plottedPatches = []

        # Add a combobox for selecting the function over state space that is observed
        self.selectedFunctionObservable = None
        self.functionObservableLabel = QtGui.QLabel(
            "Function over State Space")
        self.functionObservableComboBox = QtGui.QComboBox(self)
        functionObservables = OBSERVABLES.getAllObservablesOfType(
            FunctionOverStateSpaceObservable)
        stateActionValueObservables = \
                OBSERVABLES.getAllObservablesOfType(StateActionValuesObservable)
        functionObservables.extend(stateActionValueObservables)
        self.functionObservableComboBox.addItems([
            functionObservable.title
            for functionObservable in functionObservables
        ])
        if len(functionObservables) > 0:
            self.selectedFunctionObservable = functionObservables[0].title

        self.connect(self.functionObservableComboBox,
                     QtCore.SIGNAL('activated (const QString&)'),
                     self._functionObservableChanged)

        # Automatically update funtion observable combobox when new observables
        # are created during runtime
        def updateFunctionObservableBox(viewer, action):
            self.functionObservableComboBox.clear()
            functionObservables = \
                OBSERVABLES.getAllObservablesOfType(FunctionOverStateSpaceObservable)
            stateActionValueObservables = \
                OBSERVABLES.getAllObservablesOfType(StateActionValuesObservable)
            functionObservables.extend(stateActionValueObservables)
            self.functionObservableComboBox.addItems([
                functionObservable.title
                for functionObservable in functionObservables
            ])
            if self.selectedFunctionObservable is None \
                    and len(functionObservables) > 0:
                self.selectedFunctionObservable = functionObservables[0].title
            else:
                # Let combobox still show the selected observable
                index = self.functionObservableComboBox.findText(
                    self.selectedFunctionObservable)
                if index != -1:
                    self.functionObservableComboBox.setCurrentIndex(index)

        OBSERVABLES.addObserver(updateFunctionObservableBox)

        # Add a combobox for for selecting the suboption that is used when
        # a StateActionValuesObservable is observed
        self.selectedSuboption = None
        self.suboptionLabel = QtGui.QLabel("Suboption")
        self.suboptionComboBox = QtGui.QComboBox(self)

        # Slider that controls the frequency of update the plot
        self.updateFrequency = 0.0
        self.updateFrequencySlider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        self.updateFrequencySlider.setValue(int(self.updateFrequency * 100))
        self.updateFrequencySlider.setMinimum(0)
        self.updateFrequencySlider.setMaximum(100)
        self.updateFrequencySlider.setTickInterval(0.1)
        self.updateFrequencySlider.setTickPosition(QtGui.QSlider.TicksBelow)
        self.connect(self.updateFrequencySlider,
                     QtCore.SIGNAL('sliderReleased()'),
                     self._changeUpdateFrequency)
        self.updateFrequencyLabel = QtGui.QLabel("UpdateFrequency: %s" %
                                                 self.updateFrequency)

        # Button to enforce update of plot
        self.updatePlotButton = QtGui.QPushButton("Update Plot")
        self.connect(self.updatePlotButton, QtCore.SIGNAL('clicked()'),
                     self._updatePlot)

        # Legend of plot
        self.legendLabel = QtGui.QLabel("Legend:")
        self.legendWidget = QtGui.QListWidget(self)

        self.hlayout = QtGui.QHBoxLayout()
        self.hlayout.addWidget(plotWidget)
        self.vlayout = QtGui.QVBoxLayout()
        self.functionObservableLayout = QtGui.QHBoxLayout()
        self.functionObservableLayout.addWidget(self.functionObservableLabel)
        self.functionObservableLayout.addWidget(
            self.functionObservableComboBox)
        self.vlayout.addLayout(self.functionObservableLayout)
        self.suboptionLayout = QtGui.QHBoxLayout()
        self.suboptionLayout.addWidget(self.suboptionLabel)
        self.suboptionLayout.addWidget(self.suboptionComboBox)
        self.vlayout.addLayout(self.suboptionLayout)
        self.updateFrequencyLayout = QtGui.QHBoxLayout()
        self.updateFrequencyLayout.addWidget(self.updateFrequencyLabel)
        self.updateFrequencyLayout.addWidget(self.updateFrequencySlider)
        self.vlayout.addLayout(self.updateFrequencyLayout)
        self.vlayout.addWidget(self.updatePlotButton)
        self.vlayout.addWidget(self.legendLabel)
        self.vlayout.addWidget(self.legendWidget)
        self.hlayout.addLayout(self.vlayout)
        self.setLayout(self.hlayout)

        # Connect to observer (has to be the last thing!!)
        self.functionObservable = None
        if self.selectedFunctionObservable is not None:
            self._functionObservableChanged(self.selectedFunctionObservable)
예제 #5
0
    def __init__(self, pinballMazeEnv, stateSpace):
        super(PinballMazeFunctionViewer, self).__init__()

        self.pinballMazeEnv = pinballMazeEnv
        self.stateSpace = stateSpace
        self.actions = []

        self.updateCounter = 0
        self.updatePlotNow = False
        self.evalFunction = None

        self.lock = threading.Lock()

        # Create matplotlib widgets
        plotWidget = QtGui.QWidget(self)
        plotWidget.setMinimumSize(600, 500)
        plotWidget.setWindowTitle("Pinball Maze")

        self.fig = Figure((6.0, 5.0), dpi=100)
        self.axis = self.fig.gca()
        self.pinballMazeEnv.plotStateSpaceStructure(self.axis)
        self.canvas = FigureCanvas(self.fig)
        self.canvas.setParent(plotWidget)
        self.canvas.draw()

        self.plottedPatches = []

        # Add a combobox for selecting the function over state space that is observed
        self.selectedFunctionObservable = None
        self.functionObservableLabel = QtGui.QLabel(
            "Function over State Space")
        self.functionObservableComboBox = QtGui.QComboBox(self)
        functionObservables = OBSERVABLES.getAllObservablesOfType(
            FunctionOverStateSpaceObservable)
        self.functionObservableComboBox.addItems([
            functionObservable.title
            for functionObservable in functionObservables
        ])
        if len(functionObservables) > 0:
            self.selectedFunctionObservable = functionObservables[0].title

        self.connect(self.functionObservableComboBox,
                     QtCore.SIGNAL('activated (const QString&)'),
                     self._functionObservableChanged)

        # Automatically update funtion observable combobox when new observables
        # are created during runtime
        def updateFunctionObservableBox(viewer, action):
            self.functionObservableComboBox.clear()
            functionObservables = \
                OBSERVABLES.getAllObservablesOfType(FunctionOverStateSpaceObservable)
            self.functionObservableComboBox.addItems([
                functionObservable.title
                for functionObservable in functionObservables
            ])
            if len(functionObservables) > 0:
                self.selectedFunctionObservable = functionObservables[0].title

        OBSERVABLES.addObserver(updateFunctionObservableBox)

        # Slider that controls the granularity of the plot-grid
        self.gridNodesPerDim = 50
        self.gridNodesSlider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        self.gridNodesSlider.setValue(self.gridNodesPerDim)
        self.gridNodesSlider.setMinimum(0)
        self.gridNodesSlider.setMaximum(100)
        self.gridNodesSlider.setTickInterval(10)
        self.gridNodesSlider.setTickPosition(QtGui.QSlider.TicksBelow)
        self.connect(self.gridNodesSlider, QtCore.SIGNAL('sliderReleased()'),
                     self._changeGridNodes)
        self.gridNodesLabel = QtGui.QLabel("Grid Nodes Per Dimension: %s" %
                                           self.gridNodesPerDim)

        # Slider that controls the frequency of update the plot
        self.updateFrequency = 0.0
        self.updateFrequencySlider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        self.updateFrequencySlider.setValue(int(self.updateFrequency * 100))
        self.updateFrequencySlider.setMinimum(0)
        self.updateFrequencySlider.setMaximum(100)
        self.updateFrequencySlider.setTickInterval(0.1)
        self.updateFrequencySlider.setTickPosition(QtGui.QSlider.TicksBelow)
        self.connect(self.updateFrequencySlider,
                     QtCore.SIGNAL('sliderReleased()'),
                     self._changeUpdateFrequency)
        self.updateFrequencyLabel = QtGui.QLabel("UpdateFrequency: %s" %
                                                 self.updateFrequency)

        # Button to enforce update of plot
        self.updatePlotButton = QtGui.QPushButton("Update Plot")
        self.connect(self.updatePlotButton, QtCore.SIGNAL('clicked()'),
                     self._updatePlot)

        # Chosen xvel and yvel values
        self.xVel = 0.5
        self.xVelSlider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        self.xVelSlider.setValue(int(self.xVel * 10))
        self.xVelSlider.setMinimum(0)
        self.xVelSlider.setMaximum(10)
        self.xVelSlider.setTickInterval(1)
        self.xVelSlider.setTickPosition(QtGui.QSlider.TicksBelow)
        self.connect(self.xVelSlider, QtCore.SIGNAL('sliderReleased()'),
                     self._changeXVel)
        self.xVelLabel = QtGui.QLabel("xvel value: %s" % self.xVel)

        self.yVel = 0.5
        self.yVelSlider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        self.yVelSlider.setValue(int(self.yVel * 10))
        self.yVelSlider.setMinimum(0)
        self.yVelSlider.setMaximum(10)
        self.yVelSlider.setTickInterval(1)
        self.yVelSlider.setTickPosition(QtGui.QSlider.TicksBelow)
        self.connect(self.yVelSlider, QtCore.SIGNAL('sliderReleased()'),
                     self._changeYVel)
        self.yVelLabel = QtGui.QLabel("yvel value: %s" % self.xVel)

        # Legend of plot
        self.legendLabel = QtGui.QLabel("Legend:")
        self.legendWidget = QtGui.QListWidget(self)

        self.hlayout = QtGui.QHBoxLayout()
        self.hlayout.addWidget(plotWidget)
        self.vlayout = QtGui.QVBoxLayout()
        self.functionObservableLayout = QtGui.QHBoxLayout()
        self.functionObservableLayout.addWidget(self.functionObservableLabel)
        self.functionObservableLayout.addWidget(
            self.functionObservableComboBox)
        self.vlayout.addLayout(self.functionObservableLayout)
        self.gridNodesLayout = QtGui.QHBoxLayout()
        self.gridNodesLayout.addWidget(self.gridNodesLabel)
        self.gridNodesLayout.addWidget(self.gridNodesSlider)
        self.vlayout.addLayout(self.gridNodesLayout)
        self.updateFrequencyLayout = QtGui.QHBoxLayout()
        self.updateFrequencyLayout.addWidget(self.updateFrequencyLabel)
        self.updateFrequencyLayout.addWidget(self.updateFrequencySlider)
        self.vlayout.addLayout(self.updateFrequencyLayout)
        self.vlayout.addWidget(self.updatePlotButton)
        self.xVelLayout = QtGui.QHBoxLayout()
        self.xVelLayout.addWidget(self.xVelLabel)
        self.xVelLayout.addWidget(self.xVelSlider)
        self.vlayout.addLayout(self.xVelLayout)
        self.yVelLayout = QtGui.QHBoxLayout()
        self.yVelLayout.addWidget(self.yVelLabel)
        self.yVelLayout.addWidget(self.yVelSlider)
        self.vlayout.addLayout(self.yVelLayout)
        self.vlayout.addWidget(self.legendLabel)
        self.vlayout.addWidget(self.legendWidget)
        self.hlayout.addLayout(self.vlayout)
        self.setLayout(self.hlayout)

        # Connect to observer (has to be the last thing!!)
        self.functionObservable = None
        if self.selectedFunctionObservable:
            self.functionObservable = \
                    OBSERVABLES.getObservable(self.selectedFunctionObservable,
                                              FunctionOverStateSpaceObservable)
            self.functionObservableCallback = \
                 lambda evalFunction: self._updateFunction(evalFunction)
            self.functionObservable.addObserver(
                self.functionObservableCallback)
예제 #6
0
    def __init__(self):
        super(FloatStreamViewer, self).__init__()

        # Create matplotlib widget
        plotWidget = QtGui.QWidget(self)
        plotWidget.setMinimumSize(800, 500)

        fig = Figure((8.0, 5.0), dpi=100)
        self.canvas = FigureCanvas(fig)
        self.canvas.setParent(plotWidget)
        self.axis = fig.gca()

        # Local container for displayed values
        self.values = deque()
        self.times = deque()

        # Combo Box for selecting the observable
        self.comboBox = QtGui.QComboBox(self)
        self.floatStreamObservables = \
                OBSERVABLES.getAllObservablesOfType(FloatStreamObservable)
        self.comboBox.addItems(
            map(lambda x: "%s" % x.title, self.floatStreamObservables))
        self.connect(self.comboBox, QtCore.SIGNAL('currentIndexChanged (int)'),
                     self._observableChanged)

        # Automatically update combobox when new float stream observables
        #  are created during runtime
        def updateComboBox(observable, action):
            self.comboBox.clear()
            self.floatStreamObservables = \
                    OBSERVABLES.getAllObservablesOfType(FloatStreamObservable)
            self.comboBox.addItems(
                map(lambda x: "%s" % x.title, self.floatStreamObservables))

        OBSERVABLES.addObserver(updateComboBox)

        # The number of values from the observable that are remembered
        self.windowSize = 64

        # Slider for controlling the window size
        self.windowSizeSlider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        self.windowSizeSlider.setValue(numpy.log2(self.windowSize))
        self.windowSizeSlider.setMinimum(0)
        self.windowSizeSlider.setMaximum(15)
        self.windowSizeSlider.setTickInterval(1)
        self.windowSizeSlider.setTickPosition(QtGui.QSlider.TicksBelow)

        self.connect(self.windowSizeSlider, QtCore.SIGNAL('sliderReleased()'),
                     self._changeWindowSize)

        self.windowSizeLabel = QtGui.QLabel("WindowSize: %s" % self.windowSize)

        # The length of the moving window average
        self.mwaSize = 10

        # Slider for controlling the moving average window
        self.mwaSlider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        self.mwaSlider.setValue(self.mwaSize)
        self.mwaSlider.setMinimum(1)
        self.mwaSlider.setMaximum(50)
        self.mwaSlider.setTickInterval(10)
        self.mwaSlider.setTickPosition(QtGui.QSlider.TicksBelow)

        self.connect(self.mwaSlider, QtCore.SIGNAL('sliderReleased()'),
                     self._changeMWA)

        self.mwaLabel = QtGui.QLabel("Moving Window Average : %s" %
                                     self.mwaSize)

        # Create layout
        self.vlayout = QtGui.QVBoxLayout()
        self.vlayout.addWidget(self.comboBox)
        self.vlayout.addWidget(self.windowSizeSlider)
        self.vlayout.addWidget(self.windowSizeLabel)
        self.vlayout.addWidget(self.mwaSlider)
        self.vlayout.addWidget(self.mwaLabel)

        self.hlayout = QtGui.QHBoxLayout()
        self.hlayout.addWidget(plotWidget)
        self.hlayout.addLayout(self.vlayout)

        self.setLayout(self.hlayout)

        # Handling connecting to observable
        self.observableCallback = lambda time, value, *args: self.update(
            time, value)
        if len(self.floatStreamObservables) > 0:
            # Show per default the first observable
            self.observable = self.floatStreamObservables[0]
            # Connect to observer (has to be the last thing!!)
            self.observable.addObserver(self.observableCallback)
        else:
            self.observable = None