36
36
[ 4. , 3. ], [10. , 6. ], [ 4. , 8. ], [ 1. , 12. ],
37
37
[ 4. , 6. ], [ 4. , 7. ], [ 9. , 2. ], [ 1. , 12. ],
38
38
]),
39
- ranges_total = np .array ([4. , 1. , 8. , 6. , 1. , 4. ,
39
+ ranges_total_strict = np .array ([4. , 1. , 8. , 6. , 1. , 4. ,
40
40
4. , 11. , 2. , 3. , 7. , 11. ]),
41
+ ranges_total = np .array ([ 0.171875 , 3.4375 , 1.375 , 0.171875 ,
42
+ 8.078125 , 5.671875 , 0.6875 , 3.4375 ,
43
+ 4.296875 , 1.890625 , 3.4375 , 6.53125 ,
44
+ 10.828125 , 11.0 ]),
45
+ ranges_total_means = np .array ([9.679688 , 6.84375 , 3.75 , 2.289062 ,
46
+ 6.242188 , 8.304688 , 3.921875 , 7.703125 ,
47
+ 6.070312 , 5.210938 , 5.640625 , 5.296875 ,
48
+ 6.585938 , 6.50 ]),
41
49
ranges_count = np .array ([2 , 1 , 1 , 3 , 0 , 1 , 1 , 1 , 0 , 0 , 2 , 0 ]),
42
50
classes = np .array ([1. , 2. , 3. , 4. , 5. , 6. ,
43
51
7. , 8. , 9. , 10. , 11. , 12. ]),
@@ -65,8 +73,8 @@ class BaseArrayTestCase:
65
73
def test_array_equal (self ):
66
74
np .testing .assert_array_equal (self .result , self .result_true )
67
75
68
- def test_allclose (self ):
69
- np .testing .assert_allclose (self .result , self .result_true )
76
+ # def test_allclose(self):
77
+ # np.testing.assert_allclose(self.result, self.result_true)
70
78
71
79
72
80
class TestFindReversalsStrict (BaseArrayTestCase , unittest .TestCase ):
@@ -128,9 +136,25 @@ def setUp(self):
128
136
self .result = find_rainflow_matrix (cycles , bins , bins )
129
137
130
138
131
- class TestFindRainflowRangesStrict (BaseArrayTestCase , unittest .TestCase ):
139
+ class TestFindRainflowRanges (BaseArrayTestCase , unittest .TestCase ):
132
140
def setUp (self ):
133
141
self .result_true = TESTDATA ['ranges_total' ]
142
+ self .result = find_rainflow_ranges (TESTDATA ['dataseries' ], k = 64 )
143
+
144
+
145
+ class TestFindRainflowRangesMeans (unittest .TestCase ):
146
+ def setUp (self ):
147
+ self .result_true = TESTDATA ['ranges_total_means' ]
148
+ _ , self .result = find_rainflow_ranges (
149
+ TESTDATA ['dataseries' ], k = 64 , return_means = True )
150
+
151
+ def test_almost_equal (self ):
152
+ np .testing .assert_allclose (self .result , self .result_true , rtol = 1e-6 )
153
+
154
+
155
+ class TestFindRainflowRangesStrict (BaseArrayTestCase , unittest .TestCase ):
156
+ def setUp (self ):
157
+ self .result_true = TESTDATA ['ranges_total_strict' ]
134
158
self .result = find_rainflow_ranges_strict (
135
159
TESTDATA ['dataseries' ], k = 11 )
136
160
@@ -140,7 +164,7 @@ def setUp(self):
140
164
self .N_true = TESTDATA ['ranges_count' ]
141
165
self .S_true = TESTDATA ['classes' ]
142
166
self .N , self .S = find_range_count (
143
- TESTDATA ['ranges_total ' ],
167
+ TESTDATA ['ranges_total_strict ' ],
144
168
bins = TESTDATA ['class_boundaries' ])
145
169
146
170
def test_count_allclose (self ):
0 commit comments