Example #1
0
 def test_mutually_exclusive_ruptures(self):
     # Test the calculation of hazard curves using mutually exclusive
     # ruptures for a single source
     gsim_by_trt = [SadighEtAl1997()]
     rupture = _create_rupture(10., 6.)
     data = [(rupture, PMF([(0.7, 0), (0.3, 1)])),
             (rupture, PMF([(0.6, 0), (0.4, 1)]))]
     print(data[0][0])
     data[0][0].weight = 0.5
     data[1][0].weight = 0.5
     print(data[0][0].weight)
     src = NonParametricSeismicSource('0', 'test', TRT.ACTIVE_SHALLOW_CRUST,
                                      data)
     src.src_group_id = 0
     src.mutex_weight = 1
     group = SourceGroup(src.tectonic_region_type, [src], 'test', 'mutex',
                         'mutex')
     param = dict(imtls=self.imtls,
                  filter_distance='rjb',
                  src_interdep=group.src_interdep,
                  rup_interdep=group.rup_interdep,
                  grp_probability=group.grp_probability)
     crv = classical(group, self.sites, gsim_by_trt, param)['pmap'][0]
     npt.assert_almost_equal(numpy.array([0.35000, 0.32497, 0.10398]),
                             crv[0].array[:, 0],
                             decimal=4)
Example #2
0
 def test_mutually_exclusive_ruptures(self):
     # Test the calculation of hazard curves using mutually exclusive
     # ruptures for a single source
     gsim_by_trt = [SadighEtAl1997()]
     rupture = _create_rupture(10., 6.)
     data = [(rupture, PMF([(0.7, 0), (0.3, 1)])),
             (rupture, PMF([(0.6, 0), (0.4, 1)]))]
     src = NonParametricSeismicSource('0', 'test', TRT.ACTIVE_SHALLOW_CRUST,
                                      data)
     src.src_group_id = [0]
     group = SourceGroup(
         src.tectonic_region_type, [src], 'test', 'mutex', 'mutex')
     param = dict(imtls=self.imtls)
     crv = classical(group, self.sites, gsim_by_trt, param)[0]
     npt.assert_almost_equal(numpy.array([0.35000, 0.32497, 0.10398]),
                             crv[0].array[:, 0], decimal=4)
 def test_mutually_exclusive_ruptures(self):
     # Test the calculation of hazard curves using mutually exclusive
     # ruptures for a single source
     gsim_by_trt = [SadighEtAl1997()]
     rupture = _create_rupture(10., 6.)
     data = [(rupture, PMF([(0.7, 0), (0.3, 1)])),
             (rupture, PMF([(0.6, 0), (0.4, 1)]))]
     print(data[0][0])
     data[0][0].weight = 0.5
     data[1][0].weight = 0.5
     print(data[0][0].weight)
     src = NonParametricSeismicSource('0', 'test', TRT.ACTIVE_SHALLOW_CRUST,
                                      data)
     src.src_group_id = 0
     src.mutex_weight = 1
     group = SourceGroup(
         src.tectonic_region_type, [src], 'test', 'mutex', 'mutex')
     param = dict(imtls=self.imtls, filter_distance='rjb',
                  src_interdep=group.src_interdep,
                  rup_interdep=group.rup_interdep,
                  grp_probability=group.grp_probability)
     crv = classical(group, self.sites, gsim_by_trt, param)['pmap'][0]
     npt.assert_almost_equal(numpy.array([0.35000, 0.32497, 0.10398]),
                             crv[0].array[:, 0], decimal=4)