Loading 2_offset_hierarchical_struct/parse_iv_data.py 0 → 100644 +36 −0 Original line number Diff line number Diff line import mechnet as mn import numpy as np 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): grouppaths = mn.datman.bundle_all_sub_groups(filepath, ["simulationdata"]) simdata = mn.datman.get_simdata(filepath, grouppaths[0], readpickled=False) simdata_dict = simdata.get_simdata_dict() iv_data = np.array(simdata_dict["logged_data"]["iv"]) return iv_data def plot_iv_curve(data): fig, ax = plt.subplots() x = data[:,0] y = data[:,1] ax.plot(x, y) #plt.show() def write_data_to_txt(data, file_name): with open(file_name, 'w') as file: for point in data: x, y = point file.write(f"{x},{y}\n") if __name__ == "__main__": seed = 1000 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}.txt") print("cutoff prev") No newline at end of file Loading
2_offset_hierarchical_struct/parse_iv_data.py 0 → 100644 +36 −0 Original line number Diff line number Diff line import mechnet as mn import numpy as np 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): grouppaths = mn.datman.bundle_all_sub_groups(filepath, ["simulationdata"]) simdata = mn.datman.get_simdata(filepath, grouppaths[0], readpickled=False) simdata_dict = simdata.get_simdata_dict() iv_data = np.array(simdata_dict["logged_data"]["iv"]) return iv_data def plot_iv_curve(data): fig, ax = plt.subplots() x = data[:,0] y = data[:,1] ax.plot(x, y) #plt.show() def write_data_to_txt(data, file_name): with open(file_name, 'w') as file: for point in data: x, y = point file.write(f"{x},{y}\n") if __name__ == "__main__": seed = 1000 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}.txt") print("cutoff prev") No newline at end of file