示例#1
0
    def __init__(self, parent):
        super().__init__(parent)

        # back end attributes
        self.paths = {}  # {1:'/.../.../', 2:'/.../.../'}
        self.curves = {}  # {1:pd.df, 2:pd.df

        # init curves
        figure_acc_train = plt.figure(dpi=50)
        figure_lss_train = plt.figure(dpi=50)
        figure_acc_val = plt.figure(dpi=50)
        figure_lss_val = plt.figure(dpi=50)

        self.canvas_acc_train = canvas(figure_acc_train)
        self.canvas_lss_train = canvas(figure_lss_train)
        self.canvas_acc_val = canvas(figure_acc_val)
        self.canvas_lss_val = canvas(figure_lss_val)

        # note: set parent to allow super class mainwindow control these canvas
        self.canvas_acc_train.setParent(parent)
        self.canvas_lss_train.setParent(parent)
        self.canvas_acc_val.setParent(parent)
        self.canvas_lss_val.setParent(parent)

        # init toolbar
        Toolbar1 = toolbar(self.canvas_acc_train, self)
        Toolbar2 = toolbar(self.canvas_acc_val, self)
        Toolbar3 = toolbar(self.canvas_lss_train, self)
        Toolbar4 = toolbar(self.canvas_lss_val, self)

        # set layout
        QVBL1 = QtWidgets.QVBoxLayout()
        QVBL1.addWidget(self.canvas_acc_train)
        QVBL1.addWidget(Toolbar1)
        QVBL1.addWidget(self.canvas_lss_train)
        QVBL1.addWidget(Toolbar3)

        QVBL2 = QtWidgets.QVBoxLayout()
        QVBL2.addWidget(self.canvas_acc_val)
        QVBL2.addWidget(Toolbar2)
        QVBL2.addWidget(self.canvas_lss_val)
        QVBL2.addWidget(Toolbar4)

        # set layout
        self.QHBL = QtWidgets.QHBoxLayout()
        self.QHBL.addLayout(QVBL1)
        self.QHBL.addLayout(QVBL2)
        self.setLayout(self.QHBL)

        # finally draw the canvas
        self.canvas_acc_train.draw()
        self.canvas_lss_train.draw()
        self.canvas_acc_val.draw()
        self.canvas_lss_val.draw()
示例#2
0
    def __init__(self, parent):
        super().__init__(parent)

        self.w = {}
        self.betaOrBias = {}
        self.gamma = {}
        self.beta = {}
        self.step = {}

        # todo: w/gamma/beta plots if using batch norm (gamma beta), or 2 plots w/b without batch norm
        figure_w = plt.figure(dpi=50)
        # figure_gamma = plt.figure(dpi=50)
        # figure_beta = plt.figure(dpi=50)

        # set canvas
        self.canvas_w = canvas(figure_w)
        # self.canvas_gamma = canvas(figure_gamma)
        # self.canvas_beta = canvas(figure_beta)

        # layout
        self.QHBL = QtWidgets.QHBoxLayout()
        self.QHBL.addWidget(self.canvas_w)
        # self.QHBL.addWidget(self.canvas_gamma)
        # self.QHBL.addWidget(self.canvas_beta)
        self.setLayout(self.QHBL)

        # todo: scrollable
        # self.QHBL.layout().setContentsMargins(0, 0, 0, 0)
        # self.QHBL.layout().setSpacing(0)

        # draw blancket
        self.canvas_w.draw()
示例#3
0
    def __init__(self, parent):
        super().__init__(parent)

        # back end attributes
        self.total_vs = 0  # {'total_vs': int, 'index': [1, 2, 4, 5...]}
        self.accum_nb_vx = None  # pd.DataFrame{A: [1234, 2345, ], B: [123, 234],...}
        self.accum_interf = None  # pd.DataFrame{'0-1': [0.1, 0.5, 0.3 ...], '0-2': [0.6, 0.02, ...] ...}
        self.plan_vs = None  # pd.DataFrame{A: [1234, 2345, ], B: [123, 234],...}

        # init curve
        volfracplot = plt.figure(dpi=40)
        self.canvas_volfrac = canvas(volfracplot)
        self.canvas_volfrac.setParent(parent)

        # init toolbar
        # Toolbar = toolbar(self.canvas_volfrac, self)

        # set layout
        self.QHBL = QtWidgets.QHBoxLayout()
        # self.QHBL.addWidget(Toolbar)
        self.QHBL.addWidget(self.canvas_volfrac)
        self.setLayout(self.QHBL)

        # draw
        self.canvas_volfrac.draw()
示例#4
0
    def __init__(self):
        super().__init__()
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)  # 타이틀을 제거
        self.setupUi(self)  # ui파일로 구성한 자료를 화면으로 구성 _ 관련 객체 및 바인딩 실시.

        #콤보박스 속성 설정.
        self.combo_portName.addItems(["serial0", "serial1"
                                      ])  #serial0 : Rs232, serial1 : Rs485
        self.combo_baudRate.addItems(["9600", "57600", "115200"])  # 통신속도
        self.combo_target.addItems(
            ["A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7"])  # 그래프로 표현할 소스

        #차트 영역 설정.
        plt.ion()  # 바로바로 그래프로 표현할 수 있도록 설정해줍니다.
        self.fig = plt.Figure()  #figure 영역
        self._canvas = canvas(self.fig)  #canvas 설정
        self.layout_view.addWidget(self._canvas)  # 캔버스를 레이아웃에 배치 --> 차트 출력목적.
        self.ax = self.fig.add_subplot(1, 1, 1)  # axes생성
        self.line_1 = self.ax.plot(
            [random.random() * 1024 for i in range(0, 26)],
            'b-')[0]  # 그래프를 생성하며, 초기화면의 출력을 위해 랜덤값으로 그래프를 그립니다. ( 선색은 파랑색~! )

        #버튼 시그널 설정.
        self.btn_connection.clicked.connect(
            self.slot_connection)  # 시리얼 통신포트 연결
        self.btn_close.clicked.connect(self.slot_close)  # 프로그램 종료
示例#5
0
 def __init__(self, parent):
     super().__init__(parent)
     self.df = None
     fig1 = plt.figure()
     self.canvas1 = canvas(fig1)
     self.canvas1.setParent(parent)
     ########## the following code is mandatory despite the layout being added in QtDesigner, or the MPLwidget sticks on the cornor
     self.QHBL = QtWidgets.QHBoxLayout()
     self.QHBL.addWidget(self.canvas1)
     self.setLayout(self.QHBL)
     ########## the above code is mandatory despite the layout being added  in QtDesigner, or the MPLwidget sticks on the cornor
     self.canvas1.draw()