Exemplo n.º 1
0
    def test_newmark_displacement(self):
        self.sites["newmark_disp"] = newmark_displ_from_pga_M(pga=self.pga,
            critical_accel=self.sites['crit_accel'], M=7.5)

        nd = np.array([0., 0., 0., 2.192335, 0., 0., 0., 0., 0., 0.])

        np.testing.assert_array_almost_equal(self.sites["newmark_disp"], nd)
Exemplo n.º 2
0
 def compute(self, mag, imt, gmf, sites):
     if imt.name == 'PGA':
         nd = newmark_displ_from_pga_M(
             gmf, sites.crit_accel, mag,
             self.c1, self.c2, self.c3, self.c4, self.crit_accel_threshold)
         return nd, prob_failure_given_displacement(nd)
     else:
         raise NotImplementedError('NewmarkDisplacement for %s' % imt)
Exemplo n.º 3
0
    def test_newmark_displacement(self):
        self.sites["newmark_disp"] = newmark_displ_from_pga_M(pga=self.pga,
            critical_accel=self.sites['crit_accel'], M=7.5)

        nd = np.array([0.00000000e+00, 7.89939769e-04, 0.00000000e+00,
            2.19233517e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
            0.00000000e+00, 9.14544278e-06, 9.66079448e-05])

        np.testing.assert_array_almost_equal(self.sites["newmark_disp"], nd)
Exemplo n.º 4
0
    def test_newmark_prob_displacement(self):
        self.sites["newmark_disp"] = newmark_displ_from_pga_M(
            pga=self.pga, critical_accel=self.sites['crit_accel'], M=7.5)

        self.sites["prob_disp"] = prob_failure_given_displacement(
            self.sites["newmark_disp"])

        prob_d = np.array([0., 0., 0., 0.335, 0., 0., 0., 0., 0., 0.])

        np.testing.assert_array_almost_equal(self.sites["prob_disp"], prob_d)
Exemplo n.º 5
0
 def compute(self, mag, imt_gmf, sites):
     out = []
     for imt, gmf in imt_gmf:
         if imt.name == 'PGA':
             nd = newmark_displ_from_pga_M(gmf, sites.crit_accel, mag,
                                           self.c1, self.c2, self.c3,
                                           self.c4,
                                           self.crit_accel_threshold)
         out.append(nd)
         out.append(prob_failure_given_displacement(nd))
     return out
Exemplo n.º 6
0
    def test_newmark_prob_displacement(self):
        self.sites["newmark_disp"] = newmark_displ_from_pga_M(pga=self.pga,
            critical_accel=self.sites['crit_accel'], M=7.5)

        self.sites["prob_disp"] = prob_failure_given_displacement(
            self.sites["newmark_disp"]
        )

        prob_d = np.array([0.00000000e+00, 3.02568994e-04, 0.00000000e+00,
            3.35000000e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
            0.00000000e+00, 2.82209270e-07, 1.12933769e-05])

        np.testing.assert_array_almost_equal(self.sites["prob_disp"], prob_d)
Exemplo n.º 7
0
    def test_newmark_displ_from_pga_M_M65(self):
        pgas = np.linspace(0.0, 2.0, num=10)
        Dns = newmark_displ_from_pga_M(pgas, critical_accel=1.0, M=6.5)

        Dn_ = np.array([
            0.000000e00,
            0.000000e00,
            0.000000e00,
            0.000000e00,
            0.000000e00,
            6.006612e-05,
            6.681122e-04,
            1.929713e-03,
            3.775745e-03,
            6.137864e-03,
        ])
        np.testing.assert_allclose(Dns, Dn_, atol=1e-9)