예제 #1
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     mean, stds = self._get_mean_and_stddevs(sites, rup, dists, imt,
                                             stddev_types)
     mean += self._get_delta(dists)
     stddevs = [np.ones(len(dists.rrup)) * get_sigma(imt)]
     mean = np.squeeze(mean)
     return mean, stddevs
예제 #2
0
 def _get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """
     See :meth:`superclass method
     <.base.GroundShakingIntensityModel.get_mean_and_stddevs>`
     for spec of input and result values.
     """
     # Zhao et al. 2006 - Vs30 + Rrup
     mean, stds1 = super().get_mean_and_stddevs(sites, rup, dists, imt,
                                                stddev_types)
     cff = self.SITE_COEFFS[imt]
     mean_zh06 = mean + np.log(cff['mf'])
     # Atkinson and Macias (2009) - Rrup
     gmpe = AtkinsonMacias2009()
     mean_am09, stds2 = gmpe.get_mean_and_stddevs(sites, rup, dists, imt,
                                                  stddev_types)
     mean_am09 += np.log(cff['mf'])
     # Abrahamson et al. (2015) - Rrup + vs30 + backarc
     gmpe = AbrahamsonEtAl2015SInter()
     mean_ab15, stds3 = gmpe.get_mean_and_stddevs(sites, rup, dists, imt,
                                                  stddev_types)
     # Ghofrani and Atkinson (2014) - Rrup + vs30
     gmpe = GhofraniAtkinson2014()
     mean_ga14, stds4 = gmpe.get_mean_and_stddevs(sites, rup, dists, imt,
                                                  stddev_types)
     mean_ga14 += np.log(cff['mf'])
     # Computing adjusted mean and stds
     mean_adj = np.log(
         np.exp(mean_zh06) * 0.1 + np.exp(mean_am09) * 0.5 +
         np.exp(mean_ab15) * 0.2 + np.exp(mean_ga14) * 0.2)
     stds_adj = [np.ones(len(dists.rrup)) * get_sigma(imt)]
     return mean_adj, stds_adj
예제 #3
0
 def test_get_sigma_sa0(self):
     """ Test the calculation of sigma for short periods"""
     imt = SA(0.6)
     computed = get_sigma(imt)
     expected = np.log(10**0.25)
     np.testing.assert_almost_equal(computed, expected)
     #
     imt = SA(0.4)
     computed = get_sigma(imt)
     expected = np.log(10**0.24)
     np.testing.assert_almost_equal(computed, expected)
     #
     imt = SA(1.2)
     computed = get_sigma(imt)
     expected = np.log(10**0.27)
     np.testing.assert_almost_equal(computed, expected)
예제 #4
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """ """
     # get original values
     mean, stddevs = super().get_mean_and_stddevs(sites, rup, dists, imt,
                                                  stddev_types)
     stds = [np.ones(len(dists.rjb))*get_sigma(imt)]
     return mean, stds
예제 #5
0
 def test_get_sigma_sa0(self):
     """ Test the calculation of sigma for short periods"""
     imt = SA(0.6)
     computed = get_sigma(imt)
     expected = np.log(10**0.25)
     np.testing.assert_almost_equal(computed, expected)
     #
     imt = SA(0.4)
     computed = get_sigma(imt)
     expected = np.log(10**0.24)
     np.testing.assert_almost_equal(computed, expected)
     #
     imt = SA(1.2)
     computed = get_sigma(imt)
     expected = np.log(10**0.27)
     np.testing.assert_almost_equal(computed, expected)
예제 #6
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """ """
     # get original values
     mean, stddevs = super().get_mean_and_stddevs(sites, rup, dists, imt,
                                                  stddev_types)
     stds = [np.ones(len(dists.rjb)) * get_sigma(imt)]
     return mean, stds
예제 #7
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """ """
     rupl = copy.deepcopy(rup)
     rupl.mag -= 0.5
     mean, stddevs = super().get_mean_and_stddevs(sites, rupl, dists, imt,
                                                  stddev_types)
     stddevs = [np.ones(len(dists.rjb)) * get_sigma(imt)]
     return mean, stddevs
예제 #8
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """
     See documentation for method `GroundShakingIntensityModel` in
     :class:~`openquake.hazardlib.gsim.base.GSIM`
     """
     mean, stds = self._get_mean_and_stddevs(sites, rup, dists, imt,
                                             stddev_types)
     stddevs = [np.ones(len(dists.repi))*get_sigma(imt)]
     return mean, stddevs
예제 #9
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """
     See documentation for method `GroundShakingIntensityModel` in
     :class:~`openquake.hazardlib.gsim.base.GSIM`
     """
     mean, stds = self._get_mean_and_stddevs(sites, rup, dists, imt,
                                             stddev_types)
     stddevs = [np.ones(len(dists.repi)) * get_sigma(imt)]
     return mean, stddevs
예제 #10
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """
     See :meth:`superclass method
     <.base.GroundShakingIntensityModel.get_mean_and_stddevs>`
     for spec of input and result values.
     """
     mean = self._get_mean(sites, rup, dists, imt, stddev_types)
     stddevs = [np.ones(len(dists.rrup)) * get_sigma(imt)]
     return mean, stddevs
예제 #11
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """
     See :meth:`superclass method
     <.base.GroundShakingIntensityModel.get_mean_and_stddevs>`
     for spec of input and result values.
     """
     mean = self._get_mean(sites, rup, dists, imt, stddev_types)
     stddevs = [np.ones(len(dists.rrup))*get_sigma(imt)]
     return mean, stddevs
예제 #12
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """ """
     rupl = copy.deepcopy(rup)
     rupl.mag -= 0.5
     # distances
     distsl = copy.copy(dists)
     distsl.rjb, distsl.rrup = \
         get_equivalent_distances_west(rup.mag, dists.repi)
     mean, stddevs = super().get_mean_and_stddevs(sites, rupl, distsl, imt,
                                                  stddev_types)
     stddevs = [np.ones(len(dists.repi))*get_sigma(imt)]
     return mean, stddevs
예제 #13
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """ """
     rupl = copy.deepcopy(rup)
     rupl.mag -= 0.5
     # distances
     distsl = copy.copy(dists)
     distsl.rjb, distsl.rrup = \
         get_equivalent_distances_west(rup.mag, dists.repi)
     mean, stddevs = super().get_mean_and_stddevs(sites, rupl, distsl, imt,
                                                  stddev_types)
     stddevs = [np.ones(len(dists.repi)) * get_sigma(imt)]
     return mean, stddevs
예제 #14
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     # get original values
     mean, _ = super().get_mean_and_stddevs(sites, rup, dists, imt,
                                            stddev_types)
     # adjust mean values using the reccomended delta (see Atkinson and
     # Adams, 2013)
     tmp = 0.1+0.0007*dists.rjb
     tmp = np.vstack((tmp, np.ones_like(tmp)*0.3))
     delta = np.log(10.**(np.amin(tmp, axis=0)))
     mean_adj = mean - delta
     stddevs = [np.ones(len(dists.rjb))*get_sigma(imt)]
     return mean_adj, stddevs
예제 #15
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     # get original values
     mean, _ = super().get_mean_and_stddevs(sites, rup, dists, imt,
                                            stddev_types)
     # adjust mean values using the reccomended delta (see Atkinson and
     # Adams, 2013)
     tmp = 0.1 + 0.0007 * dists.rjb
     tmp = np.vstack((tmp, np.ones_like(tmp) * 0.3))
     delta = np.log(10.**(np.amin(tmp, axis=0)))
     mean_adj = mean - delta
     stddevs = [np.ones(len(dists.rjb)) * get_sigma(imt)]
     return mean_adj, stddevs
예제 #16
0
    def compute(self, ctx, imts, mean, sig, tau, phi):
        """
        See documentation for method `GroundShakingIntensityModel` in
        :class:~`openquake.hazardlib.gsim.base.GSIM`
        """
        mean_stds = []  # 5 arrays of shape (2, M, N)
        for gsim in self.gsims:
            # add equivalent distances
            if isinstance(gsim, AtkinsonBoore2006Modified2011):
                c = utils.add_distances_east(ctx, ab06=True)
            else:
                c = utils.add_distances_east(ctx)
            mean_stds.extend(
                contexts.get_mean_stds([gsim], c, imts, StdDev.TOTAL))

        for m, imt in enumerate(imts):
            cff = self.COEFFS_SITE[imt]

            # Pezeshk et al. 2011 - Rrup
            mean1, stds1 = mean_stds[0][:, m]
            mean1 = apply_correction_to_BC(cff, mean1, imt, ctx.repi)

            # Atkinson 2008 - Rjb
            mean2, stds2 = mean_stds[1][:, m]

            # Silva single corner
            mean4, stds4 = mean_stds[2][:, m]
            mean4 = apply_correction_to_BC(cff, mean4, imt, ctx.repi)

            # Silva double corner
            mean5, stds5 = mean_stds[3][:, m]
            mean5 = apply_correction_to_BC(cff, mean5, imt, ctx.repi)

            # Atkinson and Boore 2006 - Rrup
            mean3, stds3 = mean_stds[4][:, m]

            # Computing adjusted mean and stds
            mean[
                m] = mean1 * 0.2 + mean2 * 0.2 + mean3 * 0.2 + mean4 * 0.2 + mean5 * 0.2

            # Note that in this case we do not apply a triangular smoothing on
            # distance as explained at page 996 of Atkinson and Adams (2013)
            # for the calculation of the standard deviation
            stds = np.log(
                np.exp(stds1) * 0.2 + np.exp(stds2) * 0.2 +
                np.exp(stds3) * 0.2 + np.exp(stds4) * 0.2 +
                np.exp(stds5) * 0.2)
            sig[m] = get_sigma(imt)
            if self.sgn:
                mean[m] += self.sgn * (stds + _get_delta(stds, ctx.repi))
예제 #17
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """ """
     rupl = copy.deepcopy(rup)
     rupl.mag -= 0.5
     mean, stddevs = super().get_mean_and_stddevs(sites, rupl, dists, imt,
                                                  stddev_types)
     # Adjust mean values using the reccomended delta (see Atkinson and
     # Adams, 2013)
     tmp = 0.1 + 0.0007 * dists.rjb
     tmp = np.vstack((tmp, np.ones_like(tmp) * 0.3))
     delta = np.log(10.**(np.amin(tmp, axis=0)))
     mean_adj = mean + delta
     stddevs = [np.ones(len(dists.rjb)) * get_sigma(imt)]
     return mean_adj, stddevs
예제 #18
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """
     See documentation for method `GroundShakingIntensityModel` in
     :class:~`openquake.hazardlib.gsim.base.GSIM`
     """
     # This is just used for testing purposes
     if len(stddev_types) == 0:
         stddev_types = [StdDev.TOTAL]
     mean, stds = self._get_mean_and_stddevs(sites, rup, dists, imt,
                                             stddev_types)
     stddevs = [np.ones(len(dists.repi)) * get_sigma(imt)]
     delta = self._get_delta(stds, dists)
     mean = mean + stds + delta
     mean = np.squeeze(mean)
     return mean, stddevs
예제 #19
0
파일: sslab.py 프로젝트: zhhongsh/oq-engine
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     # get original values
     hslab = 50  # See info in GMPEt_Inslab_med.dat
     rjb, rrup = utils.get_equivalent_distance_inslab(
         rup.mag, dists.repi, hslab)
     dists.rjb = rjb
     dists.rrup = rrup
     mean, stddevs = super().get_mean_and_stddevs(sites, rup, dists, imt,
                                                  stddev_types)
     # adjust mean values using the reccomended delta (see Atkinson and
     # Adams, 2013; page 992)
     delta = np.log(10.**(0.15))
     mean_adj = mean - delta
     stddevs = [np.ones(len(dists.rrup)) * get_sigma(imt)]
     return mean_adj, stddevs
예제 #20
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     # get original values
     hslab = 50  # See info in GMPEt_Inslab_med.dat
     rjb, rrup = utils.get_equivalent_distance_inslab(rup.mag, dists.repi,
                                                      hslab)
     dists.rjb = rjb
     dists.rrup = rrup
     mean, stddevs = super().get_mean_and_stddevs(sites, rup, dists, imt,
                                                  stddev_types)
     # adjust mean values using the reccomended delta (see Atkinson and
     # Adams, 2013; page 992)
     delta = np.log(10.**(0.15))
     mean_adj = mean - delta
     stddevs = [np.ones(len(dists.rrup))*get_sigma(imt)]
     return mean_adj, stddevs
예제 #21
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """
     See documentation for method `GroundShakingIntensityModel` in
     :class:~`openquake.hazardlib.gsim.base.GSIM`
     """
     # This is just used for testing purposes
     if len(stddev_types) == 0:
         stddev_types = [StdDev.TOTAL]
     mean, stds = self._get_mean_and_stddevs(sites, rup, dists, imt,
                                             stddev_types)
     stddevs = [np.ones(len(dists.repi))*get_sigma(imt)]
     delta = self._get_delta(stds, dists)
     mean = mean + stds + delta
     mean = np.squeeze(mean)
     return mean, stddevs
예제 #22
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """ """
     rupl = copy.copy(rup)
     rupl.mag -= 0.5
     # distances
     distsl = copy.copy(dists)
     distsl.rjb, distsl.rrup = \
         get_equivalent_distances_west(rup.mag, dists.repi)
     mean, stddevs = super().get_mean_and_stddevs(sites, rupl, distsl, imt,
                                                  stddev_types)
     # adjust mean values using the reccomended delta (see Atkinson and
     # Adams, 2013)
     tmp = 0.1+0.0007*distsl.rjb
     tmp = np.vstack((tmp, np.ones_like(tmp)*0.3))
     delta = np.log(10.**(np.amin(tmp, axis=0)))
     mean_adj = mean - delta
     stddevs = [np.ones(len(dists.repi))*get_sigma(imt)]
     return mean_adj, stddevs
예제 #23
0
파일: sslab.py 프로젝트: pheresi/oq-engine
 def compute(self, ctx, imts, mean, sig, tau, phi):
     """
     See :meth:`superclass method
     <.base.GroundShakingIntensityModel.compute>`
     for spec of input and result values.
     """
     # get original values
     hslab = 50  # See info in GMPEt_Inslab_med.dat
     rjb, rrup = utils.get_equivalent_distance_inslab(
         ctx.mag, ctx.repi, hslab)
     ctx = copy.copy(ctx)
     ctx.rjb = rjb
     ctx.rrup = rrup
     super().compute(ctx, imts, mean, sig, tau, phi)
     for m, imt in enumerate(imts):
         cff = self.COEFFS_SITE[imt]
         mean[m] = np.log(np.exp(mean[m]) * 10**cff['mf']) + self.delta
         sig[m] = get_sigma(imt)
예제 #24
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     """ """
     rupl = copy.deepcopy(rup)
     rupl.mag -= 0.5
     # distances
     distsl = copy.copy(dists)
     distsl.rjb, distsl.rrup = \
         get_equivalent_distances_west(rup.mag, dists.repi)
     mean, stddevs = super().get_mean_and_stddevs(sites, rupl, distsl, imt,
                                                  stddev_types)
     # Adjust mean values using the reccomended delta (see Atkinson and
     # Adams, 2013)
     tmp = 0.1+0.0007*distsl.rjb
     tmp = np.vstack((tmp, np.ones_like(tmp)*0.3))
     delta = np.log(10.**(np.amin(tmp, axis=0)))
     mean_adj = mean + delta
     stddevs = [np.ones(len(dists.repi))*get_sigma(imt)]
     return mean_adj, stddevs
예제 #25
0
    def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
        """
        See :meth:`superclass method
        <.base.GroundShakingIntensityModel.get_mean_and_stddevs>`
        for spec of input and result values.
        """

        # get original values
        hslab = 50  # See info in GMPEt_Inslab_med.dat
        rjb, rrup = utils.get_equivalent_distance_inslab(rup.mag, dists.repi,
                                                         hslab)
        dists.rjb = rjb
        dists.rrup = rrup
        mean, stddevs = super().get_mean_and_stddevs(sites, rup, dists, imt,
                                                     stddev_types)
        cff = self.SITE_COEFFS[imt]
        mean_adj = np.log(np.exp(mean) * 10**cff['mf'])
        stddevs = [np.ones(len(dists.rrup))*get_sigma(imt)]
        return mean_adj, stddevs
예제 #26
0
파일: sslab.py 프로젝트: zhhongsh/oq-engine
    def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
        """
        See :meth:`superclass method
        <.base.GroundShakingIntensityModel.get_mean_and_stddevs>`
        for spec of input and result values.
        """

        # get original values
        hslab = 50  # See info in GMPEt_Inslab_med.dat
        rjb, rrup = utils.get_equivalent_distance_inslab(
            rup.mag, dists.repi, hslab)
        dists.rjb = rjb
        dists.rrup = rrup
        mean, stddevs = super().get_mean_and_stddevs(sites, rup, dists, imt,
                                                     stddev_types)
        cff = self.SITE_COEFFS[imt]
        mean_adj = np.log(np.exp(mean) * 10**cff['mf'])
        stddevs = [np.ones(len(dists.rrup)) * get_sigma(imt)]
        return mean_adj, stddevs
예제 #27
0
파일: sinter.py 프로젝트: pheresi/oq-engine
    def compute(self, ctx, imts, mean, sig, tau, phi):
        """
        See :meth:`superclass method
        <.base.GroundShakingIntensityModel.get_mean_and_stddevs>`
        for spec of input and result values.
        """
        mean_zh06, mean_am09, mean_ab15, mean_ga14 = contexts.get_mean_stds(
            self.gsims, ctx, imts, None)

        # Computing adjusted means
        for m, imt in enumerate(imts):
            cff = self.COEFFS_SITE[imt]
            mean[m] = (np.log(np.exp(mean_zh06[0, m]) * cff['mf']) * 0.1 +
                       mean_am09[0, m] * 0.5 + mean_ab15[0, m] * 0.2 +
                       np.log(np.exp(mean_ga14[0, m]) * cff['mf']) * 0.2)
            if self.sgn:
                delta = np.minimum((0.15 - 0.0007 * ctx.rrup), 0.35)
                mean[m] += self.sgn * delta
            sig[m] = get_sigma(imt)
예제 #28
0
 def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
     mean = self._get_mean(sites, rup, dists, imt, stddev_types)
     mean += self._get_delta(dists)
     stddevs = [np.ones(len(dists.rrup))*get_sigma(imt)]
     mean = np.squeeze(mean)
     return mean, stddevs
예제 #29
0
 def test_get_sigma_pga(self):
     """ Test the calculation of sigma for short periods"""
     imt = PGA()
     computed = get_sigma(imt)
     expected = np.log(10**0.23)
     np.testing.assert_almost_equal(computed, expected)
예제 #30
0
 def test_get_sigma_pga(self):
     """ Test the calculation of sigma for short periods"""
     imt = PGA()
     computed = get_sigma(imt)
     expected = np.log(10**0.23)
     np.testing.assert_almost_equal(computed, expected)