コード例 #1
0
    def test_recurrence_mle_algorithm(self):
        context = create_context('config_recurrence_mle.yml')

        workflow = create_workflow(context.config)

        run(workflow, context)

        sm = context.sm_definitions[0]

        self.assertAlmostEqual(
            sm.rupture_rate_model.truncated_gutenberg_richter.b_value,
            0.595256,
            self.decimal_places)

        self.assertAlmostEqual(
            sm.recurrence_sigb,
            0.024816,
            self.decimal_places)

        self.assertAlmostEqual(
            sm.rupture_rate_model.truncated_gutenberg_richter.a_value,
            158.109066,
            self.decimal_places)

        self.assertAlmostEqual(
            sm.recurrence_siga_m,
            49.997286,
            self.decimal_places)
コード例 #2
0
    def test_recurrence_weichert_algorithm(self):
        context = create_context('config_recurrence_weichert.yml')

        workflow = create_workflow(context.config)

        run(workflow, context)

        sm = context.sm_definitions[0]

        self.assertAlmostEqual(
            sm.rupture_rate_model.truncated_gutenberg_richter.b_value,
            0.569790,
            self.decimal_places)

        self.assertAlmostEqual(
            sm.recurrence_sigb,
            0.041210,
            self.decimal_places)

        self.assertAlmostEqual(
            sm.rupture_rate_model.truncated_gutenberg_richter.a_value,
            132.051268,
            self.decimal_places)

        self.assertAlmostEqual(
            sm.recurrence_siga_m,
            7.701386,
            self.decimal_places)
コード例 #3
0
    def setUp(self):

        self.context_jobs = create_context('config_jobs.yml')

        self.expected_preprocessed_catalogue = get_data_path(
            'expected_preprocessed_catalogue.csv', DATA_DIR)

        self.expected_preprocessed_ctable = get_data_path(
            'expected_completeness_table.csv', DATA_DIR)
コード例 #4
0
    def setUp(self):

        self.context_jobs = create_context('config_jobs.yml')

        self.expected_preprocessed_catalogue = get_data_path(
            'expected_preprocessed_catalogue.csv', DATA_DIR)

        self.expected_preprocessed_ctable = get_data_path(
            'expected_completeness_table.csv', DATA_DIR)
コード例 #5
0
    def test_gardner_knopoff(self):
        context = create_context('config_gardner_knopoff.yml')
        workflow = create_workflow(context.config)
        run(workflow, context)

        expected_vcl = np.array([0, 0, 0, 2, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
            0, 0, 0, 3, 3])

        self.assertTrue(np.array_equal(self.expected_vmain_shock,
                context.working_catalog))
        self.assertTrue(np.array_equal(expected_vcl, context.vcl))
        self.assertTrue(np.array_equal(self.expected_flag_vector,
                context.flag_vector))
コード例 #6
0
    def test_gardner_knopoff(self):
        context = create_context('config_gardner_knopoff.yml')
        workflow = create_workflow(context.config)
        run(workflow, context)

        expected_vcl = np.array(
            [0, 0, 0, 2, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 3, 3])

        self.assertTrue(
            np.array_equal(self.expected_vmain_shock, context.working_catalog))
        self.assertTrue(np.array_equal(expected_vcl, context.vcl))
        self.assertTrue(
            np.array_equal(self.expected_flag_vector, context.flag_vector))
コード例 #7
0
    def test_maximum_magnitude_kijko_npg(self):
        context = create_context('config_maxmag_kijko_npg.yml')

        workflow = create_workflow(context.config)

        run(workflow, context)

        sm = context.sm_definitions[0]

        self.assertAlmostEqual(6.44392,
            sm.rupture_rate_model.truncated_gutenberg_richter.max_magnitude,
            self.decimal_places)

        self.assertAlmostEqual(0.10922, sm.max_mag_sigma, self.decimal_places)
コード例 #8
0
    def test_maximum_magnitude_cum_moment(self):
        # It depends on a random seed so precision is relaxed
        self.decimal_places = 1
        context = create_context('config_maxmag_cum_moment.yml')

        workflow = create_workflow(context.config)

        run(workflow, context)

        sm = context.sm_definitions[0]

        self.assertAlmostEqual(6.6,
            sm.rupture_rate_model.truncated_gutenberg_richter.max_magnitude,
            self.decimal_places)

        self.assertAlmostEqual(0.05, sm.max_mag_sigma, self.decimal_places)
コード例 #9
0
    def test_stepp(self):
        context = create_context('config_stepp.yml')

        workflow = create_workflow(context.config)

        run(workflow, context)

        filtered_eq_events = np.array(
            [[1994., 4.0], [1994., 4.1], [1994., 4.2], [1994., 4.3],
             [1994., 4.4], [1964., 4.5], [1964., 4.6], [1964., 4.7],
             [1964., 4.8], [1964., 4.9], [1964., 5.0], [1964., 5.1],
             [1964., 5.2], [1964., 5.3], [1964., 5.4], [1919., 5.5],
             [1919., 5.6], [1919., 5.7], [1919., 5.8], [1919., 5.9],
             [1919., 6.0], [1919., 6.1], [1919., 6.2], [1919., 6.3],
             [1919., 6.4], [1919., 6.5], [1919., 6.6], [1919., 6.7],
             [1919., 6.8], [1919., 6.9], [1919., 7.0], [1919., 7.1],
             [1919., 7.2], [1919., 7.3]])

        self.assertTrue(
            np.allclose(filtered_eq_events, context.completeness_table))
コード例 #10
0
    def test_stepp(self):
        context = create_context('config_stepp.yml')

        workflow = create_workflow(context.config)

        run(workflow, context)

        filtered_eq_events = np.array([
                    [1994., 4.0], [1994., 4.1], [1994., 4.2],
                    [1994., 4.3], [1994., 4.4], [1964., 4.5],
                    [1964., 4.6], [1964., 4.7], [1964., 4.8],
                    [1964., 4.9], [1964., 5.0], [1964., 5.1],
                    [1964., 5.2], [1964., 5.3], [1964., 5.4],
                    [1919., 5.5], [1919., 5.6], [1919., 5.7],
                    [1919., 5.8], [1919., 5.9], [1919., 6.0],
                    [1919., 6.1], [1919., 6.2], [1919., 6.3],
                    [1919., 6.4], [1919., 6.5], [1919., 6.6],
                    [1919., 6.7], [1919., 6.8], [1919., 6.9],
                    [1919., 7.0], [1919., 7.1], [1919., 7.2],
                    [1919., 7.3]])

        self.assertTrue(np.allclose(filtered_eq_events,
                context.completeness_table))