diff --git a/tests/python/draw_git_test_plots.py b/tests/python/draw_git_test_plots.py new file mode 100644 index 00000000..c91c8f5d --- /dev/null +++ b/tests/python/draw_git_test_plots.py @@ -0,0 +1,48 @@ +import os +import glob +import pandas as pd +import matplotlib.pyplot as plt +import numpy as np +def plot_data_from_file(file_path): + # Load the data, assuming the last column is text + data = pd.read_csv(file_path, header=None) + rep_size=len(set(data[data.columns[-1]])) + data.drop(data.columns[-1], axis=1, inplace=True) # Drop the last column (text) + + # Number of numerical columns + num_columns = data.shape[1] + + # Create a subplot for each column + fig, axes = plt.subplots(num_columns, 1, figsize=(10, 6 * num_columns)) + + # In case there is only one column, axes will not be an array, so we convert it + if num_columns == 1: + axes = [axes] + + for i, ax in enumerate(axes): + idx=0 + ax.scatter(np.asarray(data.index,dtype=np.int64)%rep_size, data[i], label=f'Column {i+1}') + ax.set_title(f'Column {i+1}') + ax.set_xlabel('ID Number') + ax.set_ylabel('Value') + ax.legend() + ax.grid(True) + + plt.tight_layout() + plt.suptitle(f'Data from {os.path.basename(file_path)}') + + # Save the plot to a file + plt.savefig(file_path.replace('.txt', '.png')) + plt.close() + +def scan_and_plot(directory): + # Scan for .txt files in the given directory + txt_files = glob.glob(os.path.join(directory, '*.txt')) + + # Process each file + for file in txt_files: + print(f'Processing {file}...') + plot_data_from_file(file) + print(f'Plot saved for {file}') +# Replace 'your_folder_path' with the path to the folder containing the .txt files +scan_and_plot('./') \ No newline at end of file diff --git a/tests/python/git_tester.py b/tests/python/git_tester.py index 1f9c2ba7..e7657fee 100644 --- a/tests/python/git_tester.py +++ b/tests/python/git_tester.py @@ -9,16 +9,18 @@ speedtest_copy_path = os.path.join("tests", "python", "speedtest2.py") shutil.copyfile(speedtest_src_path, speedtest_copy_path) # the file has to be outside of git -commits = list(Repository('.', from_tag="v0.6.2").traverse_commits()) +commits = list(Repository('.', from_tag="v0.7.0").traverse_commits()) print("Found commits:") for idx, commit in enumerate(commits): name = commit.msg.replace('\n', ' ').replace('\r', ' ') print(idx, commit.hash, name) for commit in commits: - name = commit.msg.replace('\n', ' ').replace('\r', ' ').replace(",", ";") + commit_time = commit.author_date.strftime("%Y-%m-%d %H:%M:%S") + author_name = commit.author.name + name = "auth:"+author_name+"_"+commit_time+"_msg:"+commit.msg.replace('\n', ' ').replace('\r', ' ').replace(",", ";") print("\nProcessing", commit.hash, name) - + if os.path.exists("build"): shutil.rmtree("build") os.system(f"git checkout {commit.hash}") @@ -43,10 +45,11 @@ print("build failed!!!!") continue - # os.system(f'python {speedtest_copy_path} -n "{hash[:4]}_{name}" -d 32 -t 1') + os.system(f'python {speedtest_copy_path} -n "{commit.hash[:4]}_{name}" -d 16 -t 1') os.system(f'python {speedtest_copy_path} -n "{commit.hash[:4]}_{name}" -d 16 -t 64') - # os.system(f'python {speedtest_copy_path} -n "{name}" -d 64 -t 1') - # os.system(f'python {speedtest_copy_path} -n "{name}" -d 128 -t 1') - # os.system(f'python {speedtest_copy_path} -n "{name}" -d 4 -t 24') - # os.system(f'python {speedtest_copy_path} -n "{name}" -d 128 -t 24') + os.system(f'python {speedtest_copy_path} -n "{commit.hash[:4]}_{name}" -d 4 -t 1') + os.system(f'python {speedtest_copy_path} -n "{commit.hash[:4]}_{name}" -d 4 -t 64') + os.system(f'python {speedtest_copy_path} -n "{commit.hash[:4]}_{name}" -d 128 -t 1') + os.system(f'python {speedtest_copy_path} -n "{commit.hash[:4]}_{name}" -d 128 -t 64') +