def test_gm_calculation_hard_rock(self): """ Test mean and std calculation - on hard rock using AB06""" # Modified gmpe mgmpe = NRCan15SiteTermLinear(gmpe_name='AtkinsonBoore2006') # Set parameters sites = Dummy.get_site_collection(2, vs30=[760, 2010]) rup = Dummy.get_rupture(mag=7.0) dists = DistancesContext() dists.rrup = np.array([15., 15.]) stdt = [const.StdDev.TOTAL] gmpe = AtkinsonBoore2006() for imt in [PGA(), SA(1.0), SA(5.0)]: # # Computes results mean, stds = mgmpe.get_mean_and_stddevs(sites, rup, dists, imt, stdt) # Compute the expected results mean_expected, stds_expected = gmpe.get_mean_and_stddevs( sites, rup, dists, imt, stdt) # Test that for reference soil conditions the modified GMPE gives # the same results of the original gmpe np.testing.assert_allclose(np.exp(mean), np.exp(mean_expected), rtol=1.0e-1) np.testing.assert_allclose(stds, stds_expected)
def test_gm_calculationAB06(self): # Modified gmpe mgmpe = NRCan15SiteTerm(gmpe_name='AtkinsonBoore2006') ctx = self.ctx(4, [1000., 1500., 1000., 1500.]) ctx.rrup = np.array([10., 10., 40., 40.]) imt = PGA() stdt = [const.StdDev.TOTAL] # Computes results mean, stds = mgmpe.get_mean_and_stddevs(ctx, ctx, ctx, imt, stdt) # Compute the expected results gmpe = AtkinsonBoore2006() mean_expected, stds_expected = gmpe.get_mean_and_stddevs( ctx, ctx, ctx, imt, stdt) # Test that for reference soil conditions the modified GMPE gives the # same results of the original gmpe np.testing.assert_almost_equal(mean, mean_expected) np.testing.assert_almost_equal(stds, stds_expected)
def test_gm_calculationAB06_hard_bedrock(self): """ Test mean and std calculation - AB06 on vs30 hard bedrock""" # Modified gmpe mgmpe = NRCan15SiteTerm(gmpe_name='AtkinsonBoore2006') # Set parameters sites = Dummy.get_site_collection(4, vs30=1999.0) rup = Dummy.get_rupture(mag=6.0) dists = DistancesContext() dists.rrup = np.array([10., 20., 30., 40.]) imt = PGA() stdt = [const.StdDev.TOTAL] # Computes results mean, stds = mgmpe.get_mean_and_stddevs(sites, rup, dists, imt, stdt) # Compute the expected results gmpe = AtkinsonBoore2006() mean_expected, stds_expected = gmpe.get_mean_and_stddevs( sites, rup, dists, imt, stdt) # Test that for reference soil conditions the modified GMPE gives the # same results of the original gmpe np.testing.assert_almost_equal(mean, mean_expected) np.testing.assert_almost_equal(stds, stds_expected)
def test_gm_calculation_hard_rock(self): # Modified gmpe mgmpe = NRCan15SiteTermLinear(gmpe_name='AtkinsonBoore2006') # Set parameters ctx = self.ctx(2, vs30=[760, 2010]) ctx.rrup = np.array([15., 15.]) ctx.mag = 7.0 stdt = [const.StdDev.TOTAL] gmpe = AtkinsonBoore2006() for imt in [PGA(), SA(1.0), SA(5.0)]: # Computes results mean, stds = mgmpe.get_mean_and_stddevs(ctx, ctx, ctx, imt, stdt) # Compute the expected results mean_expected, stds_expected = gmpe.get_mean_and_stddevs( ctx, ctx, ctx, imt, stdt) # Test that for reference soil conditions the modified GMPE gives # the same results of the original gmpe np.testing.assert_allclose(np.exp(mean), np.exp(mean_expected), rtol=1.0e-1) np.testing.assert_allclose(stds, stds_expected)