def openDir(self):
        dialog = QtWidgets.QFileDialog()
        dialog.setFileMode(QFileDialog.DirectoryOnly)

        dic_file = []
        if dialog.exec_():  # == QtGui.QDialog.Accepted:
            dic_file = dialog.selectedFiles()
        print("openDir: (dic_file) ", dic_file)

        log_file = []
        has_log = False
        suf = 'log'
        if dic_file:
            for f in os.listdir(dic_file[0]):
                #         print(f)
                suffix = f[f.rfind('.') + 1:]
                name = f[:f.rfind('.')]
                print(name)
                if suffix == suf:
                    has_log = True
                    if "AnalogicStandaloneType" in name:  # if match AnalogicStandaloneType*.log, append to log_file
                        log_file += dic_file[0] + "/" + f,
            print(has_log, log_file)
            if not has_log:
                self.showdialog(False, has_log)
            if len(log_file) == 0 and has_log:
                self.showdialog(False, False)
            if len(log_file) != 0:
                pp = PreProc(log_file)  # pass files into PreProc class
                dp = DataProc('in_window_logfile.csv',
                              'machine_decision_logfile.csv'
                              )  # pass the prepared data into DataProc class
                dp.getDiffHistogram(dp.linked)
                self.image.setPixmap(QtGui.QPixmap('his.png'))
    def openFile(self):
        filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(
            None, "QFileDialog.getOpenFileNames()", "",
            "All Files (*);;Log Files (*.log);;")
        if filenames:
            print("inside:", filenames)
        print("fdsfs", filenames)

        illegal = False
        suf = 'log'  # test for single .txt first, need to modify for final version
        if len(filenames) != 0:
            for f in filenames:  # check all files are illegal in here
                suffix = f[f.rfind('.') + 1:]
                if suffix != suf:
                    print("Illegal selection")
                    illegal = True
            print(illegal)
            if illegal:
                self.showdialog(illegal, True)
            else:
                pp = PreProc(filenames)  # pass files into PreProc class
                dp = DataProc('in_window_logfile.csv',
                              'machine_decision_logfile.csv'
                              )  # pass the prepared data into DataProc class
                dp.getDiffHistogram(dp.linked)
                self.image.setPixmap(QtGui.QPixmap('his.png'))
Beispiel #3
0
    def openDir(self):
        dialog = QtWidgets.QFileDialog()
        dialog.setFileMode(QFileDialog.DirectoryOnly)

        dic_file = []
        if dialog.exec_():  # == QtGui.QDialog.Accepted:
            dic_file = dialog.selectedFiles()
        print("openDir: (dic_file) ", dic_file)

        log_file = []
        has_log = False
        suf = 'log'
        if dic_file:
            for f in os.listdir(dic_file[0]):
                #         print(f)
                suffix = f[f.rfind('.') + 1:]
                name = f[:f.rfind('.')]
                print(name)
                if suffix == suf:
                    has_log = True
                    if "AnalogicStandaloneType" in name:  # if match AnalogicStandaloneType*.log, append to log_file
                        log_file += dic_file[0] + "/" + f,
            print(has_log, log_file)
            if not has_log:
                self.showdialog(False, has_log)
            if len(log_file) == 0 and has_log:
                self.showdialog(False, False)
            if len(log_file) != 0:
                pp = PreProc(log_file)  # pass files into PreProc class
                dp = DataProc()  # pass the prepared data into DataProc class
                self.statusbar.showMessage('Done')
Beispiel #4
0
    def openFile(self):
        filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(
            None, "QFileDialog.getOpenFileNames()", "",
            "All Files (*);;Log Files (*.log);;")
        if filenames:
            print("inside:", filenames)
        print("fdsfs", filenames)

        illegal = False
        suf = 'log'  # test for single .txt first, need to modify for final version
        if len(filenames) != 0:
            for f in filenames:  # check all files are illegal in here
                suffix = f[f.rfind('.') + 1:]
                if suffix != suf:
                    print("Illegal selection")
                    illegal = True
            print(illegal)
            if illegal:
                self.showdialog(illegal, True)
            else:
                # self.statusbar.showMessage('Processing Files...')
                pp = PreProc(filenames)  # pass files into PreProc class
                # self.statusbar.showMessage('Analyzing datas...')
                dp = DataProc()  # pass the prepared data into DataProc class
                self.statusbar.showMessage('Done')
Beispiel #5
0
    def openDir(self):
        dialog = QtWidgets.QFileDialog()
        dialog.setFileMode(QFileDialog.DirectoryOnly)

        dic_file = []
        if dialog.exec_(): # == QtGui.QDialog.Accepted:
            dic_file = dialog.selectedFiles()
        print(dic_file)

        filenames = []
        if len(dic_file) != 0:
            for f in os.listdir(dic_file[0]):
                print(f)
                filenames += dic_file[0]+"/"+f,
            print(filenames)

        # has_log = False
        # suf = 'log'
        # if dic_file:
        #     for f in os.listdir(dic_file[0]):
        #         print(f)
        #         suffix = f[f.rfind('.')+1:]
        #         if suffix == suf:
        #             has_log = True     
        #     if not has_log:              
        #         self.showdialog(False, has_log);
        # # self.processFile(filenames)
        #     else:
        #         pp = PreProc(filenames)     # pass files into PreProc class
        #         dp = DataProc('in_window_logfile.csv', 'machine_decision_logfile.csv')     # pass the prepared data into DataProc class
        pp = PreProc(filenames)     # pass files into PreProc class
        dp = DataProc('in_window_logfile.csv', 'machine_decision_logfile.csv')     # pass the prepared data into DataProc class
Beispiel #6
0
    def openFile(self):
        filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(None,"QFileDialog.getOpenFileNames()", "","All Files (*);;Log Files (*.log);;")
        if filenames:
            print("inside:",filenames)
        print("fdsfs", filenames)

        illegal = False
        suf = 'log' # test for single .txt first, need to modify for final version
        if len(filenames) != 0:
            for f in filenames: # check all files are illegal in here
                suffix = f[f.rfind('.')+1:]
                if suffix != suf:
                    print("Illegal selection")
                    illegal = True
            print(illegal)
            if illegal:
                self.showdialog(illegal, True);
            else:
                # self.statusbar.showMessage('Processing Files...')
                start_time = timeit.default_timer()
                pp = PreProc(filenames)     # pass files into PreProc class
                elapsed = timeit.default_timer() - start_time
                print("time cost preProc:", elapsed)
                # self.statusbar.showMessage('Analyzing datas...')
                start_time1 = timeit.default_timer()
                dp = DataProc()     # pass the prepared data into DataProc class
                elapsed1 = timeit.default_timer() - start_time1
                print("time cost dataProc:", elapsed1)
                self.linked = dp.linked
                self.unlinked = dp.unlinked
                self.dfinal = dp.dfinal
                self.cut_oversized = dp.cut_oversized
                self.statusbar.showMessage('Done')
                self.removeWidgets()
                self.layout.addWidget(self.createBar())
Beispiel #7
0
    def choosePath(self):
        # pop out the file dialog

        dialog = QFileDialog()
        dialog.setFileMode(QFileDialog.ExistingFiles)

        filenames = []
        if dialog.exec_():
            filenames = dialog.selectedFiles()
        # print(filenames)
        illegal = False
        suf = 'log'  # test for single .txt first, need to modify for final version
        if len(filenames) != 0:
            for f in filenames:  # check all files are illegal in here
                print(f)  #, f.rfind('.'), f[f.rfind('.')+1:])
                suffix = f[f.rfind('.') + 1:]
                if suffix != suf:
                    print("Illegal selection")
                    illegal = True
            if illegal:
                print("Should pop up message box")
                self.showdialog()
                # then go back to selection

            # we made here because all files are log file
            # go to File process procedure, I might prababely create a calss for process log files
            else:
                self.textBox.setText((',').join(filenames))
                print("show loding dialog")
                # self.l = LoadView()
                # self.l
                # fp = FileProc(filenames)
                pp = PreProc(filenames)
                dp = DataProc('in_window_logfile.csv',
                              'machine_decision_logfile.csv')
                # linked_bags = fp.getLinkedBags()
                # unlinked_bags = fp.getUnlinkedBags()
                # print(len(linked_bags), len(unlinked_bags))
                # dp = DataProc(linked_bags, unlinked_bags)

                # # self.l.setParent(None)
                # # uncomment below when fileProc connect to dataProc
                # self.m = MainMenu('his.png')      # this line is to show histogram

                # self.h = HisView('his.png')
                # self.h.show()
                # to here
                print(dp.dfinal)
                model = pandasModel(dp.dfinal)
                self.view = QTableView()
                self.view.setModel(model)
                self.view.resize(800, 600)
                self.view.show()
Beispiel #8
0
    def openDir(self):
        dialog = QtWidgets.QFileDialog()
        dialog.setFileMode(QFileDialog.DirectoryOnly)

        dic_file = []
        if dialog.exec_(): # == QtGui.QDialog.Accepted:
            dic_file = dialog.selectedFiles()

        log_file = []
        has_log = False
        suf = 'log'
        if dic_file:
            for f in os.listdir(dic_file[0]):
                suffix = f[f.rfind('.')+1:]
                name = f[:f.rfind('.')]
                if suffix == suf:
                    has_log = True
                    if "AnalogicStandaloneType" in name:# if match AnalogicStandaloneType*.log, append to log_file
                        log_file += dic_file[0]+"/"+f,
            if not has_log:            
                self.showdialog(False, has_log)
            if len(log_file) == 0 and has_log:
                self.showdialog(False, False)
            if len(log_file) != 0:
                start_time = timeit.default_timer()
                pp = PreProc(log_file)     # pass files into PreProc class
                elapsed = timeit.default_timer() - start_time
                print("time cost on processing data:", elapsed)
                start_time1 = timeit.default_timer()
                dp = DataProc()     # pass the prepared data into DataProc class
                elapsed1 = timeit.default_timer() - start_time1
                print("time cost on load data:", elapsed1)
                self.linked = dp.linked
                self.unlinked = dp.unlinked
                self.dfinal = dp.dfinal
                self.cut_oversized = dp.cut_oversized
                self.slipping = dp.slipping
                self.pushed = dp.pushed
                self.entrance_events = pp.entrance_events
                self.entrance_misreads = pp.misread_entrance
                self.found_prev_bag = pp.found_prev_bag
                self.total_bins = pp.total_bins
                self.scanner_linked_rfid = pp.scanner_linked_rfid
                self.already_sent_moveback_bag = pp.bag_already_sent
                self.lost_track_crusty_bag = pp.lost_track_crusty_bag
                self.exit_events = pp.exit_events
                self.exit_misreads = pp.misread_exit 
                self.exit_read_unlinked = pp.exit_read_unlinked
                self.statusbar.showMessage('Done')
                self.setSummaryLabel()
                self.setUnlinkedLabel()
                self.setFileLists(log_file)
                self.onActivated(self.currText)         # to display chart corresponding to dropdown selections
Beispiel #9
0
    def openDir(self):
        dialog = QtWidgets.QFileDialog()
        dialog.setFileMode(QFileDialog.DirectoryOnly)

        dic_file = []
        if dialog.exec_(): # == QtGui.QDialog.Accepted:
            dic_file = dialog.selectedFiles()
        print("openDir: (dic_file) ", dic_file)

        log_file = []
        has_log = False
        suf = 'log'
        if dic_file:
            for f in os.listdir(dic_file[0]):
                suffix = f[f.rfind('.')+1:]
                name = f[:f.rfind('.')]
                print(name)
                if suffix == suf:
                    has_log = True
                    if "AnalogicStandaloneType" in name:# if match AnalogicStandaloneType*.log, append to log_file
                        log_file += dic_file[0]+"/"+f,
            print(has_log, log_file)
            if not has_log:            
                self.showdialog(False, has_log)
            if len(log_file) == 0 and has_log:
                self.showdialog(False, False)
            if len(log_file) != 0:
                start_time = timeit.default_timer()
                pp = PreProc(log_file)     # pass files into PreProc class
                elapsed = timeit.default_timer() - start_time
                print("time cost preProc:", elapsed)
                start_time1 = timeit.default_timer()
                dp = DataProc()     # pass the prepared data into DataProc class
                elapsed1 = timeit.default_timer() - start_time1
                print("time cost dataProc:", elapsed1)
                self.linked = dp.linked
                self.unlinked = dp.unlinked
                self.dfinal = dp.dfinal
                self.cut_oversized = dp.cut_oversized
                self.statusbar.showMessage('Done')
                self.removeWidgets()
                self.layout.addWidget(self.createBar())
Beispiel #10
0
    def openFile(self):
        filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(None,"QFileDialog.getOpenFileNames()", "","All Files (*);;Log Files (*.log);;")

        illegal = False
        suf = 'log' # test for single .txt first, need to modify for final version
        if len(filenames) != 0:
            for f in filenames: # check all files are illegal in here
                suffix = f[f.rfind('.')+1:]
                if suffix != suf:
                    illegal = True
            if illegal:
                self.showdialog(illegal, True);
            else:
                start_time = timeit.default_timer()
                pp = PreProc(filenames)     # pass files into PreProc class
                elapsed = timeit.default_timer() - start_time
                print("time cost on processing data:", elapsed)
                start_time1 = timeit.default_timer()
                dp = DataProc()     # pass the prepared data into DataProc class
                elapsed1 = timeit.default_timer() - start_time1
                print("time cost on load data:", elapsed1)
                self.linked = dp.linked
                self.unlinked = dp.unlinked
                self.dfinal = dp.dfinal
                self.cut_oversized = dp.cut_oversized
                self.slipping = dp.slipping
                self.pushed = dp.pushed
                self.entrance_events = pp.entrance_events
                self.entrance_misreads = pp.misread_entrance
                self.found_prev_bag = pp.found_prev_bag
                self.total_bins = pp.total_bins
                self.scanner_linked_rfid = pp.scanner_linked_rfid   
                self.already_sent_moveback_bag = pp.bag_already_sent
                self.lost_track_crusty_bag = pp.lost_track_crusty_bag
                self.exit_events = pp.exit_events
                self.exit_misreads = pp.misread_exit  
                self.exit_read_unlinked = pp.exit_read_unlinked
                self.statusbar.showMessage('Done')
                self.setSummaryLabel()
                self.setUnlinkedLabel()
                self.setFileLists(filenames)
                self.onActivated(self.currText)         # to display chart corresponding to dropdown selections
Beispiel #11
0
    def choosePath(self):   # pop out the file browser, triggered by "open" button

        dialog = QFileDialog()
        dialog.setFileMode(QFileDialog.ExistingFiles)

        filenames = []
        if dialog.exec_():
            filenames = dialog.selectedFiles()  
        # print(filenames)
        illegal = False
        suf = 'log' # test for single .txt first, need to modify for final version
        if len(filenames) != 0:
            for f in filenames: # check all files are illegal in here
                # print(f)    #, f.rfind('.'), f[f.rfind('.')+1:])
                suffix = f[f.rfind('.')+1:]
                if suffix != suf:
                    print("Illegal selection")
                    illegal = True

            # if selected file contains illegal extension, show warning
            if illegal:
                print("Should pop up message box")
                self.showdialog();
                # then go back to selection 
                    
            # we made here because all files are log file, go to File process procedure,seperate calss for process log files
            else:
                self.textBox.setText((',').join(filenames))     # display selected files inside the textedit box

                pp = PreProc(filenames)     # pass files into PreProc class
                dp = DataProc('in_window_logfile.csv', 'machine_decision_logfile.csv')     # pass the prepared data into DataProc class

                self.m = MainMenu('his.png')      # this line is to show histogram

                print(dp.dfinal)    # print the final dataframe, show on console

                # diaplay the dataframe on seperate widget
                model = pandasModel(dp.dfinal)  
                self.view = QTableView()
                self.view.setModel(model)
                self.view.resize(800, 600)
                self.view.show()
Beispiel #12
0
    def openFile(self):
        filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(None,"QFileDialog.getOpenFileNames()", "","All Files (*);;Log Files (*.log);;")
        if filenames:
            print("inside:",filenames)
        print("fdsfs", filenames)

        # self.processFile(filenames)
        # illegal_file = False
        # has_log = False
        # suf = 'log' # test for single .txt first, need to modify for final version
        # if len(filenames) != 0:
        #     for f in filenames: # check all files are illegal in here
        #         print("fff")
        #         suffix = f[f.rfind('.')+1:]
        #         if suffix != suf:
        #             print("Illegal selection")
        #             illegal = True
        #         elif suffix == suf:
        #             has_log = True
        #     self.showdialog(illegal_file, has_log);
        pp = PreProc(filenames)     # pass files into PreProc class
        dp = DataProc('in_window_logfile.csv', 'machine_decision_logfile.csv')     # pass the prepared data into DataProc class
Beispiel #13
0
    def createBar(self, MainWindow):
        dp = DataProc()
        # print(dp.linked)
        linked_list = dp.linked['Beam Diff'].values.tolist()
        # print(linked_list)

        count = [0] * 200
        # print(count)

        for item in linked_list:
            if item <= 160:
                count[int(item)] += 1

        set0 = QBarSet('Beam Difference')
        # set0.setColor(QColor("blue"))
        # add pen width to bar
        pen = QPen(QColor(0xfdb157))
        pen.setWidth(5)
        set0.setPen(pen)
        # set1 = QBarSet('X1')

        set0.append(count)
        # set0.append([random.randint(0, 10) for i in range(6)])

        series = QBarSeries()
        series.append(set0)
        # series.barWidth()

        # series.append(set1)

        # Getting the Chart
        chart = QChart()  # Getting the Chart

        # add font to title
        font = QFont()
        font.setPixelSize(18)
        chart.setTitleFont(font)

        chart.addSeries(series)  # Add data
        chart.setTitle('Linked Bags Histogram')  # Set title
        chart.setAnimationOptions(QChart.SeriesAnimations)  # Set animation

        # months = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun') # Set custom axis
        times = [
            '0-20', '20-40', '40-60', '60-80', '80-100', '100-120', '120-140',
            '140-160'
        ]

        # Set x-axis
        axisX = QBarCategoryAxis()
        # axisX.append(months)
        axisX.append(times)

        # Set y-axis
        # axisY = QValueAxis()
        # axisY.setRange(0, 200)

        # Alignment for x,y axis
        chart.addAxis(axisX, Qt.AlignBottom)
        # chart.addAxis(axisY, Qt.AlignLeft)

        # Enable legend and set custom axis alignment to bottom
        chart.legend().setVisible(True)
        chart.legend().setAlignment(Qt.AlignBottom)

        # Create ChartView
        chartView = QChartView(chart)
        # add rendering
        # chartView.setRenderHint(QPainter.Antialiasing)
        # Set view at the center of MainWindw (show view)
        MainWindow.setCentralWidget(chartView)