Files
olivv-cs-ComfyUI-FunPack/tests/test_pulse_temporal.py
T
digital-garbage b72878f866 Add Pulse temporal style with per-scene ease-down segments
Introduces a new temporal_style option that cycles motion→hold ramps
across each scene's denoise trajectory via a segmented frame_rate wrapper.
Wired through Studio, engine settings, chain sampler conditioning tags,
and build_enhancements for single-scene workflows.
2026-06-10 16:50:19 +03:00

42 lines
1.6 KiB
Python

"""Unit tests for Pulse temporal style schedule math."""
import importlib.util
from pathlib import Path
_root = Path(__file__).resolve().parents[1]
_spec = importlib.util.spec_from_file_location("ltx_enhancements", _root / "ltx_enhancements.py")
_mod = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_mod)
pulse_mult_for_progress = _mod.pulse_mult_for_progress
PULSE_PEAK_MULT = _mod.PULSE_PEAK_MULT
PULSE_FLOOR_MULT = _mod.PULSE_FLOOR_MULT
def test_pulse_starts_at_peak():
mult = pulse_mult_for_progress(0.0, segment_count=3)
assert abs(mult - PULSE_PEAK_MULT) < 1e-6
def test_pulse_segment_boundaries_reset_toward_peak():
# End of segment 0 (progress ~1/3) should be near floor; start of segment 1 resets toward peak.
end_seg0 = pulse_mult_for_progress(1.0 / 3.0 - 1e-6, segment_count=3)
start_seg1 = pulse_mult_for_progress(1.0 / 3.0, segment_count=3)
assert end_seg0 > PULSE_PEAK_MULT
assert abs(start_seg1 - PULSE_PEAK_MULT) < 1e-6
def test_pulse_eases_down_within_segment():
start = pulse_mult_for_progress(0.0, segment_count=1)
end = pulse_mult_for_progress(1.0, segment_count=1)
mid = pulse_mult_for_progress(0.5, segment_count=1)
assert start < mid < end
assert abs(end - PULSE_FLOOR_MULT) < 1e-6
def test_pulse_three_segments():
samples = [pulse_mult_for_progress(p, segment_count=3) for p in (0.0, 0.16, 0.33, 0.5, 0.66, 0.99)]
# Each segment should show an upward jump at boundaries (reset to peak).
assert samples[0] < samples[1] < samples[2]
assert samples[2] > samples[3]
assert samples[3] < samples[4]