Returns the site amplification term for the case in which Vs30
        is used directly
350760
def _get_site_amplification_term(self, C, vs30):
        
        return C["gamma"] * np.log10(vs30 / self.CONSTS["Vref"])
1236935
def _get_intra_event_sigmas(self, sites):
        
        sigma1 = 1.18 * np.ones_like(sites.vs30)
        sigma2 = 0.94 * np.ones_like(sites.vs30)

        idx1 = np.logical_and(sites.vs30 >= 360.0, sites.vs30 < 760.0)
        idx2 = sites.vs30 < 360.0
        sigma1[idx1] = 1.17
        sigma2[idx1] = 0.93
        sigma1[idx2] = 0.96
        sigma2[idx2] = 0.73
        return sigma1, sigma2
991674
def get_sites(self):
        
        st = self.site_text
        suffixes = [' residue', ' residues', ',', '/']
        for suffix in suffixes:
            if st.endswith(suffix):
                st = st[:-len(suffix)]
        assert(not st.endswith(','))

        # Strip parentheses
        st = st.replace('(', '')
        st = st.replace(')', '')
        st = st.replace(' or ', ' and ')  # Treat end and or the same

        sites = []
        parts = st.split(' and ')
        for part in parts:
            if part.endswith(','):
                part = part[:-1]
            if len(part.strip()) > 0:
                sites.extend(ReachProcessor._parse_site_text(part.strip()))
        return sites
741976
def _get_basin_depth_term(self, C, sites, period):
        
        return np.zeros(len(sites.vs30), dtype=float)
156677
def calculate_z1pt0(vs30):
    '''
    
    '''
    c1 = 571 ** 4.
    c2 = 1360.0 ** 4.
    return numpy.exp((-7.15 / 4.0) * numpy.log((vs30 ** 4. + c1) / (c2 + c1)))
1335084
def get_site_pattern(agent):
    """"""
    if not isinstance(agent, ist.Agent):
        return {}
    pattern = {}
    # Handle bound conditions
    for bc in agent.bound_conditions:
        # Here we make the assumption that the binding site
        # is simply named after the binding partner
        if bc.is_bound:
            pattern[get_binding_site_name(bc.agent)] = ANY
        else:
            pattern[get_binding_site_name(bc.agent)] = None

    # Handle modifications
    for mod in agent.mods:
        mod_site_str = abbrevs[mod.mod_type]
        if mod.residue is not None:
            mod_site_str = mod.residue
        mod_pos_str = mod.position if mod.position is not None else ''
        mod_site = ('%s%s' % (mod_site_str, mod_pos_str))
        site_states = states[mod.mod_type]
        if mod.is_modified:
            pattern[mod_site] = (site_states[1], WILD)
        else:
            pattern[mod_site] = (site_states[0], WILD)

    # Handle mutations
    for mc in agent.mutations:
        res_from = mc.residue_from if mc.residue_from else 'mut'
        res_to = mc.residue_to if mc.residue_to else 'X'
        if mc.position is None:
            mut_site_name = res_from
        else:
            mut_site_name = res_from + mc.position
        pattern[mut_site_name] = res_to

    # Handle location
    if agent.location is not None:
        pattern['loc'] = _n(agent.location)

    # Handle activity
    if agent.activity is not None:
        active_site_name = agent.activity.activity_type
        if agent.activity.is_active:
            active_site_state = 'active'
        else:
            active_site_state = 'inactive'
        pattern[active_site_name] = active_site_state

    return pattern
1017670
Symbol accessBase(Symbol sym,
                  DiagnosticPosition pos,
                  Symbol location,
                  Type site,
                  Name name,
                  boolean qualified) {
        return accessInternal(sym, pos, location, site, name, qualified, List.nil(), null, basicLogResolveHelper);
    }
404277
def _get_site_class(self, sites):
        
        vs30 = sites.vs30
        S = np.zeros_like(vs30)
        S[vs30 <= 760] = 1

        return S
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
1270869
function getSite(prefix, locals) {
  const site = locals && locals.site;

  return site || siteService.getSiteFromPrefix(prefix);
}
537441
def _get_linear_site_term(self, C, vs30):
        
        flin = vs30 / self.CONSTS["Vref"]
        flin[vs30 > C["Vc"]] = C["Vc"] / self.CONSTS["Vref"]
        return C["c"] * np.log(flin)
838508
def _get_vs30star(self, vs30, imt):
        
        # compute the v1 value (see eq. 9, page 1034)
        if imt.name == "SA":
            t = imt.period
            if t <= 0.50:
                v1 = 1500.0
            elif t < 3.0:
                v1 = np.exp(-0.35 * np.log(t / 0.5) + np.log(1500.))
            else:
                v1 = 800.0
        elif imt.name == "PGA":
            v1 = 1500.0
        else:
            # This covers the PGV case
            v1 = 1500.0
        # set the vs30 star value (see eq. 8, page 1034)
        vs30_star = np.ones_like(vs30) * vs30
        vs30_star[vs30 >= v1] = v1
        return vs30_star
1290161
def _compute_site_response_term(self, C, sites, pga1000):
        
        vs_star = sites.vs30.copy()
        vs_star[vs_star > 1000.0] = 1000.
        arg = vs_star / C["vlin"]
        site_resp_term = C["theta12"] * np.log(arg)
        # Get linear scaling term
        idx = sites.vs30 >= C["vlin"]
        site_resp_term[idx] += (C["b"] * self.CONSTS["n"] * np.log(arg[idx]))
        # Get nonlinear scaling term
        idx = np.logical_not(idx)
        site_resp_term[idx] += (
            -C["b"] * np.log(pga1000[idx] + self.CONSTS["c"]) +
            C["b"] * np.log(pga1000[idx] + self.CONSTS["c"] *
                            (arg[idx] ** self.CONSTS["n"])))
        return site_resp_term
362895
def _compute_site_response_term(self, C, imt, sites, pga1100):
        
        site_resp_term = np.zeros_like(sites.vs30)

        vs30_star, _ = self._compute_vs30_star_factor(imt, sites.vs30)
        vlin, c, n = C['VLIN'], self.CONSTS['c'], self.CONSTS['n']
        a10, b = C['a10'], C['b']

        idx = sites.vs30 < vlin
        arg = vs30_star[idx] / vlin
        site_resp_term[idx] = (a10 * np.log(arg) -
                               b * np.log(pga1100[idx] + c) +
                               b * np.log(pga1100[idx] + c * (arg ** n)))

        idx = sites.vs30 >= vlin
        site_resp_term[idx] = (a10 + b * n) * np.log(vs30_star[idx] / vlin)

        return site_resp_term
1183605
def _get_site_response_term(self, C, imt, vs30, sa1180):
        
        # vs30 star
        vs30_star = self._get_vs30star(vs30, imt)
        # compute the site term
        site_resp_term = np.zeros_like(vs30)
        gt_vlin = vs30 >= C['vlin']
        lw_vlin = vs30 < C['vlin']
        # compute site response term for sites with vs30 greater than vlin
        vs30_rat = vs30_star / C['vlin']
        site_resp_term[gt_vlin] = ((C['a10'] + C['b'] * self.CONSTS['n']) *
                                   np.log(vs30_rat[gt_vlin]))
        # compute site response term for sites with vs30 lower than vlin
        site_resp_term[lw_vlin] = (C['a10'] * np.log(vs30_rat[lw_vlin]) -
                                   C['b'] * np.log(sa1180[lw_vlin] + C['c']) +
                                   C['b'] * np.log(sa1180[lw_vlin] + C['c'] *
                                                   vs30_rat[lw_vlin] **
                                                   self.CONSTS['n']))
        return site_resp_term
1048432
def _HostPrefix(client_id):
  """"""
  if not client_id:
    return ""

  hostname = None
  if data_store.RelationalDBEnabled():
    client_snapshot = data_store.REL_DB.ReadClientSnapshot(client_id)
    if client_snapshot:
      hostname = client_snapshot.knowledge_base.fqdn
  else:
    client_fd = aff4.FACTORY.Open(client_id, mode="rw")
    hostname = client_fd.Get(client_fd.Schema.FQDN) or ""

  if hostname:
    return "%s: " % hostname
  else:
    return ""
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