Loading 2_offset_hierarchical_struct/parse_iv_data.py +14 −8 Original line number Diff line number Diff line Loading @@ -4,7 +4,6 @@ import matplotlib.pyplot as plt import h5py base_path = "/FASTTEMP/p7/lpyka/hierarchical_interface/2_offset_hierarchical_struct/offset_1" file_name = "FDB_PARSOL_SIRC-FCVC_SOG-IVCG_HFBA_CPC-NIC_-_1000.h5" def get_iv_data(filepath): Loading @@ -21,16 +20,23 @@ def plot_iv_curve(data): ax.plot(x, y) #plt.show() def write_data_to_txt(data, file_name): with open(file_name, 'w') as file: def append_data_to_txt(data, seed): with open("ivcat.txt", 'a') as file: file.write(f"#seed_{seed}\n") for point in data: x, y = point file.write(f"{x} {y}\n") def clear_txt_file(): with open("ivcat.txt", "w") as f: f.write("") if __name__ == "__main__": seed = 1000 clear_txt_file() for seed in range(1000,1009): file_name = f"FDB_PARSOL_SIRC-FCVC_SOG-IVCG_HFBA_CPC-NIC_-_{seed}.h5" full_path = base_path + "/" + file_name iv_data = get_iv_data(full_path) plot_iv_curve(iv_data) write_data_to_txt(iv_data, f"iv_seed{seed}_0.txt") #plot_iv_curve(iv_data) append_data_to_txt(iv_data, seed) print("cutoff prev") No newline at end of file ivcat.txt 0 → 100644 +0 −0 Empty file added. Loading
2_offset_hierarchical_struct/parse_iv_data.py +14 −8 Original line number Diff line number Diff line Loading @@ -4,7 +4,6 @@ import matplotlib.pyplot as plt import h5py base_path = "/FASTTEMP/p7/lpyka/hierarchical_interface/2_offset_hierarchical_struct/offset_1" file_name = "FDB_PARSOL_SIRC-FCVC_SOG-IVCG_HFBA_CPC-NIC_-_1000.h5" def get_iv_data(filepath): Loading @@ -21,16 +20,23 @@ def plot_iv_curve(data): ax.plot(x, y) #plt.show() def write_data_to_txt(data, file_name): with open(file_name, 'w') as file: def append_data_to_txt(data, seed): with open("ivcat.txt", 'a') as file: file.write(f"#seed_{seed}\n") for point in data: x, y = point file.write(f"{x} {y}\n") def clear_txt_file(): with open("ivcat.txt", "w") as f: f.write("") if __name__ == "__main__": seed = 1000 clear_txt_file() for seed in range(1000,1009): file_name = f"FDB_PARSOL_SIRC-FCVC_SOG-IVCG_HFBA_CPC-NIC_-_{seed}.h5" full_path = base_path + "/" + file_name iv_data = get_iv_data(full_path) plot_iv_curve(iv_data) write_data_to_txt(iv_data, f"iv_seed{seed}_0.txt") #plot_iv_curve(iv_data) append_data_to_txt(iv_data, seed) print("cutoff prev") No newline at end of file