def test_fault_source_outside_depth_range(self): """ Tests the rates when the whole fault is inside the polygon """ self.limits = {"polygon": Polygon([Point(14.9, 14.9), Point(14.9, 15.1), Point(15.1, 15.1), Point(15.1, 14.9)]), "upper_depth": 21.0, "lower_depth": 25.0} model1 = RatePolygon(self.limits, [SIMPLE_FAULT], area_discretisation=4.0) model1.get_rates(7.0) self.assertAlmostEqual(model1.rates, 0.0)
def test_point_source_outside_mag_limit(self): """ Tests the case of a single point source outside the polygon """ self.limits = {"polygon": Polygon([Point(14.9, 14.9), Point(14.9, 15.1), Point(15.1, 15.1), Point(15.1, 14.9)]), "upper_depth": 0.0, "lower_depth": 3.0} model1 = RatePolygon(self.limits, [POINT_SOURCE], area_discretisation=4.0) model1.get_rates(5.5, 6.0) self.assertAlmostEqual(model1.rates, 0.0)
def test_instantiation(self): """ Tests simple instantiation of the class """ self.limits = {"polygon": Polygon([Point(14.9, 14.9), Point(14.9, 15.1), Point(15.1, 15.1), Point(15.1, 14.9)]), "upper_depth": 0.0, "lower_depth": 10.0} model1 = RatePolygon(self.limits, [POINT_SOURCE], area_discretisation=4.0) self.assertAlmostEqual(model1.upper_depth, 0.0) self.assertAlmostEqual(model1.lower_depth, 10.0) self.assertAlmostEqual(model1.rates, 0.0)