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)
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)
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 openquake.hmtk.models import IncrementalMFD from openquake.hmtk.faults.fault_geometries import (SimpleFaultGeometry, ComplexFaultGeometry) from openquake.hmtk.sources.simple_fault_source import mtkSimpleFaultSource from openquake.hmtk.sources.complex_fault_source import mtkComplexFaultSource from openquake.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
# 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,
# 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