model = pipeline.Model( vs=np.arange(3.5, 4.8, 0.1), all_deps=deps, idep=np.array([25, 50, 60, 70, 80, 90, 100, 102, 104, 106, 108, 110, 112]), std_rf=0, lam_rf=0, std_swd=0) #model = pipeline.Model(vs = np.array([1.8, 2.4, 3.4, 4.5, 4.7, 4.65]), all_deps = deps, # idep = np.array([10, 32, 41, 60, 96, 120]), # std_rf = 0, lam_rf = 0, std_swd = 0) #model = pipeline.Model(vs = np.array([3.4, 4.5]), all_deps = deps, # idep = np.array([60, 96]), # std_rf = 0, lam_rf = 0, std_swd = 0) rf_obs = pipeline.SynthesiseRF(pipeline.MakeFullModel(model)) swd_obs = pipeline.SynthesiseSWD(pipeline.MakeFullModel(model), 1 / np.arange(0.02, 0.1, 0.01), 1e6) all_lims = pipeline.Limits(vs=(0.5, 5.5), dep=(0, 200), std_rf=(0, 0.05), lam_rf=(0.05, 0.5), std_swd=(0, 0.15)) out = pipeline.JointInversion(rf_obs, swd_obs, all_lims, max_it, rnd_sd) actual_model = pipeline.SaveModel(pipeline.MakeFullModel(model), out[1][:, 0]) #%% all_models = out[1] good_mods = all_models[:, np.where(all_models[0, ] > 0)[0]] nit = good_mods.shape[1]
#%% all_models = np.load('testsave.npy') good_mods = all_models[:, np.where(all_models[0, ] > 0)[0]] nit = good_mods.shape[1] good_mods = good_mods[:, -int(nit / 5):] mean_mod = np.mean(good_mods, axis=1) std_mod = np.std(good_mods, axis=1) good_mod = pipeline.Model(vs=mean_mod, all_deps=all_models[:, 0], idep=np.arange(0, mean_mod.size), lam_rf=0, std_rf=0, std_swd=0) fullmodel = pipeline.MakeFullModel(good_mod) fig1 = plt.figure() ax1 = plt.subplot(131) for k in range(all_models[1, ].size - 1): colstr = str(0.75 - k / 2 / all_models[1, ].size) ax1.plot(all_models[:, k], all_models[:, 0], '-', linewidth=1, color=colstr) ax1.set_ylim((195, 0)) #ax1.plot(actual_model,all_models[:,0],'r-',linewidth=3) ax1.set_xlim((2, 5.5)) ax1.set_xlabel('Shear Velocity (km/s)')
basedir = 'D:/Scattered_Waves/RJMCMC/' #'C:/Users/Emily/Documents/RJMCMC/' savename = open(os.path.join(basedir, 'input_data.py'), mode='w') deps = np.concatenate( (np.arange(0, 10, 0.2), np.arange(10, 60, 1), np.arange(60, 201, 5))) model = pipeline.Model(vs=np.array([3.7, 4.3, 4.7, 4.6]), all_deps=deps, idep=np.array([10, 30, 90, 110]), std_rf_sc=1, lam_rf=0.2, std_swd_sc=1) fullmodel = pipeline.MakeFullModel(model) savemodel = pipeline.SaveModel(fullmodel, deps) stdsw = np.array([ 0.7880, 0.3990, 0.5520, 0.4860, 0.3620, 0.2210, 0.0070, 0.0120, 0.0130, 0.0160, 0.0150, 0.0100 ]) swd_in = pipeline.SurfaceWaveDisp( period=np.array([ 9, 10.12, 11.57, 13.5, 16.2, 20.25, 25,