Esempio n. 1
0
    def _plot(self):
        """Plots best and current paths data.
        """

        self.best_canvas.Clear()
        self.current_canvas.Clear()

        if len(self.results) > 0:
            x_max = self.results[-1].time
            self.best_canvas.xSpec = (0, x_max)
            self.current_canvas.xSpec = (0, x_max)

        best_points = [
            (r.time, r.best.distance) for r in self.results
            if r.best is not None and isinstance(r.best.distance, int)
        ]
        best_line = PolyLine(best_points)
        best_plot = PlotGraphics([best_line],
                                 title='Best path distance over time',
                                 xLabel='Time [ns]',
                                 yLabel='Distance')

        current_points = [
            (r.time, r.current.distance) for r in self.results
            if r.current is not None and isinstance(r.current.distance, int)
        ]
        current_line = PolyLine(current_points)
        current_plot = PlotGraphics([current_line],
                                    title='Current path distance over time',
                                    xLabel='Time [ns]',
                                    yLabel='Distance')

        self.best_canvas.Draw(best_plot)
        self.current_canvas.Draw(current_plot)
Esempio n. 2
0
def drawSinCosWaves():
    # 100 points sin function, plotted as green circles
    data1 = 2. * _Numeric.pi * _Numeric.arange(200) / 200.
    data1.shape = (100, 2)
    data1[:, 1] = _Numeric.sin(data1[:, 0])
    markers1 = PolyMarker(data1,
                          legend='Green Markers',
                          colour='green',
                          marker='circle',
                          size=1)

    # 50 points cos function, plotted as red line
    data1 = 2. * _Numeric.pi * _Numeric.arange(100) / 100.
    data1.shape = (50, 2)
    data1[:, 1] = _Numeric.cos(data1[:, 0])
    lines = PolyLine(data1, legend='Red Line', colour='red')

    # A few more points...
    pi = _Numeric.pi
    markers2 = PolyMarker([(0., 0.), (pi / 4., 1.), (pi / 2, 0.),
                           (3. * pi / 4., -1)],
                          legend='Cross Legend',
                          colour='blue',
                          marker='cross')

    return PlotGraphics([markers1, lines, markers2], "Graph Title", "X Axis",
                        "Y Axis")
Esempio n. 3
0
    def drawBarGraph():
        self.canvas = PlotCanvas(panel)
        self.canvas.Draw(drawBarGraph())
        toggleGrid = wx.CheckBox(panel, label="Show Grid")
        toggleGrid.Bind(wx.EVT_CHECKBOX, self.onToggleGrid)
        toggleLegend = wx.CheckBox(panel, label="Show Legend")
        toggleLegend.Bind(wx.EVT_CHECKBOX, self.onToggleLegend)

        points1 = [(1, 0), (1, 10)]
        line1 = PolyLine(points1, colour='green', legend='Feb.', width=10)
        points1g = [(2, 0), (2, 4)]
        line1g = PolyLine(points1g, colour='red', legend='Mar.', width=10)
        points1b = [(3, 0), (3, 100)]
        line1b = PolyLine(points1b, colour='blue', legend='Apr.', width=10)

        points2 = [(4, 0), (4, 12)]
        line2 = PolyLine(points2, colour='Yellow', legend='May', width=10)
        points2g = [(5, 0), (5, 8)]
        line2g = PolyLine(points2g, colour='orange', legend='June', width=10)
        points2b = [(6, 0), (6, 4)]
        line2b = PolyLine(points2b, colour='brown', legend='July', width=10)

        return PlotGraphics([line1, line1g, line1b, line2, line2g, line2b],
                            "Bar Graph - (Turn on Grid, Legend)", "Months",
                            "Number of Students")
Esempio n. 4
0
 def DrawGraph(self):
     lines = []
     last_point = (-1, 0)
     for x, y in self.Engine.Deck.GetAttrsAndCounts(self.Plotting):
         lines.append(PolyLine([last_point, (x, y)], width=5))
         last_point = (x, y)
     if not lines:
         lines.append(PolyLine([(0, 0), (0, 0)]))
     return PlotGraphics(lines, self.Plotting, self.Plotting, 'Count')
Esempio n. 5
0
def drawLinePlot():
    # 25,000 point line
    data1 = _Numeric.arange(5e5, 1e6, 10)
    data1.shape = (25000, 2)
    line1 = PolyLine(data1, legend='Wide Line', colour='green', width=5)

    # A few more points...
    markers2 = PolyMarker(data1,
                          legend='Square',
                          colour='blue',
                          marker='square')
    return PlotGraphics([line1, markers2], "25,000 Points", "Value X", "")
Esempio n. 6
0
 def dibujar_state_codes(self): # Genera la ventana grafica de la grafica
     size = int(math.sqrt(float(len(self.state_codes))))
     data = np.zeros((len(self.state_codes),2)) #Crea una matriz especial para el procesamiento y visualizacion de los datos
     codigos=[]
     for codigo in self.state_codes:
         if type(codigo) != int:
             codigos.append(0)
         else:
             codigos.append(codigo)
     data[:,0] = np.array(range(len(codigos))) #Añade los codigos que se obtuvieron por peticion
     data[:,1] = np.array(codigos)
     linea = PolyLine(data, legend="codigos de estado",colour='red') # Se añaden los parametros para la grafica
     return PlotGraphics([linea],"Resultados", "Peticiones", "codigos")
Esempio n. 7
0
    def __draw_reg_plot(self):

        plot_title = "REGISTER %s" % self.__id

        if not self.__data:
            plot_title = "NO DATA YET"

        x_axis_title = "Time (seconds since first sample)"
        y_axis_title = self.__id

        line1 = PolyLine(self.__data, colour='blue', width=3)

        return PlotGraphics([line1], plot_title, x_axis_title, y_axis_title)
Esempio n. 8
0
    def createPlotGraphics(self):
        """
        Create the plot's graphics
        """
        temps = self.readFile()
        lines = []
        for temp in temps:
            tempInt = int(temp[1][1])
            if tempInt < 60:
                color = "blue"
            elif tempInt >= 60 and tempInt <= 75:
                color = "orange"
            else:
                color = "red"
            lines.append(PolyLine(temp, colour=color, width=10))

        return PlotGraphics(lines, "Bar Graph of Temperatures", "Days",
                            "Temperatures")
Esempio n. 9
0
def drawBarGraph():
    # Bar graph
    points1=[(1,0), (1,10)]
    line1 = PolyLine(points1, colour='green', legend='Feb.', width=10)
    points1g=[(2,0), (2,4)]
    line1g = PolyLine(points1g, colour='red', legend='Mar.', width=10)
    points1b=[(3,0), (3,6)]
    line1b = PolyLine(points1b, colour='blue', legend='Apr.', width=10)

    points2=[(4,0), (4,12)]
    line2 = PolyLine(points2, colour='Yellow', legend='May', width=10)
    points2g=[(5,0), (5,8)]
    line2g = PolyLine(points2g, colour='orange', legend='June', width=10)
    points2b=[(6,0), (6,4)]
    line2b = PolyLine(points2b, colour='brown', legend='July', width=10)

    return PlotGraphics([line1, line1g, line1b, line2, line2g, line2b],
                        "Bar Graph - (Turn on Grid, Legend)", "Months",
                        "Number of Students")
Esempio n. 10
0
    def fill_Plot(self):

        # server = ServerProxy("http://localhost:8000") # local server "http://betty.userland.com"
        host = 'baco.cfn.ist.utl.pt'
        port = 8888
        client = SDASClient(host, port)
        #dS=client.getData('CENTRAL_OS9_ADC.IIGBT','0x0000', 11244)
        dS = client.getData('CENTRAL_OS9_ADC_VME_I8.IF0SN', '0x0000', 11244)
        isine = dS.getData()
        dS = client.getData('CENTRAL_OS9_ADC_VME_I8.IF0CS', '0x0000', 11244)
        cosine = dS.getData()
        ic = Density(cosine, isine)
        sze = ic.size()
        print sze
        #ic=_Numeric.arange(ic)
        # 25,000 point line
        data1 = _Numeric.arange(2 * sze)
        data2 = data1.astype(_Numeric.Float32)
        data2.shape = (-1, 2)
        data2[:, 1] = ic
        line1 = PolyLine(data2, legend='Wide Line', colour='green', width=2)
        self.plot.Draw(PlotGraphics([line1], "SDAS Plot", "Time", ""))
Esempio n. 11
0
 def DrawBarGraph(self):
     points = [(1, 0), (1, 200)]
     line1 = PolyLine(points, colour='green', legend='Feb', width=100)
     return PlotGraphics([line1], "Bar Graph - test", "Months",
                         "Number of Students")
Esempio n. 12
0
    def calculate_and_plot(self, event):
        self.T_slider_label.SetLabel('Isotherm Temperature = ' +
                                     str(self.T_slider.GetValue()) + ' K')
        Tc = 0
        Pc = 0
        m = 0
        T = float(self.T_slider.GetValue())
        T_Text = str(self.T_slider.GetValue())

        Tc_text = self.Tc_input.GetValue()
        Pc_text = self.Pc_input.GetValue()
        m_text = self.m_input.GetValue()

        if (Tc_text != '') and (Pc_text != '') and (m_text != ''):
            Tc = float(Tc_text)
            Pc = float(Pc_text) * 100
            m = float(m_text)


# Bereken aCrit
        if (Tc != 0) and (Pc != 0) and (m != 0):
            R = Psat.R
            ac = (27 * R * R * Tc * Tc) / (64 * Pc)
            b = (R * Tc) / (8 * Pc)

            calc = Psat.Psat(T, Tc, Pc / 100, m)
            Psatval = calc[0]

            self.ac_label = str(round(ac, 4))
            self.b_label = str(round(b, 4))
            if np.isreal(Psatval):
                self.Psat_label = str(round(Psatval, 4))
            else:
                self.Psat_label = Psatval

            self.ac_val.SetLabel('ac = ' + self.ac_label)
            self.b_val.SetLabel('b = ' + self.b_label)
            self.m_val.SetLabel('m = ' + m_text)
            self.P_sat.SetLabel('Psat = ' + self.Psat_label)

            #Calculate datapoints for vdw EOS
            Data = np.zeros((1001))
            Line_Data = np.zeros((1001))

            for k in range(0, 1001):
                Data[k] = 100000 * ((0.1**(10 - 0.01 * k))) + b + 0.01
                Value = max([
                    min([
                        Psat.vdw(T, Psat.a(T, Tc, Pc, m), b, Data[k], 0) / 100,
                        100
                    ]), -1000
                ])
                V_l = calc[1]
                V_v = calc[2]
                if Data[k] < V_l or Data[k] > V_v:
                    Line_Data[k] = Value
                else:
                    Line_Data[k] = Psatval
            Plot_Data1 = np.vstack((Data, Line_Data)).T

            Isotherm = PolyLine(Plot_Data1,
                                legend='Isotherm, T = ' + T_Text,
                                colour='blue')

            self.canvas.Draw(PlotGraphics([Isotherm], '', ' V', 'P'))
            self.canvas.setLogScale((True, False))