File size: 505 Bytes
78661be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import numpy as np
from pipeline.auto_clusters import estimate_n_clusters


def test_tiny_image_returns_k_min_of_two():
    tiny = np.zeros((5, 5, 3), dtype=np.float64)
    assert estimate_n_clusters(tiny) == 2


def test_red_green_image_enforces_cluster_floor():
    lab = np.zeros((200, 200, 3), dtype=np.float64)
    lab[:, :, 0] = 50
    lab[:, :100, 1] = 40
    lab[:, 100:, 1] = -40
    lab[:, :, 2] = 10
    k = estimate_n_clusters(lab)
    assert k >= 12, f"red/green floor should be 12, got {k}"