def test_circle_overlap(): pt1 = (10, 10, 10, 10, 0) pt2 = (10, 15, 10, 10, 0) assert _circle_overlap(pt1, pt2) == 0.68503764247429266 assert _circle_overlap(pt2, pt1) == 0.68503764247429266
def test_ellipse_overlap(): pt1 = (10, 10, 10, 10, 0) pt2 = (10, 15, 10, 10, 0) npt.assert_almost_equal(_circle_overlap(pt1, pt2), _ellipse_overlap(pt1, pt2), decimal=2)
def test_ellipse_corr(): pt1 = (10, 10, 10, 10, 0) pt2 = (10, 15, 10, 10, 0) npt.assert_almost_equal(_circle_overlap(pt1, pt2, return_corr=True), _ellipse_overlap(pt1, pt2, return_corr=True), decimal=2)
def test_circle_corr_inside(): pt1 = (10, 10, 10, 10, 0) pt2 = (10, 10, 8, 8, 0) # Reduces to ratio of the radii for this case corr = 0.8 npt.assert_almost_equal(_circle_overlap(pt1, pt2, return_corr=True), corr)
def test_circle_corr(): pt1 = (10, 10, 10, 10, 0) pt2 = (10, 15, 10, 10, 0) Aover = 0.68503764247429266 * np.pi * 10**2 corr = Aover / (np.pi * 10 * 10) npt.assert_almost_equal(_circle_overlap(pt1, pt2, return_corr=True), corr)