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
@@ -1,201 +0,0 @@
1
- from typing import Callable, List
2
-
3
- import torch
4
- import numpy as np
5
- import pandas as pd
6
-
7
- import plotly.graph_objs as go
8
- import plotly.express as px
9
-
10
- from pyfemtet.opt._femopt_core import History
11
-
12
- from pyfemtet.opt.prediction._base import PyFemtetPredictionModel
13
- from pyfemtet.opt.prediction.single_task_gp import SingleTaskGPModel
14
- from pyfemtet._message import Msg
15
-
16
-
17
- class PredictionModelCreator:
18
-
19
- # noinspection PyAttributeOutsideInit
20
- def fit(self, history, df):
21
- # common
22
- self.history = history # used to check fit or not
23
- self.df = df
24
- # method specific
25
- self.pmm = PyFemtetPredictionModel(history, df, SingleTaskGPModel)
26
- self.pmm.fit()
27
-
28
- def create_figure(
29
- self,
30
- prm_name_1: str,
31
- obj_name: str,
32
- remaining_x: list[float],
33
- prm_name_2: str = '',
34
- ):
35
-
36
- history = self.history
37
- df = self.df
38
-
39
- # determine axis1, axis2 range
40
- lb1 = df[f'{prm_name_1}_lower_bound'].min()
41
- ub1 = df[f'{prm_name_1}_upper_bound'].max()
42
- lb1 = df[prm_name_1].min() if np.isnan(lb1) else lb1
43
- ub1 = df[prm_name_1].max() if np.isnan(ub1) else ub1
44
- if prm_name_2:
45
- lb2 = df[f'{prm_name_2}_lower_bound'].min()
46
- ub2 = df[f'{prm_name_2}_upper_bound'].max()
47
- lb2 = df[prm_name_2].min() if np.isnan(lb2) else lb2
48
- ub2 = df[prm_name_2].max() if np.isnan(ub2) else ub2
49
-
50
- # create grid data
51
- if prm_name_2:
52
- N = 20
53
- x_grid = np.linspace(lb1, ub1, N) # shape: (N,)
54
- y_grid = np.linspace(lb2, ub2, N)
55
- xx, yy = np.meshgrid(x_grid, y_grid) # shape: (N, N)
56
- else:
57
- N = 100
58
- xx = np.linspace(lb1, ub1, N) # shape: (N,)
59
-
60
- # create raveled grid data
61
- tmp_df = pd.DataFrame(
62
- columns=history.prm_names,
63
- index=range(len(xx.ravel())), # index で df の長さを指定しないと remaining_x の代入で工夫が必要になる
64
- )
65
-
66
- # 変数名ごとに見ていって、
67
- # 横軸に使う変数ならグリッド値を入れ、
68
- # そうでなければ remaining_x の値を入れる(シリーズになる)
69
- idx = 0
70
- for prm_name in history.prm_names:
71
- if prm_name == prm_name_1:
72
- tmp_df[prm_name_1] = xx.ravel() # shape: (N**2,) or (N,)
73
- elif prm_name == prm_name_2: # no chance to hit if prm_name_2 == ''
74
- tmp_df[prm_name_2] = yy.ravel()
75
- else:
76
- tmp_df[prm_name] = remaining_x[idx]
77
- idx += 1
78
- x = tmp_df.values # shape: (len(prm), N**2)
79
-
80
- # predict by model
81
- mean, std = self.pmm.predict(x) # shape: (len(obj), N**2)
82
-
83
- # create mesh data for graph
84
- obj_index = history.obj_names.index(obj_name)
85
- zz_mean = mean[:, obj_index].reshape(xx.shape) # shape: (N**2,) -> (N, N) or (N,) -> (N,)
86
- zz_std = std[:, obj_index].reshape(xx.shape)
87
- zz_upper = zz_mean + zz_std
88
- zz_lower = zz_mean - zz_std
89
-
90
- # ===== create figure =====
91
- # description: データ点は多次元空間上の点なので、余剰次元を無視して三次元空間上に投影しても何の意味もない。むしろ混乱するのでやってはいけない。実験的機能として、透明度を設定してみる。
92
- # calculate distance from super-plane to prm point for opacity of scatter plot
93
- remaining_prm = list(history.prm_names) # weak copy
94
- remaining_prm.remove(prm_name_1)
95
- remaining_prm.remove(prm_name_2) if prm_name_2 in remaining_prm else None
96
- if len(remaining_prm) > 0:
97
- super_plane = np.array(remaining_x) # shape: (len(prm_names)-2) or (len(prm_names)-1)
98
- target_point = df[remaining_prm].values # shape: (len(df), len(prm_names)-2) or (len(df), len(prm_names)-1)
99
- distance = np.linalg.norm(target_point-super_plane, axis=1, keepdims=False) # shape: (len(df))
100
- opacity = 1 - (distance / distance.max()) # smaller distance, larger opacity
101
- else:
102
- opacity = np.ones(len(df))
103
-
104
- # scatter plot
105
- if prm_name_2:
106
- fig = go.Figure(data=go.Scatter3d(
107
- x=df[prm_name_1], y=df[prm_name_2], z=df[obj_name],
108
- mode='markers',
109
- marker=dict(
110
- size=3,
111
- line=dict(
112
- width=1, # broken?
113
- color='white',
114
- # color=df['trial'], # 見づらい?
115
- # colorscale='Viridis_r',
116
- ),
117
- ),
118
- name='trial',
119
- ))
120
- else:
121
- fig = go.Figure(data=go.Scatter(
122
- x=df[prm_name_1], y=df[obj_name],
123
- mode='markers',
124
- marker=dict(
125
- line=dict(
126
- width=1,
127
- color='white',
128
- ),
129
- ),
130
- name='trial',
131
- ))
132
-
133
- # set opacity by its distance
134
- def set_opacity(trace):
135
- trace.marker.color = [f'rgba(0, 0, 0, {o: .2f})' for o in opacity]
136
- fig.for_each_trace(set_opacity)
137
-
138
- # main RSM
139
- if prm_name_2:
140
- contours = dict(
141
- x=dict(
142
- highlight=True, show=True, color='blue',
143
- start=lb1, end=ub1, size=(ub1-lb1)/N,
144
- ),
145
- y=dict(
146
- highlight=True, show=True, color='blue',
147
- start=lb2, end=ub2, size=(ub2-lb2)/N
148
- ),
149
- z=dict(highlight=False, show=False),
150
- )
151
- fig.add_trace(
152
- go.Surface(
153
- z=zz_mean, x=xx, y=yy,
154
- contours=contours,
155
- showlegend=True,
156
- name=Msg.LEGEND_LABEL_PREDICTION_MODEL,
157
- colorbar=dict(
158
- x=0.2,
159
- xref="container",
160
- # orientation='h',
161
- )
162
- )
163
- )
164
- # std
165
- fig.add_trace(go.Surface(z=zz_upper, x=xx, y=yy, showscale=False, opacity=0.3, showlegend=True, name=Msg.LEGEND_LABEL_PREDICTION_MODEL_STDDEV))
166
- fig.add_trace(go.Surface(z=zz_lower, x=xx, y=yy, showscale=False, opacity=0.3, showlegend=True, name=Msg.LEGEND_LABEL_PREDICTION_MODEL_STDDEV))
167
-
168
- # layout
169
- fig.update_layout(
170
- title=Msg.GRAPH_TITLE_PREDICTION_MODEL,
171
- scene=dict(
172
- xaxis_title=prm_name_1,
173
- yaxis_title=prm_name_2,
174
- zaxis_title=obj_name
175
- ),
176
- margin=dict(l=0, r=0, b=0, t=30),
177
- )
178
-
179
- else:
180
- fig.add_trace(
181
- go.Scatter(x=xx, y=zz_mean, name=Msg.LEGEND_LABEL_PREDICTION_MODEL)
182
- )
183
- # std
184
- fig.add_trace(
185
- go.Scatter(
186
- x=np.concatenate([xx, xx[::-1]]),
187
- y=np.concatenate([zz_upper, zz_lower[::-1]]),
188
- opacity=0.3,
189
- fill='toself',
190
- name=Msg.LEGEND_LABEL_PREDICTION_MODEL_STDDEV,
191
- )
192
- )
193
-
194
- # layout
195
- fig.update_layout(
196
- title=Msg.GRAPH_TITLE_PREDICTION_MODEL,
197
- xaxis_title=prm_name_1,
198
- yaxis_title=obj_name,
199
- )
200
-
201
- return fig
@@ -1,226 +0,0 @@
1
- from typing import List
2
- from time import sleep
3
- from threading import Thread
4
-
5
- import pandas as pd
6
- from flask import jsonify
7
-
8
- from pyfemtet.opt.visualization._base import PyFemtetApplicationBase, logger
9
- from pyfemtet.opt.visualization._process_monitor.pages import HomePage, WorkerPage, PredictionModelPage, OptunaVisualizerPage
10
- from pyfemtet._message import Msg
11
-
12
-
13
- class ProcessMonitorApplication(PyFemtetApplicationBase):
14
- """"""
15
- """
16
- +------+--------+
17
- | side | con- |
18
- | bar | tent |
19
- +--^---+--^-----+
20
- │ └─ pages (dict(href: str = layout: Component))
21
- └──────── nav_links (dict(order: float) = NavLink)
22
-
23
- Accessible members:
24
- - history: History
25
- └ local_df: pd.DataFrame
26
- - app: Dash
27
- - local_entire_status_int: int <----------------> femopt.statue: OptimizationStatus(Actor)
28
- - local_worker_status_int_list: List[int] <-----> femopt.opt.statue: List[OptimizationStatus(Actor)]
29
- ^
30
- |
31
- sync "while" statement in start_server()
32
- """
33
-
34
- DEFAULT_PORT = 8080
35
-
36
- def __init__(
37
- self,
38
- history,
39
- status,
40
- worker_addresses,
41
- worker_status_list,
42
- is_debug=False,
43
- ):
44
- super().__init__(
45
- title='PyFemtet Monitor',
46
- subtitle='visualize optimization progress',
47
- history=history,
48
- )
49
-
50
- self._should_get_actor_data = False
51
- self.is_debug = is_debug
52
-
53
- # type hint (avoid circular import)
54
- from pyfemtet.opt._femopt_core import OptimizationStatus
55
-
56
- # register arguments
57
- self.worker_addresses: List[str] = worker_addresses
58
- self.entire_status: OptimizationStatus = status # include actor
59
- self.worker_status_list: List[OptimizationStatus] = worker_status_list # include actor
60
-
61
- # initialize local members (from actors)
62
- self._df: pd.DataFrame = self.local_data
63
- self.local_entire_status_int: int = self.entire_status.get()
64
- self.local_worker_status_int_list: List[int] = [s.get() for s in self.worker_status_list]
65
-
66
- @property
67
- def local_data(self) -> pd.DataFrame:
68
- if self._should_get_actor_data:
69
- return self._df
70
- else:
71
- return self.history.get_df(valid_only=True)
72
-
73
- @local_data.setter
74
- def local_data(self, value: pd.DataFrame):
75
- if self._should_get_actor_data:
76
- raise NotImplementedError('If should_get_actor_data, ProcessMonitorApplication.local_df is read_only.')
77
- else:
78
- self.history.set_df(value)
79
-
80
- def setup_callback(self, debug=False):
81
- if not debug:
82
- super().setup_callback()
83
-
84
- from pyfemtet.opt._femopt_core import OptimizationStatus
85
-
86
- @self.server.route('/interrupt')
87
- def some_command():
88
-
89
- # If the entire_state < INTERRUPTING, set INTERRUPTING
90
- if self.local_entire_status_int < OptimizationStatus.INTERRUPTING:
91
- self.local_entire_status_int = OptimizationStatus.INTERRUPTING
92
- result = {"message": "Interrupting signal emitted successfully."}
93
-
94
- else:
95
- result = {"message": "Interrupting signal is already emitted."}
96
-
97
- return jsonify(result)
98
-
99
- def start_server(self, host=None, port=None, host_record=None):
100
- """Callback の中で使いたい Actor のデータを Application クラスのメンバーとやり取りしつつ、server を落とす関数"""
101
-
102
- self._should_get_actor_data = True
103
-
104
- # avoid circular import
105
- from pyfemtet.opt._femopt_core import OptimizationStatus
106
-
107
- host = host or 'localhost'
108
- port = port or self.DEFAULT_PORT
109
-
110
- # dash app server を daemon thread で起動
111
- server_thread = Thread(
112
- target=self.run,
113
- args=(host, port,),
114
- kwargs=dict(host_record=host_record),
115
- daemon=True,
116
- )
117
- server_thread.start()
118
-
119
- # dash app (=flask server) の callback で dask の actor にアクセスすると
120
- # おかしくなることがあるので、ここで必要な情報のみやり取りする
121
- while True:
122
- # running 以前に monitor で current status を interrupting にしていれば actor に反映
123
- if (
124
- (self.entire_status.get() <= OptimizationStatus.RUNNING) # メインプロセスが RUNNING 以前である
125
- and (self.local_entire_status_int == OptimizationStatus.INTERRUPTING) # Application で status を INTERRUPT にした
126
- ):
127
- self.entire_status.set(OptimizationStatus.INTERRUPTING)
128
- for worker_status in self.worker_status_list:
129
- worker_status.set(OptimizationStatus.INTERRUPTING)
130
-
131
- # status と df を actor から application に反映する
132
- self._df = self.history.get_df(valid_only=True).copy()
133
- self.local_entire_status_int = self.entire_status.get()
134
- self.local_worker_status_int_list = [s.get() for s in self.worker_status_list]
135
-
136
- # terminate_all 指令があれば flask server をホストするプロセスごと終了する
137
- if self.entire_status.get() >= OptimizationStatus.TERMINATE_ALL:
138
- return 0 # take server down with me
139
-
140
- # interval
141
- sleep(1)
142
-
143
- @staticmethod
144
- def get_status_color(status_int):
145
- from pyfemtet.opt._femopt_core import OptimizationStatus
146
- # set color
147
- if status_int <= OptimizationStatus.SETTING_UP:
148
- color = 'secondary'
149
- elif status_int <= OptimizationStatus.WAIT_OTHER_WORKERS:
150
- color = 'primary'
151
- elif status_int <= OptimizationStatus.RUNNING:
152
- color = 'primary'
153
- elif status_int <= OptimizationStatus.INTERRUPTING:
154
- color = 'warning'
155
- elif status_int <= OptimizationStatus.TERMINATE_ALL:
156
- color = 'dark'
157
- elif status_int <= OptimizationStatus.CRASHED:
158
- color = 'danger'
159
- else:
160
- color = 'danger'
161
- return color
162
-
163
-
164
- def g_debug():
165
- import os
166
- os.chdir(os.path.dirname(__file__))
167
-
168
- from pyfemtet.opt._femopt_core import History, OptimizationStatus
169
-
170
- class _OS(OptimizationStatus):
171
-
172
- # noinspection PyMissingConstructor
173
- def __init__(self, name):
174
- self.name = name
175
- self.st = self.INITIALIZING
176
-
177
- def set(self, status_const):
178
- self.st = status_const
179
-
180
- def get(self) -> int:
181
- return self.st
182
-
183
- def get_text(self) -> int:
184
- return self.const_to_str(self.st)
185
-
186
- g_application = ProcessMonitorApplication(
187
- history=History(history_path=os.path.join(os.path.dirname(__file__), '..', 'result_viewer', 'sample', 'sample.csv')),
188
- status=_OS('entire'),
189
- worker_addresses=['worker1', 'worker2', 'worker3'],
190
- worker_status_list=[_OS('worker1'), _OS('worker2'), _OS('worker3')],
191
- is_debug=False,
192
- )
193
-
194
- g_home_page = HomePage(Msg.PAGE_TITLE_PROGRESS)
195
- g_rsm_page = PredictionModelPage(Msg.PAGE_TITLE_PREDICTION_MODEL, '/prediction-model', g_application)
196
- g_optuna = OptunaVisualizerPage(Msg.PAGE_TITLE_OPTUNA_VISUALIZATION, '/optuna', g_application)
197
- g_worker_page = WorkerPage(Msg.PAGE_TITLE_WORKERS, '/workers', g_application)
198
-
199
- g_application.add_page(g_home_page, 0)
200
- g_application.add_page(g_rsm_page, 1)
201
- g_application.add_page(g_optuna, 2)
202
- g_application.add_page(g_worker_page, 3)
203
- g_application.setup_callback(debug=False)
204
-
205
- g_application.run(debug=False)
206
-
207
-
208
- def main(history, status, worker_addresses, worker_status_list, host=None, port=None, host_record=None):
209
- g_application = ProcessMonitorApplication(history, status, worker_addresses, worker_status_list)
210
-
211
- g_home_page = HomePage(Msg.PAGE_TITLE_PROGRESS)
212
- g_rsm_page = PredictionModelPage(Msg.PAGE_TITLE_PREDICTION_MODEL, '/prediction-model', g_application)
213
- g_optuna = OptunaVisualizerPage(Msg.PAGE_TITLE_OPTUNA_VISUALIZATION, '/optuna', g_application)
214
- g_worker_page = WorkerPage(Msg.PAGE_TITLE_WORKERS, '/workers', g_application)
215
-
216
- g_application.add_page(g_home_page, 0)
217
- g_application.add_page(g_rsm_page, 1)
218
- g_application.add_page(g_optuna, 2)
219
- g_application.add_page(g_worker_page, 3)
220
- g_application.setup_callback()
221
-
222
- g_application.start_server(host, port, host_record)
223
-
224
-
225
- if __name__ == '__main__':
226
- g_debug()