def _get_fault_dip_term(self, C, rup):
     """
     Returns the fault dip term, f_dip, defined in equation 24
     """
     return CB14._get_fault_dip_term(self, C, rup)
 def _get_taulny(self, C, mag):
     """
     Returns the inter-event random effects coefficient (tau) defined in
     Equation 29.
     """
     return CB14._get_taulny(self, C, mag)
 def _select_basin_model(self, vs30):
     """
     Select the preferred basin model (California or Japan) to scale
     basin depth with respect to Vs30
     """
     return CB14._select_basin_model(self, vs30)
 def _get_hypocentral_depth_term(self, C, rup):
     """
     Returns the hypocentral depth scaling term, f_hyp, defined in
     equations 21 to 23
     """
     return CB14._get_hypocentral_depth_term(self, C, rup)
Esempio n. 5
0
def gmpe_avg(ztest):
    '''
    transforms cybershake dips and Rx
    
    Parameters
    ----------
    ztest: 2d numpy array of 12 feature data
    
    Returns
    -------
    model_avg: average of base model predictions in ln m/s2
    '''
    import numpy as np
    import openquake
    from openquake.hazardlib.gsim.abrahamson_2014 import AbrahamsonEtAl2014  #ASK
    from openquake.hazardlib.gsim.campbell_bozorgnia_2014 import CampbellBozorgnia2014  #CB
    from openquake.hazardlib.gsim.chiou_youngs_2014 import ChiouYoungs2014  #CY
    from openquake.hazardlib.gsim.boore_2014 import BooreEtAl2014  #BSSA
    import openquake.hazardlib.imt as imt
    from openquake.hazardlib.const import StdDev
    import openquake.hazardlib.gsim.base as base

    stddev_types = [StdDev.TOTAL]

    period = [10, 7.5, 5, 4, 3, 2, 1, 0.5, 0.2, 0.1]

    gmpeBSSAdata = np.zeros((ztest.shape[0], len(period)))
    gmpeASKdata = np.zeros((ztest.shape[0], len(period)))
    gmpeCBdata = np.zeros((ztest.shape[0], len(period)))
    gmpeCYdata = np.zeros((ztest.shape[0], len(period)))

    gmpeBSSAstd = np.zeros((ztest.shape[0], len(period)))
    gmpeASKstd = np.zeros((ztest.shape[0], len(period)))
    gmpeCBstd = np.zeros((ztest.shape[0], len(period)))
    gmpeCYstd = np.zeros((ztest.shape[0], len(period)))

    gmpeASK = AbrahamsonEtAl2014()
    gmpeCB = CampbellBozorgnia2014()
    gmpeCY = ChiouYoungs2014()
    gmpeBSSA = BooreEtAl2014()

    for i in range(ztest.shape[0]):
        dx = base.DistancesContext()
        dx.rjb = np.array([ztest[i, 9]])

        #dx.rjb = np.logspace(-1, 2, 10)
        # Magnitude and rake
        rx = base.RuptureContext()
        rx.mag = np.array([ztest[i, 0]])
        rx.rake = np.array([ztest[i, 5]])
        rx.hypo_depth = np.array([ztest[i, 7]])
        # Vs30
        sx = base.SitesContext()
        sx.vs30 = np.array([ztest[i, 2]])
        sx.vs30measured = 0

        dx.rrup = np.array([ztest[i, 1]])
        rx.ztor = np.array([ztest[i, 11]])
        rx.dip = np.array([ztest[i, 6]])
        rx.width = np.array([ztest[i, 8]])
        # dx.rx=np.array([rxkeep[i]])
        dx.rx = np.array([ztest[i, 10]])

        dx.ry0 = np.array([0])
        sx.z1pt0 = np.array([ztest[i, 3]])
        sx.z2pt5 = np.array([ztest[i, 4]])

        # Evaluate GMPE
        #Unit of measure for Z1.0 is [m] (ASK)

        #for period1 in period:
        for ii in range(len(period)):
            sx.vs30measured = 0
            period1 = period[ii]
            gmpeBSSAdata[i, ii], g = gmpeBSSA.get_mean_and_stddevs(
                sx, rx, dx, imt.SA(period1), stddev_types)
            gmpeBSSAstd[i, ii] = g[0][0]

            gmpeCBdata[i, ii], g = gmpeCB.get_mean_and_stddevs(
                sx, rx, dx, imt.SA(period1), stddev_types)
            gmpeCBstd[i, ii] = g[0][0]

            gmpeCYdata[i, ii], g = gmpeCY.get_mean_and_stddevs(
                sx, rx, dx, imt.SA(period1), stddev_types)
            gmpeCYstd[i, ii] = g[0][0]

            sx.vs30measured = [0]
            gmpeASKdata[i, ii], g = gmpeASK.get_mean_and_stddevs(
                sx, rx, dx, imt.SA(period1), stddev_types)
            gmpeASKstd[i, ii] = g[0][0]

    model_avg = np.log(9.81 * np.exp(
        np.mean([gmpeBSSAdata, gmpeCBdata, gmpeCYdata, gmpeASKdata], axis=0)))

    #outputs ln m/s2
    return model_avg
 def _get_magnitude_term(self, C, mag):
     """
     Returns the magnitude scaling term, f_mag, defined in equation 2
     """
     return CB14._get_magnitude_term(self, C, mag)
 def _get_hanging_wall_coeffs_rrup(self, dists):
     """
     Returns the hanging wall rrup term, f_hng_Rrup, defined in equation 13
     """
     return CB14._get_hanging_wall_coeffs_rrup(self, dists)
Esempio n. 8
0
def _get_extent_from_multigmpe(rupture, config=None):
    """
    Use MultiGMPE to determine extent
    """
    (clon, clat) = _rupture_center(rupture)
    origin = rupture.getOrigin()
    if config is not None:
        gmpe = MultiGMPE.from_config(config)
        gmice = get_object_from_config('gmice', 'modeling', config)
        if imt.SA in gmice.DEFINED_FOR_INTENSITY_MEASURE_TYPES:
            default_imt = imt.SA(1.0)
        elif imt.PGV in gmice.DEFINED_FOR_INTENSITY_MEASURE_TYPES:
            default_imt = imt.PGV()
        else:
            default_imt = imt.PGA()
    else:
        # Put in some default values for conf
        config = {
            'extent': {
                'mmi': {
                    'threshold': 4.5,
                    'mindist': 100,
                    'maxdist': 1000
                }
            }
        }

        # Generic GMPEs choices based only on active vs stable
        # as defaults...
        stable = is_stable(origin.lon, origin.lat)
        if not stable:
            ASK14 = AbrahamsonEtAl2014()
            CB14 = CampbellBozorgnia2014()
            CY14 = ChiouYoungs2014()
            gmpes = [ASK14, CB14, CY14]
            site_gmpes = None
            weights = [1/3.0, 1/3.0, 1/3.0]
            gmice = WGRW12()
        else:
            Fea96 = FrankelEtAl1996MwNSHMP2008()
            Tea97 = ToroEtAl1997MwNSHMP2008()
            Sea02 = SilvaEtAl2002MwNSHMP2008()
            C03 = Campbell2003MwNSHMP2008()
            TP05 = TavakoliPezeshk2005MwNSHMP2008()
            AB06p = AtkinsonBoore2006Modified2011()
            Pea11 = PezeshkEtAl2011()
            Atk08p = Atkinson2008prime()
            Sea01 = SomervilleEtAl2001NSHMP2008()
            gmpes = [Fea96, Tea97, Sea02, C03,
                     TP05, AB06p, Pea11, Atk08p, Sea01]
            site_gmpes = [AB06p]
            weights = [0.16, 0.0, 0.0, 0.17, 0.17, 0.3, 0.2, 0.0, 0.0]
            gmice = AK07()

        gmpe = MultiGMPE.from_list(
            gmpes, weights, default_gmpes_for_site=site_gmpes)
        default_imt = imt.SA(1.0)

    min_mmi = config['extent']['mmi']['threshold']
    sd_types = [const.StdDev.TOTAL]

    # Distance context
    dx = DistancesContext()
    # This imposes minimum/ maximum distances of:
    #   80 and 800 km; could make this configurable
    d_min = config['extent']['mmi']['mindist']
    d_max = config['extent']['mmi']['maxdist']
    dx.rjb = np.logspace(np.log10(d_min), np.log10(d_max), 2000)
    # Details don't matter for this; assuming vertical surface rupturing fault
    # with epicenter at the surface.
    dx.rrup = dx.rjb
    dx.rhypo = dx.rjb
    dx.repi = dx.rjb
    dx.rx = np.zeros_like(dx.rjb)
    dx.ry0 = np.zeros_like(dx.rjb)
    dx.rvolc = np.zeros_like(dx.rjb)

    # Sites context
    sx = SitesContext()
    # Set to soft soil conditions
    sx.vs30 = np.full_like(dx.rjb, 180)
    sx = MultiGMPE.set_sites_depth_parameters(sx, gmpe)
    sx.vs30measured = np.full_like(sx.vs30, False, dtype=bool)
    sx = Sites._addDepthParameters(sx)
    sx.backarc = np.full_like(sx.vs30, False, dtype=bool)

    # Rupture context
    rx = RuptureContext()
    rx.mag = origin.mag
    rx.rake = 0.0
    # From WC94...
    rx.width = 10**(-0.76 + 0.27*rx.mag)
    rx.dip = 90.0
    rx.ztor = origin.depth
    rx.hypo_depth = origin.depth

    gmpe_imt_mean, _ = gmpe.get_mean_and_stddevs(
        sx, rx, dx, default_imt, sd_types)

    # Convert to MMI
    gmpe_to_mmi, _ = gmice.getMIfromGM(gmpe_imt_mean, default_imt)

    # Minimum distance that exceeds threshold MMI?
    dists_exceed_mmi = dx.rjb[gmpe_to_mmi > min_mmi]
    if len(dists_exceed_mmi):
        mindist_km = np.max(dists_exceed_mmi)
    else:
        mindist_km = d_min

    # Get a projection
    proj = OrthographicProjection(clon - 4, clon + 4, clat + 4, clat - 4)
    if isinstance(rupture, (QuadRupture, EdgeRupture)):
        ruptx, rupty = proj(
            rupture.lons[~np.isnan(rupture.lons)],
            rupture.lats[~np.isnan(rupture.lats)]
        )
    else:
        ruptx, rupty = proj(clon, clat)

    xmin = np.nanmin(ruptx) - mindist_km
    ymin = np.nanmin(rupty) - mindist_km
    xmax = np.nanmax(ruptx) + mindist_km
    ymax = np.nanmax(rupty) + mindist_km

    # Put a limit on range of aspect ratio
    dx = xmax - xmin
    dy = ymax - ymin
    ar = dy / dx
    if ar > 1.2:
        # Inflate x
        dx_target = dy / 1.2
        ddx = dx_target - dx
        xmax = xmax + ddx / 2
        xmin = xmin - ddx / 2
    if ar < 0.83:
        # Inflate y
        dy_target = dx * 0.83
        ddy = dy_target - dy
        ymax = ymax + ddy / 2
        ymin = ymin - ddy / 2

    lonmin, latmin = proj(np.array([xmin]), np.array([ymin]), reverse=True)
    lonmax, latmax = proj(np.array([xmax]), np.array([ymax]), reverse=True)

    #
    # Round coordinates to the nearest minute -- that should make the
    # output grid register with common grid resolutions (60c, 30c,
    # 15c, 7.5c)
    #
    logging.debug("Extent: %f, %f, %f, %f" %
                  (lonmin, lonmax, latmin, latmax))
    return _round_coord(lonmin[0]), _round_coord(lonmax[0]), \
        _round_coord(latmin[0]), _round_coord(latmax[0])
 def _get_f1rx(self, C, r_x, r_1):
     """
     Defines the f1 scaling coefficient defined in equation 9
     """
     return CB14._get_f1rx(self, C, r_x, r_1)
Esempio n. 10
0
 def _get_f2rx(self, C, r_x, r_1, r_2):
     """
     Defines the f2 scaling coefficient defined in equation 10
     """
     return CB14._get_f2rx(self, C, r_x, r_1, r_2)
Esempio n. 11
0
 def _get_hanging_wall_coeffs_rx(self, C, rup, r_x):
     """
     Returns the hanging wall r-x scaling term, f_hng_Rx defined in
     equation 8
     """
     return CB14._get_hanging_wall_coeffs_rx(self, C, rup, r_x)
Esempio n. 12
0
 def _get_hanging_wall_term(self, C, rup, dists):
     """
     Returns the hanging wall scaling term, f_hng, defined in equation 7
     """
     return CB14._get_hanging_wall_term(self, C, rup, dists)
Esempio n. 13
0
 def _get_geometric_attenuation_term(self, C, mag, rrup):
     """
     Returns the geometric attenuation term, f_dis, defined in equation 3
     """
     return CB14._get_geometric_attenuation_term(self, C, mag, rrup)
Esempio n. 14
0
 def _get_philny(self, C, mag):
     """
     Returns the intra-event random effects coefficient (phi) defined in
     Equation 30.
     """
     return CB14._get_philny(self, C, mag)
Esempio n. 15
0
 def _get_hanging_wall_coeffs_mag(self, C, mag):
     """
     Returns the hanging wall magnitude term, f_hng_M defined in equation 14
     """
     return CB14._get_hanging_wall_coeffs_mag(self, C, mag)
Esempio n. 16
0
from openquake.hazardlib.gsim.campbell_bozorgnia_2014 import CampbellBozorgnia2014
from openquake.hazardlib.gsim.abrahamson_2014 import AbrahamsonEtAl2014
from openquake.hazardlib.gsim.chiou_youngs_2014 import ChiouYoungs2014
from openquake.hazardlib.imt import PGA, SA
from openquake.hazardlib.gsim.base import SitesContext
from openquake.hazardlib.gsim.base import DistancesContext
from openquake.hazardlib.gsim.base import RuptureContext
from openquake.hazardlib import const
from shakelib.multigmpe import MultiGMPE
from shakelib.rupture.factory import get_rupture
from shakelib.rupture.origin import Origin

# List of GMPEs to use.
gmpe_list = [
    BooreEtAl2014(),
    CampbellBozorgnia2014(),
    AbrahamsonEtAl2014(),
    ChiouYoungs2014()
]

# GMPE weights.
weight_list = [0.25] * 4

# Intensity measure component.
imc = const.IMC.RotD50

# Create multigmpe instance.
gmpe = MultiGMPE.from_list(gmpe_list, weight_list, imc)

# Define IMTs and standard deviations.
imts = [PGA(), SA(0.1), SA(0.2), SA(0.3), SA(0.5), SA(1), SA(2), SA(3), SA(5)]
Esempio n. 17
0
 def _get_hanging_wall_coeffs_ztor(self, ztor):
     """
     Returns the hanging wall ztor term, f_hng_Z, defined in equation 15
     """
     return CB14._get_hanging_wall_coeffs_ztor(self, ztor)
Esempio n. 18
0
def get_extent(rupture=None, config=None):
    """
    Method to compute map extent from rupture. There are numerous methods for
    getting the extent:
        - It can be specified directly in the config file,
        - it can be hard coded for specific magnitude ranges in the config
          file, or
        - it can be based on the MultiGMPE for the event.

    All methods except for the first requires a rupture object.

    If no config is provided then a rupture is required and the extent is based
    on a generic set of active/stable.

    Args:
        rupture (Rupture): A ShakeMap Rupture instance.
        config (ConfigObj): ShakeMap config object.

    Returns:
        tuple: lonmin, lonmax, latmin, latmax rounded to the nearest
        arc-minute..

    """

    # -------------------------------------------------------------------------
    # Check to see what parameters are specified in the extent config
    # -------------------------------------------------------------------------
    spans = {}
    bounds = []
    if config is not None:
        if 'extent' in config:
            if 'magnitude_spans' in config['extent']:
                if len(config['extent']['magnitude_spans']):
                    if isinstance(config['extent']['magnitude_spans'], dict):
                        spans = config['extent']['magnitude_spans']
            if 'bounds' in config['extent']:
                if 'extent' in config['extent']['bounds']:
                    if config['extent']['bounds']['extent'][0] != -999.0:
                        bounds = config['extent']['bounds']['extent']

    # -------------------------------------------------------------------------
    # Simplest option: extent was specified in the config, use that and exit.
    # -------------------------------------------------------------------------
    if len(bounds):
        xmin, ymin, xmax, ymax = bounds
        return (xmin, xmax, ymin, ymax)

    if not rupture or not isinstance(rupture, Rupture):
        raise TypeError('get_extent() requires a rupture object if the extent '
                        'is not specified in the config object.')

    # Find the central point
    origin = rupture.getOrigin()
    if isinstance(rupture, (QuadRupture, EdgeRupture)):
        # For an extended rupture, it is the midpoint between the extent of the
        # verticies
        lats = rupture.lats
        lons = rupture.lons

        # Remove nans
        lons = lons[~np.isnan(lons)]
        lats = lats[~np.isnan(lats)]

        clat = 0.5 * (np.nanmax(lats) + np.nanmin(lats))
        clon = 0.5 * (np.nanmax(lons) + np.nanmin(lons))
    else:
        # For a point source, it is just the epicenter
        clat = origin.lat
        clon = origin.lon

    mag = origin.mag

    # -------------------------------------------------------------------------
    # Second simplest option: spans are hardcoded based on magnitude
    # -------------------------------------------------------------------------
    if len(spans):
        xmin = None
        xmax = None
        ymin = None
        ymax = None
        for spankey, span in spans.items():
            if mag > span[0] and mag <= span[1]:
                ymin = clat - span[2] / 2
                ymax = clat + span[2] / 2
                xmin = clon - span[3] / 2
                xmax = clon + span[3] / 2
                break
        if xmin is not None:
            return (xmin, xmax, ymin, ymax)

    # -------------------------------------------------------------------------
    # Use MultiGMPE to get spans
    # -------------------------------------------------------------------------
    if config is not None:
        gmpe = MultiGMPE.from_config(config)
        gmice = get_object_from_config('gmice', 'modeling', config)
    else:
        # Put in some default values for conf
        config = {
            'extent': {
                'mmi': {
                    'threshold': 4.5,
                    'mindist': 100,
                    'maxdist': 1000
                }
            }
        }

        # Generic GMPEs choices based only on active vs stable
        # as defaults...
        stable = is_stable(origin.lon, origin.lat)
        if not stable:
            ASK14 = AbrahamsonEtAl2014()
            CB14 = CampbellBozorgnia2014()
            CY14 = ChiouYoungs2014()
            gmpes = [ASK14, CB14, CY14]
            site_gmpes = None
            weights = [1 / 3.0, 1 / 3.0, 1 / 3.0]
            gmice = WGRW12()
        else:
            Fea96 = FrankelEtAl1996MwNSHMP2008()
            Tea97 = ToroEtAl1997MwNSHMP2008()
            Sea02 = SilvaEtAl2002MwNSHMP2008()
            C03 = Campbell2003MwNSHMP2008()
            TP05 = TavakoliPezeshk2005MwNSHMP2008()
            AB06p = AtkinsonBoore2006Modified2011()
            Pea11 = PezeshkEtAl2011()
            Atk08p = Atkinson2008prime()
            Sea01 = SomervilleEtAl2001NSHMP2008()
            gmpes = [
                Fea96, Tea97, Sea02, C03, TP05, AB06p, Pea11, Atk08p, Sea01
            ]
            site_gmpes = [AB06p]
            weights = [0.16, 0.0, 0.0, 0.17, 0.17, 0.3, 0.2, 0.0, 0.0]
            gmice = AK07()

        gmpe = MultiGMPE.from_list(gmpes,
                                   weights,
                                   default_gmpes_for_site=site_gmpes)

    min_mmi = config['extent']['mmi']['threshold']
    default_imt = imt.SA(1.0)
    sd_types = [const.StdDev.TOTAL]

    # Distance context
    dx = DistancesContext()
    # This imposes minimum/ maximum distances of:
    #   80 and 800 km; could make this configurable
    d_min = config['extent']['mmi']['mindist']
    d_max = config['extent']['mmi']['maxdist']
    dx.rjb = np.logspace(np.log10(d_min), np.log10(d_max), 2000)
    # Details don't matter for this; assuming vertical surface rupturing fault
    # with epicenter at the surface.
    dx.rrup = dx.rjb
    dx.rhypo = dx.rjb
    dx.repi = dx.rjb
    dx.rx = np.zeros_like(dx.rjb)
    dx.ry0 = np.zeros_like(dx.rjb)
    dx.rvolc = np.zeros_like(dx.rjb)

    # Sites context
    sx = SitesContext()
    # Set to soft soil conditions
    sx.vs30 = np.full_like(dx.rjb, 180)
    sx = MultiGMPE.set_sites_depth_parameters(sx, gmpe)
    sx.vs30measured = np.full_like(sx.vs30, False, dtype=bool)
    sx = Sites._addDepthParameters(sx)
    sx.backarc = np.full_like(sx.vs30, False, dtype=bool)

    # Rupture context
    rx = RuptureContext()
    rx.mag = origin.mag
    rx.rake = 0.0
    # From WC94...
    rx.width = 10**(-0.76 + 0.27 * rx.mag)
    rx.dip = 90.0
    rx.ztor = origin.depth
    rx.hypo_depth = origin.depth

    gmpe_imt_mean, _ = gmpe.get_mean_and_stddevs(sx, rx, dx, default_imt,
                                                 sd_types)

    # Convert to MMI
    gmpe_to_mmi, _ = gmice.getMIfromGM(gmpe_imt_mean, default_imt)

    # Minimum distance that exceeds threshold MMI?
    dists_exceed_mmi = dx.rjb[gmpe_to_mmi > min_mmi]
    if len(dists_exceed_mmi):
        mindist_km = np.max(dists_exceed_mmi)
    else:
        mindist_km = d_min

    # Get a projection
    proj = OrthographicProjection(clon - 4, clon + 4, clat + 4, clat - 4)
    if isinstance(rupture, (QuadRupture, EdgeRupture)):
        ruptx, rupty = proj(lons, lats)
    else:
        ruptx, rupty = proj(clon, clat)

    xmin = np.nanmin(ruptx) - mindist_km
    ymin = np.nanmin(rupty) - mindist_km
    xmax = np.nanmax(ruptx) + mindist_km
    ymax = np.nanmax(rupty) + mindist_km

    # Put a limit on range of aspect ratio
    dx = xmax - xmin
    dy = ymax - ymin
    ar = dy / dx
    if ar > 1.2:
        # Inflate x
        dx_target = dy / 1.2
        ddx = dx_target - dx
        xmax = xmax + ddx / 2
        xmin = xmin - ddx / 2
    if ar < 0.83:
        # Inflate y
        dy_target = dx * 0.83
        ddy = dy_target - dy
        ymax = ymax + ddy / 2
        ymin = ymin - ddy / 2

    lonmin, latmin = proj(np.array([xmin]), np.array([ymin]), reverse=True)
    lonmax, latmax = proj(np.array([xmax]), np.array([ymax]), reverse=True)

    #
    # Round coordinates to the nearest minute -- that should make the
    # output grid register with common grid resolutions (60c, 30c,
    # 15c, 7.5c)
    #
    logging.debug("Extent: %f, %f, %f, %f" % (lonmin, lonmax, latmin, latmax))
    return _round_coord(lonmin[0]), _round_coord(lonmax[0]), \
        _round_coord(latmin[0]), _round_coord(latmax[0])
Esempio n. 19
0
 def _get_hanging_wall_coeffs_dip(self, dip):
     """
     Returns the hanging wall dip term, f_hng_delta, defined in equation 16
     """
     return CB14._get_hanging_wall_coeffs_dip(self, dip)
Esempio n. 20
0
    limits_filename = None
if event_name == '1852Banda_area':
    disc = 15
else:
    disc = 5
# Area or fault source model is used to define the parameter space to be searched
if trt == 'Subduction Intraslab':
    gsim_list = [
        ZhaoEtAl2006SSlab(),
        AtkinsonBoore2003SSlab(),
        AtkinsonBoore2003SSlabCascadia(),
        AbrahamsonEtAl2015SSlab()
    ]
if trt == 'Active':
    #    gsim_list = [ChiouYoungs2008(), ChiouYoungs2014(), BooreAtkinson2008(), BooreEtAl2014(), CampbellBozorgnia2008(), CampbellBozorgnia2014() ]
    gsim_list = [ChiouYoungs2014(), BooreEtAl2014(), CampbellBozorgnia2014()]
if trt == 'Subduction Interface':
    gsim_list = [
        YoungsEtAl1997SInter(),
        AtkinsonBoore2003SInter(),
        ZhaoEtAl2006SInter(),
        AbrahamsonEtAl2015SInter()
    ]


def build_site_col(sites_data, site_model_file, filename=None):
    """Interpolate vs30 values to sites of interest
    """
    #    sites_data = np.genfromtxt(site_file)
    site_points = []
    for i in range(len(sites_data[:, 0])):
Esempio n. 21
0
 def setUp(self):
     """
     Builds a simple dipping/bending fault source with a characteristic
     source model. Compares the curves for four sites, two on the hanging
     wall and two on the footwall.
     The source model is taken from the PEER Tests
     """
     point_order_dipping_east = [
         Point(-64.78365, -0.45236),
         Point(-64.80164, -0.45236),
         Point(-64.90498, -0.36564),
         Point(-65.0000, -0.16188),
         Point(-65.0000, 0.0000)
     ]
     trace_dip_east = Line(point_order_dipping_east)
     site_1 = Site(Point(-64.98651, -0.15738),
                   760.0,
                   48.0,
                   0.607,
                   vs30measured=True)
     site_2 = Site(Point(-64.77466, -0.45686),
                   760.0,
                   48.0,
                   0.607,
                   vs30measured=True)
     site_3 = Site(Point(-64.92747, -0.38363),
                   760.0,
                   48.0,
                   0.607,
                   vs30measured=True)
     site_4 = Site(Point(-65.05396, -0.17088),
                   760.0,
                   48.0,
                   0.607,
                   vs30measured=True)
     self.sites = SiteCollection([site_1, site_2, site_3, site_4])
     self.imtls = {
         "PGA": [
             0.001, 0.01, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45,
             0.5, 0.55, 0.6, 0.7, 0.8, 0.9, 1.0
         ]
     }
     fault_surface1 = SimpleFaultSurface.from_fault_data(
         trace_dip_east, 0.0, 12.0, 60., 0.5)
     mfd1 = EvenlyDiscretizedMFD(6.75, 0.01, [0.01])
     tom = PoissonTOM(1.0)
     self.sources = [
         CharacteristicFaultSource(
             "PEER_CHAR_FLT_EAST",
             "Peer Bending Fault Dipping East - Characteristic",
             "Active Shallow Crust", mfd1, tom, fault_surface1, 90.0)
     ]
     # We will check all the GMPEs
     self.gsim_set = {
         "ASK": [
             NSHMP2014(gmpe_name='AbrahamsonEtAl2014', sgn=0),
             (0.185, NSHMP2014(gmpe_name='AbrahamsonEtAl2014', sgn=-1)),
             (0.63, AbrahamsonEtAl2014()),
             (0.185, NSHMP2014(gmpe_name='AbrahamsonEtAl2014', sgn=1))
         ],
         "BSSA": [
             NSHMP2014(gmpe_name='BooreEtAl2014', sgn=0),
             (0.185, NSHMP2014(gmpe_name='BooreEtAl2014', sgn=-1)),
             (0.63, BooreEtAl2014()),
             (0.185, NSHMP2014(gmpe_name='BooreEtAl2014', sgn=1))
         ],
         "CB": [
             NSHMP2014(gmpe_name='CampbellBozorgnia2014', sgn=0),
             (0.185, NSHMP2014(gmpe_name='CampbellBozorgnia2014', sgn=-1)),
             (0.63, CampbellBozorgnia2014()),
             (0.185, NSHMP2014(gmpe_name='CampbellBozorgnia2014', sgn=1))
         ],
         "CY": [
             NSHMP2014(gmpe_name='ChiouYoungs2014', sgn=0),
             (0.185, NSHMP2014(gmpe_name='ChiouYoungs2014', sgn=-1)),
             (0.63, ChiouYoungs2014()),
             (0.185, NSHMP2014(gmpe_name='ChiouYoungs2014', sgn=1))
         ],
         "ID": [
             NSHMP2014(gmpe_name='Idriss2014', sgn=0),
             (0.185, NSHMP2014(gmpe_name='Idriss2014', sgn=-1)),
             (0.63, Idriss2014()),
             (0.185, NSHMP2014(gmpe_name='Idriss2014', sgn=1))
         ]
     }