def test_moment_7(): """ circ.moment: test bootstrapping... """ data = np.array([1.80044838, 2.02938314, 1.03534016, 4.84225057, 1.54256458, 5.19290675, 2.18474784, 4.77054777, 1.51736933, 0.72727580]) mp, (lo, hi) = pycircstat.moment(data, ci=0.8) assert_allclose(mp, 0.074229066428146 + 0.333420553996661j, rtol=1e-6)
def test_moment_center(): """ circ.moment: test that the centering argument works... """ data = np.array([1.80044838, 2.02938314, 1.03534016, 4.84225057, 1.54256458, 5.19290675, 2.18474784, 4.77054777, 1.51736933, 0.72727580]) mp = pycircstat.moment(data, cent=True) assert_allclose(mp, 3.415834014267002e-01, rtol=1e-7)
def test_moment_7(): """ circ.moment: test bootstrapping... """ data = np.array([1.80044838, 2.02938314, 1.03534016, 4.84225057, 1.54256458, 5.19290675, 2.18474784, 4.77054777, 1.51736933, 0.72727580]) mp, (lo, hi) = pycircstat.moment(data, ci=0.8) assert_allclose(mp, 0.074229066428146 + 0.333420553996661j, rtol=1e-6)
def test_moment_center(): """ circ.moment: test that the centering argument works... """ data = np.array([1.80044838, 2.02938314, 1.03534016, 4.84225057, 1.54256458, 5.19290675, 2.18474784, 4.77054777, 1.51736933, 0.72727580]) mp = pycircstat.moment(data, cent=True) assert_allclose(mp, 3.415834014267002e-01, rtol=1e-7)
def test_moment_second_order(): """ circ.moment: test second order... """ data = np.array([1.80044838, 2.02938314, 1.03534016, 4.84225057, 1.54256458, 5.19290675, 2.18474784, 4.77054777, 1.51736933, 0.72727580]) mp = pycircstat.moment(data, p=2) assert_allclose(mp, -6.729059729506420e-01 - 1.337676350865910e-01j, rtol=1e-7)
def test_moment_second_order(): """ circ.moment: test second order... """ data = np.array([1.80044838, 2.02938314, 1.03534016, 4.84225057, 1.54256458, 5.19290675, 2.18474784, 4.77054777, 1.51736933, 0.72727580]) mp = pycircstat.moment(data, p=2) assert_allclose(mp, -6.729059729506420e-01 - 1.337676350865910e-01j, rtol=1e-7)
def test_moment_2d_data_axisNone(): """circ.moment: test 2D data (axis=0)...""" data = np.array([ [0.58429, 0.88333], [1.14892, 2.22854], [2.87128, 3.06369], [1.07677, 1.49836], [2.96969, 1.51748], ]) mp = pycircstat.moment(data) assert_allclose(mp, -0.10793 + 0.64205 * 1j, rtol=1e-5)
def test_moment_2d_data_axisNone(): """circ.moment: test 2D data (axis=0)...""" data = np.array([ [0.58429, 0.88333], [1.14892, 2.22854], [2.87128, 3.06369], [1.07677, 1.49836], [2.96969, 1.51748], ]) mp = pycircstat.moment(data) assert_allclose(mp, -0.10793 + 0.64205 * 1j, rtol=1e-5)
def test_moment_2d_data_axis0(): """circ.moment: test 2D data (axis=0)...""" data = np.array([ [0.58429, 0.88333], [1.14892, 2.22854], [2.87128, 3.06369], [1.07677, 1.49836], [2.96969, 1.51748], ]) mp = pycircstat.moment(data, axis=0) assert_allclose(mp, [-0.046239398678727 + 0.556490077122954j, -0.169610962142131 + 0.727602093024094j], rtol=1e-7)
def test_moment_2d_data_axis0(): """circ.moment: test 2D data (axis=0)...""" data = np.array([ [0.58429, 0.88333], [1.14892, 2.22854], [2.87128, 3.06369], [1.07677, 1.49836], [2.96969, 1.51748], ]) mp = pycircstat.moment(data, axis=0) assert_allclose(mp, [-0.046239398678727 + 0.556490077122954j, -0.169610962142131 + 0.727602093024094j], rtol=1e-7)
def test_moment_2d_data_axis1_centering(): """circ.moment: test 2D data (axis=1) with centring...""" data = np.array([ [0.58429, 0.88333], [1.14892, 2.22854], [2.87128, 3.06369], [1.07677, 1.49836], [2.96969, 1.51748], ]) mp = pycircstat.moment(data, axis=1, cent=True) assert_allclose(mp, [0.988842694330449 - 0.000000000000000j, 0.857806351720009 + 0.000000000000000j, 0.995375867155958 - 0.000000000000000j, 0.977864880051249 + 0.000000000000000j, 0.747766200482936 - 0.000000000000000j], rtol=1e-7)
def test_moment_2d_data_axis1(): """circ.moment: test 2D data (axis=1)...""" data = np.array([ [0.58429, 0.88333], [1.14892, 2.22854], [2.87128, 3.06369], [1.07677, 1.49836], [2.96969, 1.51748], ]) mp = pycircstat.moment(data, axis=1) assert_allclose(mp, [0.734342496552133 + 0.662231811292906j, -0.100929912318249 + 0.851847926481377j, -0.980327288650584 + 0.172428315666164j, 0.273273810931458 + 0.938904227222693j, -0.465985008566902 + 0.584818144704480j], rtol=1e-7)
def test_moment_2d_data_axis1_centering(): """circ.moment: test 2D data (axis=1) with centring...""" data = np.array([ [0.58429, 0.88333], [1.14892, 2.22854], [2.87128, 3.06369], [1.07677, 1.49836], [2.96969, 1.51748], ]) mp = pycircstat.moment(data, axis=1, cent=True) assert_allclose(mp, [0.988842694330449 - 0.000000000000000j, 0.857806351720009 + 0.000000000000000j, 0.995375867155958 - 0.000000000000000j, 0.977864880051249 + 0.000000000000000j, 0.747766200482936 - 0.000000000000000j], rtol=1e-7)
def test_moment_2d_data_axis1(): """circ.moment: test 2D data (axis=1)...""" data = np.array([ [0.58429, 0.88333], [1.14892, 2.22854], [2.87128, 3.06369], [1.07677, 1.49836], [2.96969, 1.51748], ]) mp = pycircstat.moment(data, axis=1) assert_allclose(mp, [0.734342496552133 + 0.662231811292906j, -0.100929912318249 + 0.851847926481377j, -0.980327288650584 + 0.172428315666164j, 0.273273810931458 + 0.938904227222693j, -0.465985008566902 + 0.584818144704480j], rtol=1e-7)