Cut portrait ballast from tile-graph core

This commit is contained in:
Meta Vens 2026-04-23 04:59:15 +01:00
commit 8be09a5786
10 changed files with 677 additions and 1040 deletions

View file

@ -2,7 +2,7 @@ from __future__ import annotations
import numpy as np
from repixelizer.source_reference import build_source_lattice_reference, build_tile_graph_source_reference
from repixelizer.source_reference import build_source_lattice_reference
def test_source_lattice_reference_recovers_stable_cell_colors() -> None:
@ -56,35 +56,6 @@ def test_source_lattice_reference_tracks_edge_peaks_and_gradients() -> None:
assert np.all(reference.edge_grad_x[:, 0] == 1.0)
assert np.all(reference.edge_grad_y[:, 0] == 0.0)
def test_tile_graph_source_reference_matches_continuous_anchor_fields() -> None:
source = np.zeros((6, 6, 4), dtype=np.float32)
source[..., 3] = 1.0
source[:, 2, :3] = 1.0
full = build_source_lattice_reference(
source,
target_width=2,
target_height=2,
phase_x=0.0,
phase_y=0.0,
)
tile = build_tile_graph_source_reference(
source,
target_width=2,
target_height=2,
phase_x=0.0,
phase_y=0.0,
)
assert np.allclose(tile.sharp_rgba, full.sharp_rgba, atol=1e-5)
assert np.array_equal(tile.sharp_x, full.sharp_x)
assert np.array_equal(tile.sharp_y, full.sharp_y)
assert np.array_equal(tile.edge_peak_x, full.edge_peak_x)
assert np.array_equal(tile.edge_peak_y, full.edge_peak_y)
assert np.allclose(tile.edge_strength, full.edge_strength, atol=1e-5)
def test_source_lattice_reference_cpu_device_matches_default_path() -> None:
source = np.zeros((8, 8, 4), dtype=np.float32)
source[..., 3] = 1.0