pyfemtet 0.9.5__py3-none-any.whl → 1.0.0b0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyfemtet might be problematic. Click here for more details.

Files changed (272) hide show
  1. pyfemtet/__init__.py +6 -1
  2. pyfemtet/_i18n/1. make_pot_and_update_po.bat +8 -0
  3. pyfemtet/_i18n/2. build_mo.bat +5 -0
  4. pyfemtet/_i18n/__init__.py +4 -0
  5. pyfemtet/_i18n/babel.cfg +2 -0
  6. pyfemtet/_i18n/i18n.py +37 -0
  7. pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.mo +0 -0
  8. pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.po +1020 -0
  9. pyfemtet/_i18n/locales/messages.pot +987 -0
  10. pyfemtet/{_message → _i18n}/messages.py +128 -41
  11. pyfemtet/_util/closing.py +19 -0
  12. pyfemtet/_util/dask_util.py +89 -7
  13. pyfemtet/_util/df_util.py +29 -0
  14. pyfemtet/_util/excel_macro_util.py +8 -3
  15. pyfemtet/_util/excel_parse_util.py +43 -23
  16. pyfemtet/_util/femtet_access_inspection.py +120 -0
  17. pyfemtet/{_femtet_config_util/autosave.py → _util/femtet_autosave.py} +7 -0
  18. pyfemtet/_util/femtet_exit.py +105 -0
  19. pyfemtet/_util/femtet_version.py +20 -0
  20. pyfemtet/_util/helper.py +94 -0
  21. pyfemtet/_util/process_util.py +107 -0
  22. pyfemtet/_util/str_enum.py +44 -0
  23. pyfemtet/core.py +15 -47
  24. pyfemtet/dispatch_extensions/__init__.py +8 -11
  25. pyfemtet/dispatch_extensions/_impl.py +42 -198
  26. pyfemtet/logger/__init__.py +8 -1
  27. pyfemtet/logger/_impl.py +5 -6
  28. pyfemtet/opt/__init__.py +3 -17
  29. pyfemtet/opt/exceptions.py +45 -0
  30. pyfemtet/opt/femopt.py +608 -0
  31. pyfemtet/opt/history/__init__.py +11 -0
  32. pyfemtet/opt/history/_history.py +1404 -0
  33. pyfemtet/opt/history/_hypervolume.py +169 -0
  34. pyfemtet/opt/history/_optimality.py +79 -0
  35. pyfemtet/opt/interface/__init__.py +17 -24
  36. pyfemtet/opt/interface/_base_interface.py +222 -0
  37. pyfemtet/opt/interface/_excel_interface/__init__.py +3 -0
  38. pyfemtet/opt/interface/_excel_interface/debug-excel-interface.xlsm +0 -0
  39. pyfemtet/opt/interface/_excel_interface/excel_interface.py +999 -0
  40. pyfemtet/opt/interface/_femtet_interface/__init__.py +3 -0
  41. pyfemtet/opt/interface/{_femtet_parametric.py → _femtet_interface/_femtet_parametric.py} +20 -12
  42. pyfemtet/opt/interface/{_femtet.py → _femtet_interface/femtet_interface.py} +505 -349
  43. pyfemtet/opt/interface/_femtet_with_nx_interface/__init__.py +5 -0
  44. pyfemtet/opt/interface/_femtet_with_nx_interface/femtet_with_nx_interface.py +230 -0
  45. pyfemtet/opt/interface/_femtet_with_nx_interface/model1.prt +0 -0
  46. pyfemtet/opt/interface/_femtet_with_nx_interface/model1.x_t +98 -0
  47. pyfemtet/opt/interface/{_femtet_with_nx → _femtet_with_nx_interface}/update_model.py +1 -3
  48. pyfemtet/opt/interface/_femtet_with_solidworks/__init__.py +5 -0
  49. pyfemtet/opt/interface/_femtet_with_solidworks/femtet_with_solidworks_interface.py +122 -0
  50. pyfemtet/opt/interface/_solidworks_interface/__init__.py +5 -0
  51. pyfemtet/opt/interface/_solidworks_interface/solidworks_interface.py +206 -0
  52. pyfemtet/opt/interface/_surrogate_model_interface/__init__.py +8 -0
  53. pyfemtet/opt/interface/_surrogate_model_interface/base_surrogate_interface.py +150 -0
  54. pyfemtet/opt/interface/_surrogate_model_interface/botorch_interface.py +298 -0
  55. pyfemtet/opt/interface/_surrogate_model_interface/debug-pof-botorch.reccsv +18 -0
  56. pyfemtet/opt/interface/_with_excel_settings/__init__.py +61 -0
  57. pyfemtet/opt/interface/_with_excel_settings/with_excel_settings.py +134 -0
  58. pyfemtet/opt/meta_script/YAML_Generator.xlsm +0 -0
  59. pyfemtet/opt/meta_script/__main__.py +58 -36
  60. pyfemtet/opt/optimizer/__init__.py +7 -9
  61. pyfemtet/opt/optimizer/_base_optimizer.py +885 -0
  62. pyfemtet/opt/optimizer/optuna_optimizer/__init__.py +9 -0
  63. pyfemtet/opt/optimizer/optuna_optimizer/_optuna_attribute.py +73 -0
  64. pyfemtet/opt/optimizer/optuna_optimizer/_optuna_optimizer.py +678 -0
  65. pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/__init__.py +7 -0
  66. pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/debug-pof-botorch.reccsv +18 -0
  67. pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/enable_nonlinear_constraint.py +244 -0
  68. pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/pof_botorch_sampler.py +1249 -0
  69. pyfemtet/opt/optimizer/optuna_optimizer/wat_ex14_parametric_jp.femprj +0 -0
  70. pyfemtet/opt/optimizer/scipy_optimizer/__init__.py +1 -0
  71. pyfemtet/opt/optimizer/scipy_optimizer/_scipy_optimizer.py +364 -0
  72. pyfemtet/opt/prediction/__init__.py +7 -0
  73. pyfemtet/opt/prediction/_botorch_utils.py +133 -0
  74. pyfemtet/opt/prediction/_gpytorch_modules_extension.py +142 -0
  75. pyfemtet/opt/prediction/_helper.py +155 -0
  76. pyfemtet/opt/prediction/_model.py +118 -0
  77. pyfemtet/opt/problem/problem.py +304 -0
  78. pyfemtet/opt/problem/variable_manager/__init__.py +20 -0
  79. pyfemtet/opt/problem/variable_manager/_string_as_expression.py +115 -0
  80. pyfemtet/opt/problem/variable_manager/_variable_manager.py +295 -0
  81. pyfemtet/opt/visualization/history_viewer/__main__.py +5 -0
  82. pyfemtet/opt/visualization/{_base.py → history_viewer/_base_application.py} +18 -13
  83. pyfemtet/opt/visualization/history_viewer/_common_pages.py +150 -0
  84. pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/alert_region.py +10 -5
  85. pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/control_femtet.py +16 -13
  86. pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/main_graph.py +117 -47
  87. pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/pm_graph.py +159 -138
  88. pyfemtet/opt/visualization/history_viewer/_process_monitor/_application.py +173 -0
  89. pyfemtet/opt/visualization/history_viewer/_process_monitor/_pages.py +291 -0
  90. pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/dbc.py +1 -1
  91. pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/dcc.py +1 -1
  92. pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/html.py +1 -1
  93. pyfemtet/opt/visualization/history_viewer/result_viewer/__main__.py +5 -0
  94. pyfemtet/opt/visualization/{result_viewer/application.py → history_viewer/result_viewer/_application.py} +6 -6
  95. pyfemtet/opt/visualization/{result_viewer/pages.py → history_viewer/result_viewer/_pages.py} +106 -82
  96. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.csv +18 -0
  97. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.db +0 -0
  98. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.jpg +0 -0
  99. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.log +45 -0
  100. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.pdt +0 -0
  101. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.jpg +0 -0
  102. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.pdt +0 -0
  103. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.jpg +0 -0
  104. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.pdt +0 -0
  105. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.jpg +0 -0
  106. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.pdt +0 -0
  107. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.jpg +0 -0
  108. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.pdt +0 -0
  109. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.jpg +0 -0
  110. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.pdt +0 -0
  111. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.jpg +0 -0
  112. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.pdt +0 -0
  113. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.jpg +0 -0
  114. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.pdt +0 -0
  115. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.jpg +0 -0
  116. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.pdt +0 -0
  117. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.jpg +0 -0
  118. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.pdt +0 -0
  119. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.jpg +0 -0
  120. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.pdt +0 -0
  121. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.jpg +0 -0
  122. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.pdt +0 -0
  123. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.jpg +0 -0
  124. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.pdt +0 -0
  125. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.jpg +0 -0
  126. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.pdt +0 -0
  127. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.jpg +0 -0
  128. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.pdt +0 -0
  129. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bgr +0 -0
  130. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bnd +0 -0
  131. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.btr +0 -0
  132. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.jpg +0 -0
  133. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.mtl +0 -0
  134. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.pdt +0 -0
  135. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.prm +0 -0
  136. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.jpg +0 -0
  137. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.pdt +0 -0
  138. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.jpg +0 -0
  139. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.pdt +0 -0
  140. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.jpg +0 -0
  141. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.pdt +0 -0
  142. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.jpg +0 -0
  143. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.pdt +0 -0
  144. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.jpg +0 -0
  145. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.pdt +0 -0
  146. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.femprj +0 -0
  147. pyfemtet/opt/visualization/plotter/main_figure_creator.py +536 -0
  148. pyfemtet/opt/visualization/plotter/pm_graph_creator.py +359 -0
  149. pyfemtet/opt/worker_status.py +120 -0
  150. {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/METADATA +23 -24
  151. pyfemtet-1.0.0b0.dist-info/RECORD +172 -0
  152. pyfemtet-1.0.0b0.dist-info/entry_points.txt +3 -0
  153. pyfemtet/_femtet_config_util/exit.py +0 -59
  154. pyfemtet/_message/1. make_pot.bat +0 -11
  155. pyfemtet/_message/2. make_mo.bat +0 -6
  156. pyfemtet/_message/__init__.py +0 -5
  157. pyfemtet/_message/babel.cfg +0 -2
  158. pyfemtet/_message/locales/ja/LC_MESSAGES/messages.mo +0 -0
  159. pyfemtet/_message/locales/ja/LC_MESSAGES/messages.po +0 -570
  160. pyfemtet/_message/locales/messages.pot +0 -551
  161. pyfemtet/_warning.py +0 -87
  162. pyfemtet/brep/_impl.py +0 -18
  163. pyfemtet/opt/_femopt.py +0 -1007
  164. pyfemtet/opt/_femopt_core.py +0 -1169
  165. pyfemtet/opt/_test_utils/control_femtet.py +0 -39
  166. pyfemtet/opt/_test_utils/hyper_sphere.py +0 -24
  167. pyfemtet/opt/_test_utils/record_history.py +0 -130
  168. pyfemtet/opt/advanced_samples/excel_ui/(ref) original_project.femprj +0 -0
  169. pyfemtet/opt/advanced_samples/excel_ui/femtet-macro.xlsm +0 -0
  170. pyfemtet/opt/advanced_samples/excel_ui/pyfemtet-core.py +0 -291
  171. pyfemtet/opt/advanced_samples/excel_ui/test-pyfemtet-core.cmd +0 -22
  172. pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric.femprj +0 -0
  173. pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart.py +0 -99
  174. pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart_jp.py +0 -102
  175. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data.py +0 -60
  176. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data_jp.py +0 -57
  177. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate.py +0 -100
  178. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate_jp.py +0 -90
  179. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_parametric.femprj +0 -0
  180. pyfemtet/opt/interface/_base.py +0 -101
  181. pyfemtet/opt/interface/_excel_interface.py +0 -984
  182. pyfemtet/opt/interface/_femtet_excel.py +0 -141
  183. pyfemtet/opt/interface/_femtet_with_nx/__init__.py +0 -3
  184. pyfemtet/opt/interface/_femtet_with_nx/_interface.py +0 -178
  185. pyfemtet/opt/interface/_femtet_with_sldworks.py +0 -298
  186. pyfemtet/opt/interface/_surrogate/__init__.py +0 -5
  187. pyfemtet/opt/interface/_surrogate/_base.py +0 -129
  188. pyfemtet/opt/interface/_surrogate/_chaospy.py +0 -71
  189. pyfemtet/opt/interface/_surrogate/_singletaskgp.py +0 -71
  190. pyfemtet/opt/interface/_surrogate_excel.py +0 -102
  191. pyfemtet/opt/optimizer/_base.py +0 -376
  192. pyfemtet/opt/optimizer/_optuna/_botorch_patch/enable_nonlinear_constraint.py +0 -220
  193. pyfemtet/opt/optimizer/_optuna/_optuna.py +0 -434
  194. pyfemtet/opt/optimizer/_optuna/_pof_botorch.py +0 -1914
  195. pyfemtet/opt/optimizer/_scipy.py +0 -159
  196. pyfemtet/opt/optimizer/_scipy_scalar.py +0 -127
  197. pyfemtet/opt/optimizer/parameter.py +0 -113
  198. pyfemtet/opt/prediction/_base.py +0 -61
  199. pyfemtet/opt/prediction/single_task_gp.py +0 -119
  200. pyfemtet/opt/samples/femprj_sample/ParametricIF.femprj +0 -0
  201. pyfemtet/opt/samples/femprj_sample/ParametricIF.py +0 -29
  202. pyfemtet/opt/samples/femprj_sample/ParametricIF_test_result.reccsv +0 -13
  203. pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.femprj +0 -0
  204. pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.prt +0 -0
  205. pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.py +0 -135
  206. pyfemtet/opt/samples/femprj_sample/cad_ex01_NX_test_result.reccsv +0 -23
  207. pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.SLDPRT +0 -0
  208. pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.femprj +0 -0
  209. pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.py +0 -131
  210. pyfemtet/opt/samples/femprj_sample/cad_ex01_SW_test_result.reccsv +0 -23
  211. pyfemtet/opt/samples/femprj_sample/constrained_pipe.femprj +0 -0
  212. pyfemtet/opt/samples/femprj_sample/constrained_pipe.py +0 -96
  213. pyfemtet/opt/samples/femprj_sample/constrained_pipe_test_result.reccsv +0 -13
  214. pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.femprj +0 -0
  215. pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.py +0 -74
  216. pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric_test_result.reccsv +0 -13
  217. pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.femprj +0 -0
  218. pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.py +0 -58
  219. pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric_test_result.reccsv +0 -23
  220. pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.femprj +0 -0
  221. pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.py +0 -52
  222. pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.femprj +0 -0
  223. pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.py +0 -138
  224. pyfemtet/opt/samples/femprj_sample/her_ex40_parametric_test_result.reccsv +0 -18
  225. pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.femprj +0 -0
  226. pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.py +0 -60
  227. pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_parallel.py +0 -61
  228. pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_test_result.reccsv +0 -18
  229. pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.femprj +0 -0
  230. pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.py +0 -58
  231. pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_parallel.py +0 -58
  232. pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_test_result.reccsv +0 -18
  233. pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.femprj +0 -0
  234. pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.py +0 -29
  235. pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.femprj +0 -0
  236. pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.py +0 -129
  237. pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.femprj +0 -0
  238. pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.py +0 -125
  239. pyfemtet/opt/samples/femprj_sample_jp/constrained_pipe_jp.py +0 -93
  240. pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.femprj +0 -0
  241. pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.py +0 -70
  242. pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.femprj +0 -0
  243. pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.py +0 -57
  244. pyfemtet/opt/samples/femprj_sample_jp/gau_ex12_parametric_jp.py +0 -52
  245. pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.femprj +0 -0
  246. pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.py +0 -138
  247. pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.femprj +0 -0
  248. pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.py +0 -58
  249. pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_parallel_jp.py +0 -59
  250. pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_jp.py +0 -56
  251. pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_parallel_jp.py +0 -56
  252. pyfemtet/opt/visualization/_complex_components/main_figure_creator.py +0 -332
  253. pyfemtet/opt/visualization/_complex_components/pm_graph_creator.py +0 -201
  254. pyfemtet/opt/visualization/_process_monitor/application.py +0 -226
  255. pyfemtet/opt/visualization/_process_monitor/pages.py +0 -406
  256. pyfemtet/opt/visualization/_wrapped_components/__init__.py +0 -0
  257. pyfemtet/opt/visualization/result_viewer/__init__.py +0 -0
  258. pyfemtet-0.9.5.dist-info/RECORD +0 -158
  259. pyfemtet-0.9.5.dist-info/entry_points.txt +0 -3
  260. /pyfemtet/{_femtet_config_util → opt/problem}/__init__.py +0 -0
  261. /pyfemtet/{brep → opt/visualization/history_viewer}/__init__.py +0 -0
  262. /pyfemtet/opt/{_test_utils → visualization/history_viewer/_complex_components}/__init__.py +0 -0
  263. /pyfemtet/opt/{optimizer/_optuna → visualization/history_viewer/_process_monitor}/__init__.py +0 -0
  264. /pyfemtet/opt/{optimizer/_optuna/_botorch_patch → visualization/history_viewer/_wrapped_components}/__init__.py +0 -0
  265. /pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/str_enum.py +0 -0
  266. /pyfemtet/opt/visualization/{result_viewer → history_viewer/result_viewer}/.gitignore +0 -0
  267. /pyfemtet/opt/visualization/{_complex_components → history_viewer/result_viewer}/__init__.py +0 -0
  268. /pyfemtet/opt/visualization/{_process_monitor → plotter}/__init__.py +0 -0
  269. /pyfemtet/opt/{samples/femprj_sample_jp/wat_ex14_parametric_jp.femprj → wat_ex14_parametric_jp.femprj} +0 -0
  270. {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/LICENSE +0 -0
  271. {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/LICENSE_THIRD_PARTY.txt +0 -0
  272. {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,115 @@
1
+ from numbers import Number
2
+
3
+ from sympy import sympify
4
+ from sympy.core.sympify import SympifyError
5
+ from sympy import Min, Max, Add, Symbol, Expr, Basic # TODO: Add sqrt, pow
6
+
7
+ __all__ = [
8
+ '_ExpressionFromString', 'InvalidExpression', 'SympifyError'
9
+ ]
10
+
11
+
12
+ class InvalidExpression(Exception):
13
+ pass
14
+
15
+
16
+ def get_valid_functions(values_may_be_used_in_mean: dict[str, Number] = None):
17
+ v = values_may_be_used_in_mean or {}
18
+ return {
19
+ 'mean': lambda *args: Add(*args).subs(v) / len(args),
20
+ 'max': Max,
21
+ 'min': Min,
22
+ 'S': Symbol('S')
23
+ }
24
+
25
+
26
+ class _ExpressionFromString:
27
+ _expr_str: str
28
+ _sympy_expr: Expr
29
+
30
+ def __init__(self, expression_string: str | Number = None, sympy_expr: Expr = None):
31
+ """
32
+ Raises:
33
+ SympifyError: Sympy が認識できない場合
34
+ InvalidExpression: Sympy は認識できるが PyFemtet で想定する型ではない場合(tuple など)
35
+
36
+ Examples:
37
+ e = Expression('1')
38
+ e.expr # '1'
39
+ e.value # 1.0
40
+
41
+ e = Expression(1)
42
+ e.expr # '1'
43
+ e.value # 1.0
44
+
45
+ e = Expression('a')
46
+ e.expr # 'a'
47
+ e.value # ValueError
48
+
49
+ e = Expression('1/2')
50
+ e.expr # '1/2'
51
+ e.value # 0.5
52
+
53
+ e = Expression('1.0000')
54
+ e.expr # '1.0'
55
+ e.value # 1.0
56
+
57
+ """
58
+
59
+ # check
60
+ assert not (expression_string is None and sympy_expr is None)
61
+
62
+ if sympy_expr is not None:
63
+ assert expression_string is None
64
+ self._sympy_expr = sympy_expr
65
+ self._expr_str = str(sympy_expr)
66
+
67
+ else:
68
+ assert expression_string is not None
69
+ self._expr_str: str = str(expression_string)
70
+
71
+ # max(name1, name2) など関数を入れる際に問題になるので
72
+ # 下記の仕様は廃止、使い方として数値桁区切り , を入れてはいけない
73
+ # # sympify 時に tuple 扱いになるので , を置き換える
74
+ # # 日本人が数値に , を使うとき Python では _ を意味する
75
+ # # expression に _ が入っていても構わない
76
+ # tmp_expr = str(self._expr_str).replace(',', '_')
77
+ self._sympy_expr = sympify(self._expr_str, locals=get_valid_functions())
78
+
79
+ if not isinstance(self._sympy_expr, Basic):
80
+ raise InvalidExpression(f'{self._expr_str} は数式ではありません。')
81
+
82
+ @property
83
+ def dependency(self) -> set[str]:
84
+ s: Symbol
85
+ return {s.name for s in self._sympy_expr.free_symbols}
86
+
87
+ def is_number(self) -> bool:
88
+ return self._sympy_expr.is_number
89
+
90
+ def is_expression(self) -> bool:
91
+ return not self.is_number()
92
+
93
+ @property
94
+ def expression_string(self) -> str:
95
+ return self._expr_str
96
+
97
+ def eval(self, dependency_values: dict[str, Number]):
98
+
99
+ # 型チェック
100
+ assert all([isinstance(value, Number) for value
101
+ in dependency_values.values()]), \
102
+ 'ExpressionFromString では数値変数のみをサポートしています。'
103
+
104
+ re_sympy_expr = sympify(
105
+ self.expression_string,
106
+ locals=get_valid_functions(dependency_values),
107
+ )
108
+
109
+ evaluated_sympy_obj = re_sympy_expr.subs(dependency_values)
110
+ try:
111
+ evaluated_value = float(evaluated_sympy_obj)
112
+ except (ValueError, TypeError) as e:
113
+ raise type(e)(*e.args, f'{evaluated_sympy_obj=} cannot convert to float.') from None
114
+
115
+ return evaluated_value
@@ -0,0 +1,295 @@
1
+ from typing import Callable, TypeAlias, Literal
2
+
3
+ import inspect
4
+ from numbers import Real # マイナーなので型ヒントには使わず isinstance で使う
5
+ from graphlib import TopologicalSorter
6
+
7
+ import numpy as np
8
+
9
+ from ._string_as_expression import _ExpressionFromString
10
+
11
+ from pyfemtet._i18n import _
12
+
13
+ __all__ = [
14
+ 'SupportedVariableTypes',
15
+ 'Parameter',
16
+ 'Variable',
17
+ 'NumericVariable',
18
+ 'NumericParameter',
19
+ 'CategoricalVariable',
20
+ 'CategoricalParameter',
21
+ 'Expression',
22
+ 'ExpressionFromFunction',
23
+ # 'NumericExpressionFromFunction',
24
+ # 'CategoricalExpressionFromFunction',
25
+ 'ExpressionFromString',
26
+ 'VariableManager',
27
+ ]
28
+
29
+
30
+ SupportedVariableTypes: TypeAlias = str | Real # isinstance で使いうるので Real
31
+
32
+
33
+ class Variable:
34
+ name: str
35
+ value: SupportedVariableTypes
36
+ pass_to_fem: bool
37
+ properties: dict[str, ...]
38
+
39
+ def __init__(self):
40
+ # noinspection PyTypeChecker
41
+ self.value = None
42
+ self.properties = {}
43
+
44
+ def __repr__(self):
45
+ return str(self.value)
46
+
47
+
48
+ class Parameter(Variable):
49
+ pass
50
+
51
+
52
+ class NumericVariable(Variable):
53
+ value: float
54
+
55
+
56
+ class NumericParameter(NumericVariable, Parameter):
57
+ value: float
58
+ lower_bound: float | None
59
+ upper_bound: float | None
60
+ step: float | None
61
+
62
+
63
+ class CategoricalVariable(Variable):
64
+ value: str
65
+
66
+
67
+ class CategoricalParameter(CategoricalVariable, Parameter):
68
+ choices: list[str]
69
+
70
+
71
+ class Expression(Variable):
72
+ pass
73
+
74
+
75
+ class ExpressionFromFunction(Expression):
76
+ fun: Callable
77
+ args: tuple | None
78
+ kwargs: dict | None
79
+
80
+
81
+ class NumericExpressionFromFunction(ExpressionFromFunction, NumericVariable):
82
+ fun: Callable[..., float]
83
+
84
+
85
+ class CategoricalExpressionFromFunction(ExpressionFromFunction, CategoricalVariable):
86
+ fun: Callable[..., str]
87
+
88
+
89
+ class ExpressionFromString(Expression, NumericVariable):
90
+ _expr: _ExpressionFromString
91
+ InternalClass: type = _ExpressionFromString
92
+
93
+
94
+ class VariableManager:
95
+
96
+ variables: dict[str, Variable]
97
+ dependencies: dict[str, set[str]]
98
+ evaluation_order: list[str] # 評価する順番
99
+
100
+ def __init__(self):
101
+ super().__init__()
102
+ self.variables = dict()
103
+ self.dependencies = dict()
104
+
105
+ @staticmethod
106
+ def _calc_dependencies(variables: dict[str, Variable]) -> dict[str, set[str]]:
107
+
108
+ dependencies: dict[str, set[str]] = dict()
109
+ all_var_names: set[str] = set(variables.keys())
110
+
111
+ var_name: str
112
+ for var_name, var in variables.items():
113
+
114
+ # Expression ならば、fun の引数のうち
115
+ # variables の名前であるものを dependency とする
116
+ if isinstance(var, ExpressionFromFunction):
117
+ arg_names: set[str] = set(inspect.signature(var.fun).parameters)
118
+ dep_var_names: set[str] = all_var_names & arg_names
119
+ dependency = dep_var_names
120
+
121
+ # ExpressionString であれば、
122
+ # 使われている変数を解析する
123
+ elif isinstance(var, ExpressionFromString):
124
+ dependency = var._expr.dependency
125
+
126
+ else:
127
+ assert isinstance(var, Variable)
128
+ dependency = {}
129
+
130
+ dependencies.update({var_name: dependency})
131
+
132
+ return dependencies
133
+
134
+ @staticmethod
135
+ def _calc_evaluation_order(dependencies: dict[str, set[str]]) -> list[str]:
136
+ ts = TopologicalSorter(dependencies)
137
+ return list(ts.static_order())
138
+
139
+ def resolve(self):
140
+ self.dependencies = self._calc_dependencies(self.variables)
141
+ self.evaluation_order = self._calc_evaluation_order(self.dependencies)
142
+
143
+ def eval_expressions(self):
144
+
145
+ for var_name in self.evaluation_order:
146
+
147
+ var = self.variables[var_name]
148
+
149
+ # fun を持つ場合
150
+ if isinstance(var, ExpressionFromFunction):
151
+
152
+ # pop するので list をコピーしておく
153
+ user_def_args = list(var.args)
154
+
155
+ # 位置引数を揃え、残りをキーワード引数にする
156
+ pos_args = []
157
+ kw_args = var.kwargs or {}
158
+
159
+ # 引数順に調べる
160
+ required_arg_names = inspect.signature(var.fun).parameters.values()
161
+ for p in required_arg_names:
162
+
163
+ # 位置引数であ(りう)る
164
+ if p.kind <= inspect.Parameter.POSITIONAL_OR_KEYWORD:
165
+
166
+ # 変数である
167
+ if p.name in self.variables:
168
+ # order 順に見ているのですでに value が正しいはず
169
+ pos_args.append(self.variables[p.name].value)
170
+
171
+ # ユーザー定義位置引数である
172
+ else:
173
+ try:
174
+ pos_args.append(user_def_args.pop(0))
175
+ except IndexError as e: # pop from empty list
176
+ msg = []
177
+ for p_ in required_arg_names:
178
+ if p_.kind == inspect.Parameter.VAR_POSITIONAL:
179
+ msg.append(f'*{p_.name}')
180
+ elif p_.kind == inspect.Parameter.VAR_KEYWORD:
181
+ msg.append(f'**{p_.name}')
182
+ else:
183
+ msg.append(p_.name)
184
+ raise type(e)(
185
+ *e.args,
186
+ _(
187
+ 'Missing arguments! '
188
+ 'The arguments specified by `args`: {var_args} / '
189
+ 'The arguments specified by `kwargs`: {var_kwargs} / '
190
+ 'Required arguments: {msg}',
191
+ var_args=var.args,
192
+ var_kwargs=var.kwargs,
193
+ msg=msg
194
+ ),
195
+ ) from None
196
+
197
+ # *args である
198
+ elif p.kind == inspect.Parameter.VAR_POSITIONAL:
199
+
200
+ # ユーザー定義位置引数でないとおかしい
201
+ assert p.name not in self.variables, _('Extra positional argument name cannot be duplicated with a variable name.')
202
+
203
+ # *args なので残り全部を pos_args に入れる
204
+ pos_args.extend(user_def_args)
205
+
206
+ # キーワード引数である
207
+ elif p.kind == inspect.Parameter.KEYWORD_ONLY:
208
+
209
+ # 変数である
210
+ if p.name in self.variables:
211
+ # order 順に見ているのですでに value が正しいはず
212
+ kw_args.update({p.name: self.variables[p.name].value})
213
+
214
+ # **kwargs である
215
+ else:
216
+
217
+ # kw_args にユーザー定義キーワード引数を入れているので何もしなくてよい
218
+ assert p.name not in self.variables, _('Extra keyword argument name cannot be duplicated with a variable name.')
219
+
220
+ # fun を実行する
221
+ var.value = var.fun(*pos_args, **kw_args)
222
+
223
+ # string expression の場合
224
+ elif isinstance(var, ExpressionFromString):
225
+
226
+ # dependency_values を作る
227
+ dependency: set[str] = var._expr.dependency
228
+
229
+ # order 順に見ているので value は正しいはず
230
+ dependency_values: dict[str, SupportedVariableTypes] = {
231
+ dep_name: self.variables[dep_name].value
232
+ for dep_name in dependency
233
+ }
234
+
235
+ # 計算
236
+ var.value = var._expr.eval(dependency_values)
237
+
238
+ # その他 = Expression ではない場合
239
+ else:
240
+ # optimizer によって直接 update されている
241
+ # はずなので何もしなくてよい
242
+ pass
243
+
244
+ # noinspection PyShadowingBuiltins
245
+ def get_variables(
246
+ self,
247
+ *,
248
+ filter: (Literal['pass_to_fem', 'parameter']
249
+ | tuple[Literal['pass_to_fem', 'parameter']]
250
+ | None) = None, # 'pass_to_fem' and 'parameter' (OR filter)
251
+ format: str = None, # None, 'dict' and 'values'
252
+ ) -> (
253
+ dict[str, Variable]
254
+ | dict[str, Parameter]
255
+ | dict[str, SupportedVariableTypes]
256
+ | np.ndarray
257
+ ):
258
+
259
+ raw = {}
260
+
261
+ for name, var in self.variables.items():
262
+
263
+ if filter is not None:
264
+ if 'pass_to_fem' in filter:
265
+ if var.pass_to_fem:
266
+ raw.update({name: var})
267
+
268
+ if 'parameter' in filter:
269
+ if isinstance(var, Parameter):
270
+ raw.update({name: var})
271
+
272
+ else:
273
+ raw.update({name: var})
274
+
275
+ if format is None:
276
+ return raw
277
+
278
+ elif format == 'raw':
279
+ return raw
280
+
281
+ elif format == 'dict':
282
+ return {name: var.value for name, var in raw.items()}
283
+
284
+ elif format == 'values':
285
+ return np.array([var.value for var in raw.values()])
286
+
287
+ else:
288
+ raise NotImplementedError(
289
+ _(
290
+ 'invalid format {format} is passed to '
291
+ 'VariableManager.get_variables(). '
292
+ 'Valid formats are one of (`raw`, `dict`, `values`).',
293
+ format=format,
294
+ )
295
+ )
@@ -0,0 +1,5 @@
1
+ from pyfemtet.opt.visualization.history_viewer.result_viewer._application import result_viewer_main
2
+
3
+
4
+ if __name__ == '__main__':
5
+ result_viewer_main()
@@ -14,24 +14,32 @@ from dash import Output, Input # , State, no_update, callback_context
14
14
  # from dash import html, dcc
15
15
  import dash_bootstrap_components
16
16
 
17
- from pyfemtet.opt._femopt_core import History
18
- from pyfemtet.opt.visualization._wrapped_components import html, dcc, dbc
17
+ # from pyfemtet.opt._femopt_core import History
18
+ # from pyfemtet.opt.visualization._wrapped_components import html, dcc, dbc
19
+ from pyfemtet.opt.history import History
20
+ from pyfemtet.opt.visualization.history_viewer._wrapped_components import html
21
+ from pyfemtet.opt.visualization.history_viewer._wrapped_components import dcc, dbc
19
22
 
20
23
  # the others
21
24
  from abc import ABC, abstractmethod
22
25
  import logging
23
26
  import psutil
24
- import json
25
27
  from pyfemtet.logger import get_module_logger, get_dash_logger
26
28
 
27
- logger = get_module_logger('opt.monitor', __name__)
29
+ __all__ = [
30
+ 'logger',
31
+ 'AbstractPage',
32
+ 'PyFemtetApplicationBase',
33
+ ]
34
+
35
+
36
+ logger = get_module_logger('opt.monitor', False)
28
37
  logger.setLevel(logging.ERROR)
29
38
 
30
39
  dash_logger = get_dash_logger()
31
40
  dash_logger.setLevel(logging.ERROR)
32
41
 
33
42
 
34
-
35
43
  class AbstractPage(ABC):
36
44
  """Define content."""
37
45
  """
@@ -50,7 +58,7 @@ title -->home| | | |
50
58
 
51
59
  """
52
60
  def __init__(self, title='base-page', rel_url='/', application=None):
53
- self.layout: Component = None
61
+ self.layout: Component = html.Div('This is a abstract page before setup.')
54
62
  self.rel_url = rel_url
55
63
  self.title = title
56
64
  self.application: PyFemtetApplicationBase = application
@@ -135,6 +143,7 @@ class SidebarApplicationBase:
135
143
  self.title = title if title is not None else 'App'
136
144
  self.subtitle = subtitle if title is not None else ''
137
145
  self.server = Flask(__name__)
146
+ # noinspection PyTypeChecker
138
147
  self.app = Dash(
139
148
  __name__,
140
149
  external_stylesheets=[dash_bootstrap_components.themes.BOOTSTRAP],
@@ -239,15 +248,11 @@ class PyFemtetApplicationBase(SidebarApplicationBase):
239
248
  history: History = None,
240
249
  ):
241
250
  # register arguments
242
- self.history = history # include actor
251
+ self.history: History = history # include actor
243
252
  super().__init__(title, subtitle)
244
253
 
245
-
246
- def check_page_layout(page_cls: type):
247
- home_page = page_cls() # required
248
- application = PyFemtetApplicationBase(title='test-app')
249
- application.add_page(home_page, 0)
250
- application.run(debug=True)
254
+ def get_df(self, equality_filters: dict = None):
255
+ return self.history.get_df(equality_filters=equality_filters)
251
256
 
252
257
 
253
258
  if __name__ == '__main__':
@@ -0,0 +1,150 @@
1
+ import optuna
2
+
3
+ from dash import Output, Input
4
+
5
+ from pyfemtet.opt.visualization.history_viewer._wrapped_components import html
6
+ from pyfemtet.opt.visualization.history_viewer._wrapped_components import dcc
7
+ from pyfemtet.opt.visualization.history_viewer._base_application import AbstractPage
8
+ from pyfemtet.opt.visualization.history_viewer._complex_components.pm_graph import *
9
+
10
+ from pyfemtet._i18n import Msg
11
+
12
+ __all__ = [
13
+ 'PredictionModelPage',
14
+ 'OptunaVisualizerPage',
15
+ ]
16
+
17
+
18
+ DBC_COLUMN_STYLE_CENTER = {
19
+ 'display': 'flex',
20
+ 'justify-content': 'center',
21
+ 'align-items': 'center',
22
+ }
23
+
24
+ DBC_COLUMN_STYLE_RIGHT = {
25
+ 'display': 'flex',
26
+ 'justify-content': 'right',
27
+ 'align-items': 'right',
28
+ }
29
+
30
+
31
+ def is_iterable(component):
32
+ return hasattr(component, '__len__')
33
+
34
+
35
+ class PredictionModelPage(AbstractPage):
36
+ rsm_graph: PredictionModelGraph
37
+
38
+ def __init__(self, title, rel_url, application):
39
+ super().__init__(title, rel_url, application)
40
+
41
+ def setup_component(self):
42
+ self.rsm_graph: PredictionModelGraph = PredictionModelGraph()
43
+ self.add_subpage(self.rsm_graph)
44
+
45
+ def setup_layout(self):
46
+ self.layout = self.rsm_graph.layout
47
+
48
+
49
+ class OptunaVisualizerPage(AbstractPage):
50
+ location: dcc.Location
51
+ _layout: html.Div
52
+
53
+ def __init__(self, title, rel_url, application):
54
+ super().__init__(title, rel_url, application)
55
+
56
+ def setup_component(self):
57
+ self.location = dcc.Location(id='optuna-page-location', refresh=True)
58
+ self._layout = html.Div(children=[Msg.DETAIL_PAGE_TEXT_BEFORE_LOADING])
59
+ self.layout = [self.location, self._layout]
60
+
61
+ def _setup_layout(self):
62
+
63
+ study = self.application.history._create_optuna_study_for_visualization()
64
+ # prm_names = self.application.history.prm_names
65
+ obj_names = self.application.history.obj_names
66
+
67
+ layout = list()
68
+
69
+ layout.append(html.H2(Msg.DETAIL_PAGE_HISTORY_HEADER))
70
+ layout.append(html.H4(Msg.DETAIL_PAGE_HISTORY_DESCRIPTION))
71
+ for i, obj_name in enumerate(obj_names):
72
+ fig = optuna.visualization.plot_optimization_history(
73
+ study,
74
+ target=lambda t: t.values[i],
75
+ target_name=obj_name
76
+ )
77
+ layout.append(dcc.Graph(figure=fig, style={'height': '70vh'}))
78
+
79
+ layout.append(html.H2(Msg.DETAIL_PAGE_PARALLEL_COOR_HEADER))
80
+ layout.append(html.H4(Msg.DETAIL_PAGE_PARALLEL_COOR_DESCRIPTION))
81
+ for i, obj_name in enumerate(obj_names):
82
+ fig = optuna.visualization.plot_parallel_coordinate(
83
+ study,
84
+ target=lambda t: t.values[i],
85
+ target_name=obj_name
86
+ )
87
+ layout.append(dcc.Graph(figure=fig, style={'height': '70vh'}))
88
+
89
+ layout.append(html.H2(Msg.DETAIL_PAGE_CONTOUR_HEADER))
90
+ layout.append(html.H4(Msg.DETAIL_PAGE_CONTOUR_DESCRIPTION))
91
+ for i, obj_name in enumerate(obj_names):
92
+ fig = optuna.visualization.plot_contour(
93
+ study,
94
+ target=lambda t: t.values[i],
95
+ target_name=obj_name
96
+ )
97
+ layout.append(dcc.Graph(figure=fig, style={'height': '90vh'}))
98
+
99
+ # import itertools
100
+ # for (i, j) in itertools.combinations(range(len(obj_names)), 2):
101
+ # fig = optuna.visualization.plot_pareto_front(
102
+ # study,
103
+ # targets=lambda t: (t.values[i], t.values[j]),
104
+ # target_names=[obj_names[i], obj_names[j]],
105
+ # )
106
+ # self.graphs.append(dcc.Graph(figure=fig, style={'height': '50vh'}))
107
+
108
+ layout.append(html.H2(Msg.DETAIL_PAGE_SLICE_HEADER))
109
+ layout.append(html.H4(Msg.DETAIL_PAGE_SLICE_DESCRIPTION))
110
+ for i, obj_name in enumerate(obj_names):
111
+ fig = optuna.visualization.plot_slice(
112
+ study,
113
+ target=lambda t: t.values[i],
114
+ target_name=obj_name
115
+ )
116
+ layout.append(dcc.Graph(figure=fig, style={'height': '70vh'}))
117
+
118
+ layout.append(html.H2(Msg.DETAIL_PAGE_IMPORTANCE_HEADER))
119
+ layout.append(html.H4(Msg.DETAIL_PAGE_IMPORTANCE_DESCRIPTION))
120
+ for i, obj_name in enumerate(obj_names):
121
+ fig = optuna.visualization.plot_param_importances(
122
+ study,
123
+ target=lambda t: t.values[i],
124
+ target_name=obj_name
125
+ )
126
+ import plotly.graph_objects as go
127
+ fig: go.Figure
128
+ fig.update_layout(title=obj_name)
129
+ layout.append(dcc.Graph(figure=fig, style={'height': '70vh'}))
130
+
131
+ return layout
132
+
133
+ def setup_callback(self):
134
+ app = self.application.app
135
+
136
+ @app.callback(
137
+ Output(self._layout, 'children'),
138
+ Input(self.location, 'pathname'), # on page load
139
+ )
140
+ def update_page(_):
141
+ if self.application.history is None:
142
+ return Msg.ERR_NO_HISTORY_SELECTED
143
+
144
+ if len(self.application.get_df()) == 0:
145
+ return Msg.ERR_NO_FEM_RESULT
146
+
147
+ return self._setup_layout()
148
+
149
+ def setup_layout(self):
150
+ pass
@@ -3,13 +3,17 @@ from typing import List
3
3
  from dash.development.base_component import Component
4
4
 
5
5
  # callback
6
- from dash import Output, Input, State, no_update, callback_context
7
- from dash.exceptions import PreventUpdate
6
+ from dash import Output, Input
8
7
 
9
8
  # components
10
- from pyfemtet.opt.visualization._wrapped_components import html, dcc, dbc
9
+ from pyfemtet.opt.visualization.history_viewer._wrapped_components import dbc
11
10
 
12
- from pyfemtet.opt.visualization._base import AbstractPage, logger
11
+ from pyfemtet.opt.visualization.history_viewer._base_application import AbstractPage
12
+
13
+
14
+ __all__ = [
15
+ 'AlertRegion'
16
+ ]
13
17
 
14
18
 
15
19
  class AlertRegion(AbstractPage):
@@ -53,7 +57,8 @@ class AlertRegion(AbstractPage):
53
57
  def clear_alerts(_):
54
58
  return []
55
59
 
56
- def create_alerts(self, msg, color='secondary', current_alerts=None) -> List[Component]:
60
+ @staticmethod
61
+ def create_alerts(msg, color='secondary', current_alerts=None) -> List[Component]:
57
62
 
58
63
  if current_alerts is None:
59
64
  current_alerts = []