def compute(self, ctx, imts, mean, sig, tau, phi): """ See :meth:`superclass method <.base.GroundShakingIntensityModel.compute>` for spec of input and result values. """ # horrible hack to fix the distance parameters; needed for the can15 # subclasses; extra distances are add in can15.eastern # this also affects generic_gmpe_avgsa_test.py vars(ctx).update(contexts.get_dists(ctx)) # compute PGA on rock conditions - needed to compute non-linear # site amplification term pga4nl = _get_pga_on_rock(self.COEFFS[PGA()], ctx) for m, imt in enumerate(imts): C = self.COEFFS[imt] C_SR = self.COEFFS_SOIL_RESPONSE[imt] # equation 1, pag 106, without sigma term, that is only the first 3 # terms. The third term (site amplification) is computed as given # in equation (6), that is the sum of a linear term - equation (7) # - and a non-linear one - equations (8a) to (8c). # Mref, Rref values are given in the caption to table 6, pag 119. if imt == PGA(): # avoid recomputing PGA on rock, just add site terms mean[m] = np.log(pga4nl) + \ _get_site_amplification_linear(ctx.vs30, C_SR) + \ _get_site_amplification_non_linear(ctx.vs30, pga4nl, C_SR) else: mean[m] = _compute_magnitude_scaling(ctx, C) + \ _compute_distance_scaling(ctx, C) + \ _get_site_amplification_linear(ctx.vs30, C_SR) + \ _get_site_amplification_non_linear(ctx.vs30, pga4nl, C_SR) if self.kind in ('2011', 'prime'): # correction factor (see Atkinson and Boore, 2011; equation 5 # at page 1126 and nga08_gm_tmr.for line 508 corr_fact = 10.0**(np.max([0, 3.888 - 0.674 * ctx.mag]) - (np.max([0, 2.933 - 0.510 * ctx.mag]) * np.log10(ctx.rjb + 10.))) mean[m] = np.log(np.exp(mean[m]) * corr_fact) if self.kind == 'hawaii': hawaii_adjust(mean[m], ctx, imt) elif self.kind == 'prime': # Implements the Boore & Atkinson (2011) adjustment to the # Atkinson (2008) GMPE A08 = self.COEFFS_A08[imt] f_ena = 10.0 ** (A08["c"] + A08["d"] * ctx.rjb) mean[m] = np.log(np.exp(mean[m]) * f_ena) set_sig(self.kind, C, sig[m], tau[m], phi[m])
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. """ # extracting dictionary of coefficients specific to required # intensity measure type. C = self.COEFFS[imt] C_SR = self.COEFFS_SOIL_RESPONSE[imt] # compute PGA on rock conditions - needed to compute non-linear # site amplification term vars(rup).update(contexts.get_dists(dists)) # update distances pga4nl = self._get_pga_on_rock(rup, C) # equation 1, pag 106, without sigma term, that is only the first 3 # terms. The third term (site amplification) is computed as given in # equation (6), that is the sum of a linear term - equation (7) - and # a non-linear one - equations (8a) to (8c). # Mref, Rref values are given in the caption to table 6, pag 119. if imt == PGA(): # avoid recomputing PGA on rock, just add site terms mean = np.log(pga4nl) + \ self._get_site_amplification_linear(sites.vs30, C_SR) + \ self._get_site_amplification_non_linear(sites.vs30, pga4nl, C_SR) else: mean = self._compute_magnitude_scaling(rup, C) + \ self._compute_distance_scaling(rup, C) + \ self._get_site_amplification_linear(sites.vs30, C_SR) + \ self._get_site_amplification_non_linear(sites.vs30, pga4nl, C_SR) stddevs = self._get_stddevs(C, stddev_types, len(sites.vs30)) return mean, stddevs