tmp/ 가 창끼리 안 건너가는 것이 확정돼(랩탑이 시간 두고 두 번 확인) 시험·예외가 저절로 건너가도록 git 안으로 옮김. 사용자 확정. - 내용은 하나도 안 고침 — 자리만 옮김. tmp/tests 는 남겨 둠. - 같은 이름이 이미 있던 64 개는 랩탑 것을 그대로 두고 건너뜀. - helper_b05_*.js 둘은 랩탑이 .cjs 로 이미 올린 것과 **줄바꿈만 다른 같은 내용**이라 복사본을 도로 뺌(시험이 .cjs 를 부름). - resources/tester/ 에서 전체 1176 통과 · 29 건너뜀 · 실패 0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
51 lines
1.7 KiB
Python
51 lines
1.7 KiB
Python
"""미리보기 점 수집이 업로드 분석 시간을 늘리지 않는지 (2026-09-04 사용자 제약)."""
|
|
|
|
import sys
|
|
import time
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
sys.path.append(str(ROOT))
|
|
|
|
|
|
def _las_file() -> Path:
|
|
from tmp.tests.test_preview_assets import _project_root # noqa: PLC0415
|
|
|
|
root = _project_root()
|
|
files = sorted((root / "B03_FileInput" / "input" / "las").glob("*.la*"))
|
|
if not files:
|
|
pytest.skip("LAS 파일이 없습니다.")
|
|
return files[0]
|
|
|
|
|
|
def test_collect_cost_is_small():
|
|
import laspy
|
|
import numpy as np
|
|
|
|
path = _las_file()
|
|
# ① 분류 통계만 (종전 동작)
|
|
started = time.perf_counter()
|
|
with laspy.open(path) as las_file:
|
|
counts: dict[int, int] = {}
|
|
for chunk in las_file.chunk_iterator(500_000):
|
|
values, chunk_counts = np.unique(
|
|
np.asarray(chunk.classification, dtype=np.uint8), return_counts=True
|
|
)
|
|
for value, count in zip(values.tolist(), chunk_counts.tolist(), strict=True):
|
|
counts[value] = counts.get(value, 0) + count
|
|
baseline = time.perf_counter() - started
|
|
|
|
# ② 지금 동작 (같은 길에 XY 를 성기게 주움)
|
|
from B03_FileInput.B03_FileInput_Engine_Analyze import analyze_las_metadata
|
|
|
|
started = time.perf_counter()
|
|
meta = analyze_las_metadata(path)
|
|
current = time.perf_counter() - started
|
|
|
|
print(f"\n분류 통계만 {baseline:.2f}s / 점 수집 포함 {current:.2f}s "
|
|
f"(차이 {current - baseline:+.2f}s, 점 {len(meta['preview_points'])}개)")
|
|
# 파일을 다시 읽지 않으므로 한 번 훑는 시간과 크게 다르지 않아야 한다.
|
|
assert current <= baseline * 1.5 + 1.0
|