def test_full_filter_returns_false_on_moment_too_low(): image_passes = full_filter(circle, (127, 127), cent_atol=1000, thresh_m00_min=10e8, thresh_m00_max=10e9, thresh_similarity=1000, kernel=(3, 3)) assert (image_passes == False)
def test_full_filter_returns_true(): image_passes = full_filter(circle, (127, 127), cent_atol=1000, thresh_m00_min=-10e9, thresh_m00_max=10e9, thresh_similarity=1000, kernel=(3, 3)) assert (image_passes == True)
def test_full_filter_returns_false_on_centriods_too_different(): image_passes = full_filter(circle, (0, 0), cent_atol=1, thresh_m00_min=-10e9, thresh_m00_max=10e9, thresh_similarity=1000, kernel=(3, 3)) assert (image_passes == False)
def test_full_filter_returns_false_on_contour_too_dissimilar(): semi_circle = np.copy(circle) semi_circle[:, :127] = 0 image_passes = full_filter(semi_circle, (127, 127), cent_atol=100, thresh_m00_min=-10e9, thresh_m00_max=10e9, thresh_similarity=0.001, kernel=(3, 3)) assert (image_passes == False)
def test_full_filter_works_on_dg3_images(): for key, img in images_dg3.items(): try: cent, _ = detect(img, kernel=(9, 9)) except NoBeamDetected: cent = (0, 0) image_passes = full_filter(img, cent, kernel=(9, 9), n_opening=3, thresh_similarity=0.1, cent_atol=3) assert (image_passes == bool(int(key[-3:])) and True)
def test_full_filter_returns_true_correctly(): for i, image in enumerate(beam_images): cent, _ = detect(image) image_passes = full_filter(image, cent, n_opening=0, kernel=(3, 3), thresh_m00_min=5, thresh_m00_max=100) if image is beam_image_04: assert (image_passes == False) else: assert (image_passes == True)