def test_smc_vs_pt(self): problem_smc = load_model(smc_res_dir, 'geometry', build=True) problem_pt = load_model(pt_res_dir, 'geometry', build=True) print('Loaded models') step_smc = problem_smc.init_sampler(False) print('compiled smc') step_pt = problem_pt.init_sampler(False) print('compiled pt') maxpoint = { 'depth': array([1.]), 'dip': array([42.]), 'duration': array([8.]), 'east_shift': array([-4.]), 'h_any_P_0_Z': array([ 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3. ]), 'magnitude': array([6.2]), 'north_shift': array([-4.]), 'rake': array([-110.]), 'strike': array([120.]), 'time': array([-7.4]) } point = problem_smc.get_random_point() point_smc, _ = step_smc.step(point) point_pt, _ = step_pt.step(point) print(point_pt, point_smc)
def test_linear_velmod_covariance(self): print('Warning!: Needs specific project_directory!') project_dir = '/home/vasyurhm/BEATS/LaquilaJointPonlyUPDATE_wide_cov' problem = load_model(project_dir, mode='ffi', build=False) gc = problem.composites['geodetic'] point = problem.get_random_point() gc.update_weights(point) fig, axs = plt.subplots(2, 2) for i, ds in enumerate(gc.datasets): im1 = axs[i, 1].matshow(ds.covariance.data) im2 = axs[i, 0].matshow(ds.covariance.pred_v) print('predv mena', ds.covariance.pred_v.mean()) print('data mena', ds.covariance.data.mean()) plt.colorbar(im1) plt.show()
def load_problem(dirname, mode): beat_dir = get_run_directory() project_dir = os.path.join(beat_dir, 'data/examples', dirname) return models.load_model(project_dir, mode=mode)
def setUp(self): self.mode = 'geometry' self.problem = models.load_model(project_dir, self.mode)
util.setup_logging('test_ffi_stacking', 'info') # set random seed for reproducible station locations num.random.seed(10) nuc_dip = 5. nuc_strike = 2. time_shift = -10. # from previous inversion # general project_dir = '/home/vasyurhm/BEATS/LaquilaJointPonlyUPDATE_wide_kin3' store_superdirs = ['/home/vasyurhm/GF/Laquila'] white_noise_perc_max = 0.025 # White noise to disturb the synthetic data, in percent to the maximum amplitude [Hallo et al. 2016 use 0.01] problem = models.load_model(project_dir, mode='ffi', build=False) event = problem.config.event components = ['uparr'] #, 'uperp'] starttime_sampling = 0.5 arrival_taper = heart.ArrivalTaper( a=-15., b=-10., c=50., d=55.) sc = problem.composites['seismic'] fault = sc.load_fault_geometry()