Example #1
0
    def test(self):
        cfg = os.path.join(os.path.dirname(__file__), 'job.ini')
        job = self.run_hazard(cfg)
        [output] = export.core.get_outputs(job.id)
        actual = map(numpy.median, models.get_gmvs_per_site(output, 'PGA'))
        expected_medians_pga = [0.48155582, 0.21123045, 0.14484586]
        assert_almost_equal(actual, expected_medians_pga, decimal=2)

        actual = map(numpy.median, models.get_gmvs_per_site(output, 'SA(0.1)'))
        expected_medians_sa = [0.93913177, 0.40880148, 0.2692668]
        assert_almost_equal(actual, expected_medians_sa, decimal=2)
Example #2
0
    def test(self):
        cfg = os.path.join(os.path.dirname(__file__), 'job.ini')
        job = self.run_hazard(cfg)
        [output] = export.core.get_outputs(job.id)
        actual = map(numpy.median, models.get_gmvs_per_site(output, 'PGA'))
        expected_medians_pga = [0.48155582, 0.21123045, 0.14484586]
        assert_almost_equal(actual, expected_medians_pga, decimal=2)

        actual = map(numpy.median, models.get_gmvs_per_site(output, 'SA(0.1)'))
        expected_medians_sa = [0.93913177, 0.40880148, 0.2692668]
        assert_almost_equal(actual, expected_medians_sa, decimal=2)
Example #3
0
 def test(self):
     cfg = os.path.join(os.path.dirname(__file__), 'job.ini')
     job = self.run_hazard(cfg)
     [output] = export.core.get_outputs(job.id)
     actual = map(numpy.median, models.get_gmvs_per_site(output, 'PGA'))
     expected_medians = [0.37412136, 0.19021782, 0.1365383]
     assert_almost_equal(actual, expected_medians, decimal=2)
Example #4
0
 def test(self):
     cfg = os.path.join(os.path.dirname(__file__), 'job.ini')
     job = self.run_hazard(cfg)
     [output] = export.core.get_outputs(job.id, 'gmf_scenario')
     actual = map(numpy.median, models.get_gmvs_per_site(output, 'PGA'))
     expected_medians = [0.41615372, 0.22797466, 0.1936226]
     assert_almost_equal(actual, expected_medians, decimal=2)
Example #5
0
 def test(self):
     cfg = os.path.join(os.path.dirname(__file__), 'job.ini')
     job = self.run_hazard(cfg)
     [output] = export.core.get_outputs(job.id)
     actual = map(numpy.median, models.get_gmvs_per_site(output, 'PGA'))
     expected_medians = [0.37412136, 0.19021782, 0.1365383]
     assert_almost_equal(actual, expected_medians, decimal=2)
Example #6
0
 def test(self):
     cfg = os.path.join(os.path.dirname(case_4.__file__), 'job.ini')
     job = self.run_hazard(cfg)
     [output] = export.core.get_outputs(job.id, 'gmf_scenario')
     actual = map(numpy.median, models.get_gmvs_per_site(output, 'PGA'))
     expected_medians = [0.41615372, 0.22797466, 0.1936226]
     assert_almost_equal(actual, expected_medians, decimal=2)
Example #7
0
    def test(self):
        cfg = os.path.join(os.path.dirname(__file__), 'job.ini')
        job = self.run_hazard(cfg)
        [output] = export.core.get_outputs(job.id, 'gmf_scenario')

        gmvs_per_site = models.get_gmvs_per_site(output, 'PGA')
        actual = map(numpy.median, gmvs_per_site)
        expected_medians = [0.48155582, 0.21123045, 0.14484586]
        assert_almost_equal(actual, expected_medians, decimal=2)
Example #8
0
    def test(self):
        cfg = os.path.join(os.path.dirname(case_1.__file__), 'job.ini')
        job = self.run_hazard(cfg)
        [output] = export.core.get_outputs(job.id, 'gmf_scenario')

        gmvs_per_site = models.get_gmvs_per_site(output, 'PGA')
        actual = map(numpy.median, gmvs_per_site)
        expected_medians = [0.48155582, 0.21123045, 0.14484586]
        assert_almost_equal(actual, expected_medians, decimal=2)
Example #9
0
 def test(self):
     cfg = os.path.join(os.path.dirname(__file__), 'job.ini')
     job = self.run_hazard(cfg)
     [output] = export.core.get_outputs(job.id, 'gmf_scenario')
     gmfs = list(models.get_gmvs_per_site(output, 'PGA'))
     realizations = 2e4
     first_value = 0.5
     second_value = 1.0
     gmfs_within_range_fst = qa_utils.count(first_value, gmfs[0], gmfs[1])
     gmfs_within_range_snd = qa_utils.count(second_value, gmfs[0], gmfs[1])
     self.assertAlmostEqual(gmfs_within_range_fst / realizations,
                            0.05, places=2)
     self.assertAlmostEqual(gmfs_within_range_snd / realizations,
                            0.006, places=3)
Example #10
0
 def test(self):
     cfg = os.path.join(os.path.dirname(case_6.__file__), 'job.ini')
     job = self.run_hazard(cfg)
     [output] = export.core.get_outputs(job.id, 'gmf_scenario')
     gmfs = list(models.get_gmvs_per_site(output, 'PGA'))
     realizations = 2e4
     first_value = 0.5
     second_value = 1.0
     gmfs_within_range_fst = count_close(first_value, gmfs[0], gmfs[1])
     gmfs_within_range_snd = count_close(second_value, gmfs[0], gmfs[1])
     self.assertAlmostEqual(gmfs_within_range_fst / realizations,
                            0.05,
                            places=2)
     self.assertAlmostEqual(gmfs_within_range_snd / realizations,
                            0.006,
                            places=3)
Example #11
0
    def test(self):
        cfg = os.path.join(os.path.dirname(__file__), 'job.ini')
        job = self.run_hazard(cfg)
        [output] = export.core.get_outputs(job.id)
        gmfs = list(models.get_gmvs_per_site(output, 'PGA', sort=lambda x: x))
        realizations = 1e5
        first_value = 0.5
        second_value = 1.0
        gmfs_within_range_fst = qa_utils.count(first_value, gmfs[0], gmfs[1])
        gmfs_within_range_snd = qa_utils.count(second_value, gmfs[0], gmfs[1])

        self.assertAlmostEqual(gmfs_within_range_fst / realizations,
                               0.02,
                               places=2)
        self.assertAlmostEqual(gmfs_within_range_snd / realizations,
                               0.002,
                               places=3)