Пример #1
0
 def test_get_total_moment_rate_when_b_equal_to_1_5(self):
     mfd = TruncatedGRMFD(min_mag=6.0,
                          max_mag=8.0,
                          bin_width=0.1,
                          a_val=-9.4,
                          b_val=1.5)
     self.assertAlmostEqual(mfd._get_total_moment_rate(), 1.3400508)
Пример #2
0
 def test_set_a_and_get_total_moment_rate(self):
     mfd = TruncatedGRMFD(min_mag=3.0, max_mag=4.0, bin_width=0.1,
                          a_val=4.4, b_val=0.5)
     tmr = mfd._get_total_moment_rate()
     mfd._set_a(tmr)
     self.assertAlmostEqual(mfd.a_val, 4.4)
     self.assertEqual(mfd._get_total_moment_rate(), tmr)
Пример #3
0
 def test_set_a_and_get_total_moment_rate_when_b_equal_to_1_5(self):
     mfd = TruncatedGRMFD(min_mag=2.4, max_mag=5.6, bin_width=0.4,
                          a_val=-0.44, b_val=1.5)
     tmr = mfd._get_total_moment_rate()
     mfd._set_a(tmr)
     self.assertAlmostEqual(mfd.a_val, -0.44)
     self.assertEqual(mfd._get_total_moment_rate(), tmr)
Пример #4
0
 def test_get_total_moment_rate(self):
     mfd = TruncatedGRMFD(min_mag=6.0,
                          max_mag=8.0,
                          bin_width=0.1,
                          a_val=-17.2,
                          b_val=0.4)
     self.assertAlmostEqual(mfd._get_total_moment_rate(), 1.6140553)
Пример #5
0
 def test_set_ab(self):
     mfd = TruncatedGRMFD(min_mag=2.5, max_mag=3.5, bin_width=0.25,
                          a_val=1, b_val=1.3)
     mfd.modify('set_ab', {'a_val': -4.2, 'b_val': 1.45})
     self.assertEqual(mfd.max_mag, 3.5)
     self.assertEqual(mfd.a_val, -4.2)
     self.assertEqual(mfd.b_val, 1.45)
     self.assertEqual(mfd.min_mag, 2.5)
Пример #6
0
 def test_set_max_mag(self):
     mfd = TruncatedGRMFD(min_mag=3.5, max_mag=5.5, bin_width=0.5,
                          a_val=1, b_val=1.3)
     mfd.modify('set_max_mag', {'value': 4.2})
     self.assertEqual(mfd.max_mag, 4.2)
     self.assertEqual(mfd.a_val, 1)
     self.assertEqual(mfd.b_val, 1.3)
     self.assertEqual(mfd.min_mag, 3.5)
Пример #7
0
 def test_set_a(self):
     mfd = TruncatedGRMFD(min_mag=6.0,
                          max_mag=8.0,
                          bin_width=0.1,
                          a_val=1.5,
                          b_val=0.5)
     mfd._set_a(123.45)
     self.assertAlmostEqual(mfd.a_val, -14.6531141)
Пример #8
0
 def test_set_a_when_b_equal_to_1_5(self):
     mfd = TruncatedGRMFD(min_mag=6.0,
                          max_mag=8.0,
                          bin_width=0.1,
                          a_val=1.5,
                          b_val=1.5)
     mfd._set_a(12.45)
     self.assertAlmostEqual(mfd.a_val, -8.4319519)
Пример #9
0
 def test(self):
     mfd = TruncatedGRMFD(min_mag=0.61, max_mag=0.94, bin_width=0.1,
                          a_val=1, b_val=0.2)
     # mag values should be rounded to 0.6 and 0.9 and there
     # should be three bins with the first having center at 0.65
     min_mag, num_bins = mfd._get_min_mag_and_num_bins()
     self.assertAlmostEqual(min_mag, 0.65)
     self.assertEqual(mfd.get_min_mag(), min_mag)
     self.assertEqual(num_bins, 3)
Пример #10
0
 def _test(self, expected_rates, rate_tolerance, **kwargs):
     mfd = TruncatedGRMFD(**kwargs)
     actual_rates = mfd.get_annual_occurrence_rates()
     self.assertEqual(len(actual_rates), len(expected_rates))
     for i, (mag, rate) in enumerate(actual_rates):
         expected_mag, expected_rate = expected_rates[i]
         self.assertAlmostEqual(mag, expected_mag, delta=1e-14)
         self.assertAlmostEqual(rate, expected_rate, delta=rate_tolerance)
         if i == 0:
             self.assertEqual(mag, mfd.get_min_mag())
Пример #11
0
 def _test(self, expected_rates, rate_tolerance, **kwargs):
     mfd = TruncatedGRMFD(**kwargs)
     actual_rates = mfd.get_annual_occurrence_rates()
     self.assertEqual(len(actual_rates), len(expected_rates))
     for i, (mag, rate) in enumerate(actual_rates):
         expected_mag, expected_rate = expected_rates[i]
         self.assertAlmostEqual(mag, expected_mag, delta=1e-14)
         self.assertAlmostEqual(rate, expected_rate, delta=rate_tolerance)
         if i == 0:
             self.assertEqual(mag, mfd.get_min_mag())
Пример #12
0
 def test_set_ab(self):
     mfd = TruncatedGRMFD(min_mag=2.5,
                          max_mag=3.5,
                          bin_width=0.25,
                          a_val=1,
                          b_val=1.3)
     mfd.modify('set_ab', {'a_val': -4.2, 'b_val': 1.45})
     self.assertEqual(mfd.max_mag, 3.5)
     self.assertEqual(mfd.a_val, -4.2)
     self.assertEqual(mfd.b_val, 1.45)
     self.assertEqual(mfd.min_mag, 2.5)
Пример #13
0
 def test_set_max_mag(self):
     mfd = TruncatedGRMFD(min_mag=3.5,
                          max_mag=5.5,
                          bin_width=0.5,
                          a_val=1,
                          b_val=1.3)
     mfd.modify('set_max_mag', {'value': 4.2})
     self.assertEqual(mfd.max_mag, 4.2)
     self.assertEqual(mfd.a_val, 1)
     self.assertEqual(mfd.b_val, 1.3)
     self.assertEqual(mfd.min_mag, 3.5)
Пример #14
0
 def test(self):
     mfd = TruncatedGRMFD(min_mag=0.61,
                          max_mag=0.94,
                          bin_width=0.1,
                          a_val=1,
                          b_val=0.2)
     # mag values should be rounded to 0.6 and 0.9 and there
     # should be three bins with the first having center at 0.65
     min_mag, num_bins = mfd._get_min_mag_and_num_bins()
     self.assertAlmostEqual(min_mag, 0.65)
     self.assertEqual(mfd.get_min_mag(), min_mag)
     self.assertEqual(num_bins, 3)
Пример #15
0
 def test_increment_b_check_constraints(self):
     mfd = TruncatedGRMFD(min_mag=6.0,
                          max_mag=7.0,
                          bin_width=0.1,
                          a_val=1,
                          b_val=1)
     self.assert_mfd_error(mfd.modify, 'increment_b', {'value': -1})
     mfd = TruncatedGRMFD(min_mag=6.0,
                          max_mag=7.0,
                          bin_width=0.1,
                          a_val=1,
                          b_val=1)
     self.assert_mfd_error(mfd.modify, 'increment_b', {'value': -2})
Пример #16
0
 def test_set_max_mag_check_constraints(self):
     mfd = TruncatedGRMFD(min_mag=3.5,
                          max_mag=5.5,
                          bin_width=0.5,
                          a_val=1,
                          b_val=1.3)
     self.assert_mfd_error(mfd.modify, 'set_max_mag', {'value': 3.6})
Пример #17
0
 def test_set_ab_check_constraints(self):
     mfd = TruncatedGRMFD(min_mag=6.0,
                          max_mag=7.0,
                          bin_width=0.1,
                          a_val=1,
                          b_val=1)
     self.assert_mfd_error(mfd.modify, 'set_ab', {'a_val': 0, 'b_val': 0})
Пример #18
0
 def setUp(self):
     super(AreaSourceFilterSitesBySourceTestCase, self).setUp()
     mfd = TruncatedGRMFD(a_val=3,
                          b_val=1,
                          min_mag=1,
                          max_mag=2,
                          bin_width=1)
     self.source = make_area_source(self.POLYGON, discretization=1, mfd=mfd)
Пример #19
0
 def test_increment_b(self):
     mfd = TruncatedGRMFD(min_mag=4.2,
                          max_mag=6.6,
                          bin_width=0.2,
                          a_val=-20.5,
                          b_val=0.51)
     old_tmr = mfd._get_total_moment_rate()
     mfd.modify('increment_b', {'value': 1.46})
     self.assertEqual(mfd.max_mag, 6.6)
     self.assertEqual(mfd.b_val, 0.51 + 1.46)
     self.assertEqual(mfd.min_mag, 4.2)
     self.assertAlmostEqual(mfd._get_total_moment_rate(), old_tmr)
     mfd.modify('increment_b', {'value': -1.46})
     self.assertAlmostEqual(mfd._get_total_moment_rate(), old_tmr)
     self.assertEqual(mfd.b_val, 0.51)
     self.assertAlmostEqual(mfd.a_val, -20.5)
Пример #20
0
 def test_increment_max_mag(self):
     mfd = TruncatedGRMFD(min_mag=6.0,
                          max_mag=7.0,
                          bin_width=0.1,
                          a_val=-18.2,
                          b_val=0.41)
     old_tmr = mfd._get_total_moment_rate()
     mfd.modify('increment_max_mag', {'value': 1})
     self.assertEqual(mfd.max_mag, 8.0)
     self.assertEqual(mfd.b_val, 0.41)
     self.assertEqual(mfd.min_mag, 6.0)
     self.assertAlmostEqual(mfd._get_total_moment_rate(), old_tmr)
     mfd.modify('increment_max_mag', {'value': -1})
     self.assertAlmostEqual(mfd._get_total_moment_rate(), old_tmr)
     self.assertEqual(mfd.max_mag, 7.0)
     self.assertAlmostEqual(mfd.a_val, -18.2)
Пример #21
0
 def test_increment_max_mag(self):
     mfd = TruncatedGRMFD(min_mag=6.0, max_mag=7.0, bin_width=0.1,
                          a_val=-18.2, b_val=0.41)
     old_tmr = mfd._get_total_moment_rate()
     mfd.modify('increment_max_mag', {'value': 1})
     self.assertEqual(mfd.max_mag, 8.0)
     self.assertEqual(mfd.b_val, 0.41)
     self.assertEqual(mfd.min_mag, 6.0)
     self.assertAlmostEqual(mfd._get_total_moment_rate(), old_tmr)
     mfd.modify('increment_max_mag', {'value': -1})
     self.assertAlmostEqual(mfd._get_total_moment_rate(), old_tmr)
     self.assertEqual(mfd.max_mag, 7.0)
     self.assertAlmostEqual(mfd.a_val, -18.2)
Пример #22
0
 def test_increment_b(self):
     mfd = TruncatedGRMFD(min_mag=4.2, max_mag=6.6, bin_width=0.2,
                          a_val=-20.5, b_val=0.51)
     old_tmr = mfd._get_total_moment_rate()
     mfd.modify('increment_b', {'value': 1.46})
     self.assertEqual(mfd.max_mag, 6.6)
     self.assertEqual(mfd.b_val, 0.51 + 1.46)
     self.assertEqual(mfd.min_mag, 4.2)
     self.assertAlmostEqual(mfd._get_total_moment_rate(), old_tmr)
     mfd.modify('increment_b', {'value': -1.46})
     self.assertAlmostEqual(mfd._get_total_moment_rate(), old_tmr)
     self.assertEqual(mfd.b_val, 0.51)
     self.assertAlmostEqual(mfd.a_val, -20.5)
Пример #23
0
    def test(self):
        mfd = TruncatedGRMFD(a_val=1,
                             b_val=2,
                             min_mag=3,
                             max_mag=5,
                             bin_width=1)
        np_dist = PMF([(0.5, NodalPlane(1, 20, 3)), (0.5, NodalPlane(2, 2,
                                                                     4))])
        source = make_point_source(nodal_plane_distribution=np_dist, mfd=mfd)
        radius = source._get_max_rupture_projection_radius()
        self.assertAlmostEqual(radius, 1.2830362)

        mfd = TruncatedGRMFD(a_val=1,
                             b_val=2,
                             min_mag=5,
                             max_mag=6,
                             bin_width=1)
        np_dist = PMF([(0.5, NodalPlane(1, 40, 3)), (0.5, NodalPlane(2, 30,
                                                                     4))])
        source = make_point_source(nodal_plane_distribution=np_dist, mfd=mfd)
        radius = source._get_max_rupture_projection_radius()
        self.assertAlmostEqual(radius, 3.8712214)
Пример #24
0
 def test_set_a_and_get_total_moment_rate(self):
     mfd = TruncatedGRMFD(min_mag=3.0,
                          max_mag=4.0,
                          bin_width=0.1,
                          a_val=4.4,
                          b_val=0.5)
     tmr = mfd._get_total_moment_rate()
     mfd._set_a(tmr)
     self.assertAlmostEqual(mfd.a_val, 4.4)
     self.assertEqual(mfd._get_total_moment_rate(), tmr)
Пример #25
0
 def test_set_a_and_get_total_moment_rate_when_b_equal_to_1_5(self):
     mfd = TruncatedGRMFD(min_mag=2.4,
                          max_mag=5.6,
                          bin_width=0.4,
                          a_val=-0.44,
                          b_val=1.5)
     tmr = mfd._get_total_moment_rate()
     mfd._set_a(tmr)
     self.assertAlmostEqual(mfd.a_val, -0.44)
     self.assertEqual(mfd._get_total_moment_rate(), tmr)
Пример #26
0
def make_point_source(**kwargs):
    default_arguments = {
        'source_id': 'source_id',
        'name': 'source name',
        'tectonic_region_type': TRT.SUBDUCTION_INTRASLAB,
        'mfd': TruncatedGRMFD(a_val=1,
                              b_val=2,
                              min_mag=3,
                              max_mag=5,
                              bin_width=1),
        'location': Point(1.2, 3.4, 5.6),
        'nodal_plane_distribution': PMF([(1, NodalPlane(1, 2, 3))]),
        'hypocenter_distribution': PMF([(1, 4)]),
        'upper_seismogenic_depth': 1.3,
        'lower_seismogenic_depth': 4.9,
        'magnitude_scaling_relationship': PeerMSR(),
        'rupture_aspect_ratio': 1.333,
        'rupture_mesh_spacing': 1.234
    }
    default_arguments.update(kwargs)
    kwargs = default_arguments
    return PointSource(**kwargs)
Пример #27
0
 def test_dilated(self):
     mfd = TruncatedGRMFD(a_val=1,
                          b_val=2,
                          min_mag=3,
                          max_mag=5,
                          bin_width=1)
     np_dist = PMF([(1, NodalPlane(0, 2, 4))])
     source = make_point_source(nodal_plane_distribution=np_dist, mfd=mfd)
     polygon = source.get_rupture_enclosing_polygon(dilation=20)
     self.assertIsInstance(polygon, Polygon)
     elons = [
         1.3917408, 1.3908138, 1.3880493, 1.3834740, 1.3771320, 1.3690846,
         1.3594093, 1.3481992, 1.3355624, 1.3216207, 1.3065082, 1.2903704,
         1.2733628, 1.2556490, 1.2373996, 1.2187902, 1.2000000, 1.1812098,
         1.1626004, 1.1443510, 1.1266372, 1.1096296, 1.0934918, 1.0783793,
         1.0644376, 1.0518008, 1.0405907, 1.0309154, 1.0228680, 1.0165260,
         1.0119507, 1.0091862, 1.0082592, 1.0091788, 1.0119361, 1.0165049,
         1.0228411, 1.0308838, 1.0405556, 1.0517635, 1.0643995, 1.0783420,
         1.0934567, 1.1095979, 1.1266103, 1.1443298, 1.1625858, 1.1812023,
         1.2000000, 1.2187977, 1.2374142, 1.2556702, 1.2733897, 1.2904021,
         1.3065433, 1.3216580, 1.3356005, 1.3482365, 1.3594444, 1.3691162,
         1.3771589, 1.3834951, 1.3880639, 1.3908212, 1.3917408
     ]
     elats = [
         3.3999810, 3.3812204, 3.3626409, 3.3444213, 3.3267370, 3.3097585,
         3.2936490, 3.2785638, 3.2646481, 3.2520357, 3.2408482, 3.2311932,
         3.2231637, 3.2168369, 3.2122738, 3.2095182, 3.2085967, 3.2095182,
         3.2122738, 3.2168369, 3.2231637, 3.2311932, 3.2408482, 3.2520357,
         3.2646481, 3.2785638, 3.2936490, 3.3097585, 3.3267370, 3.3444213,
         3.3626409, 3.3812204, 3.3999810, 3.4187420, 3.4373226, 3.4555440,
         3.4732305, 3.4902120, 3.5063247, 3.5214135, 3.5353329, 3.5479490,
         3.5591401, 3.5687983, 3.5768308, 3.5831599, 3.5877248, 3.5904815,
         3.5914033, 3.5904815, 3.5877248, 3.5831599, 3.5768308, 3.5687983,
         3.5591401, 3.5479490, 3.5353329, 3.5214135, 3.5063247, 3.4902120,
         3.4732305, 3.4555440, 3.4373226, 3.4187420, 3.3999810
     ]
     numpy.testing.assert_allclose(polygon.lons, elons)
     numpy.testing.assert_allclose(polygon.lats, elats)
Пример #28
0
 def test_no_dilation(self):
     mfd = TruncatedGRMFD(a_val=1,
                          b_val=2,
                          min_mag=3,
                          max_mag=5,
                          bin_width=1)
     np_dist = PMF([(1, NodalPlane(0, 2, 4))])
     source = make_point_source(nodal_plane_distribution=np_dist, mfd=mfd)
     polygon = source.get_rupture_enclosing_polygon()
     self.assertIsInstance(polygon, Polygon)
     elons = [
         1.2115590, 1.2115033, 1.2113368, 1.2110612, 1.2106790, 1.2101940,
         1.2096109, 1.2089351, 1.2081734, 1.2073329, 1.2064218, 1.2054488,
         1.2044234, 1.2033554, 1.2022550, 1.2011330, 1.2000000, 1.1988670,
         1.1977450, 1.1966446, 1.1955766, 1.1945512, 1.1935782, 1.1926671,
         1.1918266, 1.1910649, 1.1903891, 1.1898060, 1.1893210, 1.1889388,
         1.1886632, 1.1884967, 1.1884410, 1.1884967, 1.1886631, 1.1889387,
         1.1893209, 1.1898058, 1.1903890, 1.1910647, 1.1918265, 1.1926670,
         1.1935781, 1.1945511, 1.1955765, 1.1966446, 1.1977449, 1.1988670,
         1.2000000, 1.2011330, 1.2022551, 1.2033554, 1.2044235, 1.2054489,
         1.2064219, 1.2073330, 1.2081735, 1.2089353, 1.2096110, 1.2101942,
         1.2106791, 1.2110613, 1.2113369, 1.2115033, 1.2115590
     ]
     elats = [
         3.3999999, 3.3988689, 3.3977489, 3.3966505, 3.3955843, 3.3945607,
         3.3935894, 3.3926799, 3.3918409, 3.3910805, 3.3904060, 3.3898238,
         3.3893397, 3.3889582, 3.3886831, 3.3885169, 3.3884614, 3.3885169,
         3.3886831, 3.3889582, 3.3893397, 3.3898238, 3.3904060, 3.3910805,
         3.3918409, 3.3926799, 3.3935894, 3.3945607, 3.3955843, 3.3966505,
         3.3977489, 3.3988689, 3.3999999, 3.4011309, 3.4022510, 3.4033494,
         3.4044156, 3.4054392, 3.4064105, 3.4073200, 3.4081590, 3.4089194,
         3.4095940, 3.4101761, 3.4106603, 3.4110418, 3.4113169, 3.4114831,
         3.4115386, 3.4114831, 3.4113169, 3.4110418, 3.4106603, 3.4101761,
         3.4095940, 3.4089194, 3.4081590, 3.4073200, 3.4064105, 3.4054392,
         3.4044156, 3.4033494, 3.4022510, 3.4011309, 3.3999999
     ]
     numpy.testing.assert_allclose(polygon.lons, elons)
     numpy.testing.assert_allclose(polygon.lats, elats)
Пример #29
0
 def _get_rupture(self,
                  min_mag,
                  max_mag,
                  hypocenter_depth,
                  aspect_ratio,
                  dip,
                  rupture_mesh_spacing,
                  upper_seismogenic_depth=2,
                  lower_seismogenic_depth=16):
     source_id = name = 'test-source'
     trt = TRT.ACTIVE_SHALLOW_CRUST
     mfd = TruncatedGRMFD(a_val=2,
                          b_val=1,
                          min_mag=min_mag,
                          max_mag=max_mag,
                          bin_width=1)
     location = Point(0, 0)
     nodal_plane = NodalPlane(strike=45, dip=dip, rake=-123.23)
     nodal_plane_distribution = PMF([(1, nodal_plane)])
     hypocenter_distribution = PMF([(1, hypocenter_depth)])
     magnitude_scaling_relationship = PeerMSR()
     rupture_aspect_ratio = aspect_ratio
     point_source = PointSource(
         source_id, name, trt, mfd, rupture_mesh_spacing,
         magnitude_scaling_relationship, rupture_aspect_ratio,
         upper_seismogenic_depth, lower_seismogenic_depth, location,
         nodal_plane_distribution, hypocenter_distribution)
     tom = PoissonTOM(time_span=50)
     ruptures = list(point_source.iter_ruptures(tom))
     self.assertEqual(len(ruptures), 1)
     [rupture] = ruptures
     self.assertIs(rupture.temporal_occurrence_model, tom)
     self.assertIs(rupture.tectonic_region_type, trt)
     self.assertEqual(rupture.rake, nodal_plane.rake)
     self.assertIsInstance(rupture.surface, PlanarSurface)
     self.assertEqual(rupture.surface.mesh_spacing, rupture_mesh_spacing)
     return rupture
Пример #30
0
def make_area_source(polygon, discretization, **kwargs):
    default_arguments = {
        'source_id': 'source_id',
        'name': 'area source name',
        'tectonic_region_type': TRT.VOLCANIC,
        'mfd': TruncatedGRMFD(a_val=3,
                              b_val=1,
                              min_mag=5,
                              max_mag=7,
                              bin_width=1),
        'nodal_plane_distribution': PMF([(1, NodalPlane(1, 2, 3))]),
        'hypocenter_distribution': PMF([(1, 4)]),
        'upper_seismogenic_depth': 1.3,
        'lower_seismogenic_depth': 4.9,
        'magnitude_scaling_relationship': PeerMSR(),
        'rupture_aspect_ratio': 1.333,
        'polygon': polygon,
        'area_discretization': discretization,
        'rupture_mesh_spacing': 12.33
    }
    default_arguments.update(kwargs)
    kwargs = default_arguments
    source = AreaSource(**kwargs)
    return source
Пример #31
0
 def test_get_total_moment_rate_when_b_equal_to_1_5(self):
     mfd = TruncatedGRMFD(min_mag=6.0, max_mag=8.0, bin_width=0.1,
                          a_val=-9.4, b_val=1.5)
     self.assertAlmostEqual(mfd._get_total_moment_rate(),  1.3400508)
Пример #32
0
    def test_areasource(self):
        nodalplane = NodalPlane(strike=0.0, dip=90.0, rake=0.0)
        src = AreaSource(source_id='src_1',
                         name='area source',
                         tectonic_region_type='Active Shallow Crust',
                         mfd=TruncatedGRMFD(a_val=3.5,
                                            b_val=1.0,
                                            min_mag=5.0,
                                            max_mag=6.5,
                                            bin_width=0.1),
                         nodal_plane_distribution=PMF([(1.0, nodalplane)]),
                         hypocenter_distribution=PMF([(1.0, 5.0)]),
                         upper_seismogenic_depth=0.0,
                         lower_seismogenic_depth=10.0,
                         magnitude_scaling_relationship=WC1994(),
                         rupture_aspect_ratio=1.0,
                         polygon=Polygon([
                             Point(-0.5, -0.5),
                             Point(-0.5, 0.5),
                             Point(0.5, 0.5),
                             Point(0.5, -0.5)
                         ]),
                         area_discretization=9.0,
                         rupture_mesh_spacing=1.0)
        site = Site(location=Point(0.0, 0.0),
                    vs30=800.0,
                    vs30measured=True,
                    z1pt0=500.0,
                    z2pt5=2.0)
        gsims = {'Active Shallow Crust': BooreAtkinson2008()}
        imt = SA(period=0.1, damping=5.0)
        iml = 0.2
        time_span = 50.0
        truncation_level = 3.0
        tom = PoissonTOM(time_span)
        n_epsilons = 3
        mag_bin_width = 0.2
        # in km
        dist_bin_width = 10.0
        # in decimal degree
        coord_bin_width = 0.2

        # compute disaggregation
        bin_edges, diss_matrix = disagg.disaggregation(
            [src], site, imt, iml, gsims, tom, truncation_level, n_epsilons,
            mag_bin_width, dist_bin_width, coord_bin_width)
        mag_bins, dist_bins, lon_bins, lat_bins, eps_bins, trt_bins = bin_edges
        numpy.testing.assert_almost_equal(
            mag_bins, [5., 5.2, 5.4, 5.6, 5.8, 6., 6.2, 6.4, 6.6])
        numpy.testing.assert_almost_equal(
            dist_bins, [0., 10., 20., 30., 40., 50., 60., 70., 80.])
        numpy.testing.assert_almost_equal(
            lat_bins, [-0.6, -0.4, -0.2, 0., 0.2, 0.4, 0.6])
        numpy.testing.assert_almost_equal(
            lon_bins, [-0.6, -0.4, -0.2, 0., 0.2, 0.4, 0.6])
        numpy.testing.assert_almost_equal(eps_bins, [-3., -1., 1., 3.])
        self.assertEqual(trt_bins, ['Active Shallow Crust'])

        expected_matrix = numpy.fromstring("""\
eJzt3Hk01dseAHAnY+EeosI1FIpKmcPF2ZmJDKVMGSLDNVNuhWQKJc4pykuajIlSNB3F5Sqa3HIb
ZeqkulEpXnlK5b7VOv3c1X7DzXHOy1vfzz/W+rL2/p7f/n73dn7HDxcXGE/JKwqeLFTzRnH09leM
4RLUsa7pp6kZ6ejz91XL3TWjURLq+hSPQf9prPHUH3bIpLp7F5YPABOR/rF0u5k1W5D70Q0f7G/S
iHrOSeiLS3vhyvH+mtHok9WUT0Jrc0pEKH4BxLwXa1IWMcTWcjwfAAAAAAAAAAAAAAAAAGA8bbA8
05jf741USD279t04iGQjB1ZRfROI+96CfVXDgtxJzHgEx+6HJ/FoHJOuzcLyAWAi2vyx+iTdhIoM
EqfFpCzLIur5SuyhF3H9ERyv84Gf51nvtQhHC8qCBJ0kthHzjizdtLj0cDRK2cirVOgXD30HAAAA
AAAAAAAAAAAAYEKqv7BXVsPcA7UbnLfOmJSDnBSyJaoGo4j73oopnalR2vHMuC/H7oeXiaUvO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xeQSdCjtq+/EBh9dx5WtCWWtjJz3L9IDPujnA5BvZ6v3qcIg8ZMWF+lvefE7oCHmc6
P6/L6OfCvHOGsvSv3aN8GSe7qK1wqvzI8vUEAAAAAAAA/P9bdpfPPs9dFSV16KnXm6xAz6IHKv32
aCKXgadOrQVayPTancuHHnui1WeDhKT8DNn+/uJculeoX5kkNm9DRkaR2mleZp5mzDwV4P0OmBAy
rLVkS9f6ohLJCs+6zaPPdxxXTpIIcAtG1PnZ7XpzOPf/na7w91g9d/Jk9pEJMW8+Sfy233QvLA7A
n3m+X/hbYp8BcV58jrfHuvHLhZmx7bzwUuG7o1VgjY1/MTzjdKCCBZZP1eohgRnGZlh8x/nlcgLC
Rlj8a7Xk3PMRcjDGxtkpypiySVEXO6fobXYqQTraWLxOwHx/i4g62861Kc8vOza6OWB9/WxKevSm
RtavAxibnbSH8bX+0ti61yadMihL0MfWKy509zv/ADxenWyar3d2Gsv1Qw8xzNu61IDl/s22D3WZ
oY5YPkcYmjdq6M0aLNfnslnNO3db/MDy67o04+F1cq483r9Uq25u48XY661w3KZ/Od0Iix8a5LlF
dZGB32PZTMFz7ZOwbSJ/uX50ll2J5FUUxNalx8w6RvvMWwqrddjTa5fcki7HsfdT/w2lsy9ffFD8
m9n/LZN5Yl8lyWDXpzn+QfuH1zOwPjrrWX1RO3kK9vMS9omuUw+LfjOvCwAAAAAAgLH4A6tzO/E=\
""".decode('base64').decode('zip')).reshape((8, 8, 6, 6, 3, 1))
        numpy.testing.assert_almost_equal(diss_matrix, expected_matrix)
Пример #33
0
 def test_set_a(self):
     mfd = TruncatedGRMFD(min_mag=6.0, max_mag=8.0, bin_width=0.1,
                          a_val=1.5, b_val=0.5)
     mfd._set_a(123.45)
     self.assertAlmostEqual(mfd.a_val, -14.6531141)
Пример #34
0
SET1_CASE10_SITE2 = SET1_CASE11_SITE2 = Site(
    location=Point(-122.0, 37.550), vs30=800.0, vs30measured=True,
    z1pt0=1.0, z2pt5=2.0
)
SET1_CASE10_SITE3 = SET1_CASE11_SITE3 = Site(
    location=Point(-122.0, 37.099), vs30=800.0, vs30measured=True,
    z1pt0=1.0, z2pt5=2.0
)
SET1_CASE10_SITE4 = SET1_CASE11_SITE4 = Site(
    location=Point(-122.0, 36.874), vs30=800.0, vs30measured=True,
    z1pt0=1.0, z2pt5=2.0
)


# page 14
SET1_CASE10_MFD = TruncatedGRMFD(a_val=3.1, b_val=0.9, min_mag=5.0,
                                 max_mag=6.5, bin_width=0.1)
SET1_CASE11_MFD = SET1_CASE10_MFD
# page 14
SET1_CASE10_HYPOCENTER_DEPTH = 5.0

# page A-15
SET1_CASE10_IMLS = [0.001, 0.01, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4]
SET1_CASE10_SITE1_POES = [
    3.87E-02, 2.19E-02, 2.97E-03, 9.22E-04, 3.59E-04,
    1.31E-04, 4.76E-05, 1.72E-05, 5.38E-06, 1.18E-06
]
SET1_CASE10_SITE2_POES = [
    3.87E-02, 1.82E-02, 2.96E-03, 9.21E-04, 3.59E-04,
    1.31E-04, 4.76E-05, 1.72E-05, 5.37E-06, 1.18E-06
]
SET1_CASE10_SITE3_POES = [
Пример #35
0
 def test_set_a_when_b_equal_to_1_5(self):
     mfd = TruncatedGRMFD(min_mag=6.0, max_mag=8.0, bin_width=0.1,
                          a_val=1.5, b_val=1.5)
     mfd._set_a(12.45)
     self.assertAlmostEqual(mfd.a_val, -8.4319519)
Пример #36
0
 def test_get_total_moment_rate(self):
     mfd = TruncatedGRMFD(min_mag=6.0, max_mag=8.0, bin_width=0.1,
                          a_val=-17.2, b_val=0.4)
     self.assertAlmostEqual(mfd._get_total_moment_rate(), 1.6140553)