@@ -25,30 +25,30 @@ class TestLoadData:
25
25
"hrr" )
26
26
27
27
def test_backfill (self ):
28
- num0 = pd . Series ([0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ], dtype = float )
29
- den0 = pd . Series ([0 , 10 , 10 , 10 , 10 , 10 , 10 , 100 , 101 ], dtype = float )
28
+ num0 = np . array ([0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ], dtype = float ). reshape ( - 1 , 1 )
29
+ den0 = np . array ([0 , 10 , 10 , 10 , 10 , 10 , 10 , 100 , 101 ], dtype = float )
30
30
31
31
num1 , den1 = EMRHospSensor .backfill (num0 , den0 , k = 7 , min_visits_to_fill = 0 )
32
- pd . testing . assert_series_equal (num0 , num1 )
33
- pd . testing . assert_series_equal (den0 , den1 )
32
+ assert np . array_equal (num0 , num1 )
33
+ assert np . array_equal (den0 , den1 )
34
34
35
35
num2 , den2 = EMRHospSensor .backfill (num0 , den0 , k = 7 , min_visits_to_fill = 11 )
36
- exp_num2 = pd . Series ([0 , 1 , 3 , 5 , 7 , 9 , 11 , 7 , 8 ], dtype = float )
37
- exp_den2 = pd . Series ([0 , 10 , 20 , 20 , 20 , 20 , 20 , 100 , 101 ], dtype = float )
38
- pd . testing . assert_series_equal (exp_num2 , num2 )
39
- pd . testing . assert_series_equal (exp_den2 , den2 )
40
-
36
+ exp_num2 = np . array ([0 , 1 , 3 , 5 , 7 , 9 , 11 , 7 , 8 ], dtype = float ). reshape ( - 1 , 1 )
37
+ exp_den2 = np . array ([0 , 10 , 20 , 20 , 20 , 20 , 20 , 100 , 101 ], dtype = float )
38
+ assert np . array_equal (exp_num2 , num2 )
39
+ assert np . array_equal (exp_den2 , den2 )
40
+ #
41
41
num3 , den3 = EMRHospSensor .backfill (num0 , den0 , k = 7 , min_visits_to_fill = 100 )
42
- exp_num3 = pd . Series ([0 , 1 , 3 , 6 , 10 , 15 , 21 , 7 , 8 ], dtype = float )
43
- exp_den3 = pd . Series ([0 , 10 , 20 , 30 , 40 , 50 , 60 , 100 , 101 ], dtype = float )
44
- pd . testing . assert_series_equal (exp_num3 , num3 )
45
- pd . testing . assert_series_equal (exp_den3 , den3 )
46
-
42
+ exp_num3 = np . array ([0 , 1 , 3 , 6 , 10 , 15 , 21 , 7 , 8 ], dtype = float ). reshape ( - 1 , 1 )
43
+ exp_den3 = np . array ([0 , 10 , 20 , 30 , 40 , 50 , 60 , 100 , 101 ], dtype = float )
44
+ assert np . array_equal (exp_num3 , num3 )
45
+ assert np . array_equal (exp_den3 , den3 )
46
+ #
47
47
num4 , den4 = EMRHospSensor .backfill (num0 , den0 , k = 3 , min_visits_to_fill = 100 )
48
- exp_num4 = pd . Series ([0 , 1 , 3 , 6 , 10 , 14 , 18 , 7 , 8 ], dtype = float )
49
- exp_den4 = pd . Series ([0 , 10 , 20 , 30 , 40 , 40 , 40 , 100 , 101 ], dtype = float )
50
- pd . testing . assert_series_equal (exp_num4 , num4 )
51
- pd . testing . assert_series_equal (exp_den4 , den4 )
48
+ exp_num4 = np . array ([0 , 1 , 3 , 6 , 10 , 14 , 18 , 7 , 8 ], dtype = float ). reshape ( - 1 , 1 )
49
+ exp_den4 = np . array ([0 , 10 , 20 , 30 , 40 , 40 , 40 , 100 , 101 ], dtype = float )
50
+ assert np . array_equal (exp_num4 , num4 )
51
+ assert np . array_equal (exp_den4 , den4 )
52
52
53
53
def test_fit_fips (self ):
54
54
date_range = pd .date_range ("2020-05-01" , "2020-05-20" )
@@ -93,3 +93,5 @@ def test_fit_hrrs(self):
93
93
assert np .nanmax (res0 ["se" ]) <= 100 * (0.5 / np .sqrt (Config .MIN_DEN ))
94
94
assert np .nanmin (res0 ["se" ]) > 0
95
95
assert res0 ["incl" ].sum () > 0
96
+
97
+
0 commit comments