@@ -47,6 +47,7 @@ def test_from_step(self):
4747 self .assertEqual (imp_fun .haz_type , 'TC' )
4848 self .assertEqual (imp_fun .id , 2 )
4949
50+
5051 def test_from_sigmoid (self ):
5152 """Check default impact function: sigmoid function"""
5253 inten = (0 , 100 , 5 )
@@ -59,34 +60,6 @@ def test_from_sigmoid(self):
5960 self .assertEqual (imp_fun .haz_type , 'RF' )
6061 self .assertEqual (imp_fun .id , 2 )
6162
62- def test_from_poly_s_shape (self ):
63- """Check default impact function: polynomial s-shape"""
64- inten = (0 , 5 , 1 )
65- impf = ImpactFunc .from_poly_s_shape (
66- inten , threshold = 0.2 , half_point = 1 , upper_limit = 0.8 , exponent = 4 ,
67- haz_type = 'RF' , impf_id = 2 , intensity_unit = 'm'
68- )
69- correct_mdd = np .array ([0 , 0.4 , 0.76995746 , 0.79470418 , 0.79843158 ])
70- self .assertTrue (np .array_equal (impf .paa , np .ones (5 )))
71- np .testing .assert_array_almost_equal (impf .mdd , correct_mdd )
72- self .assertTrue (np .array_equal (impf .intensity , np .arange (0 , 5 , 1 )))
73- self .assertEqual (impf .haz_type , 'RF' )
74- self .assertEqual (impf .id , 2 )
75- self .assertEqual (impf .intensity_unit , 'm' )
76-
77- # If threshold > half_point, mdd should all be 0
78- impf = ImpactFunc .from_poly_s_shape (
79- inten , threshold = 2 , half_point = 1 , upper_limit = 0.8 , exponent = 4 ,
80- haz_type = 'RF' , impf_id = 2 , intensity_unit = 'm'
81- )
82- correct_mdd = np .array ([0 , 0.4 , 0.76995746 , 0.79470418 , 0.79843158 ])
83- self .assertTrue (np .array_equal (impf .paa , np .ones (5 )))
84- np .testing .assert_array_almost_equal (impf .mdd , np .zeros (5 ))
85- self .assertTrue (np .array_equal (impf .intensity , np .arange (0 , 5 , 1 )))
86- self .assertEqual (impf .haz_type , 'RF' )
87- self .assertEqual (impf .id , 2 )
88- self .assertEqual (impf .intensity_unit , 'm' )
89-
9063# Execute Tests
9164if __name__ == "__main__" :
9265 TESTS = unittest .TestLoader ().loadTestsFromTestCase (TestInterpolation )
0 commit comments