def test(self):
     mfd = TruncatedGRMFD(min_mag=0.61, max_mag=0.94, bin_width=0.1,
                          a_val=1, b_val=0.2)
     # mag values should be rounded to 0.6 and 0.9 and there
     # should be three bins with the first having center at 0.65
     min_mag, num_bins = mfd._get_min_mag_and_num_bins()
     self.assertAlmostEqual(min_mag, 0.65)
     self.assertEqual(mfd.get_min_mag(), min_mag)
     self.assertEqual(num_bins, 3)
 def _test(self, expected_rates, rate_tolerance, **kwargs):
     mfd = TruncatedGRMFD(**kwargs)
     actual_rates = mfd.get_annual_occurrence_rates()
     self.assertEqual(len(actual_rates), len(expected_rates))
     for i, (mag, rate) in enumerate(actual_rates):
         expected_mag, expected_rate = expected_rates[i]
         self.assertAlmostEqual(mag, expected_mag, delta=1e-14)
         self.assertAlmostEqual(rate, expected_rate, delta=rate_tolerance)
         if i == 0:
             self.assertEqual(mag, mfd.get_min_mag())
Esempio n. 3
0
 def _test(self, expected_rates, rate_tolerance, **kwargs):
     mfd = TruncatedGRMFD(**kwargs)
     actual_rates = mfd.get_annual_occurrence_rates()
     self.assertEqual(len(actual_rates), len(expected_rates))
     for i, (mag, rate) in enumerate(actual_rates):
         expected_mag, expected_rate = expected_rates[i]
         self.assertAlmostEqual(mag, expected_mag, delta=1e-14)
         self.assertAlmostEqual(rate, expected_rate, delta=rate_tolerance)
         if i == 0:
             self.assertEqual(mag, mfd.get_min_mag())
Esempio n. 4
0
 def test(self):
     mfd = TruncatedGRMFD(min_mag=0.61,
                          max_mag=0.94,
                          bin_width=0.1,
                          a_val=1,
                          b_val=0.2)
     # mag values should be rounded to 0.6 and 0.9 and there
     # should be three bins with the first having center at 0.65
     min_mag, num_bins = mfd._get_min_mag_and_num_bins()
     self.assertAlmostEqual(min_mag, 0.65)
     self.assertEqual(mfd.get_min_mag(), min_mag)
     self.assertEqual(num_bins, 3)