(self)
| 2695 | class Test_I0: |
| 2696 | |
| 2697 | def test_simple(self): |
| 2698 | assert_almost_equal( |
| 2699 | i0(0.5), |
| 2700 | np.array(1.0634833707413234)) |
| 2701 | |
| 2702 | # need at least one test above 8, as the implementation is piecewise |
| 2703 | A = np.array([0.49842636, 0.6969809, 0.22011976, 0.0155549, 10.0]) |
| 2704 | expected = np.array([1.06307822, 1.12518299, 1.01214991, |
| 2705 | 1.00006049, 2815.71662847]) |
| 2706 | assert_almost_equal(i0(A), expected) |
| 2707 | assert_almost_equal(i0(-A), expected) |
| 2708 | |
| 2709 | B = np.array([[0.827002, 0.99959078], |
| 2710 | [0.89694769, 0.39298162], |
| 2711 | [0.37954418, 0.05206293], |
| 2712 | [0.36465447, 0.72446427], |
| 2713 | [0.48164949, 0.50324519]]) |
| 2714 | assert_almost_equal( |
| 2715 | i0(B), |
| 2716 | np.array([[1.17843223, 1.26583466], |
| 2717 | [1.21147086, 1.03898290], |
| 2718 | [1.03633899, 1.00067775], |
| 2719 | [1.03352052, 1.13557954], |
| 2720 | [1.05884290, 1.06432317]])) |
| 2721 | # Regression test for gh-11205 |
| 2722 | i0_0 = np.i0([0.]) |
| 2723 | assert_equal(i0_0.shape, (1,)) |
| 2724 | assert_array_equal(np.i0([0.]), np.array([1.])) |
| 2725 | |
| 2726 | def test_non_array(self): |
| 2727 | a = np.arange(4) |
nothing calls this directly
no test coverage detected