|
@@ -9,17 +9,17 @@ from app.services.CMSAnalyst import CMSAnalyst
|
|
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
-@router.post("/analysis/{analysisType}")
|
|
|
-async def analyze(analysisType: str, input_data:CmsAnalysisInput):
|
|
|
|
|
|
+@router.post("/analysis/{analysisType}")
|
|
|
+async def analyze(analysisType: str, input_data: CmsAnalysisInput):
|
|
|
analysis_map = {
|
|
|
- #包络谱分析
|
|
|
+ # 包络谱分析
|
|
|
"envelope": "envelope_spectrum",
|
|
|
- #频域分析
|
|
|
+ # 频域分析
|
|
|
"frequency": "frequency_domain",
|
|
|
- #时域分析
|
|
|
+ # 时域分析
|
|
|
"time": "time_domain",
|
|
|
- #趋势分析
|
|
|
+ # 趋势分析
|
|
|
"trend": "trend_analysis"
|
|
|
}
|
|
|
|
|
@@ -42,11 +42,9 @@ async def analyze(analysisType: str, input_data:CmsAnalysisInput):
|
|
|
else:
|
|
|
# 处理其他情况,例如其他数据类型
|
|
|
func_res = {'type': analysisType, 'data': str(func_res)}
|
|
|
- #对象转化为字符串形式
|
|
|
- return json.dumps(func_res,ensure_ascii=False)
|
|
|
+ # 对象转化为字符串形式
|
|
|
+ return json.dumps(func_res, ensure_ascii=False)
|
|
|
# return JSONResponse(content=func_res)#返回json格式
|
|
|
except Exception as e:
|
|
|
logger.error(f"analyze is bad {traceback.format_exc()}")
|
|
|
return {"message": "error", "detail": str(e)}
|
|
|
-
|
|
|
-
|