Merge remote-tracking branch 'origin/sub_laptop_7' into main_laptop_1

This commit is contained in:
2026-10-26 03:28:31 +09:00
6 changed files with 79 additions and 23 deletions
+32
View File
@@ -182,3 +182,35 @@ def test_node_mask_section_and_route_ends(root):
assert mask[(np.abs(yy) <= 12.0) & (xx >= 1) & (xx <= 99)].all()
part = run._node_mask(STATIONS, grid, 20.0, 60.0, 12.0)
assert not part[(xx < 19.5) | (xx > 60.5)].any() and part[(yy == 0) & (xx == 40)].all()
def test_ground_order_and_label_map(tmp_path):
"""물성 = E02 작업본 → 초기값 → 마스터 기본값(성토 φ 28) · 층 물성 = label_map 짝."""
import json
from E04_Stab3D import E04_Stab3D_Engine_Grid as grid_engine
assert {m["id"]: m["phi"] for m in run.read_ground(tmp_path)["materials"]}["fill"] == 28.0
init = tmp_path / "initial_snapshot" / "E02_StabGround" / "ground.json"
init.parent.mkdir(parents=True)
init.write_text(json.dumps({"tag": "initial"}), encoding="utf-8")
assert run.read_ground(tmp_path) == {"tag": "initial"}
work = tmp_path / "E02_StabGround" / "ground.json"
work.parent.mkdir(parents=True)
work.write_text(json.dumps({"tag": "work"}), encoding="utf-8")
assert run.read_ground(tmp_path) == {"tag": "work"}
z = np.full((2, 2), 10.0)
grid = {
"x": np.arange(2.0),
"y": np.arange(2.0),
"z": z,
"z_orig": z,
"rock_top": z - 3,
"rock_kind": np.ones((2, 2), int),
"q": np.zeros((2, 2)),
}
ids = [m["id"] for m in grid_engine.strata_from_grid(grid).materials]
assert ids == ["fill", "weathered_soil", "weathered_rock", "soft_rock"]
mapped = grid_engine.strata_from_grid(grid, label_map={"soil": "colluvium", "fill": "fill"})
assert [m["id"] for m in mapped.materials][:2] == ["fill", "colluvium"]
+4
View File
@@ -56,6 +56,9 @@ writeFileSync(process.argv[3], JSON.stringify({
min2d: R.min2d([{ chainage_m: 0, fs_min: 1.1 }, { chainage_m: 20, fs_min: 1.4 },
{ chainage_m: 40, fs_min: null }, { chainage_m: 60, fs_min: 0.9 }], 10, 50),
ratio: [R.ratio3d2d(1.68, 1.4), R.ratio3d2d(1.5, null), R.ratio3d2d(1.5, 0)],
fs2d: [R.fs2dOf({ fs_by_condition: { wet: 1.2 }, min: { wet: 1.1 } }, "wet"),
R.fs2dOf({ fs_by_condition: { dry: 1.6 }, min: { wet: 1.1 } }, "wet"),
R.fs2dOf({ fs_by_condition: { wet: null }, min: {} }, "wet"), R.fs2dOf({}, "dry")],
terrain: mesh(M.terrainMesh(c.grid, c.z)),
sphere: mesh(M.slipMesh(c.grid, c.z, c.sphere)),
ellipsoid: mesh(M.slipMesh(c.grid, c.z, c.ellipsoid)),
@@ -120,6 +123,7 @@ def test_raster_min_pixels_ratio(ts):
assert ts["pixelEmpty"] == 0 # 빈 셀 = 투명
assert ts["min2d"] == 1.4 # 10~50 m 안 = 20 m(1.4) · null 뺌
assert ts["ratio"][0] == pytest.approx(1.2) and ts["ratio"][1:] == [None, None]
assert ts["fs2d"] == [1.2, 1.1, None, None] # 지배 비탈 → 조건별 최소 → 없음
def _py_slip(best, x, y):