mod_space[range(mod_space.shape[0]), inds] += 1 fig2 = plt.figure() ax2 = plt.subplot(121) ax2.imshow(np.log10(mod_space[-1::-1] + 1e-1), cmap='viridis', aspect=allvels[-1] / evendeps[-1], extent=[allvels[0], allvels[-1], evendeps[0], evendeps[-1]]) ax2.invert_yaxis() ax2.set_xlabel('Shear Velocity (km/s)') ax2.set_ylabel('Depth (km)') ax2.xaxis.set_label_position('top') ax2.xaxis.tick_top() ax2.set_xlim((1.5, 5)) synth_swd = pipeline.SynthesiseSWD(fullmodel, swd_obs.period, 1e6) synth_rf = pipeline.SynthesiseRF(fullmodel) plt.figure(figsize=(10, 8)) plt.subplot(121) plt.title('Receiver Function\n real: red; synth: grey') rft = np.arange(0, rf_obs.dt * rf_obs.amp.size, rf_obs.dt) plt.plot(rf_obs.amp, rft, 'r-', linewidth=2) plt.plot(synth_rf.amp, rft, '-', color='0.25', linewidth=2) plt.plot(rf_obs.amp - 0.02, rft, 'r--', linewidth=1) plt.plot(rf_obs.amp + 0.02, rft, 'r--', linewidth=1) plt.ylim(30, 0) plt.subplot(122) plt.title('Surface Wave Dispersion\n real: red; synth: grey') plt.plot(swd_obs.period, swd_obs.c, 'r-', linewidth=2)
allvels = np.arange(all_lims.vs[0], all_lims.vs[1], 0.01) evendeps = np.arange(0, all_models[-1, 0], 0.1) i_ed = np.zeros(evendeps.shape, dtype=int) for k in range(all_models[:, 0].size - 1, 0, -1): i_ed[all_models[k, 0] >= evendeps] = k mod_space = np.zeros((evendeps.size, allvels.size)) for k in range(1, good_mods.shape[1]): even_vels = good_mods[i_ed, -k] inds = np.round(even_vels - all_lims.vs[0], 2) / 0.01 - 1 inds = inds.astype(int) mod_space[range(mod_space.shape[0]), inds] += 1 #%% synth_swd = pipeline.SynthesiseSWD(fullmodel, swd_obs, 1e6) if nit * save_every < 1e5: synth_swd_coarse = pipeline.SynthesiseSWD(fullmodel, swd_obs, 1) synth_rf = pipeline.SynthesiseRF(fullmodel, rf_obs) plt.figure(figsize=(6, 8)) ax2 = plt.subplot(111) ax2.imshow(np.log10(mod_space[-1::-1] + 1e-1), cmap='viridis', aspect=allvels[-1] / evendeps[-1], extent=[allvels[0], allvels[-1], evendeps[0], evendeps[-1]]) ax2.invert_yaxis() ax2.set_xlabel('Shear Velocity (km/s)') ax2.set_ylabel('Depth (km)') ax2.xaxis.set_label_position('top') ax2.xaxis.tick_top()
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] good_mods = good_mods[:, -int(nit / 5):] mean_mod = np.mean(good_mods, axis=1)
10.12, 11.57, 13.5, 16.2, 20.25, 25, 32, 40, 50, 60, 80, ]), c=np.zeros(12, ), std=stdsw, #0.01*np.ones(12,) ) swd = pipeline.SynthesiseSWD(fullmodel, swd_in, 1e6) stdrf = np.array([ 0.012, 0.026, 0.033, 0.039, 0.043, 0.045, 0.047, 0.042, 0.037, 0.042, 0.045, 0.043, 0.042, 0.041, 0.041, 0.038, 0.038, 0.038, 0.037, 0.036, 0.035, 0.034, 0.032, 0.029, 0.025, 0.022, 0.019, 0.017, 0.016, 0.015, 0.013, 0.012, 0.013, 0.013, 0.014, 0.013, 0.012, 0.012, 0.012, 0.011, 0.011, 0.011, 0.013, 0.016, 0.021, 0.026, 0.030, 0.031, 0.035, 0.036, 0.033, 0.029, 0.023, 0.016, 0.014, 0.016, 0.017, 0.016, 0.017, 0.019, 0.019, 0.019, 0.018, 0.018, 0.018, 0.018, 0.018, 0.015, 0.015, 0.011, 0.010, 0.014, 0.019, 0.022, 0.021, 0.020, 0.019, 0.019, 0.024, 0.034, 0.047, 0.059, 0.068, 0.076, 0.077, 0.073, 0.068, 0.058, 0.046, 0.034, 0.024, 0.022, 0.032, 0.043, 0.054, 0.062, 0.065, 0.066, 0.063, 0.059, 0.059, 0.068, 0.078, 0.084, 0.088, 0.085, 0.081, 0.073, 0.060, 0.049, 0.037, 0.036, 0.037, 0.038, 0.040, 0.040, 0.041, 0.043, 0.045, 0.047 ]) rf_in = [