test(770-1): 532-2 B06 면적 대조 = E03 분석 길(관 · 벽 측점 그려지는 설계선) · 검증_sub4_E 복사본
- 까닭: 768 새 자료 관 측점 340 · 342 · 1200 · 1201 m 에서 B06 [저장] 면적 = 관 트림 뒤 「그려지는 설계선」 기준(`structure.layouts` 폐회로 면적) · 시험만 원 설계선으로 재 어긋남(옛 검증_sub4 엔 관 측점 없음) - E03 분석 길(`walls_by_station` · `design_with_walls`)로는 71 측점 모두 B06 과 같음(검증_sub4_E · 검증_sub6_E) — 코드 흠 아님 · 코드 안 고침 - 시험 = 옛 B 초기값 스냅샷 대신 E 복사본 + 분석 길 그대로 · 관 측점 있어야 함 확인 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""532-2 E03 2D 지층 모델 빌더 — 폴리곤 닫힘 · 지층 · 성토체 · 절성토 면적 = B06 · 비탈 목록 · 측점 해석 꼴.
|
||||
|
||||
- 순수 함수(`build_section_model`)는 만든 단면으로 · B06 대조는 검증_sub4 초기값 스냅샷(읽기만 · 없으면 건너뜀).
|
||||
- 순수 함수(`build_section_model`)는 만든 단면으로 ·
|
||||
B06 대조는 검증_sub4_E 복사본(읽기만 · 없으면 건너뜀) ·
|
||||
E03 분석 길 그대로(관 · 벽 측점 = `walls_by_station` 그려지는 설계선 · B06 면적도 그 선).
|
||||
|
||||
./venv/Scripts/python.exe -m pytest resources/tester/test_532_2_stab_section_model.py -q
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
@@ -18,6 +19,8 @@ from shapely.geometry import Polygon
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from common_util.common_util_station_key import chainage_key # noqa: E402
|
||||
from E01_StabRegister import E01_StabRegister_Source as source # noqa: E402
|
||||
from E03_StabSection.E03_StabSection_Engine_Model import ( # noqa: E402
|
||||
build_section_model,
|
||||
polygon_closed,
|
||||
@@ -25,8 +28,13 @@ from E03_StabSection.E03_StabSection_Engine_Model import ( # noqa: E402
|
||||
side_cases,
|
||||
)
|
||||
from E03_StabSection.E03_StabSection_Engine_Station import analyze_station # noqa: E402
|
||||
from E03_StabSection.E03_StabSection_Walls import ( # noqa: E402
|
||||
design_with_walls,
|
||||
walls_by_station,
|
||||
walls_of,
|
||||
)
|
||||
|
||||
SUB4 = ROOT / "storage/1/3/b5cf922b-2eaf-44b1-9e28-da78b4c92d00/initial_snapshot"
|
||||
SUB4_E = ROOT / "storage/1/3/1fe7901c-d26b-443d-89a2-28172ec438bc"
|
||||
|
||||
# 오른쪽(−) 산 · 왼쪽(+) 골 · 편절편성: 노면 −2~2 · 우 절토 1:0.5 · 좌 성토 1:1.5
|
||||
GROUND = [(x / 2, 10.0 - 0.6 * (x / 2)) for x in range(-40, 41)] # 10 − 0.6x (좌로 내려감)
|
||||
@@ -131,18 +139,22 @@ def test_analyze_station_shape():
|
||||
assert res["cases"][0]["result"]["contour"]["F"]
|
||||
|
||||
|
||||
@pytest.mark.skipif(not (SUB4 / "db.json").exists(), reason="검증_sub4 스냅샷 없음")
|
||||
@pytest.mark.skipif(not source.source_dir(SUB4_E).is_dir(), reason="검증_sub4_E 복사본 없음")
|
||||
def test_b06_areas_match_all_stations():
|
||||
"""검증_sub4 전 측점 — 모델 절토 · 성토 · 토사 · 암 면적 = B06 저장값(반올림 4 자리 안)."""
|
||||
rows = json.loads((SUB4 / "db.json").read_text(encoding="utf-8"))["cross_sections"]
|
||||
assert rows
|
||||
for row in rows:
|
||||
design = json.loads(row["data"])["design"]
|
||||
name = Path(row["cross_section_file_path"]).name
|
||||
cross = json.loads(
|
||||
(SUB4 / "B06_Section__cross_sections" / name).read_text(encoding="utf-8")
|
||||
)
|
||||
m = section_model_from_b06(cross, design)
|
||||
"""검증_sub4_E 전 측점 — 모델 절토 · 성토 · 토사 · 암 면적 = B06 저장값(반올림 4 자리 안).
|
||||
|
||||
관 · 벽 측점은 E03 분석 길 그대로(`design_with_walls` · `walls_of`) — B06 [저장] 면적이
|
||||
구조물 트림 뒤 「그려지는 설계선」 기준이라 원 설계선으로 재면 어긋남."""
|
||||
root = source.source_dir(SUB4_E)
|
||||
found = walls_by_station(root)
|
||||
stations = source.stations(root)
|
||||
assert stations and found # 관 측점이 있어야 트림 길도 잼
|
||||
for station in stations:
|
||||
cross = source.cross_section(root, station["chainage_m"])
|
||||
design = cross["design"]
|
||||
name = cross.get("label")
|
||||
entry = found.get(chainage_key(station["chainage_m"]))
|
||||
m = section_model_from_b06(cross, design_with_walls(design, entry), walls=walls_of(entry))
|
||||
assert all(polygon_closed(r) for r in m["regions"]), name
|
||||
a = m["areas"]
|
||||
assert abs(a["cut_m2"] - design["cut_area_m2"]) < 2e-3, name
|
||||
|
||||
Reference in New Issue
Block a user