def test_available_mfds(self):
     '''
     As of May 2013 the following MFDs should be available:
     AndersonLucoArbitrary
     AndersonLucoAreaMmax
     YoungsCoppersmithExponential
     YoungsCoppersmithCharacteristic
     Characteristic
     '''
     self.mfds = mfd.get_available_mfds()
     expected_dict = OrderedDict(
         [('AndersonLucoArbitrary',
            mfd.anderson_luco_arbitrary.AndersonLucoArbitrary),
          ('AndersonLucoAreaMmax',
            mfd.anderson_luco_area_mmax.AndersonLucoAreaMmax),
          ('BaseMFDfromSlip', mfd.base.BaseMFDfromSlip),
          ('Characteristic', mfd.characteristic.Characteristic),
          ('YoungsCoppersmithCharacteristic',
            mfd.youngs_coppersmith.YoungsCoppersmithCharacteristic),
          ('YoungsCoppersmithExponential',
            mfd.youngs_coppersmith.YoungsCoppersmithExponential)])
     self.assertDictEqual(self.mfds,expected_dict)
Example #2
0
 def test_available_mfds(self):
     '''
     As of May 2013 the following MFDs should be available:
     AndersonLucoArbitrary
     AndersonLucoAreaMmax
     YoungsCoppersmithExponential
     YoungsCoppersmithCharacteristic
     Characteristic
     '''
     self.mfds = mfd.get_available_mfds()
     expected_dict = OrderedDict([
         ('AndersonLucoArbitrary',
          mfd.anderson_luco_arbitrary.AndersonLucoArbitrary),
         ('AndersonLucoAreaMmax',
          mfd.anderson_luco_area_mmax.AndersonLucoAreaMmax),
         ('BaseMFDfromSlip', mfd.base.BaseMFDfromSlip),
         ('Characteristic', mfd.characteristic.Characteristic),
         ('YoungsCoppersmithCharacteristic',
          mfd.youngs_coppersmith.YoungsCoppersmithCharacteristic),
         ('YoungsCoppersmithExponential',
          mfd.youngs_coppersmith.YoungsCoppersmithExponential)
     ])
     self.assertDictEqual(self.mfds, expected_dict)
Example #3
0
calculation of the magnitude frequency distribution from the geological
slip rate
'''
import numpy as np
from math import fabs

from openquake.hazardlib.scalerel import get_available_scalerel
from openquake.hazardlib.mfd.evenly_discretized import EvenlyDiscretizedMFD
from hmtk.models import IncrementalMFD
from hmtk.faults.fault_geometries import (SimpleFaultGeometry,
                                          ComplexFaultGeometry)
from hmtk.sources.simple_fault_source import mtkSimpleFaultSource
from hmtk.sources.complex_fault_source import mtkComplexFaultSource
from hmtk.faults import mfd

MFD_MAP = mfd.get_available_mfds()
SCALE_REL_MAP = get_available_scalerel()
DEFAULT_MSR_SIGMA = [(0., 1.0)]


def _update_slip_rates_with_aseismic(slip_rate, aseismic):
    '''
    For all the slip rates in the slip rate tuple, multiply by the aseismic
    coefficient
    :param list slip_rate:
        List of tuples (Slip Value, Weight) defining the slip distribution
    :param float aseismic:
        Fractional proportion of slip release aseismically

    :returns:
        slip - List of tuples (Slip Value, Weight) for adjusted slip rates
Example #4
0
#    YoungsCoppersmithCharacteristic)
#
#
#
#def _get_occurence_array(mmin, bin_width, occurrence):
#    """
#    Returns the incremental and cumulative recurrence
#    """
#    mags = mmin + np.cumsum(bin_width * np.ones(len(occurrence))) - bin_width
#    cumulative = np.array([np.sum(occurrence[iloc:])
#                           for iloc in range(0, len(occurrence))])
#    return np.column_stack([mags, occurrence, cumulative])
#

DEFAULT_SIZE=(8., 6.)
MFD_MAP = get_available_mfds()

def plot_recurrence_models(configs, area, slip, msr, rake,
        shear_modulus=30.0, disp_length_ratio=1.25E-5, msr_sigma=0.,
        filename=None, filetype='png', dpi=300):
    """
    Plots a set of recurrence models
    :param list configs:
        List of configuration dictionaries
    """
    plt.figure(figsize=DEFAULT_SIZE)
    for config in configs:
        model = RecurrenceBranch(area, slip, msr, rake, shear_modulus,
                                 disp_length_ratio, msr_sigma, weight=1.0)
        model.get_recurrence(config)
        occurrence = model.recurrence.occur_rates
Example #5
0
#    YoungsCoppersmithCharacteristic)
#
#
#
#def _get_occurence_array(mmin, bin_width, occurrence):
#    """
#    Returns the incremental and cumulative recurrence
#    """
#    mags = mmin + np.cumsum(bin_width * np.ones(len(occurrence))) - bin_width
#    cumulative = np.array([np.sum(occurrence[iloc:])
#                           for iloc in range(0, len(occurrence))])
#    return np.column_stack([mags, occurrence, cumulative])
#

DEFAULT_SIZE = (8., 6.)
MFD_MAP = get_available_mfds()


def plot_recurrence_models(configs,
                           area,
                           slip,
                           msr,
                           rake,
                           shear_modulus=30.0,
                           disp_length_ratio=1.25E-5,
                           msr_sigma=0.,
                           filename=None,
                           filetype='png',
                           dpi=300):
    """
    Plots a set of recurrence models
Example #6
0
'''
import warnings
import numpy as np
from math import fabs

from openquake.hazardlib.scalerel import get_available_scalerel
from openquake.hazardlib.mfd.evenly_discretized import EvenlyDiscretizedMFD
from openquake.nrmllib.models import IncrementalMFD
from hmtk.faults.fault_geometries import (SimpleFaultGeometry,
                                          ComplexFaultGeometry)
from hmtk.sources.simple_fault_source import mtkSimpleFaultSource
from hmtk.sources.complex_fault_source import mtkComplexFaultSource
from hmtk.faults import mfd


MFD_MAP = mfd.get_available_mfds()
SCALE_REL_MAP = get_available_scalerel()
DEFAULT_MSR_SIGMA = [(0., 1.0)]


def _update_slip_rates_with_aseismic(slip_rate, aseismic):
    '''
    For all the slip rates in the slip rate tuple, multiply by the aseismic
    coefficient
    :param list slip_rate:
        List of tuples (Slip Value, Weight) defining the slip distribution
    :param float aseismic:
        Fractional proportion of slip release aseismically

    :returns:
        slip - List of tuples (Slip Value, Weight) for adjusted slip rates