Ejemplo n.º 1
0
    def __init__(self):
        super().__init__()
        self._chart = QtChart.QChart()
        self._chart.legend().hide()
        self._chart.layout().setContentsMargins(0, 0, 0, 0)
        self._chart.setBackgroundRoundness(0)
        self._chart.setBackgroundVisible(False)
        self._chart.setMargins(QtCore.QMargins(0, 0, 0, 0))

        self._xAxis = QtChart.QValueAxis()
        self._xAxis.setTickCount(3)
        self._xAxis.setMinorTickCount(4)
        self._xAxis.setLabelFormat("%.3f mm")
        self._chart.addAxis(self._xAxis, QtCore.Qt.AlignBottom)

        self._yAxis = QtChart.QValueAxis()
        self._yAxis.setTickCount(2)
        self._yAxis.setMinorTickCount(3)
        self._yAxis.setLabelFormat("%.2g Ohm")
        self._chart.addAxis(self._yAxis, QtCore.Qt.AlignLeft)

        self._line = QtChart.QLineSeries()
        self._line.setColor(QtGui.QColor('magenta'))

        self._chart.addSeries(self._line)
        self._line.attachAxis(self._xAxis)
        self._line.attachAxis(self._yAxis)

        self._series = QtChart.QScatterSeries()
        self._series.setName("R")
        self._series.setMarkerSize(3)
        self._series.setBorderColor(QtGui.QColor('red'))
        self._series.setColor(QtGui.QColor('red'))

        self._chart.addSeries(self._series)
        self._series.attachAxis(self._xAxis)
        self._series.attachAxis(self._yAxis)

        self._marker = QtChart.QScatterSeries()
        self._marker.setMarkerSize(9)
        self._marker.setBorderColor(QtGui.QColor('red'))
        self._marker.setColor(QtGui.QColor('red'))

        self._chart.addSeries(self._marker)
        self._marker.attachAxis(self._xAxis)
        self._marker.attachAxis(self._yAxis)

        self.qt.setMinimumSize(160, 60)

        self._view = QtChart.QChartView(self._chart)
        self.qt.layout().setContentsMargins(0, 0, 0, 0)
        self.qt.layout().addWidget(self._view)
Ejemplo n.º 2
0
    def __init__(self):
        self.r = QtWidgets.QDoubleSpinBox(Form)
        self.label_4 = QtWidgets.QLabel(Form)
        self.label_3 = QtWidgets.QLabel(Form)
        self.L = QtWidgets.QDoubleSpinBox(Form)
        self.btn_pause = QtWidgets.QPushButton(Form)
        self.btn_start = QtWidgets.QPushButton(Form)
        self.label_2 = QtWidgets.QLabel(Form)
        self.R = QtWidgets.QDoubleSpinBox(Form)
        self.label = QtWidgets.QLabel(Form)
        self.M = QtWidgets.QDoubleSpinBox(Form)
        self.chartView = QtChart.QChartView(Form)
        self.chartView.setRenderHint(QtGui.QPainter.Antialiasing)

        self.chart = self.chartView.chart()
        self.chart.legend().setVisible(False)
        self.axisX = QtChart.QValueAxis()
        self.axisY = QtChart.QValueAxis()

        self.axis_series = QtChart.QLineSeries()
        self.ring_series = QtChart.QLineSeries()
        self.rope_series = QtChart.QLineSeries()
        self.dot_series = QtChart.QScatterSeries()

        self.timer = QtCore.QTimer()
        self.timer.setInterval(100)
        self.total_time = .0

        self.runge_kutta = ode(self.f)
        self.runge_kutta.set_integrator('dopri5')

        self.dest = +1
        self.flag = True
Ejemplo n.º 3
0
    def __init__(self):
        self.W = QtWidgets.QDoubleSpinBox(Form)
        self.H = QtWidgets.QDoubleSpinBox(Form)
        self.label_25 = QtWidgets.QLabel(Form)
        self.label_24 = QtWidgets.QLabel(Form)
        self.label_23 = QtWidgets.QLabel(Form)
        self.label_22 = QtWidgets.QLabel(Form)
        self.dY = QtWidgets.QDoubleSpinBox(Form)
        self.mu = QtWidgets.QDoubleSpinBox(Form)
        self.label_21 = QtWidgets.QLabel(Form)
        self.dX = QtWidgets.QDoubleSpinBox(Form)
        self.label_20 = QtWidgets.QLabel(Form)
        self.label_19 = QtWidgets.QLabel(Form)
        self.label_18 = QtWidgets.QLabel(Form)
        self.label_17 = QtWidgets.QLabel(Form)
        self.label_16 = QtWidgets.QLabel(Form)
        self.M = QtWidgets.QDoubleSpinBox(Form)
        self.k4 = QtWidgets.QDoubleSpinBox(Form)
        self.label_15 = QtWidgets.QLabel(Form)
        self.m = QtWidgets.QDoubleSpinBox(Form)
        self.label_14 = QtWidgets.QLabel(Form)
        self.label_13 = QtWidgets.QLabel(Form)
        self.label_12 = QtWidgets.QLabel(Form)
        self.label_11 = QtWidgets.QLabel(Form)
        self.label_10 = QtWidgets.QLabel(Form)
        self.k3 = QtWidgets.QDoubleSpinBox(Form)
        self.label_9 = QtWidgets.QLabel(Form)
        self.label_8 = QtWidgets.QLabel(Form)
        self.k2 = QtWidgets.QDoubleSpinBox(Form)
        self.label_7 = QtWidgets.QLabel(Form)
        self.label_6 = QtWidgets.QLabel(Form)
        self.label_5 = QtWidgets.QLabel(Form)
        self.k1 = QtWidgets.QDoubleSpinBox(Form)
        self.label_4 = QtWidgets.QLabel(Form)
        self.btn_pause = QtWidgets.QPushButton(Form)
        self.btn_start = QtWidgets.QPushButton(Form)
        self.btn_hide = QtWidgets.QPushButton(Form)

        self.chartView = QtChart.QChartView(Form)
        self.chartView.setRenderHint(QtGui.QPainter.Antialiasing)

        self.chart = self.chartView.chart()
        self.chart.legend().setVisible(False)
        self.axisX = QtChart.QValueAxis()
        self.axisY = QtChart.QValueAxis()

        self.mass_series = QtChart.QScatterSeries()
        self.trajectory_series = QtChart.QLineSeries()
        self.box_series = QtChart.QLineSeries()
        self.s1_series = QtChart.QLineSeries()
        self.s2_series = QtChart.QLineSeries()
        self.s3_series = QtChart.QLineSeries()
        self.s4_series = QtChart.QLineSeries()

        self.timer = QtCore.QTimer()
        self.timer.setInterval(10)
        self.total_time = .0

        self.runge_kutta = ode(self.f)
        self.runge_kutta.set_integrator('dopri5')
Ejemplo n.º 4
0
    def addFiles(self, files):
        """
        Add 'files' into the file list widget

        @param files[list]: The list of files to add into the plugin for
            plotting
        """
        for f in files:
            measured_data = self.readFile(f[0])
            computed_data = self.readFile(f[1])

            del measured_data['time']
            del computed_data['time']

            if self.dataCompatible(measured_data, computed_data):
                series = QtChart.QScatterSeries()
                series.setMarkerSize(10)
                for k, v in measured_data.items():
                    series.append(v, computed_data[k])

                series.hovered.connect(self.onHovered)
                self.chart_view.chart().addSeries(series)
                series.attachAxis(self.axis_x)
                series.attachAxis(self.axis_y)

                # to prevent the garbagge collector to destroy the series
                # object so we can use it later
                self.s.append(series)

                # rescale the axis
                smin = min(min(measured_data.values()),
                           min(computed_data.values()))
                if len(self.s) == 1:
                    self.smin = smin
                else:
                    self.smin = min(self.smin, smin)

                smax = max(max(measured_data.values()),
                           max(computed_data.values()))
                if len(self.s) == 1:
                    self.smax = smax
                else:
                    self.smax = max(self.smax, smax)

                self.axis_x.setRange(self.smin, self.smax)
                self.axis_y.setRange(self.smin, self.smax)

                # add into file list
                item1 = self.buildItem(f[0])
                item1.setCheckable(True)
                item1.setCheckState(QtCore.Qt.Checked)

                item2 = QtGui.QStandardItem("\u25A0")
                item2.setEditable(False)
                item2.setForeground(series.brush())
                item2.setData(series)

                self.file_list.appendRow([item1, item2])
Ejemplo n.º 5
0
    def _armar_serie(self, puntos, color):
        serie_puntos = QtChart.QScatterSeries()

        [serie_puntos.append(x, y) for x, y in puntos[:, [self.dim_uno,
                                                          self.dim_dos]]]

        pen_color = copy.deepcopy(color)
        background_color = copy.deepcopy(color)

        self.pen.setColor(pen_color)
        serie_puntos.setPen(self.pen)

        background_color.setAlpha(120)
        serie_puntos.setColor(background_color)

        return serie_puntos
Ejemplo n.º 6
0
 def addData(self,
             dates,
             vals,
             qColor,
             name,
             lineWidth=1,
             chartType="line",
             axis='balance',
             updateAxis=True):
     # check chart type
     if chartType == "line":
         series = qtchart.QLineSeries()
     elif chartType == "scatter":
         series = qtchart.QScatterSeries()
         series.setMarkerSize(6)
         series.setColor(qColor)
         series.setBorderColor(qColor)
     else:
         raise ValueError
     # series properties
     series.setName(name)
     for date, val in zip(dates, vals):
         if isinstance(date, datetime.datetime):
             date = date.timestamp() * 1000
         series.append(date, val)
     pen = qtgui.QPen(qColor)
     pen.setWidth(lineWidth)
     series.setPen(pen)
     self.chart.addSeries(series)
     series.attachAxis(self.xAxis)
     if axis == 'balance':
         series.attachAxis(self.yAxisBalance)
     elif axis == 'price':
         series.attachAxis(self.yAxisPrice)
     else:
         raise ValueError
     if updateAxis:
         self.adjustAxis(vals, qColor, axis=axis)
Ejemplo n.º 7
0
    def __draw_groups(self, chart, group):
        result = True
        for curr_series in chart.series():
            if curr_series.name() == group.name:
                result = False
                break

        if result:
            points_series = QtChart.QScatterSeries()
            points_series.setName(group.name)
            points_series.setMarkerSize(10)
            points_series.setBorderColor(self.__colors[self.__temp_color %
                                                       len(self.__colors)])
            self.__temp_color += 1
            points_series.append(group.x, group.y)

            if points_series not in chart.series():
                chart.addSeries(points_series)

            for sub_group in group.sub_groups:
                line_series = QtChart.QLineSeries()
                line_series.setName(group.name + ' ' + sub_group.name)
                line_series.setColor(points_series.borderColor())
                line_series.append(sub_group.x, sub_group.y)
                line_series.append(sub_group.x, group.y)
                line_series.append(group.x, group.y)
                result = True

                for curr_series in chart.series():
                    if curr_series.name() == line_series.name():
                        result = False
                        break

                if result:
                    chart.addSeries(line_series)

                self.__draw_groups(chart, sub_group)
Ejemplo n.º 8
0
 def add_spot(self,
              list,
              x,
              y,
              shape='circle',
              color='red',
              size=15,
              label='reciprocal_spot'):
     series = QtChart.QScatterSeries()
     if shape == 'circle':
         series.setMarkerShape(QtChart.QScatterSeries.MarkerShapeCircle)
     elif shape == 'rectangle':
         series.setMarkerShape(QtChart.QScatterSeries.MarkerShapeRectangle)
     series.setMarkerSize(size)
     series.setColor(QtGui.QColor(color))
     series.append(x, y)
     self.plot.profileChart.addSeries(series)
     for ax in self.plot.profileChart.axes():
         series.attachAxis(ax)
     if label == 'reciprocal_spot':
         self.reciprocal_spot_series[list] = series
     elif label == 'laue_spot':
         self.laue_spot_series[list] = series
     self.plot.profileChart.axisY().setRange(-0.5, self.plot_range.value())
Ejemplo n.º 9
0
 def __init__(self):
     self.series = QtChart.QScatterSeries()
     self.series.setMarkerSize(1)