Commit 9ac48c81 authored by Leon Pyka's avatar Leon Pyka
Browse files

ls

parent 562a85c0
Loading
Loading
Loading
Loading
+24 −7
Original line number Diff line number Diff line
import mechnet as mn
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import h5py
import sys
@@ -13,12 +15,20 @@ def get_iv_data(filepath):
    iv_data = np.array(simdata_dict["logged_data"]["iv"])
    return iv_data

def plot_iv_curve(data):
    fig, ax = plt.subplots()

def get_index(i, graph_num, width):
    if graph_num <= width:
        index = i
    else:
        index = i//width, i%width
    return index

def add_iv_curve(data, axs, index):
    x = data[:,1]
    y = data[:,0]
    ax.plot(x, y)
    plt.show()
    axs[index].plot(x, y)
    return axs


def append_data_to_txt(data, seed):
    with open("ivcat.txt", 'a') as file:
@@ -35,11 +45,18 @@ if __name__ == "__main__":
    crack_lenght = input("Crack length:  ")
    base_path = f"/FASTTEMP/p7/lpyka/hierarchical_interface/5_precracked/a_{crack_lenght}"
    clear_txt_file()
    for seed in range(1000,1050):
        file_name = f"FDB_PARSOL_SIRC-FCVC_SOG-IVCG_HFBA_CPC-NIC_-_{seed}.h5" 
    low_seed = 1000
    max_seed = 1050
    fig, axs = plt.subplots(5,10) 
    graph_num = max_seed - low_seed 
    for seed in range(low_seed, max_seed):
        file_name = f"RTS_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)
        i = seed - low_seed
        index = get_index(i, graph_num, 10)
        axs = add_iv_curve(iv_data, axs, index)
        append_data_to_txt(iv_data, seed)
    plt.show()
    push_ivcat(base_path) 
    print("cutoff prev")
 No newline at end of file