Esempio n. 1
0
def read_rsf_XT(shots_rsf='shots_cmp_full.rsf',
                logs_rsf='logs_full.rsf',
                j_log_z=c.jlogz):

    X = rsf_to_np(shots_rsf)
    # single model exception
    if X.ndim == 3:
        X = np.expand_dims(X, axis=0)

    X_f = np.flip(X, axis=2)
    X = np.maximum(np.abs(X), np.abs(X_f)) * np.sign(X + X_f)
    X = X[:, :, :(np.shape(X)[2] + 1) // 2, :]

    T = rsf_to_np(logs_rsf)
    # single model exception
    if T.ndim == 2:
        T = np.expand_dims(T, axis=0)
    # decimate logs in vertical direction --2 times by default
    T = resize(T, (*T.shape[0:2], np.shape(T)[2] // j_log_z))
    T_size = np.shape(T)
    print(T_size)

    # ensure that the number of logs is equal to the number of CMPs
    assert (X.shape[0:2] == T.shape[0:2])
    return X, T
Esempio n. 2
0
def show_model_generation():
    stretch_X_train = c.stretch_X_train
    vel = generate_model(stretch_X=stretch_X_train,
                         training_flag=False,
                         crop_flag=False,
                         distort_flag=False,
                         random_state_number=randint(10000))

    vel = rsf_to_np("marmvel.hh")
    plt_nb_T(aug_flip(vel), dx=4, dz=4, fname="../latex/Fig/marm_aug")

    vel = generate_model(stretch_X=stretch_X_train,
                         distort_flag=False,
                         random_state_number=c.random_state_number,
                         show_flag=True)
    plt_nb_T(vel, fname="../latex/Fig/cropMarm")
    N = np.shape(vel)

    vel_example = elastic_transform(np.atleast_3d(vel),
                                    alpha_deform,
                                    sigma_deform,
                                    random_state_number=c.random_state_number,
                                    plot_name="Normal")

    N = np.shape(vel)
    vel_example = generate_model(stretch_X=stretch_X_train,
                                 training_flag=True,
                                 random_state_number=c.random_state_number,
                                 show_flag=True)
    vel1 = generate_model(stretch_X=stretch_X_train,
                          training_flag=False,
                          random_state_number=randint(10000))
    vel2 = generate_model(stretch_X=stretch_X_train,
                          training_flag=False,
                          random_state_number=randint(10000))
    vel3 = generate_model(stretch_X=stretch_X_train,
                          training_flag=False,
                          random_state_number=randint(10000))
    vel4 = generate_model(stretch_X=stretch_X_train,
                          training_flag=False,
                          random_state_number=randint(10000))
    plt_nb_T(np.concatenate((vel_example, vel1, vel2, vel3, vel4), axis=1),
             fname="../latex/Fig/random_model_example")
Esempio n. 3
0
#run_all_tests(net_dict=singleCMP_net_dict, prefix="singleCMP", generate_rsf_data_flag=True)
run_all_tests(net_dict=multiCMP_net_dict, prefix="multiCMP", generate_rsf_data_flag=True)

print(f"Total execution time is {toc(tic_total)}")

#%% PLOT FWI RESULTS

# for folder in ["marm2",
#                "seam_i_sediments",
#                "seam100",
#                "overthrust"]:

for folder in ["overthrust"]:
    with cd(f"fwi_{folder}"):
        cmd("scons -j 4")
        fwi1 = rsf_to_np("fwi2.rsf")
        fwi2 = rsf_to_np("fwi_shi.rsf")
        velo = rsf_to_np("vel.rsf")
        velsm = rsf_to_np("smvel.rsf")
        R2o = r2_score(velo.flatten(), fwi2.flatten())
        fwi2 = resize(fwi2, (fwi2.shape[0], 120))
        fwi1 = resize(fwi1, (fwi2.shape[0], 120))
        plt_nb_T(fwi2, title=f"DL+MSFWI, R2={R2o:.2f}, NRMS={nrms(velo,fwi2):.1f}%", fname=f"../../latex/Fig/msfwi_{folder}", dx=25, dz=25, figsize=(32,6), vmin=1.5, vmax=4.5)
        plt_nb_T(velsm, 
                 title=f"DL, R2={r2_score(velo.flatten(),velsm.flatten()):.2f}, NRMS={nrms(velo,velsm):.1f}%", 
                 fname=f"../../latex/Fig/dl_{folder}", 
                 dx=25, dz=25, figsize=(16,6), vmin=1.5, vmax=4.5)
        plt_nb_T(velo, 
                 title=f"True model", 
                 fname=f"../../latex/Fig/true_{folder}", 
                 dx=25, dz=25, figsize=(16,6), vmin=1.5, vmax=4.5)