Exemplo n.º 1
0
def main(basic, path_train):
    print(path_train[1:])
    file = get_data(basic + path_train)
    with DB() as db:
        for i in range(len(file.data1)):
            db.write(file.package_mess[0][0], file.data1[i], file.data2[i],
                     file.data3[i], file.data4[i])
Exemplo n.º 2
0
def main():
    path = "C:/Users/liang-jiashun/Desktop/0011.xlsx"
    this = getdata.get_data(path)
    plt.figure()
    plt.scatter(range(len(this.result2[0])), this.result2[0])
    res = savgol(this.result2[0], 3, 2)
    # plt.figure()
    plt.scatter(range(len(res)), res)
    res = np.convolve([0.2, 0.3, 0.5], this.result2[0])
    res[20] = res[19] = res[18]
    res[0] = res[1] = res[2]
    print(len(res))
    plt.scatter(range(len(res)), res)
    plt.show()
    print(len(res))
Exemplo n.º 3
0
def main():
    path_bath = "0001"
    path_src = "C:/Users/liang-jiashun/Desktop" + "/" + path_bath
    files = os.listdir(path_src)
    for i, file in enumerate(files):
        if not os.path.isdir(path_src + "/" + file):
            print(file)
            this = getdata.get_data(path_src + "/" + file)

            while 0 in this.data1:
                this.data1.remove(0)
                this.data2.remove(0)
                this.data3.remove(0)
                this.y.remove(0)

            # ax3d(change.log(this.data1), change.log(this.data2), change.log(this.data3), file)
            ax3d(this.data1, this.data2, this.data3, file)
            # break
    plt.show()
Exemplo n.º 4
0
    def __init__(self, path, basic, createFile=True):
        # ---------------------- 读取数据输入文件
        self.a.clear()
        self.b.clear()
        self.c.clear()
        this = Get.get_data(basic + path, head_del=False)
        try:
            for i in range(int(len(this.data1) / this.data1.index(0))):
                self.a.append(
                    copy.deepcopy(
                        this.data1[this.data1.index(0) * i +
                                   i:this.data1.index(0) * (i + 1) + i]))
                self.b.append(
                    copy.deepcopy(
                        this.data2[this.data2.index(0) * i +
                                   i:this.data2.index(0) * (i + 1) + i]))
                self.c.append(
                    copy.deepcopy(
                        this.data3[this.data3.index(0) * i +
                                   i:this.data3.index(0) * (i + 1) + i]))
        except IndexError:
            self.a.append(copy.deepcopy(this.data1))
            self.b.append(copy.deepcopy(this.data2))
            self.c.append(copy.deepcopy(this.data3))

        # --------------------------------- 生成输出文件
        if createFile:
            if not os.path.exists(basic + "/test"):  # 创建test目录
                os.makedirs(basic + "/test")

            if os.path.exists(basic + "/test/test_" + path[1:]):
                os.remove(basic + "/test/test_" + path[1:])
            shutil.copy("C:/Users/liang-jiashun/Desktop/Excel模板/test.xlsx",
                        basic + "/test")
            os.rename(basic + "/test/test.xlsx",
                      basic + "/test/test_" + path[1:])
            WriteExcel.initexcel(basic + "/test/test_" + path[1:])
Exemplo n.º 5
0
def main():
    this = Get.get_data("C:/Users/liang-jiashun/Desktop/0011.xlsx")
    a = log(this.data1)
    print(a)
Exemplo n.º 6
0
def excel(path, path_excel, size_max=4, size_min=3):
    score = Score(size_max=size_max, size_min=size_min)
    wb = openpyxl.load_workbook(filename=path_excel)
    ws = wb.worksheets[0]
    excel_clear(ws)
    y = 2
    x = 4 * 0
    files = os.listdir(path)

    number = 0
    for file in files:
        if not os.path.isdir(path + '/' + file):
            number += 1
    bar = progressbar.ProgressBar(
        max_value=number * 2,
        widgets=[
            '自动评价中: ',
            progressbar.Bar('>'),
            ' ',
            progressbar.Counter(format='%(value)02d/%(max_value)d'),
        ],
    )
    print()

    for file in files:
        if not os.path.isdir(path + '/' + file):
            this = Get.get_data(path + '/' + file)
            res = score.score(this.result1)
            # print(file, res[0][0], res[0][1], res[0][2])
            if file.split('_')[-3].find('告') == -1:
                ws.cell(
                    row=y, column=1
                ).value = file.split('_')[-3] + '_' + file.split('_')[-2]
            else:
                ws.cell(row=y, column=1).value = file.split('_')[-2]
            ws.cell(row=y, column=2 + x).value = res[1][0]
            ws.cell(row=y, column=3 + x).value = res[1][1]
            ws.cell(row=y, column=4 + x).value = res[1][2]
            bar.update(y - 2)
            y += 1
    y = 2
    x = 4 * 1
    files = os.listdir(path + '/test')
    for file in files:
        if not os.path.isdir(path + '/test/' + file):
            this = Get.get_data(path + '/test/' + file)
            res = score.score(this.result1)
            # print(file, res[0][0], res[0][1], res[0][2])
            ws.cell(row=y, column=2 + x).value = res[1][0]
            ws.cell(row=y, column=3 + x).value = res[1][1]
            ws.cell(row=y, column=4 + x).value = res[1][2]
            bar.update(y - 2 + number)
            y += 1
    try:
        wb.save(filename=path_excel)
    except PermissionError:
        print()
        print('保存 {} 文件时:缺少权限 or 文件已打开!!!'.format(path_excel))
        wb.close()
        exit()
    print('Score table has created!')
    bar.finish()