Returns the site scaling. For sites with Vs30 > 1200 m/s the site
        amplification for Vs30 = 1200 is used
17947
def _get_site_scaling_term(self, C, vs30):
        
        site_amp = C["xi"] * np.log(1200.0) * np.ones(len(vs30))
        idx = vs30 < 1200.0
        site_amp[idx] = C["xi"] * np.log(vs30[idx])
        return site_amp
1196411
def _get_mean(self, C, rup, dists, sites):
        
        return (self._get_magnitude_scaling_term(C, rup.mag) +
                self._get_distance_scaling_term(C, dists.rjb, rup.mag) +
                self._get_site_amplification_term(C, sites.vs30))
1031076
def _get_distance_scaling(self, C, mag, rhypo):
        
        return (C["a3"] * np.log(rhypo)) + (C["a4"] + C["a5"] * mag) * rhypo
936233
def _compute_mean(self, C, rup, dists, sites, imt):
        
        mean = (self._get_magnitude_scaling_term(C, rup.mag) +
                self._get_distance_scaling_term(C, rup.mag, dists.rrup) +
                self._get_site_amplification_term(C, sites.vs30))
        # convert from cm/s**2 to g for SA and from m/s**2 to g for PGA (PGV
        # is already in cm/s) and also convert from base 10 to base e.
        if imt.name == "PGA":
            mean = np.log((10 ** mean) * ((2 * np.pi / 0.01) ** 2) *
                          1e-2 / g)
        elif imt.name == "SA":
            mean = np.log((10 ** mean) * ((2 * np.pi / imt.period) ** 2) *
                          1e-2 / g)
        else:
            mean = np.log(10 ** mean)

        return mean
498621
def _get_site_dummy_variables(self, vs30):
        
        s_b = np.zeros_like(vs30)
        s_c = np.zeros_like(vs30)
        s_d = np.zeros_like(vs30)
        s_b[np.logical_and(vs30 >= 360., vs30 < 800.)] = 1.0
        s_c[np.logical_and(vs30 >= 180., vs30 < 360.)] = 1.0
        s_d[vs30 < 180] = 1.0
        return s_b, s_c, s_d
141636
def get_site_amplification(self, C, sites):
        
        ampl = np.zeros(sites.vs30.shape)
        # For observed vs30 sites
        ampl[sites.vs30measured] = (C["d0_obs"] + C["d1_obs"] *
                                    np.log(sites.vs30[sites.vs30measured]))
        # For inferred Vs30 sites
        idx = np.logical_not(sites.vs30measured)
        ampl[idx] = (C["d0_inf"] + C["d1_inf"] * np.log(sites.vs30[idx]))
        return ampl
1034985
function () {
        var scale = null;
        if (this.baseLayer != null) {
            var res = this.getResolution();
            var units = this.baseLayer.units;
            scale = OpenLayers.Util.getScaleFromResolution(res, units);
        }
        return scale;
    }
58210
def _get_site_type_dummy_variables(self, sites):
        
        Sc = np.zeros_like(sites.vs30)
        Sd = np.zeros_like(sites.vs30)
        # Soft soil; Vs30 < 360 m/s. Page 199.
        Sd[sites.vs30 < 360.0] = 1
        # Stiff soil 360 <= Vs30 < 760
        Sc[np.logical_and(sites.vs30 >= 360.0, sites.vs30 < 760.0)] = 1

        return Sc, Sd
641156
function getScales(xyMinMaxCurr, xyMinMaxOrigin) {
    var sizeCurr = getSize(xyMinMaxCurr);
    var sizeOrigin = getSize(xyMinMaxOrigin);
    var scales = [sizeCurr[0] / sizeOrigin[0], sizeCurr[1] / sizeOrigin[1]];
    isNaN(scales[0]) && (scales[0] = 1);
    isNaN(scales[1]) && (scales[1] = 1);
    return scales;
}
198065
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
        

        # Distance term
        R = np.sqrt(dists.rjb ** 2 + 11.29 ** 2)

        # Magnitude term
        M = rup.mag - 6

        # Site term only distinguishes between lava and ash;
        # since ash sites have Vs30 in the range 60-200m/s,
        # we use this upper value as class separator
        S = np.zeros(R.shape)
        S[sites.vs30 <= 200] = 1

        # Mean ground motion (log10)
        mean = (0.518 + 0.387*M - np.log10(R) - 0.00256*R + 0.335*S)

        # Converting to natural log
        mean /= np.log10(np.e)

        # Check for standard deviation type
        assert all(stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES
                   for stddev_type in stddev_types)

        # Constant (total) standard deviation
        stddevs = [0.237/np.log10(np.e) + np.zeros(R.shape)]

        return mean, stddevs
290469
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
        
        # extracting dictionary of coefficients specific to required
        # intensity measure type.
        C = self.COEFFS[imt]
        mean = (self._compute_style_of_faulting_term(rup, C) +
                self._compute_magnitude_scaling(rup.mag, C) +
                self._compute_distance_scaling(dists.rjb, C) +
                self._compute_site_term(sites.vs30, C))

        stddevs = self._get_stddevs(C, stddev_types, num_sites=len(sites.vs30))

        return mean, stddevs
1031870
def _get_site_amplification(self, sites, imt, C):
        
        Ss, Sa = self._get_site_type_dummy_variables(sites)
        return (C['b7'] * Ss) + (C['b8'] * Sa)
1243680
def _compute_site_class_term(self, C, vs30):
        
        # map vs30 value to site class, see table 2, p. 901.
        site_term = np.zeros(len(vs30))

        # hard rock
        site_term[vs30 > 1100.0] = C['CH']

        # rock
        site_term[(vs30 > 600) & (vs30 <= 1100)] = C['C1']

        # hard soil
        site_term[(vs30 > 300) & (vs30 <= 600)] = C['C2']

        # medium soil
        site_term[(vs30 > 200) & (vs30 <= 300)] = C['C3']

        # soft soil
        site_term[vs30 <= 200] = C['C4']

        return site_term
1243087
def _get_shallow_site_response_term(self, C, vs30, pga_rock):
        
        vs_mod = vs30 / C["k1"]
        # Get linear global site response term
        f_site_g = C["c11"] * np.log(vs_mod)
        idx = vs30 > C["k1"]
        f_site_g[idx] = f_site_g[idx] + (C["k2"] * self.CONSTS["n"] *
                                         np.log(vs_mod[idx]))

        # Get nonlinear site response term
        idx = np.logical_not(idx)
        if np.any(idx):
            f_site_g[idx] = f_site_g[idx] + C["k2"] * (
                np.log(pga_rock[idx] +
                       self.CONSTS["c"] * (vs_mod[idx] ** self.CONSTS["n"])) -
                np.log(pga_rock[idx] + self.CONSTS["c"])
                )

        # For Japan sites (SJ = 1) further scaling is needed (equation 19)
        if self.CONSTS["SJ"]:
            fsite_j = np.log(vs_mod)
            idx = vs30 > 200.0
            if np.any(idx):
                fsite_j[idx] = (C["c13"] + C["k2"] * self.CONSTS["n"]) *\
                    fsite_j[idx]
            idx = np.logical_not(idx)
            if np.any(idx):
                fsite_j[idx] = (C["c12"] + C["k2"] * self.CONSTS["n"]) *\
                    (fsite_j[idx] - np.log(200.0 / C["k1"]))

            return f_site_g + fsite_j
        else:
            return f_site_g
466385
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
        
        # extract dictionaries of coefficients specific to required
        # intensity measure type
        C = self.COEFFS[imt]
        imean = (self._get_magnitude_scaling_term(C, rup.mag) +
                 self._get_distance_scaling_term(C, dists.rjb, rup.mag))
        # convert from cm/s**2 to g for SA and from cm/s**2 to g for PGA (PGV
        # is already in cm/s) and also convert from base 10 to base e.
        if imt.name in "SA PGA":
            mean = np.log((10.0 ** (imean - 2.0)) / g)
        else:
            mean = np.log(10 ** imean)

        stddevs = self._get_stddevs(C, stddev_types, dists.rjb.shape[0])

        return mean, stddevs
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
551211
def _compute_soil_amplification(self, C, vs30, pga_bc, mean):
        
        # convert from base e (as defined in BA2008) to base 10 (as used in
        # AB2006)
        sal = np.log10(np.exp(self._get_site_amplification_linear(vs30, C)))
        sanl = np.log10(np.exp(
            self._get_site_amplification_non_linear(vs30, pga_bc, C)))

        idxs = vs30 < 2000.0
        mean[idxs] = mean[idxs] + sal[idxs] + sanl[idxs]