Ejemplo n.º 1
0
 def test_gm_calculationBA08_vs30variable(self):
     # Modified gmpe
     mgmpe = NRCan15SiteTermLinear(gmpe_name='BooreAtkinson2008')
     ctx = self.ctx(3, vs30=[400., 600, 1000])
     ctx.rjb = np.array([10., 10., 10.])
     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 = BooreAtkinson2008()
     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[:-1], mean_expected[:-1])
     np.testing.assert_almost_equal(stds[:-1], stds_expected[:-1])
Ejemplo n.º 2
0
 def test_gm_calculation_soilBC(self):
     # Modified gmpe
     mgmpe = NRCan15SiteTermLinear(gmpe_name='AtkinsonBoore2006')
     # Set parameters
     ctx = self.ctx(4, vs30=760.)
     ctx.rrup = np.array([1., 10., 30., 70.])
     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)
Ejemplo n.º 3
0
    def test_instantiation(self):
        mgmpe = NRCan15SiteTermLinear(gmpe_name='BooreEtAl2014')
        #
        # Check the assigned IMTs
        expected = set([PGA, SA, PGV])
        self.assertEqual(mgmpe.DEFINED_FOR_INTENSITY_MEASURE_TYPES, expected)

        # Check the TR
        expected = TRT.ACTIVE_SHALLOW_CRUST
        self.assertEqual(mgmpe.DEFINED_FOR_TECTONIC_REGION_TYPE, expected)

        # Check the IM component
        expected = IMC.RotD50
        self.assertEqual(mgmpe.DEFINED_FOR_INTENSITY_MEASURE_COMPONENT,
                         expected)

        # Check the required distances
        expected = set(['rjb'])
        self.assertEqual(mgmpe.REQUIRES_DISTANCES, expected)
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
 def test_set_vs30_attribute(self):
     mgmpe = NRCan15SiteTermLinear(gmpe_name='Campbell2003SHARE')
     msg = '{:s} does not have vs30 in the required site parameters'
     self.assertTrue('vs30' in mgmpe.REQUIRES_SITES_PARAMETERS, msg=msg)
Ejemplo n.º 6
0
 def test_raise_error(self):
     with self.assertRaises(AttributeError):
         NRCan15SiteTermLinear(gmpe_name='FukushimaTanaka1990')