コード例 #1
0
 def test_hazard_curve_B(self):
     # Test classical case i.e. independent sources in a list instance
     curves = calc_hazard_curves_ext([self.src1, self.src2],
                                     self.sites,
                                     self.imtls,
                                     self.gsim_by_trt,
                                     truncation_level=None)
     crv = curves[0][0]
     npt.assert_almost_equal(numpy.array([0.58000, 0.53891, 0.15929]),
                             crv, decimal=4)
コード例 #2
0
 def test_hazard_curve_B(self):
     # Test classical case i.e. independent sources in a list instance
     curves = calc_hazard_curves_ext([self.src1, self.src2],
                                     self.sites,
                                     self.imtls,
                                     self.gsim_by_trt,
                                     truncation_level=None)
     crv = curves[0][0]
     npt.assert_almost_equal(numpy.array([0.58000, 0.53891, 0.15929]),
                             crv, decimal=4)
コード例 #3
0
 def test_hazard_curve_B(self):
     # Test simple calculation
     group = SourceGroup([self.src2], 'test', 'indep', 'indep')
     groups = [group]
     curves = calc_hazard_curves_ext(groups,
                                     self.sites,
                                     self.imtls,
                                     self.gsim_by_trt,
                                     truncation_level=None)
     npt.assert_almost_equal(numpy.array([0.30000, 0.27855, 0.08912]),
                             curves[0][0], decimal=4)
コード例 #4
0
 def test_hazard_curve_A(self):
     # Test back-compatibility
     # Classical case i.e. independent sources in a list instance
     curves = calc_hazard_curves_ext([self.src2],
                                     self.sites,
                                     self.imtls,
                                     self.gsim_by_trt,
                                     truncation_level=None)
     crv = curves[0][0]
     npt.assert_almost_equal(numpy.array([0.30000, 0.27855, 0.08912]),
                             crv, decimal=4)
コード例 #5
0
 def test(self):
     source_model = os.path.join(os.path.dirname(__file__), 'nankai.xml')
     groups = nrml.parse(source_model, SourceConverter(
         investigation_time=50., rupture_mesh_spacing=2.))
     site = Site(Point(135.68, 35.68), 800, True, z1pt0=100., z2pt5=1.)
     s_filter = SourceFilter(SiteCollection([site]), None)
     imtls = DictArray({'PGV': [20, 40, 80]})
     gsim_by_trt = {'Subduction Interface': SiMidorikawa1999SInter()}
     hcurves = calc_hazard_curves_ext(groups, s_filter, imtls, gsim_by_trt)
     npt.assert_almost_equal([0.91149953, 0.12548556, 0.00177583],
                             hcurves['PGV'][0])
コード例 #6
0
 def test_hazard_curve_A(self):
     # Test back-compatibility
     # Classical case i.e. independent sources in a list instance
     curves = calc_hazard_curves_ext([self.src2],
                                     self.sites,
                                     self.imtls,
                                     self.gsim_by_trt,
                                     truncation_level=None)
     crv = curves[0][0]
     npt.assert_almost_equal(numpy.array([0.30000, 0.27855, 0.08912]),
                             crv, decimal=4)
コード例 #7
0
 def test_hazard_curve_B(self):
     # Test simple calculation
     group = SourceGroup(
         TRT.ACTIVE_SHALLOW_CRUST, [self.src2], 'test', 'indep', 'indep')
     groups = [group]
     curves = calc_hazard_curves_ext(groups,
                                     self.sites,
                                     self.imtls,
                                     self.gsim_by_trt,
                                     truncation_level=None)
     npt.assert_almost_equal(numpy.array([0.30000, 0.27855, 0.08912]),
                             curves[0][0], decimal=4)