def _get_phi(ergodic, PHI_SS, PHI_S2SS, phi_ss_quantile, phi_model, imt, mag): """ Returns the within-event standard deviation (phi) """ phi = get_phi_ss(imt, mag, PHI_SS) # check if phi adjustment (2.6.6) is needed # -> if phi < 0.4 in middle branch and T is below 0.5 s # -> preserve separation between high and low phi values if imt.period < 0.5 and phi_ss_quantile == 0.5: phi = max(phi, 0.4) elif imt.period < 0.5 and phi_ss_quantile != 0.5: # compute phi at quantile 0.5 and take the maximum comp to 0.4 PHI_SS_0p5 = get_phi_ss_at_quantile_ACME( PHI_SETUP[phi_model], 0.5) phi_0p5 = get_phi_ss(imt, mag, PHI_SS_0p5) # make adjustment if needed phi = 0.4 + phi - phi_0p5 if phi_0p5 < 0.4 else phi if ergodic: C = PHI_S2SS[imt] phi = np.sqrt(phi ** 2. + C["phi_s2ss"] ** 2.) return phi
def _setup_standard_deviations(gsim): # setup tau gsim.TAU = get_tau_at_quantile(TAU_SETUP[gsim.tau_model]["MEAN"], TAU_SETUP[gsim.tau_model]["STD"], gsim.tau_quantile) # setup phi PHI_SETUP['global_linear'] = gsim.COEFFS_PHI_SS_GLOBAL_LINEAR gsim.PHI_SS = get_phi_ss_at_quantile_ACME(PHI_SETUP[gsim.phi_model], gsim.phi_ss_quantile) # if required setup phis2ss if gsim.ergodic: if gsim.phi_s2ss_model == 'cena': gsim.PHI_S2SS = get_phi_s2ss_at_quantile( PHI_S2SS_MODEL[gsim.phi_s2ss_model], gsim.phi_s2ss_quantile) elif gsim.phi_s2ss_model == 'brb': gsim.PHI_S2SS = gsim.COEFFS_PHI_S2SS_BRB else: opts = "'cena', 'brb', or 'None'" raise ValueError('phi_s2ss_model can be {}'.format(opts))