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,105 @@
1
+ from time import time, sleep
2
+ from packaging.version import Version
3
+
4
+ from win32com.client import CDispatch
5
+ from femtetutils import util
6
+ import psutil
7
+
8
+ from pyfemtet._i18n import _
9
+
10
+ from pyfemtet._util.helper import *
11
+ from pyfemtet._util.process_util import _get_pid
12
+ from pyfemtet._util.femtet_version import _version
13
+
14
+ from pyfemtet.logger import get_module_logger
15
+
16
+
17
+ __all__ = ['_exit_or_force_terminate']
18
+
19
+
20
+ logger = get_module_logger('util.femtet.exit', False)
21
+
22
+
23
+ def _exit_or_force_terminate(timeout, Femtet: CDispatch, force=True):
24
+
25
+ # Femtet がすでに終了しているかどうかを判断する
26
+ hwnd = Femtet.hWnd
27
+ pid = _get_pid(hwnd)
28
+
29
+ # pid が 0 ならすでに終了しているものと見做して何もしない
30
+ if pid == 0:
31
+ return
32
+
33
+ # Exit() メソッドを定義している最小の Femtet バージョン
34
+ minimum_version = Version('2024.0.1')
35
+
36
+ # 現在の Femtet のバージョン
37
+ current_version = _version(Femtet=Femtet)
38
+
39
+ # 現在のバージョン >= minimum version なら Exit を実行
40
+ if current_version >= minimum_version:
41
+ # gracefully termination method without save project available from 2024.0.1
42
+ try:
43
+ with time_counting(
44
+ name='Femtet.Exit()',
45
+ warning_time_sec=timeout,
46
+ warning_fun=lambda: logger.warning(
47
+ _(
48
+ en_message='Femtet.Exit() does not finished in '
49
+ '{timeout} sec. Most common reason is '
50
+ 'that a dialog is opening in Femtet '
51
+ 'and waiting user input. Please close '
52
+ 'the dialog if it exists.',
53
+ jp_message='Femtet.Exit() は {timeout} 秒以内に終了できませんでした。'
54
+ '考えられる理由として、Femtet で予期せずダイアログが開いており'
55
+ 'ユーザーの入力を待っている場合があります。'
56
+ 'もしダイアログが存在すれば閉じてください。',
57
+ timeout=timeout
58
+ ),
59
+ # f'Femtet.Exit() が {timeout} 以内に終了していません。'
60
+ # f'Femtet で予期せずダイアログ等が開いている場合、'
61
+ # f'入力待ちのため処理が終了しない場合があります。'
62
+ # f'確認してください。'
63
+ )
64
+ ):
65
+ succeeded = Femtet.Exit(force)
66
+
67
+ except AttributeError:
68
+ raise AttributeError(
69
+ _(
70
+ en_message='Macro version is not consistent to '
71
+ 'the one of Femtet.exe. Please consider to'
72
+ 'execute ``Enable Macros`` of current Femtet '
73
+ 'version to fix it.',
74
+ jp_message='Femtet.exe のバージョンとマクロのバージョンが一致していません。'
75
+ '使用中の Femtet.exe と同じバージョンの「マクロ機能を有効化する」'
76
+ 'コマンドを実行してください。',
77
+ )
78
+ )
79
+
80
+ # そうでなければ強制終了する
81
+ else:
82
+ # terminate
83
+ util.close_femtet(Femtet.hWnd, timeout, force)
84
+
85
+ try:
86
+ succeeded = True
87
+ pid = _get_pid(hwnd)
88
+ start = time()
89
+ while psutil.pid_exists(pid):
90
+ if time() - start > 30: # 30 秒経っても存在するのは何かおかしい
91
+ logger.error(_('Failed to close Femtet in '
92
+ '30 seconds.',
93
+ '30 秒以内に Femtet を終了することが'
94
+ 'できませんでした。'
95
+ ))
96
+ succeeded = False
97
+ break
98
+ sleep(1)
99
+ sleep(1)
100
+
101
+ # dead
102
+ except (AttributeError, OSError):
103
+ pass
104
+
105
+ return succeeded
@@ -0,0 +1,20 @@
1
+ from packaging.version import Version
2
+
3
+ __all__ = [
4
+ '_version'
5
+ ]
6
+
7
+
8
+ def _version(
9
+ main=None,
10
+ major=None,
11
+ minor=None,
12
+ Femtet=None,
13
+ ):
14
+ if Femtet is not None:
15
+ assert (main is None) and (major is None) and (minor is None), 'バージョンを指定しないでください'
16
+ main, major, minor = Femtet.Version.split('.')[:3]
17
+ else:
18
+ assert (main is not None) and (major is not None) and (minor is not None), 'バージョンを指定してください'
19
+
20
+ return Version('.'.join((str(main), str(major), str(minor))))
@@ -0,0 +1,94 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Callable
4
+ import warnings
5
+ from time import time, sleep
6
+ from threading import Thread
7
+
8
+ from pyfemtet._i18n import _
9
+
10
+ __all__ = [
11
+ 'float_',
12
+ 'time_counting',
13
+ ]
14
+
15
+
16
+ def float_(value: str | None | float) -> str | float | None:
17
+ if value is None:
18
+ return value
19
+ try:
20
+ return float(value)
21
+ except ValueError:
22
+ return value
23
+
24
+
25
+ class _TimeCounting:
26
+
27
+ _thread: Thread
28
+ _should_exit: bool
29
+ name: str
30
+ warning_time_sec: float
31
+ warning_message: str | None
32
+ warning_fun: Callable[[], ...] | None
33
+
34
+ def __init__(
35
+ self,
36
+ name: str,
37
+ warning_time_sec: float = None,
38
+ warning_message: str = None,
39
+ warning_fun: Callable[[], ...] = None,
40
+ ):
41
+ self.name = name
42
+ self.warning_time_sec = warning_time_sec
43
+ self.warning_message = warning_message
44
+ self.warning_fun = warning_fun
45
+ if self.warning_time_sec is not None:
46
+ if warning_message is None and warning_fun is None:
47
+ self.warning_message = _(
48
+ '{name} does not finished in {timeout} seconds.',
49
+ '{name} が {timeout} 秒以内に終了しませんでした。',
50
+ name=self.name,
51
+ timeout=self.warning_time_sec
52
+ )
53
+
54
+ self._thread = Thread(target=self._time_count, daemon=True)
55
+ self._should_exit = False
56
+
57
+ def _time_count(self):
58
+ start = time()
59
+
60
+ while True:
61
+
62
+ if self._should_exit:
63
+ break
64
+
65
+ elif time() - start > self.warning_time_sec:
66
+ if self.warning_fun is None:
67
+ warnings.warn(self.warning_message)
68
+ else:
69
+ self.warning_fun()
70
+ break
71
+
72
+ sleep(0.5)
73
+
74
+ def __enter__(self):
75
+ self._thread.start()
76
+
77
+ def __exit__(self, exc_type, exc_val, exc_tb):
78
+ self._should_exit = True
79
+ self._thread.join()
80
+
81
+
82
+ def time_counting(
83
+ name: str,
84
+ warning_time_sec: float = None,
85
+ warning_message: str = None,
86
+ warning_fun: Callable[[], ...] = None,
87
+ ):
88
+
89
+ return _TimeCounting(
90
+ name,
91
+ warning_time_sec,
92
+ warning_message,
93
+ warning_fun,
94
+ )
@@ -0,0 +1,107 @@
1
+ import os
2
+
3
+ import psutil
4
+
5
+ import win32process
6
+ import win32gui
7
+
8
+ # noinspection PyUnresolvedReferences
9
+ from multiprocessing.context import BaseContext, SpawnProcess, _concrete_contexts
10
+ # noinspection PyUnresolvedReferences
11
+ from multiprocessing.process import _children, _cleanup
12
+ from multiprocessing.managers import SyncManager
13
+
14
+
15
+ __all__ = [
16
+ '_NestableSyncManager',
17
+ '_NestableSpawnProcess',
18
+ '_get_hwnds',
19
+ '_get_pid',
20
+ '_get_pids',
21
+ ]
22
+
23
+
24
+ # noinspection PyPep8Naming
25
+ def _NestableSyncManager():
26
+ m = SyncManager(ctx=_NestableSpawnContext()) # このへんが時間のかかる処理
27
+ m.start()
28
+ return m
29
+
30
+
31
+ def _get_hwnds(pid) -> list[int]:
32
+ """Proces ID から window handle を取得します."""
33
+ def callback(hwnd, _hwnds):
34
+ if win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd):
35
+ _, found_pid = win32process.GetWindowThreadProcessId(hwnd)
36
+ if found_pid == pid:
37
+ _hwnds.append(hwnd)
38
+ return True
39
+ hwnds = []
40
+ win32gui.EnumWindows(callback, hwnds)
41
+ return hwnds
42
+
43
+
44
+ def _get_pid(hwnd) -> int:
45
+ """Window handle から process ID を取得します."""
46
+ if hwnd > 0:
47
+ _, pid = win32process.GetWindowThreadProcessId(hwnd)
48
+ else:
49
+ pid = 0
50
+ return pid
51
+
52
+
53
+ def _get_pids(process_name) -> list[int]:
54
+ """Process のイメージ名から実行中の process ID を取得します."""
55
+ pids = [p.info["pid"] for p in psutil.process_iter(attrs=["pid", "name"]) if p.info["name"] == process_name]
56
+ return pids
57
+
58
+
59
+ # noinspection PyUnresolvedReferences,PyAttributeOutsideInit
60
+ class _NestableSpawnProcess(SpawnProcess):
61
+ _start_method = 'nestable_spawn'
62
+
63
+ def start(self):
64
+ """This method is modified version of multiprocess.process.BaseProcess.start().
65
+
66
+ By using this class, it may become a zombie process.
67
+
68
+ """
69
+
70
+ #
71
+ # multiprocessing/process.py
72
+ #
73
+ # Copyright (c) 2006-2008, R Oudkerk
74
+ # Licensed to PSF under a Contributor Agreement.
75
+ #
76
+
77
+ self._check_closed()
78
+ assert self._popen is None, 'cannot start a process twice'
79
+ assert self._parent_pid == os.getpid(), \
80
+ 'can only start a process object created by current process'
81
+ # assert not _current_process._config.get('daemon'), \
82
+ # 'daemonic processes are not allowed to have children'
83
+ _cleanup()
84
+ self._popen = self._Popen(self)
85
+ self._sentinel = self._popen.sentinel
86
+ # Avoid a refcycle if the target function holds an indirect
87
+ # reference to the process object (see bpo-30775)
88
+ del self._target, self._args, self._kwargs
89
+ _children.add(self)
90
+
91
+
92
+ class _NestableSpawnContext(BaseContext):
93
+
94
+ #
95
+ # multiprocessing/process.py
96
+ #
97
+ # Copyright (c) 2006-2008, R Oudkerk
98
+ # Licensed to PSF under a Contributor Agreement.
99
+ #
100
+
101
+ _name = 'nestable_spawn'
102
+ Process = _NestableSpawnProcess
103
+
104
+
105
+ _concrete_contexts.update(
106
+ dict(nestable_spawn=_NestableSpawnContext())
107
+ )
@@ -0,0 +1,44 @@
1
+ """Copy of StrEnum for python <= 3.10 support."""
2
+
3
+
4
+ from enum import Enum
5
+
6
+
7
+ class ReprEnum(Enum):
8
+ """
9
+ Only changes the repr(), leaving str() and format() to the mixed-in type.
10
+ """
11
+
12
+
13
+ # noinspection PyMethodParameters,PySingleQuotedDocstring
14
+ class StrEnum(str, ReprEnum):
15
+ """
16
+ Enum where members are also (and must be) strings
17
+ """
18
+
19
+ def __new__(cls, *values):
20
+ "values must already be of type `str`"
21
+ if len(values) > 3:
22
+ raise TypeError('too many arguments for str(): %r' % (values, ))
23
+ if len(values) == 1:
24
+ # it must be a string
25
+ if not isinstance(values[0], str):
26
+ raise TypeError('%r is not a string' % (values[0], ))
27
+ if len(values) >= 2:
28
+ # check that encoding argument is a string
29
+ if not isinstance(values[1], str):
30
+ raise TypeError('encoding must be a string, not %r' % (values[1], ))
31
+ if len(values) == 3:
32
+ # check that errors argument is a string
33
+ if not isinstance(values[2], str):
34
+ raise TypeError('errors must be a string, not %r' % (values[2]))
35
+ value = str(*values)
36
+ member = str.__new__(cls, value)
37
+ member._value_ = value
38
+ return member
39
+
40
+ def _generate_next_value_(name, start, count, last_values):
41
+ """
42
+ Return the lower-cased version of the member name.
43
+ """
44
+ return name.lower()
pyfemtet/core.py CHANGED
@@ -1,52 +1,20 @@
1
- class ModelError(Exception):
2
- """Exception raised for errors in the model update.
3
-
4
- If this exception is thrown during an optimization calculation, the process attempts to skip that attempt if possible.
5
-
6
- """
7
- pass
8
-
9
-
10
- class MeshError(Exception):
11
- """Exception raised for errors in the meshing.
12
-
13
- If this exception is thrown during an optimization calculation, the process attempts to skip that attempt if possible.
14
-
15
- """
16
- pass
17
-
18
-
19
- class SolveError(Exception):
20
- """Exception raised for errors in the solver.
21
-
22
- If this exception is thrown during an optimization calculation, the process attempts to skip that attempt if possible.
23
-
24
- """
25
- pass
26
-
27
-
28
- # class PostError(Exception):
29
- # pass
30
-
31
-
32
- # class FEMCrash(Exception):
33
- # pass
1
+ from pyfemtet._i18n import _
34
2
 
35
3
 
36
- class FemtetAutomationError(Exception):
37
- """Exception raised for errors in automating Femtet."""
4
+ class DeprecationError(Exception):
38
5
  pass
39
6
 
40
7
 
41
- def _version(
42
- main=None,
43
- major=None,
44
- minor=None,
45
- Femtet=None,
46
- ):
47
- if Femtet is not None:
48
- assert (main is None) and (major is None) and (minor is None), 'バージョンを指定しないでください'
49
- main, major, minor = [int(v) for v in Femtet.Version.split('.')[:3]]
50
- else:
51
- assert (main is not None) and (major is not None) and (minor is not None), 'バージョンを指定してください'
52
- return main*10000 + major*100 + minor
8
+ raise DeprecationError(_(
9
+ en_message='Starting from version 1.0, the import '
10
+ 'method for the Error classes has changed. '
11
+ 'Please change imports such as '
12
+ '`from pyfemtet.core import ModelError` '
13
+ 'to `from pyfemtet.opt.exceptions import ModelError`. '
14
+ 'For more details, please see https://pyfemtet.readthedocs.io/en/stable/pages/migration_to_v1.html.',
15
+ jp_message='バージョン 1.0.0 からは、Error クラスのインポート方法が'
16
+ '変わりました。`from pyfemtet.core import ModelError` '
17
+ 'などは、 `from pyfemtet.opt.exceptions import ModelError` '
18
+ 'としてください。'
19
+ '詳しくは、https://pyfemtet.readthedocs.io/ja/stable/pages/migration_to_v1.html をご覧ください。',
20
+ ))
@@ -1,11 +1,8 @@
1
- from pyfemtet.dispatch_extensions._impl import (
2
- dispatch_femtet,
3
- dispatch_specific_femtet,
4
- launch_and_dispatch_femtet,
5
- DispatchExtensionException,
6
- FemtetNotFoundException,
7
- FemtetConnectionTimeoutError,
8
- IFemtet,
9
- _get_pid,
10
- _get_pids,
11
- )
1
+ from ._impl import *
2
+
3
+ __all__ = [
4
+ 'launch_and_dispatch_femtet',
5
+ 'dispatch_femtet',
6
+ 'dispatch_specific_femtet',
7
+ 'DispatchExtensionException',
8
+ ]