Example #1
0
    def showDialog(self):

        text, ok = QInputDialog.getText(self, 'Input Dialog',
                                        'Enter your text:')

        if ok:
            if 'file:' in text:
                self.le.setText(
                    main.mixText(main.readFile(text.replace('file:', ''))))
            else:
                self.le.setText(main.mixText(str(text) + '.'))
Example #2
0
def openArquivo():
    try:
        fileName = filedialog.askopenfilename(title="Select File",
                                              filetypes=(("txt files",
                                                          "*.txt"),
                                                         ("all files", "*.*")))
        if fileName != '':
            code = main.readFile(fileName)
            textinput.delete('1.0', 'end-1c')
            textinput.insert("end-1c", code)
    except Exception as e:
        pass
Example #3
0
    def browse(self):
        options = QtWidgets.QFileDialog.Options()
        options |= QtWidgets.QFileDialog.DontUseNativeDialog
        self.inputFile = QtWidgets.QFileDialog.getOpenFileName(
            self.mainWindow,
            "QFileDialog.getOpenFileName()",
            "",
            options=options)
        if self.inputFile:
            self.inputFile = str(self.inputFile[0])
            self.lines = classifier.readFile(self.inputFile)
            self.labelFileName.setText("Nazwa przetwarzanego pliku: \n" +
                                       self.inputFile.split("/")[-1])

            self.progressBar.setProperty("value", 0)
            self.labelNumOfNature.setText("")
Example #4
0
def debug():
    try:
        entrada = textinput.get("1.0", 'end-1c')
        main.execultaDebug(entrada, var.get())

        debug_message = main.readFile('parselog.txt')

        root2 = tk.Tk()
        root2.title("SiNo 1.0")
        root2.geometry('1366x768')

        #ico2 = PhotoImage(file = 'icones/post.png')
        #root2.tk.call('wm', 'iconphoto', root2._w, ico2)
        canvas = tk.Canvas(root2, bg='#FDF5E6', height=HEIGHT, width=WIDTH)
        canvas.pack(expand=YES, fill=BOTH)

        label3 = tk.Label(root2, text=" DEBUG PLY ", bg='#FDF5E9')
        label3.place(relx=0.40, rely=0.01)
        frame1 = tk.Frame(root2, bg='#FDF5E9', bd=5)
        frame1.place(relx=0.53,
                     rely=0.03,
                     relwidth=0.95,
                     relheight=0.95,
                     anchor='n')

        textinput1 = tk.Text(frame1, font=(NORM_FONT, 15))
        textinput1.place(relwidth=0.95, relheight=0.95)

        textinput1.insert("end-1c", debug_message)

        scrollBar_input1 = tk.Scrollbar(frame1)
        scrollBar_input1.place(relx=0.96, rely=0.01, relwidth=0.018)

        scrollBar_input1.config(command=textinput1.yview)
        textinput1.config(yscrollcommand=scrollBar_input1.set)

        root2.mainloop()

    except Exception as e:
        label.insert(
            "end-1c",
            ' \n ************************************* SiNo ************************************* \n'
            + '>>Return main::  ' + str(e))
Example #5
0
    plt.plot([real_global_returns] * len(hist))
    plt.title("boxplot_ARMA")

    plt.subplot(1, 3, 2)
    plt.boxplot([sim_garch])
    plt.plot([real_global_returns] * len(hist))
    plt.title("boxplot_GARCH")

    plt.subplot(1, 3, 3)
    plt.boxplot([sim_sv])
    plt.plot([real_global_returns] * 500)
    plt.title("boxplot_SV")

    plt.show()


#for test
import main
import GlobalValue

if __name__ == '__main__':
    main.readFile('Portfolio structure.csv')
    main.readHistData('Historical Data.csv')
    modelp = pickle.load(open("globalValue_modelParams.dat", "rb"))
    yahoodata = pickle.load(open("globalValue_yahooData.dat", "rb"))
    #print(modelp[0])
    #plot_simulation(modelp[0],yahoodata[0])
    #plot_simulation(modelp[1],yahoodata[1])
    #plot_simulation(modelp[2],yahoodata[2])
    #returns = pickle.load(open("global_returns.dat", "rb"))
Example #6
0
    plt.title("boxplot_ARMA")

    plt.subplot(1,3,2)
    plt.boxplot([sim_garch])
    plt.plot([real_global_returns] * len(hist))
    plt.title("boxplot_GARCH")

    plt.subplot(1,3,3)
    plt.boxplot([sim_sv])
    plt.plot([real_global_returns]*500)
    plt.title("boxplot_SV")

    plt.show()



#for test
import main
import GlobalValue

if __name__ == '__main__':
    main.readFile('Portfolio structure.csv')
    main.readHistData('Historical Data.csv')
    modelp = pickle.load(open("globalValue_modelParams.dat", "rb"))
    yahoodata = pickle.load(open("globalValue_yahooData.dat", "rb"))
    #print(modelp[0])
    #plot_simulation(modelp[0],yahoodata[0])
    #plot_simulation(modelp[1],yahoodata[1])
    #plot_simulation(modelp[2],yahoodata[2])
    #returns = pickle.load(open("global_returns.dat", "rb"))
from main import readFile

assert len(readFile(
    'mapping-coding--graph.dat')) != 77485, "Houston we've got a problem"
Example #8
0
                   default_element_size=(40, 1),
                   grab_anywhere=False)
check = False

while True:  # Event Loop
    event, values = window.read()
    if event == sg.WIN_CLOSED or event == 'Exit':
        break
    try:
        if event == 'Submit':
            if values['result_file_path'] == "Select result file":
                print("Please select result file path")
            else:
                #print(values['result_file_path'])
                path = values['result_file_path']
                readFile(path)
                check = True
                #print(values)
        elif event == 'Generate' and check:
            if values['top_3']:
                print("Top 3 students\n")
                print('{:20s} {:20s} {:40s}'.format("Roll No.", "Name",
                                                    "Percentage"))
                for x in range(3):
                    print('{:20s} {:20s} {:40s}'.format(
                        percentData[x]['rollNo'], percentData[x]['name'],
                        percentData[x]['percentage']))
            elif values['sub_wise']:
                for key, value in subjectCodeDist.items():
                    print(
                        str(key) + "     A1 = " + str(value['A1']) + " A2 = " +
    def processFiles(self, path, gap):
        if self.isStopped():
            return
        filenames = []
        self.flag_ad = "0"
        self.flag_de = "0"
        for filename in os.listdir(path):
            #用来判断文件夹中是否有之前处理过的数据,记录下之前处理数据的下标
            if str(filename).startswith("adsorption_spectrum") and str(
                    filename).endswith(".xls"):
                self.flag_ad = str(int(str(filename)[-5]) + 1)
            if str(filename).startswith("desorption_spectrum") and str(
                    filename).endswith(".xls"):
                self.flag_de = str(int(str(filename)[-5]) + 1)

            if str(filename).endswith(".jdx"):
                filenames.append(filename)

        flag = 0
        for filename in filenames:
            if flag == 0:
                f = open("directory.txt", 'w')
                f.write(path + "\\" + filename)
                f.close()
                flag = 1

            if self.isStopped():
                return
            data = main.readFile(unicode(path + "\\" + filename))
            if str(filename).endswith("ef.jdx"):
                self.data_ad[1:1] = [data]
                self.data_de[1:1] = [data]
#            [self.data_x1,self.data_y1]=data
            elif str(filename).endswith("ark.jdx"):
                self.data_ad[0:0] = [data]
                self.data_de[0:0] = [data]
#            [self.data_x2,self.data_y2]=data
            else:
                if str(filename).startswith("a") and str(filename).endswith(
                        ".jdx"):
                    self.data_ad.append(data)
                elif str(filename).startswith("d") and str(filename).endswith(
                        ".jdx"):
                    self.data_de.append(data)
            self.emit(SIGNAL("indexed(QString)"), filename)

        import xlwt
        file_ad = xlwt.Workbook()
        table_ad = file_ad.add_sheet('Sheet1', cell_overwrite_ok=True)
        file_ad.save(path + "\\" + 'adsorption_spectrum' + self.flag_ad +
                     '.xls')
        count = 0
        flag = 0
        for i in range(2, len(self.data_ad), gap):
            print(i)
            temp = main.slotTest2DataProcess(
                self.data_ad[0][0], self.data_ad[0][1], self.data_ad[1][0],
                self.data_ad[1][1], self.data_ad[i][0], self.data_ad[i][1])
            self.result_ad.append(temp)

            if flag == 0:
                data_x_smooth = temp[0]
                data_y_smooth = temp[1]

                if count == 0:
                    for j in range(len(data_x_smooth)):
                        table_ad.write(j, count, data_x_smooth[j])
                        table_ad.write(j, count + 1, data_y_smooth[j])
                else:
                    for j in range(len(data_y_smooth)):
                        table_ad.write(j, count + 1, data_y_smooth[j])

                count = count + 1
                if count % 10 == 0:
                    print("................")
                    file_ad.save(path + "\\" + 'adsorption_spectrum' +
                                 self.flag_ad + '.xls')
            flag = (flag + 1) % 5
            self.emit(SIGNAL("processed(QString)"), "adsorption --- %i " % i)
        file_ad.save(path + "\\" + 'adsorption_spectrum' + self.flag_ad +
                     '.xls')

        file_de = xlwt.Workbook()
        table_de = file_de.add_sheet('Sheet1', cell_overwrite_ok=True)
        file_de.save(path + "\\" + 'desorption_spectrum' + self.flag_de +
                     '.xls')
        count = 0
        flag = 0
        for i in range(2, len(self.data_de), gap):
            print(i)
            temp = main.slotTest2DataProcess(
                self.data_de[0][0], self.data_de[0][1], self.data_de[1][0],
                self.data_de[1][1], self.data_de[i][0], self.data_de[i][1])
            self.result_de.append(temp)

            if flag == 0:
                data_x_smooth = temp[0]
                data_y_smooth = temp[1]

                if count == 0:
                    for j in range(len(data_x_smooth)):
                        table_de.write(j, count, data_x_smooth[j])
                        table_de.write(j, count + 1, data_y_smooth[j])
                else:
                    for j in range(len(data_y_smooth)):
                        table_de.write(j, count + 1, data_y_smooth[j])

                count = count + 1
                if count % 10 == 0:
                    print("......................")
                    file_de.save(path + "\\" + 'desorption_spectrum' +
                                 self.flag_de + '.xls')
            flag = (flag + 1) % 10
            self.emit(SIGNAL("processed(QString)"), "desorption --- %i " % i)
        file_de.save(path + "\\" + 'desorption_spectrum' + self.flag_de +
                     '.xls')
        self.completed = True