def test_cvf_nomasked(self): (mdeaths, fdeaths) = (self.mdeaths, self.fdeaths) cvfm = cvf(mdeaths, mdeaths) assert_almost_equal(avf(mdeaths), cvfm) cvfmf = cvf(mdeaths, fdeaths) assert_almost_equal(cvfmf[:16].round(), [ 74941, 56473, 27961, -820, -29395, -47777, -52855, -46871, -29427, -1390, 30090, 50403, 55378, 49061, 27739, -260 ]) assert_almost_equal(cvfmf[-15:].round(), [ 1156, 28067, 47243, 54365, 47740, 26100, -1883, -29299, -46964, -52031, -46368, -26827, 1517, 31105, 57137, ])
def test_cvf_nomasked(self): (mdeaths, fdeaths) = (self.mdeaths, self.fdeaths) cvfm = cvf(mdeaths,mdeaths) assert_almost_equal(avf(mdeaths), cvfm) cvfmf = cvf(mdeaths,fdeaths) assert_almost_equal(cvfmf[:16].round(), [ 74941, 56473, 27961, -820,-29395,-47777,-52855, -46871,-29427, -1390, 30090, 50403,55378, 49061, 27739,-260]) assert_almost_equal(cvfmf[-15:].round(), [ 1156, 28067, 47243, 54365, 47740, 26100, -1883, -29299,-46964,-52031,-46368,-26827, 1517, 31105, 57137,])
def test_cvf_masked(self): (mdeaths, fdeaths) = (self.mdeaths, self.fdeaths) (mdeaths_, fdeaths_) = (mdeaths.copy(), fdeaths.copy()) mdeaths_[0] = fdeaths_[-1] = ma.masked cvfmf = cvf(mdeaths_,fdeaths_) assert_almost_equal(cvfmf[:16].round(4), [ 73964.4731, 56471.7150, 27967.4713, -795.2985, -29350.6550,-47710.5560,-52768.6081,-46767.4760, -29311.7816, -1280.9791, 30179.0824, 50463.3681, 55404.6871, 49071.1267, 27764.8371, -219.5959]) assert_almost_equal(cvfmf[-15:].round(4), [ 206.5786, 26763.5676, 46821.7325, 53326.3888, 47955.9913, 26600.5188, -2221.0872,-28578.8452, -46765.5598,-52410.7168,-46279.6304,-27242.8170, 498.1511, 29551.1878, 57576.9793])
def test_cvf_masked(self): (mdeaths, fdeaths) = (self.mdeaths, self.fdeaths) (mdeaths_, fdeaths_) = (mdeaths.copy(), fdeaths.copy()) mdeaths_[0] = fdeaths_[-1] = ma.masked cvfmf = cvf(mdeaths_, fdeaths_) assert_almost_equal(cvfmf[:16].round(4), [ 73964.4731, 56471.7150, 27967.4713, -795.2985, -29350.6550, -47710.5560, -52768.6081, -46767.4760, -29311.7816, -1280.9791, 30179.0824, 50463.3681, 55404.6871, 49071.1267, 27764.8371, -219.5959 ]) assert_almost_equal(cvfmf[-15:].round(4), [ 206.5786, 26763.5676, 46821.7325, 53326.3888, 47955.9913, 26600.5188, -2221.0872, -28578.8452, -46765.5598, -52410.7168, -46279.6304, -27242.8170, 498.1511, 29551.1878, 57576.9793 ])