Returns the magnitude scaling term of the GMPE described in
        equation 3
553547
def _get_magnitude_scaling_term(self, C, mag):
        
        dmag = mag - self.CONSTS["Mh"]
        if mag < self.CONSTS["Mh"]:
            return C["e1"] + (C["b1"] * dmag) + (C["b2"] * (dmag ** 2.0))
        else:
            return C["e1"] + (C["b3"] * dmag)
82274
def get_distance_scaling_term(self, C, rhyp):
        
        rval = rhyp + C['bh']
        return C['b5'] * np.log(rval) + C['b6'] * rval
411797
def _get_site_scaling(self, C, pga_rock, sites, period, rjb):
        
        flin = self._get_linear_site_term(C, sites.vs30)
        fnl = self._get_nonlinear_site_term(C, sites.vs30, pga_rock)
        fbd = self._get_basin_depth_term(C, sites, period)
        return flin + fnl + fbd
1362847
def _get_distance_scaling_term(self, C, mag, rrup):
        
        if mag < 6.75:
            mag_factor = -(C["b1_lo"] + C["b2_lo"] * mag)
        else:
            mag_factor = -(C["b1_hi"] + C["b2_hi"] * mag)
        return mag_factor * np.log(rrup + 10.0) + (C["gamma"] * rrup)
382512
def _compute_magnitude_term(self, C, mag):
        
        fmag = C['c0'] + C['c1'] * mag
        if mag <= 5.5:
            return fmag
        elif mag > 6.5:
            return fmag + (C['c2'] * (mag - 5.5)) + (C['c3'] * (mag - 6.5))
        else:
            return fmag + (C['c2'] * (mag - 5.5))
235536
def mse(vref, vcmp):
    

    r = np.asarray(vref, dtype=np.float64).ravel()
    c = np.asarray(vcmp, dtype=np.float64).ravel()
    return np.mean(np.abs(r - c)**2)
1003363
def exp_rmspe(pred:Tensor, targ:Tensor)->Rank0Tensor:
    ""
    pred,targ = flatten_check(pred,targ)
    pred, targ = torch.exp(pred), torch.exp(targ)
    pct_var = (targ - pred)/targ
    return torch.sqrt((pct_var**2).mean())
986940
def _parameter_constraints(self, theta_E, gamma, q, phi_G, s_scale):
        
        if theta_E < 0:
            theta_E = 0
        if s_scale < 0.00000001:
            s_scale = 0.00000001
        if gamma < 1.2:
            gamma = 1.2
            theta_E = 0
        if gamma > 2.9:
            gamma = 2.9
            theta_E = 0
        if q < 0.01:
            q = 0.01
            theta_E = 0
        if q > 1:
            q = 1.
            theta_E = 0
        return theta_E, gamma, q, phi_G, s_scale
1199953
def _get_magnitude_term(self, C, mag):
        
        dmag = mag - 8.0
        return C["c0"] + C["c3"] * dmag + C["c4"] * (dmag ** 2.)
872709
def _compute_magnitude_term(self, C, rup):
        
        return C['c2'] * (rup.mag - 8.0) + C['c3'] * (rup.mag - 8.0) ** 2
634529
def _get_distance_term(self, C, rrup, mag):
        
        r_adj = np.sqrt(rrup ** 2.0 + (mag ** 2.0 - 3.1 * mag - 14.55) ** 2.)
        return C["c1"] * np.log10(r_adj) + C["c2"] * r_adj
1080138
def get_magnitude_scaling_term(self, C, rup):
        
        m_c = self.CONSTANTS["m_c"]
        if rup.mag <= m_c:
            return C["cSL"] * rup.mag +\
                C["cSL2"] * ((rup.mag - self.CONSTANTS["m_sc"]) ** 2.)
        else:
            return C["cSL"] * m_c +\
               C["cSL2"] * ((m_c - self.CONSTANTS["m_sc"]) ** 2.) +\
               C["dSL"] * (rup.mag - m_c)
1045506
def _compute_mean(self, C, mag, dists, rake):
        
        mean = (
            self._compute_magnitude_scaling_term(C, mag) +
            self._compute_geometric_decay_term(C, mag, dists) +
            self._compute_faulting_style_term(C, rake) +
            self._compute_anelestic_attenuation_term(C, dists)
        )

        return mean
554770
def _compute_linear_magnitude_term(self, C, mag):
        
        if mag <= self.c1:
            # this is the second term in eq. (1a), p. 2981
            return C['a2'] * (mag - self.c1)
        else:
            # this is the second term in eq. (1b), p. 2982
            return C['a3'] * (mag - self.c1)
945385
def _compute_magnitude_scaling(self, mag, C):
        
        dmag = mag - 6.
        return (C['B2'] * dmag) + (C['B3'] * (dmag ** 2.))
684037
def _get_distance_term(self, C, rhypo, mag):
        
        h_eff = self._get_effective_distance(mag)
        r_val = np.sqrt(rhypo ** 2.0 + h_eff ** 2.0)
        return C["c3"] * np.log10(r_val)
1069399
def _compute_mean(self, C, rup, rjb):
        
        mean = (C['c1'] +
                self._compute_magnitude_term(C, rup) +
                self._compute_distance_term(C, rup, rjb))
        return mean