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]
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) plt.plot(synth_swd.period, synth_swd.c, '-', color='0.25', linewidth=2)
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 = [ pipeline.RecvFunc( amp=np.array([0, 1]), dt=0.25, std=stdrf, #0.02*np.ones(120,), rf_phase='Ps', ray_param=0.06147, filter_corners=[1, 100], std_sc=0.5, weight_by='even') ] rf_Ps = pipeline.SynthesiseRF(fullmodel, rf_in) rf_Sp = pipeline.SynthesiseRF(fullmodel, [ rf_in[0]._replace( rf_phase='Sp', ray_param=0.11012, filter_corners=[4, 100], std_sc=5) ]) if rf_phase == 'Ps': rf = rf_Ps if rf_phase == 'Sp': rf = rf_Sp if rf_phase == 'Both': rf = [rf_Ps[0], rf_Sp[0]] print('\n\nimport pipeline\nimport numpy as np\n', '\ndef LoadObservations():\n', '\n\tswd_obs = pipeline.SurfaceWaveDisp(', '\n\t\tperiod = np.array([', end='', sep='',