def test_loss_ratios_range_generation(self): expected_range = numpy.array([0.0000, 0.0292, 0.0583, 0.0875, 0.1167, 0.1458, 0.1750, 0.2042, 0.2333, 0.2625, 0.2917, 0.3208, 0.3500, 0.3792, 0.4083, 0.4375, 0.4667, 0.4958, 0.5250, 0.5542, 0.5833, 0.6125, 0.6417, 0.6708, 0.700]) self.assertTrue(numpy.allclose(expected_range, prob.compute_loss_ratios_range(self.vuln_function), atol=0.0001))
def test_builds_the_cumulative_histogram(self): self.assertTrue(numpy.allclose(self.cum_histogram, prob.compute_cumulative_histogram( prob.compute_loss_ratios(self.vuln_function, self.gmfs), prob.compute_loss_ratios_range(self.vuln_function))))