feat: v3.5 - Multi-language acoustic algorithm scheduler

- Core: Python/C++/MATLAB tri-protocol bridge architecture
- Validation: 5-type real-time field, type, dimension, completeness, and compatibility checking
- UI: Premium Deep Sea theme with visual pipeline preview
- Modules: Sea Trial Exclusive + Exception Hub + Algorithm Management
- Tests: Full coverage with 5 automated test cases
这个提交包含在:
2026-01-21 07:41:12 +08:00
当前提交 11a2d4a4b9
共修改 25 个文件,包含 2528 行新增和 0 行删除
+86
查看文件
@@ -0,0 +1,86 @@
from __future__ import annotations
import importlib.util
import os
import platform
import shutil
import sys
from typing import Any, Dict, List
def _has_module(module_name: str) -> bool:
"""安全检测 Python 模块是否可用"""
try:
return importlib.util.find_spec(module_name) is not None
except ModuleNotFoundError:
return False
def _get_lib_suffix() -> str:
"""获取当前平台的动态库后缀"""
system = platform.system().lower()
if system == "windows":
return ".dll"
elif system == "darwin":
return ".dylib"
return ".so"
def _check_ld_paths() -> List[str]:
"""检测动态库搜索路径"""
paths = []
for var in ["LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH", "PATH"]:
val = os.environ.get(var)
if val:
paths.extend([p for p in val.split(os.pathsep) if p])
return paths[:10] # 限制输出长度
def collect_env_info() -> Dict[str, Any]:
"""收集完整的环境信息"""
compilers = {
"gcc": shutil.which("gcc"),
"g++": shutil.which("g++"),
"clang": shutil.which("clang"),
"clang++": shutil.which("clang++"),
"cl": shutil.which("cl"), # MSVC
}
return {
"python": {
"version": sys.version.split()[0],
"executable": sys.executable,
},
"platform": {
"os": platform.system(),
"release": platform.release(),
"machine": platform.machine(),
"lib_suffix": _get_lib_suffix(),
},
"matlab": {
"engine_available": _has_module("matlab.engine") or _has_module("matlab"),
"oct2py_available": _has_module("oct2py"),
"octave_cli": shutil.which("octave") or shutil.which("octave-cli"),
},
"cpp": {
"compilers": {k: v for k, v in compilers.items() if v},
"any_available": any(compilers.values()),
},
"ld_paths": _check_ld_paths(),
"scipy_available": _has_module("scipy"),
"numpy_available": _has_module("numpy"),
}
def get_available_algo_types() -> List[str]:
"""根据环境返回可用的算法类型列表"""
env = collect_env_info()
types = ["python"] # Python 始终可用
if env["matlab"]["engine_available"] or env["matlab"]["oct2py_available"] or env["matlab"]["octave_cli"]:
types.append("matlab")
if env["cpp"]["any_available"]:
types.append("cpp")
return types