def test_log_sigma_BA08(self): model_name = 'Boore_08' (distances, distance_types, magnitudes, test_mean, test_sigma, periods, depths, _, _, _, _, _, _) = data2atts('Toro_1997_midcontinent') event_activity = 0.5 periods = array([0.015, 0.45, 4.5]) gm = Ground_motion_calculator(model_name, periods=periods) # print "magnitudes", magnitudes Vs30 = 560 * ones(magnitudes['Mw'].shape) fault_type = zeros(magnitudes['Mw'].shape, dtype=int64) log_mean, log_sigma = gm.distribution_function( distances, distance_types, magnitudes, depth=depths, event_activity=event_activity, Vs30=560, fault_type=fault_type) test_log_sigma = array([0.569, 0.609, 0.716]) # print "log_sigma", log_sigma # FIXME check the shape as well self.assert_(allclose(log_sigma, test_log_sigma, rtol=0.05), "%s did not pass assert" % model_name)
def test_log_sigma_Somerville09_Yilgarn(self): model_name = 'Somerville09_Yilgarn' (distances, distance_types, magnitudes, test_mean, test_sigma, periods, depths, _, _, _, _, _, _) = data2atts( 'Toro_1997_midcontinent') event_activity = 1 periods = array([0.010, 0.045, 1.0]) gm = Ground_motion_calculator(model_name, periods=periods) log_mean, log_sigma = gm.distribution_function( distances, distance_types, magnitudes, depth=depths, event_activity=event_activity) test_log_sigma = array([0.5512, 0.55095, 0.6817]) # FIXME check the shape as well self.assert_(allclose(log_sigma, test_log_sigma, rtol=0.0000005), "%s did not pass assert" % model_name)
def test_log_sigma_Somerville09_Yilgarn(self): model_name = 'Somerville09_Yilgarn' (distances, distance_types, magnitudes, test_mean, test_sigma, periods, depths, _, _, _, _, _, _) = data2atts('Toro_1997_midcontinent') event_activity = 1 periods = array([0.010, 0.045, 1.0]) gm = Ground_motion_calculator(model_name, periods=periods) log_mean, log_sigma = gm.distribution_function( distances, distance_types, magnitudes, depth=depths, event_activity=event_activity) test_log_sigma = array([0.5512, 0.55095, 0.6817]) # FIXME check the shape as well self.assert_(allclose(log_sigma, test_log_sigma, rtol=0.0000005), "%s did not pass assert" % model_name)
def test_log_mean(self): """ This checks that for the given test_distance and test_magnitudes, the calculated ground motion is the same as the test_ground_motion """ model_name = 'Toro_1997_midcontinent' (distances, distance_types, magnitudes, test_mean, test_sigma, periods, depths, _, _, _, _, _, _) = data2atts(model_name) event_activity = 0.5 gm = Ground_motion_calculator(model_name, periods=periods) log_mean, log_sigma = gm.distribution_function( distances, distance_types, magnitudes, depth=depths, event_activity=event_activity) self.assert_(allclose(exp(log_mean), test_mean, rtol=0.05), "%s did not pass assert" % model_name)