pitchPowerAnalyst.py 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. import os
  2. from datetime import datetime
  3. import numpy as np
  4. import pandas as pd
  5. import plotly.express as px
  6. import plotly.graph_objects as go
  7. from algorithmContract.confBusiness import *
  8. from algorithmContract.contract import Contract
  9. from behavior.analystWithGoodBadPoint import AnalystWithGoodBadPoint
  10. class PitchPowerAnalyst(AnalystWithGoodBadPoint):
  11. """
  12. 风电机组变桨-功率分析
  13. """
  14. def typeAnalyst(self):
  15. return "pitch_power"
  16. def selectColumns(self):
  17. return [Field_DeviceCode, Field_Time,Field_WindSpeed, Field_ActiverPower, Field_PitchAngel1]
  18. def turbinesAnalysis(self, outputAnalysisDir, conf: Contract, turbineCodes):
  19. dictionary = self.processTurbineData(turbineCodes, conf,self.selectColumns())
  20. dataFrame = self.userDataFrame(dictionary,conf.dataContract.configAnalysis,self)
  21. turbineInfos = self.common.getTurbineInfos(conf.dataContract.dataFilter.powerFarmID, turbineCodes,
  22. self.turbineInfo)
  23. result_df1 = self.plot_power_pitch_angle(dataFrame, turbineInfos, outputAnalysisDir, conf)
  24. result_df2 = self.drawScatterGraph(dataFrame, turbineInfos, outputAnalysisDir, conf)
  25. result_df = pd.concat([result_df1, result_df2], ignore_index=True)
  26. return result_df
  27. def plot_power_pitch_angle(self, dataFrame:pd.DataFrame, turbineModelInfo: pd.Series, outputAnalysisDir:str, conf: Contract):
  28. # 按设备名分组数据
  29. dataFrameMerge = dataFrame[(dataFrame[Field_ActiverPower] > 0)].sort_values(by=Field_YearMonth)
  30. grouped = dataFrameMerge.groupby([Field_NameOfTurbine, Field_CodeOfTurbine])
  31. # 定义固定的颜色映射列表
  32. fixed_colors = [
  33. "#3E409C",
  34. "#476CB9",
  35. "#3586BF",
  36. "#4FA4B5",
  37. "#52A3AE",
  38. "#60C5A3",
  39. "#85D0AE",
  40. "#A8DCA2",
  41. "#CFEE9E",
  42. "#E4F39E",
  43. "#EEF9A7",
  44. "#FBFFBE",
  45. "#FDF1A9",
  46. "#FFE286",
  47. "#FFC475",
  48. "#FCB06C",
  49. "#F78F4F",
  50. "#F96F4A",
  51. "#E4574C",
  52. "#CA3756",
  53. "#AF254F"
  54. ]
  55. # 将 fixed_colors 转换为 Plotly 的 colorscale 格式
  56. fixed_colorscale = [
  57. [i / (len(fixed_colors) - 1), color] for i, color in enumerate(fixed_colors)
  58. ]
  59. # 遍历每个设备并绘制散点图
  60. result_rows1 = []
  61. for name, group in grouped:
  62. # 创建图形
  63. fig = go.Figure()
  64. # 添加散点图
  65. fig.add_trace(go.Scatter(
  66. x=group[Field_ActiverPower],
  67. y=group[Field_PitchAngel1],
  68. mode='markers',
  69. # marker=dict(color='blue', size=3.5)
  70. marker=dict(
  71. color=group[Field_UnixYearMonth],
  72. colorscale=fixed_colorscale,
  73. size=3,
  74. opacity=0.7,
  75. colorbar=dict(
  76. tickvals=np.linspace(
  77. group[Field_UnixYearMonth].min(), group[Field_UnixYearMonth].max(), 6),
  78. ticktext=[datetime.fromtimestamp(ts).strftime('%Y-%m') for ts in np.linspace(
  79. group[Field_UnixYearMonth].min(), group[Field_UnixYearMonth].max(), 6)],
  80. thickness=18,
  81. len=1, # 设置颜色条的长度,使其占据整个图的高度
  82. outlinecolor='rgba(255,255,255,0)'
  83. ),
  84. showscale=True
  85. ),
  86. showlegend=False
  87. ))
  88. # 设置图形布局
  89. fig.update_layout(
  90. title=f'机组: {name[0]}',
  91. xaxis=dict(
  92. title='功率',
  93. range=[self.axisLowerLimitActivePower,
  94. self.axisUpperLimitActivePower],
  95. dtick=self.axisStepActivePower,
  96. tickangle=-45 # 设置x轴刻度值旋转角度为45度,如果需要
  97. ),
  98. yaxis=dict(
  99. title='桨距角',
  100. range=[self.axisLowerLimitPitchAngle,
  101. self.axisUpperLimitPitchAngle],
  102. dtick=self.axisStepPitchAngle
  103. ),
  104. coloraxis=dict(
  105. colorbar=dict(
  106. title="时间",
  107. ticks="outside",
  108. len=1, # 设置颜色条的长度,使其占据整个图的高度
  109. thickness=20, # 调整颜色条的宽度
  110. orientation='v', # 设置颜色条为垂直方向
  111. tickmode='array', # 确保刻度按顺序排列
  112. tickvals=dataFrameMerge[Field_YearMonth].unique(
  113. ).tolist(), # 确保刻度为唯一的年月
  114. ticktext=dataFrameMerge[Field_YearMonth].unique(
  115. ).tolist() # 以%Y-%m格式显示标签
  116. )
  117. )
  118. )
  119. # 确保从 Series 中提取的是具体的值
  120. engineTypeCode = turbineModelInfo.get(Field_MillTypeCode, "")
  121. if isinstance(engineTypeCode, pd.Series):
  122. engineTypeCode = engineTypeCode.iloc[0]
  123. engineTypeName = turbineModelInfo.get(Field_MachineTypeCode, "")
  124. if isinstance(engineTypeName, pd.Series):
  125. engineTypeName = engineTypeName.iloc[0]
  126. # 构建最终的JSON对象
  127. json_output = {
  128. "analysisTypeCode": "变桨和有功功率协调性分析",
  129. "engineCode": engineTypeCode,
  130. "engineTypeName": engineTypeName,
  131. "xaixs": "功率(kW)",
  132. "yaixs": "桨距角(°)",
  133. "data": [{
  134. "engineName": name[0],
  135. "engineCode": name[1],
  136. "title": f' 机组: {name[0]}',
  137. "xData": group[Field_ActiverPower].tolist(),
  138. "yData": group[Field_PitchAngel1].tolist(),
  139. "colorbar": dataFrameMerge[Field_YearMonth].unique().tolist(),
  140. }]
  141. }
  142. # 保存图像
  143. filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}.png")
  144. fig.write_image(filePathOfImage, width=800, height=600, scale=3)
  145. # filePathOfHtml = os.path.join(outputAnalysisDir, f"{name[0]}.html")
  146. # fig.write_html(filePathOfHtml)
  147. # 将JSON对象保存到文件
  148. output_json_path = os.path.join(outputAnalysisDir, f"pitch_Power_Analyst{name[0]}.json")
  149. with open(output_json_path, 'w', encoding='utf-8') as f:
  150. import json
  151. json.dump(json_output, f, ensure_ascii=False, indent=4)
  152. result_rows1.append({
  153. Field_Return_TypeAnalyst: self.typeAnalyst(),
  154. Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
  155. Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
  156. Field_CodeOfTurbine: name[1],
  157. Field_Return_FilePath: filePathOfImage,
  158. Field_Return_IsSaveDatabase: False
  159. })
  160. result_rows1.append({
  161. Field_Return_TypeAnalyst: self.typeAnalyst(),
  162. Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
  163. Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
  164. Field_CodeOfTurbine: name[1],
  165. Field_MillTypeCode: 'total',
  166. Field_Return_FilePath: output_json_path,
  167. Field_Return_IsSaveDatabase: True
  168. })
  169. result_df1 = pd.DataFrame(result_rows1)
  170. return result_df1
  171. def drawScatterGraph(self, dataFrame: pd.DataFrame, turbineModelInfo: pd.Series, outputAnalysisDir: str, conf: Contract):
  172. dataFrame = dataFrame[(dataFrame[Field_ActiverPower] > 0)].sort_values(
  173. by=Field_YearMonth)
  174. grouped = dataFrame.groupby([Field_NameOfTurbine, Field_CodeOfTurbine])
  175. '''
  176. # 遍历每个设备的数据
  177. result_rows2 = []
  178. for name, group in grouped:
  179. if len(group[Field_YearMonth].unique()) > 1:
  180. fig = px.scatter_3d(dataFrame,
  181. x=Field_PitchAngel1,
  182. y=Field_YearMonth,
  183. z=Field_ActiverPower,
  184. color=Field_YearMonth,
  185. labels={Field_PitchAngel1: '桨距角',
  186. Field_YearMonth: '时间', Field_ActiverPower: '功率'},
  187. )
  188. # 设置固定散点大小
  189. fig.update_traces(marker=dict(size=1.5))
  190. # 更新图形的布局
  191. fig.update_layout(
  192. title={
  193. "text": f'月度桨距角功率3D散点图: {name[0]}',
  194. "x": 0.5
  195. },
  196. scene=dict(
  197. xaxis=dict(
  198. title='桨距角',
  199. dtick=self.axisStepPitchAngle,
  200. range=[self.axisLowerLimitPitchAngle,
  201. self.axisUpperLimitPitchAngle],
  202. ),
  203. yaxis=dict(
  204. title='时间',
  205. tickformat='%Y-%m', # 日期格式,
  206. dtick='M1', # 每月一个刻度
  207. showgrid=True, # 显示网格线
  208. ),
  209. zaxis=dict(
  210. title='功率',
  211. dtick=self.axisStepActivePower,
  212. range=[self.axisLowerLimitActivePower,
  213. self.axisUpperLimitActivePower],
  214. showgrid=True, # 显示网格线
  215. )
  216. ),
  217. scene_camera=dict(
  218. up=dict(x=0, y=0, z=1), # 保持相机向上方向不变
  219. center=dict(x=0, y=0, z=0), # 保持相机中心位置不变
  220. eye=dict(x=-1.8, y=-1.8, z=1.2) # 调整eye属性以实现水平旋转180°
  221. ),
  222. # 设置图例标题
  223. # legend_title_text='Time',
  224. legend=dict(
  225. orientation="h",
  226. itemsizing="constant", # Use constant size for legend items
  227. itemwidth=80 # Set the width of legend items to 50 pixels
  228. )
  229. )
  230. '''
  231. # 假设 colorsList 已经在代码的其他部分定义
  232. colorsList = [
  233. "#3E409C",
  234. "#3586BF",
  235. "#52A3AE",
  236. "#85D0AE",
  237. "#A8DCA2",
  238. "#FBFFBE",
  239. "#FDF1A9",
  240. "#FFE286",
  241. "#FCB06C",
  242. "#F96F4A",
  243. "#E4574C",
  244. "#AF254F"
  245. ]
  246. # 遍历每个设备的数据
  247. result_rows2 = []
  248. for name, group in grouped:
  249. if len(group[Field_YearMonth].unique()) > 1:
  250. fig = px.scatter_3d(
  251. group,
  252. x=Field_PitchAngel1,
  253. y=Field_YearMonth,
  254. z=Field_ActiverPower,
  255. color=Field_YearMonth,
  256. color_discrete_sequence=colorsList, # 使用 colorsList 作为颜色映射
  257. labels={
  258. Field_PitchAngel1: '桨距角',
  259. Field_YearMonth: '时间',
  260. Field_ActiverPower: '功率'
  261. },
  262. )
  263. # 设置固定散点大小
  264. fig.update_traces(marker=dict(size=1.5))
  265. # 更新图形的布局
  266. fig.update_layout(
  267. title={
  268. "text": f'月度桨距角功率3D散点图: {name[0]}',
  269. "x": 0.5
  270. },
  271. scene=dict(
  272. xaxis=dict(
  273. title='桨距角',
  274. dtick=self.axisStepPitchAngle,
  275. range=[self.axisLowerLimitPitchAngle, self.axisUpperLimitPitchAngle],
  276. ),
  277. yaxis=dict(
  278. title='时间',
  279. tickformat='%Y-%m', # 日期格式,
  280. dtick='M1', # 每月一个刻度
  281. showgrid=True, # 显示网格线
  282. ),
  283. zaxis=dict(
  284. title='功率',
  285. dtick=self.axisStepActivePower,
  286. range=[self.axisLowerLimitActivePower, self.axisUpperLimitActivePower],
  287. showgrid=True, # 显示网格线
  288. )
  289. ),
  290. scene_camera=dict(
  291. up=dict(x=0, y=0, z=1), # 保持相机向上方向不变
  292. center=dict(x=0, y=0, z=0), # 保持相机中心位置不变
  293. eye=dict(x=-1.8, y=-1.8, z=1.2) # 调整eye属性以实现水平旋转180°
  294. ),
  295. legend=dict(
  296. orientation="h",
  297. itemsizing="constant", # Use constant size for legend items
  298. itemwidth=80 # Set the width of legend items to 50 pixels
  299. )
  300. )
  301. # 确保从 Series 中提取的是具体的值
  302. engineTypeCode = turbineModelInfo.get(Field_MillTypeCode, "")
  303. if isinstance(engineTypeCode, pd.Series):
  304. engineTypeCode = engineTypeCode.iloc[0]
  305. engineTypeName = turbineModelInfo.get(Field_MachineTypeCode, "")
  306. if isinstance(engineTypeName, pd.Series):
  307. engineTypeName = engineTypeName.iloc[0]
  308. # 构建最终的JSON对象
  309. json_output = {
  310. "analysisTypeCode": "变桨和有功功率协调性分析",
  311. "engineCode": engineTypeCode,
  312. "engineTypeName": engineTypeName,
  313. "xaixs": "桨距角(°)",
  314. "yaixs": "时间",
  315. "zaixs": "有功功率(kW)",
  316. "data": [{
  317. "engineName": name[0],
  318. "engineCode": name[1],
  319. "title": f' 月度桨距角功率3D散点图: {name[0]}',
  320. "xData": group[Field_PitchAngel1].tolist(),
  321. "yData": group[Field_YearMonth].tolist(),
  322. "zData": group[Field_ActiverPower].tolist(),
  323. }]
  324. }
  325. # 保存图像
  326. filePathOfImage = os.path.join(outputAnalysisDir, f"{name[0]}_3D.png")
  327. fig.write_image(filePathOfImage, width=800, height=600, scale=3)
  328. # filePathOfHtml = os.path.join(outputAnalysisDir, f"{name[0]}_3D.html")
  329. # fig.write_html(filePathOfHtml)
  330. # 将JSON对象保存到文件
  331. output_json_path = os.path.join(outputAnalysisDir, f"pitch_Power_Analyst{name[0]}_3D.json")
  332. with open(output_json_path, 'w', encoding='utf-8') as f:
  333. import json
  334. json.dump(json_output, f, ensure_ascii=False, indent=4)
  335. result_rows2.append({
  336. Field_Return_TypeAnalyst: self.typeAnalyst(),
  337. Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
  338. Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
  339. Field_CodeOfTurbine: name[1],
  340. Field_Return_FilePath: filePathOfImage,
  341. Field_Return_IsSaveDatabase: False
  342. })
  343. result_rows2.append({
  344. Field_Return_TypeAnalyst: self.typeAnalyst(),
  345. Field_PowerFarmCode: conf.dataContract.dataFilter.powerFarmID,
  346. Field_Return_BatchCode: conf.dataContract.dataFilter.dataBatchNum,
  347. Field_CodeOfTurbine: name[1],
  348. Field_MillTypeCode: 'total',
  349. Field_Return_FilePath: output_json_path,
  350. Field_Return_IsSaveDatabase: True
  351. })
  352. result_df2 = pd.DataFrame(result_rows2)
  353. return result_df2
  354. # self.drawScatterGraphOfTurbine(
  355. # group, outputAnalysisDir, conf, name)
  356. # def drawScatterGraphOfTurbine(self, dataFrame: pd.DataFrame, outputAnalysisDir: str, conf: Contract, turbineName: str):
  357. # # 创建3D散点图
  358. # fig = px.scatter_3d(dataFrame,
  359. # x=Field_PitchAngel1,
  360. # y=Field_YearMonth,
  361. # z=Field_ActiverPower,
  362. # color=Field_YearMonth,
  363. # labels={Field_PitchAngel1: 'Pitch Angle',
  364. # Field_YearMonth: 'Time', Field_ActiverPower: 'Power'},
  365. # )
  366. # # 设置固定散点大小
  367. # fig.update_traces(marker=dict(size=1.5))
  368. # # 更新图形的布局
  369. # fig.update_layout(
  370. # title={
  371. # "text": f'Monthly Pitch-Power 3D Scatter Plot: {turbineName}',
  372. # "x": 0.5
  373. # },
  374. # scene=dict(
  375. # xaxis=dict(
  376. # title='Pitch Angle',
  377. # range=[conf.dataContract.graphSets["pitchAngle"]["min"] if not self.common.isNone(conf.dataContract.graphSets["pitchAngle"]["min"]) else -2,
  378. # conf.dataContract.graphSets["pitchAngle"]["max"] if not self.common.isNone(conf.dataContract.graphSets["pitchAngle"]["max"]) else 28],
  379. # dtick=conf.dataContract.graphSets["pitchAngle"]["step"] if not self.common.isNone(conf.dataContract.graphSets["pitchAngle"]["step"]) else 2,
  380. # ),
  381. # yaxis=dict(
  382. # title='Time',
  383. # tickformat='%Y-%m', # 日期格式,
  384. # dtick='M1', # 每月一个刻度
  385. # showgrid=True, # 显示网格线
  386. # ),
  387. # zaxis=dict(
  388. # title='Power',
  389. # dtick=conf.dataContract.graphSets["activePower"]["step"] if not self.common.isNone(
  390. # conf.dataContract.graphSets["activePower"]) and not self.common.isNone(
  391. # conf.dataContract.graphSets["activePower"]["step"]) else 250,
  392. # range=[conf.dataContract.graphSets["activePower"]["min"] if not self.common.isNone(
  393. # conf.dataContract.graphSets["activePower"]["min"]) else 0, conf.dataContract.graphSets["activePower"]["max"] if not self.common.isNone(conf.dataContract.graphSets["activePower"]["max"]) else conf.rated_power*1.2],
  394. # showgrid=True, # 显示网格线
  395. # )
  396. # ),
  397. # scene_camera=dict(
  398. # up=dict(x=0, y=0, z=1), # 保持相机向上方向不变
  399. # center=dict(x=0, y=0, z=0), # 保持相机中心位置不变
  400. # eye=dict(x=-1.8, y=-1.8, z=1.2) # 调整eye属性以实现水平旋转180°
  401. # ),
  402. # # 设置图例标题
  403. # legend_title_text='Time'
  404. # )
  405. # # 保存图像
  406. # outputFileHtml = os.path.join(
  407. # outputAnalysisDir, "{}_3D.html".format(turbineName))
  408. # fig.write_html(outputFileHtml)
  409. """"
  410. def drawScatterGraph(self, dataFrame: pd.DataFrame, outputAnalysisDir, conf: Contract):
  411. ## 绘制变桨-功率分布图并保存为文件。
  412. ## 参数:
  413. ## dataFrameMerge (pd.DataFrame): 包含数据的DataFrame,需要包含设备名、风速和功率列。
  414. ## outputAnalysisDir (str): 分析输出目录。
  415. ## conf (ConfBusiness): 配置
  416. ## 按设备名分组数据
  417. colorsList = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd',
  418. '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf', '#aec7e8', '#ffbb78']
  419. grouped = dataFrame.groupby(Field_NameOfTurbine)
  420. # 遍历每个设备的数据
  421. for name, group in grouped:
  422. # 创建颜色映射,将每个年月映射到一个唯一的颜色
  423. unique_months = group[Field_YearMonth].unique()
  424. colors = [
  425. colorsList[i % 12] for i in range(len(unique_months))]
  426. color_map = dict(zip(unique_months, colors))
  427. # 使用go.Scatter3d创建3D散点图
  428. trace = go.Scatter3d(
  429. x=group[Field_PitchAngel1],
  430. y=group[Field_YearMonth],
  431. z=group[Field_ActiverPower],
  432. mode='markers',
  433. marker=dict(
  434. color=[color_map[month]
  435. for month in group[Field_YearMonth]],
  436. size=1.5,
  437. line=dict(
  438. color='rgba(0, 0, 0, 0)', # 设置边框颜色为透明,以去掉白色边框
  439. width=0 # 设置边框宽度为0,进一步确保没有边框
  440. ),
  441. opacity=0.8 # 调整散点的透明度,增加透视效果
  442. )
  443. )
  444. # 创建图形
  445. fig = go.Figure(data=[trace])
  446. # 更新图形的布局
  447. fig.update_layout(
  448. title={
  449. "text": f'三维散点图{name}',
  450. "x": 0.5
  451. },
  452. scene=dict(
  453. xaxis=dict(
  454. title='桨距角',
  455. dtick=conf.dataContract.graphSets["pitchAngle"]["step"] if not self.common.isNone(
  456. conf.dataContract.graphSets["pitchAngle"]["step"]) else 2, # 设置y轴刻度间隔为0.1
  457. range=[conf.dataContract.graphSets["pitchAngle"]["min"] if not self.common.isNone(
  458. conf.dataContract.graphSets["pitchAngle"]["min"]) else -2, conf.dataContract.graphSets["pitchAngle"]["max"] if not self.common.isNone(conf.dataContract.graphSets["pitchAngle"]["max"]) else 28], # 设置y轴的范围从0到1
  459. showgrid=True, # 显示网格线
  460. ),
  461. yaxis=dict(
  462. title='时间',
  463. tickmode='array',
  464. tickvals=unique_months,
  465. ticktext=unique_months,
  466. showgrid=True, # 显示网格线
  467. categoryorder='category ascending'
  468. ),
  469. zaxis=dict(
  470. title='功率',
  471. dtick=conf.dataContract.graphSets["activePower"]["step"] if not self.common.isNone(
  472. conf.dataContract.graphSets["activePower"]) and not self.common.isNone(
  473. conf.dataContract.graphSets["activePower"]["step"]) else 250,
  474. range=[conf.dataContract.graphSets["activePower"]["min"] if not self.common.isNone(
  475. conf.dataContract.graphSets["activePower"]["min"]) else 0, conf.dataContract.graphSets["activePower"]["max"] if not self.common.isNone(conf.dataContract.graphSets["activePower"]["max"]) else conf.rated_power*1.2],
  476. )
  477. ),
  478. scene_camera=dict(
  479. up=dict(x=0, y=0, z=1), # 保持相机向上方向不变
  480. center=dict(x=0, y=0, z=0), # 保持相机中心位置不变
  481. eye=dict(x=-1.8, y=-1.8, z=1.2) # 调整eye属性以实现水平旋转180°
  482. ),
  483. margin=dict(t=50, b=10) # t为顶部(top)间距,b为底部(bottom)间距
  484. )
  485. # 保存图像
  486. outputFileHtml = os.path.join(
  487. outputAnalysisDir, "{}.html".format(name))
  488. fig.write_html(outputFileHtml)
  489. """